diff --git "a/pgsql-performance.200504" "b/pgsql-performance.200504" new file mode 100644--- /dev/null +++ "b/pgsql-performance.200504" @@ -0,0 +1,71164 @@ +From pgsql-performance-owner@postgresql.org Fri Apr 1 03:01:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1F4AD5352E + for ; + Fri, 1 Apr 2005 03:01:13 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70051-09 + for ; + Fri, 1 Apr 2005 02:01:11 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 18022534E3 + for ; + Fri, 1 Apr 2005 03:01:10 +0100 (BST) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Thu, 31 Mar 2005 18:04:10 -0800 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Thu, 31 Mar 2005 18:04:06 -0800 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005033118040629150 + for ; + Thu, 31 Mar 2005 18:04:06 -0800 +X-ASG-Debug-ID: 1112320869-14512-6-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail2 (mail2.hq.corp [192.168.160.6]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 6E7372005D94 + for ; + Thu, 31 Mar 2005 18:01:09 -0800 (PST) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Thu, 31 Mar 2005 18:04:01 -0800 +Message-ID: <424CAB5D.9020807@sfnet.cc> +Date: Fri, 01 Apr 2005 02:01:01 +0000 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +Cc: pgsql-performance@postgresql.org +X-ASG-Orig-Subj: Follow-Up: How to improve db performance with $7K? +Subject: Follow-Up: How to improve db performance with $7K? +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> +In-Reply-To: <1112107974.7903.28.camel@sixtyfour.internetstaff.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 01 Apr 2005 02:04:01.0778 (UTC) + FILETIME=[12F53520:01C5365F] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: -0.90 +X-Barracuda-Spam-Status: No, SCORE=-0.90 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_30 +X-Barracuda-Spam-Report: Code version 2.64, rules version 2.1.2403 + Rule breakdown below pts rule name description + ---- ---------------------- ------------------------------------------- + -0.90 BAYES_30 BODY: Bayesian spam probability is 30 to 40% + [score: 0.3961] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.219 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/1 +X-Sequence-Number: 11398 + +Thanks for everyone's feedback on to best improve our Postgresql +database for the animal hospital. I re-read the PostgreSQL 8.0 +Performance Checklist just to keep focused. + +We purchased (2) 4 x 146GB 10,000rpm SCSI U320 SCA drive arrays ($2600) +and (1) Sun W2100z dual AMD64 workstation with 4GB RAM ($2500). We did +not need a rack-mount server, so I though Sun's workstation would do +fine. I'll double the RAM. Hopefully, this should out-perform our dual +2.8 Xeon with 4GB of RAM. + +Now, we need to purchase a good U320 RAID card now. Any suggestions for +those which run well under Linux? + +These two drive arrays main purpose is for our database. For those +messed with drive arrays before, how would you slice-up the drive array? +Will database performance be effected how our RAID10 is configured? Any +suggestions? + +Thanks. + +Steve Poe + + + + +From pgsql-performance-owner@postgresql.org Fri Apr 1 05:03:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B9ED53758 + for ; + Fri, 1 Apr 2005 05:03:42 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31797-01 + for ; + Fri, 1 Apr 2005 04:03:33 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 4BF9853557 + for ; + Fri, 1 Apr 2005 05:03:32 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id j1so550637rnf + for ; + Thu, 31 Mar 2005 20:03:32 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=GpNeKNnzTOFgr6jcKfDCeU6z/JNcxxpf0M+uVuoVBE49Q/JMehVTvG0NXcl40SFFCIsmkZSfgvhaflBkOEg7n7XPTYZJVYYPXvPRYzQIira3swSlH91y5y52xrxiE9xebK9NBacuLIIy11HfwRH3P5xKEbQuGWcvXV0U+BMbG9Y= +Received: by 10.38.126.71 with SMTP id y71mr2060801rnc; + Thu, 31 Mar 2005 20:03:32 -0800 (PST) +Received: by 10.38.82.47 with HTTP; Thu, 31 Mar 2005 20:03:32 -0800 (PST) +Message-ID: +Date: Thu, 31 Mar 2005 22:03:32 -0600 +From: Yudie Pg +Reply-To: Yudie Pg +To: pgsql-performance@postgresql.org +Subject: Re: How to speed up word count in tsearch2? +In-Reply-To: <200503311250.45932.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: + <200503311250.45932.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.246 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/2 +X-Sequence-Number: 11399 + +> You need to look at what else is using RAM on that machine. And maybe buy +> more. + +Ouch.. I had that feeling also. then how can I know how much memory +needed for certain amount words? and why counting uncommon words are +faster than common one? + +From pgsql-performance-owner@postgresql.org Fri Apr 1 09:10:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 332C153A41 + for ; + Fri, 1 Apr 2005 09:10:09 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21080-02 + for ; + Fri, 1 Apr 2005 08:10:05 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id 44ACA53A11 + for ; + Fri, 1 Apr 2005 09:10:02 +0100 (BST) +Received: (qmail 30492 invoked from network); 1 Apr 2005 08:10:00 -0000 +Received: from c-66-30-13-6.hsd1.ma.comcast.net (HELO ?192.168.0.101?) + (66.30.13.6) by 0 with SMTP; 1 Apr 2005 08:10:00 -0000 +In-Reply-To: <424CAB5D.9020807@sfnet.cc> +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Thomas F.O'Connell +Subject: Re: Follow-Up: How to improve db performance with $7K? +Date: Fri, 1 Apr 2005 03:09:50 -0500 +To: Steve Poe +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/3 +X-Sequence-Number: 11400 + +I'd use two of your drives to create a mirrored partition where pg_xlog +resides separate from the actual data. + +RAID 10 is probably appropriate for the remaining drives. + +Fortunately, you're not using Dell, so you don't have to worry about +the Perc3/Di RAID controller, which is not so compatible with Linux... + +-tfo + + -- + Thomas F. O'Connell + Co-Founder, Information Architect + Sitening, LLC + http://www.sitening.com/ + 110 30th Avenue North, Suite 6 + Nashville, TN 37203-6320 + 615-260-0005 + +On Mar 31, 2005, at 9:01 PM, Steve Poe wrote: + +> Thanks for everyone's feedback on to best improve our Postgresql +> database for the animal hospital. I re-read the PostgreSQL 8.0 +> Performance Checklist just to keep focused. +> +> We purchased (2) 4 x 146GB 10,000rpm SCSI U320 SCA drive arrays +> ($2600) and (1) Sun W2100z dual AMD64 workstation with 4GB RAM +> ($2500). We did not need a rack-mount server, so I though Sun's +> workstation would do fine. I'll double the RAM. Hopefully, this should +> out-perform our dual 2.8 Xeon with 4GB of RAM. +> +> Now, we need to purchase a good U320 RAID card now. Any suggestions +> for those which run well under Linux? +> +> These two drive arrays main purpose is for our database. For those +> messed with drive arrays before, how would you slice-up the drive +> array? Will database performance be effected how our RAID10 is +> configured? Any suggestions? +> +> Thanks. +> +> Steve Poe + + +From pgsql-performance-owner@postgresql.org Fri Apr 1 11:05:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A0C9539DD + for ; + Fri, 1 Apr 2005 11:05:50 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50613-05 + for ; + Fri, 1 Apr 2005 10:05:41 +0000 (GMT) +Received: from michael.eatserver.nl (michael.eatserver.nl [212.203.14.103]) + by svr1.postgresql.org (Postfix) with ESMTP id 680105379A + for ; + Fri, 1 Apr 2005 11:05:40 +0100 (BST) +Received: from linux (82-168-44-140-bbxl.xdsl.tiscali.nl [82.168.44.140]) + (authenticated bits=0) + by michael.eatserver.nl (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id + j31ABpQW032394 + for ; Fri, 1 Apr 2005 12:11:51 +0200 +From: "H.J. Sanders" +To: +Subject: date - range +Date: Fri, 1 Apr 2005 12:05:44 +0200 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Importance: Normal +X-Virus-Scanned: by amavisd-new +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/4 +X-Sequence-Number: 11401 + + +Anybody a solution for the next problem: + +people can subscribe to a service for 1 or more days (upto a max. of 365). + +So in the database is stored: first_date and last_date + +To select which people are subscribed for a certain date (e.g. today) we use +a select like + +select ....... where first_date <= today and last_date >= today + +Whatever index we create system always does a sequential scan (which I can +understand). + +Has someone a smarter solution? + +All suggestions will be welcomed. + + + +From pgsql-performance-owner@postgresql.org Fri Apr 1 13:17:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B27D95323C + for ; + Fri, 1 Apr 2005 13:17:56 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99564-05 + for ; + Fri, 1 Apr 2005 12:17:53 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) + by svr1.postgresql.org (Postfix) with ESMTP id 7BC3153237 + for ; + Fri, 1 Apr 2005 13:17:52 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id j1so630600rnf + for ; + Fri, 01 Apr 2005 04:17:56 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=uD35jnMWyrkhQp/a32/jUmKE02UkXF/ovfTMw8IDQN/fBxacTuc59eix02H50VmqjddUjH7vPOOUjgA/8wuWGQwJVzRVmP6Av3ycrsPYVjFFhFcKFLIpU6bNc1PYigsjoHlhaE5w0QeuTxpH7bptat/mjfrNIOdWSNA6PPrhknU= +Received: by 10.38.15.55 with SMTP id 55mr2334649rno; + Fri, 01 Apr 2005 04:17:56 -0800 (PST) +Received: by 10.38.126.31 with HTTP; Fri, 1 Apr 2005 04:17:56 -0800 (PST) +Message-ID: +Date: Fri, 1 Apr 2005 12:17:56 +0000 +From: Mike Rylander +Reply-To: Mike Rylander +To: Yudie Pg +Subject: Re: How to speed up word count in tsearch2? +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: + <200503311250.45932.josh@agliodbs.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.25 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/5 +X-Sequence-Number: 11402 + +On Apr 1, 2005 4:03 AM, Yudie Pg wrote: +> > You need to look at what else is using RAM on that machine. And maybe buy +> > more. +> +> Ouch.. I had that feeling also. then how can I know how much memory +> needed for certain amount words? and why counting uncommon words are +> faster than common one? + +Because the index is a tree. You fall of the end of a branch faster +with uncommon words. Plus the executor goes back to the table for +fewer real rows with uncommon words. + +It sounds like you may just need a faster disk subsystem. That would +shrink the time for the first query on any particular set of words, +and it would make everything else faster as a nice side effect. What +does your disk layout look like now? + +-- +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Fri Apr 1 15:54:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3902E5322E + for ; + Fri, 1 Apr 2005 15:54:44 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53305-01 + for ; + Fri, 1 Apr 2005 14:54:43 +0000 (GMT) +Received: from ns1.bi.lt (ns.bi.lt [213.226.131.131]) + by svr1.postgresql.org (Postfix) with ESMTP id 96DAA5322B + for ; + Fri, 1 Apr 2005 15:54:40 +0100 (BST) +Received: from B027543 (inet.bee.lt [213.226.131.30]) + by ns1.bi.lt (8.12.11/8.12.11) with SMTP id j31Esicf010193 + for ; Fri, 1 Apr 2005 17:54:44 +0300 +Message-ID: <026901c536ca$bdd40690$f20214ac@bite.lt> +From: "Mindaugas Riauba" +To: +Subject: Tuning PostgreSQL +Date: Fri, 1 Apr 2005 17:54:44 +0300 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="windows-1257" +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2800.1437 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.835 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/6 +X-Sequence-Number: 11403 + + + Hello, + + What would be reasonable settings for quite heavily used +but not large database? + + Dabatase is under 1G in size and fits into server cache (server +has 2GB of memeory). Two of most used tables are ~100k rows each +but they get up to 50inserts/updates/deletes per second. + + How to tweak fsm (?) and pg_auovacuum settings for such case? +What I do not like about one table is "unused item pointers" number. + Now I use max_fsm_relations=1000 and max_fsm_pages=200000. +pg_autovacuum ran with default settings. + + Thanks, + + Mindaugas + +# VACUUM VERBOSE msq; +INFO: vacuuming "msq" +INFO: index "msq_next" now contains 74983 row versions in 537 pages +DETAIL: 75963 index row versions were removed. +123 index pages have been deleted, 0 are currently reusable. +CPU 0.05s/0.13u sec elapsed 2.00 sec. +INFO: index "msq_recipient_idx" now contains 75014 row versions in 740 +pages +DETAIL: 75963 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.00s/0.16u sec elapsed 0.17 sec. +INFO: index "msq_id_pk" now contains 75065 row versions in 396 pages +DETAIL: 75963 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.01s/0.15u sec elapsed 0.17 sec. +INFO: "msq": removed 75963 row versions in 6118 pages +DETAIL: CPU 0.62s/0.56u sec elapsed 17.02 sec. +INFO: "msq": found 75963 removable, 74553 nonremovable row versions in +49386 pages +DETAIL: 1221 dead row versions cannot be removed yet. +There were 1634616 unused item pointers. +0 pages are entirely empty. +CPU 1.36s/1.24u sec elapsed 33.23 sec. + + +From pgsql-performance-owner@postgresql.org Fri Apr 1 17:17:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C81952A2F + for ; + Fri, 1 Apr 2005 17:17:08 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79062-01 + for ; + Fri, 1 Apr 2005 16:16:59 +0000 (GMT) +Received: from ncspsmtp2.ncs.com (ncspsmtp2.ncs.com [159.182.31.5]) + by svr1.postgresql.org (Postfix) with ESMTP id 0029753C09 + for ; + Fri, 1 Apr 2005 17:16:57 +0100 (BST) +Received: from chmpgexgmail1.nn.com (Not Verified[159.182.46.46]) by + ncspsmtp2.ncs.com with NetIQ MailMarshal (v5.5.6.7) + id ; Fri, 01 Apr 2005 10:13:25 -0600 +Received: by CHMPGEXGMAIL1 with Internet Mail Service (5.5.2657.72) + id ; Fri, 1 Apr 2005 10:14:12 -0600 +Message-ID: + <42E7C401A4CBCD49829BB53DDD538BA40211439B@chmpgexgmail3.ic.ncs.com> +From: "Peterson, Bjorn" +To: pgsql-performance@postgresql.org +Subject: enable_XXX options +Date: Fri, 1 Apr 2005 10:04:08 -0600 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C536D4.6F78EDD0" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + HTML_MESSAGE, HTML_NONELEMENT_20_30 +X-Spam-Level: +X-Archive-Number: 200504/7 +X-Sequence-Number: 11404 + +This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +------_=_NextPart_001_01C536D4.6F78EDD0 +Content-Type: text/plain + +I have a query in my application that takes an unreasonable amount of time +to complete (>4.5 hours execution time). After reviewing the EXPLAIN and +EXPLAIN ANALYZE output for that and similar queries, my colleagues and I +determined that turning off the enable_nestloop option might help - we +noticed dramatic speed improvements for that specific query after doing so +(<2 minutes execution time). I was warned not to mess with the enable_XXX +options in a production environment, but does anyone see any problem with +turning off the enable_nestloop option right before executing my query and +turning it back on afterwards? + + + +Bjorn Peterson + +Software Engineer + +Pearson School Technologies + +Bloomington, MN + +(952) 681-3384 + + + + +**************************************************************************** +This email may contain confidential material. +If you were not an intended recipient, +Please notify the sender and delete all copies. +We may monitor email to and from our network. +**************************************************************************** + +------_=_NextPart_001_01C536D4.6F78EDD0 +Content-Type: text/html +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + + + + + + + + +
+ +

I have a query in my application that takes an unreaso= +nable +amount of time to complete (>4.5 hours execution time).   Af= +ter +reviewing the EXPLAIN and EXPLAIN ANALYZE output for that and similar que= +ries, +my colleagues and I determined that turning off the enable_nestloop optio= +n +might help – we noticed dramatic speed improvements for that specif= +ic query +after doing so (<2 minutes execution time).  I was warned not to = +mess +with the enable_XXX options in a production environment, but does anyone = +see +any problem with turning off the enable_nestloop option right before exec= +uting +my query and turning it back on afterwards?

+ +

 

+ +

Bjorn Peterson

+ +

Software Engineer

+ +

Pears= +on School Technolo= +gies

+ +

Bloom= +ington, MN

+ +

(952) 681-3384

+ +

 

+ +
+ + +************************************************************= +****************=20 +

+

This email may contain confidential
material. If you = +were not=20 +an intended recipient,
Please notify the sender and delete all copies= +.=20 +
We may monitor email to and from our network.

+ ******************************************************= +*********************=20 +

+
 
+ + + + +------_=_NextPart_001_01C536D4.6F78EDD0-- + +From pgsql-performance-owner@postgresql.org Fri Apr 1 17:20:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C690952A2F + for ; + Fri, 1 Apr 2005 17:20:36 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78823-05 + for ; + Fri, 1 Apr 2005 16:20:28 +0000 (GMT) +Received: from mail.99main.com (mail.99main.com [208.28.184.11]) + by svr1.postgresql.org (Postfix) with ESMTP id D0F6253326 + for ; + Fri, 1 Apr 2005 17:20:26 +0100 (BST) +Received: from 99main.com (localhost [127.0.0.1]) + by mail.99main.com (8.12.8+Sun/8.12.8) with ESMTP id j31GKPc2003485 + for ; + Fri, 1 Apr 2005 11:20:25 -0500 (EST) +From: "Keith Worthington" +To: "PostgreSQL Perform" +Reply-To: KeithW@narrowpathinc.com +Subject: Triggers with FOR EACH STATEMENT +Date: Fri, 1 Apr 2005 11:20:25 -0500 +Message-Id: <20050401161901.M13616@narrowpathinc.com> +X-Mailer: Open WebMail 2.50 20050106 +X-OriginatingIP: 68.235.22.242 (npkeithw) +MIME-Version: 1.0 +Content-Type: text/plain; + charset=iso-8859-1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/8 +X-Sequence-Number: 11405 + +Hi All, + +I have a trigger function that copies data from an input table to a table in +the actual data model. The data model table has a trigger after update on it. + Is the first trigger fired after the copy terminates or after each insert? +Is the second trigger fired after the first trigger is complete or once for +every iteration of the loop in the first trigger? I only want these triggers +to fire after the previous action is complete. That is what I thought I was +getting when I chose the FOR EACH STATEMENT attribute. Here are excerpts from +the various programs that are running. Your thoughts are appreciated. + + From a bash shell COPY is used to put data in the input table. + cat ${v_load_dir}/${v_filename}.ld | \ + psql --echo-all \ + --dbname ${DB} \ + --username dbuser \ + --command \ + "COPY tbl_status + FROM stdin + WITH DELIMITER AS ',' + NULL AS '';" + +The input table has an AFTER-INSERT-STATEMENT trigger. + CREATE TRIGGER tgr_xfr_status + AFTER INSERT + ON tbl_status + FOR EACH STATEMENT + EXECUTE PROCEDURE tf_xfr_status(); + +The input table trigger uses a LOOP to process each newly inserted record. + FOR rcrd_order IN SELECT... + LOOP +-- Now update the information in the detail table. + UPDATE tbl_detail + SET closed = rcrd_order.closed + WHERE tbl_detail.number = rcrd_order.so_number; + END LOOP; + +The data model table has an AFTER-UPDATE-STATEMENT trigger. + CREATE TRIGGER tgr_update_allocated + AFTER UPDATE + ON tbl_detail + FOR EACH STATEMENT + EXECUTE PROCEDURE tf_update_allocated(); + +Kind Regards, +Keith + +From pgsql-performance-owner@postgresql.org Fri Apr 1 17:36:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BA55353BE0 + for ; + Fri, 1 Apr 2005 17:36:48 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84648-01 + for ; + Fri, 1 Apr 2005 16:36:45 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 935D253BAE + for ; + Fri, 1 Apr 2005 17:36:45 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j31Gah9p007069; + Fri, 1 Apr 2005 11:36:43 -0500 (EST) +To: "Peterson, Bjorn" +Cc: pgsql-performance@postgresql.org +Subject: Re: enable_XXX options +In-reply-to: + <42E7C401A4CBCD49829BB53DDD538BA40211439B@chmpgexgmail3.ic.ncs.com> +References: + <42E7C401A4CBCD49829BB53DDD538BA40211439B@chmpgexgmail3.ic.ncs.com> +Comments: In-reply-to "Peterson, Bjorn" + message dated "Fri, 01 Apr 2005 10:04:08 -0600" +Date: Fri, 01 Apr 2005 11:36:43 -0500 +Message-ID: <7068.1112373403@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/9 +X-Sequence-Number: 11406 + +"Peterson, Bjorn" writes: +> I have a query in my application that takes an unreasonable amount of time +> to complete (>4.5 hours execution time). After reviewing the EXPLAIN and +> EXPLAIN ANALYZE output for that and similar queries, my colleagues and I +> determined that turning off the enable_nestloop option might help - we +> noticed dramatic speed improvements for that specific query after doing so +> (<2 minutes execution time). I was warned not to mess with the enable_XXX +> options in a production environment, but does anyone see any problem with +> turning off the enable_nestloop option right before executing my query and +> turning it back on afterwards? + +That's what it's there for ... but it would be useful to look into why +the planner gets it so wrong without that hint. Could we see EXPLAIN +ANALYZE both ways? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 1 18:03:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 810F85341B + for ; + Fri, 1 Apr 2005 18:03:26 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92329-06 + for ; + Fri, 1 Apr 2005 17:03:17 +0000 (GMT) +Received: from ncspsmtp2.ncs.com (ncspsmtp2.ncs.com [159.182.31.5]) + by svr1.postgresql.org (Postfix) with ESMTP id 61E4A533D7 + for ; + Fri, 1 Apr 2005 18:03:15 +0100 (BST) +Received: from mesa-mx2.mesa.ncs.com (Not Verified[159.182.107.66]) by + ncspsmtp2.ncs.com with NetIQ MailMarshal (v5.5.6.7) + id ; Fri, 01 Apr 2005 10:59:42 -0600 +Received: by mesa-mx2.mesa.ncs.com with Internet Mail Service (5.5.2657.72) + id ; Fri, 1 Apr 2005 09:51:55 -0700 +Message-ID: + <42E7C401A4CBCD49829BB53DDD538BA402114414@chmpgexgmail3.ic.ncs.com> +From: "Peterson, Bjorn" +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: enable_XXX options +Date: Fri, 1 Apr 2005 09:50:58 -0700 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: text/plain +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/10 +X-Sequence-Number: 11407 + +-----Original Message----- +>From: Tom Lane [mailto:tgl@sss.pgh.pa.us] +>Sent: Friday, April 01, 2005 10:37 AM +>To: Peterson, Bjorn +>Cc: pgsql-performance@postgresql.org +>Subject: Re: [PERFORM] enable_XXX options +> +>"Peterson, Bjorn" writes: +>> I have a query in my application that takes an unreasonable amount of +time +>> to complete (>4.5 hours execution time). After reviewing the EXPLAIN +and +>> EXPLAIN ANALYZE output for that and similar queries, my colleagues and I +>> determined that turning off the enable_nestloop option might help - we +>> noticed dramatic speed improvements for that specific query after doing +so +>> (<2 minutes execution time). I was warned not to mess with the +enable_XXX +>> options in a production environment, but does anyone see any problem with +>> turning off the enable_nestloop option right before executing my query +and +>> turning it back on afterwards? +> +>That's what it's there for ... but it would be useful to look into why +>the planner gets it so wrong without that hint. Could we see EXPLAIN +>ANALYZE both ways? +> +> regards, tom lane +> + + +Below is my query and the output of EXPLAIN - I was not able to run EXPLAIN +ANALYZE, as the query never completes unless we turn enable_nestloop off: + +SELECT t.term_id AS term_id, a.user_id AS user_id, a.time_slot AS course_id, +a.attendance_status AS status, SUM(CASE WHEN a.attendance_date>=t.start_date +THEN 1 ELSE 0 END) AS cur_total, COUNT(a.attendance_date) AS ytd_total FROM +"Attendance" a, "Terms" t, "Terms" ytd, "CoursesUsers" cu, "Courses" c, +"CoursesOffered" co, "Schools" s WHERE a.attendance_type=1 AND +a.attendance_status IN(3,4,1,2) AND a.attendance_date>=ytd.start_date AND +a.attendance_date<=t.end_date AND a.attendance_date<=now() AND +a.user_id=cu.user_id AND a.time_slot=cu.course_id AND +cu.course_id=c.course_id AND co.course_offered_id=c.course_offered_id AND +co.school_id=s.school_id AND s.district_id=2 AND ytd.term_id=t.top_term_id +AND c.course_id IN +(221,395,244,394,366,370,400,11,373,369,392,406,398,381,391,393,403,376,220, +846,440,935,910,431,428,904,905,222,201,453,913,1794,408,901,856,424,443,175 +0,452,461,462,471,463,911,489,821,916,501,223) GROUP BY a.user_id, +a.time_slot, t.term_id, a.attendance_status ORDER BY a.user_id, a.time_slot, +t.term_id, a.attendance_status + +The Attendance table is the largest (about 2 million records), Terms has +about 50 records, CoursesUsers has about 30,000 records, Courses has about +2000 records, CoursesOffered has about 1000 records, and Schools has 3 +records. The purpose of this query is to retrieve the number of absences +for each student/course/term combination - we need separate totals for +year-to-date (from the start of the school year), and for absences only +within the current term. Every field referenced in the WHERE clause has an +appropriate single or multi-column index. + +We are using the standard PostgreSQL JDBC driver and the only parameter +being set in this query is the district_id (s.district_id=2). We are +running Postgres 8.0.1 on a Windows 2000 server. + + +With enable_nestloop on (default): + +QUERY PLAN +GroupAggregate (cost=4674.63..4677.13 rows=100 width=22) + -> Sort (cost=4674.63..4674.88 rows=100 width=22) + Sort Key: a.user_id + -> Nested Loop (cost=276.69..4671.30 rows=100 width=22) + Join Filter: (("outer".attendance_date <= "inner".end_date) +AND ("outer".attendance_date >= "inner".start_date)) + -> Hash Join (cost=273.30..4649.92 rows=20 width=14) + Hash Cond: ("outer".school_id = "inner".school_id) + -> Nested Loop (cost=272.26..4648.50 rows=25 width=18) + -> Hash Join (cost=272.26..986.69 rows=836 +width=16) + Hash Cond: ("outer".course_offered_id = +"inner".course_offered_id) + -> Hash Join (cost=246.81..948.70 rows=836 +width=16) + Hash Cond: ("outer".course_id = +"inner".course_id) + -> Seq Scan on "CoursesUsers" cu +(cost=0.00..545.02 rows=29702 width=8) + -> Hash (cost=246.68..246.68 rows=49 +width=8) + -> Seq Scan on "Courses" c +(cost=0.00..246.68 rows=49 width=8) + Filter: ((course_id = 221) +OR (course_id = 395) OR (course_id = 244) OR (course_id = 394) OR (course_id += 366) OR (course_id = 370) OR (course_id = 400) OR (course_id = 11) OR +(course_id = 373) OR (course_i (..) + -> Hash (cost=23.36..23.36 rows=836 +width=8) + -> Seq Scan on "CoursesOffered" co +(cost=0.00..23.36 rows=836 width=8) + -> Index Scan using "Attendance_pkey" on +"Attendance" a (cost=0.00..4.37 rows=1 width=14) + Index Cond: ((a.attendance_date <= now()) +AND (a.attendance_type = 1) AND ("outer".course_id = a.time_slot) AND +(a.user_id = "outer".user_id)) + Filter: ((attendance_status = 3) OR +(attendance_status = 4) OR (attendance_status = 1) OR (attendance_status = +2)) + -> Hash (cost=1.04..1.04 rows=3 width=4) + -> Seq Scan on "Schools" s (cost=0.00..1.04 +rows=3 width=4) + Filter: (district_id = 2) + -> Materialize (cost=3.39..3.75 rows=36 width=16) + -> Hash Join (cost=1.45..3.35 rows=36 width=16) + Hash Cond: ("outer".top_term_id = "inner".term_id) + -> Seq Scan on "Terms" t (cost=0.00..1.36 +rows=36 width=16) + -> Hash (cost=1.36..1.36 rows=36 width=8) + -> Seq Scan on "Terms" ytd +(cost=0.00..1.36 rows=36 width=8) + +------------------------------------------------------------------------- + +After turning enable_nestloop off: + +QUERY PLAN +GroupAggregate (cost=100078595.13..100078597.63 rows=100 width=22) + -> Sort (cost=100078595.13..100078595.38 rows=100 width=22) + Sort Key: a.user_id + -> Nested Loop (cost=100078571.91..100078591.81 rows=100 width=22) + Join Filter: (("inner".attendance_date <= "outer".end_date) +AND ("inner".attendance_date >= "outer".start_date)) + -> Hash Join (cost=1.45..3.35 rows=36 width=16) + Hash Cond: ("outer".top_term_id = "inner".term_id) + -> Seq Scan on "Terms" t (cost=0.00..1.36 rows=36 +width=16) + -> Hash (cost=1.36..1.36 rows=36 width=8) + -> Seq Scan on "Terms" ytd (cost=0.00..1.36 +rows=36 width=8) + -> Materialize (cost=78570.46..78570.66 rows=20 width=14) + -> Hash Join (cost=991.91..78570.44 rows=20 width=14) + Hash Cond: ("outer".school_id = "inner".school_id) + -> Hash Join (cost=990.87..78569.02 rows=25 +width=18) + Hash Cond: (("outer".time_slot = +"inner".course_id) AND ("outer".user_id = "inner".user_id)) + -> Seq Scan on "Attendance" a +(cost=0.00..75599.26 rows=79148 width=14) + Filter: ((attendance_type = 1) AND +((attendance_status = 3) OR (attendance_status = 4) OR (attendance_status = +1) OR (attendance_status = 2)) AND (attendance_date <= now())) + -> Hash (cost=986.69..986.69 rows=836 +width=16) + -> Hash Join (cost=272.26..986.69 +rows=836 width=16) + Hash Cond: +("outer".course_offered_id = "inner".course_offered_id) + -> Hash Join +(cost=246.81..948.70 rows=836 width=16) + Hash Cond: +("outer".course_id = "inner".course_id) + -> Seq Scan on +"CoursesUsers" cu (cost=0.00..545.02 rows=29702 width=8) + -> Hash +(cost=246.68..246.68 rows=49 width=8) + -> Seq Scan on +"Courses" c (cost=0.00..246.68 rows=49 width=8) + Filter: +((course_id = 221) OR (course_id = 395) OR (course_id = 244) OR (course_id = +394) OR (course_id = 366) OR (course_id = 370) OR (course_id = 400) OR +(course_id = 11) OR (course_id = 373) (..) + -> Hash (cost=23.36..23.36 +rows=836 width=8) + -> Seq Scan on +"CoursesOffered" co (cost=0.00..23.36 rows=836 width=8) + -> Hash (cost=1.04..1.04 rows=3 width=4) + -> Seq Scan on "Schools" s +(cost=0.00..1.04 rows=3 width=4) + Filter: (district_id = 2) + + + + +**************************************************************************** +This email may contain confidential material. +If you were not an intended recipient, +Please notify the sender and delete all copies. +We may monitor email to and from our network. +**************************************************************************** + +From pgsql-performance-owner@postgresql.org Fri Apr 1 18:27:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F4295343A + for ; + Fri, 1 Apr 2005 18:27:54 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96927-10 + for ; + Fri, 1 Apr 2005 17:27:52 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id F07E153421 + for ; + Fri, 1 Apr 2005 18:27:51 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j31HRorS015286; + Fri, 1 Apr 2005 12:27:50 -0500 (EST) +To: "Peterson, Bjorn" +Cc: pgsql-performance@postgresql.org +Subject: Re: enable_XXX options +In-reply-to: + <42E7C401A4CBCD49829BB53DDD538BA402114414@chmpgexgmail3.ic.ncs.com> +References: + <42E7C401A4CBCD49829BB53DDD538BA402114414@chmpgexgmail3.ic.ncs.com> +Comments: In-reply-to "Peterson, Bjorn" + message dated "Fri, 01 Apr 2005 09:50:58 -0700" +Date: Fri, 01 Apr 2005 12:27:50 -0500 +Message-ID: <15285.1112376470@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/11 +X-Sequence-Number: 11408 + +"Peterson, Bjorn" writes: +>> That's what it's there for ... but it would be useful to look into why +>> the planner gets it so wrong without that hint. Could we see EXPLAIN +>> ANALYZE both ways? + +> Below is my query and the output of EXPLAIN - I was not able to run EXPLAIN +> ANALYZE, as the query never completes unless we turn enable_nestloop off: + +Well, when the point is to find out why the planner's estimates don't +match reality, it's difficult to learn anything by looking only at the +estimates and not at reality. + +Given what you say about the table sizes, the planner's preferred plan +looks somewhat reasonable. I think the weak spot is the assumption that +this index check will be fast: + +> -> Index Scan using "Attendance_pkey" on +> "Attendance" a (cost=0.00..4.37 rows=1 width=14) +> Index Cond: ((a.attendance_date <= now()) +> AND (a.attendance_type = 1) AND ("outer".course_id = a.time_slot) AND +> (a.user_id = "outer".user_id)) + +and the reason this seems like a weak spot is that the plan implies that +you made attendance_date be the first column in the index. At least for +this query, it'd be far better for attendance_date to be the last +column, so that the info for any one user_id is bunched together in the +index. For that matter I'd bet that attendance_type shouldn't be the +highest part of the key either --- either course_id or user_id should +probably be the leading key, depending on what sorts of queries you do. +It wouldn't matter for this query, but you should look to see if you +have other queries that select on only one of the two. + +If you have both equalities and inequalities in an index condition, you +always want the equalities to be on the higher-order keys. Otherwise +the scan will involve wasted scanning over index entries that match +only some of the conditions. (Think about the ordering of a multicolumn +index to see why this is so.) In this particular case I think the thing +will be scanning almost the whole index every time :-( + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 1 19:06:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9073B53221 + for ; + Fri, 1 Apr 2005 19:06:16 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09382-05 + for ; + Fri, 1 Apr 2005 18:06:14 +0000 (GMT) +Received: from hub.org (hub.org [200.46.204.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 90F4452A38 + for ; + Fri, 1 Apr 2005 19:06:14 +0100 (BST) +Received: from localhost (unknown [200.46.204.144]) + by hub.org (Postfix) with ESMTP id 64F0D1291F2 + for ; + Fri, 1 Apr 2005 14:06:14 -0400 (AST) +Received: from hub.org ([200.46.204.220]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10504-02 for ; + Fri, 1 Apr 2005 18:06:04 +0000 (GMT) +Received: from ganymede.hub.org (blk-224-181-254.eastlink.ca [24.224.181.254]) + by hub.org (Postfix) with ESMTP id 45E7F129321 + for ; + Fri, 1 Apr 2005 14:06:04 -0400 (AST) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id DA8E73422B; Fri, 1 Apr 2005 14:06:03 -0400 (AST) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id D6EC1341FC + for ; + Fri, 1 Apr 2005 14:06:03 -0400 (AST) +Date: Fri, 1 Apr 2005 14:06:03 -0400 (AST) +From: "Marc G. Fournier" +X-X-Sender: scrappy@ganymede.hub.org +To: pgsql-performance@postgresql.org +Subject: Sustained inserts per sec ... ? +Message-ID: <20050401140421.P18194@ganymede.hub.org> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.267 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/12 +X-Sequence-Number: 11409 + + +Just curious, but does anyone have an idea of what we are capable of? I +realize that size of record would affect things, as well as hardware, but +if anyone has some ideas on max, with 'record size', that would be +appreciated ... + +Thanks ... + +---- +Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) +Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664 + +From pgsql-performance-owner@postgresql.org Fri Apr 1 20:27:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C50953ABB; + Fri, 1 Apr 2005 20:27:14 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34188-01; Fri, 1 Apr 2005 19:27:09 +0000 (GMT) +Received: from gw.tssi.com (gw.tssi.com [198.147.197.1]) + by svr1.postgresql.org (Postfix) with ESMTP id A799553AD0; + Fri, 1 Apr 2005 20:27:07 +0100 (BST) +Received: from gw.tssi.com (nolan@gw.tssi.com [127.0.0.1] (may be forged)) + by gw.tssi.com (8.12.6/8.12.6) with ESMTP id j31JRGZE006426; + Fri, 1 Apr 2005 13:27:16 -0600 +Received: (from nolan@localhost) + by gw.tssi.com (8.12.6/8.12.6/Submit) id j31JRFMK006424; + Fri, 1 Apr 2005 13:27:15 -0600 +From: Mike Nolan +Message-Id: <200504011927.j31JRFMK006424@gw.tssi.com> +Subject: Re: Sustained inserts per sec ... ? +To: scrappy@postgresql.org (Marc G. Fournier) +Date: Fri, 1 Apr 2005 13:27:14 -0600 (CST) +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20050401140421.P18194@ganymede.hub.org> from "Marc G. Fournier" + at Apr 01, 2005 02:06:03 PM +X-Mailer: ELM [version 2.5 PL3] +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/13 +X-Sequence-Number: 11410 + +> Just curious, but does anyone have an idea of what we are capable of? I +> realize that size of record would affect things, as well as hardware, but +> if anyone has some ideas on max, with 'record size', that would be +> appreciated ... + +Well, I just did an insert of 27,500 records with 9 fields, averaging +around 118 bytes per record, each insert statement coming from a separate +SQL statement fed to psql, and it took a bit over 4 minutes, or about +106 inserts per second. + +That seems consistent with what I get when I do a restore of a dump +file that has insert statement instead of COPY. + +The hardware is a Dell dual Xeon system, the disks are mirrored SATA +drives with write buffering turned off. +-- +Mike Nolan + + + +From pgsql-performance-owner@postgresql.org Fri Apr 1 20:38:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F35B53682 + for ; + Fri, 1 Apr 2005 20:38:45 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34315-08 + for ; + Fri, 1 Apr 2005 19:38:36 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.200]) + by svr1.postgresql.org (Postfix) with ESMTP id AE86853232 + for ; + Fri, 1 Apr 2005 20:38:35 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so737961rng + for ; + Fri, 01 Apr 2005 11:38:37 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=tJ34NjFbMZYn0zxyAfPVVY56Czui2d3UIV6BhIGrj46P7aHa6R3UnnPDMfQ89XJwrISUVjblsFvtfQoiNiFhCpVVWM/4XIu1KWVSiYCpvm+vHb5IF9BuO9uvB453d9PtagLi7MabWPXT3a1qNsBPfEgx+/iKosGpRiIgmbyktxM= +Received: by 10.38.69.34 with SMTP id r34mr3076361rna; + Fri, 01 Apr 2005 11:38:36 -0800 (PST) +Received: by 10.38.207.41 with HTTP; Fri, 1 Apr 2005 11:38:36 -0800 (PST) +Message-ID: <59d991c4050401113857086517@mail.gmail.com> +Date: Fri, 1 Apr 2005 14:38:36 -0500 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: "Marc G. Fournier" +Subject: Re: Sustained inserts per sec ... ? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20050401140421.P18194@ganymede.hub.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.228 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/14 +X-Sequence-Number: 11411 + +On Apr 1, 2005 1:06 PM, Marc G. Fournier wrote: +> +> Just curious, but does anyone have an idea of what we are capable of? I +> realize that size of record would affect things, as well as hardware, but +> if anyone has some ideas on max, with 'record size', that would be +> appreciated ... + +On a AMD64/3000, 1Gb RAM, 2 SATA drives (1 for log, 1 for data), and +inserting using batches of 500-1000 rows, and also using the COPY +syntax, I have seen an interesting thing. There are 5 indexes +involved here, BTW. This is Linux 2.6 running on an XFS file system +(ext3 was even worse for me). + +I can start at about 4,000 rows/second, but at about 1M rows, it +plummets, and by 4M it's taking 6-15 seconds to insert 1000 rows. +That's only about 15 rows/second, which is quite pathetic. The +problem seems to be related to my indexes, since I have to keep them +online (the system in continually querying, as well). + +This was an application originally written for MySQL/MYISAM, and it's +looking like PostgreSQL can't hold up for it, simply because it's "too +much database" if that makes sense. The same box, running the MySQL +implementation (which uses no transactions) runs around 800-1000 +rows/second systained. + +Just a point of reference. I'm trying to collect some data so that I +can provide some charts of the degredation, hoping to find the point +where it dies and thereby find the point where it needs attention. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Fri Apr 1 21:42:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D8652539A3; + Fri, 1 Apr 2005 21:42:19 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53995-02; Fri, 1 Apr 2005 20:42:11 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E79AD539C4; + Fri, 1 Apr 2005 21:42:10 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j31Kg8Q5028354; + Fri, 1 Apr 2005 15:42:08 -0500 (EST) +To: Christopher Petrilli +Cc: "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <59d991c4050401113857086517@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Fri, 01 Apr 2005 14:38:36 -0500" +Date: Fri, 01 Apr 2005 15:42:08 -0500 +Message-ID: <28353.1112388128@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/15 +X-Sequence-Number: 11412 + +Christopher Petrilli writes: +> I can start at about 4,000 rows/second, but at about 1M rows, it +> plummets, and by 4M it's taking 6-15 seconds to insert 1000 rows. +> That's only about 15 rows/second, which is quite pathetic. The +> problem seems to be related to my indexes, since I have to keep them +> online (the system in continually querying, as well). + +I doubt it has anything to do with your indexes. I'm wondering about +foreign key checks, myself. What FKs exist on these tables? Is the +"start" condition zero rows in every table? Which PG version exactly? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 1 21:46:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DEC3539AA + for ; + Fri, 1 Apr 2005 21:46:48 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55346-01 + for ; + Fri, 1 Apr 2005 20:46:39 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.193]) + by svr1.postgresql.org (Postfix) with ESMTP id EB292539A6 + for ; + Fri, 1 Apr 2005 21:46:38 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so752903rng + for ; + Fri, 01 Apr 2005 12:46:40 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=BBOT1odQb84hn3OCDsXK/QIjBX9FPjmuQ3zkE0YQ4LST1Jop+UQ7QPwKvHyCGfHl7ZfCqSjForVI4Yv9n2pAuqlUdClxwalRDKwOXLr+5RYWnQV9GwrSDrVwxj1sOZjsEt0yP/H2BkA/mk3IY2csrjlcorgK5w8EroYUn3zFHX0= +Received: by 10.38.87.21 with SMTP id k21mr3045365rnb; + Fri, 01 Apr 2005 12:46:40 -0800 (PST) +Received: by 10.38.207.41 with HTTP; Fri, 1 Apr 2005 12:46:40 -0800 (PST) +Message-ID: <59d991c4050401124638c4ab5d@mail.gmail.com> +Date: Fri, 1 Apr 2005 15:46:40 -0500 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Sustained inserts per sec ... ? +Cc: "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <28353.1112388128@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.24 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/16 +X-Sequence-Number: 11413 + +On Apr 1, 2005 3:42 PM, Tom Lane wrote: +> Christopher Petrilli writes: +> > I can start at about 4,000 rows/second, but at about 1M rows, it +> > plummets, and by 4M it's taking 6-15 seconds to insert 1000 rows. +> > That's only about 15 rows/second, which is quite pathetic. The +> > problem seems to be related to my indexes, since I have to keep them +> > online (the system in continually querying, as well). +> +> I doubt it has anything to do with your indexes. I'm wondering about +> foreign key checks, myself. What FKs exist on these tables? Is the +> "start" condition zero rows in every table? Which PG version exactly? + +Sure, I'm going to post something on my web site when I get some +numbers that will make this more valuable. To answer your question: + +1. No foreign keys (long story, but they just don't exist for this one table) +2. Start condition is zero. I'm using multiple inherited tables to +deal with the data "partitioning" since eventual size is billions of +rows. Each "partition" currently has 10M rows in it as a goal. +3. Version 8.0.2, however I started this experiment with 8.0.0. +4. fsync=off + +What seems to happen is it slams into a "wall" of some sort, the +system goes into disk write frenzy (wait=90% CPU), and eventually +recovers and starts running for a while at a more normal speed. What +I need though, is to not have that wall happen. It is easier for me +to accept a constant degredation of 5%, rather than a 99% degredation +for short periods, as it can cause cascade problems in the system. + +My goal is to gather some numbers, and post code + schema + analysis. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Fri Apr 1 21:53:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D13A4539B5; + Fri, 1 Apr 2005 21:53:50 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53326-10; Fri, 1 Apr 2005 20:53:42 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 378A7535F8; + Fri, 1 Apr 2005 21:53:41 +0100 (BST) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j31Ko0kh010534; Fri, 1 Apr 2005 12:50:00 -0800 +Subject: Re: Sustained inserts per sec ... ? +From: "Joshua D. Drake" +Reply-To: jd@commandprompt.com +To: Christopher Petrilli +Cc: Tom Lane , "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c4050401124638c4ab5d@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> +Content-Type: text/plain +Organization: Joshua D. Drake +Date: Fri, 01 Apr 2005 12:53:38 -0800 +Message-Id: <1112388818.3487.34.camel@jd2.commandprompt.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.4 (2.0.4-2) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/17 +X-Sequence-Number: 11414 + + +> What seems to happen is it slams into a "wall" of some sort, the +> system goes into disk write frenzy (wait=90% CPU), and eventually +> recovers and starts running for a while at a more normal speed. What +> I need though, is to not have that wall happen. It is easier for me +> to accept a constant degredation of 5%, rather than a 99% degredation +> for short periods, as it can cause cascade problems in the system. + +Could this possibly be a checkpoint happening? + +Also how many checkpoint segments do you have? + + +> +> My goal is to gather some numbers, and post code + schema + analysis. +> +> Chris +-- +Command Prompt, Inc., Your PostgreSQL solutions company. 503-667-4564 +Custom programming, 24x7 support, managed services, and hosting +Open Source Authors: plPHP, pgManage, Co-Authors: plPerlNG +Reliable replication, Mammoth Replicator - http://www.commandprompt.com/ + + +From pgsql-performance-owner@postgresql.org Fri Apr 1 21:59:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D5CC539A1; + Fri, 1 Apr 2005 21:58:58 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55058-10; Fri, 1 Apr 2005 20:58:49 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E1CF5387F; + Fri, 1 Apr 2005 21:58:48 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j31KwjkC028518; + Fri, 1 Apr 2005 15:58:45 -0500 (EST) +To: Christopher Petrilli +Cc: "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <59d991c4050401124638c4ab5d@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Fri, 01 Apr 2005 15:46:40 -0500" +Date: Fri, 01 Apr 2005 15:58:45 -0500 +Message-ID: <28517.1112389125@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/18 +X-Sequence-Number: 11415 + +Christopher Petrilli writes: +> What seems to happen is it slams into a "wall" of some sort, the +> system goes into disk write frenzy (wait=90% CPU), and eventually +> recovers and starts running for a while at a more normal speed. + +Checkpoint maybe? If so, tweaking the bgwriter parameters might +improve matters. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 1 21:59:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 710A5535F8 + for ; + Fri, 1 Apr 2005 21:59:56 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57350-05 + for ; + Fri, 1 Apr 2005 20:59:51 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E74752A3A + for ; + Fri, 1 Apr 2005 21:59:50 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so755706rng + for ; + Fri, 01 Apr 2005 12:59:52 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=cLTlLaR6jgipW05+hvgGhaq7f2mVDzRVDG5q4MlAu9oDYRS2IWaCtW3P4issgCAvQGB//ZE8hvVEYS26LmZTc/pU0+51CQl4r/RDX6tgb0FIUWCPRcrLZTQQdVzHiGkBXFNmlC6V5cwsRC8xrBPzYKmU8XRVDI68nK4w28cdDrY= +Received: by 10.38.86.68 with SMTP id j68mr3221241rnb; + Fri, 01 Apr 2005 12:59:52 -0800 (PST) +Received: by 10.38.207.41 with HTTP; Fri, 1 Apr 2005 12:59:52 -0800 (PST) +Message-ID: <59d991c4050401125956d6069d@mail.gmail.com> +Date: Fri, 1 Apr 2005 15:59:52 -0500 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: jd@commandprompt.com +Subject: Re: Sustained inserts per sec ... ? +Cc: Tom Lane , "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <1112388818.3487.34.camel@jd2.commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.266 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/19 +X-Sequence-Number: 11416 + +On Apr 1, 2005 3:53 PM, Joshua D. Drake wrote: +> +> > What seems to happen is it slams into a "wall" of some sort, the +> > system goes into disk write frenzy (wait=90% CPU), and eventually +> > recovers and starts running for a while at a more normal speed. What +> > I need though, is to not have that wall happen. It is easier for me +> > to accept a constant degredation of 5%, rather than a 99% degredation +> > for short periods, as it can cause cascade problems in the system. +> +> Could this possibly be a checkpoint happening? +> +> Also how many checkpoint segments do you have? + +Changes to the postgresql.conf file from "default": + + maintenance_work_mem = 131072 + fsync = false + checkpoint_segments = 32 + +I set the checkpoint segments up until it no longer complained about +them rolling over. That was the best "advice" I could find online. +The maintenance_work_mem I upped to deal with indexes being updated +constantly. And finally, since I'm willing to risk some loss, I +turned fsync off, since the system is on a UPS (or will be in +production) and carefully monitored. + +I did actually wonder about the checkpoint_segments being an issue, +since it seems to me the more of them you have, the more you'd have to +deal with when checkpointing, and so you might actually want to turn +that number down to create a "smoother" behavior. + +Unfortunately, the alot advice for 'loading data' doesn't apply when +you have a constant stream of load, rather than just sporadic. Any +advice is more than appreciated. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Fri Apr 1 22:03:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FB78539D1; + Fri, 1 Apr 2005 22:03:48 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57634-09; Fri, 1 Apr 2005 21:03:38 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8740E539C9; + Fri, 1 Apr 2005 22:03:38 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j31L3bgL028576; + Fri, 1 Apr 2005 16:03:37 -0500 (EST) +To: Mike Nolan +Cc: scrappy@postgresql.org (Marc G. Fournier), + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <200504011927.j31JRFMK006424@gw.tssi.com> +References: <200504011927.j31JRFMK006424@gw.tssi.com> +Comments: In-reply-to Mike Nolan + message dated "Fri, 01 Apr 2005 13:27:14 -0600" +Date: Fri, 01 Apr 2005 16:03:37 -0500 +Message-ID: <28575.1112389417@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/20 +X-Sequence-Number: 11417 + +Mike Nolan writes: +> Well, I just did an insert of 27,500 records with 9 fields, averaging +> around 118 bytes per record, each insert statement coming from a separate +> SQL statement fed to psql, and it took a bit over 4 minutes, or about +> 106 inserts per second. + +Is that with a separate transaction for each insert command? I can get +significantly higher rates on my devel machine if the inserts are +bundled into transactions of reasonable length. + +With fsync on, you can't expect to get more than about one commit per +disk rotation (with a single inserting process), so with say a 7200RPM +drive (120 revs/sec) the above is a pretty good fraction of the +theoretical limit. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 1 22:17:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C2BC539C9 + for ; + Fri, 1 Apr 2005 22:17:23 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62911-06 + for ; + Fri, 1 Apr 2005 21:17:20 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) + by svr1.postgresql.org (Postfix) with ESMTP id 81430533EB + for ; + Fri, 1 Apr 2005 22:17:17 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so1097946wri + for ; + Fri, 01 Apr 2005 13:17:19 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=roPcXjxaijxjeiOkiu7N2HnYXiVapKYBGZuAPGWR/riSq+GwGUex3vC2o8IJUKem5wtK8Ys27fBkC5cv+pHuMWHj0ZiSFrKR2zj697GJVbMLomenUIInMgNunbfxIwcCqBC3TMHi/VkEvcUIq5mcZGKcNv9+l+FwWGoCUePa7p8= +Received: by 10.54.66.17 with SMTP id o17mr116520wra; + Fri, 01 Apr 2005 13:17:19 -0800 (PST) +Received: by 10.54.86.16 with HTTP; Fri, 1 Apr 2005 13:17:19 -0800 (PST) +Message-ID: <33c6269f05040113175b47b640@mail.gmail.com> +Date: Fri, 1 Apr 2005 16:17:19 -0500 +From: Alex Turner +Reply-To: Alex Turner +To: "Marc G. Fournier" +Subject: Re: Sustained inserts per sec ... ? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20050401140421.P18194@ganymede.hub.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.241 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/21 +X-Sequence-Number: 11418 + +1250/sec with record size average is 26 bytes +800/sec with record size average is 48 bytes. +250/sec with record size average is 618 bytes. + +Data from pg_stats and our own job monitoring + +System has four partitions, two raid 1s, a four disk RAID 10 and a six +disk RAID 10. +pg_xlog is on four disk RAID 10, database is on RAID 10. + +Data is very spread out because database turnover time is very high, +so our performance is about double this with a fresh DB. (the data +half life is probably measurable in days or weeks). + +Alex Turner +netEconomist + +On Apr 1, 2005 1:06 PM, Marc G. Fournier wrote: +> +> Just curious, but does anyone have an idea of what we are capable of? I +> realize that size of record would affect things, as well as hardware, but +> if anyone has some ideas on max, with 'record size', that would be +> appreciated ... +> +> Thanks ... +> +> ---- +> Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) +> Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Fri Apr 1 22:21:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BE3453327 + for ; + Fri, 1 Apr 2005 22:20:49 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63523-05 + for ; + Fri, 1 Apr 2005 21:20:47 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) + by svr1.postgresql.org (Postfix) with ESMTP id CCCC35323D + for ; + Fri, 1 Apr 2005 22:20:45 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so1098958wri + for ; + Fri, 01 Apr 2005 13:20:47 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=amtAwKk794tN/+813NGd+Jvk03hCx/pxXDBKbrXkTUtIqeWEr7tY2qubFOKQAWaRTbDeAxcM/OMHv2zcKkM306xTVcpGfOgasgbJYtI31/DFZbzfIydR7tdBeP7bkx6brQwUHBGvW0veRK1zdyD+7PIEKjNXta2FznacnnLIA2c= +Received: by 10.54.52.27 with SMTP id z27mr1043231wrz; + Fri, 01 Apr 2005 13:20:46 -0800 (PST) +Received: by 10.54.86.16 with HTTP; Fri, 1 Apr 2005 13:20:46 -0800 (PST) +Message-ID: <33c6269f050401132052019918@mail.gmail.com> +Date: Fri, 1 Apr 2005 16:20:46 -0500 +From: Alex Turner +Reply-To: Alex Turner +To: "Marc G. Fournier" +Subject: Re: Sustained inserts per sec ... ? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <33c6269f05040113175b47b640@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <33c6269f05040113175b47b640@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.244 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/22 +X-Sequence-Number: 11419 + +Oh - this is with a seperate transaction per command. + +fsync is on. + +Alex Turner +netEconomist + +On Apr 1, 2005 4:17 PM, Alex Turner wrote: +> 1250/sec with record size average is 26 bytes +> 800/sec with record size average is 48 bytes. +> 250/sec with record size average is 618 bytes. +> +> Data from pg_stats and our own job monitoring +> +> System has four partitions, two raid 1s, a four disk RAID 10 and a six +> disk RAID 10. +> pg_xlog is on four disk RAID 10, database is on RAID 10. +> +> Data is very spread out because database turnover time is very high, +> so our performance is about double this with a fresh DB. (the data +> half life is probably measurable in days or weeks). +> +> Alex Turner +> netEconomist +> +> On Apr 1, 2005 1:06 PM, Marc G. Fournier wrote: +> > +> > Just curious, but does anyone have an idea of what we are capable of? I +> > realize that size of record would affect things, as well as hardware, but +> > if anyone has some ideas on max, with 'record size', that would be +> > appreciated ... +> > +> > Thanks ... +> > +> > ---- +> > Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) +> > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664 +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 8: explain analyze is your friend +> > +> + +From pgsql-performance-owner@postgresql.org Fri Apr 1 22:23:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 52574539E3 + for ; + Fri, 1 Apr 2005 22:23:23 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65258-01 + for ; + Fri, 1 Apr 2005 21:23:14 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 7EFDE52A3A + for ; + Fri, 1 Apr 2005 22:23:14 +0100 (BST) +Received: from [192.168.7.149] (host-149.int.kcilink.com [192.168.7.149]) + by yertle.kcilink.com (Postfix) with ESMTP id 84BA8B80D + for ; + Fri, 1 Apr 2005 16:23:16 -0500 (EST) +Mime-Version: 1.0 (Apple Message framework v619.2) +In-Reply-To: <424CAB5D.9020807@sfnet.cc> +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <6cceaeb5dc30b08f54f7a37d3f1f90c9@khera.org> +Content-Transfer-Encoding: 7bit +From: Vivek Khera +Subject: Re: Follow-Up: How to improve db performance with $7K? +Date: Fri, 1 Apr 2005 16:23:13 -0500 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.224 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/23 +X-Sequence-Number: 11420 + + +On Mar 31, 2005, at 9:01 PM, Steve Poe wrote: + +> Now, we need to purchase a good U320 RAID card now. Any suggestions +> for those which run well under Linux? + +Not sure if it works with linux, but under FreeBSD 5, the LSI MegaRAID +cards are well supported. You should be able to pick up a 320-2X with +128Mb battery backed cache for about $1k. Wicked fast... I'm suprized +you didn't go for the 15k RPM drives for a small extra cost. + + +From pgsql-performance-owner@postgresql.org Fri Apr 1 23:04:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7034852A2F; + Fri, 1 Apr 2005 23:04:03 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75983-02; Fri, 1 Apr 2005 22:03:56 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 13DB053A54; + Fri, 1 Apr 2005 23:03:55 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j31M3rMR029022; + Fri, 1 Apr 2005 17:03:53 -0500 (EST) +To: Alex Turner +Cc: "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <33c6269f050401132052019918@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <33c6269f05040113175b47b640@mail.gmail.com> + <33c6269f050401132052019918@mail.gmail.com> +Comments: In-reply-to Alex Turner + message dated "Fri, 01 Apr 2005 16:20:46 -0500" +Date: Fri, 01 Apr 2005 17:03:53 -0500 +Message-ID: <29021.1112393033@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/24 +X-Sequence-Number: 11421 + +Alex Turner writes: +> On Apr 1, 2005 4:17 PM, Alex Turner wrote: +>> 1250/sec with record size average is 26 bytes +>> 800/sec with record size average is 48 bytes. +>> 250/sec with record size average is 618 bytes. + +> Oh - this is with a seperate transaction per command. +> fsync is on. + +[ raised eyebrow... ] What kind of disk hardware is that exactly, and +does it have write cache enabled? It's hard to believe those numbers +if not. + +Write caching is fine if it's done in a battery-backed cache, which you +can get in the higher-end hardware RAID controllers. Otherwise you're +going to have problems whenever the power goes away unexpectedly. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 1 23:36:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CC20B53ACE; + Fri, 1 Apr 2005 23:36:46 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81875-07; Fri, 1 Apr 2005 22:36:44 +0000 (GMT) +Received: from gw.tssi.com (gw.tssi.com [198.147.197.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FA5A53AB4; + Fri, 1 Apr 2005 23:36:41 +0100 (BST) +Received: from gw.tssi.com (nolan@gw.tssi.com [127.0.0.1] (may be forged)) + by gw.tssi.com (8.12.6/8.12.6) with ESMTP id j31ManZE009304; + Fri, 1 Apr 2005 16:36:50 -0600 +Received: (from nolan@localhost) + by gw.tssi.com (8.12.6/8.12.6/Submit) id j31MamDD009302; + Fri, 1 Apr 2005 16:36:48 -0600 +From: Mike Nolan +Message-Id: <200504012236.j31MamDD009302@gw.tssi.com> +Subject: Re: Sustained inserts per sec ... ? +To: tgl@sss.pgh.pa.us (Tom Lane) +Date: Fri, 1 Apr 2005 16:36:47 -0600 (CST) +Cc: scrappy@postgresql.org (Marc G. Fournier), + pgsql-performance@postgresql.org +In-Reply-To: <28575.1112389417@sss.pgh.pa.us> from "Tom Lane" at Apr 01, + 2005 04:03:37 PM +X-Mailer: ELM [version 2.5 PL3] +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/25 +X-Sequence-Number: 11422 + +> > Well, I just did an insert of 27,500 records with 9 fields, averaging +> > around 118 bytes per record, each insert statement coming from a separate +> > SQL statement fed to psql, and it took a bit over 4 minutes, or about +> > 106 inserts per second. +> +> Is that with a separate transaction for each insert command? I can get +> significantly higher rates on my devel machine if the inserts are +> bundled into transactions of reasonable length. + +That's with autocommit on. If I do it as a single transaction block, +it takes about 6.5 seconds, which is about 4200 transactions/second. +-- +Mike Nolan + +From pgsql-performance-owner@postgresql.org Sat Apr 2 00:25:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ACFE053A24 + for ; + Sat, 2 Apr 2005 00:24:13 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90989-06 + for ; + Fri, 1 Apr 2005 23:24:04 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 940CA53A04 + for ; + Sat, 2 Apr 2005 00:24:02 +0100 (BST) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j31NO2H8005789 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Fri, 1 Apr 2005 16:24:04 -0700 (MST) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j31NO2Du008465; + Fri, 1 Apr 2005 16:24:02 -0700 (MST) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j31NO1OG008464; + Fri, 1 Apr 2005 16:24:01 -0700 (MST) (envelope-from mfuhr) +Date: Fri, 1 Apr 2005 16:24:01 -0700 +From: Michael Fuhr +To: "H.J. Sanders" +Cc: pgsql-performance@postgresql.org +Subject: Re: date - range +Message-ID: <20050401232401.GA8389@winnie.fuhr.org> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/26 +X-Sequence-Number: 11423 + +On Fri, Apr 01, 2005 at 12:05:44PM +0200, H.J. Sanders wrote: +> +> people can subscribe to a service for 1 or more days (upto a max. of 365). +> +> So in the database is stored: first_date and last_date +> +> To select which people are subscribed for a certain date (e.g. today) we use +> a select like +> +> select ....... where first_date <= today and last_date >= today +> +> Whatever index we create system always does a sequential scan (which I can +> understand). + +Could you show the table and index definitions and the EXPLAIN +ANALYZE output of two queries, one with enable_seqscan set to "on" +and one with it set to "off"? The planner might think that a +sequential scan would be faster than an index scan, and EXPLAIN +ANALYZE should tell us if that guess is correct. + +What version of PostgreSQL are you using? + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Sat Apr 2 06:59:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 507A053692 + for ; + Sat, 2 Apr 2005 06:59:52 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85003-08 + for ; + Sat, 2 Apr 2005 05:59:46 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B75952A9B + for ; + Sat, 2 Apr 2005 06:59:45 +0100 (BST) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050402055945.CINB22140.priv-edtnes56.telusplanet.net@localhost>; + Fri, 1 Apr 2005 22:59:45 -0700 +Received: from 64.180.225.200 ( [64.180.225.200]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Fri, 1 Apr 2005 21:59:44 -0800 +Message-ID: <1112421584.424e34d0d2d63@webmail.telus.net> +Date: Fri, 1 Apr 2005 21:59:44 -0800 +From: Mischa +To: "H.J. Sanders" +Cc: pgsql-performance@postgresql.org +Subject: Re: date - range +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 64.180.225.200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/27 +X-Sequence-Number: 11424 + +Quoting "H.J. Sanders" : + +> +> Anybody a solution for the next problem: +> people can subscribe to a service for 1 or more days (upto a max. of 365). +> So in the database is stored: first_date and last_date +> To select which people are subscribed for a certain date (e.g. today) we use +> a select like +> +> select ....... where first_date <= today and last_date >= today +> +> Whatever index we create system always does a sequential scan (which I can +> understand). Has someone a smarter solution? + +Yep, standard SQL problem. The answer is sort of a hand-rolled GIST index. + +To save typing, I'm going to pretend all your dates are stored as integers. +In reality, you'll probably be writing views with lots of EXTRACT(EPOCH...)'s in +them, to achieve the same result. + +Suppose you have table People(id, first_date, last_date, ...) +Each such range "fits" in some larger fixed range of 1,2,4, ... days +that starts and ends on a fixed (epoch) date multiple of 1,2,4,... +For example, if your range were days (1040..1080), then that fits in the +64-wide range (1024...1088]. You calculate the start and width of the range that +just fits, and store that in People, too. Now, you index on (start,width). + +Now, when you want to query for a given "today", you have to try for +all possible widths in People. Fortunately, that's darn few! +The ranges up to a decade (!) will still mean only 16 different widths. +A max range of one year (<512 days) means only 9 widths. +You can do this with a tiny static table. + +Then: the query: + +SELECT People.* FROM People +JOIN Widths +ON People.start = today - today % Widths.width +AND People.width = Widths.width + +Though this may look gross, it makes an index work where no normal BTree index +would. I've used it for some really nasty data conversions of 100M-row tables. + +Your first name wouldn't be "Harlan", would it? :-) +-- "Dreams come true, not free." + + +From pgsql-performance-owner@postgresql.org Sat Apr 2 07:25:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B6C5852AA6 + for ; + Sat, 2 Apr 2005 07:25:28 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92855-01 + for ; + Sat, 2 Apr 2005 06:25:23 +0000 (GMT) +Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id 0D8AB5398B + for ; + Sat, 2 Apr 2005 07:25:19 +0100 (BST) +Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050402062519.CPDS27369.priv-edtnes51.telusplanet.net@localhost>; + Fri, 1 Apr 2005 23:25:19 -0700 +Received: from 64.180.225.200 ( [64.180.225.200]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Fri, 1 Apr 2005 22:25:19 -0800 +Message-ID: <1112423119.424e3acf49c9f@webmail.telus.net> +Date: Fri, 1 Apr 2005 22:25:19 -0800 +From: Mischa +To: Mischa +Cc: "H.J. Sanders" , pgsql-performance@postgresql.org +Subject: Re: date - range +References: + <1112421584.424e34d0d2d63@webmail.telus.net> +In-Reply-To: <1112421584.424e34d0d2d63@webmail.telus.net> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 64.180.225.200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/28 +X-Sequence-Number: 11425 + +Quoting Mischa : + +[deleted] +> SELECT People.* FROM People +> JOIN Widths +> ON People.start = today - today % Widths.width +> AND People.width = Widths.width + +Yikes! I hit the SEND button one ohnosecend too fast. + +(1) You still ALSO have to test: +... AND today between first_date and last_date + +(2) On some SQL engines, it makes a different to how the engine can re-order the +nested loops, if you make the index (width,start) instead of (start,width). +Haven't tried on PG8 yet. +-- +"Dreams come true, not free." + + +From pgsql-performance-owner@postgresql.org Sat Apr 2 08:01:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B7815397E + for ; + Sat, 2 Apr 2005 08:01:41 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01642-01 + for ; + Sat, 2 Apr 2005 07:01:36 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 83FEE53823 + for ; + Sat, 2 Apr 2005 08:01:34 +0100 (BST) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3271WbK006147 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Sat, 2 Apr 2005 00:01:34 -0700 (MST) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3271WSV010590; + Sat, 2 Apr 2005 00:01:32 -0700 (MST) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3271VoZ010589; + Sat, 2 Apr 2005 00:01:31 -0700 (MST) (envelope-from mfuhr) +Date: Sat, 2 Apr 2005 00:01:31 -0700 +From: Michael Fuhr +To: Mischa +Cc: "H.J. Sanders" , pgsql-performance@postgresql.org +Subject: Re: date - range +Message-ID: <20050402070131.GA10532@winnie.fuhr.org> +References: + <1112421584.424e34d0d2d63@webmail.telus.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1112421584.424e34d0d2d63@webmail.telus.net> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/29 +X-Sequence-Number: 11426 + +On Fri, Apr 01, 2005 at 09:59:44PM -0800, Mischa wrote: +> > +> > select ....... where first_date <= today and last_date >= today +> > +> > Whatever index we create system always does a sequential scan (which I can +> > understand). Has someone a smarter solution? +> +> Yep, standard SQL problem. The answer is sort of a hand-rolled GIST index. + +That might not be necessary in this case. + +CREATE TABLE foo ( + id serial PRIMARY KEY, + first_date date NOT NULL, + last_date date NOT NULL, + CONSTRAINT check_date CHECK (last_date >= first_date) +); + +/* populate table */ + +CREATE INDEX foo_date_idx ON foo (first_date, last_date); +ANALYZE foo; + +EXPLAIN SELECT * FROM foo +WHERE first_date <= current_date AND last_date >= current_date; + QUERY PLAN +-------------------------------------------------------------------------------------------- + Index Scan using foo_date_idx on foo (cost=0.01..15.55 rows=97 width=12) + Index Cond: ((first_date <= ('now'::text)::date) AND (last_date >= ('now'::text)::date)) +(2 rows) + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Sat Apr 2 14:57:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D992353AD0 + for ; + Sat, 2 Apr 2005 14:57:33 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82102-03 + for ; + Sat, 2 Apr 2005 13:57:28 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 27F0A53ACF + for ; + Sat, 2 Apr 2005 14:57:27 +0100 (BST) +Received: (qmail 12315 invoked by uid 500); 2 Apr 2005 14:14:17 -0000 +Date: Sat, 2 Apr 2005 08:14:17 -0600 +From: Bruno Wolff III +To: Michael Fuhr +Cc: Mischa , "H.J. Sanders" , + pgsql-performance@postgresql.org +Subject: Re: date - range +Message-ID: <20050402141417.GA11325@wolff.to> +Mail-Followup-To: Michael Fuhr , + Mischa , "H.J. Sanders" , + pgsql-performance@postgresql.org +References: + <1112421584.424e34d0d2d63@webmail.telus.net> + <20050402070131.GA10532@winnie.fuhr.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050402070131.GA10532@winnie.fuhr.org> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/30 +X-Sequence-Number: 11427 + +On Sat, Apr 02, 2005 at 00:01:31 -0700, + Michael Fuhr wrote: +> On Fri, Apr 01, 2005 at 09:59:44PM -0800, Mischa wrote: +> > > +> > > select ....... where first_date <= today and last_date >= today +> > > +> > > Whatever index we create system always does a sequential scan (which I can +> > > understand). Has someone a smarter solution? +> > +> > Yep, standard SQL problem. The answer is sort of a hand-rolled GIST index. +> +> That might not be necessary in this case. + +Even though you get an index scan, I don't think it is going to be +very fast as there are going to be a lot of entries with first_date +<= current_date. If the requests are almost always for the current date, +then switching the order of columns in the index will help, since there +will probably be few orders for future service, so that the current +date being <= the last_date will be a much better indicator of whether +they have service. If requests are made well into the past then this +approach will have the same problem as checking first_date first. +He will probably get faster lookups using rtree or gist indexes as +he really is checking for containment. + +> +> CREATE TABLE foo ( +> id serial PRIMARY KEY, +> first_date date NOT NULL, +> last_date date NOT NULL, +> CONSTRAINT check_date CHECK (last_date >= first_date) +> ); +> +> /* populate table */ +> +> CREATE INDEX foo_date_idx ON foo (first_date, last_date); +> ANALYZE foo; +> +> EXPLAIN SELECT * FROM foo +> WHERE first_date <= current_date AND last_date >= current_date; +> QUERY PLAN +> -------------------------------------------------------------------------------------------- +> Index Scan using foo_date_idx on foo (cost=0.01..15.55 rows=97 width=12) +> Index Cond: ((first_date <= ('now'::text)::date) AND (last_date >= ('now'::text)::date)) +> (2 rows) + +From pgsql-performance-owner@postgresql.org Sat Apr 2 17:21:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AF2F1534D5 + for ; + Sat, 2 Apr 2005 17:21:49 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10347-07 + for ; + Sat, 2 Apr 2005 16:21:46 +0000 (GMT) +Received: from mail.ofsloans.com (mail.ofsloans.com [208.187.153.100]) + by svr1.postgresql.org (Postfix) with ESMTP id 349E253359 + for ; + Sat, 2 Apr 2005 17:21:45 +0100 (BST) +Message-ID: <424EC690.5030909@lashell.net> +Date: Sat, 02 Apr 2005 09:21:36 -0700 +From: Will LaShell +MIME-Version: 1.0 +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: Follow-Up: How to improve db performance with $7K? +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> + <6cceaeb5dc30b08f54f7a37d3f1f90c9@khera.org> +In-Reply-To: <6cceaeb5dc30b08f54f7a37d3f1f90c9@khera.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/31 +X-Sequence-Number: 11428 + +Vivek Khera wrote: + +> +> On Mar 31, 2005, at 9:01 PM, Steve Poe wrote: +> +>> Now, we need to purchase a good U320 RAID card now. Any suggestions +>> for those which run well under Linux? +> +> +> Not sure if it works with linux, but under FreeBSD 5, the LSI MegaRAID +> cards are well supported. You should be able to pick up a 320-2X with +> 128Mb battery backed cache for about $1k. Wicked fast... I'm suprized +> you didn't go for the 15k RPM drives for a small extra cost. + + + +Wow, okay, so I'm not sure where everyone's email went, but I got +over a weeks worth of list emails at once. + +Several of you have sent me requests on where we purchased our systems +at. Compsource was the vendor, www.c-source.com or +www.compsource.com. The sales rep we have is Steve Taylor or you +can talk to the sales manager Tom. I've bought hardware from them +for the last 2 years and I've been very pleased. I'm sorry wasn't able +to respond sooner. + + +Steve, The LSI MegaRAID cards are where its at. I've had -great- luck +with them over the years. There were a few weird problems with a series +awhile back where the linux driver needed tweaked by the developers +along with a new bios update. The 320 series is just as Vivek said, +wicked fast. Very strong cards. Be sure though when you order it to +specificy the battery backup either with it, or make sure you buy the +right one for it. There are a couple of options with battery cache on +the cards that can trip you up. + +Good luck on your systems! Now that I've got my email problems +resolved I'm definitely more than help to give any information you all +need. + +From pgsql-performance-owner@postgresql.org Sun Apr 3 09:01:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 843FC539A6 + for ; + Sun, 3 Apr 2005 09:01:28 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94829-03 + for ; + Sun, 3 Apr 2005 08:01:16 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id C1B01538D3 + for ; + Sun, 3 Apr 2005 09:01:15 +0100 (BST) +Received: (qmail 14035 invoked from network); 3 Apr 2005 10:01:33 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 3 Apr 2005 10:01:33 +0200 +To: "Hannes Dorbath" , + pgsql-performance@postgresql.org +Subject: Re: Query Optimizer Failure / Possible Bug +References: +Message-ID: +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Date: Sun, 03 Apr 2005 10:01:13 +0200 +In-Reply-To: +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/39 +X-Sequence-Number: 11436 + + + Noticed this problem,too. + You can always make the calculation you want done once inside a set +returning function so it'll behave like a table, but that's ugly. + +On Mon, 28 Mar 2005 16:14:44 +0200, Hannes Dorbath + wrote: + +> hm, a few days and not a single reply :| +> +> any more information needed? test data? simplified test case? anything? +> +> +> thanks +> +> +> Hannes Dorbath wrote: +>> The query and the corresponding EXPLAIN is at +>> http://hannes.imos.net/query.txt +>> I'd like to use the column q.replaced_serials for multiple calculations +>> in the SELECT clause, but every time it is referenced there in some way +>> the whole query in the FROM clause returning q is executed again. +>> This doesn't make sense to me at all and eats performance. +>> If this wasn't clear enough, for every +>> q.replaced_serials AS some_column +>> in the SELECT clause there is new block of +>> --------------------------------------------------------------- +>> -> Aggregate (cost=884.23..884.23 rows=1 width=0) +>> -> Nested Loop (cost=0.00..884.23 rows=1 width=0) +>> -> Index Scan using ix_rma_ticket_serials_replace on +>> rma_ticket_serials rts (cost=0.00..122.35 +>> rows=190 width=4) +>> Index Cond: ("replace" = false) +>> -> Index Scan using pk_serials on serials s +>> (cost=0.00..3.51 rows=1 width=4) +>> Index Cond: (s.serial_id = "outer".serial_id) +>> Filter: ((article_no = $0) AND (delivery_id = $1)) +>> --------------------------------------------------------------- +>> in the EXPLAIN result. +>> For those who wonder why I do this FROM (SELECT...). I was searching +>> for +>> a way to use the result of an subselect for multiple calculations in the +>> SELECT clause and return that calculation results as individual columns. +>> I tested a bit further and found out that PG behaves the same in case q +>> is a view. This makes me wonder how efficient the optimizer can work +>> with views - or even worse - nested views. +>> Tested and reproduced on PG 7.4.1 linux and 8.0.0 win32. +>> Thanks in advance, +>> Hannes Dorbath +> + + + +From pgsql-performance-owner@postgresql.org Sun Apr 3 13:01:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 70DD1531FE + for ; + Sun, 3 Apr 2005 13:01:39 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38160-06 + for ; + Sun, 3 Apr 2005 12:01:30 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id AA5905332A + for ; + Sun, 3 Apr 2005 13:01:29 +0100 (BST) +Received: (qmail 28048 invoked by uid 500); 3 Apr 2005 12:18:20 -0000 +Date: Sun, 3 Apr 2005 07:18:20 -0500 +From: Bruno Wolff III +To: Karim A Nassar +Cc: Simon Riggs , + Stephan Szabo , Tom Lane , + Christopher Kings-Lynne , + pgsql-performance@postgresql.org +Subject: Re: Delete query takes exorbitant amount of time +Message-ID: <20050403121820.GB27923@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Karim A Nassar , + Simon Riggs , + Stephan Szabo , + Tom Lane , + Christopher Kings-Lynne , + pgsql-performance@postgresql.org +References: <1112044045.11750.919.camel@localhost.localdomain> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/40 +X-Sequence-Number: 11437 + +On Tue, Mar 29, 2005 at 01:48:48 -0700, + Karim A Nassar wrote: +> +> For this FK check, there only need be one referring id to invalidate the +> delete. ISTM that for any delete with a FK reference, the index could +> always be used to search for a single value in the referring table +> (excepting very small tables). Why then must a sequential scan be +> performed in this case, and/or in general? + +First the index needs to exist. It isn't created automatically because not +everyone wants such an index. Second, you need to have analyzed the +referencing table so that the planner will know it is big enough that +using an indexed search is worthwhile. The planner is getting better +about dealing with size changes without reanalyzing, but it seems there +are still some gotchas in 8.0. + +From pgsql-performance-owner@postgresql.org Sun Apr 3 13:47:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B2355334B + for ; + Sun, 3 Apr 2005 13:47:22 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49808-03 + for ; + Sun, 3 Apr 2005 12:47:20 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 101435333E + for ; + Sun, 3 Apr 2005 13:47:19 +0100 (BST) +Received: (qmail 28699 invoked by uid 500); 3 Apr 2005 13:04:11 -0000 +Date: Sun, 3 Apr 2005 08:04:11 -0500 +From: Bruno Wolff III +To: =?iso-8859-1?B?QUzdIMdFTN1L?= +Cc: pgsql-performance@postgresql.org +Subject: Re: coalesce alternative +Message-ID: <20050403130411.GD27923@wolff.to> +Mail-Followup-To: Bruno Wolff III , + =?iso-8859-1?B?QUzdIMdFTN1L?= , + pgsql-performance@postgresql.org +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/41 +X-Sequence-Number: 11438 + +On Tue, Mar 29, 2005 at 14:21:13 +0300, + AL� �EL�K wrote: +> I have used coalesce function for null fields but coalesce is too slow. +> I need fast alternative for coalesce + +It is unlikely that coalesce is your problem. People might be able to provide +some help if you provide EXPLAIN ANALYZE output and the actual query for your +slow query. + +From pgsql-performance-owner@postgresql.org Mon Apr 4 06:08:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B537C539A6 + for ; + Mon, 4 Apr 2005 06:08:10 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76152-09 + for ; + Mon, 4 Apr 2005 05:08:05 +0000 (GMT) +Received: from smtpout04-03.prod.mesa1.secureserver.net + (smtpout04-03.prod.mesa1.secureserver.net [64.202.165.198]) + by svr1.postgresql.org (Postfix) with SMTP id 02F0553980 + for ; + Mon, 4 Apr 2005 06:08:03 +0100 (BST) +Received: (qmail 22239 invoked from network); 4 Apr 2005 05:08:03 -0000 +Received: from unknown (HELO webmail10.mesa1.secureserver.net) (64.202.189.47) + by smtpout04-03.prod.mesa1.secureserver.net with SMTP; + 4 Apr 2005 05:08:03 -0000 +Received: (qmail 7176 invoked by uid 99); 4 Apr 2005 05:08:03 -0000 +Message-ID: <20050404050803.7175.qmail@webmail10.mesa1.secureserver.net> +Date: Sun, 3 Apr 2005 22:08:03 -0700 +From: mark.lubratt@indeq.com +Subject: Correcting Hash Join Estimates +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: TEXT/plain; CHARSET=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.262 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/42 +X-Sequence-Number: 11439 + +Hello! + +I posted a similar question to this one about a month ago; but, for some +reason, it never seemed to be broadcast eventhough it ended up in the +archives. So, since I'm still struggling with this, I thought I'd +repost... + +I'm trying to optimize a query and the EXPLAIN ANALYZE (see link below) +shows that some hash join row estimates are wrong by a factor of 2-3, +and upwards of 7-8. There is a corresponding mis-estimation of the +amount of time taken for these steps. The database is vacuum analyzed +nightly by a cron job. How would I go about tightening up these +errors? I suspect that I need to SET STATISTIC on some columns, but +how can I tell which columns? + +Any help would be appreciated. + +WinXP (dual Xeon 1.2GB RAM) PgSQL 8.0.1 +Explain Analyze: +View Definition: + +The largest table contains about 10,000 rows. All tables have indexes +on their foreign keys. + +Thanks! +Mark + + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 06:54:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 208EE536E9 + for ; + Mon, 4 Apr 2005 06:54:26 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88389-05 + for ; + Mon, 4 Apr 2005 05:54:21 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CF85A536E2 + for ; + Mon, 4 Apr 2005 06:54:20 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j345sHk9017974; + Mon, 4 Apr 2005 01:54:17 -0400 (EDT) +To: mark.lubratt@indeq.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Correcting Hash Join Estimates +In-reply-to: <20050404050803.7175.qmail@webmail10.mesa1.secureserver.net> +References: <20050404050803.7175.qmail@webmail10.mesa1.secureserver.net> +Comments: In-reply-to mark.lubratt@indeq.com + message dated "Sun, 03 Apr 2005 22:08:03 -0700" +Date: Mon, 04 Apr 2005 01:54:17 -0400 +Message-ID: <17973.1112594057@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/43 +X-Sequence-Number: 11440 + +mark.lubratt@indeq.com writes: +> I'm trying to optimize a query and the EXPLAIN ANALYZE (see link below) +> shows that some hash join row estimates are wrong by a factor of 2-3, +> and upwards of 7-8. + +I doubt that improving those estimates would lead to markedly better +results. You need to think about improving the view design instead. +What context is this view used in --- do you just do "select * from +view_get_all_user_award2", or are there conditions added to it, or +perhaps it gets joined with other things? Do you really need the +DISTINCT constraint? Do you really need the ORDER BY? Can you +simplify the WHERE clause at all? + +Half a second sounds pretty decent to me for a ten-way join with a WHERE +clause as unstructured as that. If you really need it to execute in way +less time, you're probably going to have to rethink your data +representation to make the query simpler. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 4 07:15:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 92679536D2 + for ; + Mon, 4 Apr 2005 07:15:44 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94549-05 + for ; + Mon, 4 Apr 2005 06:15:39 +0000 (GMT) +Received: from smtpout04-04.prod.mesa1.secureserver.net + (smtpout04-04.prod.mesa1.secureserver.net [64.202.165.199]) + by svr1.postgresql.org (Postfix) with SMTP id D698E536CE + for ; + Mon, 4 Apr 2005 07:15:37 +0100 (BST) +Received: (qmail 28199 invoked from network); 4 Apr 2005 06:15:38 -0000 +Received: from unknown (63.229.213.126) + by smtpout04-04.prod.mesa1.secureserver.net (64.202.165.199) with ESMTP; + 04 Apr 2005 06:15:38 -0000 +Mime-Version: 1.0 (Apple Message framework v619.2) +In-Reply-To: <17973.1112594057@sss.pgh.pa.us> +References: <20050404050803.7175.qmail@webmail10.mesa1.secureserver.net> + <17973.1112594057@sss.pgh.pa.us> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <3de3144f9eb6c83400f8d41584af47f2@indeq.com> +Content-Transfer-Encoding: 7bit +From: Mark Lubratt +Subject: Re: Correcting Hash Join Estimates +Date: Mon, 4 Apr 2005 01:15:38 -0500 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/44 +X-Sequence-Number: 11441 + + +On Apr 4, 2005, at 12:54 AM, Tom Lane wrote: + +> mark.lubratt@indeq.com writes: +>> I'm trying to optimize a query and the EXPLAIN ANALYZE (see link +>> below) +>> shows that some hash join row estimates are wrong by a factor of 2-3, +>> and upwards of 7-8. +> +> I doubt that improving those estimates would lead to markedly better +> results. You need to think about improving the view design instead. +> What context is this view used in --- do you just do "select * from +> view_get_all_user_award2", or are there conditions added to it, or +> perhaps it gets joined with other things? + +Yes. I forgot to show how the query is executed... + +select * from view_get_all_user_award2 where person_id = 1; + + +> Do you really need the +> DISTINCT constraint? + +Yes. + +> Do you really need the ORDER BY? + +The customer wants an initial ordering in the displayed data. + +> Can you +> simplify the WHERE clause at all? +> + +I originally had a bunch of LEFT JOINs. After reading Tow's "SQL +Tuning", I was hoping to steer the planner into a more "optimal" plan +by using a large where clause instead and doing the joins there (I +think they're called implicit joins). I was able to shave a couple of +hundred milliseconds off the execution time by doing this. + +> Half a second sounds pretty decent to me for a ten-way join with a +> WHERE +> clause as unstructured as that. If you really need it to execute in +> way +> less time, you're probably going to have to rethink your data +> representation to make the query simpler. +> + +Unfortunately, I'm not sure I can restructure the data. I did consider +materialized views. However, they couldn't be lazy and that seemed +like a lot of extra work for the backend for very little improvement. + +If this sounds like decent performance to you... I guess I can just +tell the complainers that it's as good as it's going to get (barring a +major hardware upgrade...). + +Thanks! +Mark + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 08:56:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 46DA653753 + for ; + Mon, 4 Apr 2005 08:56:10 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13517-05 + for ; + Mon, 4 Apr 2005 07:56:06 +0000 (GMT) +Received: from notes.beauchamp.loxane.fr (unknown [217.167.112.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 34227536C0 + for ; + Mon, 4 Apr 2005 08:56:03 +0100 (BST) +To: pgsql-performance@postgresql.org +Subject: Postgresql vs SQLserver for this application ? +MIME-Version: 1.0 +X-Mailer: Lotus Notes Release 5.0.10 March 22, 2002 +Message-ID: + +From: bsimon@loxane.com +Date: Mon, 4 Apr 2005 10:02:22 +0200 +X-MIMETrack: Serialize by Router on notes/Loxane(Release 5.0.10 |March 22, + 2002) at 04/04/2005 10:02:29, + Serialize complete at 04/04/2005 10:02:29 +Content-Type: multipart/alternative; + boundary="=_alternative 002BB4B4C1256FD9_=" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.245 tagged_above=0 required=5 tests=AWL, HTML_30_40, + HTML_MESSAGE, NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/45 +X-Sequence-Number: 11442 + +Message en plusieurs parties au format MIME +--=_alternative 002BB4B4C1256FD9_= +Content-Type: text/plain; charset="us-ascii" + +hi all. + +We are designing a quite big application that requires a high-performance +database backend. +The rates we need to obtain are at least 5000 inserts per second and 15 +selects per second for one connection. There should only be 3 or 4 +simultaneous connections. +I think our main concern is to deal with the constant flow of data coming +from the inserts that must be available for selection as fast as possible. +(kind of real time access ...) + +As a consequence, the database should rapidly increase up to more than one +hundred gigs. We still have to determine how and when we shoud backup old +data to prevent the application from a performance drop. We intend to +develop some kind of real-time partionning on our main table keep the +flows up. + +At first, we were planning to use SQL Server as it has features that in my +opinion could help us a lot : + - replication + - clustering + +Recently we started to study Postgresql as a solution for our project : + - it also has replication + - Postgis module can handle geographic datatypes (which would +facilitate our developments) + - We do have a strong knowledge on Postgresql administration (we +use it for production processes) + - it is free (!) and we could save money for hardware purchase. + +Is SQL server clustering a real asset ? How reliable are Postgresql +replication tools ? Should I trust Postgresql performance for this kind +of needs ? + +My question is a bit fuzzy but any advices are most welcome... +hardware,tuning or design tips as well :)) + +Thanks a lot. + +Benjamin. + + +--=_alternative 002BB4B4C1256FD9_= +Content-Type: text/html; charset="us-ascii" + + +
hi all. +
+
We are designing a quite big application that requires a high-performance database backend. +
The rates we need to obtain are at least  5000 inserts per second and 15 selects per second for one connection. There should only be 3 or 4 simultaneous connections. +
I think our main concern is to deal with the constant flow of data coming from the inserts that must be available for selection as fast as possible. (kind of real time access ...) +
+
As a consequence, the database should rapidly increase up to more than one hundred gigs. We still have to determine how and when we shoud backup old data to prevent the application from a performance drop. We intend to develop some kind of real-time partionning on our main table keep the flows up. +
+
At first, we were planning to use SQL Server as it has features that in my opinion could help us a lot : +
        - replication +
        - clustering +
+
Recently we started to study Postgresql as a solution for our project : +
        - it also has replication +
        - Postgis module can handle geographic datatypes (which would facilitate our developments) +
        - We do have a strong knowledge on Postgresql administration (we use it for production processes) +
        - it is free (!) and we could save money for hardware purchase. +
+
Is SQL server clustering a real asset ? How reliable are Postgresql replication tools  ? Should I trust Postgresql performance for this kind of needs ? +
+
My question is a bit fuzzy but any advices are most welcome... hardware,tuning or design tips as well :)) +
+
Thanks a lot. +
+
Benjamin. +
+
+--=_alternative 002BB4B4C1256FD9_=-- + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:54:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D408D53707 + for ; + Mon, 4 Apr 2005 11:21:18 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53717-07 + for ; + Mon, 4 Apr 2005 10:21:14 +0000 (GMT) +Received: from hotmail.com (bay106-f32.bay106.hotmail.com [65.54.161.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 665AB5398A + for ; + Mon, 4 Apr 2005 11:21:13 +0100 (BST) +Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; + Mon, 4 Apr 2005 03:21:16 -0700 +Message-ID: +Received: from 65.54.161.202 by by106fd.bay106.hotmail.msn.com with HTTP; + Mon, 04 Apr 2005 10:21:16 GMT +X-Originating-IP: [65.54.161.202] +X-Originating-Email: [anonpermutation@hotmail.com] +X-Sender: anonpermutation@hotmail.com +From: "anon permutation" +To: pgsql-performance@postgresql.org +Subject: 8.0.1 much slower than 7.4.2? +Date: Mon, 04 Apr 2005 10:21:16 +0000 +Mime-Version: 1.0 +Content-Type: text/plain; format=flowed +X-OriginalArrivalTime: 04 Apr 2005 10:21:16.0353 (UTC) + FILETIME=[08FD5310:01C53900] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.75 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, MSGID_FROM_MTA_HEADER +X-Spam-Level: * +X-Archive-Number: 200504/208 +X-Sequence-Number: 11605 + + +Hi, + +I have just upgraded our db from 7.4.2 to 8.0.1 and we are doing some +testing. For some reason, we have discovered that our application performs +much slower on 8.0.1. + +My initial reaction was to turn on log_min_duration_statement to see what's +happening. However, log_min_duration_statement does not work for JDBC +clients in 8.0.1. + +As a result, I modified log_statement to all. Without my application doing +anything, I see statements below being executed non-stop. Who is triggering +these statemetns? Is this normal? What am I doing wrong? + +I am using Fedora Core 1 - Kernel: 2.4.22-1.2174.nptl + +Please help. Thanks. + + + + +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +IKE '%nextval(%' + + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 11:32:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E1C5E537A3 + for ; + Mon, 4 Apr 2005 11:32:24 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57119-05 + for ; + Mon, 4 Apr 2005 10:32:03 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 9CEA153A21 + for ; + Mon, 4 Apr 2005 11:32:01 +0100 (BST) +Received: by zproxy.gmail.com with SMTP id 9so282276nzo + for ; + Mon, 04 Apr 2005 03:32:04 -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; + b=DTxHJFeilicrfj1pHrSpvCInt88cB/mfKt/B5w3Ysq/0zHxjmyuIcuA64dUEHXHL6RDg28AXntz+mP6UbzdM3HE7w52uLespLLmgapPWmxGvcN5KYED0bgKhTijO7iA0RQ4QAv6uT8bBaXa+bULadm2m8fDxJ+DLG/CzAJhotec= +Received: by 10.36.43.10 with SMTP id q10mr58726nzq; + Mon, 04 Apr 2005 03:32:04 -0700 (PDT) +Received: by 10.36.31.14 with HTTP; Mon, 4 Apr 2005 03:32:04 -0700 (PDT) +Message-ID: +Date: Mon, 4 Apr 2005 18:32:04 +0800 +From: +Reply-To: +To: pgsql-performance@postgresql.org +Subject: 8.0.1 performance question. +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/46 +X-Sequence-Number: 11443 + +Hi, + +I have just upgraded our db from 7.4.2 to 8.0.1 and we are doing some +testing. For some reasons, we have discovered that our application +performs much slower on 8.0.1. + +My initial reaction was to turn on log_min_duration_statement to see +what's happening. However, log_min_duration_statement does not work +for JDBC clients in 8.0.1. + +As a result, I modified log_statement to all. Without my application +doing anything, I see statements below being executed non-stop. Who +is triggering these statemetns? Is this normal? What am I doing +wrong? + +I am using Fedora Core 1 - Kernel: 2.4.22-1.2174.nptl + +Please help. Thanks. + + + + +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' + +From pgsql-performance-owner@postgresql.org Mon Apr 4 14:44:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AAF16533A0 + for ; + Mon, 4 Apr 2005 14:44:07 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12134-08 + for ; + Mon, 4 Apr 2005 13:43:49 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) + by svr1.postgresql.org (Postfix) with ESMTP id E034953410 + for ; + Mon, 4 Apr 2005 14:43:47 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so1575559wri + for ; + Mon, 04 Apr 2005 06:43:52 -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:references; + b=W6MkdtLX8XxlmPptgp24wnJJF3Lk6ubB/I4hKHclNWHw9pXeZ7U/ljkeXLON9dnBnCoU3ZJlyUwLE9AJe9qz23HkTRag3HxcZkmFMTFRPagLqsE7OHFWdlPomUps5TwckefzBvyg9wSWMDCIlmXsr38VmlHv8KVIkNJmfY5buMM= +Received: by 10.54.77.17 with SMTP id z17mr302719wra; + Mon, 04 Apr 2005 06:43:52 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 4 Apr 2005 06:43:52 -0700 (PDT) +Message-ID: <33c6269f0504040643317b69cd@mail.gmail.com> +Date: Mon, 4 Apr 2005 09:43:52 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: pg@fastcrypt.com +Subject: Re: How to improve db performance with $7K? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42494741.7060806@fastcrypt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.245 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/47 +X-Sequence-Number: 11444 + +To be honest, I've yet to run across a SCSI configuration that can +touch the 3ware SATA controllers. I have yet to see one top 80MB/sec, +let alone 180MB/sec read or write, which is why we moved _away_ from +SCSI. I've seen Compaq, Dell and LSI controllers all do pathetically +badly on RAID 1, RAID 5 and RAID 10. + +35MB/sec for a three drive RAID 0 is not bad, it's appalling. The +hardware manufacturer should be publicly embarassed for this kind of +speed. A single U320 10k drive can do close to 70MB/sec sustained. + +If someone can offer benchmarks to the contrary (particularly in +linux), I would be greatly interested. + +Alex Turner +netEconomist + +On Mar 29, 2005 8:17 AM, Dave Cramer wrote: +> Yeah, 35Mb per sec is slow for a raid controller, the 3ware mirrored is +> about 50Mb/sec, and striped is about 100 +> +> Dave +> +> PFC wrote: +> +> > +> >> With hardware tuning, I am sure we can do better than 35Mb per sec. Also +> > +> > +> > WTF ? +> > +> > My Laptop does 19 MB/s (reading <10 KB files, reiser4) ! +> > +> > A recent desktop 7200rpm IDE drive +> > # hdparm -t /dev/hdc1 +> > /dev/hdc1: +> > Timing buffered disk reads: 148 MB in 3.02 seconds = 49.01 MB/sec +> > +> > # ll "DragonBall 001.avi" +> > -r--r--r-- 1 peufeu users 218M mar 9 20:07 DragonBall +> > 001.avi +> > +> > # time cat "DragonBall 001.avi" >/dev/null +> > real 0m4.162s +> > user 0m0.020s +> > sys 0m0.510s +> > +> > (the file was not in the cache) +> > => about 52 MB/s (reiser3.6) +> > +> > So, you have a problem with your hardware... +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 7: don't forget to increase your free space map settings +> > +> > +> +> -- +> Dave Cramer +> http://www.postgresintl.com +> 519 939 0336 +> ICQ#14675561 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org +> + +From pgsql-performance-owner@postgresql.org Mon Apr 4 14:48:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 949075342C + for ; + Mon, 4 Apr 2005 14:48:47 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12982-07 + for ; + Mon, 4 Apr 2005 13:48:46 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B40D53426 + for ; + Mon, 4 Apr 2005 14:48:43 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1190937rng + for ; + Mon, 04 Apr 2005 06:48:47 -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:references; + b=DKn/ktsdU9H/xIO6Lrt0t7/4yx/fr3SLkhUqr5ATZjFoQ91Fy3Nm/BCSOCVjmxj3aKdEO99TPfs624IV/gRLlx2nMHxBfdLq71jGy/VVD7esVp4wr6MTrfdQXq4HPzgWn75wj2Y89LAswBJXzPH+etDdCbvWeQSDAQq5kjCbvFI= +Received: by 10.38.69.34 with SMTP id r34mr394704rna; + Mon, 04 Apr 2005 06:48:47 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 06:48:47 -0700 (PDT) +Message-ID: <59d991c40504040648457808e9@mail.gmail.com> +Date: Mon, 4 Apr 2005 09:48:47 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: jd@commandprompt.com +Subject: Re: Sustained inserts per sec ... ? +Cc: Tom Lane , "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c4050401125956d6069d@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.27 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/48 +X-Sequence-Number: 11445 + +On Apr 1, 2005 3:59 PM, Christopher Petrilli wrote: +> On Apr 1, 2005 3:53 PM, Joshua D. Drake wrote: +> > +> > > What seems to happen is it slams into a "wall" of some sort, the +> > > system goes into disk write frenzy (wait=90% CPU), and eventually +> > > recovers and starts running for a while at a more normal speed. What +> > > I need though, is to not have that wall happen. It is easier for me +> > > to accept a constant degredation of 5%, rather than a 99% degredation +> > > for short periods, as it can cause cascade problems in the system. +> > +> > Could this possibly be a checkpoint happening? +> > +> > Also how many checkpoint segments do you have? +> +> Changes to the postgresql.conf file from "default": +> +> maintenance_work_mem = 131072 +> fsync = false +> checkpoint_segments = 32 + +I've now had a chance to run a couple more tests, and here's two +graphs of the time required to insert (via COPY from a file) 500 +records at a time: + +http://www.amber.org/~petrilli/diagrams/pgsql_copy500.png +http://www.amber.org/~petrilli/diagrams/pgsql_copy500_bgwriter.png + +The first is with the above changes, the second contains two +additional modificiations to the configuration: + + bgwriter_percent = 25 + bgwriter_maxpages = 1000 + +To my, likely faulty, intuition, it would seem that there is a backup +happening in the moving of data from the WAL to the final resting +place, and that by increasing these I could pull that forward. As you +can see from the charts, that doesn't seem to have any major impact. +The point, in the rough middle, is where the program begins inserting +into a new table (inherited). The X axis is the "total" number of rows +inserted. The table has: + + * 21 columns (nothing too strange) + * No OIDS + * 5 indexes, including the primary key on a string + +They are created by creating a main table, then doing: + + CREATE TABLE foo001 INHERITS (foos); + +And then recreating all the indexes. + +Thoughts? Any advice would be more than appreciated. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Mon Apr 4 16:52:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 084E1533CD + for ; + Mon, 4 Apr 2005 16:52:06 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65800-03 + for ; + Mon, 4 Apr 2005 15:51:57 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F41D533BB + for ; + Mon, 4 Apr 2005 16:51:53 +0100 (BST) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Mon, 4 Apr 2005 08:54:50 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Mon, 4 Apr 2005 08:54:48 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005040408544803614 + for ; + Mon, 04 Apr 2005 08:54:48 -0700 +X-ASG-Debug-ID: 1112629909-23789-0-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail2 (mail2.hq.corp [192.168.160.6]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 9077F200766A + for ; + Mon, 4 Apr 2005 08:51:49 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Mon, 4 Apr 2005 08:54:41 -0700 +Message-ID: <42515198.9090903@sfnet.cc> +Date: Mon, 04 Apr 2005 07:39:20 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alex Turner +Cc: pg@fastcrypt.com, pgsql-performance@postgresql.org +X-ASG-Orig-Subj: Re: [PERFORM] How to improve db performance with $7K? +Subject: Re: How to improve db performance with $7K? +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> +In-Reply-To: <33c6269f0504040643317b69cd@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 04 Apr 2005 15:54:41.0144 (UTC) + FILETIME=[9CC62F80:01C5392E] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: -0.00 +X-Barracuda-Spam-Status: No, SCORE=-0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_44 +X-Barracuda-Spam-Report: Code version 2.64, rules version 2.1.2546 + Rule breakdown below pts rule name description + ---- ---------------------- ------------------------------------------- + -0.00 BAYES_44 BODY: Bayesian spam probability is 44 to 50% + [score: 0.4808] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.208 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/51 +X-Sequence-Number: 11448 + + + +Alex Turner wrote: + +>To be honest, I've yet to run across a SCSI configuration that can +>touch the 3ware SATA controllers. I have yet to see one top 80MB/sec, +>let alone 180MB/sec read or write, which is why we moved _away_ from +>SCSI. I've seen Compaq, Dell and LSI controllers all do pathetically +>badly on RAID 1, RAID 5 and RAID 10. +> +> +Alex, + +How does the 3ware controller do in heavy writes back to the database? +It may have been Josh, but someone said that SATA does well with reads +but not writes. Would not equal amount of SCSI drives outperform SATA? +I don't want to start a "whose better" war, I am just trying to learn +here. It would seem the more drives you could place in a RAID +configuration, the performance would increase. + +Steve Poe + + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 15:47:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2682D5323D + for ; + Mon, 4 Apr 2005 15:47:33 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34753-03 + for ; + Mon, 4 Apr 2005 14:47:29 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) + by svr1.postgresql.org (Postfix) with ESMTP id B2D5752A6D + for ; + Mon, 4 Apr 2005 15:47:29 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so1592915wri + for ; + Mon, 04 Apr 2005 07:47:34 -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:references; + b=KlvEdxQrtT41gKiLwgyHVQ63AnGn6zf9AAb2FO9XXCPP9zJS8RGSammnm4ozVNgxtJJlJoal+MJPHIaubXecRAxrS7FYdBqb5sx/TN7sfo51UA09F8sUuVj94j1GzOFMMpSAvbs0Gq9OhE+XN2Mdj2LJzKjegRr3QuNZAQ3uO98= +Received: by 10.54.31.37 with SMTP id e37mr364077wre; + Mon, 04 Apr 2005 07:47:34 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 4 Apr 2005 07:47:34 -0700 (PDT) +Message-ID: <33c6269f05040407471d716702@mail.gmail.com> +Date: Mon, 4 Apr 2005 10:47:34 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Tom Lane +Subject: Re: Sustained inserts per sec ... ? +Cc: "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <29021.1112393033@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <33c6269f05040113175b47b640@mail.gmail.com> + <33c6269f050401132052019918@mail.gmail.com> + <29021.1112393033@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.246 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/49 +X-Sequence-Number: 11446 + +Yup, Battery backed, cache enabled. 6 drive RAID 10, and 4 drive RAID +10, and 2xRAID 1. + +It's a 3ware 9500S-8MI - not bad for $450 plus BBU. + +Alex Turner +netEconomist + +On Apr 1, 2005 6:03 PM, Tom Lane wrote: +> Alex Turner writes: +> > On Apr 1, 2005 4:17 PM, Alex Turner wrote: +> >> 1250/sec with record size average is 26 bytes +> >> 800/sec with record size average is 48 bytes. +> >> 250/sec with record size average is 618 bytes. +> +> > Oh - this is with a seperate transaction per command. +> > fsync is on. +> +> [ raised eyebrow... ] What kind of disk hardware is that exactly, and +> does it have write cache enabled? It's hard to believe those numbers +> if not. +> +> Write caching is fine if it's done in a battery-backed cache, which you +> can get in the higher-end hardware RAID controllers. Otherwise you're +> going to have problems whenever the power goes away unexpectedly. +> +> regards, tom lane +> + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:54:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DEB74533AF + for ; + Mon, 4 Apr 2005 16:14:28 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42154-10 + for ; + Mon, 4 Apr 2005 15:14:23 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BA5352967 + for ; + Mon, 4 Apr 2005 16:14:22 +0100 (BST) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id F15C730952; Mon, 4 Apr 2005 17:14:06 +0200 (MET DST) +Date: Mon, 04 Apr 2005 17:18:24 +0200 +From: Hannes Dorbath +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +X-Newsgroups: pgsql.performance +Subject: Re: Query Optimizer Failure / Possible Bug +References: + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +Lines: 66 +Message-ID: <42515478$0$5507$8fe63b2a@news.disputo.net> +Organization: FirstUseNet Intermedia GmbH +X-Complaints-To: abuse@disputo.de +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/207 +X-Sequence-Number: 11604 + +Mhh. I have no clue about the internals of PostgreSQL and query planing, +but to me as user this should really be a thing the optimizer has to +work out.. + + +On 03.04.2005 10:01, PFC wrote: +> +> Noticed this problem,too. +> You can always make the calculation you want done once inside a set +> returning function so it'll behave like a table, but that's ugly. +> +> On Mon, 28 Mar 2005 16:14:44 +0200, Hannes Dorbath +> wrote: +> +>> hm, a few days and not a single reply :| +>> +>> any more information needed? test data? simplified test case? anything? +>> +>> +>> thanks +>> +>> +>> Hannes Dorbath wrote: +>> +>>> The query and the corresponding EXPLAIN is at +>>> http://hannes.imos.net/query.txt +>>> I'd like to use the column q.replaced_serials for multiple calculations +>>> in the SELECT clause, but every time it is referenced there in some way +>>> the whole query in the FROM clause returning q is executed again. +>>> This doesn't make sense to me at all and eats performance. +>>> If this wasn't clear enough, for every +>>> q.replaced_serials AS some_column +>>> in the SELECT clause there is new block of +>>> --------------------------------------------------------------- +>>> -> Aggregate (cost=884.23..884.23 rows=1 width=0) +>>> -> Nested Loop (cost=0.00..884.23 rows=1 width=0) +>>> -> Index Scan using ix_rma_ticket_serials_replace on +>>> rma_ticket_serials rts (cost=0.00..122.35 +>>> rows=190 width=4) +>>> Index Cond: ("replace" = false) +>>> -> Index Scan using pk_serials on serials s +>>> (cost=0.00..3.51 rows=1 width=4) +>>> Index Cond: (s.serial_id = "outer".serial_id) +>>> Filter: ((article_no = $0) AND (delivery_id = $1)) +>>> --------------------------------------------------------------- +>>> in the EXPLAIN result. +>>> For those who wonder why I do this FROM (SELECT...). I was +>>> searching for +>>> a way to use the result of an subselect for multiple calculations in the +>>> SELECT clause and return that calculation results as individual columns. +>>> I tested a bit further and found out that PG behaves the same in case q +>>> is a view. This makes me wonder how efficient the optimizer can work +>>> with views - or even worse - nested views. +>>> Tested and reproduced on PG 7.4.1 linux and 8.0.0 win32. +>>> Thanks in advance, +>>> Hannes Dorbath +>> +>> +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +From pgsql-performance-owner@postgresql.org Mon Apr 4 16:49:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 30FD75294B + for ; + Mon, 4 Apr 2005 16:49:38 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60456-09 + for ; + Mon, 4 Apr 2005 15:49:31 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 83AA2533F6 + for ; + Mon, 4 Apr 2005 16:49:31 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j34FnLPA026422; + Mon, 4 Apr 2005 11:49:21 -0400 (EDT) +To: alvin.yk@gmail.com +Cc: pgsql-performance@postgresql.org +Subject: Re: 8.0.1 performance question. +In-reply-to: +References: +Comments: In-reply-to + message dated "Mon, 04 Apr 2005 18:32:04 +0800" +Date: Mon, 04 Apr 2005 11:49:21 -0400 +Message-ID: <26421.1112629761@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/50 +X-Sequence-Number: 11447 + + writes: +> As a result, I modified log_statement to all. Without my application +> doing anything, I see statements below being executed non-stop. Who +> is triggering these statemetns? Is this normal? What am I doing +> wrong? + +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +> (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +> L +> IKE '%nextval(%' + +Better ask about that on pgsql-jdbc. I suppose this is the trace of the +JDBC driver trying to find out column metadata ... but if it's failing +to cache the information that's a pretty serious performance hit. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 4 16:53:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 90219529CE; + Mon, 4 Apr 2005 16:53:17 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65201-06; Mon, 4 Apr 2005 15:53:15 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 38DBE52968; + Mon, 4 Apr 2005 16:53:13 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j34FqxnQ026455; + Mon, 4 Apr 2005 11:52:59 -0400 (EDT) +To: Christopher Petrilli +Cc: jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <59d991c40504040648457808e9@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Mon, 04 Apr 2005 09:48:47 -0400" +Date: Mon, 04 Apr 2005 11:52:59 -0400 +Message-ID: <26454.1112629979@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/52 +X-Sequence-Number: 11449 + +Christopher Petrilli writes: +> The table has: +> * 21 columns (nothing too strange) +> * No OIDS +> * 5 indexes, including the primary key on a string + +Could we see the *exact* SQL definitions of the table and indexes? +Also some sample data would be interesting. I'm wondering for example +about the incidence of duplicate index keys. + + regards, tom lane + +From pgsql-jdbc-owner@postgresql.org Mon Apr 4 17:00:59 2005 +X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8150552968 + for ; + Mon, 4 Apr 2005 17:00:58 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66222-09 + for ; + Mon, 4 Apr 2005 16:00:44 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 33BB35294B + for ; Mon, 4 Apr 2005 17:00:41 +0100 (BST) +Received: by zproxy.gmail.com with SMTP id 9so323689nzo + for ; Mon, 04 Apr 2005 09:00:39 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=LSHYf8iwBB3dVBiJOpCmiP6MJ//EPTAk7v2/IcaxNdLWJ8jw5ANL0xWJCXmDR3SVoxJiTM9TZPvM7IINeEGVIirf1OIixikRCKAVPGxftwk8f39mB5nSSbEnsGtJhJWTFS3lg25FYEAnJqJbGppWHtJOKQ0tMvMp0ZFxFfuMmMc= +Received: by 10.36.43.10 with SMTP id q10mr67299nzq; + Mon, 04 Apr 2005 09:00:39 -0700 (PDT) +Received: by 10.36.31.14 with HTTP; Mon, 4 Apr 2005 09:00:39 -0700 (PDT) +Message-ID: +Date: Tue, 5 Apr 2005 00:00:39 +0800 +From: +Reply-To: +To: pgsql-jdbc@postgresql.org +Subject: 8.0.1 performance question. +In-Reply-To: <26421.1112629761@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: + <26421.1112629761@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/13 +X-Sequence-Number: 12620 + +Hi, + +I have just upgraded our db from 7.4.2 to 8.0.1 and we are doing some +testing. For some reasons, we have discovered that our application +performs much slower on 8.0.1. + +My initial reaction was to turn on log_min_duration_statement to see +what's happening. However, log_min_duration_statement does not work +for JDBC clients in 8.0.1. + +As a result, I modified log_statement to all. Without my application +doing anything, I see statements below being executed non-stop. Who +is triggering these statemetns? Is this normal? What am I doing +wrong? + +I am using Fedora Core 1 - Kernel: 2.4.22-1.2174.nptl + +Please help. Thanks. + +PS. I sent this email to the performance list and Tom asked me to +check with this list. Therefore, here I am. + +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +(a.attrelid=c.oid +) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +L +IKE '%nextval(%' + + +---------- Forwarded message ---------- +From: Tom Lane +Date: Apr 4, 2005 11:49 PM +Subject: Re: [PERFORM] 8.0.1 performance question. +To: alvin.yk@gmail.com +Cc: pgsql-performance@postgresql.org + + + writes: +> As a result, I modified log_statement to all. Without my application +> doing anything, I see statements below being executed non-stop. Who +> is triggering these statemetns? Is this normal? What am I doing +> wrong? + +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +> (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +> L +> IKE '%nextval(%' + +Better ask about that on pgsql-jdbc. I suppose this is the trace of the +JDBC driver trying to find out column metadata ... but if it's failing +to cache the information that's a pretty serious performance hit. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 4 17:09:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B056E533BB + for ; + Mon, 4 Apr 2005 17:09:37 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74446-05 + for ; + Mon, 4 Apr 2005 16:09:36 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.193]) + by svr1.postgresql.org (Postfix) with ESMTP id 73B56529E1 + for ; + Mon, 4 Apr 2005 17:09:35 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1239120rng + for ; + Mon, 04 Apr 2005 09:09:35 -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:references; + b=bmkLlaRHj6ydrj4IH5tOid8ZtS/OIl037dSrac6HwBjpPldC7MpkxSkeuxPGjrSr91XzAOP6cex0HNV615eatpI/5cmuqArADXmRA9GPY1bOL+pXPgLKK5FGmglzrZihde851IiLwh7fAJTQrubNP89/MwwJnVqI1PGm+k6MkOQ= +Received: by 10.38.151.1 with SMTP id y1mr5408462rnd; + Mon, 04 Apr 2005 09:09:35 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 09:09:35 -0700 (PDT) +Message-ID: <59d991c405040409094e7bbd17@mail.gmail.com> +Date: Mon, 4 Apr 2005 12:09:35 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Sustained inserts per sec ... ? +Cc: jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <26454.1112629979@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.279 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/53 +X-Sequence-Number: 11450 + +On Apr 4, 2005 11:52 AM, Tom Lane wrote: +> Christopher Petrilli writes: +> > The table has: +> > * 21 columns (nothing too strange) +> > * No OIDS +> > * 5 indexes, including the primary key on a string +> +> Could we see the *exact* SQL definitions of the table and indexes? +> Also some sample data would be interesting. I'm wondering for example +> about the incidence of duplicate index keys. + +Of course, this is a bit cleansed, since it's an internal project, but +only the column names are changed: + +CREATE TABLE foos ( + foo_id VARCHAR(32), + s_ts INTEGER NOT NULL, + c_ts INTEGER NOT NULL, + bar_id INTEGER NOT NULL, + proto INTEGER NOT NULL, + src_ip INT8 NOT NULL, + dst_ip INT8 NOT NULL, + src_port INTEGER, + dst_port INTEGER, + nated INTEGER NOT NULL, + src_nat_ip INT8, + dst_nat_ip INT8, + src_nat_port INTEGER, + dst_nat_port INTEGER, + foo_class INTEGER NOT NULL, + foo_type INTEGER NOT NULL, + src_bar INTEGER NOT NULL, + dst_bar INTEGER NOT NULL, + user_name VARCHAR(255), + info TEXT +) WITHOUT OIDS; +ALTER TABLE foos ADD CONSTRAINT foos_foo_id_pk UNIQUE (foo_id); +CREATE INDEX foos_c_ts_idx ON foos(conduit_ts); +CREATE INDEX foos_src_ip_idx ON foos(src_ip); +CREATE INDEX foos_dst_ip_idx ON foos(dst_ip); +CREATE INDEX foos_foo_class_idx ON foos(foo_class); +CREATE INDEX foos_foo_type_idx ON foos(foo_type); + + +CREATE TABLE foos001 ( ) INHERITS (foos) WITHOUT OIDS; +ALTER TABLE foos001 ADD CONSTRAINT foos001_foo_id_pk UNIQUE (foo_id); +CREATE INDEX foos001_c_ts_idx ON foos001(conduit_ts); +CREATE INDEX foos001_src_ip_idx ON foos001(src_ip); +CREATE INDEX foos001_dst_ip_idx ON foos001(dst_ip); +CREATE INDEX foos001_foo_class_idx ON foos001(foo_class); +CREATE INDEX foos001_foo_type_idx ON foos001(foo_type); + +That continues on, but you get the idea... + +So, as you asked about data content, specifically regarding indices, +here's what the "simulator" creates: + +foo_id - 32 character UID (generated by the UUID function in mxTools, +which looks like '00beef19420053c64f3f01aeb0b4a2a5', and varies in the +upper components more than the lower. + +*_ts - UNIX epoch timestamps, sequential. There's a long story behind +not using DATETIME format, but if that's the big issue, it can be +dealt with. + +*_ip - Randomly selected 32-bit integers from a pre-generated list +containing about 500 different numbers ranging from 3232235500 to +3232236031. This is unfortunately, not too atypical from the "real +world". + +*_class - Randomly selected 1-100 (again, not atypical, although +normal distribution would be less random) + +*_type - Randomly selected 1-10000 (not atypical, and more random than +in real world) + +Hopefully this helps? + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-jdbc-owner@postgresql.org Mon Apr 4 17:15:53 2005 +X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0499B5341E + for ; + Mon, 4 Apr 2005 17:15:52 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76833-05 + for ; + Mon, 4 Apr 2005 16:15:42 +0000 (GMT) +Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) + by svr1.postgresql.org (Postfix) with SMTP id 4FEE053400 + for ; Mon, 4 Apr 2005 17:15:41 +0100 (BST) +Received: (qmail 8747 invoked by uid 1112); 4 Apr 2005 16:15:40 -0000 +Date: Mon, 4 Apr 2005 11:15:40 -0500 (EST) +From: Kris Jurka +X-X-Sender: books@leary.csoft.net +To: alvin.yk@gmail.com +Cc: pgsql-jdbc@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: 8.0.1 performance question. +In-Reply-To: +Message-ID: +References: + <26421.1112629761@sss.pgh.pa.us> + +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/14 +X-Sequence-Number: 12621 + + + +On Tue, 5 Apr 2005 alvin.yk@gmail.com wrote: + +> I see statements below being executed non-stop. Who is triggering these +> statemetns? Is this normal? What am I doing wrong? +> +> +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +> (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +> L +> IKE '%nextval(%' + +These are the results of ResultSetMetaData.isNullable() and +isAutoIncrement(), which your code is apparently calling. The results of +these calls are cached on a per ResultSet data. We have discussed +caching them at a higher level, but couldn't find a way to know when to +flush that cache. + +Kris Jurka + +From pgsql-performance-owner@postgresql.org Mon Apr 4 17:23:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AEB695336C; + Mon, 4 Apr 2005 17:23:33 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78666-04; Mon, 4 Apr 2005 16:23:31 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id ED3C75294B; + Mon, 4 Apr 2005 17:23:30 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j34GNRTs026670; + Mon, 4 Apr 2005 12:23:27 -0400 (EDT) +To: Christopher Petrilli +Cc: jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <59d991c405040409094e7bbd17@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Mon, 04 Apr 2005 12:09:35 -0400" +Date: Mon, 04 Apr 2005 12:23:27 -0400 +Message-ID: <26669.1112631807@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/55 +X-Sequence-Number: 11452 + +Christopher Petrilli writes: +> On Apr 4, 2005 11:52 AM, Tom Lane wrote: +>> Could we see the *exact* SQL definitions of the table and indexes? + +> Of course, this is a bit cleansed, since it's an internal project, but +> only the column names are changed: + +Thanks. No smoking gun in sight there. But out of curiosity, can you +do a test run with *no* indexes on the table, just to see if it behaves +any differently? Basically I was wondering if index overhead might be +part of the problem. + +Also, the X-axis on your graphs seems to be total number of rows +inserted ... can you relate that to elapsed real time for us? + + regards, tom lane + +From pgsql-jdbc-owner@postgresql.org Mon Apr 4 17:44:31 2005 +X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AEA653455 + for ; + Mon, 4 Apr 2005 17:44:30 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86452-08 + for ; + Mon, 4 Apr 2005 16:44:28 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.199]) + by svr1.postgresql.org (Postfix) with ESMTP id BB0AE533E0 + for ; Mon, 4 Apr 2005 17:44:26 +0100 (BST) +Received: by zproxy.gmail.com with SMTP id 9so330029nzo + for ; Mon, 04 Apr 2005 09:44:26 -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:references; + b=KR0XseK7xQ9Mr8mveBrAzxod2oIUSdz4uQX/sfxagweJga5l6EPbhK+iz1Yw2cKWFO0NYqX/axsCc0+SjL9o/P4NQOmB0B53VSmv/ykkEdK64agqnhjIP39zbttpgV9aKNiux+xmeFgcdXV/zUckzGfE/yV7bVrPFG6OBg7S67w= +Received: by 10.36.37.6 with SMTP id k6mr68661nzk; + Mon, 04 Apr 2005 09:44:26 -0700 (PDT) +Received: by 10.36.31.14 with HTTP; Mon, 4 Apr 2005 09:44:26 -0700 (PDT) +Message-ID: +Date: Tue, 5 Apr 2005 00:44:26 +0800 +From: +Reply-To: +To: Kris Jurka +Subject: Re: 8.0.1 performance question. +Cc: pgsql-jdbc@postgresql.org, pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: + <26421.1112629761@sss.pgh.pa.us> + + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.389 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, NO_REAL_NAME, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/16 +X-Sequence-Number: 12623 + +Thank you for the quick response. To help me debug what's happening, +can you tell me what's the difference between the 7.4 and 8.0 jdbc +drivers in this regard? Is this something that is newly introduced in +8.0? Or is this something that has always been happening? + +Thanks. + + + +On Apr 5, 2005 12:15 AM, Kris Jurka wrote: +> +> +> On Tue, 5 Apr 2005 alvin.yk@gmail.com wrote: +> +> > I see statements below being executed non-stop. Who is triggering these +> > statemetns? Is this normal? What am I doing wrong? +> > +> > +> > 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> > pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> > 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> > pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON +> > (a.attrelid=c.oid +> > ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> > a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc +> > L +> > IKE '%nextval(%' +> +> These are the results of ResultSetMetaData.isNullable() and +> isAutoIncrement(), which your code is apparently calling. The results of +> these calls are cached on a per ResultSet data. We have discussed +> caching them at a higher level, but couldn't find a way to know when to +> flush that cache. +> +> Kris Jurka +> + +From pgsql-performance-owner@postgresql.org Mon Apr 4 17:51:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C000353425 + for ; + Mon, 4 Apr 2005 17:51:20 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87445-07 + for ; + Mon, 4 Apr 2005 16:51:18 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 61EBA5341F + for ; + Mon, 4 Apr 2005 17:51:17 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1253381rng + for ; + Mon, 04 Apr 2005 09:51:18 -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:references; + b=hjelBWIadqy5DoqyWufv8UTv8dGSlvk9+XE2/SQMwd7dkjxrQf1BLTBdPwRoTqEmoCLjZhy/1YVEujXxgFl9uhd78cIc96rpkZpOiBWH5stwQS7DeumeUvA6vXKh9/+RzgwUMm3HyEFHxjI0KeV0EKWimRmBTpUM80nFxvzxPE4= +Received: by 10.38.160.52 with SMTP id i52mr5389329rne; + Mon, 04 Apr 2005 09:51:17 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 09:51:17 -0700 (PDT) +Message-ID: <59d991c4050404095114ff953c@mail.gmail.com> +Date: Mon, 4 Apr 2005 12:51:17 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Sustained inserts per sec ... ? +Cc: jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <26669.1112631807@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.286 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/57 +X-Sequence-Number: 11454 + +On Apr 4, 2005 12:23 PM, Tom Lane wrote: +> Christopher Petrilli writes: +> > On Apr 4, 2005 11:52 AM, Tom Lane wrote: +> >> Could we see the *exact* SQL definitions of the table and indexes? +> +> > Of course, this is a bit cleansed, since it's an internal project, but +> > only the column names are changed: +> +> Thanks. No smoking gun in sight there. But out of curiosity, can you +> do a test run with *no* indexes on the table, just to see if it behaves +> any differently? Basically I was wondering if index overhead might be +> part of the problem. + +Running now, but it'll take a while since I have a 3/4 second pause +after each COPY to better reflect "real world" ... the application +does 1 COPY per second, or whenever it hits 1000 entries. This seemed +to be a sane way to deal with it, and not burden the system with +needless index balancing, etc. + +> Also, the X-axis on your graphs seems to be total number of rows +> inserted ... can you relate that to elapsed real time for us? + +Sure, like I said, there's a 3/4 second sleep between each COPY, +regardless of how long it took (which well, isn't quite right, but +close enough for this test). I've created a PNG with the X axies +reflecting "elapsed time": + +http://www.amber.org/~petrilli/diagrams/pgsql_copyperf_timeline.png + +In addition, I've put up the raw data I used: + +http://www.amber.org/~petrilli/diagrams/results_timeline.txt + +The columns are rowcount, elapsed time, instance time. +Hopefully this might help some? This machine has nothing else running +on it other than the normal stripped down background processes (like +sshd). + +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-jdbc-owner@postgresql.org Mon Apr 4 18:05:22 2005 +X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DF4AB5342A + for ; + Mon, 4 Apr 2005 18:05:20 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91940-07 + for ; + Mon, 4 Apr 2005 17:05:18 +0000 (GMT) +Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) + by svr1.postgresql.org (Postfix) with SMTP id 0533653424 + for ; Mon, 4 Apr 2005 18:05:17 +0100 (BST) +Received: (qmail 5255 invoked by uid 1112); 4 Apr 2005 17:05:17 -0000 +Date: Mon, 4 Apr 2005 12:05:17 -0500 (EST) +From: Kris Jurka +X-X-Sender: books@leary.csoft.net +To: alvin.yk@gmail.com +Cc: pgsql-jdbc@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: 8.0.1 performance question. +In-Reply-To: +Message-ID: +References: + <26421.1112629761@sss.pgh.pa.us> + + + +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/17 +X-Sequence-Number: 12624 + + + +On Tue, 5 Apr 2005 alvin.yk@gmail.com wrote: + +> Thank you for the quick response. To help me debug what's happening, +> can you tell me what's the difference between the 7.4 and 8.0 jdbc +> drivers in this regard? Is this something that is newly introduced in +> 8.0? Or is this something that has always been happening? +> + +8.0 is the first driver version to take advantage of the V3 protocol's +ability to return the base tables and columns of a ResultSet. +Previously isNullable was hardcoded to always return +columnNullableUnknown and isAutoIncrement always returned false. + +I guess the question is why are you calling these methods if they didn't +work previously? + +Kris Jurka + +From pgsql-performance-owner@postgresql.org Mon Apr 4 20:13:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EA05A53398 + for ; + Mon, 4 Apr 2005 20:13:57 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27804-06 + for ; + Mon, 4 Apr 2005 19:13:49 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id 24BCE52A5C + for ; + Mon, 4 Apr 2005 20:13:48 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so1674887wri + for ; + Mon, 04 Apr 2005 12:13:50 -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:references; + b=lHaJhhLQv3pgC6PKEKKctB4PUcTBEPt7gWsKM6PdvcC0YiUo1EyhYHYpBulLQCwQ7UJAwaOIoUcOeQMXrKrCOZU2qwzGaU7S6M4/8RqF8jkCv8Vh30sMEvSUF68DK9ujBVGLIsl9OMxprNNLrf4f5CEdQuB2PBof9IvOkRbZ0vg= +Received: by 10.54.13.34 with SMTP id 34mr260wrm; + Mon, 04 Apr 2005 12:12:54 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 4 Apr 2005 12:12:20 -0700 (PDT) +Message-ID: <33c6269f05040412126b5bc719@mail.gmail.com> +Date: Mon, 4 Apr 2005 15:12:20 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Steve Poe +Subject: Re: How to improve db performance with $7K? +Cc: pg@fastcrypt.com, pgsql-performance@postgresql.org +In-Reply-To: <42515198.9090903@sfnet.cc> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <42443863.4040302@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.247 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/59 +X-Sequence-Number: 11456 + +I'm no drive expert, but it seems to me that our write performance is +excellent. I think what most are concerned about is OLTP where you +are doing heavy write _and_ heavy read performance at the same time. + +Our system is mostly read during the day, but we do a full system +update everynight that is all writes, and it's very fast compared to +the smaller SCSI system we moved off of. Nearly a 6x spead +improvement, as fast as 900 rows/sec with a 48 byte record, one row +per transaction. + +I don't know enough about how SATA works to really comment on it's +performance as a protocol compared with SCSI. If anyone has a usefull +link on that, it would be greatly appreciated. + +More drives will give more throughput/sec, but not necesarily more +transactions/sec. For that you will need more RAM on the controler, +and defaintely a BBU to keep your data safe. + +Alex Turner +netEconomist + +On Apr 4, 2005 10:39 AM, Steve Poe wrote: +> +> +> Alex Turner wrote: +> +> >To be honest, I've yet to run across a SCSI configuration that can +> >touch the 3ware SATA controllers. I have yet to see one top 80MB/sec, +> >let alone 180MB/sec read or write, which is why we moved _away_ from +> >SCSI. I've seen Compaq, Dell and LSI controllers all do pathetically +> >badly on RAID 1, RAID 5 and RAID 10. +> > +> > +> Alex, +> +> How does the 3ware controller do in heavy writes back to the database? +> It may have been Josh, but someone said that SATA does well with reads +> but not writes. Would not equal amount of SCSI drives outperform SATA? +> I don't want to start a "whose better" war, I am just trying to learn +> here. It would seem the more drives you could place in a RAID +> configuration, the performance would increase. +> +> Steve Poe +> +> + +From pgsql-performance-owner@postgresql.org Mon Apr 4 20:25:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A22D25334D + for ; + Mon, 4 Apr 2005 20:23:37 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32441-01 + for ; + Mon, 4 Apr 2005 19:23:36 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 43BD952A5C + for ; + Mon, 4 Apr 2005 20:23:33 +0100 (BST) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id 8F7DCB80C + for ; + Mon, 4 Apr 2005 15:23:33 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v619.2) +In-Reply-To: <33c6269f05040412126b5bc719@mail.gmail.com> +References: <42443863.4040302@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Vivek Khera +Subject: Re: How to improve db performance with $7K? +Date: Mon, 4 Apr 2005 15:23:33 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.143 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/60 +X-Sequence-Number: 11457 + + +On Apr 4, 2005, at 3:12 PM, Alex Turner wrote: + +> Our system is mostly read during the day, but we do a full system +> update everynight that is all writes, and it's very fast compared to +> the smaller SCSI system we moved off of. Nearly a 6x spead +> improvement, as fast as 900 rows/sec with a 48 byte record, one row +> per transaction. +> + +Well, if you're not heavily multitasking, the advantage of SCSI is lost +on you. + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 20:33:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A9DCA53400 + for ; + Mon, 4 Apr 2005 20:33:39 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35427-01 + for ; + Mon, 4 Apr 2005 19:33:36 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id BD958533EE + for ; + Mon, 4 Apr 2005 20:33:35 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so1682068wri + for ; + Mon, 04 Apr 2005 12:33:36 -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:references; + b=VKPaixeRReUD1eVAV66JWa6rOk0Xiec5aI0o73X/M84ayqjFDM5uyJpIzu/cFYitebMfrq8s6K/YfezkBcjHelB0EhNVkcdEfsvTCLTojrrVC+AySZ4fRqRxRqnP7NpRW18QfnTfgVzPmGebR0xy3YM6c8lqzegDMv2ZW0KWAtY= +Received: by 10.54.7.36 with SMTP id 36mr79801wrg; + Mon, 04 Apr 2005 12:33:36 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 4 Apr 2005 12:33:35 -0700 (PDT) +Message-ID: <33c6269f05040412336cbfe3b4@mail.gmail.com> +Date: Mon, 4 Apr 2005 15:33:35 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Vivek Khera +Subject: Re: How to improve db performance with $7K? +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <42443863.4040302@sfnet.cc> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.249 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/61 +X-Sequence-Number: 11458 + +I'm doing some research on SATA vs SCSI right now, but to be honest +I'm not turning up much at the protocol level. Alot of stupid +benchmarks comparing 10k Raptor drives against Top of the line 15k +drives, where usnurprsingly the SCSI drives win but of course cost 4 +times as much. Although even in some, SATA wins, or draws. I'm +trying to find something more apples to apples. 10k to 10k. + +Alex Turner +netEconomist + + + +On Apr 4, 2005 3:23 PM, Vivek Khera wrote: +> +> On Apr 4, 2005, at 3:12 PM, Alex Turner wrote: +> +> > Our system is mostly read during the day, but we do a full system +> > update everynight that is all writes, and it's very fast compared to +> > the smaller SCSI system we moved off of. Nearly a 6x spead +> > improvement, as fast as 900 rows/sec with a 48 byte record, one row +> > per transaction. +> > +> +> Well, if you're not heavily multitasking, the advantage of SCSI is lost +> on you. +> +> Vivek Khera, Ph.D. +> +1-301-869-4449 x806 +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org +> + +From pgsql-performance-owner@postgresql.org Mon Apr 4 20:48:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F1766537BE; + Mon, 4 Apr 2005 20:48:55 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38848-03; Mon, 4 Apr 2005 19:48:53 +0000 (GMT) +Received: from cmailm3.svr.pol.co.uk (cmailm3.svr.pol.co.uk [195.92.193.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 6946E536EC; + Mon, 4 Apr 2005 20:48:52 +0100 (BST) +Received: from modem-3463.lion.dialup.pol.co.uk ([217.135.173.135] + helo=192.168.0.102) by cmailm3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DIXZ4-0008TF-0W; Mon, 04 Apr 2005 20:48:50 +0100 +Subject: Re: Sustained inserts per sec ... ? +From: Simon Riggs +To: Christopher Petrilli +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c40504040648457808e9@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 04 Apr 2005 20:46:54 +0100 +Message-Id: <1112644015.16721.790.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/62 +X-Sequence-Number: 11459 + +On Mon, 2005-04-04 at 09:48 -0400, Christopher Petrilli wrote: +> The point, in the rough middle, is where the program begins inserting +> into a new table (inherited). The X axis is the "total" number of rows +> inserted. + +and you also mention the same data plotted with elapsed time: +http://www.amber.org/~petrilli/diagrams/pgsql_copyperf_timeline.png + +Your graphs look identical to others I've seen, so I think we're +touching on something wider than your specific situation. The big +difference is that things seem to go back to high performance when you +switch to a new inherited table. + +I'm very interested in the graphs of elapsed time for COPY 500 rows +against rows inserted. The simplistic inference from those graphs are +that if you only inserted 5 million rows into each table, rather than 10 +million rows then everything would be much quicker. I hope this doesn't +work, but could you try that to see if it works? I'd like to rule out a +function of "number of rows" as an issue, or focus in on it depending +upon the results. + +Q: Please can you confirm that the discontinuity on the graph at around +5000 elapsed seconds matches EXACTLY with the switch from one table to +another? That is an important point. + +Q: How many data files are there for these relations? Wouldn't be two, +by any chance, when we have 10 million rows in them? + +Q: What is the average row length? +About 150-160 bytes? + +Thanks, + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 20:57:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 87460537BE + for ; + Mon, 4 Apr 2005 20:57:02 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41799-03 + for ; + Mon, 4 Apr 2005 19:56:58 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.199]) + by svr1.postgresql.org (Postfix) with ESMTP id 9F46F537C9 + for ; + Mon, 4 Apr 2005 20:56:57 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1301802rng + for ; + Mon, 04 Apr 2005 12:56:59 -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:references; + b=j78bxjrCUIsDVRWkv7QdASbcXRglJQj7dNhhZqZcpVgSm45rhzZQNykjBV5sG84bi80BstkCFz3MpG1UiB2lz4DsLJDbBGByFkSxS5HUbEczhh4ZFYoqCu0GjR2D36qxO94K4rJP4oIu9dZpAia3ZouW7O5JWLN/M3Dczz9AVvs= +Received: by 10.38.161.30 with SMTP id j30mr834844rne; + Mon, 04 Apr 2005 12:56:59 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 12:56:58 -0700 (PDT) +Message-ID: <59d991c4050404125611ad5af8@mail.gmail.com> +Date: Mon, 4 Apr 2005 15:56:58 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Simon Riggs +Subject: Re: Sustained inserts per sec ... ? +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <1112644015.16721.790.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.291 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/63 +X-Sequence-Number: 11460 + +On Apr 4, 2005 3:46 PM, Simon Riggs wrote: +> On Mon, 2005-04-04 at 09:48 -0400, Christopher Petrilli wrote: +> > The point, in the rough middle, is where the program begins inserting +> > into a new table (inherited). The X axis is the "total" number of rows +> > inserted. +> +> and you also mention the same data plotted with elapsed time: +> http://www.amber.org/~petrilli/diagrams/pgsql_copyperf_timeline.png +> +> Your graphs look identical to others I've seen, so I think we're +> touching on something wider than your specific situation. The big +> difference is that things seem to go back to high performance when you +> switch to a new inherited table. + +This is correct. + +> I'm very interested in the graphs of elapsed time for COPY 500 rows +> against rows inserted. The simplistic inference from those graphs are +> that if you only inserted 5 million rows into each table, rather than 10 +> million rows then everything would be much quicker. I hope this doesn't +> work, but could you try that to see if it works? I'd like to rule out a +> function of "number of rows" as an issue, or focus in on it depending +> upon the results. +> +> Q: Please can you confirm that the discontinuity on the graph at around +> 5000 elapsed seconds matches EXACTLY with the switch from one table to +> another? That is an important point. + +Well, the change over happens at 51593.395205 seconds :-) Here's two +lines from the results with row count and time added: + +10000000 51584.9818912 8.41331386566 +10000500 51593.395205 0.416964054108 + +Note that 10M is when it swaps. I see no reason to interpret it +differently, so it seems to be totally based around switching tables +(and thereby indices). + +> Q: How many data files are there for these relations? Wouldn't be two, +> by any chance, when we have 10 million rows in them? + +I allow PostgreSQL to manage all the data files itself, so here's the +default tablespace: + +total 48 +drwx------ 2 pgsql pgsql 4096 Jan 26 20:59 1 +drwx------ 2 pgsql pgsql 4096 Dec 17 19:15 17229 +drwx------ 2 pgsql pgsql 4096 Feb 16 17:55 26385357 +drwx------ 2 pgsql pgsql 4096 Mar 24 23:56 26425059 +drwx------ 2 pgsql pgsql 8192 Mar 28 11:31 26459063 +drwx------ 2 pgsql pgsql 8192 Mar 31 23:54 26475755 +drwx------ 2 pgsql pgsql 4096 Apr 4 15:07 26488263 +[root@bigbird base]# du +16624 ./26425059 +5028 ./26385357 +5660 ./26459063 +4636 ./17229 +6796 ./26475755 +4780 ./1 +1862428 ./26488263 +1905952 . + +> Q: What is the average row length? +> About 150-160 bytes? + +Raw data is around 150bytes, after insertion, I'd need to do some +other calculations. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Mon Apr 4 21:13:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B8285341E; + Mon, 4 Apr 2005 21:13:22 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45464-10; Mon, 4 Apr 2005 20:13:12 +0000 (GMT) +Received: from cmailm3.svr.pol.co.uk (cmailm3.svr.pol.co.uk [195.92.193.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D25652968; + Mon, 4 Apr 2005 21:13:11 +0100 (BST) +Received: from modem-3463.lion.dialup.pol.co.uk ([217.135.173.135] + helo=192.168.0.102) by cmailm3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DIXwc-00057z-2J; Mon, 04 Apr 2005 21:13:10 +0100 +Subject: Re: Sustained inserts per sec ... ? +From: Simon Riggs +To: Christopher Petrilli +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c4050404125611ad5af8@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 04 Apr 2005 21:11:19 +0100 +Message-Id: <1112645479.16721.806.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/64 +X-Sequence-Number: 11461 + +On Mon, 2005-04-04 at 15:56 -0400, Christopher Petrilli wrote: +> On Apr 4, 2005 3:46 PM, Simon Riggs wrote: +> > On Mon, 2005-04-04 at 09:48 -0400, Christopher Petrilli wrote: +> > > The point, in the rough middle, is where the program begins inserting +> > > into a new table (inherited). The X axis is the "total" number of rows +> > > inserted. +> > +> > and you also mention the same data plotted with elapsed time: +> > http://www.amber.org/~petrilli/diagrams/pgsql_copyperf_timeline.png +> > +> > Your graphs look identical to others I've seen, so I think we're +> > touching on something wider than your specific situation. The big +> > difference is that things seem to go back to high performance when you +> > switch to a new inherited table. +> +> This is correct. +> +> > I'm very interested in the graphs of elapsed time for COPY 500 rows +> > against rows inserted. The simplistic inference from those graphs are +> > that if you only inserted 5 million rows into each table, rather than 10 +> > million rows then everything would be much quicker. I hope this doesn't +> > work, but could you try that to see if it works? I'd like to rule out a +> > function of "number of rows" as an issue, or focus in on it depending +> > upon the results. + +Any chance of running a multiple load of 4 million rows per table, +leaving the test running for at least 3 tables worth (12+ M rows)? + +> > +> > Q: Please can you confirm that the discontinuity on the graph at around +> > 5000 elapsed seconds matches EXACTLY with the switch from one table to +> > another? That is an important point. +> +> Well, the change over happens at 51593.395205 seconds :-) Here's two +> lines from the results with row count and time added: +> +> 10000000 51584.9818912 8.41331386566 +> 10000500 51593.395205 0.416964054108 +> +> Note that 10M is when it swaps. I see no reason to interpret it +> differently, so it seems to be totally based around switching tables +> (and thereby indices). + +OK, but do you have some other external knowledge that it is definitely +happening at that time? Your argument above seems slightly circular to +me. + +This is really important because we need to know whether it ties in with +that event, or some other. + +Have you run this for more than 2 files, say 3 or more? + +You COMMIT after each 500 rows? + +> > Q: How many data files are there for these relations? Wouldn't be two, +> > by any chance, when we have 10 million rows in them? +> +> I allow PostgreSQL to manage all the data files itself, so here's the +> default tablespace: +> +> total 48 +> drwx------ 2 pgsql pgsql 4096 Jan 26 20:59 1 +> drwx------ 2 pgsql pgsql 4096 Dec 17 19:15 17229 +> drwx------ 2 pgsql pgsql 4096 Feb 16 17:55 26385357 +> drwx------ 2 pgsql pgsql 4096 Mar 24 23:56 26425059 +> drwx------ 2 pgsql pgsql 8192 Mar 28 11:31 26459063 +> drwx------ 2 pgsql pgsql 8192 Mar 31 23:54 26475755 +> drwx------ 2 pgsql pgsql 4096 Apr 4 15:07 26488263 +> [root@bigbird base]# du +> 16624 ./26425059 +> 5028 ./26385357 +> 5660 ./26459063 +> 4636 ./17229 +> 6796 ./26475755 +> 4780 ./1 +> 1862428 ./26488263 +> 1905952 . + +OK. Please... +cd $PGDATA/base/26488263 +ls -l + +I'm looking for the number of files associated with each inherited table +(heap). + +> > Q: What is the average row length? +> > About 150-160 bytes? +> +> Raw data is around 150bytes, after insertion, I'd need to do some +> other calculations. + +By my calculations, you should have just 2 data files per 10M rows for +the main table. The performance degradation seems to coincide with the +point where we move to inserting into the second of the two files. + +I'm not looking for explanations yet, just examining coincidences and +trying to predict the behaviour based upon conjectures. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 21:18:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A0DE5344A + for ; + Mon, 4 Apr 2005 21:18:49 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47436-09 + for ; + Mon, 4 Apr 2005 20:18:42 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.200]) + by svr1.postgresql.org (Postfix) with ESMTP id B8A01537E0 + for ; + Mon, 4 Apr 2005 21:18:40 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1307304rng + for ; + Mon, 04 Apr 2005 13:18:43 -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:references; + b=cFxdZTh/lzh40YR42etErxiuinjYqX29z6m2DT17/I+eOqWrYZ2HRaQgRp6RJfgeGXjasOYd3Y49NvV7VZkKeFRm39d98iunGc15HkPCJQBxmONBhSp3FShq3Xx14xWxa/yUOoFyGd02OfL93YKkdc2ssp5hdSLSbQgnlwHd1MM= +Received: by 10.38.86.68 with SMTP id j68mr5685934rnb; + Mon, 04 Apr 2005 13:18:42 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 13:18:42 -0700 (PDT) +Message-ID: <59d991c405040413184699cfe1@mail.gmail.com> +Date: Mon, 4 Apr 2005 16:18:42 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Simon Riggs +Subject: Re: Sustained inserts per sec ... ? +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <1112645479.16721.806.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> + <1112645479.16721.806.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.299 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/65 +X-Sequence-Number: 11462 + +On Apr 4, 2005 4:11 PM, Simon Riggs wrote: +> > > I'm very interested in the graphs of elapsed time for COPY 500 rows +> > > against rows inserted. The simplistic inference from those graphs are +> > > that if you only inserted 5 million rows into each table, rather than 10 +> > > million rows then everything would be much quicker. I hope this doesn't +> > > work, but could you try that to see if it works? I'd like to rule out a +> > > function of "number of rows" as an issue, or focus in on it depending +> > > upon the results. +> +> Any chance of running a multiple load of 4 million rows per table, +> leaving the test running for at least 3 tables worth (12+ M rows)? + +As soon as I get done running a test without indexes :-) + +> > > Q: Please can you confirm that the discontinuity on the graph at around +> > > 5000 elapsed seconds matches EXACTLY with the switch from one table to +> > > another? That is an important point. +> > +> > Well, the change over happens at 51593.395205 seconds :-) Here's two +> > lines from the results with row count and time added: +> > +> > 10000000 51584.9818912 8.41331386566 +> > 10000500 51593.395205 0.416964054108 +> > +> > Note that 10M is when it swaps. I see no reason to interpret it +> > differently, so it seems to be totally based around switching tables +> > (and thereby indices). +> +> OK, but do you have some other external knowledge that it is definitely +> happening at that time? Your argument above seems slightly circular to +> me. + +My program *SPECIFICALLY* counts to 10M then switches the COPY statement. + +> This is really important because we need to know whether it ties in with +> that event, or some other. + +Unless basic integer math is failing, it's definately happening at 10M rows. + +> Have you run this for more than 2 files, say 3 or more? + +You mean, 3 or more tables? I'm not sure which type of files you are +reffering to here. + +> You COMMIT after each 500 rows? + +This is done using COPY syntax, not INSERT syntax. So I suppose "yes" +I do. The file that is being used for COPY is kept on a ramdisk. + +> OK. Please... +> cd $PGDATA/base/26488263 +> ls -l + +[root@bigbird base]# cd 26488263/ +[root@bigbird 26488263]# ls -l +total 2003740 +-rw------- 1 pgsql pgsql 49152 Apr 4 12:26 1247 +-rw------- 1 pgsql pgsql 245760 Apr 4 12:27 1249 +-rw------- 1 pgsql pgsql 573440 Apr 4 12:24 1255 +-rw------- 1 pgsql pgsql 57344 Apr 4 14:44 1259 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16384 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 16386 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 16388 +-rw------- 1 pgsql pgsql 24576 Apr 4 12:29 16390 +-rw------- 1 pgsql pgsql 106496 Apr 4 12:24 16392 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16394 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16396 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16398 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16400 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16402 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16404 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16406 +-rw------- 1 pgsql pgsql 212992 Apr 4 14:44 16408 +-rw------- 1 pgsql pgsql 49152 Apr 4 12:24 16410 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16412 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16414 +-rw------- 1 pgsql pgsql 114688 Apr 4 12:24 16416 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16418 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16672 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16674 +-rw------- 1 pgsql pgsql 237568 Apr 4 12:26 16676 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16678 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16679 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16680 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16681 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16682 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16683 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16684 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16685 +-rw------- 1 pgsql pgsql 245760 Apr 4 12:26 16686 +-rw------- 1 pgsql pgsql 73728 Apr 4 12:26 16687 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16688 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16689 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16690 +-rw------- 1 pgsql pgsql 65536 Apr 4 12:26 16691 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16692 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16693 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16694 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16695 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16696 +-rw------- 1 pgsql pgsql 32768 Apr 4 12:24 16697 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16698 +-rw------- 1 pgsql pgsql 163840 Apr 4 12:26 16701 +-rw------- 1 pgsql pgsql 196608 Apr 4 12:26 16702 +-rw------- 1 pgsql pgsql 73728 Apr 4 12:24 16703 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16706 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16707 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16708 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16709 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16710 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16711 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16712 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16713 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16714 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16715 +-rw------- 1 pgsql pgsql 32768 Apr 4 12:24 16716 +-rw------- 1 pgsql pgsql 106496 Apr 4 12:24 16717 +-rw------- 1 pgsql pgsql 106496 Apr 4 12:24 16718 +-rw------- 1 pgsql pgsql 1212416 Apr 4 12:24 16719 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16720 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16721 +-rw------- 1 pgsql pgsql 40960 Apr 4 14:44 16724 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16727 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16728 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16729 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16730 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:26 16731 +-rw------- 1 pgsql pgsql 49152 Apr 4 12:26 16732 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16735 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16737 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16738 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16740 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16744 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16746 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16750 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16752 +-rw------- 1 pgsql pgsql 122880 Apr 4 12:24 16753 +-rw------- 1 pgsql pgsql 16384 Apr 4 12:24 16755 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 16759 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 16761 +-rw------- 1 pgsql pgsql 40960 Apr 4 12:24 17158 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 17160 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17162 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17163 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 17165 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17167 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17168 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 17170 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17172 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17173 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 17175 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17177 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17178 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 17180 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17182 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 17183 +-rw------- 1 pgsql pgsql 0 Apr 4 12:24 17185 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:24 17187 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488264 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488266 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488268 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488269 +-rw------- 1 pgsql pgsql 1073741824 Apr 4 15:07 26488271 +-rw------- 1 pgsql pgsql 407527424 Apr 4 16:17 26488271.1 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488273 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488275 +-rw------- 1 pgsql pgsql 565067776 Apr 4 16:17 26488276 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488278 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488280 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488282 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488283 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488285 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488287 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488289 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488290 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488292 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488294 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488296 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488297 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488299 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488301 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488303 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488304 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488306 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488308 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488310 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488311 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488313 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488315 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488317 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488318 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488320 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488322 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488324 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488325 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488327 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488329 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488331 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488332 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488334 +-rw------- 1 pgsql pgsql 0 Apr 4 12:26 26488336 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488338 +-rw------- 1 pgsql pgsql 8192 Apr 4 12:26 26488339 +-rw------- 1 pgsql pgsql 60045 Apr 4 12:24 pg_internal.init +-rw------- 1 pgsql pgsql 4 Apr 4 12:24 PG_VERSION + +Hopefully this helps. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Mon Apr 4 21:53:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BFC7652A74 + for ; + Mon, 4 Apr 2005 21:53:28 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60947-03 + for ; + Mon, 4 Apr 2005 20:53:22 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id E05BC535DF + for ; + Mon, 4 Apr 2005 21:53:21 +0100 (BST) +Received: (qmail 6181 invoked from network); 4 Apr 2005 22:53:41 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 4 Apr 2005 22:53:41 +0200 +To: "Christopher Petrilli" , + "Simon Riggs" +Cc: jd@commandprompt.com, "Tom Lane" , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c405040413184699cfe1@mail.gmail.com> + <1112645479.16721.806.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c40504040648457808e9@mail.gmail.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401113857086517@mail.gmail.com> +Message-ID: +Date: Mon, 04 Apr 2005 22:53:21 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <59d991c405040413184699cfe1@mail.gmail.com> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/66 +X-Sequence-Number: 11463 + + + +> This is done using COPY syntax, not INSERT syntax. So I suppose "yes" +> I do. The file that is being used for COPY is kept on a ramdisk. + + COPY or psql \copy ? + If you wanna be sure you commit after each COPY, launch a psql in a shell +and check if the inserted rows are visible (watching SELECT count(*) grow +will do) + +From pgsql-performance-owner@postgresql.org Mon Apr 4 21:56:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C177E535F3 + for ; + Mon, 4 Apr 2005 21:56:33 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62194-04 + for ; + Mon, 4 Apr 2005 20:56:25 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.202]) + by svr1.postgresql.org (Postfix) with ESMTP id 37160533FA + for ; + Mon, 4 Apr 2005 21:56:24 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1315953rng + for ; + Mon, 04 Apr 2005 13:56:27 -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:references; + b=LsRcTrXX+zZaJxYy2tOVoVzwXFySxMIz9LMUWX0V7B62ocbtzyXJzNgk8337GfbdeeIakirSp/+TNxy1NcVGv/+HCDa9OdGDI5qHwbIUbP2u2SXmX8qjmiLRYG9qso2yFsu0bN7mIxc1wnJ+w7Tz5lsCzh7S9wlQ6kgP+a3YxlQ= +Received: by 10.38.13.39 with SMTP id 39mr5638057rnm; + Mon, 04 Apr 2005 13:56:26 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 13:56:26 -0700 (PDT) +Message-ID: <59d991c4050404135650abda4f@mail.gmail.com> +Date: Mon, 4 Apr 2005 16:56:26 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: PFC +Subject: Re: Sustained inserts per sec ... ? +Cc: Simon Riggs , jd@commandprompt.com, + Tom Lane , "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c40504040648457808e9@mail.gmail.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401113857086517@mail.gmail.com> + <59d991c405040413184699cfe1@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.299 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/67 +X-Sequence-Number: 11464 + +On Apr 4, 2005 4:53 PM, PFC wrote: +> > This is done using COPY syntax, not INSERT syntax. So I suppose "yes" +> > I do. The file that is being used for COPY is kept on a ramdisk. +> +> COPY or psql \copy ? +> If you wanna be sure you commit after each COPY, launch a psql in a shell +> and check if the inserted rows are visible (watching SELECT count(*) grow +> will do) + +The script is Python, using pyexpect (a'la expect) and does this, exactly: + +psql = pexpect.spawn('/usr/local/pgsql/bin/psql -d bench2 ') +[ ...] +start = time.time() +psql.expect_exact('bench2=#') +psql.sendline("COPY events%03i FROM '/mnt/tmpfs/loadfile';" % (tablenum+1)) +results.write('%s\n' % (time.time() - start)) +results.flush() + +There's other code, but it's all related to building the loadfile. +Note that I'm specifically including the time it takes to get the +prompt back in the timing (but it does slip 1 loop, which isn't +relevent). + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Mon Apr 4 22:00:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1EE975340C; + Mon, 4 Apr 2005 22:00:21 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62487-08; Mon, 4 Apr 2005 21:00:19 +0000 (GMT) +Received: from cmailg3.svr.pol.co.uk (cmailg3.svr.pol.co.uk [195.92.195.173]) + by svr1.postgresql.org (Postfix) with ESMTP id 065EB53461; + Mon, 4 Apr 2005 22:00:18 +0100 (BST) +Received: from modem-3463.lion.dialup.pol.co.uk ([217.135.173.135] + helo=192.168.0.102) by cmailg3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DIYg9-0008Dj-QE; Mon, 04 Apr 2005 22:00:14 +0100 +Subject: Re: Sustained inserts per sec ... ? +From: Simon Riggs +To: Christopher Petrilli +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c405040413184699cfe1@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> + <1112645479.16721.806.camel@localhost.localdomain> + <59d991c405040413184699cfe1@mail.gmail.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 04 Apr 2005 21:58:23 +0100 +Message-Id: <1112648303.16721.816.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/68 +X-Sequence-Number: 11465 + +On Mon, 2005-04-04 at 16:18 -0400, Christopher Petrilli wrote: +> On Apr 4, 2005 4:11 PM, Simon Riggs wrote: +> > > > I'm very interested in the graphs of elapsed time for COPY 500 rows +> > > > against rows inserted. The simplistic inference from those graphs are +> > > > that if you only inserted 5 million rows into each table, rather than 10 +> > > > million rows then everything would be much quicker. I hope this doesn't +> > > > work, but could you try that to see if it works? I'd like to rule out a +> > > > function of "number of rows" as an issue, or focus in on it depending +> > > > upon the results. +> > +> > Any chance of running a multiple load of 4 million rows per table, +> > leaving the test running for at least 3 tables worth (12+ M rows)? +> +> As soon as I get done running a test without indexes :-) +> +> > > > Q: Please can you confirm that the discontinuity on the graph at around +> > > > 5000 elapsed seconds matches EXACTLY with the switch from one table to +> > > > another? That is an important point. +> > > +> > > Well, the change over happens at 51593.395205 seconds :-) Here's two +> > > lines from the results with row count and time added: +> > > +> > > 10000000 51584.9818912 8.41331386566 +> > > 10000500 51593.395205 0.416964054108 +> > > +> My program *SPECIFICALLY* counts to 10M then switches the COPY statement. + +> > OK. Please... +> > cd $PGDATA/base/26488263 +> > ls -l +> +> [root@bigbird base]# cd 26488263/ +> [root@bigbird 26488263]# ls -l +> total 2003740 + +> -rw------- 1 pgsql pgsql 1073741824 Apr 4 15:07 26488271 +> -rw------- 1 pgsql pgsql 407527424 Apr 4 16:17 26488271.1 + +Can you do: +select relname from pg_class where relfilenode = 26488271 +and confirm that the name is the table you've been loading... + +Couldn't see all your indexes... are they still there? + +Thanks, + +Best Regards, Simon Riggs + + + +From pgsql-performance-owner@postgresql.org Mon Apr 4 22:04:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E1EB5338F + for ; + Mon, 4 Apr 2005 22:04:14 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65174-06 + for ; + Mon, 4 Apr 2005 21:04:10 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 58BD653225 + for ; + Mon, 4 Apr 2005 22:03:54 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1317556rng + for ; + Mon, 04 Apr 2005 14:03:56 -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:references; + b=jpVIbmXX1hYenVGmPDCZqyfCZQjkhFKMc9gIS9VUnfh2YAt81xyCCFbrvLg/kflG3CQgOMgrZb7hc2QocRyZtpM2ss2D0vfPppqzwPr2AwCUl5AqZK6kPUlJVq1JI5S4K1si/v8cXEOgK6lAH8LM4CsTrR58zi6fiiftSd3Rbj4= +Received: by 10.38.13.39 with SMTP id 39mr5645258rnm; + Mon, 04 Apr 2005 14:03:56 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 14:03:56 -0700 (PDT) +Message-ID: <59d991c4050404140333bff1ed@mail.gmail.com> +Date: Mon, 4 Apr 2005 17:03:56 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Simon Riggs +Subject: Re: Sustained inserts per sec ... ? +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <1112648303.16721.816.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> + <1112645479.16721.806.camel@localhost.localdomain> + <59d991c405040413184699cfe1@mail.gmail.com> + <1112648303.16721.816.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.302 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/69 +X-Sequence-Number: 11466 + +On Apr 4, 2005 4:58 PM, Simon Riggs wrote: +> Can you do: +> select relname from pg_class where relfilenode = 26488271 +> and confirm that the name is the table you've been loading... + +It is. + +> Couldn't see all your indexes... are they still there? + +Nope, I'm running a second run without the auxilary indices. I only +have the primary key index. So far, a quick scan with the eye says +that it's behaving "better", but beginning to have issues again. I'll +post results as soon as they are done. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Mon Apr 4 23:46:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1DE025364E; + Mon, 4 Apr 2005 23:46:02 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95643-02; Mon, 4 Apr 2005 22:45:52 +0000 (GMT) +Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) + by svr1.postgresql.org (Postfix) with ESMTP id 4217B533AE; + Mon, 4 Apr 2005 23:45:51 +0100 (BST) +Received: from modem-3427.lion.dialup.pol.co.uk ([217.135.173.99] + helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.14) + id 1DIaKM-0005cD-JA; Mon, 04 Apr 2005 23:45:50 +0100 +Subject: Re: Sustained inserts per sec ... ? +From: Simon Riggs +To: Christopher Petrilli +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c4050404140333bff1ed@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> + <1112645479.16721.806.camel@localhost.localdomain> + <59d991c405040413184699cfe1@mail.gmail.com> + <1112648303.16721.816.camel@localhost.localdomain> + <59d991c4050404140333bff1ed@mail.gmail.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 04 Apr 2005 23:44:00 +0100 +Message-Id: <1112654640.16721.859.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/70 +X-Sequence-Number: 11467 + +On Mon, 2005-04-04 at 17:03 -0400, Christopher Petrilli wrote: +> On Apr 4, 2005 4:58 PM, Simon Riggs wrote: +> > Can you do: +> > select relname from pg_class where relfilenode = 26488271 +> > and confirm that the name is the table you've been loading... +> +> It is. +> +> > Couldn't see all your indexes... are they still there? +> +> Nope, I'm running a second run without the auxilary indices. I only +> have the primary key index. So far, a quick scan with the eye says +> that it's behaving "better", but beginning to have issues again. I'll +> post results as soon as they are done. + +Hmmm.... + +Before I start to tunnel-vision on a particular coincidence... + +How much memory have you got on the system? +How much of that have you allocated to various tasks? +What else is happening on your system? +Tell us more about disk set-up and other hardware related things. +Disk cache...disk speed...seek times....etc + +Best Regards, Simon Riggs + + + + + + +From pgsql-performance-owner@postgresql.org Tue Apr 5 00:28:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CEEF6536C1 + for ; + Tue, 5 Apr 2005 00:28:32 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07948-03 + for ; + Mon, 4 Apr 2005 23:28:22 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.207]) + by svr1.postgresql.org (Postfix) with ESMTP id A5FD05366D + for ; + Tue, 5 Apr 2005 00:28:21 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id j1so1330783rnf + for ; + Mon, 04 Apr 2005 16:28:25 -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:references; + b=SS15FlNIbczgMaP3vC78qu5k/TrRylKBdjvzqJeLgkskog5FuxMMGZwwmxvMgqJhl3CxZoX3ixKlUgucNxKseQ+MvC03t55DyHhdXeJ+hnnzWADSla20kl69/OHtGF6T3zigh2hUulyKUtdcwJsQM0VLbQBzhAM+mLq+27m3+CQ= +Received: by 10.38.15.55 with SMTP id 55mr5586964rno; + Mon, 04 Apr 2005 16:28:25 -0700 (PDT) +Received: by 10.38.126.31 with HTTP; Mon, 4 Apr 2005 16:28:25 -0700 (PDT) +Message-ID: +Date: Mon, 4 Apr 2005 23:28:25 +0000 +From: Mike Rylander +Reply-To: Mike Rylander +To: Simon Riggs +Subject: Re: Sustained inserts per sec ... ? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1112654640.16721.859.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> + <1112645479.16721.806.camel@localhost.localdomain> + <59d991c405040413184699cfe1@mail.gmail.com> + <1112648303.16721.816.camel@localhost.localdomain> + <59d991c4050404140333bff1ed@mail.gmail.com> + <1112654640.16721.859.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/71 +X-Sequence-Number: 11468 + +If I'm getting the point of this thread correctly, have a huge amount +of data in one table degrades INSERT/COPY performance even with just a +PKEY index. If that's about the size of it, read on. If not, ignore +me because I missed something. + +On Apr 4, 2005 10:44 PM, Simon Riggs wrote: +> Before I start to tunnel-vision on a particular coincidence... +> + +Don't worry too much about tunnel vision. I see the same thing every +day with multi-million row tables. The bigger the table gets (with +only a pkey index) the slower the inserts go. If I start over +(truncate, drop/create table), or if I point the initial load at a new +table, everything gets speedy. I've always figured it was a function +of table size and learned to live with it... + +> How much memory have you got on the system? + +On mine, 16G + +> How much of that have you allocated to various tasks? + +shared buffers: 15000 + +> What else is happening on your system? + +Nothing on mine. + +> Tell us more about disk set-up and other hardware related things. + +6-disk RAID10 on a Compaq SmartArray 6404 with 256M BB cache, WAL on +2-disk mirror on built in SmartArray5 controller. + +-- +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Tue Apr 5 00:40:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B2C452958 + for ; + Tue, 5 Apr 2005 00:40:37 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09693-07 + for ; + Mon, 4 Apr 2005 23:40:35 +0000 (GMT) +Received: from e6.ny.us.ibm.com (e6.ny.us.ibm.com [32.97.182.146]) + by svr1.postgresql.org (Postfix) with ESMTP id B265A535BB + for ; + Tue, 5 Apr 2005 00:40:33 +0100 (BST) +Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) + by e6.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id j34NeaDt032104 + for ; Mon, 4 Apr 2005 19:40:36 -0400 +Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) + by d01relay02.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id + j34Neaoc092294 + for ; Mon, 4 Apr 2005 19:40:36 -0400 +Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) + by d01av03.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j34NeZN7008338 + for ; Mon, 4 Apr 2005 19:40:35 -0400 +Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) + by d01av03.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j34NeZ0N008335 + for ; Mon, 4 Apr 2005 19:40:35 -0400 +Subject: Bulk COPY end of copy delimiter +To: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 +Message-ID: + +From: Steven Rosenstein +Date: Mon, 4 Apr 2005 19:40:30 -0400 +X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | + November 15, 2004) at 04/04/2005 19:40:35 +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.274 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/72 +X-Sequence-Number: 11469 + + + + + +Today while trying to do a bulk COPY of data into a table, the process +aborted with the following error message: + +ERROR: end-of-copy marker corrupt +CONTEXT: COPY tbl_logged_event, line 178519: "606447014,1492,2005-02-24 +03:16:14,2005-02-23 20:27:48,win_applog,,error,adsmclientservice,nt +author..." + +Googling the error, we found reference to the '\.' (backslash-period) being +an "end-of-copy marker". Unfortunately, our data contains the +backslash-period character sequence. Is there any know fix or workaround +for this condition? + +We're using Postgresql 7.3.9 and also running tests on an 8.0.1 system. + +Thanks in advance, +--- Steve +___________________________________________________________________________________ + +Steven Rosenstein +IT Architect/Developer | IBM Virtual Server Administration +Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 +Text Messaging: 6463456978 @ mobile.mycingular.com +Email: srosenst @ us.ibm.com + +"Learn from the mistakes of others because you can't live long enough to +make them all yourself." -- Eleanor Roosevelt + + +From pgsql-performance-owner@postgresql.org Tue Apr 5 01:00:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 26B9253584 + for ; + Tue, 5 Apr 2005 01:00:19 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17130-02 + for ; + Tue, 5 Apr 2005 00:00:15 +0000 (GMT) +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by svr1.postgresql.org (Postfix) with ESMTP id DA40A5336B + for ; + Tue, 5 Apr 2005 01:00:13 +0100 (BST) +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 j3500FTX020908; + Tue, 5 Apr 2005 10:00:16 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + j3500F1e020905; Tue, 5 Apr 2005 10:00:15 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Tue, 5 Apr 2005 10:00:15 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: Steven Rosenstein +Cc: pgsql-performance@postgresql.org +Subject: Re: Bulk COPY end of copy delimiter +In-Reply-To: + +Message-ID: +References: + +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/73 +X-Sequence-Number: 11470 + +Hi, + +On Mon, 4 Apr 2005, Steven Rosenstein wrote: + +> +> +> +> +> Today while trying to do a bulk COPY of data into a table, the process +> aborted with the following error message: +> +> ERROR: end-of-copy marker corrupt +> CONTEXT: COPY tbl_logged_event, line 178519: "606447014,1492,2005-02-24 +> 03:16:14,2005-02-23 20:27:48,win_applog,,error,adsmclientservice,nt +> author..." +> +> Googling the error, we found reference to the '\.' (backslash-period) being +> an "end-of-copy marker". Unfortunately, our data contains the +> backslash-period character sequence. Is there any know fix or workaround +> for this condition? + +Any sequence \. in COPY input data should be escaped as \\. If this data +was generated by pg_dump then its a problem, but I haven't seen any other +reports of this. Can I assume that you've generated the data for bulk load +yourself? If so, there is discussion of escaping characters here: +http://www.postgresql.org/docs/8.0/static/sql-copy.html. + +Gavin + +From pgsql-performance-owner@postgresql.org Tue Apr 5 02:31:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AE67E535AB + for ; + Tue, 5 Apr 2005 02:31:45 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37198-08 + for ; + Tue, 5 Apr 2005 01:31:35 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.200]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B1DC53397 + for ; + Tue, 5 Apr 2005 02:31:34 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1357549rng + for ; + Mon, 04 Apr 2005 18:31:39 -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:references; + b=tFirBHUdKLFkOL6AzSag4t/u1aDiiIxf8JFNc6RLWko7Gsz9XYw2ZGewqH9xqU2Jdw2SPjQ3BIg5SAXLjulpfYusPGqPdli+zhv7yhINhBCNTrGEAf8iqNYnIsG/o0rjtzULYTKLHxAKdnEAcCpMmMLwhtjzD3YT+7yWu2iSumA= +Received: by 10.38.13.39 with SMTP id 39mr5838716rnm; + Mon, 04 Apr 2005 18:31:38 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 18:31:38 -0700 (PDT) +Message-ID: <59d991c405040418314b860fca@mail.gmail.com> +Date: Mon, 4 Apr 2005 21:31:38 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Simon Riggs +Subject: Re: Sustained inserts per sec ... ? +Cc: jd@commandprompt.com, Tom Lane , + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <1112654640.16721.859.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <1112644015.16721.790.camel@localhost.localdomain> + <59d991c4050404125611ad5af8@mail.gmail.com> + <1112645479.16721.806.camel@localhost.localdomain> + <59d991c405040413184699cfe1@mail.gmail.com> + <1112648303.16721.816.camel@localhost.localdomain> + <59d991c4050404140333bff1ed@mail.gmail.com> + <1112654640.16721.859.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.307 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/74 +X-Sequence-Number: 11471 + +On Apr 4, 2005 6:44 PM, Simon Riggs wrote: +> Before I start to tunnel-vision on a particular coincidence... +> +> How much memory have you got on the system? + +Now, 2Gb, but most of it is free in this situation. Earlier, I posted +some of the settings related to work mem. + +> How much of that have you allocated to various tasks? + +Do you mean inside PostgreSQL? + +> What else is happening on your system? + +sshd, that's it :-) + +> Tell us more about disk set-up and other hardware related things. +> Disk cache...disk speed...seek times....etc + +Sure, here's the system configuration: + +* AMD64/3000 +* 2GB RAM (was 1GB, has made no difference) +* 1 x 120GB SATA drive (w/WAL), 7200RPM Seagate +* 1 x 160GB SATA drive (main), 7200RPM Seagate + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Apr 5 03:36:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 445F6533FF; + Tue, 5 Apr 2005 03:36:32 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55929-02; Tue, 5 Apr 2005 02:36:30 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A6728536E1; + Tue, 5 Apr 2005 03:36:28 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j352aTSC005218; + Mon, 4 Apr 2005 22:36:29 -0400 (EDT) +To: Christopher Petrilli +Cc: jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <59d991c40504041846bc39a6@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Mon, 04 Apr 2005 21:46:17 -0400" +Date: Mon, 04 Apr 2005 22:36:29 -0400 +Message-ID: <5217.1112668589@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/75 +X-Sequence-Number: 11472 + +Christopher Petrilli writes: +> On Apr 4, 2005 12:23 PM, Tom Lane wrote: +>> do a test run with *no* indexes on the table, just to see if it behaves +>> any differently? Basically I was wondering if index overhead might be +>> part of the problem. + +> http://www.amber.org/~petrilli/diagrams/pgsql_copy500_pkonly.png + +> I appologize, I forgot to kill the PK, but as you can see, the curve +> flattened out a lot. It still begins to increase in what seems like +> the same place. You can find the results themselves at: + +Yeah, this confirms the thought that the indexes are the source of +the issue. (Which is what I'd expect, because a bare INSERT ought to be +an approximately constant-time operation. But it's good to verify.) + +Now some amount of slowdown is to be expected as the indexes get larger, +since it ought to take roughly O(log N) time to insert a new entry in an +index of size N. The weird thing about your curves is the very sudden +jump in the insert times. + +What I think might be happening is that the "working set" of pages +touched during index inserts is gradually growing, and at some point it +exceeds shared_buffers, and at that point performance goes in the toilet +because we are suddenly doing lots of reads to pull in index pages that +fell out of the shared buffer area. + +It would be interesting to watch the output of iostat or vmstat during +this test run. If I'm correct about this, the I/O load should be +basically all writes during the initial part of the test, and then +suddenly develop a significant and increasing fraction of reads at the +point where the slowdown occurs. + +The indicated fix of course is to increase shared_buffers. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 5 03:55:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 396345370B + for ; + Tue, 5 Apr 2005 03:55:03 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73199-02 + for ; + Tue, 5 Apr 2005 02:54:53 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.202]) + by svr1.postgresql.org (Postfix) with ESMTP id D470653707 + for ; + Tue, 5 Apr 2005 03:54:51 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1366815rng + for ; + Mon, 04 Apr 2005 19:54:57 -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:references; + b=TtX9qrctbVzf4oz5avNHU9VMqADG0MQDk2U8zcXPAGq74SbNV/Pzr/J1+96DCPlDKzMgCZEyNrlHxxofnqPSmxxkLzIQHR68HEYE4+WGDKnzPBxn4Fn6zQ6Yv4HAtZUex6okKw0tpajCGQDTAoLLAbQ0T55o8yStKluvG4Cra0U= +Received: by 10.38.69.34 with SMTP id r34mr312039rna; + Mon, 04 Apr 2005 19:54:57 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 19:54:57 -0700 (PDT) +Message-ID: <59d991c4050404195443fba84c@mail.gmail.com> +Date: Mon, 4 Apr 2005 22:54:57 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Sustained inserts per sec ... ? +Cc: jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <5217.1112668589@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.313 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/76 +X-Sequence-Number: 11473 + +On Apr 4, 2005 10:36 PM, Tom Lane wrote: +> Christopher Petrilli writes: +> > On Apr 4, 2005 12:23 PM, Tom Lane wrote: +> >> do a test run with *no* indexes on the table, just to see if it behaves +> >> any differently? Basically I was wondering if index overhead might be +> >> part of the problem. +> +> > http://www.amber.org/~petrilli/diagrams/pgsql_copy500_pkonly.png +> +> > I appologize, I forgot to kill the PK, but as you can see, the curve +> > flattened out a lot. It still begins to increase in what seems like +> > the same place. You can find the results themselves at: +> +> Yeah, this confirms the thought that the indexes are the source of +> the issue. (Which is what I'd expect, because a bare INSERT ought to be +> an approximately constant-time operation. But it's good to verify.) + +This seemsed to be my original idea, but I wanted to eliminate +everything else as much as possible. I was also concerned that I might +be hitting a bad case in the trees. I had to change some UID +generation code to better hash, so... + +> Now some amount of slowdown is to be expected as the indexes get larger, +> since it ought to take roughly O(log N) time to insert a new entry in an +> index of size N. The weird thing about your curves is the very sudden +> jump in the insert times. + +Right, I expected O(log N) behavior myself, and it seems to behave +that way, if you look at the first section (although there's some +interesting patterns that are visible if you exclude data outside the +90th percentile in the first section, that seems to coincide with some +write activity. + +> It would be interesting to watch the output of iostat or vmstat during +> this test run. If I'm correct about this, the I/O load should be +> basically all writes during the initial part of the test, and then +> suddenly develop a significant and increasing fraction of reads at the +> point where the slowdown occurs. + +Well, I can track this on a run, if it would be useful, but I think +you're right as it matches what I saw from looking at iostat at those +points. + +> The indicated fix of course is to increase shared_buffers. + +Any idea where it should be set? + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Apr 5 04:05:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A05755370B; + Tue, 5 Apr 2005 04:05:44 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80878-01; Tue, 5 Apr 2005 03:05:34 +0000 (GMT) +Received: from e2.ny.us.ibm.com (e2.ny.us.ibm.com [32.97.182.142]) + by svr1.postgresql.org (Postfix) with ESMTP id 163E15370A; + Tue, 5 Apr 2005 04:05:32 +0100 (BST) +Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) + by e2.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id j3535HSK019578; + Mon, 4 Apr 2005 23:05:17 -0400 +Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) + by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id + j3535HGh247742; Mon, 4 Apr 2005 23:05:17 -0400 +Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) + by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j3535GTK021777; + Mon, 4 Apr 2005 23:05:17 -0400 +Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) + by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j3535GSQ021770; + Mon, 4 Apr 2005 23:05:16 -0400 +In-Reply-To: +Subject: Re: Bulk COPY end of copy delimiter +To: Gavin Sherry +Cc: pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org +X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 +Message-ID: + +From: Steven Rosenstein +Date: Mon, 4 Apr 2005 23:05:13 -0400 +X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | + November 15, 2004) at 04/04/2005 23:05:15 +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.275 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/77 +X-Sequence-Number: 11474 + + + + + +Your assumption is correct. The data was generated out of a DB2 database, +and uses commas as field delimiters. + +Thank you for the workaround, +--- Steve +___________________________________________________________________________________ + +Steven Rosenstein +IT Architect/Developer | IBM Virtual Server Administration +Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 +Text Messaging: 6463456978 @ mobile.mycingular.com +Email: srosenst @ us.ibm.com + +"Learn from the mistakes of others because you can't live long enough to +make them all yourself." -- Eleanor Roosevelt + + + + Gavin Sherry + To + Sent by: Steven Rosenstein/New + pgsql-performance York/IBM@IBMUS + -owner@postgresql cc + .org pgsql-performance@postgresql.org + Subject + Re: [PERFORM] Bulk COPY end of copy + 04/04/2005 08:00 delimiter + PM + + + + + + + + + +Hi, + +On Mon, 4 Apr 2005, Steven Rosenstein wrote: + +> +> +> +> +> Today while trying to do a bulk COPY of data into a table, the process +> aborted with the following error message: +> +> ERROR: end-of-copy marker corrupt +> CONTEXT: COPY tbl_logged_event, line 178519: "606447014,1492,2005-02-24 +> 03:16:14,2005-02-23 20:27:48,win_applog,,error,adsmclientservice,nt +> author..." +> +> Googling the error, we found reference to the '\.' (backslash-period) +being +> an "end-of-copy marker". Unfortunately, our data contains the +> backslash-period character sequence. Is there any know fix or workaround +> for this condition? + +Any sequence \. in COPY input data should be escaped as \\. If this data +was generated by pg_dump then its a problem, but I haven't seen any other +reports of this. Can I assume that you've generated the data for bulk load +yourself? If so, there is discussion of escaping characters here: +http://www.postgresql.org/docs/8.0/static/sql-copy.html. + +Gavin + +---------------------------(end of broadcast)--------------------------- +TIP 3: if posting/reading through Usenet, please send an appropriate + subscribe-nomail command to majordomo@postgresql.org so that your + message can get through to the mailing list cleanly + + + +From pgsql-performance-owner@postgresql.org Tue Apr 5 04:35:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D3235372B; + Tue, 5 Apr 2005 04:35:09 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86173-08; Tue, 5 Apr 2005 03:35:08 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D3C0C5373D; + Tue, 5 Apr 2005 04:35:07 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j353Z07O006491; + Mon, 4 Apr 2005 23:35:01 -0400 (EDT) +To: Christopher Petrilli +Cc: jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <59d991c4050404195443fba84c@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> + <59d991c4050404195443fba84c@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Mon, 04 Apr 2005 22:54:57 -0400" +Date: Mon, 04 Apr 2005 23:35:00 -0400 +Message-ID: <6490.1112672100@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/78 +X-Sequence-Number: 11475 + +Christopher Petrilli writes: +> On Apr 4, 2005 10:36 PM, Tom Lane wrote: +>> The indicated fix of course is to increase shared_buffers. + +> Any idea where it should be set? + +Not really. An upper bound would be the total size of the finished +indexes for one 10M-row table, but one would suppose that that's +overkill. The leaf pages shouldn't have to stay in RAM to have +reasonable behavior --- the killer case is when upper-level tree +pages drop out. Or that's what I'd expect anyway. + +You could probably drop the inter-insert sleep for testing purposes, +if you want to experiment with several shared_buffers values quickly. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 5 04:46:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A14EF53764; + Tue, 5 Apr 2005 04:46:03 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89680-04; Tue, 5 Apr 2005 03:46:02 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 165D95375C; + Tue, 5 Apr 2005 04:46:01 +0100 (BST) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1DIf0e-0003Js-00; Mon, 04 Apr 2005 23:45:48 -0400 +To: Tom Lane +Cc: Christopher Petrilli , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> +In-Reply-To: <5217.1112668589@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 04 Apr 2005 23:45:47 -0400 +Message-ID: <87y8bxophw.fsf@stark.xeocode.com> +Lines: 35 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/79 +X-Sequence-Number: 11476 + + +Tom Lane writes: + +> What I think might be happening is that the "working set" of pages +> touched during index inserts is gradually growing, and at some point it +> exceeds shared_buffers, and at that point performance goes in the toilet +> because we are suddenly doing lots of reads to pull in index pages that +> fell out of the shared buffer area. + +All this is happening within a single transaction too, right? So there hasn't +been an fsync the entire time. It's entirely up to the kernel when to decide +to start writing data. + +It's possible it's just buffering all the writes in memory until the amount of +free buffers drops below some threshold then it suddenly starts writing out +buffers. + +> It would be interesting to watch the output of iostat or vmstat during +> this test run. If I'm correct about this, the I/O load should be +> basically all writes during the initial part of the test, and then +> suddenly develop a significant and increasing fraction of reads at the +> point where the slowdown occurs. + +I think he's right, if you see a reasonable write volume before the +performance drop followed by a sudden increase in read volume (and decrease of +write volume proportionate to the drop in performance) then it's just shared +buffers becoming a bottleneck. + +If there's hardly any write volume before, then a sudden increase in write +volume despite a drop in performance then I might be right. In which case you +might want to look into tools to tune your kernel vm system. + + +-- +greg + + +From pgsql-performance-owner@postgresql.org Tue Apr 5 04:56:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A73875375C + for ; + Tue, 5 Apr 2005 04:56:14 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92617-04 + for ; + Tue, 5 Apr 2005 03:56:04 +0000 (GMT) +Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 14FBA5347F + for ; + Tue, 5 Apr 2005 04:56:03 +0100 (BST) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.192]) + by svr2.postgresql.org (Postfix) with ESMTP id 1A099F0CF6 + for ; + Tue, 5 Apr 2005 04:53:01 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1373392rng + for ; + Mon, 04 Apr 2005 20:55:01 -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:references; + b=ikAFTT7XQdCk3ap/H+iczgeFP2R4ltozVox3VplDLGEAz2C22pcVWVpYJqxOuMp+Bs+/cvn5expIGHnh8pH0VwkxDPrKYBulQhymenApORTE26dbWZoosm8Cl57l64FfDFUd66Lg+rPpNZKtnBjswTfQqi+lq8/MQhg/wG4/xcc= +Received: by 10.38.151.1 with SMTP id y1mr5965647rnd; + Mon, 04 Apr 2005 20:55:00 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 20:55:00 -0700 (PDT) +Message-ID: <59d991c405040420556b72bba4@mail.gmail.com> +Date: Mon, 4 Apr 2005 23:55:00 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Greg Stark +Subject: Re: Sustained inserts per sec ... ? +Cc: Tom Lane , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <87y8bxophw.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> <87y8bxophw.fsf@stark.xeocode.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.314 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/80 +X-Sequence-Number: 11477 + +On 04 Apr 2005 23:45:47 -0400, Greg Stark wrote: +> +> Tom Lane writes: +> +> > What I think might be happening is that the "working set" of pages +> > touched during index inserts is gradually growing, and at some point it +> > exceeds shared_buffers, and at that point performance goes in the toilet +> > because we are suddenly doing lots of reads to pull in index pages that +> > fell out of the shared buffer area. +> +> All this is happening within a single transaction too, right? So there hasn't +> been an fsync the entire time. It's entirely up to the kernel when to decide +> to start writing data. + +This was my concern, and in fact moving from ext3 -> XFS has helped +substantially in this regard. This is all happening inside COPY +statements, so there's effectively a commit every 500 rows. I could +enlarge this, but I didn't notice a huge increase in performance when +doing tests on smaller bits. + +Also, you are correct, I am running without fsync, although I could +change that if you thought it would "smooth" the performance. The +issue is less absolute performance than something more deterministic. +Going from 0.05 seconds for a 500 row COPY to 26 seconds really messes +with the system. + +One thing that was mentioned early on, and I hope people remember, is +that I am running autovacuum in the background, but the timing of it +seems to have little to do with the system's problems, at least the +debug output doesn't conincide with performance loss. + +> It's possible it's just buffering all the writes in memory until the amount of +> free buffers drops below some threshold then it suddenly starts writing out +> buffers. + +That was happening with ext3, actually, or at least to the best of my knowledge. + +> > It would be interesting to watch the output of iostat or vmstat during +> > this test run. If I'm correct about this, the I/O load should be +> > basically all writes during the initial part of the test, and then +> > suddenly develop a significant and increasing fraction of reads at the +> > point where the slowdown occurs. +> +> I think he's right, if you see a reasonable write volume before the +> performance drop followed by a sudden increase in read volume (and decrease of +> write volume proportionate to the drop in performance) then it's just shared +> buffers becoming a bottleneck. + +I've set shared_buffers to 16000 (from the original 1000) and am +running now, without the pauses. We'll see what it looks like, but so +far it seems to be running faster. How much and how it degrades will +be an interesting view. + +> If there's hardly any write volume before, then a sudden increase in write +> volume despite a drop in performance then I might be right. In which case you +> might want to look into tools to tune your kernel vm system. + +Here's a quick snapshot of iostat: + +Linux 2.6.9-1.667 (bigbird.amber.org) 04/04/2005 + +avg-cpu: %user %nice %sys %iowait %idle + 1.05 0.01 0.63 13.15 85.17 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +hda 0.00 0.00 0.00 3616 0 +sda 23.15 68.09 748.89 246884021 2715312654 +sdb 19.08 37.65 773.03 136515457 2802814036 + +The first 3 columns have been identical (or nearly so) the whole time, +which tells me the system is pegged in its performance on IO. This is +not surprising. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Apr 5 04:57:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 056E25367F; + Tue, 5 Apr 2005 04:57:56 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92903-03; Tue, 5 Apr 2005 03:57:50 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A19F9537BE; + Tue, 5 Apr 2005 04:57:48 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j353veGE007439; + Mon, 4 Apr 2005 23:57:40 -0400 (EDT) +To: Greg Stark +Cc: Christopher Petrilli , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +In-reply-to: <87y8bxophw.fsf@stark.xeocode.com> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> <87y8bxophw.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "04 Apr 2005 23:45:47 -0400" +Date: Mon, 04 Apr 2005 23:57:40 -0400 +Message-ID: <7438.1112673460@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/81 +X-Sequence-Number: 11478 + +Greg Stark writes: +> All this is happening within a single transaction too, right? So there hasn't +> been an fsync the entire time. It's entirely up to the kernel when to decide +> to start writing data. + +No ... there's a commit every 500 records. However, I think Chris said +he was running with fsync off; so you're right that the kernel is at +liberty to write stuff to disk when it feels like. It could be that +those outlier points are transactions that occurred in the middle of +periodic syncer-driven mass writes. Maybe fsync off is +counterproductive for this situation? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 5 05:05:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8043753793 + for ; + Tue, 5 Apr 2005 05:05:02 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95571-01 + for ; + Tue, 5 Apr 2005 04:04:59 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id EAA865379C + for ; + Tue, 5 Apr 2005 05:04:58 +0100 (BST) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 794C61548C; Mon, 4 Apr 2005 23:04:57 -0500 (CDT) +Date: Mon, 4 Apr 2005 23:04:57 -0500 +From: "Jim C. Nasby" +To: pgsql-performance@postgresql.org +Subject: Compressing WAL +Message-ID: <20050405040457.GK93835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/82 +X-Sequence-Number: 11479 + +Maybe better for -hackers, but here it goes anyway... + +Has anyone looked at compressing WAL's before writing to disk? On a +system generating a lot of WAL it seems there might be some gains to be +had WAL data could be compressed before going to disk, since today's +machines are generally more I/O bound than CPU bound. And unlike the +base tables, you generally don't need to read the WAL, so you don't +really need to worry about not being able to quickly scan through the +data without decompressing it. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 5 05:16:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AD62A5370A + for ; + Tue, 5 Apr 2005 05:16:33 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97358-07 + for ; + Tue, 5 Apr 2005 04:16:28 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C72F53619 + for ; + Tue, 5 Apr 2005 05:16:27 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1375825rng + for ; + Mon, 04 Apr 2005 21:16:27 -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:references; + b=qDZQgDjFMoJXF2XUmzoMm+b95ShersCf5cBESFlRXjfqFQ+Eb4kP9ERA4SL+o9ZmPgiTXtJh9cT3Ehmsahac+8qqgD40Rt8fJAZyQ8vyZSQ4E7qFNVa45TIE85UWZ5EAuw1Ry2MrOOlf6WKJZiG4ZI6n3z5KjuOc96pi1SwKmcM= +Received: by 10.38.86.68 with SMTP id j68mr6030020rnb; + Mon, 04 Apr 2005 21:16:27 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Mon, 4 Apr 2005 21:16:27 -0700 (PDT) +Message-ID: <59d991c405040421164aeea3fb@mail.gmail.com> +Date: Tue, 5 Apr 2005 00:16:27 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Sustained inserts per sec ... ? +Cc: Greg Stark , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <7438.1112673460@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> <87y8bxophw.fsf@stark.xeocode.com> + <7438.1112673460@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.315 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/83 +X-Sequence-Number: 11480 + +On Apr 4, 2005 11:57 PM, Tom Lane wrote: +> Greg Stark writes: +> > All this is happening within a single transaction too, right? So there hasn't +> > been an fsync the entire time. It's entirely up to the kernel when to decide +> > to start writing data. +> +> No ... there's a commit every 500 records. However, I think Chris said +> he was running with fsync off; so you're right that the kernel is at +> liberty to write stuff to disk when it feels like. It could be that +> those outlier points are transactions that occurred in the middle of +> periodic syncer-driven mass writes. Maybe fsync off is +> counterproductive for this situation? + +Looking at preliminary results from running with shared_buffers at +16000, it seems this may be correct. Performance was flatter for a +BIT longer, but slammed right into the wall and started hitting the +3-30 second range per COPY. I've restarted the run, with fsync turned +on (fdatasync), and we'll see. + +My fear is that it's some bizarre situation interacting with both +issues, and one that might not be solvable. Does anyone else have +much experience with this sort of sustained COPY? + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Apr 5 06:04:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A2DDD537E0; + Tue, 5 Apr 2005 06:04:02 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09621-02; Tue, 5 Apr 2005 05:03:54 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id A46B653797; + Tue, 5 Apr 2005 06:03:53 +0100 (BST) +Received: by flake.decibel.org (Postfix, from userid 1001) + id CB39315487; Tue, 5 Apr 2005 00:03:52 -0500 (CDT) +Date: Tue, 5 Apr 2005 00:03:52 -0500 +From: "Jim C. Nasby" +To: Christopher Petrilli +Cc: Tom Lane , Greg Stark , + jd@commandprompt.com, "Marc G. Fournier" , + pgsql-performance@postgresql.org +Subject: Re: Sustained inserts per sec ... ? +Message-ID: <20050405050352.GM93835@decibel.org> +References: <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> <87y8bxophw.fsf@stark.xeocode.com> + <7438.1112673460@sss.pgh.pa.us> + <59d991c405040421164aeea3fb@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <59d991c405040421164aeea3fb@mail.gmail.com> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/84 +X-Sequence-Number: 11481 + +On Tue, Apr 05, 2005 at 12:16:27AM -0400, Christopher Petrilli wrote: +> My fear is that it's some bizarre situation interacting with both +> issues, and one that might not be solvable. Does anyone else have +> much experience with this sort of sustained COPY? + +You might ask the guy who just posted to -admin about a database that's +doing 340M inserts a day in 300M transactions... +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 5 15:27:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 042765370A + for ; + Tue, 5 Apr 2005 15:27:12 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59100-05 + for ; + Tue, 5 Apr 2005 14:27:08 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.205]) + by svr1.postgresql.org (Postfix) with ESMTP id A4A5E537E0 + for ; + Tue, 5 Apr 2005 15:27:07 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1479743rng + for ; + Tue, 05 Apr 2005 07:27:12 -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:references; + b=Yiw+DcmYwYosxUAqBESFojOjpSjtqv6bh94GLjLRBBaCzZ0mMXon03TNN1ZSHKeVcNs8ztjrUrj1/DZ9hDA23lY28Gke1589WNwE1krVJOY1S8mLQ58oezmVuILrqsfcsxKwuhKEtuYuNfrj8ayVhaIsdjM7Ywe3gS3R/aAwbqg= +Received: by 10.38.160.52 with SMTP id i52mr6341392rne; + Tue, 05 Apr 2005 07:27:10 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Tue, 5 Apr 2005 07:27:10 -0700 (PDT) +Message-ID: <59d991c4050405072746774c61@mail.gmail.com> +Date: Tue, 5 Apr 2005 10:27:10 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Sustained inserts per sec ... ? +Cc: Greg Stark , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c405040421164aeea3fb@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> <87y8bxophw.fsf@stark.xeocode.com> + <7438.1112673460@sss.pgh.pa.us> + <59d991c405040421164aeea3fb@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.316 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/85 +X-Sequence-Number: 11482 + +On Apr 5, 2005 12:16 AM, Christopher Petrilli wrote: +> Looking at preliminary results from running with shared_buffers at +> 16000, it seems this may be correct. Performance was flatter for a +> BIT longer, but slammed right into the wall and started hitting the +> 3-30 second range per COPY. I've restarted the run, with fsync turned +> on (fdatasync), and we'll see. +> +> My fear is that it's some bizarre situation interacting with both +> issues, and one that might not be solvable. Does anyone else have +> much experience with this sort of sustained COPY? + +Well, here's the results: + +http://www.amber.org/~petrilli/diagrams/pgsql_copy500_comparison.png + +The red is the run with shared_buffers turned up, but fsync off. +The blue is the run with shared_buffers turned up, but fsync on. + +Note that it hits the wall sooner. Unfortunately, my brain is fried, +and not sure what that means! + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Apr 5 20:50:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A48E953209; + Tue, 5 Apr 2005 20:50:37 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60668-09; Tue, 5 Apr 2005 19:50:27 +0000 (GMT) +Received: from cmailm3.svr.pol.co.uk (cmailm3.svr.pol.co.uk [195.92.193.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F01452A84; + Tue, 5 Apr 2005 20:50:26 +0100 (BST) +Received: from modem-1544.lynx.dialup.pol.co.uk ([217.135.198.8] + helo=192.168.0.102) by cmailm3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DIu47-0000sZ-G3; Tue, 05 Apr 2005 20:50:24 +0100 +Subject: Re: Sustained inserts per sec ... ? +From: Simon Riggs +To: Christopher Petrilli +Cc: Tom Lane , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <5217.1112668589@sss.pgh.pa.us> +References: <20050401140421.P18194@ganymede.hub.org> + <59d991c4050401113857086517@mail.gmail.com> + <28353.1112388128@sss.pgh.pa.us> + <59d991c4050401124638c4ab5d@mail.gmail.com> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Tue, 05 Apr 2005 20:48:29 +0100 +Message-Id: <1112730509.16721.918.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/86 +X-Sequence-Number: 11483 + +On Mon, 2005-04-04 at 22:36 -0400, Tom Lane wrote: +> Christopher Petrilli writes: +> > On Apr 4, 2005 12:23 PM, Tom Lane wrote: +> >> do a test run with *no* indexes on the table, just to see if it behaves +> >> any differently? Basically I was wondering if index overhead might be +> >> part of the problem. +> +> > http://www.amber.org/~petrilli/diagrams/pgsql_copy500_pkonly.png +> +> > I appologize, I forgot to kill the PK, but as you can see, the curve +> > flattened out a lot. It still begins to increase in what seems like +> > the same place. You can find the results themselves at: +> +> Yeah, this confirms the thought that the indexes are the source of +> the issue. (Which is what I'd expect, because a bare INSERT ought to be +> an approximately constant-time operation. But it's good to verify.) + +Yup, indexes are the best explanation so far - block extension needs +some work, but I doubted that it was the source of this effect. + +> Now some amount of slowdown is to be expected as the indexes get larger, +> since it ought to take roughly O(log N) time to insert a new entry in an +> index of size N. The weird thing about your curves is the very sudden +> jump in the insert times. + +Well, ISTM that the curve is far from unique. Mark's OSDL tests show +them too. What was wierd, for me, was that it "resets" when you move to +a new table. The index theory does accurately explain that. + +Perhaps the jump is not so sudden? Do I see a first small step up at +about 4.5M rows, then another much bigger one at 7.5M (which looks like +the only one at first glance)? + +> What I think might be happening is that the "working set" of pages +> touched during index inserts is gradually growing, and at some point it +> exceeds shared_buffers, and at that point performance goes in the toilet +> because we are suddenly doing lots of reads to pull in index pages that +> fell out of the shared buffer area. + +So this does seem to be the best explanation and it seems a good one. + +It's also an excellent advert for table and index partitioning, and some +damning evidence against global indexes on partitioned tables (though +they may still be better than the alternative...) + +> The indicated fix of course is to increase shared_buffers. + +Splitting your tables at 4M, not 10M would work even better. + +.. + +Anyway, where most of this started was with Christopher's comments: + +On Fri, 2005-04-01 at 14:38 -0500, Christopher Petrilli wrote: +> This was an application originally written for MySQL/MYISAM, and it's +> looking like PostgreSQL can't hold up for it, simply because it's "too +> much database" if that makes sense. The same box, running the MySQL +> implementation (which uses no transactions) runs around 800-1000 +> rows/second systained. + +B-trees aren't unique to PostgreSQL; the explanation developed here +would work equally well for any database system that used tree-based +indexes. Do we still think that MySQL can do this when PostgreSQL +cannot? How? + +Do we have performance test results showing the same application load +without the degradation? We don't need to look at the source code to +measure MySQL performance... + +Best Regards, Simon Riggs + + + +From pgsql-performance-owner@postgresql.org Tue Apr 5 21:05:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C33D538E5 + for ; + Tue, 5 Apr 2005 21:05:53 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65216-06 + for ; + Tue, 5 Apr 2005 20:05:48 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.199]) + by svr1.postgresql.org (Postfix) with ESMTP id B244C5342B + for ; + Tue, 5 Apr 2005 21:05:47 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so1571120rng + for ; + Tue, 05 Apr 2005 13:05:49 -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:references; + b=o7W3bpi0WDUZhmz9qrhDn/ywGXCI4RPgpCoWtylH7PXWfZOIHOqo5k7GNsHBvU8Cr8EC8VjVl4LLqCzN/nkGoAVzCF7v2fEeYTvm5Vi08ks3NoL6v2EdRfWkqZhnj5gsPprx8VYbu01zNLpya2j7JO5sYi9g6CLy/vYNCbuO7HA= +Received: by 10.38.86.68 with SMTP id j68mr6793132rnb; + Tue, 05 Apr 2005 13:05:49 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Tue, 5 Apr 2005 13:05:48 -0700 (PDT) +Message-ID: <59d991c405040513055be3a9b2@mail.gmail.com> +Date: Tue, 5 Apr 2005 16:05:48 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Simon Riggs +Subject: Re: Sustained inserts per sec ... ? +Cc: Tom Lane , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <1112730509.16721.918.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> + <1112730509.16721.918.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.316 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/87 +X-Sequence-Number: 11484 + +On Apr 5, 2005 3:48 PM, Simon Riggs wrote: +> > Now some amount of slowdown is to be expected as the indexes get larger, +> > since it ought to take roughly O(log N) time to insert a new entry in an +> > index of size N. The weird thing about your curves is the very sudden +> > jump in the insert times. +> +> Well, ISTM that the curve is far from unique. Mark's OSDL tests show +> them too. What was wierd, for me, was that it "resets" when you move to +> a new table. The index theory does accurately explain that. +> +> Perhaps the jump is not so sudden? Do I see a first small step up at +> about 4.5M rows, then another much bigger one at 7.5M (which looks like +> the only one at first glance)? +> +> > What I think might be happening is that the "working set" of pages +> > touched during index inserts is gradually growing, and at some point it +> > exceeds shared_buffers, and at that point performance goes in the toilet +> > because we are suddenly doing lots of reads to pull in index pages that +> > fell out of the shared buffer area. +> +> So this does seem to be the best explanation and it seems a good one. +> +> It's also an excellent advert for table and index partitioning, and some +> damning evidence against global indexes on partitioned tables (though +> they may still be better than the alternative...) +> +> > The indicated fix of course is to increase shared_buffers. +> +> Splitting your tables at 4M, not 10M would work even better. + +Unfortunately, given we are talking about billions of rows +potentially, I'm concerned about that many tables when it comes to +query time. I assume this will kick in the genetic optimizer? + + +> Anyway, where most of this started was with Christopher's comments: +> +> On Fri, 2005-04-01 at 14:38 -0500, Christopher Petrilli wrote: +> > This was an application originally written for MySQL/MYISAM, and it's +> > looking like PostgreSQL can't hold up for it, simply because it's "too +> > much database" if that makes sense. The same box, running the MySQL +> > implementation (which uses no transactions) runs around 800-1000 +> > rows/second systained. +> +> B-trees aren't unique to PostgreSQL; the explanation developed here +> would work equally well for any database system that used tree-based +> indexes. Do we still think that MySQL can do this when PostgreSQL +> cannot? How? + +There are customers in production using MySQL with 10M rows/table, and +I have no evidence of this behavior. I do not have the test jig for +MySQL, but I can create one, which is what I will do. Note that they +are using MyISAM files, so there is no ACID behavior. Also, I have +seen troubling corruption issues that I've never been able to +concretely identify. + +Above all, I've been impressed that PostgreSQL, even when it hits this +wall, never corrupts anything. + + > Do we have performance test results showing the same application load +> without the degradation? We don't need to look at the source code to +> measure MySQL performance... + +I will see what I can do in the next few days to create a similar +little test for MySQL. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Apr 5 23:55:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D56BB5389A + for ; + Tue, 5 Apr 2005 23:55:48 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08445-09 + for ; + Tue, 5 Apr 2005 22:55:45 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 990AE53884 + for ; + Tue, 5 Apr 2005 23:55:44 +0100 (BST) +Received: by rproxy.gmail.com with SMTP id a41so24476rng + for ; + Tue, 05 Apr 2005 15:55:42 -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:references; + b=N7NuHqdXGykQcVky7bDEGlSY8cYGBZPg0TJBQzhpeQZdD1TSZ37lPBZLB8sGphHCULuaW2zTCwORS1eqPoRf7BJjSkRjqK+NmPgvAcDeUBNKV5Mhib1ASuLNVtXTDLMkckl5kdt4GezsVm/lme01RgcPx7Pm0WYhYEUzqE3iaTM= +Received: by 10.38.160.49 with SMTP id i49mr132633rne; + Tue, 05 Apr 2005 15:55:42 -0700 (PDT) +Received: by 10.38.207.41 with HTTP; Tue, 5 Apr 2005 15:55:42 -0700 (PDT) +Message-ID: <59d991c405040515555c77d1e@mail.gmail.com> +Date: Tue, 5 Apr 2005 18:55:42 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Simon Riggs +Subject: Re: Sustained inserts per sec ... ? +Cc: Tom Lane , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <1112730509.16721.918.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050401140421.P18194@ganymede.hub.org> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> + <1112730509.16721.918.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.318 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/88 +X-Sequence-Number: 11485 + +On Apr 5, 2005 3:48 PM, Simon Riggs wrote: +> B-trees aren't unique to PostgreSQL; the explanation developed here +> would work equally well for any database system that used tree-based +> indexes. Do we still think that MySQL can do this when PostgreSQL +> cannot? How? +> +> Do we have performance test results showing the same application load +> without the degradation? We don't need to look at the source code to +> measure MySQL performance... + +http://www.amber.org/~petrilli/diagrams/comparison_mysql_pgsql.png + +That chart shows MySQL (using INSERT against MyISAM tables) and +PostgreSQL (using COPY) running with the exact same code otherwise. +Note that MySQL does hit a bit of a wall, but nothing as drastic as +PostgreSQL and actually maintains something "more flat". The red and +blue dashed lines are the 95th percentile point. + +My suspicion is that what we're seeing is WAL issues, not particularly +index issues. The indices just fill up the WAL faster because there's +more data. This is a wag basically, but it would seem to explain the +difference. In both cases, the indices were identical. Five on each. + +One interesting thing... PostgreSQL starts out a good bit faster, but +looses in the end. + +Chris +-- +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Wed Apr 6 05:45:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AFC155351F + for ; + Wed, 6 Apr 2005 05:45:07 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02423-09 + for ; + Wed, 6 Apr 2005 04:45:01 +0000 (GMT) +Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B67B53509 + for ; + Wed, 6 Apr 2005 05:44:59 +0100 (BST) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc12) with ESMTP + id <2005040604445601400q4kdje>; Wed, 6 Apr 2005 04:44:56 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Tue, 05 Apr 2005 21:44:56 -0700 + id 00026F8E.42536948.00006BB0 +Date: Tue, 5 Apr 2005 21:44:56 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: Follow-Up: How to improve db performance with $7K? +Message-ID: <20050406044456.GA19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/89 +X-Sequence-Number: 11486 + +Thomas F.O'Connell wrote: +> I'd use two of your drives to create a mirrored partition where pg_xlog +> resides separate from the actual data. +> +> RAID 10 is probably appropriate for the remaining drives. +> +> Fortunately, you're not using Dell, so you don't have to worry about +> the Perc3/Di RAID controller, which is not so compatible with +> Linux... + +Hmm...I have to wonder how true this is these days. + +My company has a Dell 2500 with a Perc3/Di running Debian Linux, with +the 2.6.10 kernel. The controller seems to work reasonably well, +though I wouldn't doubt that it's slower than a different one might +be. But so far we haven't had any reliability issues with it. + +Now, the performance is pretty bad considering the setup -- a RAID 5 +with five 73.6 gig SCSI disks (10K RPM, I believe). Reads through the +filesystem come through at about 65 megabytes/sec, writes about 35 +megabytes/sec (at least, so says "bonnie -s 8192"). This is on a +system with a single 3 GHz Xeon and 1 gigabyte of memory. I'd expect +much better read performance from what is essentially a stripe of 4 +fast SCSI disks. + + +While compatibility hasn't really been an issue, at least as far as +the basics go, I still agree with your general sentiment -- stay away +from the Dells, at least if they have the Perc3/Di controller. You'll +probably get much better performance out of something else. + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Wed Apr 6 08:11:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 559A65391B + for ; + Wed, 6 Apr 2005 08:10:59 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46445-03 + for ; + Wed, 6 Apr 2005 07:10:53 +0000 (GMT) +Received: from notes.beauchamp.loxane.fr (unknown [217.167.112.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 6273353878 + for ; + Wed, 6 Apr 2005 08:10:50 +0100 (BST) +To: pgsql-performance@postgresql.org +Cc: "Mohan, Ross" +Subject: RE : RE: Postgresql vs SQLserver for this application ? +MIME-Version: 1.0 +X-Mailer: Lotus Notes Release 5.0.10 March 22, 2002 +Message-ID: + +From: bsimon@loxane.com +Date: Wed, 6 Apr 2005 09:17:15 +0200 +X-MIMETrack: Serialize by Router on notes/Loxane(Release 5.0.10 |March 22, + 2002) at 06/04/2005 09:17:20, + Serialize complete at 06/04/2005 09:17:20 +Content-Type: multipart/alternative; + boundary="=_alternative 002792B5C1256FDB_=" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.262 tagged_above=0 required=5 tests=AWL, HTML_50_60, + HTML_MESSAGE, NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/90 +X-Sequence-Number: 11487 + +Message en plusieurs parties au format MIME +--=_alternative 002792B5C1256FDB_= +Content-Type: text/plain; charset="us-ascii" + +Unfortunately. + +But we are in the the process to choose Postgresql with pgcluster. I'm +currently running some tests (performance, stability...) +Save the money on the license fees, you get it for your hardware ;-) + +I still welcome any advices or comments and I'll let you know how the +project is going on. + +Benjamin. + + + + +"Mohan, Ross" +05/04/2005 20:48 + + + Pour : + cc : + Objet : RE: [PERFORM] Postgresql vs SQLserver for this application ? + + +You never got answers on this? Apologies, I don't have one, but'd be +curious to hear about any you did get.... + +thx + +Ross +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of bsimon@loxane.com +Sent: Monday, April 04, 2005 4:02 AM +To: pgsql-performance@postgresql.org +Subject: [PERFORM] Postgresql vs SQLserver for this application ? + + +hi all. + +We are designing a quite big application that requires a high-performance +database backend. +The rates we need to obtain are at least 5000 inserts per second and 15 +selects per second for one connection. There should only be 3 or 4 +simultaneous connections. +I think our main concern is to deal with the constant flow of data coming +from the inserts that must be available for selection as fast as possible. +(kind of real time access ...) + +As a consequence, the database should rapidly increase up to more than one +hundred gigs. We still have to determine how and when we shoud backup old +data to prevent the application from a performance drop. We intend to +develop some kind of real-time partionning on our main table keep the +flows up. + +At first, we were planning to use SQL Server as it has features that in my +opinion could help us a lot : + - replication + - clustering + +Recently we started to study Postgresql as a solution for our project : + - it also has replication + - Postgis module can handle geographic datatypes (which would +facilitate our developments) + - We do have a strong knowledge on Postgresql administration (we +use it for production processes) + - it is free (!) and we could save money for hardware purchase. + +Is SQL server clustering a real asset ? How reliable are Postgresql +replication tools ? Should I trust Postgresql performance for this kind +of needs ? + +My question is a bit fuzzy but any advices are most welcome... +hardware,tuning or design tips as well :)) + +Thanks a lot. + +Benjamin. + + + +--=_alternative 002792B5C1256FDB_= +Content-Type: text/html; charset="us-ascii" + + +
Unfortunately. +
+
But we are in the the process to choose Postgresql with pgcluster. I'm currently running some tests (performance, stability...) +
Save the money on the license fees, you get it for your hardware ;-) +
+
I still welcome any advices or comments and I'll let you know how the project is going on. +
+
Benjamin. +
+
+
+ + +
+"Mohan, Ross" <RMohan@arbinet.com> +

05/04/2005 20:48 +
+

        +
        Pour :        <bsimon@loxane.com> +
        cc :         +
        Objet :        RE: [PERFORM] Postgresql vs SQLserver for this application ?
+
+
+
You never got answers on this? Apologies, I don't have one, but'd be curious to hear about any you did get.... +
  +
thx +
  +
Ross +
-----Original Message-----
+From:
pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of bsimon@loxane.com
+Sent:
Monday, April 04, 2005 4:02 AM
+To:
pgsql-performance@postgresql.org
+Subject:
[PERFORM] Postgresql vs SQLserver for this application ?
+
+

+hi all.

+

+We are designing a quite big application that requires a high-performance database backend.
+The rates we need to obtain are at least  5000 inserts per second and 15 selects per second for one connection. There should only be 3 or 4 simultaneous connections.
+I think our main concern is to deal with the constant flow of data coming from the inserts that must be available for selection as fast as possible. (kind of real time access ...)

+

+As a consequence, the database should rapidly increase up to more than one hundred gigs. We still have to determine how and when we shoud backup old data to prevent the application from a performance drop. We intend to develop some kind of real-time partionning on our main table keep the flows up.

+

+At first, we were planning to use SQL Server as it has features that in my opinion could help us a lot :

+        - replication
+        - clustering

+

+Recently we started to study Postgresql as a solution for our project :

+        - it also has replication
+        - Postgis module can handle geographic datatypes (which would facilitate our developments)

+        - We do have a strong knowledge on Postgresql administration (we use it for production processes)

+        - it is free (!) and we could save money for hardware purchase.

+

+Is SQL server clustering a real asset ? How reliable are Postgresql replication tools  ? Should I trust Postgresql performance for this kind of needs ?

+

+My question is a bit fuzzy but any advices are most welcome... hardware,tuning or design tips as well :))

+

+Thanks a lot.

+

+Benjamin.

+
+
+
+--=_alternative 002792B5C1256FDB_=-- + +From pgsql-performance-owner@postgresql.org Wed Apr 6 08:30:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 772B9539D4 + for ; + Wed, 6 Apr 2005 08:30:54 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52191-02 + for ; + Wed, 6 Apr 2005 07:30:50 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 96F6C539CF + for ; + Wed, 6 Apr 2005 08:30:48 +0100 (BST) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 1E63530952; Wed, 6 Apr 2005 09:30:30 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: How to improve db performance with $7K? +Date: Wed, 06 Apr 2005 00:30:44 -0700 +Organization: Hub.Org Networking Services +Lines: 24 +Message-ID: +References: <42443863.4040302@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: <33c6269f05040412126b5bc719@mail.gmail.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/91 +X-Sequence-Number: 11488 + +Alex Turner wrote: +> I'm no drive expert, but it seems to me that our write performance is +> excellent. I think what most are concerned about is OLTP where you +> are doing heavy write _and_ heavy read performance at the same time. +> +> Our system is mostly read during the day, but we do a full system +> update everynight that is all writes, and it's very fast compared to +> the smaller SCSI system we moved off of. Nearly a 6x spead +> improvement, as fast as 900 rows/sec with a 48 byte record, one row +> per transaction. + +I've started with SATA in a multi-read/multi-write environment. While it +ran pretty good with 1 thread writing, the addition of a 2nd thread +(whether reading or writing) would cause exponential slowdowns. + +I suffered through this for a week and then switched to SCSI. Single +threaded performance was pretty similar but with the advanced command +queueing SCSI has, I was able to do multiple reads/writes simultaneously +with only a small performance hit for each thread. + +Perhaps having a SATA caching raid controller might help this situation. +I don't know. It's pretty hard justifying buying a $$$ 3ware controller +just to test it when you could spend the same money on SCSI and have a +guarantee it'll work good under multi-IO scenarios. + +From pgsql-performance-owner@postgresql.org Wed Apr 6 09:12:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 67D7753A02; + Wed, 6 Apr 2005 09:12:01 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63572-06; Wed, 6 Apr 2005 08:11:56 +0000 (GMT) +Received: from cmailm3.svr.pol.co.uk (cmailm3.svr.pol.co.uk [195.92.193.19]) + by svr1.postgresql.org (Postfix) with ESMTP id CAE6353A2A; + Wed, 6 Apr 2005 09:11:55 +0100 (BST) +Received: from modem-3774.leopard.dialup.pol.co.uk ([217.135.158.190] + helo=192.168.0.102) by cmailm3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DJ5di-0008UR-6U; Wed, 06 Apr 2005 09:11:54 +0100 +Subject: Re: Sustained inserts per sec ... ? +From: Simon Riggs +To: Christopher Petrilli +Cc: Tom Lane , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c405040515555c77d1e@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> + <1112730509.16721.918.camel@localhost.localdomain> + <59d991c405040515555c77d1e@mail.gmail.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 06 Apr 2005 09:09:58 +0100 +Message-Id: <1112774998.16721.1000.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/92 +X-Sequence-Number: 11489 + +On Tue, 2005-04-05 at 18:55 -0400, Christopher Petrilli wrote: +> On Apr 5, 2005 3:48 PM, Simon Riggs wrote: +> > B-trees aren't unique to PostgreSQL; the explanation developed here +> > would work equally well for any database system that used tree-based +> > indexes. Do we still think that MySQL can do this when PostgreSQL +> > cannot? How? +> > +> > Do we have performance test results showing the same application load +> > without the degradation? We don't need to look at the source code to +> > measure MySQL performance... +> +> http://www.amber.org/~petrilli/diagrams/comparison_mysql_pgsql.png +> +> That chart shows MySQL (using INSERT against MyISAM tables) and +> PostgreSQL (using COPY) running with the exact same code otherwise. +> Note that MySQL does hit a bit of a wall, but nothing as drastic as +> PostgreSQL and actually maintains something "more flat". The red and +> blue dashed lines are the 95th percentile point. + +Interesting comparison. Any chance of separating the graphs as well, I'm +interested in the detail on both graphs. + +Could you estimate the apparent periodicity on the PostgreSQL graphs? + +> My suspicion is that what we're seeing is WAL issues, not particularly +> index issues. The indices just fill up the WAL faster because there's +> more data. This is a wag basically, but it would seem to explain the +> difference. In both cases, the indices were identical. Five on each. + +Let's test the shared_buffers theory. + +Would you mind loading only 5M rows per table, but load the same amount +of data overall? That should keep us within the comparable zone overall. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 09:16:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6894753500; + Wed, 6 Apr 2005 09:16:23 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65395-01; Wed, 6 Apr 2005 08:16:18 +0000 (GMT) +Received: from cmailg3.svr.pol.co.uk (cmailg3.svr.pol.co.uk [195.92.195.173]) + by svr1.postgresql.org (Postfix) with ESMTP id AD58453A09; + Wed, 6 Apr 2005 09:16:17 +0100 (BST) +Received: from modem-3774.leopard.dialup.pol.co.uk ([217.135.158.190] + helo=192.168.0.102) by cmailg3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DJ5hv-0007OF-B2; Wed, 06 Apr 2005 09:16:15 +0100 +Subject: Re: Sustained inserts per sec ... ? +From: Simon Riggs +To: Christopher Petrilli +Cc: Tom Lane , jd@commandprompt.com, + "Marc G. Fournier" , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c405040513055be3a9b2@mail.gmail.com> +References: <20050401140421.P18194@ganymede.hub.org> + <1112388818.3487.34.camel@jd2.commandprompt.com> + <59d991c4050401125956d6069d@mail.gmail.com> + <59d991c40504040648457808e9@mail.gmail.com> + <26454.1112629979@sss.pgh.pa.us> + <59d991c405040409094e7bbd17@mail.gmail.com> + <26669.1112631807@sss.pgh.pa.us> + <59d991c40504041846bc39a6@mail.gmail.com> + <5217.1112668589@sss.pgh.pa.us> + <1112730509.16721.918.camel@localhost.localdomain> + <59d991c405040513055be3a9b2@mail.gmail.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 06 Apr 2005 09:14:19 +0100 +Message-Id: <1112775259.16721.1005.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/93 +X-Sequence-Number: 11490 + +On Tue, 2005-04-05 at 16:05 -0400, Christopher Petrilli wrote: +> On Apr 5, 2005 3:48 PM, Simon Riggs wrote: +> > > The indicated fix of course is to increase shared_buffers. +> > +> > Splitting your tables at 4M, not 10M would work even better. +> +> Unfortunately, given we are talking about billions of rows +> potentially, I'm concerned about that many tables when it comes to +> query time. I assume this will kick in the genetic optimizer? + +No, it won't start using the genetic optimizer. + +You could just buy more RAM and keep table size the same. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 12:28:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 90F5653665 + for ; + Wed, 6 Apr 2005 12:28:21 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18131-04 + for ; + Wed, 6 Apr 2005 11:28:17 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id AA043529E2 + for ; + Wed, 6 Apr 2005 12:28:16 +0100 (BST) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1DJ8hl-0007e2-Px + for pgsql-performance@postgresql.org; Wed, 06 Apr 2005 13:28:19 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1DJ8hl-00008I-00 + for ; Wed, 06 Apr 2005 13:28:17 +0200 +Date: Wed, 6 Apr 2005 13:28:17 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Follow-Up: How to improve db performance with $7K? +Message-ID: <20050406112817.GB31767@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> + + <20050406044456.GA19518@filer> +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <20050406044456.GA19518@filer> +X-Operating-System: Linux 2.6.11-rc3 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/94 +X-Sequence-Number: 11491 + +On Tue, Apr 05, 2005 at 09:44:56PM -0700, Kevin Brown wrote: +> Now, the performance is pretty bad considering the setup -- a RAID 5 +> with five 73.6 gig SCSI disks (10K RPM, I believe). Reads through the +> filesystem come through at about 65 megabytes/sec, writes about 35 +> megabytes/sec (at least, so says "bonnie -s 8192"). This is on a +> system with a single 3 GHz Xeon and 1 gigabyte of memory. I'd expect +> much better read performance from what is essentially a stripe of 4 +> fast SCSI disks. + +Data point here: We have a Linux software RAID quite close to the setup you +describe, with an onboard Adaptec controller and four 146GB 10000rpm disks, +and we get about 65MB/sec sustained when writing to an ext3 filesystem +(actually, when wgetting a file off the gigabit LAN :-) ). I haven't tested +reading, though. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:54:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8023C53745 + for ; + Wed, 6 Apr 2005 13:52:48 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42783-09 + for ; + Wed, 6 Apr 2005 12:52:44 +0000 (GMT) +Received: from daisy.midascomm.com (unknown [203.196.171.90]) + by svr1.postgresql.org (Postfix) with ESMTP id 1048E53744 + for ; + Wed, 6 Apr 2005 13:52:42 +0100 (BST) +Received: from daisy.midascomm.com (localhost.localdomain [127.0.0.1]) + by daisy.midascomm.com (8.12.10/8.12.10) with ESMTP id j36CVZDk011723 + for ; Wed, 6 Apr 2005 18:01:35 +0530 +Received: from 192.168.13.108 (SquirrelMail authenticated user thanga); + by daisy.midascomm.com with HTTP; + Wed, 6 Apr 2005 18:01:35 +0530 (IST) +Message-ID: <2038.192.168.13.108.1112790695.squirrel@192.168.13.108> +Date: Wed, 6 Apr 2005 18:01:35 +0530 (IST) +Subject: Is Indexed View Supported in psql 7.1.3?? +From: "S.Thanga Prakash" +To: pgsql-performance@postgresql.org +Reply-To: thanga@midascomm.com +User-Agent: SquirrelMail/1.5.0 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/206 +X-Sequence-Number: 11603 + +hi, + + I like to know whether Indexed View supported in psql 7.1.3.? + +Is there any performance analysis tool for psql.? + +Please! update me for the same. + +regards, +stp. + +From pgsql-performance-owner@postgresql.org Wed Apr 6 14:26:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 50BF15379D + for ; + Wed, 6 Apr 2005 14:26:35 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52456-06 + for ; + Wed, 6 Apr 2005 13:26:32 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 9290753797 + for ; + Wed, 6 Apr 2005 14:26:30 +0100 (BST) +Received: (qmail 23028 invoked from network); 6 Apr 2005 15:26:55 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 6 Apr 2005 15:26:55 +0200 +Date: Wed, 06 Apr 2005 15:26:33 +0200 +To: "Steinar H. Gunderson" , + pgsql-performance@postgresql.org +Subject: Re: Follow-Up: How to improve db performance with $7K? +References: <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> + + <20050406044456.GA19518@filer> <20050406112817.GB31767@uio.no> +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <42453273.2060509@turtle-entertainment.de> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/95 +X-Sequence-Number: 11492 + + +> and we get about 65MB/sec sustained when writing to an ext3 filesystem +> (actually, when wgetting a file off the gigabit LAN :-) ). I haven't + + Well, unless you have PCI 64 bits, the "standard" PCI does 133 MB/s which +is then split exactly in two times 66.5 MB/s for 1) reading from the PCI +network card and 2) writing to the PCI harddisk controller. No wonder you +get this figure, you're able to saturate your PCI bus, but it does not +tell you a thing on the performance of your disk or network card... Note +that the server which serves the file is limited in the same way unless +the file is in cache (RAM) or it's PCI64. So... + + +> tested +> reading, though. +> +> /* Steinar */ + + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 14:33:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 859975379D + for ; + Wed, 6 Apr 2005 14:33:55 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57118-01 + for ; + Wed, 6 Apr 2005 13:33:49 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 8485052A66 + for ; + Wed, 6 Apr 2005 14:33:48 +0100 (BST) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1DJAfH-0001CC-Us + for pgsql-performance@postgresql.org; Wed, 06 Apr 2005 15:33:52 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1DJAfE-0004ET-00 + for ; Wed, 06 Apr 2005 15:33:48 +0200 +Date: Wed, 6 Apr 2005 15:33:48 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Follow-Up: How to improve db performance with $7K? +Message-ID: <20050406133348.GA16108@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> + + <20050406044456.GA19518@filer> <20050406112817.GB31767@uio.no> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: +X-Operating-System: Linux 2.6.11-rc3 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/96 +X-Sequence-Number: 11493 + +On Wed, Apr 06, 2005 at 03:26:33PM +0200, PFC wrote: +> Well, unless you have PCI 64 bits, the "standard" PCI does 133 MB/s +> which is then split exactly in two times 66.5 MB/s for 1) reading from the +> PCI network card and 2) writing to the PCI harddisk controller. No wonder +> you get this figure, you're able to saturate your PCI bus, but it does not +> tell you a thing on the performance of your disk or network card... Note +> that the server which serves the file is limited in the same way unless +> the file is in cache (RAM) or it's PCI64. So... + +This is PCI-X. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Wed Apr 6 16:35:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D74BC534CB + for ; + Wed, 6 Apr 2005 16:35:17 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97248-02 + for ; + Wed, 6 Apr 2005 15:35:11 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 5D01F53497 + for ; + Wed, 6 Apr 2005 16:35:10 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so277129wri + for ; + Wed, 06 Apr 2005 08:35:10 -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:references; + b=baeNif+sMgGBgrGKnUCqUrK+y5FbjuBSJjrVsl6Sy7Fis66NDlTVkM1uhAQCaXVOjRvH+LvRI3mduKxQepUPNoNXTCGhHOJ/ld1jIZ+otq81TaMtD2yPDHC0AIZ2BLEl6kWVMoUZlwugemfSZeH+Z84LiY7fGrfX5+E/MkcmIFg= +Received: by 10.54.32.63 with SMTP id f63mr59392wrf; + Wed, 06 Apr 2005 08:35:10 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 08:35:10 -0700 (PDT) +Message-ID: <33c6269f050406083533d2045d@mail.gmail.com> +Date: Wed, 6 Apr 2005 11:35:10 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: William Yu +Subject: Re: How to improve db performance with $7K? +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <42443863.4040302@sfnet.cc> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.249 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/97 +X-Sequence-Number: 11494 + +It's hardly the same money, the drives are twice as much. + +It's all about the controller baby with any kind of dive. A bad SCSI +controller will give sucky performance too, believe me. We had a +Compaq Smart Array 5304, and it's performance was _very_ sub par. + +If someone has a simple benchmark test database to run, I would be +happy to run it on our hardware here. + +Alex Turner + +On Apr 6, 2005 3:30 AM, William Yu wrote: +> Alex Turner wrote: +> > I'm no drive expert, but it seems to me that our write performance is +> > excellent. I think what most are concerned about is OLTP where you +> > are doing heavy write _and_ heavy read performance at the same time. +> > +> > Our system is mostly read during the day, but we do a full system +> > update everynight that is all writes, and it's very fast compared to +> > the smaller SCSI system we moved off of. Nearly a 6x spead +> > improvement, as fast as 900 rows/sec with a 48 byte record, one row +> > per transaction. +> +> I've started with SATA in a multi-read/multi-write environment. While it +> ran pretty good with 1 thread writing, the addition of a 2nd thread +> (whether reading or writing) would cause exponential slowdowns. +> +> I suffered through this for a week and then switched to SCSI. Single +> threaded performance was pretty similar but with the advanced command +> queueing SCSI has, I was able to do multiple reads/writes simultaneously +> with only a small performance hit for each thread. +> +> Perhaps having a SATA caching raid controller might help this situation. +> I don't know. It's pretty hard justifying buying a $$$ 3ware controller +> just to test it when you could spend the same money on SCSI and have a +> guarantee it'll work good under multi-IO scenarios. +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Wed Apr 6 16:38:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EC881534CC + for ; + Wed, 6 Apr 2005 16:38:36 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98303-03 + for ; + Wed, 6 Apr 2005 15:38:30 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FC5552A45 + for ; + Wed, 6 Apr 2005 16:38:29 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so278628wri + for ; + Wed, 06 Apr 2005 08:38:29 -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:references; + b=eEkzjvOA4xwrP2B8Dimh4zMwOSKiPahh2TP07BJJRm2Xo11gKSpSAl1zWI/PaesOJkyK+JVOxJ7fEPcTBl/IeS2nOkKaLblsOaxtt80tIeQADElHVqTfV+tdPhedC211YvGvi5G2XufszeYA6NuExpkkp99Z5Jy9Bc56asK7MVo= +Received: by 10.54.33.47 with SMTP id g47mr35936wrg; + Wed, 06 Apr 2005 08:37:30 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 08:37:30 -0700 (PDT) +Message-ID: <33c6269f05040608377dfc9272@mail.gmail.com> +Date: Wed, 6 Apr 2005 11:37:30 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: "bsimon@loxane.com" +Subject: Re: RE : RE: Postgresql vs SQLserver for this application ? +Cc: pgsql-performance@postgresql.org, + "Mohan, Ross" +In-Reply-To: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.485 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP, TO_ADDRESS_EQ_REAL +X-Spam-Level: +X-Archive-Number: 200504/98 +X-Sequence-Number: 11495 + +I think everyone was scared off by the 5000 inserts per second number. + +I've never seen even Oracle do this on a top end Dell system with +copious SCSI attached storage. + +Alex Turner +netEconomist + +On Apr 6, 2005 3:17 AM, bsimon@loxane.com wrote: +> +> Unfortunately. +> +> But we are in the the process to choose Postgresql with pgcluster. I'm +> currently running some tests (performance, stability...) +> Save the money on the license fees, you get it for your hardware ;-) +> +> I still welcome any advices or comments and I'll let you know how the +> project is going on. +> +> Benjamin. +> +> +> +> "Mohan, Ross" +> +> 05/04/2005 20:48 +> +> Pour : +> cc : +> Objet : RE: [PERFORM] Postgresql vs SQLserver for this +> application ? +> +> +> You never got answers on this? Apologies, I don't have one, but'd be curious +> to hear about any you did get.... +> +> thx +> +> Ross +> +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf +> Of bsimon@loxane.com +> Sent: Monday, April 04, 2005 4:02 AM +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Postgresql vs SQLserver for this application ? +> +> +> hi all. +> +> We are designing a quite big application that requires a high-performance +> database backend. +> The rates we need to obtain are at least 5000 inserts per second and 15 +> selects per second for one connection. There should only be 3 or 4 +> simultaneous connections. +> I think our main concern is to deal with the constant flow of data coming +> from the inserts that must be available for selection as fast as possible. +> (kind of real time access ...) +> +> As a consequence, the database should rapidly increase up to more than one +> hundred gigs. We still have to determine how and when we shoud backup old +> data to prevent the application from a performance drop. We intend to +> develop some kind of real-time partionning on our main table keep the flows +> up. +> +> At first, we were planning to use SQL Server as it has features that in my +> opinion could help us a lot : +> - replication +> - clustering +> +> Recently we started to study Postgresql as a solution for our project : +> - it also has replication +> - Postgis module can handle geographic datatypes (which would +> facilitate our developments) +> - We do have a strong knowledge on Postgresql administration (we use +> it for production processes) +> - it is free (!) and we could save money for hardware purchase. +> +> Is SQL server clustering a real asset ? How reliable are Postgresql +> replication tools ? Should I trust Postgresql performance for this kind of +> needs ? +> +> My question is a bit fuzzy but any advices are most welcome... +> hardware,tuning or design tips as well :)) +> +> Thanks a lot. +> +> Benjamin. +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Apr 6 17:13:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 03DC3534D3 + for ; + Wed, 6 Apr 2005 17:13:38 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07579-08 + for ; + Wed, 6 Apr 2005 16:13:19 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id F39B753500 + for ; + Wed, 6 Apr 2005 17:13:18 +0100 (BST) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j36GVGBw002300 + for ; Wed, 6 Apr 2005 16:31:26 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j36GVGdC002290; + Wed, 6 Apr 2005 16:31:16 GMT +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: RE : RE: Postgresql vs SQLserver for this application ? +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Date: Wed, 6 Apr 2005 16:12:47 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: RE : RE: [PERFORM] Postgresql vs SQLserver for this application + ? +Thread-Index: AcU6vrCGczb/LGl9TlyX0WSMUfmQlAAAwG6A +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.31 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/99 +X-Sequence-Number: 11496 + +I wish I had a Dell system and run case to show you Alex, but I don't... +however...using Oracle's "direct path" feature, it's pretty = +straightforward.=20 + +We've done 110,000 rows per second into index-less tables on a big = +system +(IBM Power5 chips, Hitachi SAN). ( Yes, I am sure: over 100K a second. = +Sustained +for almost 9 minutes. ) + +Yes, this is an exception, but oracle directpath/InsertAppend/BulkLoad +feature enabled us to migrate a 4 TB database...really quickly.=20 + +Now...if you ask me "can this work without Power5 and Hitachi SAN?" +my answer is..you give me a top end Dell and SCSI III on 15K disks +and I'll likely easily match it, yea. + +I'd love to see PG get into this range..i am a big fan of PG (just a +rank newbie) but I gotta think the underlying code to do this has +to be not-too-complex..... + +Best,=20 + +Ross + + + +-----Original Message----- +From: Alex Turner [mailto:armtuk@gmail.com]=20 +Sent: Wednesday, April 06, 2005 11:38 AM +To: bsimon@loxane.com +Cc: pgsql-performance@postgresql.org; Mohan, Ross +Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for this = +application ? + + +I think everyone was scared off by the 5000 inserts per second number. + +I've never seen even Oracle do this on a top end Dell system with = +copious SCSI attached storage. + +Alex Turner +netEconomist + +On Apr 6, 2005 3:17 AM, bsimon@loxane.com wrote: +> =20 +> Unfortunately. +> =20 +> But we are in the the process to choose Postgresql with pgcluster. I'm = + +> currently running some tests (performance, stability...) Save the=20 +> money on the license fees, you get it for your hardware ;-) +> =20 +> I still welcome any advices or comments and I'll let you know how the=20 +> project is going on. +> =20 +> Benjamin. +> =20 +> =20 +> =20 +> "Mohan, Ross" +>=20 +> 05/04/2005 20:48 +> =20 +> Pour : =20 +> cc : =20 +> Objet : RE: [PERFORM] Postgresql vs SQLserver for this +> application ? +> =20 +> =20 +> You never got answers on this? Apologies, I don't have one, but'd be=20 +> curious to hear about any you did get.... +> =20 +> thx +> =20 +> Ross +>=20 +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf +> Of bsimon@loxane.com +> Sent: Monday, April 04, 2005 4:02 AM +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Postgresql vs SQLserver for this application ? +> =20 +>=20 +> hi all. +> =20 +> We are designing a quite big application that requires a=20 +> high-performance database backend. The rates we need to obtain are at = + +> least 5000 inserts per second and 15 selects per second for one=20 +> connection. There should only be 3 or 4 simultaneous connections. +> I think our main concern is to deal with the constant flow of data = +coming +> from the inserts that must be available for selection as fast as = +possible. +> (kind of real time access ...)=20 +> =20 +> As a consequence, the database should rapidly increase up to more=20 +> than one hundred gigs. We still have to determine how and when we=20 +> shoud backup old data to prevent the application from a performance=20 +> drop. We intend to develop some kind of real-time partionning on our=20 +> main table keep the flows up. +> =20 +> At first, we were planning to use SQL Server as it has features that=20 +> in my opinion could help us a lot : +> - replication=20 +> - clustering +> =20 +> Recently we started to study Postgresql as a solution for our project = +:=20 +> - it also has replication=20 +> - Postgis module can handle geographic datatypes (which would=20 +> facilitate our developments) +> - We do have a strong knowledge on Postgresql administration=20 +> (we use it for production processes) +> - it is free (!) and we could save money for hardware=20 +> purchase. +> =20 +> Is SQL server clustering a real asset ? How reliable are Postgresql=20 +> replication tools ? Should I trust Postgresql performance for this=20 +> kind of needs ? +> =20 +> My question is a bit fuzzy but any advices are most welcome...=20 +> hardware,tuning or design tips as well :)) +> =20 +> Thanks a lot. +> =20 +> Benjamin. +> =20 +> =20 +> + +From pgsql-performance-owner@postgresql.org Wed Apr 6 17:39:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C056A53245 + for ; + Wed, 6 Apr 2005 17:39:19 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17453-05 + for ; + Wed, 6 Apr 2005 16:39:01 +0000 (GMT) +Received: from noao.edu (noao.edu [140.252.1.54]) + by svr1.postgresql.org (Postfix) with ESMTP id 06F1A53502 + for ; + Wed, 6 Apr 2005 17:39:00 +0100 (BST) +X-TFF-CGPSA-Version: 1.4f1 +X-TFF-CGPSA-Filter: Scanned +Received: from [140.252.14.8] (HELO weaver.tuc.noao.edu) + by noao.edu (CommuniGate Pro SMTP 4.2.10) + with ESMTP-TLS id 17541340; Wed, 06 Apr 2005 09:38:53 -0700 +Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) + by weaver.tuc.noao.edu (8.12.8/8.12.8) with ESMTP id j36GcpKv028119; + Wed, 6 Apr 2005 09:38:51 -0700 +Message-ID: <4254109B.5090809@noao.edu> +Date: Wed, 06 Apr 2005 09:38:51 -0700 +From: Steve Wampler +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Mohan, Ross" +Cc: pgsql-performance@postgresql.org +Subject: Re: RE : RE: Postgresql vs SQLserver for this application +References: +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-noao.edu-MailScanner-Information: Please contact the ISP for more + information +X-noao.edu-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/100 +X-Sequence-Number: 11497 + +Mohan, Ross wrote: +> I wish I had a Dell system and run case to show you Alex, but I don't... +> however...using Oracle's "direct path" feature, it's pretty straightforward. +> +> We've done 110,000 rows per second into index-less tables on a big system +> (IBM Power5 chips, Hitachi SAN). ( Yes, I am sure: over 100K a second. Sustained +> for almost 9 minutes. ) +> +> Yes, this is an exception, but oracle directpath/InsertAppend/BulkLoad +> feature enabled us to migrate a 4 TB database...really quickly. + +How close to this is PG's COPY? I get surprisingly good results using +COPY with jdbc on smallish systems (now if that patch would make into +the mainstream PG jdbc support!) I think COPY has a bit more overhead +than what a Bulkload feature may have, but I suspect it's not that +much more. + +> Now...if you ask me "can this work without Power5 and Hitachi SAN?" +> my answer is..you give me a top end Dell and SCSI III on 15K disks +> and I'll likely easily match it, yea. +> +> I'd love to see PG get into this range..i am a big fan of PG (just a +> rank newbie) but I gotta think the underlying code to do this has +> to be not-too-complex..... + +It may not be that far off if you can use COPY instead of INSERT. +But comparing Bulkload to INSERT is a bit apples<->orangish. + +-- +Steve Wampler -- swampler@noao.edu +The gods that smiled on your birth are now laughing out loud. + +From pgsql-performance-owner@postgresql.org Wed Apr 6 17:41:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D39353523 + for ; + Wed, 6 Apr 2005 17:41:03 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18510-03 + for ; + Wed, 6 Apr 2005 16:41:00 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 0FC735350E + for ; + Wed, 6 Apr 2005 17:40:58 +0100 (BST) +Received: from dyn-70-66.tor.dsl.tht.net (dyn-70-66.tor.dsl.tht.net + [134.22.70.66]) by tht.net (Postfix) with ESMTP + id 6724376A0C; Wed, 6 Apr 2005 12:40:58 -0400 (EDT) +Subject: Re: RE : RE: Postgresql vs SQLserver for this +From: Rod Taylor +To: "Mohan, Ross" +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +References: +Content-Type: text/plain +Date: Wed, 06 Apr 2005 12:40:47 -0400 +Message-Id: <1112805647.92363.110.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/101 +X-Sequence-Number: 11498 + +On Wed, 2005-04-06 at 16:12 +0000, Mohan, Ross wrote: +> I wish I had a Dell system and run case to show you Alex, but I don't... +> however...using Oracle's "direct path" feature, it's pretty straightforward. +> +> We've done 110,000 rows per second into index-less tables on a big system +> (IBM Power5 chips, Hitachi SAN). ( Yes, I am sure: over 100K a second. Sustained +> for almost 9 minutes. ) + +Just for kicks I did a local test on a desktop machine (single CPU, +single IDE drive) using COPY from STDIN for a set of integers in via a +single transaction, no indexes. + +1572864 tuples were loaded in 13715.613ms, which is approx 115k rows per +second. + +Okay, no checkpoints and I didn't cross an index boundary, but I also +haven't tuned the config file beyond bumping up the buffers. + +Lets try again with more data this time. + +31Million tuples were loaded in approx 279 seconds, or approx 112k rows +per second. + +> I'd love to see PG get into this range..i am a big fan of PG (just a +> rank newbie) but I gotta think the underlying code to do this has +> to be not-too-complex..... + +I'd say we're there. + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com] +> Sent: Wednesday, April 06, 2005 11:38 AM +> To: bsimon@loxane.com +> Cc: pgsql-performance@postgresql.org; Mohan, Ross +> Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for this application ? +> +> +> I think everyone was scared off by the 5000 inserts per second number. +> +> I've never seen even Oracle do this on a top end Dell system with copious SCSI attached storage. +> +> Alex Turner +> netEconomist +> +> On Apr 6, 2005 3:17 AM, bsimon@loxane.com wrote: +> > +> > Unfortunately. +> > +> > But we are in the the process to choose Postgresql with pgcluster. I'm +> > currently running some tests (performance, stability...) Save the +> > money on the license fees, you get it for your hardware ;-) +> > +> > I still welcome any advices or comments and I'll let you know how the +> > project is going on. +> > +> > Benjamin. +> > +> > +> > +> > "Mohan, Ross" +> > +> > 05/04/2005 20:48 +> > +> > Pour : +> > cc : +> > Objet : RE: [PERFORM] Postgresql vs SQLserver for this +> > application ? +> > +> > +> > You never got answers on this? Apologies, I don't have one, but'd be +> > curious to hear about any you did get.... +> > +> > thx +> > +> > Ross +> > +> > -----Original Message----- +> > From: pgsql-performance-owner@postgresql.org +> > [mailto:pgsql-performance-owner@postgresql.org] On Behalf +> > Of bsimon@loxane.com +> > Sent: Monday, April 04, 2005 4:02 AM +> > To: pgsql-performance@postgresql.org +> > Subject: [PERFORM] Postgresql vs SQLserver for this application ? +> > +> > +> > hi all. +> > +> > We are designing a quite big application that requires a +> > high-performance database backend. The rates we need to obtain are at +> > least 5000 inserts per second and 15 selects per second for one +> > connection. There should only be 3 or 4 simultaneous connections. +> > I think our main concern is to deal with the constant flow of data coming +> > from the inserts that must be available for selection as fast as possible. +> > (kind of real time access ...) +> > +> > As a consequence, the database should rapidly increase up to more +> > than one hundred gigs. We still have to determine how and when we +> > shoud backup old data to prevent the application from a performance +> > drop. We intend to develop some kind of real-time partionning on our +> > main table keep the flows up. +> > +> > At first, we were planning to use SQL Server as it has features that +> > in my opinion could help us a lot : +> > - replication +> > - clustering +> > +> > Recently we started to study Postgresql as a solution for our project : +> > - it also has replication +> > - Postgis module can handle geographic datatypes (which would +> > facilitate our developments) +> > - We do have a strong knowledge on Postgresql administration +> > (we use it for production processes) +> > - it is free (!) and we could save money for hardware +> > purchase. +> > +> > Is SQL server clustering a real asset ? How reliable are Postgresql +> > replication tools ? Should I trust Postgresql performance for this +> > kind of needs ? +> > +> > My question is a bit fuzzy but any advices are most welcome... +> > hardware,tuning or design tips as well :)) +> > +> > Thanks a lot. +> > +> > Benjamin. +> > +> > +> > +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 17:44:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0819553245 + for ; + Wed, 6 Apr 2005 17:44:55 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18866-04 + for ; + Wed, 6 Apr 2005 16:44:36 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 80D035294A + for ; + Wed, 6 Apr 2005 17:44:35 +0100 (BST) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j36H2MBu003566 + for ; Wed, 6 Apr 2005 17:02:37 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j36H2LdE003557; + Wed, 6 Apr 2005 17:02:22 GMT +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: RE : RE: Postgresql vs SQLserver for this application ? +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Date: Wed, 6 Apr 2005 16:43:33 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: RE : RE: [PERFORM] Postgresql vs SQLserver for this application + ? +Thread-Index: AcU6xyYZ8kdkEKtqR46Ds12UDK7OFAAACRrw +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.284 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/102 +X-Sequence-Number: 11499 + +How close to this is PG's COPY? I get surprisingly good results using = +COPY with jdbc on smallish systems (now if that patch would make into = +the mainstream PG jdbc support!) I think COPY has a bit more overhead = +than what a Bulkload feature may have, but I suspect it's not that much = +more. + +|| Steve, I do not know. But am reading the docs now, and should figure = +it out. Ask + me later if you remember. Oracle's "direct path" is a way of just = +slamming blocks + filled with rows into the table, above the high water mark. It = +sidesteps freelist + management and all manner of intrablock issues. There is a = +"payback", but the benefits + far far outweigh the costs.=20 + +> Now...if you ask me "can this work without Power5 and Hitachi SAN?" my = + +> answer is..you give me a top end Dell and SCSI III on 15K disks and=20 +> I'll likely easily match it, yea. +>=20 +> I'd love to see PG get into this range..i am a big fan of PG (just a=20 +> rank newbie) but I gotta think the underlying code to do this has to=20 +> be not-too-complex..... + +It may not be that far off if you can use COPY instead of INSERT. But = +comparing Bulkload to INSERT is a bit apples<->orangish. + +|| Oh! I see! I had no idea I was doing that! Thanks for pointing it = +out clearly to me. Yea, I would + say a full transactional INSERT of 5K rows/sec into an indexed-table = +is a near-mythology without significant + caveats (parallelized, deferred buffering, etc.)=20 + + + +--=20 +Steve Wampler -- swampler@noao.edu +The gods that smiled on your birth are now laughing out loud. + +From pgsql-performance-owner@postgresql.org Wed Apr 6 17:48:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4BC075350A + for ; + Wed, 6 Apr 2005 17:48:39 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19094-09 + for ; + Wed, 6 Apr 2005 16:48:37 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 11102534B4 + for ; + Wed, 6 Apr 2005 17:48:36 +0100 (BST) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j36H6OBu003631 + for ; Wed, 6 Apr 2005 17:06:38 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j36H6OdC003625; + Wed, 6 Apr 2005 17:06:24 GMT +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: RE : RE: Postgresql vs SQLserver for thisapplication ? +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Date: Wed, 6 Apr 2005 16:47:13 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: RE : RE: [PERFORM] Postgresql vs SQLserver for thisapplication ? +Thread-Index: AcU6x2zyAIq+MSAjQOqrG5X5IRqjMgAAJcFg +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00, CASHCASHCASH, + USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.263 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/103 +X-Sequence-Number: 11500 + + + +31Million tuples were loaded in approx 279 seconds, or approx 112k rows = +per second. + +> I'd love to see PG get into this range..i am a big fan of PG (just a=20 +> rank newbie) but I gotta think the underlying code to do this has to=20 +> be not-too-complex..... + +I'd say we're there. + + +|| Yes! PG is there, assuredly! So VERY cool! I made a = +newbie + error of conflating COPY with INSERT. I don't know if I could get + oracle to do much more than about 500-1500 rows/sec...PG is quite = +impressive. + + Makes one wonder why corporations positively insist on giving oracle + $$$$ yearly. + +-----Original Message----- +From: Rod Taylor [mailto:pg@rbt.ca]=20 +Sent: Wednesday, April 06, 2005 12:41 PM +To: Mohan, Ross +Cc: pgsql-performance@postgresql.org +Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for = +thisapplication ? + + +On Wed, 2005-04-06 at 16:12 +0000, Mohan, Ross wrote: +> I wish I had a Dell system and run case to show you Alex, but I=20 +> don't... however...using Oracle's "direct path" feature, it's pretty=20 +> straightforward. +>=20 +> We've done 110,000 rows per second into index-less tables on a big=20 +> system (IBM Power5 chips, Hitachi SAN). ( Yes, I am sure: over 100K a=20 +> second. Sustained for almost 9 minutes. ) + +Just for kicks I did a local test on a desktop machine (single CPU, = +single IDE drive) using COPY from STDIN for a set of integers in via a = +single transaction, no indexes. + +1572864 tuples were loaded in 13715.613ms, which is approx 115k rows per = +second. + +Okay, no checkpoints and I didn't cross an index boundary, but I also = +haven't tuned the config file beyond bumping up the buffers. + +Lets try again with more data this time. + +31Million tuples were loaded in approx 279 seconds, or approx 112k rows = +per second. + +> I'd love to see PG get into this range..i am a big fan of PG (just a=20 +> rank newbie) but I gotta think the underlying code to do this has to=20 +> be not-too-complex..... + +I'd say we're there. + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com] +> Sent: Wednesday, April 06, 2005 11:38 AM +> To: bsimon@loxane.com +> Cc: pgsql-performance@postgresql.org; Mohan, Ross +> Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for this = +application ? +>=20 +>=20 +> I think everyone was scared off by the 5000 inserts per second number. +>=20 +> I've never seen even Oracle do this on a top end Dell system with=20 +> copious SCSI attached storage. +>=20 +> Alex Turner +> netEconomist +>=20 +> On Apr 6, 2005 3:17 AM, bsimon@loxane.com wrote: +> > =20 +> > Unfortunately. +> > =20 +> > But we are in the the process to choose Postgresql with pgcluster.=20 +> > I'm +> > currently running some tests (performance, stability...) Save the=20 +> > money on the license fees, you get it for your hardware ;-) +> > =20 +> > I still welcome any advices or comments and I'll let you know how=20 +> > the +> > project is going on. +> > =20 +> > Benjamin. +> > =20 +> > =20 +> > =20 +> > "Mohan, Ross" +> >=20 +> > 05/04/2005 20:48 +> > =20 +> > Pour : =20 +> > cc : =20 +> > Objet : RE: [PERFORM] Postgresql vs SQLserver for = +this +> > application ? +> > =20 +> > =20 +> > You never got answers on this? Apologies, I don't have one, but'd be +> > curious to hear about any you did get.... +> > =20 +> > thx +> > =20 +> > Ross +> >=20 +> > -----Original Message----- +> > From: pgsql-performance-owner@postgresql.org +> > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> > bsimon@loxane.com +> > Sent: Monday, April 04, 2005 4:02 AM +> > To: pgsql-performance@postgresql.org +> > Subject: [PERFORM] Postgresql vs SQLserver for this application ? +> > =20 +> >=20 +> > hi all. +> > =20 +> > We are designing a quite big application that requires a +> > high-performance database backend. The rates we need to obtain are = +at=20 +> > least 5000 inserts per second and 15 selects per second for one=20 +> > connection. There should only be 3 or 4 simultaneous connections. +> > I think our main concern is to deal with the constant flow of data = +coming +> > from the inserts that must be available for selection as fast as = +possible. +> > (kind of real time access ...)=20 +> > =20 +> > As a consequence, the database should rapidly increase up to more +> > than one hundred gigs. We still have to determine how and when we=20 +> > shoud backup old data to prevent the application from a performance=20 +> > drop. We intend to develop some kind of real-time partionning on our = + +> > main table keep the flows up. +> > =20 +> > At first, we were planning to use SQL Server as it has features=20 +> > that +> > in my opinion could help us a lot : +> > - replication=20 +> > - clustering +> > =20 +> > Recently we started to study Postgresql as a solution for our = +project :=20 +> > - it also has replication=20 +> > - Postgis module can handle geographic datatypes (which=20 +> > would +> > facilitate our developments) +> > - We do have a strong knowledge on Postgresql administration = + +> > (we use it for production processes) +> > - it is free (!) and we could save money for hardware=20 +> > purchase. +> > =20 +> > Is SQL server clustering a real asset ? How reliable are Postgresql +> > replication tools ? Should I trust Postgresql performance for this=20 +> > kind of needs ? +> > =20 +> > My question is a bit fuzzy but any advices are most welcome... +> > hardware,tuning or design tips as well :)) +> > =20 +> > Thanks a lot. +> > =20 +> > Benjamin. +> > =20 +> > =20 +> > +>=20 +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to = +majordomo@postgresql.org) +>=20 +--=20 + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 17:54:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2EDD7531C7 + for ; + Wed, 6 Apr 2005 17:52:39 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22240-02 + for ; + Wed, 6 Apr 2005 16:52:37 +0000 (GMT) +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 466665294A + for ; + Wed, 6 Apr 2005 17:52:36 +0100 (BST) +Received: from [10.0.0.2] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id 9CA73181D1 + for ; + Wed, 6 Apr 2005 18:52:30 +0200 (MEST) +Message-ID: <425413D3.5030304@vulcanus.its.tudelft.nl> +Date: Wed, 06 Apr 2005 18:52:35 +0200 +From: Arjen van der Meijden +User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: performance pgsql +Subject: Plan for relatively simple query seems to be very inefficient +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/104 +X-Sequence-Number: 11501 + +Hi list, + +I noticed on a forum a query taking a surprisingly large amount of time +in MySQL. Of course I wanted to prove PostgreSQL 8.0.1 could do it much +better. To my surprise PostgreSQL was ten times worse on the same +machine! And I don't understand why. + +I don't really need this query to be fast since I don't use it, but the +range-thing is not really an uncommon query I suppose. So I'm wondering +why it is so slow and this may point to a wrong plan being chosen or +generated. + +Here are table definitions: + + Table "public.postcodes" + Column | Type | Modifiers +-------------+---------------+----------- + postcode_id | smallint | not null + range_from | smallint | + range_till | smallint | +Indexes: + "postcodes_pkey" PRIMARY KEY, btree (postcode_id) + "range" UNIQUE, btree (range_from, range_till) + + Table "public.data_main" + Column | Type | Modifiers +--------+----------+----------- + userid | integer | not null + range | smallint | +Indexes: + "data_main_pkey" PRIMARY KEY, btree (userid) + +And here's the query I ran: + +SELECT COUNT(*) FROM +data_main AS dm, +postcodes AS p +WHERE dm.range BETWEEN p.range_from AND p.range_till + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=332586.85..332586.85 rows=1 width=0) (actual +time=22712.038..22712.039 rows=1 loops=1) + -> Nested Loop (cost=3.76..328945.96 rows=1456356 width=0) (actual +time=0.054..22600.826 rows=82688 loops=1) + Join Filter: (("outer".range >= "inner".range_from) AND +("outer".range <= "inner".range_till)) + -> Seq Scan on data_main dm (cost=0.00..1262.20 rows=81920 +width=2) (actual time=0.020..136.930 rows=81920 loops=1) + -> Materialize (cost=3.76..5.36 rows=160 width=4) (actual +time=0.001..0.099 rows=160 loops=81920) + -> Seq Scan on postcodes p (cost=0.00..3.60 rows=160 +width=4) (actual time=0.010..0.396 rows=160 loops=1) + Total runtime: 22712.211 ms + + +When I do something completely bogus, which will result in coupling the +data per record from data_main on one record from postcodes, it still +not very fast but acceptable: + +SELECT COUNT(*) FROM +data_main AS dm, +postcodes AS p +WHERE dm.range / 10 = p.postcode_id + + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=10076.98..10076.98 rows=1 width=0) (actual +time=1456.016..1456.017 rows=1 loops=1) + -> Merge Join (cost=8636.81..9913.13 rows=65537 width=0) (actual +time=1058.105..1358.571 rows=81920 loops=1) + Merge Cond: ("outer".postcode_id = "inner"."?column2?") + -> Index Scan using postcodes_pkey on postcodes p +(cost=0.00..5.76 rows=160 width=2) (actual time=0.034..0.507 rows=160 +loops=1) + -> Sort (cost=8636.81..8841.61 rows=81920 width=2) (actual +time=1057.698..1169.879 rows=81920 loops=1) + Sort Key: (dm.range / 10) + -> Seq Scan on data_main dm (cost=0.00..1262.20 +rows=81920 width=2) (actual time=0.020..238.886 rows=81920 loops=1) + Total runtime: 1461.156 ms + + +Doing something similarily bogus, but with less results is much faster, +even though it should have basically the same plan: + +SELECT COUNT(*) FROM +data_main AS dm, +postcodes AS p +WHERE dm.range = p.postcode_id + + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=2138.63..2138.63 rows=1 width=0) (actual +time=180.667..180.668 rows=1 loops=1) + -> Hash Join (cost=4.00..2087.02 rows=20642 width=0) (actual +time=180.645..180.645 rows=0 loops=1) + Hash Cond: ("outer".range = "inner".postcode_id) + -> Seq Scan on data_main dm (cost=0.00..1262.20 rows=81920 +width=2) (actual time=0.005..105.548 rows=81920 loops=1) + -> Hash (cost=3.60..3.60 rows=160 width=2) (actual +time=0.592..0.592 rows=0 loops=1) + -> Seq Scan on postcodes p (cost=0.00..3.60 rows=160 +width=2) (actual time=0.025..0.349 rows=160 loops=1) + Total runtime: 180.807 ms +(7 rows) + +If you like to toy around with the datasets on your heavily optimized +postgresql-installs, let me know. The data is just generated for +testing-purposes and I'd happily send a copy to anyone interested. + +Best regards, + +Arjen van der Meijden + +From pgsql-performance-owner@postgresql.org Wed Apr 6 18:02:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3511D5350A + for ; + Wed, 6 Apr 2005 18:02:09 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24560-06 + for ; + Wed, 6 Apr 2005 17:02:08 +0000 (GMT) +Received: from gp.word-to-the-wise.com (gp.word-to-the-wise.com + [64.71.176.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 176B053500 + for ; + Wed, 6 Apr 2005 18:02:07 +0100 (BST) +Received: by gp.word-to-the-wise.com (Postfix, from userid 500) + id 4B9AB90000E; Wed, 6 Apr 2005 10:04:12 -0700 (PDT) +Date: Wed, 6 Apr 2005 10:04:12 -0700 +From: Steve Atkins +To: performance pgsql +Subject: Re: Plan for relatively simple query seems to be very inefficient +Message-ID: <20050406170412.GB22693@gp.word-to-the-wise.com> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <425413D3.5030304@vulcanus.its.tudelft.nl> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/105 +X-Sequence-Number: 11502 + +On Wed, Apr 06, 2005 at 06:52:35PM +0200, Arjen van der Meijden wrote: +> Hi list, +> +> I noticed on a forum a query taking a surprisingly large amount of time +> in MySQL. Of course I wanted to prove PostgreSQL 8.0.1 could do it much +> better. To my surprise PostgreSQL was ten times worse on the same +> machine! And I don't understand why. +> +> I don't really need this query to be fast since I don't use it, but the +> range-thing is not really an uncommon query I suppose. So I'm wondering +> why it is so slow and this may point to a wrong plan being chosen or +> generated. + +That's the wrong index type for fast range queries. You really need +something like GiST or rtree for that. I do something similar in +production and queries are down at the millisecond level with the +right index. + + +Cheers, + Steve + +> Here are table definitions: +> +> Table "public.postcodes" +> Column | Type | Modifiers +> -------------+---------------+----------- +> postcode_id | smallint | not null +> range_from | smallint | +> range_till | smallint | +> Indexes: +> "postcodes_pkey" PRIMARY KEY, btree (postcode_id) +> "range" UNIQUE, btree (range_from, range_till) +> +> Table "public.data_main" +> Column | Type | Modifiers +> --------+----------+----------- +> userid | integer | not null +> range | smallint | +> Indexes: +> "data_main_pkey" PRIMARY KEY, btree (userid) +> +> And here's the query I ran: +> +> SELECT COUNT(*) FROM +> data_main AS dm, +> postcodes AS p +> WHERE dm.range BETWEEN p.range_from AND p.range_till + +From pgsql-performance-owner@postgresql.org Wed Apr 6 18:02:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C1F2F53536 + for ; + Wed, 6 Apr 2005 18:02:46 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24537-09 + for ; + Wed, 6 Apr 2005 17:02:29 +0000 (GMT) +Received: from notes.beauchamp.loxane.fr (unknown [217.167.112.209]) + by svr1.postgresql.org (Postfix) with ESMTP id CC6E35296E + for ; + Wed, 6 Apr 2005 18:02:23 +0100 (BST) +To: Rod Taylor +Cc: pgsql-performance@postgresql.org +Subject: =?iso-8859-1?Q?R=E9f=2E_=3A_Re=3A_RE_=3A_RE=3A__Postgresql_vs?= + SQLserver for this +MIME-Version: 1.0 +X-Mailer: Lotus Notes Release 5.0.10 March 22, 2002 +Message-ID: + +From: bsimon@loxane.com +Date: Wed, 6 Apr 2005 19:08:46 +0200 +X-MIMETrack: Serialize by Router on notes/Loxane(Release 5.0.10 |March 22, + 2002) at 06/04/2005 19:08:53, + Serialize complete at 06/04/2005 19:08:53 +Content-Type: multipart/alternative; + boundary="=_alternative 005DCD5EC1256FDB_=" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.245 tagged_above=0 required=5 tests=AWL, HTML_30_40, + HTML_MESSAGE, NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/106 +X-Sequence-Number: 11503 + +Message en plusieurs parties au format MIME +--=_alternative 005DCD5EC1256FDB_= +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +On our production server, I can insert 5000 tuples in 2100 ms.=20 + +Single Xeon 2.6 Ghz +2 Gigs ram +3ware RAID 5 SATA drives array, 3 drives only :-(( +PG 8.0 - fsync off=20 + +I do think inserting 5000 tuples in a second (i.e 5000 insert=20 +transactions, no bulk load) can be reached with well a configured SCSI=20 +RAID 10 array. + +Anyway it was a MISTAKE in my former description of the project : (sorry=20 +for this) + + - we need 5000 inserts per MINUTE + +My question remain : + + Is pgcluster worth giving a try and can it be trusted for in a=20 +production environnement ? + Will it be possible to get a sort of real-time application ? + + +Thanks for all your comments. +Benjamin. + + + + +=20 + + + + +Rod Taylor +Envoy=E9 par : pgsql-performance-owner@postgresql.org +06/04/2005 18:40 + +=20 + Pour : "Mohan, Ross" + cc : pgsql-performance@postgresql.org + Objet : Re: RE : RE: [PERFORM] Postgresql vs SQLserver for this + + +On Wed, 2005-04-06 at 16:12 +0000, Mohan, Ross wrote: +> I wish I had a Dell system and run case to show you Alex, but I don't... +> however...using Oracle's "direct path" feature, it's pretty=20 +straightforward.=20 +>=20 +> We've done 110,000 rows per second into index-less tables on a big=20 +system +> (IBM Power5 chips, Hitachi SAN). ( Yes, I am sure: over 100K a second.=20 +Sustained +> for almost 9 minutes. ) + +Just for kicks I did a local test on a desktop machine (single CPU, +single IDE drive) using COPY from STDIN for a set of integers in via a +single transaction, no indexes. + +1572864 tuples were loaded in 13715.613ms, which is approx 115k rows per +second. + +Okay, no checkpoints and I didn't cross an index boundary, but I also +haven't tuned the config file beyond bumping up the buffers. + +Lets try again with more data this time. + +31Million tuples were loaded in approx 279 seconds, or approx 112k rows +per second. + +> I'd love to see PG get into this range..i am a big fan of PG (just a +> rank newbie) but I gotta think the underlying code to do this has +> to be not-too-complex..... + +I'd say we're there. + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com]=20 +> Sent: Wednesday, April 06, 2005 11:38 AM +> To: bsimon@loxane.com +> Cc: pgsql-performance@postgresql.org; Mohan, Ross +> Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for this=20 +application ? +>=20 +>=20 +> I think everyone was scared off by the 5000 inserts per second number. +>=20 +> I've never seen even Oracle do this on a top end Dell system with=20 +copious SCSI attached storage. +>=20 +> Alex Turner +> netEconomist +>=20 +> On Apr 6, 2005 3:17 AM, bsimon@loxane.com wrote: +> >=20 +> > Unfortunately. +> >=20 +> > But we are in the the process to choose Postgresql with pgcluster. I'm = + + +> > currently running some tests (performance, stability...) Save the=20 +> > money on the license fees, you get it for your hardware ;-) +> >=20 +> > I still welcome any advices or comments and I'll let you know how the=20 +> > project is going on. +> >=20 +> > Benjamin. +> >=20 +> >=20 +> >=20 +> > "Mohan, Ross" +> >=20 +> > 05/04/2005 20:48 +> >=20 +> > Pour : =20 +> > cc :=20 +> > Objet : RE: [PERFORM] Postgresql vs SQLserver for this +> > application ? +> >=20 +> >=20 +> > You never got answers on this? Apologies, I don't have one, but'd be=20 +> > curious to hear about any you did get.... +> >=20 +> > thx +> >=20 +> > Ross +> >=20 +> > -----Original Message----- +> > From: pgsql-performance-owner@postgresql.org +> > [mailto:pgsql-performance-owner@postgresql.org] On Behalf +> > Of bsimon@loxane.com +> > Sent: Monday, April 04, 2005 4:02 AM +> > To: pgsql-performance@postgresql.org +> > Subject: [PERFORM] Postgresql vs SQLserver for this application ? +> >=20 +> >=20 +> > hi all. +> >=20 +> > We are designing a quite big application that requires a=20 +> > high-performance database backend. The rates we need to obtain are at = + + +> > least 5000 inserts per second and 15 selects per second for one=20 +> > connection. There should only be 3 or 4 simultaneous connections. +> > I think our main concern is to deal with the constant flow of data=20 +coming +> > from the inserts that must be available for selection as fast as=20 +possible. +> > (kind of real time access ...)=20 +> >=20 +> > As a consequence, the database should rapidly increase up to more=20 +> > than one hundred gigs. We still have to determine how and when we=20 +> > shoud backup old data to prevent the application from a performance=20 +> > drop. We intend to develop some kind of real-time partionning on our=20 +> > main table keep the flows up. +> >=20 +> > At first, we were planning to use SQL Server as it has features that=20 +> > in my opinion could help us a lot : +> > - replication=20 +> > - clustering +> >=20 +> > Recently we started to study Postgresql as a solution for our project = + +:=20 +> > - it also has replication=20 +> > - Postgis module can handle geographic datatypes (which would=20 +> > facilitate our developments) +> > - We do have a strong knowledge on Postgresql administration=20 +> > (we use it for production processes) +> > - it is free (!) and we could save money for hardware=20 +> > purchase. +> >=20 +> > Is SQL server clustering a real asset ? How reliable are Postgresql=20 +> > replication tools ? Should I trust Postgresql performance for this=20 +> > kind of needs ? +> >=20 +> > My question is a bit fuzzy but any advices are most welcome...=20 +> > hardware,tuning or design tips as well :)) +> >=20 +> > Thanks a lot. +> >=20 +> > Benjamin. +> >=20 +> >=20 +> > +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +>=20 +--=20 + + +---------------------------(end of broadcast)--------------------------- +TIP 9: the planner will ignore your desire to choose an index scan if your + joining column's datatypes do not match + + + +--=_alternative 005DCD5EC1256FDB_= +Content-Type: text/html; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + +
On our production server, I can inse= +rt 5000 tuples in 2100 ms. +
+
Single Xeon 2.6 Ghz +
2 Gigs ram +
3ware RAID 5 SATA drives array, 3 dr= +ives only :-(( +
PG 8.0 - fsync off +
+
I do think inserting 5000 tuples in = +a second (i.e 5000 insert transactions, no bulk load) can be reached with w= +ell a configured SCSI RAID 10 array. +
+
Anyway it was a MISTAKE in my former= + description of the project : (sorry for this) +
+
        -  = +we need 5000 inserts per MINUTE +
+
My question remain : +
+
        Is pgclu= +ster worth giving a try and can it be trusted for in a production environne= +ment ? +
        Will it = +be possible to get a sort of real-time application ? +
+
+
Thanks for all your comments. +
Benjamin. +
+
+
+
+
  +
+
+
+ + +
+Rod Taylor <pg@rbt.ca><= +/font> +
Envoy=E9 par : pgsql-performance-own= +er@postgresql.org +

06/04/2005 18:40 +
+

        +
        Pour : &= +nbsp;      "Mohan, Ross" <RMohan@arbinet.com>= +; +
        cc : &nb= +sp;      pgsql-performance@postgresql.org +
        Objet : = +       Re: RE : RE: [PERFORM] Postgresql vs SQLserver f= +or this
+
+
+
On Wed, 2005-04-06 at 16:12 +0000, = +Mohan, Ross wrote:
+> I wish I had a Dell system and run case to show you Alex, but I don't.= +..
+> however...using Oracle's "direct path" feature, it's pretty = +straightforward.
+>
+> We've done 110,000 rows per second into index-less tables on a big sys= +tem
+> (IBM Power5 chips, Hitachi SAN). ( Yes, I am sure: over 100K a second.= + Sustained
+> for almost 9 minutes. )
+
+Just for kicks I did a local test on a desktop machine (single CPU,
+single IDE drive) using COPY from STDIN for a set of integers in via a
+single transaction, no indexes.
+
+1572864 tuples were loaded in 13715.613ms, which is approx 115k rows per
+second.
+
+Okay, no checkpoints and I didn't cross an index boundary, but I also
+haven't tuned the config file beyond bumping up the buffers.
+
+Lets try again with more data this time.
+
+31Million tuples were loaded in approx 279 seconds, or approx 112k rows
+per second.
+
+> I'd love to see PG get into this range..i am a big fan of PG (just a +> rank newbie) but I gotta think the underlying code to do this has
+> to be not-too-complex.....
+
+I'd say we're there.
+
+> -----Original Message-----
+> From: Alex Turner [mailto:armtuk@gmail.com]
+> Sent: Wednesday, April 06, 2005 11:38 AM
+> To: bsimon@loxane.com
+> Cc: pgsql-performance@postgresql.org; Mohan, Ross
+> Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for this appli= +cation ?
+>
+>
+> I think everyone was scared off by the 5000 inserts per second number.= +
+>
+> I've never seen even Oracle do this on a top end Dell system with copi= +ous SCSI attached storage.
+>
+> Alex Turner
+> netEconomist
+>
+> On Apr 6, 2005 3:17 AM, bsimon@loxane.com <bsimon@loxane.com> wr= +ote:
+> >  
+> > Unfortunately.
+> >  
+> > But we are in the the process to choose Postgresql with pgcluster= +. I'm
+> > currently running some tests (performance, stability...) Save the= +
+> > money on the license fees, you get it for your hardware ;-)
+> >  
+> > I still welcome any advices or comments and I'll let you know how= + the
+> > project is going on.
+> >  
+> > Benjamin.
+> >  
+> >  
+> >  
+> >  "Mohan, Ross" <RMohan@arbinet.com>
+> >
+> > 05/04/2005 20:48
+> >          
+> >         Pour :        <= +;bsimon@loxane.com>
+> >         cc :        
+> >         Objet :        RE= +: [PERFORM] Postgresql vs SQLserver for this
+> > application ?
+> >  
+> >  
+> > You never got answers on this? Apologies, I don't have one, but'd= + be
+> > curious to hear about any you did get....
+> >  
+> > thx
+> >  
+> > Ross
+> >
+> > -----Original Message-----
+> >  From: pgsql-performance-owner@postgresql.org
+> > [mailto:pgsql-performance-owner@postgresql.org] On Behalf
+> > Of bsimon@loxane.com
+> >  Sent: Monday, April 04, 2005 4:02 AM
+> >  To: pgsql-performance@postgresql.org
+> >  Subject: [PERFORM] Postgresql vs SQLserver for this applica= +tion ?
+> >  
+> >
+> >  hi all.
+> >  
+> >  We are designing a quite big application that requires a +> > high-performance database backend.  The rates we need to obt= +ain are at
+> > least  5000 inserts per second and 15 selects per second for= + one
+> > connection. There should only be 3 or 4 simultaneous connections.= +
+> >  I think our main concern is to deal with the constant flow = +of data coming
+> > from the inserts that must be available for selection as fast as = +possible.
+
> > (kind of real time access= + ...)
+> >  
+> >  As a consequence, the database should rapidly increase up t= +o more
+> > than one hundred gigs. We still have to determine how and when we= +
+> > shoud backup old data to prevent the application from a performan= +ce
+> > drop. We intend to develop some kind of real-time partionning on = +our
+> > main table keep the flows up.
+> >  
+> >  At first, we were planning to use SQL Server as it has feat= +ures that
+> > in my opinion could help us a lot :
+> >         - replication
+> >         - clustering
+> >  
+> >  Recently we started to study Postgresql as a solution for o= +ur project :
+> >         - it also has replication
+> >         - Postgis module can handle geographi= +c datatypes (which would
+> > facilitate our developments)
+> >         - We do have a strong knowledge on Po= +stgresql administration
+> > (we use it for production processes)
+> >         - it is free (!) and we could save mo= +ney for hardware
+> > purchase.
+> >  
+> >  Is SQL server clustering a real asset ? How reliable are Po= +stgresql
+> > replication tools  ? Should I trust Postgresql performance f= +or this
+> > kind of needs ?
+> >  
+> >  My question is a bit fuzzy but any advices are most welcome= +...
+> > hardware,tuning or design tips as well :))
+> >  
+> >  Thanks a lot.
+> >  
+> >  Benjamin.
+> >  
+> >  
+> >
+>
+> ---------------------------(end of broadcast)-------------------------= +--
+> TIP 2: you can get off all lists at once with the unregister command +>     (send "unregister YourEmailAddressHere" to maj= +ordomo@postgresql.org)
+>
+--
+
+
+---------------------------(end of broadcast)---------------------------
+TIP 9: the planner will ignore your desire to choose an index scan if your<= +br> +      joining column's datatypes do not match
+
+
+
+--=_alternative 005DCD5EC1256FDB_=-- + +From pgsql-performance-owner@postgresql.org Wed Apr 6 18:18:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E39A053541 + for ; + Wed, 6 Apr 2005 18:18:39 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30227-05 + for ; + Wed, 6 Apr 2005 17:18:37 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CE6B53545 + for ; + Wed, 6 Apr 2005 18:18:36 +0100 (BST) +Received: from dyn-70-66.tor.dsl.tht.net (dyn-70-66.tor.dsl.tht.net + [134.22.70.66]) by tht.net (Postfix) with ESMTP + id 913D276A0C; Wed, 6 Apr 2005 13:18:40 -0400 (EDT) +Subject: Re: =?ISO-8859-1?Q?R=E9f=2E?= : Re: RE : RE: Postgresql +From: Rod Taylor +To: bsimon@loxane.com +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +References: + +Content-Type: text/plain +Date: Wed, 06 Apr 2005 13:18:29 -0400 +Message-Id: <1112807909.92363.120.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/107 +X-Sequence-Number: 11504 + +On Wed, 2005-04-06 at 19:08 +0200, bsimon@loxane.com wrote: +> +> On our production server, I can insert 5000 tuples in 2100 ms. +> +> Single Xeon 2.6 Ghz +> 2 Gigs ram +> 3ware RAID 5 SATA drives array, 3 drives only :-(( +> PG 8.0 - fsync off +> +> I do think inserting 5000 tuples in a second (i.e 5000 insert +> transactions, no bulk load) can be reached with well a configured SCSI +> RAID 10 array. + +Yeah, I think that can be done provided there is more than one worker. +My limit seems to be about 1000 transactions per second each with a +single insert for a single process (round trip time down the Fibre +Channel is large) but running 4 simultaneously only drops throughput to +about 900 per process (total of 2400 transactions per second) and the +machine still seemed to have lots of oomph to spare. + +Also worth noting is that this test was performed on a machine which as +a noise floor receives about 200 queries per second, which it was +serving during the test. + +> Is pgcluster worth giving a try and can it be trusted for in a +> production environnement ? +> Will it be possible to get a sort of real-time application ? + +>From the design of pgcluster it looks like it adds in a significant +amount of additional communication so expect your throughput for a +single process to drop through the floor. + +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 18:40:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C29D053A40 + for ; + Wed, 6 Apr 2005 18:40:35 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35242-08 + for ; + Wed, 6 Apr 2005 17:40:26 +0000 (GMT) +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FC2053570 + for ; + Wed, 6 Apr 2005 18:40:26 +0100 (BST) +Received: from [10.0.0.2] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP + id DC71718152; Wed, 6 Apr 2005 19:40:23 +0200 (MEST) +Message-ID: <42541F0D.9010009@vulcanus.its.tudelft.nl> +Date: Wed, 06 Apr 2005 19:40:29 +0200 +From: Arjen van der Meijden +User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Steve Atkins +Cc: performance pgsql +Subject: Re: Plan for relatively simple query seems to be very inefficient +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <20050406170412.GB22693@gp.word-to-the-wise.com> +In-Reply-To: <20050406170412.GB22693@gp.word-to-the-wise.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/108 +X-Sequence-Number: 11505 + +On 6-4-2005 19:04, Steve Atkins wrote: +> On Wed, Apr 06, 2005 at 06:52:35PM +0200, Arjen van der Meijden wrote: +> +>>Hi list, +>> +>>I noticed on a forum a query taking a surprisingly large amount of time +>>in MySQL. Of course I wanted to prove PostgreSQL 8.0.1 could do it much +>>better. To my surprise PostgreSQL was ten times worse on the same +>>machine! And I don't understand why. +>> +>>I don't really need this query to be fast since I don't use it, but the +>>range-thing is not really an uncommon query I suppose. So I'm wondering +>>why it is so slow and this may point to a wrong plan being chosen or +>>generated. +> +> +> That's the wrong index type for fast range queries. You really need +> something like GiST or rtree for that. I do something similar in +> production and queries are down at the millisecond level with the +> right index. + +That may be, but since that table is only two pages the index would +probably not be used even if it was rtree or GiST? +Btw, "access method "rtree" does not support multicolumn indexes", I'd +need another way of storing it as well? Plus it doesn't support < and > +so the query should be changed for the way ranges are checked. + +I'm not sure if the dataset is really suitable for other range checks. +It is a linear set of postal codes grouped by their number (range_from +to range_till) into regions and the query basically joins the region to +each records of a user table. Of course one could use lines on the +x-axis and define the postal-code of a specific user as a point on one +of those lines... + +But nonetheless, /this/ query should be "not that slow" either, right? + +Arjen + +From pgsql-performance-owner@postgresql.org Wed Apr 6 18:42:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C9D4D53A3C + for ; + Wed, 6 Apr 2005 18:42:16 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36899-08 + for ; + Wed, 6 Apr 2005 17:42:14 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 681E953570 + for ; + Wed, 6 Apr 2005 18:42:13 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36HgEpD028553; + Wed, 6 Apr 2005 13:42:14 -0400 (EDT) +To: Arjen van der Meijden +Cc: performance pgsql +Subject: Re: Plan for relatively simple query seems to be very inefficient +In-reply-to: <425413D3.5030304@vulcanus.its.tudelft.nl> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> +Comments: In-reply-to Arjen van der Meijden + + message dated "Wed, 06 Apr 2005 18:52:35 +0200" +Date: Wed, 06 Apr 2005 13:42:14 -0400 +Message-ID: <28552.1112809334@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/109 +X-Sequence-Number: 11506 + +Arjen van der Meijden writes: +> I noticed on a forum a query taking a surprisingly large amount of time +> in MySQL. Of course I wanted to prove PostgreSQL 8.0.1 could do it much +> better. To my surprise PostgreSQL was ten times worse on the same +> machine! And I don't understand why. + +Wrong index ... what you probably could use here is an index on +data_main.range, so that the query could run with postcodes as the +outer side. I get such a plan by default with empty tables: + + Aggregate (cost=99177.80..99177.80 rows=1 width=0) + -> Nested Loop (cost=0.00..98021.80 rows=462400 width=0) + -> Seq Scan on postcodes p (cost=0.00..30.40 rows=2040 width=4) + -> Index Scan using rangei on data_main dm (cost=0.00..44.63 rows=227 width=2) + Index Cond: ((dm.range >= "outer".range_from) AND (dm.range <= "outer".range_till)) + +but I'm not sure if the planner would prefer it with the tables loaded +up. (It might not be the right thing anyway ... but seems worth +trying.) + +Given the relatively small size of the postcodes table, and the fact +that each data_main row seems to join to about one postcodes row, +it's possible that what the planner did for you was actually the +optimal thing anyhow. I'm not sure that any range-capable index would +be faster than just scanning through 160 entries in memory ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 6 18:43:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BC7E53A30 + for ; + Wed, 6 Apr 2005 18:43:09 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38362-01 + for ; + Wed, 6 Apr 2005 17:42:59 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 1095753541 + for ; + Wed, 6 Apr 2005 18:42:57 +0100 (BST) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1DJEYJ-0004H0-9b + for pgsql-performance@postgresql.org; Wed, 06 Apr 2005 19:42:56 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1DJEYI-0003zg-00 + for ; Wed, 06 Apr 2005 19:42:54 +0200 +Date: Wed, 6 Apr 2005 19:42:54 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: =?utf-8?Q?R=C3=A9f?= +Message-ID: <20050406174254.GC13641@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: + + <1112807909.92363.120.camel@home> +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <1112807909.92363.120.camel@home> +X-Operating-System: Linux 2.6.11-rc3 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/110 +X-Sequence-Number: 11507 + +On Wed, Apr 06, 2005 at 01:18:29PM -0400, Rod Taylor wrote: +> Yeah, I think that can be done provided there is more than one worker. +> My limit seems to be about 1000 transactions per second each with a +> single insert for a single process (round trip time down the Fibre +> Channel is large) but running 4 simultaneously only drops throughput to +> about 900 per process (total of 2400 transactions per second) and the +> machine still seemed to have lots of oomph to spare. + +Erm, have I missed something here? 900 * 4 = 2400? + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Wed Apr 6 18:45:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E439B53A38 + for ; + Wed, 6 Apr 2005 18:45:44 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37597-05 + for ; + Wed, 6 Apr 2005 17:45:36 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id D2F8D53A30 + for ; + Wed, 6 Apr 2005 18:45:34 +0100 (BST) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Plan for relatively simple query seems to be very inefficient +Date: Wed, 6 Apr 2005 12:45:31 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A0@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Plan for relatively simple query seems to be very + inefficient +Thread-Index: AcU6yf2HRgFPmA40RrercFe5hfZVzAABMlqA +From: "Dave Held" +To: "performance pgsql" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.076 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/111 +X-Sequence-Number: 11508 + +> -----Original Message----- +> From: Arjen van der Meijden=20 +> [mailto:acmmailing@vulcanus.its.tudelft.nl] +> Sent: Wednesday, April 06, 2005 11:53 AM +> To: performance pgsql +> Subject: [PERFORM] Plan for relatively simple query seems to be very +> inefficient +>=20 +> [...] +> SELECT COUNT(*) FROM +> data_main AS dm, +> postcodes AS p +> WHERE dm.range BETWEEN p.range_from AND p.range_till +> [...] +> Aggregate (cost=3D332586.85..332586.85 rows=3D1 width=3D0) (actual=20 +> time=3D22712.038..22712.039 rows=3D1 loops=3D1) +> -> Nested Loop (cost=3D3.76..328945.96 rows=3D1456356=20 +> width=3D0) (actual=20 +> time=3D0.054..22600.826 rows=3D82688 loops=3D1) + +I'm still a noob at reading EXPLAIN ANALYZE, but it seems to me +that your statistics are throwing off the planner here. It=20 +estimates 1.4M and gets 82K, so it's off by a factor of about 20. =20 +Have you considered doing a VACUUM or upping your statistics? + +> [...] +> When I do something completely bogus, which will result in=20 +> coupling the data per record from data_main on one record from +> postcodes, it still not very fast but acceptable: +> [...] +> Aggregate (cost=3D10076.98..10076.98 rows=3D1 width=3D0) (actual=20 +> time=3D1456.016..1456.017 rows=3D1 loops=3D1) +> -> Merge Join (cost=3D8636.81..9913.13 rows=3D65537=20 +> width=3D0) (actual=20 +> time=3D1058.105..1358.571 rows=3D81920 loops=3D1) + +Looks like Merge Join is faster than the Nested Loop for this +query. If you notice, the row counts are a lot closer to the +estimates, too. This is probably a "good" plan. + +> [...] +> Doing something similarily bogus, but with less results is=20 +> much faster, even though it should have basically the same +> plan: +>=20 +> SELECT COUNT(*) FROM +> data_main AS dm, +> postcodes AS p +> WHERE dm.range =3D p.postcode_id +> [...] +> Aggregate (cost=3D2138.63..2138.63 rows=3D1 width=3D0) (actual=20 +> time=3D180.667..180.668 rows=3D1 loops=3D1) +> -> Hash Join (cost=3D4.00..2087.02 rows=3D20642 width=3D0) = +(actual=20 +> time=3D180.645..180.645 rows=3D0 loops=3D1) + +This one I don't understand at all. Clearly, the Hash Join is +the way to go, but the estimates are way off (which probably=20 +explains why this plan isn't chosen in the first place). + +> Hash Cond: ("outer".range =3D "inner".postcode_id) +> -> Seq Scan on data_main dm (cost=3D0.00..1262.20=20 +> rows=3D81920=20 +> width=3D2) (actual time=3D0.005..105.548 rows=3D81920 loops=3D1) +> -> Hash (cost=3D3.60..3.60 rows=3D160 width=3D2) (actual=20 +> time=3D0.592..0.592 rows=3D0 loops=3D1) +> -> Seq Scan on postcodes p (cost=3D0.00..3.60=20 +> rows=3D160=20 +> width=3D2) (actual time=3D0.025..0.349 rows=3D160 loops=3D1) +> Total runtime: 180.807 ms +> (7 rows) +> [...] + +My completely amateur guess is that the planner is able to use +Merge Join and Hash Join on your contrived queries because you +are only trying to join one field to a single value (i.e.: +operator=3D). But the BETWEEN clause is what forces the Nested +Loop. You can see that here: + + -> Seq Scan on postcodes p (cost=3D0.00..3.60 = +rows=3D160=20 +width=3D4) (actual time=3D0.010..0.396 rows=3D160 loops=3D1) +vs. here: + + -> Index Scan using postcodes_pkey on postcodes p=20 +(cost=3D0.00..5.76 rows=3D160 width=3D2) (actual time=3D0.034..0.507 = +rows=3D160=20 +loops=3D1) + +So the first query forces a SeqScan on postcodes, while the +second can do an IndexScan. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Wed Apr 6 19:00:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B819553332 + for ; + Wed, 6 Apr 2005 19:00:46 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40856-10 + for ; + Wed, 6 Apr 2005 18:00:07 +0000 (GMT) +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 46FD2534C3 + for ; + Wed, 6 Apr 2005 19:00:06 +0100 (BST) +Received: from [10.0.0.2] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP + id 07BA818148; Wed, 6 Apr 2005 20:00:04 +0200 (MEST) +Message-ID: <425423A9.9000504@vulcanus.its.tudelft.nl> +Date: Wed, 06 Apr 2005 20:00:09 +0200 +From: Arjen van der Meijden +User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: performance pgsql +Subject: Re: Plan for relatively simple query seems to be very inefficient +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> +In-Reply-To: <28552.1112809334@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/112 +X-Sequence-Number: 11509 + +On 6-4-2005 19:42, Tom Lane wrote: +> Arjen van der Meijden writes: +> +>>I noticed on a forum a query taking a surprisingly large amount of time +>>in MySQL. Of course I wanted to prove PostgreSQL 8.0.1 could do it much +>>better. To my surprise PostgreSQL was ten times worse on the same +>>machine! And I don't understand why. +> +> +> Wrong index ... what you probably could use here is an index on +> data_main.range, so that the query could run with postcodes as the +> outer side. I get such a plan by default with empty tables: +> +> Aggregate (cost=99177.80..99177.80 rows=1 width=0) +> -> Nested Loop (cost=0.00..98021.80 rows=462400 width=0) +> -> Seq Scan on postcodes p (cost=0.00..30.40 rows=2040 width=4) +> -> Index Scan using rangei on data_main dm (cost=0.00..44.63 rows=227 width=2) +> Index Cond: ((dm.range >= "outer".range_from) AND (dm.range <= "outer".range_till)) +> +> but I'm not sure if the planner would prefer it with the tables loaded +> up. (It might not be the right thing anyway ... but seems worth +> trying.) + +No it didn't prefer it. + +> Given the relatively small size of the postcodes table, and the fact +> that each data_main row seems to join to about one postcodes row, +> it's possible that what the planner did for you was actually the +> optimal thing anyhow. I'm not sure that any range-capable index would +> be faster than just scanning through 160 entries in memory ... +> +> regards, tom lane + +Yep, there is only one or in corner cases two postcode-ranges per +postcode. Actually it should be only one, but my generated data is not +perfect. +But the sequential scan per record is not really what surprises me, +especially since the postcode table is only two pages of data, I didn't +really expect otherwise. +It is the fact that it takes 22 seconds that surprises me. Especially +since the two other examples on the same data which consider about the +same amount of records per table/record only take 1.4 and 0.18 seconds. + +Best regards, + +Arjen + +From pgsql-performance-owner@postgresql.org Wed Apr 6 19:09:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 911945343E + for ; + Wed, 6 Apr 2005 19:09:32 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46003-04 + for ; + Wed, 6 Apr 2005 18:09:29 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7DA8E533E6 + for ; + Wed, 6 Apr 2005 19:09:29 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36I93CW028761; + Wed, 6 Apr 2005 14:09:03 -0400 (EDT) +To: "Dave Held" +Cc: "performance pgsql" , + Arjen van der Meijden +Subject: Re: Plan for relatively simple query seems to be very inefficient +In-reply-to: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A0@asg002.asg.local> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A0@asg002.asg.local> +Comments: In-reply-to "Dave Held" + message dated "Wed, 06 Apr 2005 12:45:31 -0500" +Date: Wed, 06 Apr 2005 14:09:03 -0400 +Message-ID: <28760.1112810943@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/113 +X-Sequence-Number: 11510 + +"Dave Held" writes: +> My completely amateur guess is that the planner is able to use +> Merge Join and Hash Join on your contrived queries because you +> are only trying to join one field to a single value (i.e.: +> operator=). But the BETWEEN clause is what forces the Nested +> Loop. You can see that here: + +Yeah --- both merge and hash join are only usable for equality joins. +(Thinking about it, it seems possible that mergejoin could be extended +to work for range joins, but we're certainly far from being able to +do that today.) So the basic alternatives the planner has are nestloops +with either postcode on the outside, or data_main on the outside. The +postcode-on-the-outside case would be plausible with an index on +data_main.range, but Arjen didn't have one. The data_main-on-the-outside +case could only use an index if the index was range-query-capable, which +a 2-column btree index isn't. Given the small size of the postcodes +table it's not real clear that an index probe would be much of a win +anyway over a simple sequential scan. + +Comparing the nestloop case to the hash case does make one think that +there's an awful lot of overhead somewhere, though. Two int2 +comparisons ought not take very long :-(. Arjen, are you interested +in getting a gprof profile of what the backend is doing in the nestloop +-with-materialize plan? Or if you don't want to mess with it, please +send me the data off-list and I'll run a profile. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 6 19:18:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E0DC2533E6 + for ; + Wed, 6 Apr 2005 19:18:35 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48321-03 + for ; + Wed, 6 Apr 2005 18:18:25 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) + by svr1.postgresql.org (Postfix) with ESMTP id A72CA53364 + for ; + Wed, 6 Apr 2005 19:18:22 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so335225wri + for ; + Wed, 06 Apr 2005 11:18:23 -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:references; + b=PhKLjkKXC6KArg0W+MzvEXEKarXw8td8U5lzND09Gd3JDPjvzybvXMDp9ngtZ+MMYmTEdvXdboz6tZAGMW27Vc1rAuTQm1DVntQfd52tzlcIuIXY8HFLfzDbCT7z/uiVii1nPK4CUF2hxhbUXli09/MajdREEL2kdXvY/B7pnFM= +Received: by 10.54.32.67 with SMTP id f67mr233939wrf; + Wed, 06 Apr 2005 11:18:21 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 11:18:21 -0700 (PDT) +Message-ID: <33c6269f050406111849766b3@mail.gmail.com> +Date: Wed, 6 Apr 2005 14:18:21 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: "Mohan, Ross" +Subject: Re: RE : RE: Postgresql vs SQLserver for thisapplication ? +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.253 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/114 +X-Sequence-Number: 11511 + +I guess I was thinking more in the range of 5000 transaction/sec, less +so 5000 rows on bulk import... + +Alex + +On Apr 6, 2005 12:47 PM, Mohan, Ross wrote: +> +> +> 31Million tuples were loaded in approx 279 seconds, or approx 112k rows per second. +> +> > I'd love to see PG get into this range..i am a big fan of PG (just a +> > rank newbie) but I gotta think the underlying code to do this has to +> > be not-too-complex..... +> +> I'd say we're there. +> +> || Yes! PG is there, assuredly! So VERY cool! I made a newbie +> error of conflating COPY with INSERT. I don't know if I could get +> oracle to do much more than about 500-1500 rows/sec...PG is quite impressive. +> +> Makes one wonder why corporations positively insist on giving oracle +> $$$$ yearly. +> +> -----Original Message----- +> From: Rod Taylor [mailto:pg@rbt.ca] +> Sent: Wednesday, April 06, 2005 12:41 PM +> To: Mohan, Ross +> Cc: pgsql-performance@postgresql.org +> Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for thisapplication ? +> +> On Wed, 2005-04-06 at 16:12 +0000, Mohan, Ross wrote: +> > I wish I had a Dell system and run case to show you Alex, but I +> > don't... however...using Oracle's "direct path" feature, it's pretty +> > straightforward. +> > +> > We've done 110,000 rows per second into index-less tables on a big +> > system (IBM Power5 chips, Hitachi SAN). ( Yes, I am sure: over 100K a +> > second. Sustained for almost 9 minutes. ) +> +> Just for kicks I did a local test on a desktop machine (single CPU, single IDE drive) using COPY from STDIN for a set of integers in via a single transaction, no indexes. +> +> 1572864 tuples were loaded in 13715.613ms, which is approx 115k rows per second. +> +> Okay, no checkpoints and I didn't cross an index boundary, but I also haven't tuned the config file beyond bumping up the buffers. +> +> Lets try again with more data this time. +> +> 31Million tuples were loaded in approx 279 seconds, or approx 112k rows per second. +> +> > I'd love to see PG get into this range..i am a big fan of PG (just a +> > rank newbie) but I gotta think the underlying code to do this has to +> > be not-too-complex..... +> +> I'd say we're there. +> +> > -----Original Message----- +> > From: Alex Turner [mailto:armtuk@gmail.com] +> > Sent: Wednesday, April 06, 2005 11:38 AM +> > To: bsimon@loxane.com +> > Cc: pgsql-performance@postgresql.org; Mohan, Ross +> > Subject: Re: RE : RE: [PERFORM] Postgresql vs SQLserver for this application ? +> > +> > +> > I think everyone was scared off by the 5000 inserts per second number. +> > +> > I've never seen even Oracle do this on a top end Dell system with +> > copious SCSI attached storage. +> > +> > Alex Turner +> > netEconomist +> > +> > On Apr 6, 2005 3:17 AM, bsimon@loxane.com wrote: +> > > +> > > Unfortunately. +> > > +> > > But we are in the the process to choose Postgresql with pgcluster. +> > > I'm +> > > currently running some tests (performance, stability...) Save the +> > > money on the license fees, you get it for your hardware ;-) +> > > +> > > I still welcome any advices or comments and I'll let you know how +> > > the +> > > project is going on. +> > > +> > > Benjamin. +> > > +> > > +> > > +> > > "Mohan, Ross" +> > > +> > > 05/04/2005 20:48 +> > > +> > > Pour : +> > > cc : +> > > Objet : RE: [PERFORM] Postgresql vs SQLserver for this +> > > application ? +> > > +> > > +> > > You never got answers on this? Apologies, I don't have one, but'd be +> > > curious to hear about any you did get.... +> > > +> > > thx +> > > +> > > Ross +> > > +> > > -----Original Message----- +> > > From: pgsql-performance-owner@postgresql.org +> > > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of +> > > bsimon@loxane.com +> > > Sent: Monday, April 04, 2005 4:02 AM +> > > To: pgsql-performance@postgresql.org +> > > Subject: [PERFORM] Postgresql vs SQLserver for this application ? +> > > +> > > +> > > hi all. +> > > +> > > We are designing a quite big application that requires a +> > > high-performance database backend. The rates we need to obtain are at +> > > least 5000 inserts per second and 15 selects per second for one +> > > connection. There should only be 3 or 4 simultaneous connections. +> > > I think our main concern is to deal with the constant flow of data coming +> > > from the inserts that must be available for selection as fast as possible. +> > > (kind of real time access ...) +> > > +> > > As a consequence, the database should rapidly increase up to more +> > > than one hundred gigs. We still have to determine how and when we +> > > shoud backup old data to prevent the application from a performance +> > > drop. We intend to develop some kind of real-time partionning on our +> > > main table keep the flows up. +> > > +> > > At first, we were planning to use SQL Server as it has features +> > > that +> > > in my opinion could help us a lot : +> > > - replication +> > > - clustering +> > > +> > > Recently we started to study Postgresql as a solution for our project : +> > > - it also has replication +> > > - Postgis module can handle geographic datatypes (which +> > > would +> > > facilitate our developments) +> > > - We do have a strong knowledge on Postgresql administration +> > > (we use it for production processes) +> > > - it is free (!) and we could save money for hardware +> > > purchase. +> > > +> > > Is SQL server clustering a real asset ? How reliable are Postgresql +> > > replication tools ? Should I trust Postgresql performance for this +> > > kind of needs ? +> > > +> > > My question is a bit fuzzy but any advices are most welcome... +> > > hardware,tuning or design tips as well :)) +> > > +> > > Thanks a lot. +> > > +> > > Benjamin. +> > > +> > > +> > > +> > +> > ---------------------------(end of +> > broadcast)--------------------------- +> > TIP 2: you can get off all lists at once with the unregister command +> > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> > +> -- +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings +> + +From pgsql-performance-owner@postgresql.org Wed Apr 6 19:23:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5FC55296D + for ; + Wed, 6 Apr 2005 19:23:26 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47508-08 + for ; + Wed, 6 Apr 2005 18:23:18 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BEF053364 + for ; + Wed, 6 Apr 2005 19:23:17 +0100 (BST) +Received: from dyn-70-66.tor.dsl.tht.net (dyn-70-66.tor.dsl.tht.net + [134.22.70.66]) by tht.net (Postfix) with ESMTP + id 6A97C76A29; Wed, 6 Apr 2005 14:23:21 -0400 (EDT) +Subject: Re: =?ISO-8859-1?Q?R=E9f?= +From: Rod Taylor +To: "Steinar H. Gunderson" +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20050406174254.GC13641@uio.no> +References: + + <1112807909.92363.120.camel@home> <20050406174254.GC13641@uio.no> +Content-Type: text/plain +Date: Wed, 06 Apr 2005 14:23:10 -0400 +Message-Id: <1112811790.92363.123.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/115 +X-Sequence-Number: 11512 + +On Wed, 2005-04-06 at 19:42 +0200, Steinar H. Gunderson wrote: +> On Wed, Apr 06, 2005 at 01:18:29PM -0400, Rod Taylor wrote: +> > Yeah, I think that can be done provided there is more than one worker. +> > My limit seems to be about 1000 transactions per second each with a +> > single insert for a single process (round trip time down the Fibre +> > Channel is large) but running 4 simultaneously only drops throughput to +> > about 900 per process (total of 2400 transactions per second) and the +> > machine still seemed to have lots of oomph to spare. +> +> Erm, have I missed something here? 900 * 4 = 2400? + +Nope. You've not missed anything. + +If I ran 10 processes and the requirement would be met. +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 19:36:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C84E534BC + for ; + Wed, 6 Apr 2005 19:35:59 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52558-06 + for ; + Wed, 6 Apr 2005 18:35:54 +0000 (GMT) +Received: from priv-edtnes27.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id 1CF5153498 + for ; + Wed, 6 Apr 2005 19:35:53 +0100 (BST) +Received: from localhost ([199.185.220.240]) by priv-edtnes27.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050406183553.LSIR6807.priv-edtnes27.telusplanet.net@localhost>; + Wed, 6 Apr 2005 12:35:53 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@204.209.205.53 by webmail.telus.net with HTTP; + Wed, 6 Apr 2005 11:35:53 -0700 +Message-ID: <1112812553.42542c091d8ce@webmail.telus.net> +Date: Wed, 6 Apr 2005 11:35:53 -0700 +From: Mischa +To: Arjen van der Meijden +Cc: performance pgsql +Subject: Re: Plan for relatively simple query seems to be very inefficient +References: <425413D3.5030304@vulcanus.its.tudelft.nl> +In-Reply-To: <425413D3.5030304@vulcanus.its.tudelft.nl> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/116 +X-Sequence-Number: 11513 + +Quoting Arjen van der Meijden : + +> Hi list, +> +> I noticed on a forum a query taking a surprisingly large amount of time +> in MySQL. Of course I wanted to prove PostgreSQL 8.0.1 could do it much +> better. To my surprise PostgreSQL was ten times worse on the same +> machine! And I don't understand why. +> +> I don't really need this query to be fast since I don't use it, but the +> range-thing is not really an uncommon query I suppose. So I'm wondering +> why it is so slow and this may point to a wrong plan being chosen or +> generated. +> +> Here are table definitions: +> +> Table "public.postcodes" +> Column | Type | Modifiers +> -------------+---------------+----------- +> postcode_id | smallint | not null +> range_from | smallint | +> range_till | smallint | +> Indexes: +> "postcodes_pkey" PRIMARY KEY, btree (postcode_id) +> "range" UNIQUE, btree (range_from, range_till) +> +> Table "public.data_main" +> Column | Type | Modifiers +> --------+----------+----------- +> userid | integer | not null +> range | smallint | +> Indexes: +> "data_main_pkey" PRIMARY KEY, btree (userid) +> +> And here's the query I ran: +> +> SELECT COUNT(*) FROM +> data_main AS dm, +> postcodes AS p +> WHERE dm.range BETWEEN p.range_from AND p.range_till + +I just posted an answer to this (via webcafe webmail; can't recall which +pg-list), that might interest you. + +BTree indexes as they stand (multi-column, ...) answer what most people need for +queries. Unfortunately, out-of-the-box, they have no good way of handling range +queries. To compensate, you can use a small amount of kinky SQL. This is in the +same line as the tricks used to implement hierarchic queries in relational SQL. + +[1] Create a table "widths"(wid int) of powers of 2, up to what will just cover +max(range_till-range_from). Since your "range" column is a smallint, this table +can have no more than 15 rows. You can get as fussy as you want about keeping +this table to a minimum. + +[2] Change postcodes: + ALTER TABLE postcodes + ADD wid INT USING 2 ^ CEIL(LOG(range_from - range_till,2)); + ALTER TABLE postcodes + ADD start INT USING range_from - (range_from % wid); + CREATE INDEX postcodes_wid_start_index ON (wid, start); + ANALYZE postcodes; + +[4] Write your query as: + SELECT COUNT(*) + FROM data_main AS dm + CROSS JOIN widths -- yes, CROSS JOIN. For once, it HELPS performance. + JOIN postcodes AS p + ON dm.wid = widths.wid AND dm.start = p.range - p.range % widths.wid + WHERE dm.range BETWEEN p.range_from AND p.range_till + +This uses BTREE exact-match to make a tight restriction on which rows to check. +YMMV, but this has worked even for multi-M table joins. + +-- +"Dreams come true, not free." + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 19:40:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E25C5534C8 + for ; + Wed, 6 Apr 2005 19:40:37 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55084-06 + for ; + Wed, 6 Apr 2005 18:40:30 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id 7289B534BD + for ; + Wed, 6 Apr 2005 19:40:29 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so342408wri + for ; + Wed, 06 Apr 2005 11:40:31 -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:references; + b=ccImMf1CrnnTqy60sbQkswe11ak9uxpYcxUdzBdmLzy4NvoX5EVArggsiLlrkwhjb/cDHKug+x8Ji92XqSnlNJ2n2Y0oAuSU6sLrmVAENgLAObkuZRLq3J4bw401RLUH31VFYhLmGtqarQ+S1d8oMRQp5yFobdoQ23ffaYHfO2Y= +Received: by 10.54.32.67 with SMTP id f67mr250477wrf; + Wed, 06 Apr 2005 11:40:30 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 11:40:29 -0700 (PDT) +Message-ID: <33c6269f0504061140363ac662@mail.gmail.com> +Date: Wed, 6 Apr 2005 14:40:29 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Rod Taylor +Subject: =?ISO-8859-1?Q?Re:__R=E9f?= +Cc: "Steinar H. Gunderson" , + pgsql-performance@postgresql.org +In-Reply-To: <1112811790.92363.123.camel@home> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: + + <1112807909.92363.120.camel@home> <20050406174254.GC13641@uio.no> + <1112811790.92363.123.camel@home> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.254 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/117 +X-Sequence-Number: 11514 + +I think his point was that 9 * 4 != 2400 + +Alex Turner +netEconomist + +On Apr 6, 2005 2:23 PM, Rod Taylor wrote: +> On Wed, 2005-04-06 at 19:42 +0200, Steinar H. Gunderson wrote: +> > On Wed, Apr 06, 2005 at 01:18:29PM -0400, Rod Taylor wrote: +> > > Yeah, I think that can be done provided there is more than one worker. +> > > My limit seems to be about 1000 transactions per second each with a +> > > single insert for a single process (round trip time down the Fibre +> > > Channel is large) but running 4 simultaneously only drops throughput to +> > > about 900 per process (total of 2400 transactions per second) and the +> > > machine still seemed to have lots of oomph to spare. +> > +> > Erm, have I missed something here? 900 * 4 = 2400? +> +> Nope. You've not missed anything. +> +> If I ran 10 processes and the requirement would be met. +> -- +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster +> + +From pgsql-performance-owner@postgresql.org Wed Apr 6 19:46:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DEF02534BC + for ; + Wed, 6 Apr 2005 19:46:40 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56864-03 + for ; + Wed, 6 Apr 2005 18:46:39 +0000 (GMT) +Received: from priv-edtnes27.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id B2064534C7 + for ; + Wed, 6 Apr 2005 19:46:38 +0100 (BST) +Received: from localhost ([199.185.220.240]) by priv-edtnes27.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050406184639.MCDL6807.priv-edtnes27.telusplanet.net@localhost> + for ; + Wed, 6 Apr 2005 12:46:39 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@204.209.205.53 by webmail.telus.net with HTTP; + Wed, 6 Apr 2005 11:46:39 -0700 +Message-ID: <1112813199.42542e8f17b4d@webmail.telus.net> +Date: Wed, 6 Apr 2005 11:46:39 -0700 +From: Mischa +To: pgsql-performance@postgresql.org +Subject: COPY Hacks (WAS: RE: Postgresql vs SQLserver for this application ?) +References: + + <33c6269f05040608377dfc9272@mail.gmail.com> +In-Reply-To: <33c6269f05040608377dfc9272@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/118 +X-Sequence-Number: 11515 + +This thread seems to be focusing in on COPY efficiency, +I'd like to ask something I got no answer to, a few months ago. + +Using COPY ... FROM STDIN via the Perl DBI (DBD::Pg) interface, +I accidentally strung together several \n-terminated input lines, +and sent them to the server with a single "putline". + +To my (happy) surprise, I ended up with exactly that number of rows +in the target table. + +Is this a bug? Is this fundamental to the protocol? + +Since it hasn't been documented (but then, "endcopy" isn't documented), +I've been shy of investing in perf testing such mass copy calls. +But, if it DOES work, it should be reducing the number of network +roundtrips. + +So. Is it a feechur? Worth stress-testing? Could be VERY cool. + +-- +"Dreams come true, not free." + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 20:02:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 53E20534AD + for ; + Wed, 6 Apr 2005 20:02:07 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61961-04 + for ; + Wed, 6 Apr 2005 19:02:01 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 55550534DF + for ; + Wed, 6 Apr 2005 20:01:59 +0100 (BST) +Received: from dyn-70-66.tor.dsl.tht.net (dyn-70-66.tor.dsl.tht.net + [134.22.70.66]) by tht.net (Postfix) with ESMTP + id 294FA76A2A; Wed, 6 Apr 2005 15:02:04 -0400 (EDT) +Subject: Re: =?ISO-8859-1?Q?R=E9f?= +From: Rod Taylor +To: Alex Turner +Cc: "Steinar H. Gunderson" , + pgsql-performance@postgresql.org +In-Reply-To: <33c6269f0504061140363ac662@mail.gmail.com> +References: + + <1112807909.92363.120.camel@home> <20050406174254.GC13641@uio.no> + <1112811790.92363.123.camel@home> + <33c6269f0504061140363ac662@mail.gmail.com> +Content-Type: text/plain +Date: Wed, 06 Apr 2005 15:01:52 -0400 +Message-Id: <1112814112.92363.130.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/119 +X-Sequence-Number: 11516 + +On Wed, 2005-04-06 at 14:40 -0400, Alex Turner wrote: +> I think his point was that 9 * 4 != 2400 + +Oh.. heh.. I didn't even notice that. + +Can I pretend I did it in my head using HEX math and that it wasn't a +mistake? + +> On Apr 6, 2005 2:23 PM, Rod Taylor wrote: +> > On Wed, 2005-04-06 at 19:42 +0200, Steinar H. Gunderson wrote: +> > > On Wed, Apr 06, 2005 at 01:18:29PM -0400, Rod Taylor wrote: +> > > > Yeah, I think that can be done provided there is more than one worker. +> > > > My limit seems to be about 1000 transactions per second each with a +> > > > single insert for a single process (round trip time down the Fibre +> > > > Channel is large) but running 4 simultaneously only drops throughput to +> > > > about 900 per process (total of 2400 transactions per second) and the +> > > > machine still seemed to have lots of oomph to spare. +> > > +> > > Erm, have I missed something here? 900 * 4 = 2400? +> > +> > Nope. You've not missed anything. +> > +> > If I ran 10 processes and the requirement would be met. +> > -- +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 4: Don't 'kill -9' the postmaster +> > +> +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 6 20:54:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6686E53538 + for ; + Wed, 6 Apr 2005 20:54:12 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77431-02 + for ; + Wed, 6 Apr 2005 19:54:09 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BFF7C53502 + for ; + Wed, 6 Apr 2005 20:54:08 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36Js9f1003642; + Wed, 6 Apr 2005 15:54:09 -0400 (EDT) +To: Arjen van der Meijden +Cc: pgsql-performance@postgreSQL.org +Subject: Re: Plan for relatively simple query seems to be very inefficient +In-reply-to: <42542ADE.8010004@vulcanus.its.tudelft.nl> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A0@asg002.asg.local> + <28760.1112810943@sss.pgh.pa.us> + <42542ADE.8010004@vulcanus.its.tudelft.nl> +Comments: In-reply-to Arjen van der Meijden + + message dated "Wed, 06 Apr 2005 20:30:54 +0200" +Date: Wed, 06 Apr 2005 15:54:09 -0400 +Message-ID: <3641.1112817249@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/120 +X-Sequence-Number: 11517 + +Arjen van der Meijden writes: +> On 6-4-2005 20:09, Tom Lane wrote: +>> Comparing the nestloop case to the hash case does make one think that +>> there's an awful lot of overhead somewhere, though. Two int2 +>> comparisons ought not take very long :-(. Arjen, are you interested +>> in getting a gprof profile of what the backend is doing in the nestloop +>> -with-materialize plan? Or if you don't want to mess with it, please +>> send me the data off-list and I'll run a profile. + +> Here you go, both are full pg_dump-dumps with create-data (including the +> index on data_main.range). + +Well, indeed int2ge and int2le are pretty far down the list, but the +stuff that's near the top has already been beat on pretty heavily :-(. +I'm not sure there is a lot we can do about this short of a wholesale +redesign of the way we do expression evaluation. + +Flat profile: + +Each sample counts as 0.01 seconds. + % cumulative self self total + time seconds seconds calls ms/call ms/call name + 36.14 21.30 21.30 _mcount + 7.62 25.79 4.49 13412606 0.00 0.00 ExecMakeFunctionResultNoSets + 5.46 29.01 3.22 26825216 0.00 0.00 slot_getattr + 4.19 31.48 2.47 26825216 0.00 0.00 ExecEvalVar + 3.87 33.76 2.28 13189120 0.00 0.00 ExecMaterial + 3.38 35.75 1.99 13494688 0.00 0.00 slot_deform_tuple + 3.38 37.74 1.99 noshlibs + 3.12 39.58 1.84 13353893 0.00 0.00 ExecProcNode + 2.99 41.34 1.76 13107201 0.00 0.00 ExecQual + 2.90 43.05 1.71 13271974 0.00 0.00 AllocSetReset + 2.72 44.65 1.60 ExecEvalVar + 2.43 46.08 1.43 $$dyncall + 2.24 47.40 1.32 13271972 0.00 0.00 MemoryContextReset + 2.24 48.72 1.32 13188960 0.00 0.00 tuplestore_gettuple + 2.12 49.97 1.25 13189441 0.00 0.00 ExecStoreTuple + 1.80 51.03 1.06 82689 0.01 0.06 ExecNestLoop + 1.70 52.03 1.00 13354235 0.00 0.00 ExecClearTuple + 1.63 52.99 0.96 13412761 0.00 0.00 check_stack_depth + 1.58 53.92 0.93 AllocSetReset + 1.29 54.68 0.76 int2ge + 1.20 55.39 0.71 ExecMakeFunctionResultNoSets + 1.14 56.06 0.67 13107200 0.00 0.00 int2ge + 1.05 56.68 0.62 ExecEvalCoerceToDomain + 1.04 57.29 0.61 13189120 0.00 0.00 tuplestore_ateof + 0.64 57.67 0.38 13271972 0.00 0.00 MemoryContextResetChildren + 0.41 57.91 0.24 readtup_heap + 0.36 58.12 0.21 log_disconnections + 0.24 58.26 0.14 BlessTupleDesc + 0.19 58.37 0.11 ExecCountSlotsMaterial + 0.14 58.45 0.08 MemoryContextAllocZeroAligned + 0.12 58.52 0.07 ExecProcNode + 0.10 58.58 0.06 int42div + 0.08 58.63 0.05 AllocSetStats + 0.05 58.66 0.03 166022 0.00 0.00 LockBuffer + 0.05 58.69 0.03 82688 0.00 0.00 advance_transition_function + 0.05 58.72 0.03 82080 0.00 0.00 HeapTupleSatisfiesSnapshot + 0.05 58.75 0.03 ExecInitNestLoop + 0.03 58.77 0.02 SeqNext + 0.02 58.78 0.01 305408 0.00 0.00 int2le + 0.02 58.79 0.01 84231 0.00 0.00 LWLockAcquire + 0.02 58.80 0.01 82849 0.00 0.00 ExecProject + 0.02 58.81 0.01 82848 0.00 0.00 ExecVariableList + 0.02 58.82 0.01 82844 0.00 0.00 ResourceOwnerEnlargeBuffers + 0.02 58.83 0.01 82844 0.00 0.00 ResourceOwnerRememberBuffer + 0.02 58.84 0.01 82813 0.00 0.00 ReleaseAndReadBuffer + 0.02 58.85 0.01 82688 0.00 0.00 ExecEvalConst + 0.02 58.86 0.01 82688 0.00 0.00 ExecEvalExprSwitchContext + 0.02 58.87 0.01 82688 0.00 0.00 advance_aggregates + 0.02 58.88 0.01 82084 0.00 0.00 heapgettup + 0.02 58.89 0.01 81920 0.00 0.00 ExecMaterialReScan + 0.02 58.90 0.01 81920 0.00 0.00 ExecReScan + 0.02 58.91 0.01 19 0.53 0.53 downcase_truncate_identifier + 0.02 58.92 0.01 10 1.00 1.00 AllocateFile + 0.02 58.93 0.01 1 10.00 70.59 agg_retrieve_direct +[ nothing else shows as having any sample hits ] + +_mcount is profiler overhead, in case you were wondering; ignore it and +mentally scale all the other percentages up by 20% or so. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 6 21:01:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EBEE5294A + for ; + Wed, 6 Apr 2005 21:01:51 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79474-02 + for ; + Wed, 6 Apr 2005 20:01:41 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id AF79952A45 + for ; + Wed, 6 Apr 2005 21:01:40 +0100 (BST) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id CD50F30953; Wed, 6 Apr 2005 22:01:19 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: How to improve db performance with $7K? +Date: Wed, 06 Apr 2005 13:01:35 -0700 +Organization: Hub.Org Networking Services +Lines: 68 +Message-ID: +References: <42443863.4040302@sfnet.cc> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: <33c6269f050406083533d2045d@mail.gmail.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/121 +X-Sequence-Number: 11518 + +It's the same money if you factor in the 3ware controller. Even without +a caching controller, SCSI works good in multi-threaded IO (not +withstanding crappy shit from Dell or Compaq). You can get such cards +from LSI for $75. And of course, many server MBs come with LSI +controllers built-in. Our older 32-bit production servers all use Linux +software RAID w/ SCSI and there's no issues when multiple +users/processes hit the DB. + +*Maybe* a 3ware controller w/ onboard cache + battery backup might do +much better for multi-threaded IO than just plain-jane SATA. +Unfortunately, I have not been able to find anything online that can +confirm or deny this. Hence, the choice is spend $$$ on the 3ware +controller and hope it meets your needs -- or spend $$$ on SCSI drives +and be sure. + +Now if you want to run such tests, we'd all be delighted with to see the +results so we have another option for building servers. + + +Alex Turner wrote: +> It's hardly the same money, the drives are twice as much. +> +> It's all about the controller baby with any kind of dive. A bad SCSI +> controller will give sucky performance too, believe me. We had a +> Compaq Smart Array 5304, and it's performance was _very_ sub par. +> +> If someone has a simple benchmark test database to run, I would be +> happy to run it on our hardware here. +> +> Alex Turner +> +> On Apr 6, 2005 3:30 AM, William Yu wrote: +> +>>Alex Turner wrote: +>> +>>>I'm no drive expert, but it seems to me that our write performance is +>>>excellent. I think what most are concerned about is OLTP where you +>>>are doing heavy write _and_ heavy read performance at the same time. +>>> +>>>Our system is mostly read during the day, but we do a full system +>>>update everynight that is all writes, and it's very fast compared to +>>>the smaller SCSI system we moved off of. Nearly a 6x spead +>>>improvement, as fast as 900 rows/sec with a 48 byte record, one row +>>>per transaction. +>> +>>I've started with SATA in a multi-read/multi-write environment. While it +>>ran pretty good with 1 thread writing, the addition of a 2nd thread +>>(whether reading or writing) would cause exponential slowdowns. +>> +>>I suffered through this for a week and then switched to SCSI. Single +>>threaded performance was pretty similar but with the advanced command +>>queueing SCSI has, I was able to do multiple reads/writes simultaneously +>>with only a small performance hit for each thread. +>> +>>Perhaps having a SATA caching raid controller might help this situation. +>>I don't know. It's pretty hard justifying buying a $$$ 3ware controller +>>just to test it when you could spend the same money on SCSI and have a +>>guarantee it'll work good under multi-IO scenarios. +>> +>>---------------------------(end of broadcast)--------------------------- +>>TIP 8: explain analyze is your friend +>> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + +From pgsql-performance-owner@postgresql.org Wed Apr 6 21:08:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DFFF5352E + for ; + Wed, 6 Apr 2005 21:08:34 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82505-02 + for ; + Wed, 6 Apr 2005 20:08:31 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 388DD5351E + for ; + Wed, 6 Apr 2005 21:08:30 +0100 (BST) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: COPY Hacks (WAS: RE: Postgresql vs SQLserver for this application + ?) +Date: Wed, 6 Apr 2005 15:06:39 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A1@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: COPY Hacks (WAS: RE: [PERFORM] Postgresql vs SQLserver for this + application ?) +Thread-Index: AcU62ZDlFTpqtL/oRiSvE5/92ImgWAACZBag +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.075 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/122 +X-Sequence-Number: 11519 + +> -----Original Message----- +> From: Mischa [mailto:mischa.Sandberg@telus.net] +> Sent: Wednesday, April 06, 2005 1:47 PM +> To: pgsql-performance@postgresql.org +> Subject: COPY Hacks (WAS: RE: [PERFORM] Postgresql vs=20 +> SQLserver for this +> application ?) +>=20 +> [...] +> Using COPY ... FROM STDIN via the Perl DBI (DBD::Pg) interface, +> I accidentally strung together several \n-terminated input lines, +> and sent them to the server with a single "putline". +>=20 +> To my (happy) surprise, I ended up with exactly that number of +> rows in the target table. +>=20 +> Is this a bug? Is this fundamental to the protocol? + +Just guessing without looking at the code, I assume that the +server doesn't care if you send your data in lines, words, or +massive blocks. It simply looks for the newline terminator to +determine end-of-block. The reason putline works nicely is +probably that it terminates your rows with a newline character. +But as you noticed, you can do that yourself. I would say that +it's intrinsic to the way I/O is typically done. It may very +well be that the function that implements COPY never sees when +exactly you make a function call from Perl, but only sees a +buffer getting filled up with data that it needs to parse. From +that perspective, it's easy to see why you simply need to=20 +properly terminate your rows to get the expected behavior. +Consider COPYing from a file...odds are it doesn't read data +from the file exactly 1 row at a time, but rather some block- +size multiple at a time. The only way COPY could work correctly +is if it ignored the size of data sent to it and only parsed on +\n boundaries. + +> Since it hasn't been documented (but then, "endcopy" isn't=20 +> documented), I've been shy of investing in perf testing such +> mass copy calls. But, if it DOES work, it should be reducing +> the number of network roundtrips. +> [...] + +Feel free to use your technique. I would be *extremely*=20 +surprised if there were a reason it shouldn't work. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Wed Apr 6 21:28:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6597553A90 + for ; + Wed, 6 Apr 2005 21:28:19 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89972-05 + for ; + Wed, 6 Apr 2005 20:28:07 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C1A7B53AF9 + for ; + Wed, 6 Apr 2005 21:27:11 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36KRDYV005832; + Wed, 6 Apr 2005 16:27:13 -0400 (EDT) +To: Mischa +Cc: pgsql-performance@postgresql.org +Subject: Re: COPY Hacks (WAS: RE: Postgresql vs SQLserver for this application + ?) +In-reply-to: <1112813199.42542e8f17b4d@webmail.telus.net> +References: + + <33c6269f05040608377dfc9272@mail.gmail.com> + <1112813199.42542e8f17b4d@webmail.telus.net> +Comments: In-reply-to Mischa + message dated "Wed, 06 Apr 2005 11:46:39 -0700" +Date: Wed, 06 Apr 2005 16:27:13 -0400 +Message-ID: <5831.1112819233@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/123 +X-Sequence-Number: 11520 + +Mischa writes: +> Using COPY ... FROM STDIN via the Perl DBI (DBD::Pg) interface, +> I accidentally strung together several \n-terminated input lines, +> and sent them to the server with a single "putline". + +> To my (happy) surprise, I ended up with exactly that number of rows +> in the target table. + +> Is this a bug? + +No, it's the way it's supposed to work. "putline" really just sends a +stream of data ... there's no semantic significance to the number of +putline calls you use to send the stream, only to the contents of the +stream. (By the same token, it's unlikely that deliberately aggregating +such calls would be much of a win.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 6 21:51:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A2AD05396C + for ; + Wed, 6 Apr 2005 21:51:32 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00797-08 + for ; + Wed, 6 Apr 2005 20:51:29 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E3E2B538E5 + for ; + Wed, 6 Apr 2005 21:51:28 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36KpUWB006000; + Wed, 6 Apr 2005 16:51:30 -0400 (EDT) +To: Arjen van der Meijden +Cc: performance pgsql +Subject: Re: Plan for relatively simple query seems to be very inefficient +In-reply-to: <425423A9.9000504@vulcanus.its.tudelft.nl> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> +Comments: In-reply-to Arjen van der Meijden + + message dated "Wed, 06 Apr 2005 20:00:09 +0200" +Date: Wed, 06 Apr 2005 16:51:30 -0400 +Message-ID: <5999.1112820690@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/124 +X-Sequence-Number: 11521 + +Arjen van der Meijden writes: +> On 6-4-2005 19:42, Tom Lane wrote: +>> Wrong index ... what you probably could use here is an index on +>> data_main.range, so that the query could run with postcodes as the +>> outer side. I get such a plan by default with empty tables: +>> but I'm not sure if the planner would prefer it with the tables loaded +>> up. (It might not be the right thing anyway ... but seems worth +>> trying.) + +> No it didn't prefer it. + +Planner error ... because it doesn't have any good way to estimate the +number of matching rows, it thinks that way is a bit more expensive than +data_main as the outside, but in reality it seems a good deal cheaper: + + +arjen=# set enable_seqscan TO 1; +SET +arjen=# explain analyze +arjen-# SELECT COUNT(*) FROM data_main AS dm, postcodes AS p WHERE dm.range BETWEEN p.range_from AND p.range_till; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=332586.85..332586.85 rows=1 width=0) (actual time=143999.678..143999.683 rows=1 loops=1) + -> Nested Loop (cost=3.76..328945.96 rows=1456356 width=0) (actual time=0.211..143549.461 rows=82688 loops=1) + Join Filter: (("outer".range >= "inner".range_from) AND ("outer".range <= "inner".range_till)) + -> Seq Scan on data_main dm (cost=0.00..1262.20 rows=81920 width=2) (actual time=0.059..663.065 rows=81920 loops=1) + -> Materialize (cost=3.76..5.36 rows=160 width=4) (actual time=0.004..0.695 rows=160 loops=81920) + -> Seq Scan on postcodes p (cost=0.00..3.60 rows=160 width=4) (actual time=0.028..1.589 rows=160 loops=1) + Total runtime: 144000.415 ms +(7 rows) + +arjen=# set enable_seqscan TO 0; +SET +arjen=# explain analyze +arjen-# SELECT COUNT(*) FROM data_main AS dm, postcodes AS p WHERE dm.range BETWEEN p.range_from AND p.range_till; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=100336307.18..100336307.18 rows=1 width=0) (actual time=2367.097..2367.102 rows=1 loops=1) + -> Nested Loop (cost=100000000.00..100332666.28 rows=1456356 width=0) (actual time=0.279..1918.890 rows=82688 loops=1) + -> Seq Scan on postcodes p (cost=100000000.00..100000003.60 rows=160 width=4) (actual time=0.060..1.381 rows=160 loops=1) + -> Index Scan using dm_range on data_main dm (cost=0.00..1942.60 rows=9103 width=2) (actual time=0.034..7.511 rows=517 loops=160) + Index Cond: ((dm.range >= "outer".range_from) AND (dm.range <= "outer".range_till)) + Total runtime: 2368.056 ms +(6 rows) + +(this machine is slower than yours, plus I have profiling enabled still...) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:47:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BBD4152A39 + for ; + Wed, 6 Apr 2005 22:05:19 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05267-05 + for ; + Wed, 6 Apr 2005 21:05:11 +0000 (GMT) +Received: from server01.mrt-system.pl (server01.mrt-system.pl [80.53.234.114]) + by svr1.postgresql.org (Postfix) with ESMTP id 612A85295D + for ; + Wed, 6 Apr 2005 22:05:09 +0100 (BST) +Received: from localhost (localhost [127.0.0.1]) + by server01.mrt-system.pl (Mail Server) with ESMTP id 855F03F73D + for ; + Wed, 6 Apr 2005 23:05:07 +0200 (CEST) +Received: from [213.134.169.237] (anpa003.net.autocom.pl [213.134.169.237]) + by server01.mrt-system.pl (Mail Server) with ESMTP id 2775C3F70F + for ; + Wed, 6 Apr 2005 23:05:06 +0200 (CEST) +Message-ID: <42544F01.7090208@mrt-system.pl> +Date: Wed, 06 Apr 2005 23:05:05 +0200 +From: =?UTF-8?B?SmFyb3PFgmF3IFBhxYJrYQ==?= +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Never ending delete story +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by AMaViS at server01.mrt-system.pl +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/199 +X-Sequence-Number: 11596 + +Hi!!! + +We are running PostgreSQL server version 7.4.6 on RedHat 9 (Shrike) on +single Pentium 4 (2.66 GHz) box with SCSI disc and 512 MB RAM. +Our database contains several tables (small size) and one special table +with ~1000000 records (it contains log entries from system activity).We +decided that its time to do a little clean-up and it's still running +(for about 12 hours) and it seems that it won't stop :(( + +Here schema of largest table: + Table "public.activities" + Column | Type | Modifiers +-------------------+-----------------------------+----------- + act_id | bigint | not null + act_type | character varying(32) | not null + act_activity_date | timestamp without time zone | not null + act_synch_date | timestamp without time zone | + act_state | character varying(32) | + act_mcn_id | bigint | + act_mcn_alarm | character varying(16) | + act_cmd_id | bigint | + act_ctr_id | bigint | + act_emp_id | bigint | + act_parent_id | bigint | + act_rpt_id | bigint | +Indexes: + "activities_pkey" primary key, btree (act_id) + "activities_act_cmd_id" btree (act_cmd_id) + "activities_act_ctr_id" btree (act_ctr_id) + "activities_act_state_idx" btree (act_state) + "activities_act_type_idx" btree (act_type) +Foreign-key constraints: + "fk7a1b3bed494acc46" FOREIGN KEY (act_ctr_id) REFERENCES +controllers(ctr_id) + "fk7a1b3bed4c50f03f" FOREIGN KEY (act_emp_id) REFERENCES +employees(emp_id) + "fk7a1b3bed48e1ca8d" FOREIGN KEY (act_cmd_id) REFERENCES +commands(cmd_id) + "fk7a1b3bed5969e16f" FOREIGN KEY (act_mcn_id) REFERENCES +machines(mcn_id) + "fk7a1b3bedf3fd6e40" FOREIGN KEY (act_parent_id) REFERENCES +activities(act_id) + "fk7a1b3bed62ac0851" FOREIGN KEY (act_rpt_id) REFERENCES + +and our killer delete: + +mrt-vend2-jpalka=# explain delete from activities where +act_type='controller-activity' and act_ctr_id in (select ctr_id from +controllers where ctr_opr_id in (1,2)); + QUERY PLAN + +-------------------------------------------------------------------------------------------------------- + Merge IN Join (cost=9.87..17834.97 rows=84933 width=6) + Merge Cond: ("outer".act_ctr_id = "inner".ctr_id) + -> Index Scan using activities_act_ctr_id on activities +(cost=0.00..34087.59 rows=402627 width=14) + Filter: ((act_type)::text = 'controller-activity'::text) + -> Sort (cost=9.87..10.09 rows=89 width=8) + Sort Key: controllers.ctr_id + -> Seq Scan on controllers (cost=0.00..6.99 rows=89 width=8) + Filter: ((ctr_opr_id = 1) OR (ctr_opr_id = 2)) +(8 rows) +reports(rpt_id) + +Table controllers contains about 200 records.Is it problem with large +number of foreign keys in activities table? + +Can you help me? + +Thanks, +Jaroslaw Palka + +From pgsql-performance-owner@postgresql.org Wed Apr 6 23:09:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A92A753A26; + Wed, 6 Apr 2005 23:09:41 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21227-10; Wed, 6 Apr 2005 22:09:38 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F3E353A25; + Wed, 6 Apr 2005 23:09:37 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36M9bgo006327; + Wed, 6 Apr 2005 18:09:37 -0400 (EDT) +To: Arjen van der Meijden +Cc: pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +Subject: Recognizing range constraints (was Re: Plan for relatively simple + query seems to be very inefficient) +In-reply-to: <5999.1112820690@sss.pgh.pa.us> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> +Comments: In-reply-to Tom Lane + message dated "Wed, 06 Apr 2005 16:51:30 -0400" +Date: Wed, 06 Apr 2005 18:09:37 -0400 +Message-ID: <6326.1112825377@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/125 +X-Sequence-Number: 11522 + +I wrote: +> Arjen van der Meijden writes: +>> SELECT COUNT(*) FROM +>> data_main AS dm, +>> postcodes AS p +>> WHERE dm.range BETWEEN p.range_from AND p.range_till + +> Planner error ... because it doesn't have any good way to estimate the +> number of matching rows, it thinks that way is a bit more expensive than +> data_main as the outside, but in reality it seems a good deal cheaper: + +BTW, it would get the right answer if it had recognized the WHERE clause +as a range restriction --- it still doesn't know exactly what fraction +of rows will match, but its default estimate is a great deal tighter for +"WHERE x > something AND x < somethingelse" than it is for two unrelated +inequality constraints. Enough tighter that it would have gone for the +correct plan. + +The problem is that it doesn't recognize the WHERE as a range constraint +on dm.range. I thought for a moment that this might be a +recently-introduced bug, but actually the code is operating as designed: +clauselist_selectivity says + + * See if it looks like a restriction clause with a pseudoconstant + * on one side. (Anything more complicated than that might not + * behave in the simple way we are expecting.) + +"Pseudoconstant" in this context means "a constant, parameter symbol, or +non-volatile functions of these" ... so comparisons against values from +another table don't qualify. It seems like we're missing a bet though. + +Can anyone suggest a more general rule? Do we need for example to +consider whether the relation membership is the same in two clauses +that might be opposite sides of a range restriction? It seems like + + a.x > b.y AND a.x < b.z + +probably can be treated as a range restriction on a.x for this purpose, +but I'm much less sure that the same is true of + + a.x > b.y AND a.x < c.z + +Thoughts? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 6 23:12:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DA20C53A2A + for ; + Wed, 6 Apr 2005 23:12:14 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22760-03 + for ; + Wed, 6 Apr 2005 22:12:09 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id E2ECA534BD + for ; + Wed, 6 Apr 2005 23:12:07 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so408204wri + for ; + Wed, 06 Apr 2005 15:12: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:references; + b=T3eXuJpLXA5oStgVzq92EmAqPj1EgVcD2p0Wz6sO9/P9xvPXVfauVcmRKLEoL+QSv0F1EBkIQkSInBjDPm+mrpuDVbGSgnrifGLJvD8Dz2W80Ob6GGniX9LlXB/OgX1XQ1KHL9karNzcdfNTBTB/Q9FPgOQJWw+Sk/ocud9sJuA= +Received: by 10.54.52.10 with SMTP id z10mr65025wrz; + Wed, 06 Apr 2005 15:12:07 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 15:12:06 -0700 (PDT) +Message-ID: <33c6269f050406151241b01148@mail.gmail.com> +Date: Wed, 6 Apr 2005 18:12:06 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: William Yu +Subject: Re: How to improve db performance with $7K? +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <42443863.4040302@sfnet.cc> <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.255 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/126 +X-Sequence-Number: 11523 + +Well - unfortuantely software RAID isn't appropriate for everyone, and +some of us need a hardware RAID controller. The LSI Megaraid 320-2 +card is almost exactly the same price as the 3ware 9500S-12 card +(although I will conceed that a 320-2 card can handle at most 2x14 +devices compare with the 12 on the 9500S). + +If someone can come up with a test, I will be happy to run it and see +how it goes. I would be _very_ interested in the results having just +spent $7k on a new DB server!! + +I have also seen really bad performance out of SATA. It was with +either an on-board controller, or a cheap RAID controller from +HighPoint. As soon as I put in a decent controller, things went much +better. I think it's unfair to base your opinion of SATA from a test +that had a poor controler. + +I know I'm not the only one here running SATA RAID and being very +satisfied with the results. + +Thanks, + +Alex Turner +netEconomist + +On Apr 6, 2005 4:01 PM, William Yu wrote: +> It's the same money if you factor in the 3ware controller. Even without +> a caching controller, SCSI works good in multi-threaded IO (not +> withstanding crappy shit from Dell or Compaq). You can get such cards +> from LSI for $75. And of course, many server MBs come with LSI +> controllers built-in. Our older 32-bit production servers all use Linux +> software RAID w/ SCSI and there's no issues when multiple +> users/processes hit the DB. +> +> *Maybe* a 3ware controller w/ onboard cache + battery backup might do +> much better for multi-threaded IO than just plain-jane SATA. +> Unfortunately, I have not been able to find anything online that can +> confirm or deny this. Hence, the choice is spend $$$ on the 3ware +> controller and hope it meets your needs -- or spend $$$ on SCSI drives +> and be sure. +> +> Now if you want to run such tests, we'd all be delighted with to see the +> results so we have another option for building servers. +> +> +> Alex Turner wrote: +> > It's hardly the same money, the drives are twice as much. +> > +> > It's all about the controller baby with any kind of dive. A bad SCSI +> > controller will give sucky performance too, believe me. We had a +> > Compaq Smart Array 5304, and it's performance was _very_ sub par. +> > +> > If someone has a simple benchmark test database to run, I would be +> > happy to run it on our hardware here. +> > +> > Alex Turner +> > +> > On Apr 6, 2005 3:30 AM, William Yu wrote: +> > +> >>Alex Turner wrote: +> >> +> >>>I'm no drive expert, but it seems to me that our write performance is +> >>>excellent. I think what most are concerned about is OLTP where you +> >>>are doing heavy write _and_ heavy read performance at the same time. +> >>> +> >>>Our system is mostly read during the day, but we do a full system +> >>>update everynight that is all writes, and it's very fast compared to +> >>>the smaller SCSI system we moved off of. Nearly a 6x spead +> >>>improvement, as fast as 900 rows/sec with a 48 byte record, one row +> >>>per transaction. +> >> +> >>I've started with SATA in a multi-read/multi-write environment. While it +> >>ran pretty good with 1 thread writing, the addition of a 2nd thread +> >>(whether reading or writing) would cause exponential slowdowns. +> >> +> >>I suffered through this for a week and then switched to SCSI. Single +> >>threaded performance was pretty similar but with the advanced command +> >>queueing SCSI has, I was able to do multiple reads/writes simultaneously +> >>with only a small performance hit for each thread. +> >> +> >>Perhaps having a SATA caching raid controller might help this situation. +> >>I don't know. It's pretty hard justifying buying a $$$ 3ware controller +> >>just to test it when you could spend the same money on SCSI and have a +> >>guarantee it'll work good under multi-IO scenarios. +> >> +> >>---------------------------(end of broadcast)--------------------------- +> >>TIP 8: explain analyze is your friend +> >> +> > +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 2: you can get off all lists at once with the unregister command +> > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> > +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org +> + +From pgsql-performance-owner@postgresql.org Wed Apr 6 23:25:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3757753523; + Wed, 6 Apr 2005 23:25:38 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27487-02; Wed, 6 Apr 2005 22:25:34 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A3B5534BD; + Wed, 6 Apr 2005 23:25:34 +0100 (BST) +Received: by flake.decibel.org (Postfix, from userid 1001) + id DCA091547C; Wed, 6 Apr 2005 17:25:36 -0500 (CDT) +Date: Wed, 6 Apr 2005 17:25:36 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Arjen van der Meijden , + pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan for + relatively simple query seems to be very inefficient) +Message-ID: <20050406222536.GL93835@decibel.org> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <6326.1112825377@sss.pgh.pa.us> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/127 +X-Sequence-Number: 11524 + +On Wed, Apr 06, 2005 at 06:09:37PM -0400, Tom Lane wrote: +> Can anyone suggest a more general rule? Do we need for example to +> consider whether the relation membership is the same in two clauses +> that might be opposite sides of a range restriction? It seems like +> +> a.x > b.y AND a.x < b.z + +In a case like this, you could actually look at the data in b and see +what the average range size is. If you wanted to get really fancy, the +optimizer could decide how best to access a based on each row of b. + +> probably can be treated as a range restriction on a.x for this purpose, +> but I'm much less sure that the same is true of +> +> a.x > b.y AND a.x < c.z + +Well, this could end up being much trickier, since who knows how b and c +are related. Though thinking about it, although I threw out the +row-by-row analysis idea to be glib, that would actually work in this +case; you could take a look at what b and c look like each time 'through +the loop'. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 6 23:35:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 23BCF5349D + for ; + Wed, 6 Apr 2005 23:35:20 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30079-01 + for ; + Wed, 6 Apr 2005 22:35:11 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 667745296D + for ; + Wed, 6 Apr 2005 23:35:11 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36MZAwj006595; + Wed, 6 Apr 2005 18:35:10 -0400 (EDT) +To: "Jim C. Nasby" +Cc: Arjen van der Meijden , + pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan for + relatively simple query seems to be very inefficient) +In-reply-to: <20050406222536.GL93835@decibel.org> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050406222536.GL93835@decibel.org> +Comments: In-reply-to "Jim C. Nasby" + message dated "Wed, 06 Apr 2005 17:25:36 -0500" +Date: Wed, 06 Apr 2005 18:35:10 -0400 +Message-ID: <6594.1112826910@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/128 +X-Sequence-Number: 11525 + +"Jim C. Nasby" writes: +> On Wed, Apr 06, 2005 at 06:09:37PM -0400, Tom Lane wrote: +>> Can anyone suggest a more general rule? Do we need for example to +>> consider whether the relation membership is the same in two clauses +>> that might be opposite sides of a range restriction? It seems like +>> +>> a.x > b.y AND a.x < b.z + +> In a case like this, you could actually look at the data in b and see +> what the average range size is. + +Not with the current statistics --- you'd need some kind of cross-column +statistics involving both y and z. (That is, I doubt it would be +helpful to estimate the average range width by taking the difference of +independently-calculated mean values of y and z ...) But yeah, in +principle it would be possible to make a non-default estimate. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 6 23:41:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 79BA753A90 + for ; + Wed, 6 Apr 2005 23:41:11 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31072-06 + for ; + Wed, 6 Apr 2005 22:41:01 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E96353A8C + for ; + Wed, 6 Apr 2005 23:41:01 +0100 (BST) +Received: by flake.decibel.org (Postfix, from userid 1001) + id E77831547C; Wed, 6 Apr 2005 17:41:02 -0500 (CDT) +Date: Wed, 6 Apr 2005 17:41:02 -0500 +From: "Jim C. Nasby" +To: Alex Turner +Cc: William Yu , pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050406224102.GM93835@decibel.org> +References: <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <33c6269f050406151241b01148@mail.gmail.com> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/129 +X-Sequence-Number: 11526 + +Sorry if I'm pointing out the obvious here, but it seems worth +mentioning. AFAIK all 3ware controllers are setup so that each SATA +drive gets it's own SATA bus. My understanding is that by and large, +SATA still suffers from a general inability to have multiple outstanding +commands on the bus at once, unlike SCSI. Therefore, to get good +performance out of SATA you need to have a seperate bus for each drive. +Theoretically, it shouldn't really matter that it's SATA over ATA, other +than I certainly wouldn't want to try and cram 8 ATA cables into a +machine... + +Incidentally, when we were investigating storage options at a previous +job we talked to someone who deals with RS/6000 storage. He had a bunch +of info about their serial controller protocol (which I can't think of +the name of) vs SCSI. SCSI had a lot more overhead, so you could end up +saturating even a 160MB SCSI bus with only 2 or 3 drives. + +People are finally realizing how important bandwidth has become in +modern machines. Memory bandwidth is why RS/6000 was (and maybe still +is) cleaning Sun's clock, and it's why the Opteron blows Itaniums out of +the water. Likewise it's why SCSI is so much better than IDE (unless you +just give each drive it's own dedicated bandwidth). +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 6 23:56:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EDB5353A02; + Wed, 6 Apr 2005 23:55:58 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35524-01; Wed, 6 Apr 2005 22:55:56 +0000 (GMT) +Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu + [129.255.60.186]) + by svr1.postgresql.org (Postfix) with ESMTP id 14BBE53A35; + Wed, 6 Apr 2005 23:55:54 +0100 (BST) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) + by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j36MsE304919; + Wed, 6 Apr 2005 17:54:14 -0500 +Message-ID: <4254688F.6070009@arbash-meinel.com> +Date: Wed, 06 Apr 2005 17:54:07 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: "Jim C. Nasby" , + Arjen van der Meijden , + pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050406222536.GL93835@decibel.org> + <6594.1112826910@sss.pgh.pa.us> +In-Reply-To: <6594.1112826910@sss.pgh.pa.us> +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig2C897DDE71A01355669582D6" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/130 +X-Sequence-Number: 11527 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig2C897DDE71A01355669582D6 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Tom Lane wrote: +> "Jim C. Nasby" writes: +> +>>On Wed, Apr 06, 2005 at 06:09:37PM -0400, Tom Lane wrote: +>> +>>>Can anyone suggest a more general rule? Do we need for example to +>>>consider whether the relation membership is the same in two clauses +>>>that might be opposite sides of a range restriction? It seems like +>>> +>>>a.x > b.y AND a.x < b.z +> +> +>>In a case like this, you could actually look at the data in b and see +>>what the average range size is. +> +> +> Not with the current statistics --- you'd need some kind of cross-column +> statistics involving both y and z. (That is, I doubt it would be +> helpful to estimate the average range width by taking the difference of +> independently-calculated mean values of y and z ...) But yeah, in +> principle it would be possible to make a non-default estimate. +> +> regards, tom lane + +Actually, I think he was saying do a nested loop, and for each item in +the nested loop, re-evaluate if an index or a sequential scan is more +efficient. + +I don't think postgres re-plans once it has started, though you could +test this in a plpgsql function. + +John +=:-> + +--------------enig2C897DDE71A01355669582D6 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.6 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFCVGiPJdeBCYSNAAMRAnEvAKCa0SV2xU5eKMSwpAAERI3Q83A7CQCgt8ig +kK5I68eNMy/J1XE8iIz1qlw= +=jnsN +-----END PGP SIGNATURE----- + +--------------enig2C897DDE71A01355669582D6-- + +From pgsql-performance-owner@postgresql.org Thu Apr 7 00:11:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5528F53533 + for ; + Thu, 7 Apr 2005 00:11:44 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38964-03 + for ; + Wed, 6 Apr 2005 23:11:40 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A9BB2534F9 + for ; + Thu, 7 Apr 2005 00:11:39 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36N6Y7s006828; + Wed, 6 Apr 2005 19:06:34 -0400 (EDT) +To: John A Meinel +Cc: "Jim C. Nasby" , + Arjen van der Meijden , + pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan for + relatively simple query seems to be very inefficient) +In-reply-to: <4254688F.6070009@arbash-meinel.com> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050406222536.GL93835@decibel.org> + <6594.1112826910@sss.pgh.pa.us> + <4254688F.6070009@arbash-meinel.com> +Comments: In-reply-to John A Meinel + message dated "Wed, 06 Apr 2005 17:54:07 -0500" +Date: Wed, 06 Apr 2005 19:06:34 -0400 +Message-ID: <6827.1112828794@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/131 +X-Sequence-Number: 11528 + +John A Meinel writes: +> Actually, I think he was saying do a nested loop, and for each item in +> the nested loop, re-evaluate if an index or a sequential scan is more +> efficient. + +> I don't think postgres re-plans once it has started, though you could +> test this in a plpgsql function. + +It doesn't, and in any case that's a microscopic view of the issue. +The entire shape of the plan might change depending on what we think +the selectivity is --- much more than could be handled by switching +scan types at the bottom level. + +Also, I anticipate that bitmap-driven index scans will change things +considerably here. The range of usefulness of pure seqscans will +drop drastically... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 00:23:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2142F53AE8 + for ; + Thu, 7 Apr 2005 00:23:15 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39959-05 + for ; + Wed, 6 Apr 2005 23:23:06 +0000 (GMT) +Received: from castle.comp.uvic.ca (castle.comp.uvic.ca [142.104.5.97]) + by svr1.postgresql.org (Postfix) with ESMTP id C123E53A39 + for ; + Thu, 7 Apr 2005 00:23:04 +0100 (BST) +Received: from [127.0.0.1] (bkbox.idc.uvic.ca [142.104.12.33]) + by castle.comp.uvic.ca (8.13.2/8.13.2) with ESMTP id j36NMx7t7610510 + for ; Wed, 6 Apr 2005 16:23:07 -0700 +Message-ID: <42546F53.1020300@aers.ca> +Date: Wed, 06 Apr 2005 16:22:59 -0700 +From: Adam Palmblad +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "pgsql-performance@postgresql.org" +Subject: Tweaking a C Function I wrote +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-UVic-Virus-Scanned: OK - Passed virus scan by Sophos (sophie) on castle +X-UVic-Spam-Scan: castle.comp.uvic.ca Not_scanned_LOCAL +X-Scanned-By: MIMEDefang 2.33 (www . roaringpenguin . com / mimedefang) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.291 tagged_above=0 required=5 tests=AWL, + TO_ADDRESS_EQ_REAL +X-Spam-Level: +X-Archive-Number: 200504/132 +X-Sequence-Number: 11529 + +I wanted to see if I could squeeze any more performance out of a C set +returning function I wrote. As such, I looked to a profiler. Is it +possible to get profile information on the function I wrote? I've got +postmaster and my function compiled with profiling support, and can find +the gmon.out files... can I actually look at the call tree that occurs +when my function is being executed or will I be limited to viewing calls +to functions in the postmaster binary? + +-Adam + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 00:26:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E87E05351E; + Thu, 7 Apr 2005 00:26:52 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41510-06; Wed, 6 Apr 2005 23:26:51 +0000 (GMT) +Received: from cmailm3.svr.pol.co.uk (cmailm3.svr.pol.co.uk [195.92.193.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 35CB3534E2; + Thu, 7 Apr 2005 00:26:50 +0100 (BST) +Received: from modem-4039.lynx.dialup.pol.co.uk ([217.135.207.199] + helo=192.168.0.102) by cmailm3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DJJv8-0004AZ-K2; Thu, 07 Apr 2005 00:26:51 +0100 +Subject: Re: Recognizing range constraints (was Re: Plan for +From: Simon Riggs +To: Tom Lane +Cc: Arjen van der Meijden , + pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +In-Reply-To: <6326.1112825377@sss.pgh.pa.us> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Thu, 07 Apr 2005 00:24:46 +0100 +Message-Id: <1112829886.16721.1104.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/133 +X-Sequence-Number: 11530 + +On Wed, 2005-04-06 at 18:09 -0400, Tom Lane wrote: +> I wrote: +> > Arjen van der Meijden writes: +> >> SELECT COUNT(*) FROM +> >> data_main AS dm, +> >> postcodes AS p +> >> WHERE dm.range BETWEEN p.range_from AND p.range_till +> +> > Planner error ... because it doesn't have any good way to estimate the +> > number of matching rows, it thinks that way is a bit more expensive than +> > data_main as the outside, but in reality it seems a good deal cheaper: +> +> BTW, it would get the right answer if it had recognized the WHERE clause +> as a range restriction --- it still doesn't know exactly what fraction +> of rows will match, but its default estimate is a great deal tighter for +> "WHERE x > something AND x < somethingelse" than it is for two unrelated +> inequality constraints. Enough tighter that it would have gone for the +> correct plan. +> +> The problem is that it doesn't recognize the WHERE as a range constraint +> on dm.range. + +> Can anyone suggest a more general rule? Do we need for example to +> consider whether the relation membership is the same in two clauses +> that might be opposite sides of a range restriction? It seems like +> +> a.x > b.y AND a.x < b.z + +Not sure we need a more general rule. There's only three ways to view +this pair of clauses: +i) its a range constraint i.e. BETWEEN +ii) its the complement of that i.e. NOT BETWEEN +iii) its a mistake, but we're not allowed to take that path + +Arjen's query and your generalisation of it above is a common type of +query - using a lookup of a reference data table with begin/end +effective dates. It would be very useful if this was supported. + +> probably can be treated as a range restriction on a.x for this purpose, +> but I'm much less sure that the same is true of +> +> a.x > b.y AND a.x < c.z + +I can't think of a query that would use such a construct, and might even +conclude that it was very poorly normalised model. I would suggest that +this is much less common in practical use. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 00:42:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 13D875322D + for ; + Thu, 7 Apr 2005 00:42:41 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45404-05 + for ; + Wed, 6 Apr 2005 23:42:35 +0000 (GMT) +Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) + by svr1.postgresql.org (Postfix) with ESMTP id DC92E52A9A + for ; + Thu, 7 Apr 2005 00:42:34 +0100 (BST) +Received: from localhost (mailbox.samurai.com [205.207.28.82]) + by mailbox.samurai.com (Postfix) with ESMTP id 5556318CDB1; + Wed, 6 Apr 2005 19:42:37 -0400 (EDT) +Received: from mailbox.samurai.com ([205.207.28.82]) + by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, + port 10024) + with LMTP id 89704-02-3; Wed, 6 Apr 2005 19:42:33 -0400 (EDT) +Received: from [61.88.101.19] (unknown [61.88.101.19]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mailbox.samurai.com (Postfix) with ESMTP id 260AB18CD13; + Wed, 6 Apr 2005 19:42:32 -0400 (EDT) +Message-ID: <425473E6.9080605@samurai.com> +Date: Thu, 07 Apr 2005 09:42:30 +1000 +From: Neil Conway +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Adam Palmblad +Cc: "pgsql-performance@postgresql.org" +Subject: Re: Tweaking a C Function I wrote +References: <42546F53.1020300@aers.ca> +In-Reply-To: <42546F53.1020300@aers.ca> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at mailbox.samurai.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.028 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/134 +X-Sequence-Number: 11531 + +Adam Palmblad wrote: +> can I actually look at the call tree that occurs when my function is +> being executed or will I be limited to viewing calls to functions in +> the postmaster binary? + +You're the one with the gprof data, you tell us :) + +It wouldn't surprise me if gprof didn't get profiling data for dlopen'ed +shared libraries (I haven't checked), but I think both oprofile and +callgrind should be able to. + +(If you do decide to use gprof and you're on Linux, be sure to compile +Postgres with CFLAGS="-DLINUX_PROFILE", to get valid profiling data.) + +-Neil + +From pgsql-performance-owner@postgresql.org Thu Apr 7 01:32:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 073DF533D6 + for ; + Thu, 7 Apr 2005 01:32:53 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58408-09 + for ; + Thu, 7 Apr 2005 00:32:47 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) + by svr1.postgresql.org (Postfix) with ESMTP id E68A4533D1 + for ; + Thu, 7 Apr 2005 01:32:46 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so441135wri + for ; + Wed, 06 Apr 2005 17:32:50 -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:references; + b=G8V1qoAty2REdrSdi0ljyF+AXlF9gGoUyJFq3JUE4+qjg9Ikh04mefq0We0SLgrdm6VlqzmV9pQo4km19uqPiiUv5aVTASy7SuZJAHrndJZ79Or8iDN7iliTI4Ghp3csizEijZcv22S9olYPaZEh2dk1iKzBtDMh1yUda79F+lg= +Received: by 10.54.33.57 with SMTP id g57mr20773wrg; + Wed, 06 Apr 2005 17:32:50 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 17:32:50 -0700 (PDT) +Message-ID: <33c6269f0504061732195f6ae4@mail.gmail.com> +Date: Wed, 6 Apr 2005 19:32:50 -0500 +From: Alex Turner +Reply-To: Alex Turner +To: "Jim C. Nasby" +Subject: Re: How to improve db performance with $7K? +Cc: William Yu , pgsql-performance@postgresql.org +In-Reply-To: <20050406224102.GM93835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <424840AE.3050200@sfnet.cc> <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.255 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/135 +X-Sequence-Number: 11532 + +I guess I'm setting myself up here, and I'm really not being ignorant, +but can someone explain exactly how is SCSI is supposed to better than +SATA? + +Both systems use drives with platters. Each drive can physically only +read one thing at a time. + +SATA gives each drive it's own channel, but you have to share in SCSI. + A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +SCSI can only do 320MB/sec across the entire array. + +What am I missing here? + +Alex Turner +netEconomist + +On Apr 6, 2005 5:41 PM, Jim C. Nasby wrote: +> Sorry if I'm pointing out the obvious here, but it seems worth +> mentioning. AFAIK all 3ware controllers are setup so that each SATA +> drive gets it's own SATA bus. My understanding is that by and large, +> SATA still suffers from a general inability to have multiple outstanding +> commands on the bus at once, unlike SCSI. Therefore, to get good +> performance out of SATA you need to have a seperate bus for each drive. +> Theoretically, it shouldn't really matter that it's SATA over ATA, other +> than I certainly wouldn't want to try and cram 8 ATA cables into a +> machine... +> +> Incidentally, when we were investigating storage options at a previous +> job we talked to someone who deals with RS/6000 storage. He had a bunch +> of info about their serial controller protocol (which I can't think of +> the name of) vs SCSI. SCSI had a lot more overhead, so you could end up +> saturating even a 160MB SCSI bus with only 2 or 3 drives. +> +> People are finally realizing how important bandwidth has become in +> modern machines. Memory bandwidth is why RS/6000 was (and maybe still +> is) cleaning Sun's clock, and it's why the Opteron blows Itaniums out of +> the water. Likewise it's why SCSI is so much better than IDE (unless you +> just give each drive it's own dedicated bandwidth). +> -- +> Jim C. Nasby, Database Consultant decibel@decibel.org +> Give your computer some brain candy! www.distributed.net Team #1828 +> +> Windows: "Where do you want to go today?" +> Linux: "Where do you want to go tomorrow?" +> FreeBSD: "Are you guys coming, or what?" +> + +From pgsql-performance-owner@postgresql.org Thu Apr 7 02:12:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C7DB534A6 + for ; + Thu, 7 Apr 2005 02:12:21 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64900-10 + for ; + Thu, 7 Apr 2005 01:12:11 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) + by svr1.postgresql.org (Postfix) with ESMTP id 2397A53432 + for ; + Thu, 7 Apr 2005 02:12:10 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so449536wri + for ; + Wed, 06 Apr 2005 18:12:14 -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:references; + b=AjVyxpajRmVDXN4wEuj92qTjGTJ5kxEbn2Fwuxnp67e47MmA6coarTGeGqB5WOXHh5lUXwr7oRwwbJD/FxJGUomZ4/4SmlQ3JJlid+/167Hc9i3YEWxdKvJcIX7K6d1XvvzahLf8VacVN6B5sR6aSXlS+0KmpwGiPplgslamQO4= +Received: by 10.54.13.34 with SMTP id 34mr274008wrm; + Wed, 06 Apr 2005 18:12:14 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 18:12:14 -0700 (PDT) +Message-ID: <33c6269f05040618124f5c02d9@mail.gmail.com> +Date: Wed, 6 Apr 2005 20:12:14 -0500 +From: Alex Turner +Reply-To: Alex Turner +To: "Jim C. Nasby" +Subject: Re: How to improve db performance with $7K? +Cc: William Yu , pgsql-performance@postgresql.org +In-Reply-To: <33c6269f0504061732195f6ae4@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <424840AE.3050200@sfnet.cc> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.256 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/136 +X-Sequence-Number: 11533 + +Ok - so I found this fairly good online review of various SATA cards +out there, with 3ware not doing too hot on RAID 5, but ok on RAID 10. + +http://www.tweakers.net/reviews/557/ + +Very interesting stuff. + +Alex Turner +netEconomist + +On Apr 6, 2005 7:32 PM, Alex Turner wrote: +> I guess I'm setting myself up here, and I'm really not being ignorant, +> but can someone explain exactly how is SCSI is supposed to better than +> SATA? +> +> Both systems use drives with platters. Each drive can physically only +> read one thing at a time. +> +> SATA gives each drive it's own channel, but you have to share in SCSI. +> A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +> SCSI can only do 320MB/sec across the entire array. +> +> What am I missing here? +> +> Alex Turner +> netEconomist +> +> On Apr 6, 2005 5:41 PM, Jim C. Nasby wrote: +> > Sorry if I'm pointing out the obvious here, but it seems worth +> > mentioning. AFAIK all 3ware controllers are setup so that each SATA +> > drive gets it's own SATA bus. My understanding is that by and large, +> > SATA still suffers from a general inability to have multiple outstanding +> > commands on the bus at once, unlike SCSI. Therefore, to get good +> > performance out of SATA you need to have a seperate bus for each drive. +> > Theoretically, it shouldn't really matter that it's SATA over ATA, other +> > than I certainly wouldn't want to try and cram 8 ATA cables into a +> > machine... +> > +> > Incidentally, when we were investigating storage options at a previous +> > job we talked to someone who deals with RS/6000 storage. He had a bunch +> > of info about their serial controller protocol (which I can't think of +> > the name of) vs SCSI. SCSI had a lot more overhead, so you could end up +> > saturating even a 160MB SCSI bus with only 2 or 3 drives. +> > +> > People are finally realizing how important bandwidth has become in +> > modern machines. Memory bandwidth is why RS/6000 was (and maybe still +> > is) cleaning Sun's clock, and it's why the Opteron blows Itaniums out of +> > the water. Likewise it's why SCSI is so much better than IDE (unless you +> > just give each drive it's own dedicated bandwidth). +> > -- +> > Jim C. Nasby, Database Consultant decibel@decibel.org +> > Give your computer some brain candy! www.distributed.net Team #1828 +> > +> > Windows: "Where do you want to go today?" +> > Linux: "Where do you want to go tomorrow?" +> > FreeBSD: "Are you guys coming, or what?" +> > +> + +From pgsql-performance-owner@postgresql.org Thu Apr 7 02:24:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 893EA5343B + for ; + Thu, 7 Apr 2005 02:23:59 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71844-03 + for ; + Thu, 7 Apr 2005 01:23:57 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 1671F53432 + for ; + Thu, 7 Apr 2005 02:23:56 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so451977wri + for ; + Wed, 06 Apr 2005 18:24:00 -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:references; + b=rwE3+ko2Ixmq7vQQ3zIzXwOn6QdSEiEpZjub8Y8rTJ4pzOHBcziec469OX4/IROsBQg5W7clapOg8zamrTdvMXTIu70sylv9Hx3N8dGqoJfc7MMkSDlSHO3l7KYIWWQTJIKFLKPStBaqK4Y+dJETftzTtAXE6cRO9RegK6KKCrA= +Received: by 10.54.37.29 with SMTP id k29mr114696wrk; + Wed, 06 Apr 2005 18:23:59 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 18:23:59 -0700 (PDT) +Message-ID: <33c6269f050406182365961772@mail.gmail.com> +Date: Wed, 6 Apr 2005 20:23:59 -0500 +From: Alex Turner +Reply-To: Alex Turner +To: "Jim C. Nasby" +Subject: Re: How to improve db performance with $7K? +Cc: William Yu , pgsql-performance@postgresql.org +In-Reply-To: <33c6269f05040618124f5c02d9@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <424840AE.3050200@sfnet.cc> <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <33c6269f05040618124f5c02d9@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.256 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/137 +X-Sequence-Number: 11534 + +Ok - I take it back - I'm reading through this now, and realising that +the reviews are pretty clueless in several places... + + +On Apr 6, 2005 8:12 PM, Alex Turner wrote: +> Ok - so I found this fairly good online review of various SATA cards +> out there, with 3ware not doing too hot on RAID 5, but ok on RAID 10. +> +> http://www.tweakers.net/reviews/557/ +> +> Very interesting stuff. +> +> Alex Turner +> netEconomist +> +> On Apr 6, 2005 7:32 PM, Alex Turner wrote: +> > I guess I'm setting myself up here, and I'm really not being ignorant, +> > but can someone explain exactly how is SCSI is supposed to better than +> > SATA? +> > +> > Both systems use drives with platters. Each drive can physically only +> > read one thing at a time. +> > +> > SATA gives each drive it's own channel, but you have to share in SCSI. +> > A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +> > SCSI can only do 320MB/sec across the entire array. +> > +> > What am I missing here? +> > +> > Alex Turner +> > netEconomist +> > +> > On Apr 6, 2005 5:41 PM, Jim C. Nasby wrote: +> > > Sorry if I'm pointing out the obvious here, but it seems worth +> > > mentioning. AFAIK all 3ware controllers are setup so that each SATA +> > > drive gets it's own SATA bus. My understanding is that by and large, +> > > SATA still suffers from a general inability to have multiple outstanding +> > > commands on the bus at once, unlike SCSI. Therefore, to get good +> > > performance out of SATA you need to have a seperate bus for each drive. +> > > Theoretically, it shouldn't really matter that it's SATA over ATA, other +> > > than I certainly wouldn't want to try and cram 8 ATA cables into a +> > > machine... +> > > +> > > Incidentally, when we were investigating storage options at a previous +> > > job we talked to someone who deals with RS/6000 storage. He had a bunch +> > > of info about their serial controller protocol (which I can't think of +> > > the name of) vs SCSI. SCSI had a lot more overhead, so you could end up +> > > saturating even a 160MB SCSI bus with only 2 or 3 drives. +> > > +> > > People are finally realizing how important bandwidth has become in +> > > modern machines. Memory bandwidth is why RS/6000 was (and maybe still +> > > is) cleaning Sun's clock, and it's why the Opteron blows Itaniums out of +> > > the water. Likewise it's why SCSI is so much better than IDE (unless you +> > > just give each drive it's own dedicated bandwidth). +> > > -- +> > > Jim C. Nasby, Database Consultant decibel@decibel.org +> > > Give your computer some brain candy! www.distributed.net Team #1828 +> > > +> > > Windows: "Where do you want to go today?" +> > > Linux: "Where do you want to go tomorrow?" +> > > FreeBSD: "Are you guys coming, or what?" +> > > +> > +> + +From pgsql-performance-owner@postgresql.org Thu Apr 7 03:02:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B79CD537EA + for ; + Thu, 7 Apr 2005 03:02:57 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81656-05 + for ; + Thu, 7 Apr 2005 02:02:49 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id C9AE853ACC + for ; + Thu, 7 Apr 2005 03:02:48 +0100 (BST) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 83BC724FDD; + Thu, 7 Apr 2005 10:02:52 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 6781C24FCE; + Thu, 7 Apr 2005 10:02:52 +0800 (WST) +Message-ID: <4254952A.7090705@familyhealth.com.au> +Date: Thu, 07 Apr 2005 10:04:26 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Mischa +Cc: pgsql-performance@postgresql.org +Subject: Re: COPY Hacks (WAS: RE: Postgresql vs SQLserver for this +References: + + <33c6269f05040608377dfc9272@mail.gmail.com> + <1112813199.42542e8f17b4d@webmail.telus.net> +In-Reply-To: <1112813199.42542e8f17b4d@webmail.telus.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.074 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/138 +X-Sequence-Number: 11535 + +> Using COPY ... FROM STDIN via the Perl DBI (DBD::Pg) interface, +> I accidentally strung together several \n-terminated input lines, +> and sent them to the server with a single "putline". +> +> To my (happy) surprise, I ended up with exactly that number of rows +> in the target table. +> +> Is this a bug? Is this fundamental to the protocol? +> +> Since it hasn't been documented (but then, "endcopy" isn't documented), +> I've been shy of investing in perf testing such mass copy calls. +> But, if it DOES work, it should be reducing the number of network +> roundtrips. + +I think it's documented in the libpq docs... + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 7 04:01:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 554A253AD5 + for ; + Thu, 7 Apr 2005 04:01:22 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93882-08 + for ; + Thu, 7 Apr 2005 03:01:12 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E68053AE1 + for ; + Thu, 7 Apr 2005 04:01:03 +0100 (BST) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1DJNGI-0004MM-00; Wed, 06 Apr 2005 23:00:54 -0400 +To: Alex Turner +Cc: "Jim C. Nasby" , + William Yu , pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: <424840AE.3050200@sfnet.cc> <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> +In-Reply-To: <33c6269f0504061732195f6ae4@mail.gmail.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 06 Apr 2005 23:00:54 -0400 +Message-ID: <87wtrfmgt5.fsf@stark.xeocode.com> +Lines: 23 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/139 +X-Sequence-Number: 11536 + + +Alex Turner writes: + +> SATA gives each drive it's own channel, but you have to share in SCSI. +> A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +> SCSI can only do 320MB/sec across the entire array. + +SCSI controllers often have separate channels for each device too. + +In any case the issue with the IDE protocol is that fundamentally you can only +have a single command pending. SCSI can have many commands pending. This is +especially important for a database like postgres that may be busy committing +one transaction while another is trying to read. Having several commands +queued on the drive gives it a chance to execute any that are "on the way" to +the committing transaction. + +However I'm under the impression that 3ware has largely solved this problem. +Also, if you save a few dollars and can afford one additional drive that +additional drive may improve your array speed enough to overcome that +inefficiency. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 04:06:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8E55E534EB + for ; + Thu, 7 Apr 2005 04:06:57 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00627-08 + for ; + Thu, 7 Apr 2005 03:06:48 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CA1252808 + for ; + Thu, 7 Apr 2005 04:06:47 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so472703wri + for ; + Wed, 06 Apr 2005 20:06:47 -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:references; + b=ZFEC3w387ECgBLZdxsVR8hpC2ePs+r8gvL31P+p8ig4hddJYyv8b0gymEJbQFn8GDzbXe1mm2NM0SWMZ5hLVDYxwNdtEK7HqJjO8Tb1/LuzYWp2q8w3/mBK/4jDZZlCLbg+nU+r/Tkc1fEHuJz/XXR/kNrKuhmJlj6yKRXAJvcA= +Received: by 10.54.15.26 with SMTP id 26mr1319088wro; + Wed, 06 Apr 2005 20:06:47 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 6 Apr 2005 20:06:47 -0700 (PDT) +Message-ID: <33c6269f050406200623d43daf@mail.gmail.com> +Date: Wed, 6 Apr 2005 22:06:47 -0500 +From: Alex Turner +Reply-To: Alex Turner +To: Greg Stark +Subject: Re: How to improve db performance with $7K? +Cc: "Jim C. Nasby" , + William Yu , pgsql-performance@postgresql.org +In-Reply-To: <87wtrfmgt5.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <424840AE.3050200@sfnet.cc> <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.257 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/140 +X-Sequence-Number: 11537 + +Yeah - the more reading I'm doing - the more I'm finding out. + +Alledgelly the Western Digial Raptor drives implement a version of +ATA-4 Tagged Queing which allows reordering of commands. Some +controllers support this. The 3ware docs say that the controller +support both reordering on the controller and to the drive. *shrug* + +This of course is all supposed to go away with SATA II which as NCQ, +Native Command Queueing. Of course the 3ware controllers don't +support SATA II, but a few other do, and I'm sure 3ware will come out +with a controller that does. + +Alex Turner +netEconomist + +On 06 Apr 2005 23:00:54 -0400, Greg Stark wrote: +> +> Alex Turner writes: +> +> > SATA gives each drive it's own channel, but you have to share in SCSI. +> > A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +> > SCSI can only do 320MB/sec across the entire array. +> +> SCSI controllers often have separate channels for each device too. +> +> In any case the issue with the IDE protocol is that fundamentally you can only +> have a single command pending. SCSI can have many commands pending. This is +> especially important for a database like postgres that may be busy committing +> one transaction while another is trying to read. Having several commands +> queued on the drive gives it a chance to execute any that are "on the way" to +> the committing transaction. +> +> However I'm under the impression that 3ware has largely solved this problem. +> Also, if you save a few dollars and can afford one additional drive that +> additional drive may improve your array speed enough to overcome that +> inefficiency. +> +> -- +> greg +> +> + +From pgsql-performance-owner@postgresql.org Thu Apr 7 05:03:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FEEE53AEC + for ; + Thu, 7 Apr 2005 05:03:39 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16447-08 + for ; + Thu, 7 Apr 2005 04:03:37 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BE9E453B02 + for ; + Thu, 7 Apr 2005 05:03:35 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3743QXv013375; + Thu, 7 Apr 2005 00:03:26 -0400 (EDT) +To: Neil Conway +Cc: Adam Palmblad , + "pgsql-performance@postgresql.org" +Subject: Re: Tweaking a C Function I wrote +In-reply-to: <425473E6.9080605@samurai.com> +References: <42546F53.1020300@aers.ca> <425473E6.9080605@samurai.com> +Comments: In-reply-to Neil Conway + message dated "Thu, 07 Apr 2005 09:42:30 +1000" +Date: Thu, 07 Apr 2005 00:03:26 -0400 +Message-ID: <13374.1112846606@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/141 +X-Sequence-Number: 11538 + +Neil Conway writes: +> It wouldn't surprise me if gprof didn't get profiling data for dlopen'ed +> shared libraries (I haven't checked), but I think both oprofile and +> callgrind should be able to. + +None of the platforms I use are very good at this :-(. Consider +building a special backend binary with the functions of interest +statically linked into it... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 05:15:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C99D25370F + for ; + Thu, 7 Apr 2005 05:15:30 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19813-10 + for ; + Thu, 7 Apr 2005 04:15:21 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C25F152808 + for ; + Thu, 7 Apr 2005 05:15:20 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j374Evq4013450; + Thu, 7 Apr 2005 00:14:57 -0400 (EDT) +To: Greg Stark +Cc: Alex Turner , + "Jim C. Nasby" , William Yu , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-reply-to: <87wtrfmgt5.fsf@stark.xeocode.com> +References: <424840AE.3050200@sfnet.cc> <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "06 Apr 2005 23:00:54 -0400" +Date: Thu, 07 Apr 2005 00:14:57 -0400 +Message-ID: <13449.1112847297@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/142 +X-Sequence-Number: 11539 + +Greg Stark writes: +> In any case the issue with the IDE protocol is that fundamentally you +> can only have a single command pending. SCSI can have many commands +> pending. + +That's the bottom line: the SCSI protocol was designed (twenty years ago!) +to allow the drive to do physical I/O scheduling, because the CPU can +issue multiple commands before the drive has to report completion of the +first one. IDE isn't designed to do that. I understand that the latest +revisions to the IDE/ATA specs allow the drive to do this sort of thing, +but support for it is far from widespread. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 05:40:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CD16053B0E + for ; + Thu, 7 Apr 2005 05:40:40 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26804-04 + for ; + Thu, 7 Apr 2005 04:40:30 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id 5B1C55370F + for ; + Thu, 7 Apr 2005 05:40:29 +0100 (BST) +Received: (qmail 16488 invoked from network); 7 Apr 2005 04:40:28 -0000 +Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) + (209.149.56.238) by 0 with SMTP; 7 Apr 2005 04:40:28 -0000 +In-Reply-To: <20050406044456.GA19518@filer> +References: <42443863.4040302@sfnet.cc> <4244A90B.2030200@sfnet.cc> + <42453273.2060509@turtle-entertainment.de> + <200503261255.59007.josh@agliodbs.com> <42455DEC.2080301@sfnet.cc> + <1112049794.23284.29.camel@localhost.localdomain> + <424840AE.3050200@sfnet.cc> + <1112107974.7903.28.camel@sixtyfour.internetstaff.com> + <424CAB5D.9020807@sfnet.cc> + + <20050406044456.GA19518@filer> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=WINDOWS-1252; format=flowed +Message-Id: +Content-Transfer-Encoding: quoted-printable +Cc: pgsql-performance@postgresql.org +From: Thomas F.O'Connell +Subject: Re: Follow-Up: How to improve db performance with $7K? +Date: Wed, 6 Apr 2005 23:40:26 -0500 +To: Kevin Brown +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/143 +X-Sequence-Number: 11540 + +Things might've changed somewhat over the past year, but this is from=20 +_the_ Linux guy at Dell... + +-tfo + +-- +Thomas F. O'Connell +Co-Founder, Information Architect +Sitening, LLC + +Strategic Open Source =97 Open Your i=99 + +http://www.sitening.com/ +110 30th Avenue North, Suite 6 +Nashville, TN 37203-6320 +615-260-0005 + + +Date: Mon, 26 Apr 2004 14:15:02 -0500 +From: Matt Domsch +To: linux-poweredge@dell.com +Subject: PERC3/Di failure workaround hypothesis + + +--uXxzq0nDebZQVNAZ +Content-Type: text/plain; charset=3Dus-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +On Mon, Apr 26, 2004 at 11:10:36AM -0500, Sellek, Greg wrote: + > Short of ordering a Perc4 for every 2650 that I want to upgrade to RH + > ES, is there anything else I can do to get around the Perc3/Di + > problem? + +Our working hypothesis for a workaround is to do as follows: + +In afacli, set: + +Read Cache: enabled +Write Cache: enabled when protected + +Then unplug the ROMB battery. A reboot is not necessary. The firmware=20= + +will immediately drop into Write-Through Cache mode, which in our=20 +testing has not exhibited the problem. Setting the write cache to=20 +disabled in afacli doesn't seem to help - you've got to unplug the=20 +battery with it in the above settings. + +We are continuing to search for the root cause to the problem, and will=20= + +update the list when we can. + +Thanks, +Matt + +-- +Matt Domsch +Sr. Software Engineer, Lead Engineer +Dell Linux Solutions linux.dell.com & www.dell.com/linux +Linux on Dell mailing lists @ http://lists.us.dell.com + +On Apr 5, 2005, at 11:44 PM, Kevin Brown wrote: + +> Thomas F.O'Connell wrote: +>> I'd use two of your drives to create a mirrored partition where=20 +>> pg_xlog +>> resides separate from the actual data. +>> +>> RAID 10 is probably appropriate for the remaining drives. +>> +>> Fortunately, you're not using Dell, so you don't have to worry about +>> the Perc3/Di RAID controller, which is not so compatible with +>> Linux... +> +> Hmm...I have to wonder how true this is these days. +> +> My company has a Dell 2500 with a Perc3/Di running Debian Linux, with +> the 2.6.10 kernel. The controller seems to work reasonably well, +> though I wouldn't doubt that it's slower than a different one might +> be. But so far we haven't had any reliability issues with it. +> +> Now, the performance is pretty bad considering the setup -- a RAID 5 +> with five 73.6 gig SCSI disks (10K RPM, I believe). Reads through the +> filesystem come through at about 65 megabytes/sec, writes about 35 +> megabytes/sec (at least, so says "bonnie -s 8192"). This is on a +> system with a single 3 GHz Xeon and 1 gigabyte of memory. I'd expect +> much better read performance from what is essentially a stripe of 4 +> fast SCSI disks. +> +> +> While compatibility hasn't really been an issue, at least as far as +> the basics go, I still agree with your general sentiment -- stay away +> from the Dells, at least if they have the Perc3/Di controller. You'll +> probably get much better performance out of something else. +> +> +> --=20 +> Kevin Brown = +kevin@sysexperts.com= + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 05:59:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 471B053AF9 + for ; + Thu, 7 Apr 2005 05:59:18 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28996-09 + for ; + Thu, 7 Apr 2005 04:59:11 +0000 (GMT) +Received: from outbound0.sv.meer.net (outbound0.sv.meer.net [205.217.152.13]) + by svr1.postgresql.org (Postfix) with ESMTP id B3C8953B0F + for ; + Thu, 7 Apr 2005 05:59:08 +0100 (BST) +Received: from mail.meer.net (mail.meer.net [209.157.152.14]) + by outbound0.sv.meer.net (8.12.10/8.12.6) with ESMTP id j374wmqX007742; + Wed, 6 Apr 2005 21:59:02 -0700 (PDT) + (envelope-from trainor@transborder.net) +Received: from [192.168.1.47] (pool-70-20-225-225.phil.east.verizon.net + [70.20.225.225]) + by mail.meer.net (8.12.10/8.12.10/meer) with ESMTP id j374wX7V015823; + Wed, 6 Apr 2005 21:58:35 -0700 (PDT) + (envelope-from trainor@transborder.net) +In-Reply-To: <33c6269f0504061732195f6ae4@mail.gmail.com> +References: <424840AE.3050200@sfnet.cc> <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: "Jim C. Nasby" , + pgsql-performance@postgresql.org, William Yu +From: "Douglas J. Trainor" +Subject: Re: How to improve db performance with $7K? +Date: Thu, 7 Apr 2005 00:58:33 -0400 +To: Alex Turner +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/144 +X-Sequence-Number: 11541 + +You asked for it! ;-) + +If you want cheap, get SATA. If you want fast under +*load* conditions, get SCSI. Everything else at this +time is marketing hype, either intentional or learned. +Ignoring dollars, expect to see SCSI beat SATA by 40%. + + * * * What I tell you three times is true * * * + +Also, compare the warranty you get with any SATA +drive with any SCSI drive. Yes, you still have some +change leftover to buy more SATA drives when they +fail, but... it fundamentally comes down to some +actual implementation and not what is printed on +the cardboard box. Disk systems are bound by the +rules of queueing theory. You can hit the sales rep +over the head with your queueing theory book. + +Ultra320 SCSI is king of the hill for high concurrency +databases. If you're only streaming or serving files, +save some money and get a bunch of SATA drives. +But if you're reading/writing all over the disk, the +simple first-come-first-serve SATA heuristic will +hose your performance under load conditions. + +Next year, they will *try* bring out some SATA cards +that improve on first-come-first-serve, but they ain't +here now. There are a lot of rigged performance tests +out there... Maybe by the time they fix the queueing +problems, serial Attached SCSI (a/k/a SAS) will be out. +Looks like Ultra320 is the end of the line for parallel +SCSI, as Ultra640 SCSI (a/k/a SPI-5) is dead in the +water. + +Ultra320 SCSI. +Ultra320 SCSI. +Ultra320 SCSI. + +Serial Attached SCSI. +Serial Attached SCSI. +Serial Attached SCSI. + +For future trends, see: +http://www.incits.org/archive/2003/in031163/in031163.htm + + douglas + +p.s. For extra credit, try comparing SATA and SCSI drives +when they're 90% full. + +On Apr 6, 2005, at 8:32 PM, Alex Turner wrote: + +> I guess I'm setting myself up here, and I'm really not being ignorant, +> but can someone explain exactly how is SCSI is supposed to better than +> SATA? +> +> Both systems use drives with platters. Each drive can physically only +> read one thing at a time. +> +> SATA gives each drive it's own channel, but you have to share in SCSI. +> A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +> SCSI can only do 320MB/sec across the entire array. +> +> What am I missing here? +> +> Alex Turner +> netEconomist + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 08:42:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DDACC53A5C + for ; + Thu, 7 Apr 2005 08:42:20 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67935-08 + for ; + Thu, 7 Apr 2005 07:42:19 +0000 (GMT) +Received: from daisy.midascomm.com (unknown [203.196.171.90]) + by svr1.postgresql.org (Postfix) with ESMTP id EAEE85331B + for ; + Thu, 7 Apr 2005 08:42:18 +0100 (BST) +Received: from daisy.midascomm.com (localhost.localdomain [127.0.0.1]) + by daisy.midascomm.com (8.12.10/8.12.10) with ESMTP id j377L6Dk018096 + for ; Thu, 7 Apr 2005 12:51:06 +0530 +Received: from 192.168.13.108 (SquirrelMail authenticated user thanga); + by daisy.midascomm.com with HTTP; + Thu, 7 Apr 2005 12:51:06 +0530 (IST) +Message-ID: <1148.192.168.13.108.1112858466.squirrel@192.168.13.108> +Date: Thu, 7 Apr 2005 12:51:06 +0530 (IST) +Subject: help on explain analyse in psql 7.1.3 (linux) +From: "S.Thanga Prakash" +To: pgsql-performance@postgresql.org +Reply-To: thanga@midascomm.com +User-Agent: SquirrelMail/1.5.0 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/145 +X-Sequence-Number: 11542 + +hi, + + I am using psql 7.1.3 + +I didn't find option analyse in explain command.. + +how to get time taken by SQL procedure/query? + +regards, +stp.. + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:53:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B8EC053A41 + for ; + Thu, 7 Apr 2005 08:02:41 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57542-10 + for ; + Thu, 7 Apr 2005 07:02:33 +0000 (GMT) +Received: from info.midascomm.com (unknown [203.196.171.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 36F445377D + for ; + Thu, 7 Apr 2005 08:02:30 +0100 (BST) +Received: from albatross.midascomm.com ([192.168.13.108]) + by info.midascomm.com (8.12.10/8.12.10) with ESMTP id j376jKo4019373 + for ; Thu, 7 Apr 2005 12:15:26 +0530 +Date: Thu, 7 Apr 2005 12:51:47 +0530 (IST) +From: "S.Thanga Prakash" +To: +Subject: help on explain analyse +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-midascomm.com-MailScanner-Information: Please contact System Administrator + for more information +X-midascomm.com-MailScanner: Found to be clean +X-MailScanner-From: thanga@midascomm.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/205 +X-Sequence-Number: 11602 + +hi, + + I am using psql 7.1.3 + +I didn't find option analyse in explain command.. + +how to get time taken by SQL procedure/query? + +regards, +stp.. + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 09:06:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 690F553683 + for ; + Thu, 7 Apr 2005 09:06:23 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76945-06 + for ; + Thu, 7 Apr 2005 08:06:14 +0000 (GMT) +Received: from daisy.midascomm.com (unknown [203.196.171.90]) + by svr1.postgresql.org (Postfix) with ESMTP id E018B53231 + for ; + Thu, 7 Apr 2005 09:06:08 +0100 (BST) +Received: from daisy.midascomm.com (localhost.localdomain [127.0.0.1]) + by daisy.midascomm.com (8.12.10/8.12.10) with ESMTP id j377ipDk020166 + for ; Thu, 7 Apr 2005 13:14:51 +0530 +Received: from 192.168.13.108 (SquirrelMail authenticated user thanga); + by daisy.midascomm.com with HTTP; + Thu, 7 Apr 2005 13:14:51 +0530 (IST) +Message-ID: <1168.192.168.13.108.1112859891.squirrel@192.168.13.108> +Date: Thu, 7 Apr 2005 13:14:51 +0530 (IST) +Subject: help on time calculation +From: "S.Thanga Prakash" +To: pgsql-performance@postgresql.org +Reply-To: thanga@midascomm.com +User-Agent: SquirrelMail/1.5.0 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/147 +X-Sequence-Number: 11544 + +hi, + + how to find the time taken by an query/stored procedure? + +I am using psql 7.1.3 in linux 7.2 + +how to execute 'explain analyse' in the psql? Is it supported at 7.1.3 ? + + +looking forward for replies.. +regards, +stp. + +From pgsql-performance-owner@postgresql.org Thu Apr 7 08:47:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5451853231 + for ; + Thu, 7 Apr 2005 08:47:52 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71311-07 + for ; + Thu, 7 Apr 2005 07:47:43 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 4469253A8C + for ; + Thu, 7 Apr 2005 08:47:39 +0100 (BST) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id ADF2D24FE0; + Thu, 7 Apr 2005 15:47:38 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 93C0924FDF; + Thu, 7 Apr 2005 15:47:38 +0800 (WST) +Message-ID: <4254E604.90006@familyhealth.com.au> +Date: Thu, 07 Apr 2005 15:49:24 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: thanga@midascomm.com +Cc: pgsql-performance@postgresql.org +Subject: Re: help on explain analyse in psql 7.1.3 (linux) +References: <1148.192.168.13.108.1112858466.squirrel@192.168.13.108> +In-Reply-To: <1148.192.168.13.108.1112858466.squirrel@192.168.13.108> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.074 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/146 +X-Sequence-Number: 11543 + +> I didn't find option analyse in explain command.. +> +> how to get time taken by SQL procedure/query? + +Explain analyze was added in 7.2 - you really need to upgrade... + +You can use \timing in psql to get an approximation... + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 7 09:16:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C0B653231 + for ; + Thu, 7 Apr 2005 09:16:48 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77554-05 + for ; + Thu, 7 Apr 2005 08:16:47 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id E71FF53733 + for ; + Thu, 7 Apr 2005 09:16:46 +0100 (BST) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id F0D9624FDD; + Thu, 7 Apr 2005 16:16:45 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id CF02224FCE; + Thu, 7 Apr 2005 16:16:45 +0800 (WST) +Message-ID: <4254ECD8.4040705@familyhealth.com.au> +Date: Thu, 07 Apr 2005 16:18:32 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: thanga@midascomm.com +Cc: pgsql-performance@postgresql.org +Subject: Re: help on time calculation +References: <1168.192.168.13.108.1112859891.squirrel@192.168.13.108> +In-Reply-To: <1168.192.168.13.108.1112859891.squirrel@192.168.13.108> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.074 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/148 +X-Sequence-Number: 11545 + +> how to find the time taken by an query/stored procedure? + +In psql, use \timing for an approximate time. + +> I am using psql 7.1.3 in linux 7.2 +> +> how to execute 'explain analyse' in the psql? Is it supported at 7.1.3 ? + +Explain analyze is NOT supported in PostgreSQL 7.1. You really should +upgrade your PostgreSQL to version 8.0. + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 7 09:26:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A0EB537E0 + for ; + Thu, 7 Apr 2005 09:26:06 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83621-01 + for ; + Thu, 7 Apr 2005 08:26:05 +0000 (GMT) +Received: from info.midascomm.com (unknown [203.196.171.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 800F853733 + for ; + Thu, 7 Apr 2005 09:26:02 +0100 (BST) +Received: from albatross.midascomm.com ([192.168.13.108]) + by info.midascomm.com (8.12.10/8.12.10) with ESMTP id j3788oo4026874; + Thu, 7 Apr 2005 13:38:50 +0530 +Date: Thu, 7 Apr 2005 14:15:19 +0530 (IST) +From: "S.Thanga Prakash" +To: Christopher Kings-Lynne +Cc: +Subject: Re: help on explain analyse in psql 7.1.3 (linux) +In-Reply-To: <4254E604.90006@familyhealth.com.au> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-midascomm.com-MailScanner-Information: Please contact System Administrator + for more information +X-midascomm.com-MailScanner: Found to be clean +X-MailScanner-From: thanga@midascomm.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/149 +X-Sequence-Number: 11546 + +hi, + + thanks for immediate response.. + +regards, +stp.. + +On Thu, 7 Apr 2005, Christopher Kings-Lynne wrote: + +> > I didn't find option analyse in explain command.. +> > +> > how to get time taken by SQL procedure/query? +> +> Explain analyze was added in 7.2 - you really need to upgrade... +> +> You can use \timing in psql to get an approximation... +> +> Chris +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 10:56:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5FB70538A8 + for ; + Thu, 7 Apr 2005 10:56:07 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07583-02 + for ; + Thu, 7 Apr 2005 09:56:01 +0000 (GMT) +Received: from outbound0.sv.meer.net (outbound0.sv.meer.net [205.217.152.13]) + by svr1.postgresql.org (Postfix) with ESMTP id 7F13C5386B + for ; + Thu, 7 Apr 2005 10:55:59 +0100 (BST) +Received: from mail.meer.net (mail.meer.net [209.157.152.14]) + by outbound0.sv.meer.net (8.12.10/8.12.6) with ESMTP id j379u1qL013717 + for ; + Thu, 7 Apr 2005 02:56:01 -0700 (PDT) + (envelope-from trainor@transborder.net) +Received: from [192.168.1.47] (pool-70-20-225-225.phil.east.verizon.net + [70.20.225.225]) + by mail.meer.net (8.12.10/8.12.10/meer) with ESMTP id j379tXlj069135 + for ; + Thu, 7 Apr 2005 02:55:59 -0700 (PDT) + (envelope-from trainor@transborder.net) +Mime-Version: 1.0 (Apple Message framework v619.2) +In-Reply-To: <33c6269f050406151241b01148@mail.gmail.com> +References: <42443863.4040302@sfnet.cc> <424840AE.3050200@sfnet.cc> + <42494741.7060806@fastcrypt.com> + <33c6269f0504040643317b69cd@mail.gmail.com> + <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: "Douglas J. Trainor" +Subject: Re: How to improve db performance with $7K? +Date: Thu, 7 Apr 2005 05:55:59 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/150 +X-Sequence-Number: 11547 + +A good one page discussion on the future of SCSI and SATA can +be found in the latest CHIPS (The Department of the Navy Information +Technology Magazine, formerly CHIPS AHOY) in an article by +Patrick G. Koehler and Lt. Cmdr. Stan Bush. + +Click below if you don't mind being logged visiting Space and Naval +Warfare Systems Center Charleston: + + http://www.chips.navy.mil/archives/05_Jan/web_pages/scuzzy.htm + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 13:23:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1FAE153570 + for ; + Thu, 7 Apr 2005 13:23:20 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51907-01 + for ; + Thu, 7 Apr 2005 12:23:17 +0000 (GMT) +Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) + by svr1.postgresql.org (Postfix) with ESMTP id F127452808 + for ; + Thu, 7 Apr 2005 13:23:16 +0100 (BST) +Received: from list by ciao.gmane.org with local (Exim 4.43) + id 1DJVzP-0006GG-FR + for pgsql-performance@postgresql.org; Thu, 07 Apr 2005 14:20:03 +0200 +Received: from srv.protecting.net ([212.126.218.242]) + by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) + id 1AlnuQ-0007hv-00 + for ; Thu, 07 Apr 2005 14:20:03 +0200 +Received: from hf1122x by srv.protecting.net with local (Gmexim 0.1 (Debian)) + id 1AlnuQ-0007hv-00 + for ; Thu, 07 Apr 2005 14:20:03 +0200 +X-Injected-Via-Gmane: http://gmane.org/ +To: pgsql-performance@postgresql.org +From: Harald Fuchs +Subject: Re: COPY Hacks (WAS: RE: Postgresql vs SQLserver for this application + ?) +Date: 07 Apr 2005 14:21:53 +0200 +Organization: Linux Private Site +Lines: 24 +Message-ID: +References: + + <33c6269f05040608377dfc9272@mail.gmail.com> + <1112813199.42542e8f17b4d@webmail.telus.net> +Reply-To: hf1122x@protecting.net +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +X-Complaints-To: usenet@sea.gmane.org +X-Gmane-NNTP-Posting-Host: srv.protecting.net +User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/151 +X-Sequence-Number: 11548 + +In article <1112813199.42542e8f17b4d@webmail.telus.net>, +Mischa writes: + +> This thread seems to be focusing in on COPY efficiency, +> I'd like to ask something I got no answer to, a few months ago. + +> Using COPY ... FROM STDIN via the Perl DBI (DBD::Pg) interface, +> I accidentally strung together several \n-terminated input lines, +> and sent them to the server with a single "putline". + +> To my (happy) surprise, I ended up with exactly that number of rows +> in the target table. + +> Is this a bug? Is this fundamental to the protocol? + +> Since it hasn't been documented (but then, "endcopy" isn't documented), +> I've been shy of investing in perf testing such mass copy calls. +> But, if it DOES work, it should be reducing the number of network +> roundtrips. + +> So. Is it a feechur? Worth stress-testing? Could be VERY cool. + +Using COPY from DBD::Pg _is_ documented - presumed you use DBD::Pg +version 1.41 released just today. + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 15:17:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D5C8D53B02 + for ; + Thu, 7 Apr 2005 15:17:29 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89112-01 + for ; + Thu, 7 Apr 2005 14:17:20 +0000 (GMT) +Received: from mail.99main.com (mail.99main.com [208.28.184.11]) + by svr1.postgresql.org (Postfix) with ESMTP id DBC5453A01 + for ; + Thu, 7 Apr 2005 15:17:19 +0100 (BST) +Received: from 99main.com (localhost [127.0.0.1]) + by mail.99main.com (8.12.8+Sun/8.12.8) with ESMTP id j37EHMjj024870 + for ; + Thu, 7 Apr 2005 10:17:22 -0400 (EDT) +From: "Keith Worthington" +To: "PostgreSQL Perform" +Reply-To: KeithW@narrowpathinc.com +Subject: 4 way JOIN using aliases +Date: Thu, 7 Apr 2005 10:17:22 -0400 +Message-Id: <20050407140133.M89867@narrowpathinc.com> +X-Mailer: Open WebMail 2.50 20050106 +X-OriginatingIP: 68.235.22.242 (npkeithw) +MIME-Version: 1.0 +Content-Type: text/plain; + charset=iso-8859-1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/153 +X-Sequence-Number: 11550 + +Hi All, + +Thanks to all on the NOVICE list that gave me help I now have a query running +that returns the results I am after. :-) Now of course I want it to run +faster. Currently it clocks in at ~160ms. I have checked over the indexes +and I belive that the tables are indexed properly. The largest table, +tbl_item, only has 2000 rows. Is it possible to reduce the time of this query +further? I have included the output of EXPLAIN ANALYZE below the query. +Unfortunately I am still struggling trying to learn how to interpret the +output. TIA + + SELECT tbl_item.id AS item_id, + tbl_item.item_type, + tbl_item.inactive AS item_inactive, + tbl_item.description AS item_description, + CASE WHEN tbl_item.item_class=0 THEN 'Non-Stock' + WHEN tbl_item.item_class=1 THEN 'Stock' + WHEN tbl_item.item_class=2 THEN 'Description' + WHEN tbl_item.item_class=3 THEN 'Assembly' + WHEN tbl_item.item_class=4 THEN 'Service' + WHEN tbl_item.item_class=5 THEN 'Labor' + WHEN tbl_item.item_class=6 THEN 'Activity' + WHEN tbl_item.item_class=7 THEN 'Charge' + ELSE 'Unrecognized' + END AS item_class, + tbl_item.sales_gl_account AS acct_sales_gl_nmbr, + sales_desc.description AS acct_sales_gl_name, + tbl_item.inventory_gl_account AS acct_inv_gl_nmbr, + inv_desc.description AS acct_inv_gl_name, + tbl_item.cogs_gl_account AS acct_cogs_gl_nmbr, + cogs_desc.description AS acct_cogs_gl_name, + CASE WHEN tbl_item.costing_method=0 THEN 'Average' + WHEN tbl_item.costing_method=1 THEN 'FIFO' + WHEN tbl_item.costing_method=2 THEN 'LIFO' + ELSE 'Unrecognized' + END AS acct_cost_method, + tbl_mesh.mesh_size, + tbl_mesh.unit_of_measure AS mesh_uom, + tbl_mesh.mesh_type, + tbl_item.purchase_description, + tbl_item.last_unit_cost AS purchase_unit_cost, + tbl_item.purchase_uom AS purchase_uom, + tbl_item.reorder_point AS purchase_point, + tbl_item.reorder_quantity AS purchase_quantity, + tbl_item.sales_description, + tbl_item.last_unit_cost/peachtree.tbl_item.ptos_uom_factor AS + sales_unit_cost, + tbl_item.unit_of_measure AS sales_uom, + tbl_item.weight AS sales_weight, + tbl_current.last_count + + tbl_current.received + - tbl_current.shipped AS inv_on_hand, + tbl_current.allocated AS inv_committed, + tbl_current.last_count + + tbl_current.received + - tbl_current.shipped + - tbl_current.allocated AS inv_available, + tbl_current.on_order AS inv_on_order + FROM tbl_item + LEFT JOIN tbl_mesh + ON ( tbl_item.id = tbl_mesh.item_id ) + JOIN tbl_gl_account AS sales_desc + ON ( tbl_item.sales_gl_account = sales_desc.account_id ) + JOIN tbl_gl_account AS inv_desc + ON ( tbl_item.inventory_gl_account = inv_desc.account_id ) + JOIN tbl_gl_account AS cogs_desc + ON ( tbl_item.cogs_gl_account = cogs_desc.account_id ) + LEFT JOIN tbl_current + ON ( tbl_item.id = tbl_current.item_id ) + ORDER BY tbl_item.id; + + +Sort (cost=5749.75..5758.98 rows=3691 width=333) (actual +time=154.923..156.070 rows=1906 loops=1) + Sort Key: tbl_item.id + -> Hash Left Join (cost=2542.56..5194.32 rows=3691 width=333) (actual +time=30.475..146.074 rows=1906 loops=1) + Hash Cond: (("outer".id)::text = ("inner".item_id)::text) + -> Hash Join (cost=15.85..366.14 rows=3691 width=313) (actual +time=2.292..82.281 rows=1906 loops=1) + Hash Cond: (("outer".sales_gl_account)::text = +("inner".account_id)::text) + -> Hash Join (cost=11.18..305.81 rows=3749 width=290) (actual +time=1.632..61.052 rows=1906 loops=1) + Hash Cond: (("outer".cogs_gl_account)::text = +("inner".account_id)::text) + -> Hash Join (cost=6.50..244.60 rows=3808 width=267) +(actual time=1.034..40.873 rows=1906 loops=1) + Hash Cond: (("outer".inventory_gl_account)::text = +("inner".account_id)::text) + -> Hash Left Join (cost=1.82..182.50 rows=3868 +width=244) (actual time=0.407..20.878 rows=1936 loops=1) + Hash Cond: (("outer".id)::text = +("inner".item_id)::text) + -> Seq Scan on tbl_item (cost=0.00..160.68 +rows=3868 width=224) (actual time=0.131..5.022 rows=1936 loops=1) + -> Hash (cost=1.66..1.66 rows=66 width=34) +(actual time=0.236..0.236 rows=0 loops=1) + -> Seq Scan on tbl_mesh +(cost=0.00..1.66 rows=66 width=34) (actual time=0.031..0.149 rows=66 loops=1) + -> Hash (cost=4.14..4.14 rows=214 width=32) +(actual time=0.573..0.573 rows=0 loops=1) + -> Seq Scan on tbl_gl_account inv_desc +(cost=0.00..4.14 rows=214 width=32) (actual time=0.005..0.317 rows=214 loops=1) + -> Hash (cost=4.14..4.14 rows=214 width=32) (actual +time=0.556..0.556 rows=0 loops=1) + -> Seq Scan on tbl_gl_account cogs_desc +(cost=0.00..4.14 rows=214 width=32) (actual time=0.005..0.294 rows=214 loops=1) + -> Hash (cost=4.14..4.14 rows=214 width=32) (actual +time=0.603..0.603 rows=0 loops=1) + -> Seq Scan on tbl_gl_account sales_desc +(cost=0.00..4.14 rows=214 width=32) (actual time=0.031..0.343 rows=214 loops=1) + -> Hash (cost=1775.57..1775.57 rows=76457 width=31) (actual +time=26.114..26.114 rows=0 loops=1) + -> Seq Scan on tbl_current (cost=0.00..1775.57 rows=76457 +width=31) (actual time=22.870..25.024 rows=605 loops=1) +Total runtime: 158.053 ms + + +Kind Regards, +Keith + +From pgsql-performance-owner@postgresql.org Thu Apr 7 15:20:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3984C539AA; + Thu, 7 Apr 2005 15:20:32 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89949-01; Thu, 7 Apr 2005 14:20:20 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 543DE52808; + Thu, 7 Apr 2005 15:20:19 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j37EKOKs016908; + Thu, 7 Apr 2005 10:20:24 -0400 (EDT) +To: Bruno Wolff III +Cc: Arjen van der Meijden , + pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple + query seems to be very inefficient) +In-reply-to: <20050407143120.GA29575@wolff.to> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050407143120.GA29575@wolff.to> +Comments: In-reply-to Bruno Wolff III + message dated "Thu, 07 Apr 2005 09:31:20 -0500" +Date: Thu, 07 Apr 2005 10:20:24 -0400 +Message-ID: <16907.1112883624@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/154 +X-Sequence-Number: 11551 + +Bruno Wolff III writes: +> Tom Lane wrote: +>> Can anyone suggest a more general rule? + +> I think it makes sense to guess that a smaller fraction of the rows will +> be returned when a column value is bounded above and below than if it +> is only bounded on one side, even if the bounds aren't fixed. You can +> certainly be wrong. + +Yeah, the whole thing is only a heuristic anyway. I've been coming +around to the view that relation membership shouldn't matter, because +of cases like + + WHERE a.x > b.y AND a.x < 42 + +which surely should be taken as a range constraint. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 15:14:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F05A3539DB + for ; + Thu, 7 Apr 2005 15:14:31 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85438-06 + for ; + Thu, 7 Apr 2005 14:14:22 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 93015539C8 + for ; + Thu, 7 Apr 2005 15:14:20 +0100 (BST) +Received: (qmail 29885 invoked by uid 500); 7 Apr 2005 14:31:20 -0000 +Date: Thu, 7 Apr 2005 09:31:20 -0500 +From: Bruno Wolff III +To: Tom Lane +Cc: Arjen van der Meijden , + pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple + query seems to be very inefficient) +Message-ID: <20050407143120.GA29575@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Tom Lane , + Arjen van der Meijden , + pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <6326.1112825377@sss.pgh.pa.us> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/152 +X-Sequence-Number: 11549 + +On Wed, Apr 06, 2005 at 18:09:37 -0400, + Tom Lane wrote: +> +> Can anyone suggest a more general rule? Do we need for example to +> consider whether the relation membership is the same in two clauses +> that might be opposite sides of a range restriction? It seems like +> +> a.x > b.y AND a.x < b.z +> +> probably can be treated as a range restriction on a.x for this purpose, +> but I'm much less sure that the same is true of +> +> a.x > b.y AND a.x < c.z +> +> Thoughts? + +I think it makes sense to guess that a smaller fraction of the rows will +be returned when a column value is bounded above and below than if it +is only bounded on one side, even if the bounds aren't fixed. You can +certainly be wrong. The difference between this and the normal case is that +column statistics aren't normally going to be that useful. + +If date/time ranges are the common use for this construct, it might be better +to create date and/or time range types that use rtree or gist indexes. + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:13:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D827253239 + for ; + Thu, 7 Apr 2005 16:13:52 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05825-04 + for ; + Thu, 7 Apr 2005 15:13:50 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 22E24537F0 + for ; + Thu, 7 Apr 2005 16:13:47 +0100 (BST) +Received: from jfradkin ([66.15.127.235]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEL0078Z0YX8L5B@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 07 Apr 2005 10:13:46 -0500 (CDT) +Date: Thu, 07 Apr 2005 11:13:57 -0400 +From: "Joel Fradkin" +Subject: Any way to speed this up? +To: "PostgreSQL Perform" +Message-id: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: multipart/alternative; + boundary="----=_NextPart_000_0054_01C53B62.E47258A0" +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.413 tagged_above=0 required=5 tests=AWL, + HTML_MESSAGE +X-Spam-Level: * +X-Archive-Number: 200504/155 +X-Sequence-Number: 11552 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0054_01C53B62.E47258A0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +Running this explain on windows box, but production on linux both 8.0.1 + +The MSSQL is beating me out for some reason on this query. + +The linux box is much more powerful, I may have to increase the cache, = +but I +am pretty sure its not an issue yet. + +It has 8 gig internal memory any recommendation on the cache size to = +use? + +=20 + +explain analyze select * from viwassoclist where clientnum =3D 'SAKS' + +=20 + +"Merge Join (cost=3D59871.79..60855.42 rows=3D7934 width=3D112) (actual +time=3D46906.000..48217.000 rows=3D159959 loops=3D1)" + +" Merge Cond: ("outer".locationid =3D "inner".locationid)" + +" -> Sort (cost=3D393.76..394.61 rows=3D338 width=3D48) (actual +time=3D62.000..62.000 rows=3D441 loops=3D1)" + +" Sort Key: l.locationid" + +" -> Index Scan using ix_location on tbllocation l +(cost=3D0.00..379.56 rows=3D338 width=3D48) (actual = +time=3D15.000..62.000 rows=3D441 +loops=3D1)" + +" Index Cond: ('SAKS'::text =3D (clientnum)::text)" + +" -> Sort (cost=3D59478.03..59909.58 rows=3D172618 width=3D75) = +(actual +time=3D46844.000..46985.000 rows=3D159960 loops=3D1)" + +" Sort Key: a.locationid" + +" -> Merge Right Join (cost=3D0.00..39739.84 rows=3D172618 = +width=3D75) +(actual time=3D250.000..43657.000 rows=3D176431 loops=3D1)" + +" Merge Cond: ((("outer".clientnum)::text =3D +("inner".clientnum)::text) AND ("outer".id =3D "inner".jobtitleid))" + +" -> Index Scan using ix_tbljobtitle_id on tbljobtitle jt +(cost=3D0.00..194.63 rows=3D6391 width=3D37) (actual = +time=3D32.000..313.000 +rows=3D5689 loops=3D1)" + +" Filter: (1 =3D presentationid)" + +" -> Index Scan using ix_tblassoc_jobtitleid on = +tblassociate a +(cost=3D0.00..38218.08 rows=3D172618 width=3D53) (actual = +time=3D31.000..41876.000 +rows=3D176431 loops=3D1)" + +" Index Cond: ((clientnum)::text =3D 'SAKS'::text)" + +"Total runtime: 48500.000 ms" + +=20 + +CREATE OR REPLACE VIEW viwassoclist AS=20 + + SELECT a.clientnum, a.associateid, a.associatenum, a.lastname, = +a.firstname, +jt.value AS jobtitle, l.name AS "location", l.locationid AS = +mainlocationid, +l.divisionid, l.regionid, l.districtid, (a.lastname::text || ', '::text) = +|| +a.firstname::text AS assocname, a.isactive, a.isdeleted + + FROM tblassociate a + + LEFT JOIN tbljobtitle jt ON a.jobtitleid =3D jt.id AND = +jt.clientnum::text =3D +a.clientnum::text AND 1 =3D jt.presentationid + + JOIN tbllocation l ON a.locationid =3D l.locationid AND = +l.clientnum::text =3D +a.clientnum::text; + +=20 + +=20 + +CREATE TABLE tblassociate + +( + + clientnum varchar(16) NOT NULL, + + associateid int4 NOT NULL, + + associatenum varchar(10), + + firstname varchar(50), + + middleinit varchar(5), + + lastname varchar(50), + + ssn varchar(18), + + dob timestamp, + + address varchar(100), + + city varchar(50), + + state varchar(50), + + country varchar(50), + + zip varchar(10), + + homephone varchar(14), + + cellphone varchar(14), + + pager varchar(14), + + associateaccount varchar(50), + + doh timestamp, + + dot timestamp, + + rehiredate timestamp, + + lastdayworked timestamp, + + staffexecid int4, + + jobtitleid int4, + + locationid int4, + + deptid int4, + + positionnum int4, + + worktypeid int4, + + sexid int4, + + maritalstatusid int4, + + ethnicityid int4, + + weight float8, + + heightfeet int4, + + heightinches int4, + + haircolorid int4, + + eyecolorid int4, + + isonalarmlist bool NOT NULL DEFAULT false, + + isactive bool NOT NULL DEFAULT true, + + ismanager bool NOT NULL DEFAULT false, + + issecurity bool NOT NULL DEFAULT false, + + createdbyid int4, + + isdeleted bool NOT NULL DEFAULT false, + + militarybranchid int4, + + militarystatusid int4, + + patrontypeid int4, + + identificationtypeid int4, + + workaddress varchar(200), + + testtypeid int4, + + testscore int4, + + pin int4, + + county varchar(50), + + CONSTRAINT pk_tblassociate PRIMARY KEY (clientnum, associateid), + + CONSTRAINT ix_tblassociate UNIQUE (clientnum, associatenum) + +) + +=20 + +CREATE TABLE tbljobtitle + +( + + clientnum varchar(16) NOT NULL, + + id int4 NOT NULL, + + value varchar(50), + + code varchar(16), + + isdeleted bool DEFAULT false, + + presentationid int4 NOT NULL DEFAULT 1, + + CONSTRAINT pk_tbljobtitle PRIMARY KEY (clientnum, id, presentationid) + +) + +=20 + +CREATE TABLE tbllocation + +( + + clientnum varchar(16) NOT NULL, + + locationid int4 NOT NULL, + + districtid int4 NOT NULL, + + regionid int4 NOT NULL, + + divisionid int4 NOT NULL, + + locationnum varchar(8), + + name varchar(50), + + clientlocnum varchar(50), + + address varchar(100), + + address2 varchar(100), + + city varchar(50), + + state varchar(2) NOT NULL DEFAULT 'zz'::character varying, + + zip varchar(10), + + countryid int4, + + phone varchar(15), + + fax varchar(15), + + payname varchar(40), + + contact char(36), + + active bool NOT NULL DEFAULT true, + + coiprogram text, + + coilimit text, + + coiuser varchar(255), + + coidatetime varchar(32), + + ec_note_field varchar(1050), + + locationtypeid int4, + + open_time timestamp, + + close_time timestamp, + + insurance_loc_id varchar(50), + + lpregionid int4, + + sic int4, + + CONSTRAINT pk_tbllocation PRIMARY KEY (clientnum, locationid), + + CONSTRAINT ix_tbllocation_1 UNIQUE (clientnum, locationnum, name), + + CONSTRAINT ix_tbllocation_unique_number UNIQUE (clientnum, divisionid, +regionid, districtid, locationnum) + +) + +=20 + +Joel Fradkin + +=20 + +=20 + + +------=_NextPart_000_0054_01C53B62.E47258A0 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + + + +
+ +

Running this explain on windows box, but production = +on linux +both 8.0.1

+ +

The MSSQL is beating me out for some reason on this = +query.

+ +

The linux box is much more powerful, I may have to = +increase +the cache, but I am pretty sure its not an issue yet.

+ +

It has 8 gig internal memory any recommendation on = +the cache +size to use?

+ +

 

+ +

explain analyze select * from viwassoclist where = +clientnum =3D +'SAKS'

+ +

 

+ +

"Merge Join  (cost=3D59871.79..60855.42 = +rows=3D7934 +width=3D112) (actual time=3D46906.000..48217.000 rows=3D159959 = +loops=3D1)"

+ +

"  Merge Cond: = +("outer".locationid =3D +"inner".locationid)"

+ +

"  ->  Sort  = +(cost=3D393.76..394.61 +rows=3D338 width=3D48) (actual time=3D62.000..62.000 rows=3D441 = +loops=3D1)"

+ +

"        Sort = +Key: l.locationid"

+ +

"        = +->  +Index Scan using ix_location on tbllocation l  (cost=3D0.00..379.56 = +rows=3D338 +width=3D48) (actual time=3D15.000..62.000 rows=3D441 = +loops=3D1)"

+ +

"        = +      +Index Cond: ('SAKS'::text =3D (clientnum)::text)"

+ +

"  ->  Sort  = +(cost=3D59478.03..59909.58 +rows=3D172618 width=3D75) (actual time=3D46844.000..46985.000 = +rows=3D159960 +loops=3D1)"

+ +

"        Sort = +Key: a.locationid"

+ +

"        = +->  +Merge Right Join  (cost=3D0.00..39739.84 rows=3D172618 width=3D75) = +(actual +time=3D250.000..43657.000 rows=3D176431 = +loops=3D1)"

+ +

"        = +      +Merge Cond: ((("outer".clientnum)::text =3D = +("inner".clientnum)::text) +AND ("outer".id =3D = +"inner".jobtitleid))"

+ +

"        = +      +->  Index Scan using ix_tbljobtitle_id on tbljobtitle jt  +(cost=3D0.00..194.63 rows=3D6391 width=3D37) (actual = +time=3D32.000..313.000 rows=3D5689 +loops=3D1)"

+ +

"        = +            +Filter: (1 =3D presentationid)"

+ +

"        = +      +->  Index Scan using ix_tblassoc_jobtitleid on tblassociate = +a  +(cost=3D0.00..38218.08 rows=3D172618 width=3D53) (actual = +time=3D31.000..41876.000 rows=3D176431 +loops=3D1)"

+ +

"        = +            +Index Cond: ((clientnum)::text =3D 'SAKS'::text)"

+ +

"Total runtime: 48500.000 = +ms"

+ +

 

+ +

CREATE OR REPLACE VIEW viwassoclist AS = +

+ +

 SELECT a.clientnum, a.associateid, = +a.associatenum, a.lastname, +a.firstname, jt.value AS jobtitle, l.name AS "location", = +l.locationid +AS mainlocationid, l.divisionid, l.regionid, l.districtid, = +(a.lastname::text || +', '::text) || a.firstname::text AS assocname, a.isactive, = +a.isdeleted

+ +

   FROM tblassociate a

+ +

   LEFT JOIN tbljobtitle jt ON a.jobtitleid = +=3D jt.id +AND jt.clientnum::text =3D a.clientnum::text AND 1 =3D = +jt.presentationid

+ +

   JOIN tbllocation l ON a.locationid =3D = +l.locationid +AND l.clientnum::text =3D a.clientnum::text;

+ +

 

+ +

 

+ +

CREATE TABLE tblassociate

+ +

(

+ +

  clientnum varchar(16) NOT = +NULL,

+ +

  associateid int4 NOT NULL,

+ +

  associatenum varchar(10),

+ +

  firstname varchar(50),

+ +

  middleinit varchar(5),

+ +

  lastname varchar(50),

+ +

  ssn varchar(18),

+ +

  dob timestamp,

+ +

  address varchar(100),

+ +

  city varchar(50),

+ +

  state varchar(50),

+ +

  country varchar(50),

+ +

  zip varchar(10),

+ +

  homephone varchar(14),

+ +

  cellphone varchar(14),

+ +

  pager varchar(14),

+ +

  associateaccount = +varchar(50),

+ +

  doh timestamp,

+ +

  dot timestamp,

+ +

  rehiredate timestamp,

+ +

  lastdayworked timestamp,

+ +

  staffexecid int4,

+ +

  jobtitleid int4,

+ +

  locationid int4,

+ +

  deptid int4,

+ +

  positionnum int4,

+ +

  worktypeid int4,

+ +

  sexid int4,

+ +

  maritalstatusid int4,

+ +

  ethnicityid int4,

+ +

  weight float8,

+ +

  heightfeet int4,

+ +

  heightinches int4,

+ +

  haircolorid int4,

+ +

  eyecolorid int4,

+ +

  isonalarmlist bool NOT NULL DEFAULT = +false,

+ +

  isactive bool NOT NULL DEFAULT = +true,

+ +

  ismanager bool NOT NULL DEFAULT = +false,

+ +

  issecurity bool NOT NULL DEFAULT = +false,

+ +

  createdbyid int4,

+ +

  isdeleted bool NOT NULL DEFAULT = +false,

+ +

  militarybranchid int4,

+ +

  militarystatusid int4,

+ +

  patrontypeid int4,

+ +

  identificationtypeid int4,

+ +

  workaddress varchar(200),

+ +

  testtypeid int4,

+ +

  testscore int4,

+ +

  pin int4,

+ +

  county = +varchar(50),

+ +

  CONSTRAINT pk_tblassociate PRIMARY KEY = +(clientnum, associateid),

+ +

  CONSTRAINT ix_tblassociate UNIQUE (clientnum, = +associatenum)

+ +

)

+ +

 

+ +

CREATE TABLE tbljobtitle

+ +

(

+ +

  clientnum varchar(16) NOT = +NULL,

+ +

  id int4 NOT NULL,

+ +

  value varchar(50),

+ +

  code varchar(16),

+ +

  isdeleted bool DEFAULT = +false,

+ +

  presentationid int4 NOT NULL DEFAULT = +1,

+ +

  CONSTRAINT pk_tbljobtitle PRIMARY KEY = +(clientnum, id, +presentationid)

+ +

)

+ +

 

+ +

CREATE TABLE tbllocation

+ +

(

+ +

  clientnum varchar(16) NOT = +NULL,

+ +

  locationid int4 NOT NULL,

+ +

  districtid int4 NOT NULL,

+ +

  regionid int4 NOT NULL,

+ +

  divisionid int4 NOT NULL,

+ +

  locationnum varchar(8),

+ +

  name varchar(50),

+ +

  clientlocnum varchar(50),

+ +

  address varchar(100),

+ +

  address2 varchar(100),

+ +

  city varchar(50),

+ +

  state varchar(2) NOT NULL DEFAULT = +'zz'::character +varying,

+ +

  zip varchar(10),

+ +

  countryid int4,

+ +

  phone varchar(15),

+ +

  fax varchar(15),

+ +

  payname varchar(40),

+ +

  contact char(36),

+ +

  active bool NOT NULL DEFAULT = +true,

+ +

  coiprogram text,

+ +

  coilimit text,

+ +

  coiuser varchar(255),

+ +

  coidatetime varchar(32),

+ +

  ec_note_field varchar(1050),

+ +

  locationtypeid int4,

+ +

  open_time timestamp,

+ +

  close_time timestamp,

+ +

  insurance_loc_id = +varchar(50),

+ +

  lpregionid int4,

+ +

  sic int4,

+ +

  CONSTRAINT pk_tbllocation PRIMARY KEY = +(clientnum, locationid),

+ +

  CONSTRAINT ix_tbllocation_1 UNIQUE (clientnum, = +locationnum, +name),

+ +

  CONSTRAINT ix_tbllocation_unique_number UNIQUE = +(clientnum, +divisionid, regionid, districtid, locationnum)

+ +

)

+ +

 

+ +

Joel Fradkin

+ +
+ +

 

+ +
+ +

 

+ +
+ + + + + +------=_NextPart_000_0054_01C53B62.E47258A0-- + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:22:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4A62E53A6E + for ; + Thu, 7 Apr 2005 16:22:33 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07803-10 + for ; + Thu, 7 Apr 2005 15:22:30 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 51A7B53A5C + for ; + Thu, 7 Apr 2005 16:22:29 +0100 (BST) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j37FMBlQ021274 + for ; Thu, 7 Apr 2005 15:22:15 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j37FMBtJ021268; + Thu, 7 Apr 2005 15:22:11 GMT +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Building postmaster with Profiling Support WAS "Tweaking a C Function + I wrote" +Date: Thu, 7 Apr 2005 15:21:32 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Building postmaster with Profiling Support WAS "Tweaking a C + Function I wrote" +Thread-Index: AcU6/+8yrSWz+vqKSJyA9fp2IY8n/AAhSWzw +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.223 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/156 +X-Sequence-Number: 11553 + +Adam -=20 + +Is compiling postmaster with profiling support just a flag +in the build/make? Or is there something more involved?=20 + +I'd like to be able to do this in the future and so am +curious about means/methods.=20 + +If this is a RTFM, just let me know that (am currently=20 +Reading The F Manual), but if you have any "special sauce" +here, that'd be of great interest.=20 + +Thanks + +-Ross + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Adam = +Palmblad +Sent: Wednesday, April 06, 2005 7:23 PM +To: pgsql-performance@postgresql.org +Subject: [PERFORM] Tweaking a C Function I wrote + + +I wanted to see if I could squeeze any more performance out of a C set=20 +returning function I wrote. As such, I looked to a profiler. Is it=20 +possible to get profile information on the function I wrote? I've got=20 +postmaster and my function compiled with profiling support, and can find = + +the gmon.out files... can I actually look at the call tree that occurs=20 +when my function is being executed or will I be limited to viewing calls = + +to functions in the postmaster binary? + +-Adam + + +---------------------------(end of broadcast)--------------------------- +TIP 3: if posting/reading through Usenet, please send an appropriate + subscribe-nomail command to majordomo@postgresql.org so that your + message can get through to the mailing list cleanly + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:27:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E059653A99 + for ; + Thu, 7 Apr 2005 16:27:06 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11535-02 + for ; + Thu, 7 Apr 2005 15:27:05 +0000 (GMT) +Received: from mail.99main.com (mail.99main.com [208.28.184.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 74C6353A7E + for ; + Thu, 7 Apr 2005 16:27:04 +0100 (BST) +Received: from 99main.com (localhost [127.0.0.1]) + by mail.99main.com (8.12.8+Sun/8.12.8) with ESMTP id j37FR3jj012087; + Thu, 7 Apr 2005 11:27:03 -0400 (EDT) +From: "Keith Worthington" +To: "Joel Fradkin" +Cc: "PostgreSQL Perform" +Reply-To: KeithW@narrowpathinc.com +Subject: Re: Any way to speed this up? +Date: Thu, 7 Apr 2005 11:27:03 -0400 +Message-Id: <20050407152150.M93433@narrowpathinc.com> +In-Reply-To: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> +References: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> +X-Mailer: Open WebMail 2.50 20050106 +X-OriginatingIP: 68.235.22.242 (npkeithw) +MIME-Version: 1.0 +Content-Type: text/plain; + charset=iso-8859-1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/157 +X-Sequence-Number: 11554 + +On Thu, 07 Apr 2005 11:13:57 -0400, Joel Fradkin wrote +[snip] +> " -> Sort (cost=393.76..394.61 rows=338 width=48) (actual +> time=62.000..62.000 rows=441 loops=1)" +> +> " Sort Key: l.locationid" +> +> " -> Index Scan using ix_location on tbllocation l +> +> (cost=0.00..379.56 rows=338 width=48) (actual time=15.000..62.000 rows=441 +> loops=1)" +> +> " Index Cond: ('SAKS'::text = (clientnum)::text)" +> +> " -> Sort (cost=59478.03..59909.58 rows=172618 width=75) (actual +> time=46844.000..46985.000 rows=159960 loops=1)" +> +> " Sort Key: a.locationid" +[snip] +> +> CREATE TABLE tblassociate +[snip] +> +> CONSTRAINT pk_tblassociate PRIMARY KEY (clientnum, associateid), +> +> CONSTRAINT ix_tblassociate UNIQUE (clientnum, associatenum) +> +[snip] +> +> Joel Fradkin + +Joel, + +I am REALLY new at this and struggling to understand EXPLAIN ANALYZE output +but for what it is worth it looks like the sort on a.locationid is taking up a +lot of the time. I do not see an index on that column. I would suggest +indexing tblassociate.locationid and seeing if that helps. + +Kind Regards, +Keith + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:37:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D5E653A82 + for ; + Thu, 7 Apr 2005 16:37:01 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14205-03 + for ; + Thu, 7 Apr 2005 15:36:59 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B0B553878 + for ; + Thu, 7 Apr 2005 16:36:57 +0100 (BST) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j37Fauhi012210; (envelope-from ) Thu, + 7 Apr 2005 10:36:56 -0500 (CDT) +Received: from [192.168.1.13] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j37FasSW004787 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Thu, + 7 Apr 2005 10:36:55 -0500 (CDT) +Message-ID: <42555396.40303@arbash-meinel.com> +Date: Thu, 07 Apr 2005 10:36:54 -0500 +From: John Arbash Meinel +User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: PostgreSQL Perform +Subject: Re: Any way to speed this up? +References: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> +In-Reply-To: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigE92CC557C2C75A7DCC73D018" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/158 +X-Sequence-Number: 11555 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigE92CC557C2C75A7DCC73D018 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Joel Fradkin wrote: + +> Running this explain on windows box, but production on linux both 8.0.1 +> +> The MSSQL is beating me out for some reason on this query. +> +> The linux box is much more powerful, I may have to increase the cache, +> but I am pretty sure its not an issue yet. +> +> It has 8 gig internal memory any recommendation on the cache size to use? +> +> +> +> explain analyze select * from viwassoclist where clientnum = 'SAKS' +> +> +> +> "Merge Join (cost=59871.79..60855.42 rows=7934 width=112) (actual +> time=46906.000..48217.000 rows=159959 loops=1)" +> +The first thing I noticed was this. Notice that the estimated rows is +8k, the actual rows is 160k. Which means the planner is mis-estimating +the selectivity of your merge. + +> " -> Sort (cost=59478.03..59909.58 rows=172618 width=75) (actual +> time=46844.000..46985.000 rows=159960 loops=1)" +> +> " Sort Key: a.locationid" +> + +This sort actually isn't taking very long. It starts at 46800 and runs +until 47000 so it takes < 1 second. + +> " -> Merge Right Join (cost=0.00..39739.84 rows=172618 +> width=75) (actual time=250.000..43657.000 rows=176431 loops=1)" +> +> " Merge Cond: ((("outer".clientnum)::text = +> ("inner".clientnum)::text) AND ("outer".id = "inner".jobtitleid))" +> +> " -> Index Scan using ix_tbljobtitle_id on tbljobtitle +> jt (cost=0.00..194.63 rows=6391 width=37) (actual +> time=32.000..313.000 rows=5689 loops=1)" +> +> " Filter: (1 = presentationid)" +> +> " -> Index Scan using ix_tblassoc_jobtitleid on +> tblassociate a (cost=0.00..38218.08 rows=172618 width=53) (actual +> time=31.000..41876.000 rows=176431 loops=1)" +> +> " Index Cond: ((clientnum)::text = 'SAKS'::text)" +> +This is where the actual expense is. The merge right join starts at 250, +and runs until 43000. Which seems to be caused primarily by the index +scan of tblassociate. How many rows are in tblassociate? I'm assuming +quite a bit, since the planner thinks an index scan is faster than seq +scan for 170k rows. (If you have > 2M this is probably accurate) + +I don't really know how long this should take, but 38s for 172k rows +seems a little long. + +John +=:-> + + +--------------enigE92CC557C2C75A7DCC73D018 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCVVOWJdeBCYSNAAMRAh30AJ96NXUlHGAZMzjGi5kznKLtrVwYygCeI+F5 +9OjWBaFJagb253/q9Mukqps= +=BhLL +-----END PGP SIGNATURE----- + +--------------enigE92CC557C2C75A7DCC73D018-- + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:38:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 467FB53A97; + Thu, 7 Apr 2005 16:38:43 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12473-08; Thu, 7 Apr 2005 15:38:33 +0000 (GMT) +Received: from tus-gate1.raytheon.com (tus-gate1.raytheon.com + [199.46.245.230]) + by svr1.postgresql.org (Postfix) with ESMTP id 0120853AAC; + Thu, 7 Apr 2005 16:38:32 +0100 (BST) +Received: from ds02w00.directory.ray.com (ds02w00.directory.ray.com + [147.25.146.118]) + by tus-gate1.raytheon.com (8.12.10/8.12.10) with ESMTP id + j37FcC3t023260; Thu, 7 Apr 2005 08:38:27 -0700 (MST) +Received: from ds02w00 (localhost [127.0.0.1]) + by ds02w00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j37Fc86b014888; Thu, 7 Apr 2005 15:38:08 GMT +Received: from ds02w00.directory.ray.com with LMTP by ds02w00 + (2.0.6/sieved-2-0-build-559); Thu, 7 Apr 2005 15:38:07 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02w00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j37FbZXG014600 sender Richard_D_Levine@raytheon.com; + Thu, 7 Apr 2005 15:37:39 GMT +In-Reply-To: +Subject: Re: How to improve db performance with $7K? +To: "Douglas J. Trainor" +Cc: Alex Turner , "Jim C. Nasby" , + pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org, William Yu +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Thu, 7 Apr 2005 10:37:33 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/07/2005 10:37:40 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.207 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/159 +X-Sequence-Number: 11556 + +Another simple question: Why is SCSI more expensive? After the +eleventy-millionth controller is made, it seems like SCSI and SATA are +using a controller board and a spinning disk. Is somebody still making +money by licensing SCSI technology? + +Rick + +pgsql-performance-owner@postgresql.org wrote on 04/06/2005 11:58:33 PM: + +> You asked for it! ;-) +> +> If you want cheap, get SATA. If you want fast under +> *load* conditions, get SCSI. Everything else at this +> time is marketing hype, either intentional or learned. +> Ignoring dollars, expect to see SCSI beat SATA by 40%. +> +> * * * What I tell you three times is true * * * +> +> Also, compare the warranty you get with any SATA +> drive with any SCSI drive. Yes, you still have some +> change leftover to buy more SATA drives when they +> fail, but... it fundamentally comes down to some +> actual implementation and not what is printed on +> the cardboard box. Disk systems are bound by the +> rules of queueing theory. You can hit the sales rep +> over the head with your queueing theory book. +> +> Ultra320 SCSI is king of the hill for high concurrency +> databases. If you're only streaming or serving files, +> save some money and get a bunch of SATA drives. +> But if you're reading/writing all over the disk, the +> simple first-come-first-serve SATA heuristic will +> hose your performance under load conditions. +> +> Next year, they will *try* bring out some SATA cards +> that improve on first-come-first-serve, but they ain't +> here now. There are a lot of rigged performance tests +> out there... Maybe by the time they fix the queueing +> problems, serial Attached SCSI (a/k/a SAS) will be out. +> Looks like Ultra320 is the end of the line for parallel +> SCSI, as Ultra640 SCSI (a/k/a SPI-5) is dead in the +> water. +> +> Ultra320 SCSI. +> Ultra320 SCSI. +> Ultra320 SCSI. +> +> Serial Attached SCSI. +> Serial Attached SCSI. +> Serial Attached SCSI. +> +> For future trends, see: +> http://www.incits.org/archive/2003/in031163/in031163.htm +> +> douglas +> +> p.s. For extra credit, try comparing SATA and SCSI drives +> when they're 90% full. +> +> On Apr 6, 2005, at 8:32 PM, Alex Turner wrote: +> +> > I guess I'm setting myself up here, and I'm really not being ignorant, +> > but can someone explain exactly how is SCSI is supposed to better than +> > SATA? +> > +> > Both systems use drives with platters. Each drive can physically only +> > read one thing at a time. +> > +> > SATA gives each drive it's own channel, but you have to share in SCSI. +> > A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +> > SCSI can only do 320MB/sec across the entire array. +> > +> > What am I missing here? +> > +> > Alex Turner +> > netEconomist +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if +your +> joining column's datatypes do not match + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:43:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0A85453323 + for ; + Thu, 7 Apr 2005 16:43:42 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16008-07 + for ; + Thu, 7 Apr 2005 15:43:30 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 20D7D53205 + for ; + Thu, 7 Apr 2005 16:43:29 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j37FhFhC003145; + Thu, 7 Apr 2005 11:43:18 -0400 (EDT) +To: Christopher Kings-Lynne +Cc: thanga@midascomm.com, pgsql-performance@postgresql.org +Subject: Re: help on explain analyse in psql 7.1.3 (linux) +In-reply-to: <4254E604.90006@familyhealth.com.au> +References: <1148.192.168.13.108.1112858466.squirrel@192.168.13.108> + <4254E604.90006@familyhealth.com.au> +Comments: In-reply-to Christopher Kings-Lynne + message dated "Thu, 07 Apr 2005 15:49:24 +0800" +Date: Thu, 07 Apr 2005 11:43:15 -0400 +Message-ID: <3144.1112888595@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/160 +X-Sequence-Number: 11557 + +Christopher Kings-Lynne writes: +>> I didn't find option analyse in explain command.. +>> +>> how to get time taken by SQL procedure/query? + +> Explain analyze was added in 7.2 - you really need to upgrade... + +> You can use \timing in psql to get an approximation... + +7.1 psql hasn't got \timing either ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:46:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EA32C53A99 + for ; + Thu, 7 Apr 2005 16:46:39 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16390-07 + for ; + Thu, 7 Apr 2005 15:46:37 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 66DCC53205 + for ; + Thu, 7 Apr 2005 16:46:33 +0100 (BST) +Received: by wproxy.gmail.com with SMTP id 68so650018wri + for ; + Thu, 07 Apr 2005 08:46:33 -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:references; + b=WYmQW2NLa2K1RXHTmazIXORfqPUOdLop1tuf2Vabx1XZklOYcO8MLCkkCALGI4btAMIZBnHoE3bYbLKVQBZbBag9jsg3JWIu2vlphKizwb5KAc6O/P0Dtj4MrlR09HfqjjWiNg61O1ZxKpStBnzuKAYdDH2IlpuRY2cd7ee1q+w= +Received: by 10.54.13.34 with SMTP id 34mr924106wrm; + Thu, 07 Apr 2005 08:46:32 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 7 Apr 2005 08:46:31 -0700 (PDT) +Message-ID: <33c6269f05040708464df3909a@mail.gmail.com> +Date: Thu, 7 Apr 2005 11:46:31 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: "Richard_D_Levine@raytheon.com" +Subject: Re: How to improve db performance with $7K? +Cc: "Douglas J. Trainor" , + "Jim C. Nasby" , pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org, William Yu +In-Reply-To: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.494 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP, TO_ADDRESS_EQ_REAL +X-Spam-Level: +X-Archive-Number: 200504/161 +X-Sequence-Number: 11558 + +Based on the reading I'm doing, and somebody please correct me if I'm +wrong, it seems that SCSI drives contain an on disk controller that +has to process the tagged queue. SATA-I doesn't have this. This +additional controller, is basicaly an on board computer that figures +out the best order in which to process commands. I believe you are +also paying for the increased tolerance that generates a better speed. + If you compare an 80Gig 7200RPM IDE drive to a WD Raptor 76G 10k RPM +to a Seagate 10k.6 drive to a Seagate Cheatah 15k drive, each one +represents a step up in parts and technology, thereby generating a +cost increase (at least thats what the manufactures tell us). I know +if you ever held a 15k drive in your hand, you can notice a +considerable weight difference between it and a 7200RPM IDE drive. + +Alex Turner +netEconomist + +On Apr 7, 2005 11:37 AM, Richard_D_Levine@raytheon.com + wrote: +> Another simple question: Why is SCSI more expensive? After the +> eleventy-millionth controller is made, it seems like SCSI and SATA are +> using a controller board and a spinning disk. Is somebody still making +> money by licensing SCSI technology? +> +> Rick +> +> pgsql-performance-owner@postgresql.org wrote on 04/06/2005 11:58:33 PM: +> +> > You asked for it! ;-) +> > +> > If you want cheap, get SATA. If you want fast under +> > *load* conditions, get SCSI. Everything else at this +> > time is marketing hype, either intentional or learned. +> > Ignoring dollars, expect to see SCSI beat SATA by 40%. +> > +> > * * * What I tell you three times is true * * * +> > +> > Also, compare the warranty you get with any SATA +> > drive with any SCSI drive. Yes, you still have some +> > change leftover to buy more SATA drives when they +> > fail, but... it fundamentally comes down to some +> > actual implementation and not what is printed on +> > the cardboard box. Disk systems are bound by the +> > rules of queueing theory. You can hit the sales rep +> > over the head with your queueing theory book. +> > +> > Ultra320 SCSI is king of the hill for high concurrency +> > databases. If you're only streaming or serving files, +> > save some money and get a bunch of SATA drives. +> > But if you're reading/writing all over the disk, the +> > simple first-come-first-serve SATA heuristic will +> > hose your performance under load conditions. +> > +> > Next year, they will *try* bring out some SATA cards +> > that improve on first-come-first-serve, but they ain't +> > here now. There are a lot of rigged performance tests +> > out there... Maybe by the time they fix the queueing +> > problems, serial Attached SCSI (a/k/a SAS) will be out. +> > Looks like Ultra320 is the end of the line for parallel +> > SCSI, as Ultra640 SCSI (a/k/a SPI-5) is dead in the +> > water. +> > +> > Ultra320 SCSI. +> > Ultra320 SCSI. +> > Ultra320 SCSI. +> > +> > Serial Attached SCSI. +> > Serial Attached SCSI. +> > Serial Attached SCSI. +> > +> > For future trends, see: +> > http://www.incits.org/archive/2003/in031163/in031163.htm +> > +> > douglas +> > +> > p.s. For extra credit, try comparing SATA and SCSI drives +> > when they're 90% full. +> > +> > On Apr 6, 2005, at 8:32 PM, Alex Turner wrote: +> > +> > > I guess I'm setting myself up here, and I'm really not being ignorant, +> > > but can someone explain exactly how is SCSI is supposed to better than +> > > SATA? +> > > +> > > Both systems use drives with platters. Each drive can physically only +> > > read one thing at a time. +> > > +> > > SATA gives each drive it's own channel, but you have to share in SCSI. +> > > A SATA controller typicaly can do 3Gb/sec (384MB/sec) per drive, but +> > > SCSI can only do 320MB/sec across the entire array. +> > > +> > > What am I missing here? +> > > +> > > Alex Turner +> > > netEconomist +> > +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 9: the planner will ignore your desire to choose an index scan if +> your +> > joining column's datatypes do not match +> +> + +From pgsql-performance-owner@postgresql.org Thu Apr 7 16:58:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5067053821 + for ; + Thu, 7 Apr 2005 16:58:02 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21503-02 + for ; + Thu, 7 Apr 2005 15:57:52 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B2E7537EB + for ; + Thu, 7 Apr 2005 16:57:51 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j37Fvjxn003262; + Thu, 7 Apr 2005 11:57:45 -0400 (EDT) +To: "Mohan, Ross" +Cc: pgsql-performance@postgresql.org +Subject: Re: Building postmaster with Profiling Support WAS "Tweaking a C + Function I wrote" +In-reply-to: + +References: +Comments: In-reply-to "Mohan, Ross" + message dated "Thu, 07 Apr 2005 15:21:32 -0000" +Date: Thu, 07 Apr 2005 11:57:44 -0400 +Message-ID: <3261.1112889464@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/162 +X-Sequence-Number: 11559 + +"Mohan, Ross" writes: +> Is compiling postmaster with profiling support just a flag +> in the build/make? Or is there something more involved? + +cd .../src/backend +make PROFILE="-pg -DLINUX_PROFILE" all +reinstall binary + +You don't need -DLINUX_PROFILE if not on Linux, of course. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 17:04:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B97595381A + for ; + Thu, 7 Apr 2005 17:04:41 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23310-02 + for ; + Thu, 7 Apr 2005 16:04:36 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BEE77537EB + for ; + Thu, 7 Apr 2005 17:04:35 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j37G4Yi6003304; + Thu, 7 Apr 2005 12:04:34 -0400 (EDT) +To: "Joel Fradkin" +Cc: "PostgreSQL Perform" +Subject: Re: Any way to speed this up? +In-reply-to: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> +References: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> +Comments: In-reply-to "Joel Fradkin" + message dated "Thu, 07 Apr 2005 11:13:57 -0400" +Date: Thu, 07 Apr 2005 12:04:34 -0400 +Message-ID: <3303.1112889874@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/163 +X-Sequence-Number: 11560 + +"Joel Fradkin" writes: +> Running this explain on windows box, but production on linux both 8.0.1 + +Are you using any nondefault optimizer settings? The vast bulk of the +time is going into the indexscan on tblassociate (almost 42 out of the +48 seconds), and I'm a bit surprised it didn't choose a seqscan and sort +instead. Or even more likely, forget the merge joins altogether and use +hash joins --- the other tables are plenty small enough to fit in hash +tables. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 17:14:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 69C3653AE4 + for ; + Thu, 7 Apr 2005 17:13:59 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24630-08 + for ; + Thu, 7 Apr 2005 16:13:50 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DAD453ACF + for ; + Thu, 7 Apr 2005 17:13:50 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j37GDmu8003394; + Thu, 7 Apr 2005 12:13:48 -0400 (EDT) +To: John Arbash Meinel +Cc: Joel Fradkin , + PostgreSQL Perform +Subject: Re: Any way to speed this up? +In-reply-to: <42555396.40303@arbash-meinel.com> +References: <005301c53b84$6b83f8a0$797ba8c0@jfradkin> + <42555396.40303@arbash-meinel.com> +Comments: In-reply-to John Arbash Meinel + message dated "Thu, 07 Apr 2005 10:36:54 -0500" +Date: Thu, 07 Apr 2005 12:13:48 -0400 +Message-ID: <3393.1112890428@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/164 +X-Sequence-Number: 11561 + +John Arbash Meinel writes: +>> " -> Sort (cost=59478.03..59909.58 rows=172618 width=75) (actual +>> time=46844.000..46985.000 rows=159960 loops=1)" +>> +>> " Sort Key: a.locationid" +>> + +> This sort actually isn't taking very long. It starts at 46800 and runs +> until 47000 so it takes < 1 second. + +>> " -> Merge Right Join (cost=0.00..39739.84 rows=172618 +>> width=75) (actual time=250.000..43657.000 rows=176431 loops=1)" + +You're not reading it quite right. The first "actual" number is the +time at which the first result row was delivered, which for a sort is +after the completion of (the bulk of) the sorting work. What you +really need to look at is the difference between the completion times +of the node and its immediate input(s). In this case I'd blame the +sort for 46985.000 - 43657.000 msec. + +Come to think of it, though, you should not be putting a whole lot of +trust in EXPLAIN ANALYZE numbers taken on Windows, because they are +based on gettimeofday which has absolutely awful resolution on that +platform. (There's a workaround for this in our CVS, but it's not in +8.0.*.) I think we can still conclude that the indexscan on +tblassociate is most of the cost, but I wouldn't venture to say that +it's exactly such-and-such percent. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 17:30:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 237E653A77; + Thu, 7 Apr 2005 17:30:09 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30595-09; Thu, 7 Apr 2005 16:29:58 +0000 (GMT) +Received: from bos-gate5.raytheon.com (bos-gate5.raytheon.com + [199.46.198.234]) + by svr1.postgresql.org (Postfix) with ESMTP id 283AA53B0C; + Thu, 7 Apr 2005 17:29:57 +0100 (BST) +Received: from ds02e00.directory.ray.com (ds02e00.directory.ray.com + [147.25.130.245]) + by bos-gate5.raytheon.com (8.12.10/8.12.10) with ESMTP id + j37GTlfT002126; Thu, 7 Apr 2005 12:29:52 -0400 (EDT) +Received: from ds02e00 (localhost [127.0.0.1]) + by ds02e00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j37GTeMY018642; Thu, 7 Apr 2005 16:29:41 GMT +Received: from ds02e00.directory.ray.com with LMTP by ds02e00 + (2.0.6/sieved-2-0-build-559); Thu, 7 Apr 2005 16:29:37 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02e00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j37GSVG5018247 sender Richard_D_Levine@raytheon.com; + Thu, 7 Apr 2005 16:28:31 GMT +In-Reply-To: <33c6269f05040708464df3909a@mail.gmail.com> +Subject: Re: How to improve db performance with $7K? +To: Alex Turner +Cc: "Jim C. Nasby" , pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org, + "Douglas J. Trainor" , + William Yu +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Thu, 7 Apr 2005 11:28:29 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/07/2005 11:28:32 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: base64 +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.616 tagged_above=0 required=5 tests=AWL, + MIME_BASE64_BLANKS, NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/165 +X-Sequence-Number: 11562 + +WWVwLCB0aGF0J3MgaXQsIGFzIHdlbGwgYXMgaW5jcmVhc2VkIHF1YWxpdHkgY29udHJvbC4gIEkg +Zm91bmQgdGhpcyBmcm9tDQpTZWFnYXRlOg0KDQpodHRwOi8vd3d3LnNlYWdhdGUuY29tL2NvbnRl +bnQvZG9jcy9wZGYvd2hpdGVwYXBlci9EMmNfTW9yZV90aGFuX0ludGVyZmFjZV9BVEFfdnNfU0NT +SV8wNDIwMDMucGRmDQoNCldpdGggdGhpcyBxdW90ZSAobm90ZSB0aGF0IEVTIHN0YW5kcyBmb3Ig +RW50ZXJwcmlzZSBTeXN0ZW0gYW5kIFBTIHN0YW5kcw0KZm9yIFBlcnNvbmFsIFN5c3RlbSk6DQoN +ClRoZXJlIGlzIHNpZ25pZmljYW50bHkgbW9yZSBzaWxpY29uIG9uIEVTIHByb2R1Y3RzLiBUaGUg +Zm9sbG93aW5nDQpjb21wYXJpc29uIGNvbWVzIGZyb20gYSBzdHVkeSBkb25lIGluIDIwMDA6DQrC +tyB0aGUgRVMgQVNJQyBnYXRlIGNvdW50IGlzIG1vcmUgdGhhbiAyeCBhIFBTIGRyaXZlLA0Kwrcg +dGhlIGVtYmVkZGVkIFNSQU0gc3BhY2UgZm9yIHByb2dyYW0gY29kZSBpcyAyeCwNCsK3IHRoZSBw +ZXJtYW5lbnQgZmxhc2ggbWVtb3J5IGZvciBwcm9ncmFtIGNvZGUgaXMgMngsDQrCtyBkYXRhIFNS +QU0gYW5kIGNhY2hlIFNSQU0gc3BhY2UgaXMgbW9yZSB0aGFuIDEweC4NClRoZSBjb21wbGV4aXR5 +IG9mIHRoZSBTQ1NJL0ZDIGludGVyZmFjZSBjb21wYXJlZCB0byB0aGUNCklERS9BVEEgaW50ZXJm +YWNlIHNob3dzIHVwIGhlcmUgZHVlIGluIHBhcnQgdG8gdGhlIG1vcmUNCmNvbXBsZXggc3lzdGVt +IGFyY2hpdGVjdHVyZXMgaW4gd2hpY2ggRVMgZHJpdmVzIGZpbmQgdGhlbXNlbHZlcy4NCkVTIGlu +dGVyZmFjZXMgc3VwcG9ydCBtdWx0aXBsZSBpbml0aWF0b3JzIG9yIGhvc3RzLiBUaGUNCmRyaXZl +IG11c3Qga2VlcCB0cmFjayBvZiBzZXBhcmF0ZSBzZXRzIG9mIGluZm9ybWF0aW9uIGZvciBlYWNo +DQpob3N0IHRvIHdoaWNoIGl0IGlzIGF0dGFjaGVkLCBlLmcuLCBtYWludGFpbmluZyB0aGUgcHJv +Y2Vzc29yDQpwb2ludGVyIHNldHMgZm9yIG11bHRpcGxlIGluaXRpYXRvcnMgYW5kIHRhZ2dlZCBj +b21tYW5kcy4NClRoZSBjYXBhYmlsaXR5IG9mIFNDU0kvRkMgdG8gZWZmaWNpZW50bHkgcHJvY2Vz +cyBjb21tYW5kcw0KYW5kIHRhc2tzIGluIHBhcmFsbGVsIGhhcyBhbHNvIHJlc3VsdGVkIGluIGEg +aGlnaGVyIG92ZXJoZWFkDQrigJxrZXJuZWzigJ0gc3RydWN0dXJlIGZvciB0aGUgZmlybXdhcmUu +IEFsbCBvZiB0aGVzZSBjb21wbGV4aXRpZXMNCmFuZCBhbiBvdmVyYWxsIHJpY2hlciBjb21tYW5k +IHNldCByZXN1bHQgaW4gdGhlIG5lZWQgZm9yIGENCm1vcmUgZXhwZW5zaXZlIFBDQiB0byBjYXJy +eSB0aGUgZWxlY3Ryb25pY3MuDQoNClJpY2sNCg0KQWxleCBUdXJuZXIgPGFybXR1a0BnbWFpbC5j +b20+IHdyb3RlIG9uIDA0LzA3LzIwMDUgMTA6NDY6MzEgQU06DQoNCj4gQmFzZWQgb24gdGhlIHJl +YWRpbmcgSSdtIGRvaW5nLCBhbmQgc29tZWJvZHkgcGxlYXNlIGNvcnJlY3QgbWUgaWYgSSdtDQo+ +IHdyb25nLCBpdCBzZWVtcyB0aGF0IFNDU0kgZHJpdmVzIGNvbnRhaW4gYW4gb24gZGlzayBjb250 +cm9sbGVyIHRoYXQNCj4gaGFzIHRvIHByb2Nlc3MgdGhlIHRhZ2dlZCBxdWV1ZS4gIFNBVEEtSSBk +b2Vzbid0IGhhdmUgdGhpcy4gIFRoaXMNCj4gYWRkaXRpb25hbCBjb250cm9sbGVyLCBpcyBiYXNp +Y2FseSBhbiBvbiBib2FyZCBjb21wdXRlciB0aGF0IGZpZ3VyZXMNCj4gb3V0IHRoZSBiZXN0IG9y +ZGVyIGluIHdoaWNoIHRvIHByb2Nlc3MgY29tbWFuZHMuICBJIGJlbGlldmUgeW91IGFyZQ0KPiBh +bHNvIHBheWluZyBmb3IgdGhlIGluY3JlYXNlZCB0b2xlcmFuY2UgdGhhdCBnZW5lcmF0ZXMgYSBi +ZXR0ZXIgc3BlZWQuDQo+ICBJZiB5b3UgY29tcGFyZSBhbiA4MEdpZyA3MjAwUlBNIElERSBkcml2 +ZSB0byBhIFdEIFJhcHRvciA3NkcgMTBrIFJQTQ0KPiB0byBhIFNlYWdhdGUgMTBrLjYgZHJpdmUg +dG8gYSBTZWFnYXRlIENoZWF0YWggMTVrIGRyaXZlLCBlYWNoIG9uZQ0KPiByZXByZXNlbnRzIGEg +c3RlcCB1cCBpbiBwYXJ0cyBhbmQgdGVjaG5vbG9neSwgdGhlcmVieSBnZW5lcmF0aW5nIGENCj4g +Y29zdCBpbmNyZWFzZSAoYXQgbGVhc3QgdGhhdHMgd2hhdCB0aGUgbWFudWZhY3R1cmVzIHRlbGwg +dXMpLiAgSSBrbm93DQo+IGlmIHlvdSBldmVyIGhlbGQgYSAxNWsgZHJpdmUgaW4geW91ciBoYW5k +LCB5b3UgY2FuIG5vdGljZSBhDQo+IGNvbnNpZGVyYWJsZSB3ZWlnaHQgZGlmZmVyZW5jZSBiZXR3 +ZWVuIGl0IGFuZCBhIDcyMDBSUE0gSURFIGRyaXZlLg0KPg0KPiBBbGV4IFR1cm5lcg0KPiBuZXRF +Y29ub21pc3QNCj4NCj4gT24gQXByIDcsIDIwMDUgMTE6MzcgQU0sIFJpY2hhcmRfRF9MZXZpbmVA +cmF5dGhlb24uY29tDQo+IDxSaWNoYXJkX0RfTGV2aW5lQHJheXRoZW9uLmNvbT4gd3JvdGU6DQo+ +ID4gQW5vdGhlciBzaW1wbGUgcXVlc3Rpb246IFdoeSBpcyBTQ1NJIG1vcmUgZXhwZW5zaXZlPyAg +QWZ0ZXIgdGhlDQo+ID4gZWxldmVudHktbWlsbGlvbnRoIGNvbnRyb2xsZXIgaXMgbWFkZSwgaXQg +c2VlbXMgbGlrZSBTQ1NJIGFuZCBTQVRBIGFyZQ0KPiA+IHVzaW5nIGEgY29udHJvbGxlciBib2Fy +ZCBhbmQgYSBzcGlubmluZyBkaXNrLiAgSXMgc29tZWJvZHkgc3RpbGwgbWFraW5nDQo+ID4gbW9u +ZXkgYnkgbGljZW5zaW5nIFNDU0kgdGVjaG5vbG9neT8NCj4gPg0KPiA+IFJpY2sNCj4gPg0KPiA+ +IHBnc3FsLXBlcmZvcm1hbmNlLW93bmVyQHBvc3RncmVzcWwub3JnIHdyb3RlIG9uIDA0LzA2LzIw +MDUgMTE6NTg6MzMgUE06DQo+ID4NCj4gPiA+IFlvdSBhc2tlZCBmb3IgaXQhICA7LSkNCj4gPiA+ +DQo+ID4gPiBJZiB5b3Ugd2FudCBjaGVhcCwgZ2V0IFNBVEEuICBJZiB5b3Ugd2FudCBmYXN0IHVu +ZGVyDQo+ID4gPiAqbG9hZCogY29uZGl0aW9ucywgZ2V0IFNDU0kuICBFdmVyeXRoaW5nIGVsc2Ug +YXQgdGhpcw0KPiA+ID4gdGltZSBpcyBtYXJrZXRpbmcgaHlwZSwgZWl0aGVyIGludGVudGlvbmFs +IG9yIGxlYXJuZWQuDQo+ID4gPiBJZ25vcmluZyBkb2xsYXJzLCBleHBlY3QgdG8gc2VlIFNDU0kg +YmVhdCBTQVRBIGJ5IDQwJS4NCj4gPiA+DQo+ID4gPiAgICAgICogKiAqIFdoYXQgSSB0ZWxsIHlv +dSB0aHJlZSB0aW1lcyBpcyB0cnVlICogKiAqDQo+ID4gPg0KPiA+ID4gQWxzbywgY29tcGFyZSB0 +aGUgd2FycmFudHkgeW91IGdldCB3aXRoIGFueSBTQVRBDQo+ID4gPiBkcml2ZSB3aXRoIGFueSBT +Q1NJIGRyaXZlLiAgWWVzLCB5b3Ugc3RpbGwgaGF2ZSBzb21lDQo+ID4gPiBjaGFuZ2UgbGVmdG92 +ZXIgdG8gYnV5IG1vcmUgU0FUQSBkcml2ZXMgd2hlbiB0aGV5DQo+ID4gPiBmYWlsLCBidXQuLi4g +aXQgZnVuZGFtZW50YWxseSBjb21lcyBkb3duIHRvIHNvbWUNCj4gPiA+IGFjdHVhbCBpbXBsZW1l +bnRhdGlvbiBhbmQgbm90IHdoYXQgaXMgcHJpbnRlZCBvbg0KPiA+ID4gdGhlIGNhcmRib2FyZCBi +b3guICBEaXNrIHN5c3RlbXMgYXJlIGJvdW5kIGJ5IHRoZQ0KPiA+ID4gcnVsZXMgb2YgcXVldWVp +bmcgdGhlb3J5LiAgWW91IGNhbiBoaXQgdGhlIHNhbGVzIHJlcA0KPiA+ID4gb3ZlciB0aGUgaGVh +ZCB3aXRoIHlvdXIgcXVldWVpbmcgdGhlb3J5IGJvb2suDQo+ID4gPg0KPiA+ID4gVWx0cmEzMjAg +U0NTSSBpcyBraW5nIG9mIHRoZSBoaWxsIGZvciBoaWdoIGNvbmN1cnJlbmN5DQo+ID4gPiBkYXRh +YmFzZXMuICBJZiB5b3UncmUgb25seSBzdHJlYW1pbmcgb3Igc2VydmluZyBmaWxlcywNCj4gPiA+ +IHNhdmUgc29tZSBtb25leSBhbmQgZ2V0IGEgYnVuY2ggb2YgU0FUQSBkcml2ZXMuDQo+ID4gPiBC +dXQgaWYgeW91J3JlIHJlYWRpbmcvd3JpdGluZyBhbGwgb3ZlciB0aGUgZGlzaywgdGhlDQo+ID4g +PiBzaW1wbGUgZmlyc3QtY29tZS1maXJzdC1zZXJ2ZSBTQVRBIGhldXJpc3RpYyB3aWxsDQo+ID4g +PiBob3NlIHlvdXIgcGVyZm9ybWFuY2UgdW5kZXIgbG9hZCBjb25kaXRpb25zLg0KPiA+ID4NCj4g +PiA+IE5leHQgeWVhciwgdGhleSB3aWxsICp0cnkqIGJyaW5nIG91dCBzb21lIFNBVEEgY2FyZHMN +Cj4gPiA+IHRoYXQgaW1wcm92ZSBvbiBmaXJzdC1jb21lLWZpcnN0LXNlcnZlLCBidXQgdGhleSBh +aW4ndA0KPiA+ID4gaGVyZSBub3cuICBUaGVyZSBhcmUgYSBsb3Qgb2YgcmlnZ2VkIHBlcmZvcm1h +bmNlIHRlc3RzDQo+ID4gPiBvdXQgdGhlcmUuLi4gIE1heWJlIGJ5IHRoZSB0aW1lIHRoZXkgZml4 +IHRoZSBxdWV1ZWluZw0KPiA+ID4gcHJvYmxlbXMsIHNlcmlhbCBBdHRhY2hlZCBTQ1NJIChhL2sv +YSBTQVMpIHdpbGwgYmUgb3V0Lg0KPiA+ID4gTG9va3MgbGlrZSBVbHRyYTMyMCBpcyB0aGUgZW5k +IG9mIHRoZSBsaW5lIGZvciBwYXJhbGxlbA0KPiA+ID4gU0NTSSwgYXMgVWx0cmE2NDAgU0NTSSAo +YS9rL2EgU1BJLTUpIGlzIGRlYWQgaW4gdGhlDQo+ID4gPiB3YXRlci4NCj4gPiA+DQo+ID4gPiBV +bHRyYTMyMCBTQ1NJLg0KPiA+ID4gVWx0cmEzMjAgU0NTSS4NCj4gPiA+IFVsdHJhMzIwIFNDU0ku +DQo+ID4gPg0KPiA+ID4gU2VyaWFsIEF0dGFjaGVkIFNDU0kuDQo+ID4gPiBTZXJpYWwgQXR0YWNo +ZWQgU0NTSS4NCj4gPiA+IFNlcmlhbCBBdHRhY2hlZCBTQ1NJLg0KPiA+ID4NCj4gPiA+IEZvciBm +dXR1cmUgdHJlbmRzLCBzZWU6DQo+ID4gPiBodHRwOi8vd3d3LmluY2l0cy5vcmcvYXJjaGl2ZS8y +MDAzL2luMDMxMTYzL2luMDMxMTYzLmh0bQ0KPiA+ID4NCj4gPiA+ICAgICBkb3VnbGFzDQo+ID4g +Pg0KPiA+ID4gcC5zLiBGb3IgZXh0cmEgY3JlZGl0LCB0cnkgY29tcGFyaW5nIFNBVEEgYW5kIFND +U0kgZHJpdmVzDQo+ID4gPiB3aGVuIHRoZXkncmUgOTAlIGZ1bGwuDQo+ID4gPg0KPiA+ID4gT24g +QXByIDYsIDIwMDUsIGF0IDg6MzIgUE0sIEFsZXggVHVybmVyIHdyb3RlOg0KPiA+ID4NCj4gPiA+ +ID4gSSBndWVzcyBJJ20gc2V0dGluZyBteXNlbGYgdXAgaGVyZSwgYW5kIEknbSByZWFsbHkgbm90 +IGJlaW5nDQppZ25vcmFudCwNCj4gPiA+ID4gYnV0IGNhbiBzb21lb25lIGV4cGxhaW4gZXhhY3Rs +eSBob3cgaXMgU0NTSSBpcyBzdXBwb3NlZCB0byBiZXR0ZXINCnRoYW4NCj4gPiA+ID4gU0FUQT8N +Cj4gPiA+ID4NCj4gPiA+ID4gQm90aCBzeXN0ZW1zIHVzZSBkcml2ZXMgd2l0aCBwbGF0dGVycy4g +IEVhY2ggZHJpdmUgY2FuIHBoeXNpY2FsbHkNCm9ubHkNCj4gPiA+ID4gcmVhZCBvbmUgdGhpbmcg +YXQgYSB0aW1lLg0KPiA+ID4gPg0KPiA+ID4gPiBTQVRBIGdpdmVzIGVhY2ggZHJpdmUgaXQncyBv +d24gY2hhbm5lbCwgYnV0IHlvdSBoYXZlIHRvIHNoYXJlIGluDQpTQ1NJLg0KPiA+ID4gPiAgQSBT +QVRBIGNvbnRyb2xsZXIgdHlwaWNhbHkgY2FuIGRvIDNHYi9zZWMgKDM4NE1CL3NlYykgcGVyIGRy +aXZlLA0KYnV0DQo+ID4gPiA+IFNDU0kgY2FuIG9ubHkgZG8gMzIwTUIvc2VjIGFjcm9zcyB0aGUg +ZW50aXJlIGFycmF5Lg0KPiA+ID4gPg0KPiA+ID4gPiBXaGF0IGFtIEkgbWlzc2luZyBoZXJlPw0K +PiA+ID4gPg0KPiA+ID4gPiBBbGV4IFR1cm5lcg0KPiA+ID4gPiBuZXRFY29ub21pc3QNCj4gPiA+ +DQo+ID4gPg0KPiA+ID4gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBvZg0KYnJvYWRj +YXN0KS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KPiA+ID4gVElQIDk6IHRoZSBwbGFubmVy +IHdpbGwgaWdub3JlIHlvdXIgZGVzaXJlIHRvIGNob29zZSBhbiBpbmRleCBzY2FuIGlmDQo+ID4g +eW91cg0KPiA+ID4gICAgICAgam9pbmluZyBjb2x1bW4ncyBkYXRhdHlwZXMgZG8gbm90IG1hdGNo +DQo+ID4NCj4gPg== + + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 17:33:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D4D0753B09 + for ; + Thu, 7 Apr 2005 17:33:40 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30850-09 + for ; + Thu, 7 Apr 2005 16:33:36 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E8E653AAD + for ; + Thu, 7 Apr 2005 17:33:35 +0100 (BST) +Received: from jfradkin ([66.15.127.235]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEL006IB4NYOHE5@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 07 Apr 2005 11:33:35 -0500 (CDT) +Date: Thu, 07 Apr 2005 12:33:46 -0400 +From: "Joel Fradkin" +Subject: Re: Any way to speed this up? +In-reply-to: <3303.1112889874@sss.pgh.pa.us> +To: "'Tom Lane'" +Cc: "'PostgreSQL Perform'" +Message-id: <006701c53b8f$9274fdf0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.397 tagged_above=0 required=5 tests=AWL +X-Spam-Level: * +X-Archive-Number: 200504/166 +X-Sequence-Number: 11563 + +shared_buffers =3D 8000 # min 16, at least max_connections*2, 8KB +each +work_mem =3D 8192#1024 # min 64, size in KB +max_fsm_pages =3D 30000 # min max_fsm_relations*16, 6 bytes each +effective_cache_size =3D 40000 #1000 # typically 8KB each +random_page_cost =3D 1.2#4 # units are one sequential page +fetch cost + +These are the items I changed. +In the development box I turned random page cost to .2 because I figured = +it +would all be faster using an index as all my data is at a minimum being +selected by clientnum. + +But the analyze I sent in is from these settings above on a windows box. +If I was running the analyze (pgadmin) on a windows box but connecting = +to a +linux box would the times be accurate or do I have to run the analyze on = +the +linux box for that to happen? + +I am a little unclear why I would need an index on associate by location = +as +I thought it would be using indexes in location and jobtitle for their +joins. +I did not say where locationid =3D x in my query on the view. +I have so much to learn about SQL. +Joel + + + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 17:42:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 893F45390A + for ; + Thu, 7 Apr 2005 17:42:56 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32882-10 + for ; + Thu, 7 Apr 2005 16:42:49 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 29B7453B18 + for ; + Thu, 7 Apr 2005 17:42:48 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j37GgmSf011373; + Thu, 7 Apr 2005 12:42:48 -0400 (EDT) +To: "Joel Fradkin" +Cc: "'PostgreSQL Perform'" +Subject: Re: Any way to speed this up? +In-reply-to: <006701c53b8f$9274fdf0$797ba8c0@jfradkin> +References: <006701c53b8f$9274fdf0$797ba8c0@jfradkin> +Comments: In-reply-to "Joel Fradkin" + message dated "Thu, 07 Apr 2005 12:33:46 -0400" +Date: Thu, 07 Apr 2005 12:42:48 -0400 +Message-ID: <11372.1112892168@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/167 +X-Sequence-Number: 11564 + +"Joel Fradkin" writes: +> random_page_cost = 1.2#4 # units are one sequential page +> fetch cost + +That is almost certainly overoptimistic; it's causing the planner to +use indexscans when it shouldn't. Try 2 or 3 or thereabouts. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 7 17:43:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 799D353B23 + for ; + Thu, 7 Apr 2005 17:43:11 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34794-08 + for ; + Thu, 7 Apr 2005 16:43:06 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A66353B1E + for ; + Thu, 7 Apr 2005 17:43:05 +0100 (BST) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j37Gh4N0014865; (envelope-from ) Thu, + 7 Apr 2005 11:43:04 -0500 (CDT) +Received: from [192.168.1.13] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j37Gh2G5019347 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Thu, + 7 Apr 2005 11:43:03 -0500 (CDT) +Message-ID: <42556316.8020304@arbash-meinel.com> +Date: Thu, 07 Apr 2005 11:43:02 -0500 +From: John Arbash Meinel +User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: "'Tom Lane'" , + "'PostgreSQL Perform'" +Subject: Re: Any way to speed this up? +References: <006701c53b8f$9274fdf0$797ba8c0@jfradkin> +In-Reply-To: <006701c53b8f$9274fdf0$797ba8c0@jfradkin> +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigFAEF37936593196F9C0E0057" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/168 +X-Sequence-Number: 11565 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigFAEF37936593196F9C0E0057 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Joel Fradkin wrote: + +>shared_buffers = 8000 # min 16, at least max_connections*2, 8KB +>each +>work_mem = 8192#1024 # min 64, size in KB +>max_fsm_pages = 30000 # min max_fsm_relations*16, 6 bytes each +>effective_cache_size = 40000 #1000 # typically 8KB each +>random_page_cost = 1.2#4 # units are one sequential page +>fetch cost +> +>These are the items I changed. +>In the development box I turned random page cost to .2 because I figured it +>would all be faster using an index as all my data is at a minimum being +>selected by clientnum. +> +> +You're random page cost is *way* too low. I would probably change this +to no less that 2.0. + +>But the analyze I sent in is from these settings above on a windows box. +>If I was running the analyze (pgadmin) on a windows box but connecting to a +>linux box would the times be accurate or do I have to run the analyze on the +>linux box for that to happen? +> +> +> +EXPLAIN ANALYZE is done on the server side, so it doesn't matter what +you use to connect to it. The \timing flag occurs on the local side, and +is thus influenced my network latency (but it only tells you the time +for the whole query anyway). + +>I am a little unclear why I would need an index on associate by location as +>I thought it would be using indexes in location and jobtitle for their +>joins. +>I did not say where locationid = x in my query on the view. +>I have so much to learn about SQL. +>Joel +> +> +> CREATE OR REPLACE VIEW viwassoclist AS +> SELECT a.clientnum, a.associateid, a.associatenum, a.lastname, +> a.firstname, jt.value AS jobtitle, l.name AS "location", l.locationid +> AS mainlocationid, l.divisionid, l.regionid, l.districtid, +> (a.lastname::text || ', '::text) || a.firstname::text AS assocname, +> a.isactive, a.isdeleted +> FROM tblassociate a +> LEFT JOIN tbljobtitle jt ON a.jobtitleid = jt.id AND +> jt.clientnum::text = a.clientnum::text AND 1 = jt.presentationid +> JOIN tbllocation l ON a.locationid = l.locationid AND +> l.clientnum::text = a.clientnum::text; + + ^^^^^^^^^^^^^^^^^^^ +The locationid is defined in your view. This is the part that postgres +uses to merge all of the different tables together, it doesn't really +matter whether you restrict it with a WHERE clause. + +Try just setting your random page cost back to something more +reasonable, and try again. + +John +=:-> + + +--------------enigFAEF37936593196F9C0E0057 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCVWMWJdeBCYSNAAMRAvg5AKDUdPNlUihotVedHdqIbrknuXXbRwCgiYs4 +innCXWTbezQntYi4sh/TXV0= +=G38I +-----END PGP SIGNATURE----- + +--------------enigFAEF37936593196F9C0E0057-- + +From pgsql-performance-owner@postgresql.org Thu Apr 7 18:14:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A6695398B + for ; + Thu, 7 Apr 2005 18:14:28 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45557-01 + for ; + Thu, 7 Apr 2005 17:14:22 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 9ED8F537CA + for ; + Thu, 7 Apr 2005 18:14:21 +0100 (BST) +Received: from jfradkin ([66.15.127.235]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEL007OP6JX8LGB@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 07 Apr 2005 12:14:22 -0500 (CDT) +Date: Thu, 07 Apr 2005 13:14:33 -0400 +From: "Joel Fradkin" +Subject: Re: Any way to speed this up? +In-reply-to: <11372.1112892168@sss.pgh.pa.us> +To: "'Tom Lane'" +Cc: "'PostgreSQL Perform'" +Message-id: <007b01c53b95$450c5850$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: 7bit +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.382 tagged_above=0 required=5 tests=AWL +X-Spam-Level: * +X-Archive-Number: 200504/169 +X-Sequence-Number: 11566 + +Here is the result after putting it back to 4 the original value (I had done +that prior to your suggestion of using 2 or 3) to see what might change. +I also vacummed and thought I saw records deleted in associate, which I +found odd as this is a test site and no new records were added or deleted. + +"Merge Join (cost=86788.09..87945.00 rows=10387 width=112) (actual +time=19703.000..21154.000 rows=159959 loops=1)" +" Merge Cond: ("outer".locationid = "inner".locationid)" +" -> Sort (cost=1245.50..1246.33 rows=332 width=48) (actual +time=62.000..62.000 rows=441 loops=1)" +" Sort Key: l.locationid" +" -> Index Scan using ix_location on tbllocation l +(cost=0.00..1231.60 rows=332 width=48) (actual time=15.000..62.000 rows=441 +loops=1)" +" Index Cond: ('SAKS'::text = (clientnum)::text)" +" -> Sort (cost=85542.59..86042.39 rows=199922 width=75) (actual +time=19641.000..19955.000 rows=159960 loops=1)" +" Sort Key: a.locationid" +" -> Merge Right Join (cost=60850.40..62453.22 rows=199922 +width=75) (actual time=13500.000..14734.000 rows=176431 loops=1)" +" Merge Cond: (("outer".id = "inner".jobtitleid) AND +("outer"."?column4?" = "inner"."?column10?"))" +" -> Sort (cost=554.11..570.13 rows=6409 width=37) (actual +time=94.000..94.000 rows=6391 loops=1)" +" Sort Key: jt.id, (jt.clientnum)::text" +" -> Seq Scan on tbljobtitle jt (cost=0.00..148.88 +rows=6409 width=37) (actual time=0.000..63.000 rows=6391 loops=1)" +" Filter: (1 = presentationid)" +" -> Sort (cost=60296.29..60796.09 rows=199922 width=53) +(actual time=13406.000..13859.000 rows=176431 loops=1)" +" Sort Key: a.jobtitleid, (a.clientnum)::text" +" -> Seq Scan on tblassociate a (cost=0.00..38388.79 +rows=199922 width=53) (actual time=62.000..10589.000 rows=176431 loops=1)" +" Filter: ((clientnum)::text = 'SAKS'::text)" +"Total runtime: 22843.000 ms" + +Joel Fradkin + +-----Original Message----- +From: Tom Lane [mailto:tgl@sss.pgh.pa.us] +Sent: Thursday, April 07, 2005 11:43 AM +To: Joel Fradkin +Cc: 'PostgreSQL Perform' +Subject: Re: [PERFORM] Any way to speed this up? + +"Joel Fradkin" writes: +> random_page_cost = 1.2#4 # units are one sequential page +> fetch cost + +That is almost certainly overoptimistic; it's causing the planner to +use indexscans when it shouldn't. Try 2 or 3 or thereabouts. + + regards, tom lane + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 18:22:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4E6FE53B23 + for ; + Thu, 7 Apr 2005 18:22:41 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46655-06 + for ; + Thu, 7 Apr 2005 17:22:40 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id DCAC653B31 + for ; + Thu, 7 Apr 2005 18:22:39 +0100 (BST) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j37HMd4H016647; (envelope-from ) Thu, + 7 Apr 2005 12:22:39 -0500 (CDT) +Received: from [192.168.1.13] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j37HMb5p028039 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Thu, + 7 Apr 2005 12:22:38 -0500 (CDT) +Message-ID: <42556C5D.6060106@arbash-meinel.com> +Date: Thu, 07 Apr 2005 12:22:37 -0500 +From: John Arbash Meinel +User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: "'Tom Lane'" , + "'PostgreSQL Perform'" +Subject: Re: Any way to speed this up? +References: <007b01c53b95$450c5850$797ba8c0@jfradkin> +In-Reply-To: <007b01c53b95$450c5850$797ba8c0@jfradkin> +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig241C50A43AF95B0DB9B2D161" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/170 +X-Sequence-Number: 11567 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig241C50A43AF95B0DB9B2D161 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Joel Fradkin wrote: + +>Here is the result after putting it back to 4 the original value (I had done +>that prior to your suggestion of using 2 or 3) to see what might change. +>I also vacummed and thought I saw records deleted in associate, which I +>found odd as this is a test site and no new records were added or deleted. +> +> + +Well, that looks 2x as fast, right? + +You might try +SET enable_mergejoin TO off; + +Just to see if you can force a hash-join and see how long that takes. +You might also try increasing work_mem. +You can do that just in the current session with + +SET work_mem TO ....; + +John +=:-> + + +--------------enig241C50A43AF95B0DB9B2D161 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCVWxdJdeBCYSNAAMRAmO6AJ9QQ7SIo9cbqt305HO/k7KJSTg44gCeIkeT +DDH9DlX/L+xMFFro3PVqa2o= +=rUaL +-----END PGP SIGNATURE----- + +--------------enig241C50A43AF95B0DB9B2D161-- + +From pgsql-performance-owner@postgresql.org Thu Apr 7 22:26:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C4E86536DF + for ; + Thu, 7 Apr 2005 22:26:41 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17654-06 + for ; + Thu, 7 Apr 2005 21:26:38 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D44253519 + for ; + Thu, 7 Apr 2005 22:26:37 +0100 (BST) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050407212638.FQES9708.priv-edtnes56.telusplanet.net@localhost> + for ; + Thu, 7 Apr 2005 15:26:38 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 7 Apr 2005 14:26:38 -0700 +Message-ID: <1112909198.4255a58eae0d8@webmail.telus.net> +Date: Thu, 7 Apr 2005 14:26:38 -0700 +From: Mischa +To: pgsql-performance@postgresql.org +Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple + query seems to be very inefficient) +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050407143120.GA29575@wolff.to> <16907.1112883624@sss.pgh.pa.us> +In-Reply-To: <16907.1112883624@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/172 +X-Sequence-Number: 11569 + +Quoting Tom Lane : + +> Yeah, the whole thing is only a heuristic anyway. I've been coming +> around to the view that relation membership shouldn't matter, because +> of cases like +> +> WHERE a.x > b.y AND a.x < 42 +> +> which surely should be taken as a range constraint. + +Out of curiosity, will the planner induce "b.y < 42" out of this? + +-- +"Dreams come true, not free." + + +From pgsql-performance-owner@postgresql.org Thu Apr 7 22:40:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C248452A77; + Thu, 7 Apr 2005 22:40:23 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21502-07; Thu, 7 Apr 2005 21:40:14 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id E44D553731; + Thu, 7 Apr 2005 22:40:13 +0100 (BST) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 8828B15478; Thu, 7 Apr 2005 16:40:15 -0500 (CDT) +Date: Thu, 7 Apr 2005 16:40:15 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Arjen van der Meijden , + pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org +Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan for + relatively simple query seems to be very inefficient) +Message-ID: <20050407214015.GT93835@decibel.org> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050406222536.GL93835@decibel.org> + <6594.1112826910@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <6594.1112826910@sss.pgh.pa.us> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/173 +X-Sequence-Number: 11570 + +On Wed, Apr 06, 2005 at 06:35:10PM -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> > On Wed, Apr 06, 2005 at 06:09:37PM -0400, Tom Lane wrote: +> >> Can anyone suggest a more general rule? Do we need for example to +> >> consider whether the relation membership is the same in two clauses +> >> that might be opposite sides of a range restriction? It seems like +> >> +> >> a.x > b.y AND a.x < b.z +> +> > In a case like this, you could actually look at the data in b and see +> > what the average range size is. +> +> Not with the current statistics --- you'd need some kind of cross-column +> statistics involving both y and z. (That is, I doubt it would be +> helpful to estimate the average range width by taking the difference of +> independently-calculated mean values of y and z ...) But yeah, in +> principle it would be possible to make a non-default estimate. + +Actually, it might be possible to take a SWAG at it using the histogram +and correlation stats. + +You know... since getting universally useful cross-platform stats seems +to be pretty pie-in-the-sky, would it be possible to generate more +complex stats on the fly from a sampling of a table? If you're looking +at a fairly sizeable table ISTM it would be worth sampling the rows on +10 or 20 random pages to see what you get. In this case, you'd want to +know the average difference between two fields. Other queries might want +something different. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Fri Apr 8 00:59:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6989653AA2 + for ; + Fri, 8 Apr 2005 00:58:56 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56462-04 + for ; + Thu, 7 Apr 2005 23:58:54 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E621153A59 + for ; + Fri, 8 Apr 2005 00:58:53 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j37NwueE023153; + Thu, 7 Apr 2005 19:58:56 -0400 (EDT) +To: Mischa +Cc: pgsql-performance@postgresql.org +Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple + query seems to be very inefficient) +In-reply-to: <1112909198.4255a58eae0d8@webmail.telus.net> +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050407143120.GA29575@wolff.to> <16907.1112883624@sss.pgh.pa.us> + <1112909198.4255a58eae0d8@webmail.telus.net> +Comments: In-reply-to Mischa + message dated "Thu, 07 Apr 2005 14:26:38 -0700" +Date: Thu, 07 Apr 2005 19:58:56 -0400 +Message-ID: <23152.1112918336@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/174 +X-Sequence-Number: 11571 + +Mischa writes: +> Quoting Tom Lane : +>> WHERE a.x > b.y AND a.x < 42 + +> Out of curiosity, will the planner induce "b.y < 42" out of this? + +No. There's some smarts about transitive equality, but none about +transitive inequalities. Offhand I'm not sure if it'd be useful to add +such. The transitive-equality code pulls its weight because you so +often have situations like + + create view v as select a.x, ... from a join b on (a.x = b.y); + + select * from v where x = 42; + +but I'm less able to think of common use-cases for transitive +inequality ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:52:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 10FF653B21 + for ; + Fri, 8 Apr 2005 01:30:12 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65243-06 + for ; + Fri, 8 Apr 2005 00:30:09 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 25F4A53B09 + for ; + Fri, 8 Apr 2005 01:30:08 +0100 (BST) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050408003011.RNLR9708.priv-edtnes56.telusplanet.net@localhost>; + Thu, 7 Apr 2005 18:30:11 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 7 Apr 2005 17:30:11 -0700 +Message-ID: <1112920211.4255d0934e23d@webmail.telus.net> +Date: Thu, 7 Apr 2005 17:30:11 -0700 +From: a3a18850@telus.net +To: Tom Lane +Cc: Mischa , + pgsql-performance@postgresql.org +Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple + query seems to be very inefficient) +References: <425413D3.5030304@vulcanus.its.tudelft.nl> + <28552.1112809334@sss.pgh.pa.us> + <425423A9.9000504@vulcanus.its.tudelft.nl> + <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> + <20050407143120.GA29575@wolff.to> <16907.1112883624@sss.pgh.pa.us> + <1112909198.4255a58eae0d8@webmail.telus.net> + <23152.1112918336@sss.pgh.pa.us> +In-Reply-To: <23152.1112918336@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.418 tagged_above=0 required=5 + tests=DNS_FROM_RFC_POST, FORGED_RCVD_HELO, FROM_ENDS_IN_NUMS, + FROM_HAS_MIXED_NUMS, NO_REAL_NAME +X-Spam-Level: ** +X-Archive-Number: 200504/204 +X-Sequence-Number: 11601 + +Quoting Tom Lane : + +> Mischa writes: +> > Quoting Tom Lane : +> >> WHERE a.x > b.y AND a.x < 42 +> +> > Out of curiosity, will the planner induce "b.y < 42" out of this? +> +> No. There's some smarts about transitive equality, but none about +> transitive inequalities. Offhand I'm not sure if it'd be useful to add +> such. The transitive-equality code pulls its weight [...] +> but I'm less able to think of common use-cases for transitive +> inequality ... + +Thanks. My apologies for not just going and looking at the code first. + +Equality-transitives: yes, worth their weight in gold. +Inequality-transitivies: I see in OLAP queries (usually ranges), or in queries +against big UNION ALL views, where const false inequalities are the norm. +"a.x > b.y and a.x < c.z" comes up in OLAP, too, usually inside an EXISTS(...), +where you are doing something analogous to finding a path. + + + + +From pgsql-performance-owner@postgresql.org Fri Apr 8 02:30:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B87E753795 + for ; + Fri, 8 Apr 2005 02:30:16 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79484-07 + for ; + Fri, 8 Apr 2005 01:30:09 +0000 (GMT) +Received: from biglumber.com (biglumber.com [207.228.252.42]) + by svr1.postgresql.org (Postfix) with SMTP id A7D43529D4 + for ; + Fri, 8 Apr 2005 02:30:07 +0100 (BST) +Received: (qmail 18568 invoked from network); 8 Apr 2005 01:30:10 -0000 +Received: from unknown (HELO localhost) (207.228.252.42) + by 0 with SMTP; 8 Apr 2005 01:30:10 -0000 +From: "Greg Sabino Mullane" +To: pgsql-performance@postgresql.org +Subject: Re: help on explain analyse in psql 7.1.3 (linux) +X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 +X-Request-PGP: + http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 +In-Reply-To: <4254E604.90006@familyhealth.com.au> +Date: Fri, 8 Apr 2005 01:30:10 -0000 +X-Mailer: JoyMail 1.48 +Message-ID: <6f7d87109a48cd84c74dda77a17f87b0@biglumber.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.224 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200504/175 +X-Sequence-Number: 11572 + + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + + +Christopher Kings-Lynne wrote: +> Explain analyze was added in 7.2 - you really need to upgrade... +> +> You can use \timing in psql to get an approximation... + +Actually, \timing was not added until 7.2 either! So, the +original poster really, really needs to upgrade... :) + +- -- +Greg Sabino Mullane greg@turnstep.com +PGP Key: 0x14964AC8 200504072129 +http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 + +-----BEGIN PGP SIGNATURE----- + +iD8DBQFCVd69vJuQZxSWSsgRAvRHAJ9T1uxfWEnHSNI/+iiiHiJ2I1IGUgCggMYb +tjDwzfseK3aDAKHI5Ko1S/Q= +=AvKY +-----END PGP SIGNATURE----- + + + +From pgsql-performance-owner@postgresql.org Fri Apr 8 03:03:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 62B9153314 + for ; + Fri, 8 Apr 2005 03:03:23 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89593-03 + for ; + Fri, 8 Apr 2005 02:03:14 +0000 (GMT) +Received: from biglumber.com (biglumber.com [207.228.252.42]) + by svr1.postgresql.org (Postfix) with SMTP id 416C55399D + for ; + Fri, 8 Apr 2005 03:03:13 +0100 (BST) +Received: (qmail 21523 invoked from network); 8 Apr 2005 02:03:18 -0000 +Received: from unknown (HELO localhost) (207.228.252.42) + by 0 with SMTP; 8 Apr 2005 02:03:18 -0000 +From: "Greg Sabino Mullane" +To: pgsql-performance@postgresql.org +Subject: Re: COPY Hacks (WAS: RE: Postgresql vs SQLserver for this application + ?) +X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 +X-Request-PGP: + http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 +In-Reply-To: <1112813199.42542e8f17b4d@webmail.telus.net> +Date: Fri, 8 Apr 2005 02:03:18 -0000 +X-Mailer: JoyMail 1.48 +Message-ID: <067c42864e24cd39b83c335da6adc8b5@biglumber.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.145 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/176 +X-Sequence-Number: 11573 + + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + + +> Using COPY ... FROM STDIN via the Perl DBI (DBD::Pg) interface, +> I accidentally strung together several \n-terminated input lines, +> and sent them to the server with a single "putline". +... +> So. Is it a feechur? Worth stress-testing? Could be VERY cool. + +As explained elsewhere, not really a feature, more of a side-effect. +Keep in mind, however, that any network round-trip time saved has to +be balanced against some additional overhead of constructing the +combined strings in Perl before sending them over. Most times COPY +is used to parse a newline-separated file anyway. If you have a slow +network connection to the database, it *might* be a win, but my +limited testing shows that it is not an advantage for a "normal" +connection: I added 1 million rows via COPY using the normal way +(1 million pg_putline calls), via pg_putline of 1000 rows at a +time, and via 10,000 rows at a time. They all ran in 22 seconds, +with no statistical difference between them. (This was the "real" time, +the system time was actually much lower for the combined calls). + +It can't hurt to test things out on your particular system and see +if it makes a real difference: it certainly does no harm as long as +you make sure the string you send always *end* in a newline. + +- -- +Greg Sabino Mullane greg@turnstep.com +PGP Key: 0x14964AC8 200504072201 +http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 + +-----BEGIN PGP SIGNATURE----- + +iD8DBQFCVeZrvJuQZxSWSsgRAoP+AJ9jTNetePMwKv9rdyu6Lz+BjSiDOQCguoSU +ie9TaeIxUuvd5fhjFueacvM= +=1hWn +-----END PGP SIGNATURE----- + + + +From pgsql-performance-owner@postgresql.org Fri Apr 8 05:53:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9671C53603 + for ; + Fri, 8 Apr 2005 05:53:33 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43783-07 + for ; + Fri, 8 Apr 2005 04:53:23 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C3C9535C5 + for ; + Fri, 8 Apr 2005 05:53:22 +0100 (BST) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050408045322.HQWY9708.priv-edtnes56.telusplanet.net@localhost>; + Thu, 7 Apr 2005 22:53:22 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 7 Apr 2005 21:53:22 -0700 +Message-ID: <1112936002.42560e420adf7@webmail.telus.net> +Date: Thu, 7 Apr 2005 21:53:22 -0700 +From: Mischa Sandberg +To: Greg Sabino Mullane +Cc: pgsql-performance@postgresql.org +Subject: Re: multi-line copy (was: Re: COPY Hacks) +References: <067c42864e24cd39b83c335da6adc8b5@biglumber.com> +In-Reply-To: <067c42864e24cd39b83c335da6adc8b5@biglumber.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/177 +X-Sequence-Number: 11574 + + +Quoting Greg Sabino Mullane : + +> > Using COPY ... FROM STDIN via the Perl DBI (DBD::Pg) interface, +> > I accidentally strung together several \n-terminated input lines, +> > and sent them to the server with a single "putline". +> ... +> > So. Is it a feechur? Worth stress-testing? Could be VERY cool. +> +> As explained elsewhere, not really a feature, more of a side-effect. +> Keep in mind, however, that any network round-trip time saved has to +> be balanced against some additional overhead of constructing the +> combined strings in Perl before sending them over. Most times COPY +> is used to parse a newline-separated file anyway. If you have a slow +> network connection to the database, it *might* be a win, but my +> limited testing shows that it is not an advantage for a "normal" +> connection: I added 1 million rows via COPY using the normal way +> (1 million pg_putline calls), via pg_putline of 1000 rows at a +> time, and via 10,000 rows at a time. They all ran in 22 seconds, +> with no statistical difference between them. (This was the "real" time, +> the system time was actually much lower for the combined calls). +> +> It can't hurt to test things out on your particular system and see +> if it makes a real difference: it certainly does no harm as long as +> you make sure the string you send always *end* in a newline. + +Many thanks for digging into it. + +For the app I'm working with, the time delay between rows being posted +is /just/ enough to exceed the TCP Nagle delay, so every row goes across +in its own packet :-( Reducing the number of network roundtrips +by a factor of 40 is enough to cut elapsed time in half. +The cost of join("",@FortyRows), which produces a 1-4K string, is what's +negligible in this case. + +-- +"Dreams come true, not free" -- S.Sondheim, ITW + + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:51:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 053A353B7C + for ; + Fri, 8 Apr 2005 06:38:55 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83841-01 + for ; + Fri, 8 Apr 2005 05:38:46 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 77A6E53B61 + for ; + Fri, 8 Apr 2005 06:38:46 +0100 (BST) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 66D5430952; Fri, 8 Apr 2005 07:38:20 +0200 (MET DST) +From: "Qingqing Zhou" +X-Newsgroups: pgsql.performance +Subject: Re: Compressing WAL +Date: Fri, 8 Apr 2005 13:36:40 +0800 +Organization: Hub.Org Networking Services +Lines: 20 +Message-ID: +References: <20050405040457.GK93835@decibel.org> +Reply-To: "Qingqing Zhou" +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.204 tagged_above=0 required=5 tests=AWL, + PRIORITY_NO_NAME +X-Spam-Level: * +X-Archive-Number: 200504/202 +X-Sequence-Number: 11599 + + +""Jim C. Nasby"" writes +> Has anyone looked at compressing WAL's before writing to disk? On a +> system generating a lot of WAL it seems there might be some gains to be +> had WAL data could be compressed before going to disk, since today's +> machines are generally more I/O bound than CPU bound. And unlike the +> base tables, you generally don't need to read the WAL, so you don't +> really need to worry about not being able to quickly scan through the +> data without decompressing it. +> -- + +The problem is where you put the compression code? If you put it inside +XLogInsert lock or XLogWrite lock, which will hold the lock too long? Or +anywhere else? + +Regards, +Qingqing + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:51:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8E2A653554 + for ; + Fri, 8 Apr 2005 18:02:09 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79526-08 + for ; + Fri, 8 Apr 2005 17:02:03 +0000 (GMT) +Received: from smtp816.mail.sc5.yahoo.com (smtp816.mail.sc5.yahoo.com + [66.163.170.2]) + by svr1.postgresql.org (Postfix) with SMTP id ACA1F53744 + for ; + Fri, 8 Apr 2005 18:02:01 +0100 (BST) +Received: from unknown (HELO discord.dyndns.org) + (jeffroe996@sbcglobal.net@69.226.213.151 with plain) + by smtp816.mail.sc5.yahoo.com with SMTP; 8 Apr 2005 17:02:00 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.dyndns.org (8.13.1/8.13.1) with ESMTP id j38H1t81015015; + Fri, 8 Apr 2005 10:01:55 -0700 +Date: Fri, 8 Apr 2005 10:01:55 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.dyndns.org +To: Josh Berkus +Cc: sfpug@postgresql.org, pgsql-performance@postgresql.org +Subject: DATA directory on network attached storage +In-Reply-To: <200502091350.24885.josh@agliodbs.com> +Message-ID: +References: <200502091350.24885.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/203 +X-Sequence-Number: 11600 + +We are currently considering the possibility of creating a warm standby +machine utilizing heartbeat and a network attached storage device for the DATA +directory. The idea being that the warm standby machine has its postmaster +stopped. When heartbeat detects the death of the master server, the +postmaster is started up on the warm standby using the shared DATA directory. +Other than the obvious problems of both postmasters inadvertently attempting +access at the same time, I'm curious to know if anyone has tried any similar +setups and what the experiences have been. Specifically is the performance of +gigE good enough to allow postgres to perform under load with an NFS mounted +DATA dir? Are there other problems I haven't thought about? Any input would +be greatly appreciated. + +Thanks! + +-- +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 Apr 8 18:06:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BA08537F5; + Fri, 8 Apr 2005 18:06:15 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79753-10; Fri, 8 Apr 2005 17:06:09 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C35A537A9; + Fri, 8 Apr 2005 18:06:04 +0100 (BST) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7211726; Fri, 08 Apr 2005 10:07:58 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Jeff Frost +Subject: Re: [sfpug] DATA directory on network attached storage +Date: Fri, 8 Apr 2005 10:05:45 -0700 +User-Agent: KMail/1.6.2 +Cc: sfpug@postgresql.org, pgsql-performance@postgresql.org +References: <200502091350.24885.josh@agliodbs.com> + +In-Reply-To: +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200504081005.45539.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/178 +X-Sequence-Number: 11575 + +Jeff, + +> =A0Specifically is the performance of +> gigE good enough to allow postgres to perform under load with an NFS +> mounted DATA dir? =A0Are there other problems I haven't thought about? = +=A0Any +> input would be greatly appreciated. + +The big problem with NFS-mounted data is that NFS is designed to be a lossy= +=20 +protocol; that is, sometimes bits get dropped and you just re-request the=20 +file. This isn't a great idea with databases. + +If we were talking SAN, then I don't see any reason why your plan wouldn't= +=20 +work. However, what type of failure exactly are you guarding against? How= +=20 +likely is a machine failure if its hard drives are external? + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From sfpug-owner@postgresql.org Fri Apr 8 18:11:17 2005 +X-Original-To: sfpug-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 15320537C3 + for ; + Fri, 8 Apr 2005 18:11:16 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84132-01 for + ; + Fri, 8 Apr 2005 17:11:10 +0000 (GMT) +Received: from smtp818.mail.sc5.yahoo.com (smtp818.mail.sc5.yahoo.com + [66.163.170.4]) + by svr1.postgresql.org (Postfix) with SMTP id 3C06C53773 + for ; Fri, 8 Apr 2005 18:11:09 +0100 (BST) +Received: from unknown (HELO discord.dyndns.org) + (jeffroe996@sbcglobal.net@69.226.213.151 with plain) + by smtp818.mail.sc5.yahoo.com with SMTP; 8 Apr 2005 17:11:06 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.dyndns.org (8.13.1/8.13.1) with ESMTP id j38HB7Sv015782; + Fri, 8 Apr 2005 10:11:07 -0700 +Date: Fri, 8 Apr 2005 10:11:07 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.dyndns.org +To: Josh Berkus +Cc: sfpug@postgresql.org +Subject: Re: DATA directory on network attached storage +In-Reply-To: <200504081005.45539.josh@agliodbs.com> +Message-ID: +References: <200502091350.24885.josh@agliodbs.com> + + <200504081005.45539.josh@agliodbs.com> +MIME-Version: 1.0 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1; FORMAT=flowed +Content-Transfer-Encoding: 8BIT +Content-ID: +X-Archive-Number: 200504/7 +X-Sequence-Number: 1126 + + This message is in MIME format. The first part should be readable text, + while the remaining parts are likely unreadable without MIME-aware tools. + +---498755627-153491485-1112980124=:11558 +Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1; FORMAT=flowed +Content-Transfer-Encoding: 8BIT +Content-ID: + +Josh, thanks for the quick reply! + +On Fri, 8 Apr 2005, Josh Berkus wrote: + +> Jeff, +> +>> �Specifically is the performance of +>> gigE good enough to allow postgres to perform under load with an NFS +>> mounted DATA dir? �Are there other problems I haven't thought about? �Any +>> input would be greatly appreciated. +> +> The big problem with NFS-mounted data is that NFS is designed to be a lossy +> protocol; that is, sometimes bits get dropped and you just re-request the +> file. This isn't a great idea with databases. + +That is sort of what I was thinking, and we'll have to address this somehow. + +> +> If we were talking SAN, then I don't see any reason why your plan wouldn't +> work. However, what type of failure exactly are you guarding against? How +> likely is a machine failure if its hard drives are external? + +I believe we are looking to fulfill two possibilities. First is failure, be +it CPU fan, ram, motherboard, swap partition, kernel panic, etc. Second is +the ability to take the server offline for maintenance upgrades, etc. A warm +standby would be ideal to satisfy both conditions. In the past we have done +this with sloni, but sloni can be cumbersome when schema changes happen often +on the db as is the case with this one. pg-cluster is another option, but it +appears it comes only as a patched version of postgres which would hamper our +ability to change versions as quickly as might be desired. + +Perhaps something shared could be done with PITR as this new install will be +pg8. + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 +---498755627-153491485-1112980124=:11558-- + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:51:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 08CAB53CC3; + Fri, 8 Apr 2005 20:21:47 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18994-01; Fri, 8 Apr 2005 19:21:38 +0000 (GMT) +Received: from mighty.grot.org (66-117-150-96.web.lmi.net [66.117.150.96]) + by svr1.postgresql.org (Postfix) with ESMTP id D8B66537A4; + Fri, 8 Apr 2005 20:21:36 +0100 (BST) +Received: by mighty.grot.org (Postfix, from userid 515) + id F1D7B5D6A; Fri, 8 Apr 2005 19:21:36 +0000 (GMT) +Date: Fri, 8 Apr 2005 19:21:36 +0000 +From: Aditya +To: Jeff Frost +Cc: Josh Berkus , sfpug@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: [sfpug] DATA directory on network attached storage +Message-ID: <20050408192136.GD72199@mighty.grot.org> +References: <200502091350.24885.josh@agliodbs.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/201 +X-Sequence-Number: 11598 + +On Fri, Apr 08, 2005 at 10:01:55AM -0700, Jeff Frost wrote: +> We are currently considering the possibility of creating a warm standby +> machine utilizing heartbeat and a network attached storage device for the +> DATA directory. The idea being that the warm standby machine has its +> postmaster stopped. When heartbeat detects the death of the master server, +> the postmaster is started up on the warm standby using the shared DATA +> directory. Other than the obvious problems of both postmasters +> inadvertently attempting access at the same time, I'm curious to know if +> anyone has tried any similar setups and what the experiences have been. +> Specifically is the performance of gigE good enough to allow postgres to +> perform under load with an NFS mounted DATA dir? Are there other problems +> I haven't thought about? Any input would be greatly appreciated. + +We (Zapatec Inc) have been running lots of Pg dbs off of a Network Appliance +fileserver (NFS TCPv3) with FreeBSD client machines for several years now with +no problems AFAICT other than insufficient bandwidth between servers and the +fileserver (for one application, www.fastbuzz.com, 100baseTX (over a private +switched network) was insufficient, but IDE-UDMA was fine, so GigE would have +worked too, but we couldn't justify purchasing a new GigE adapter for our +Netapp). + +We have the same setup as you would like, allowing for warm standby(s), +however we haven't had to use them at all. + +We have not, AFAICT, had any problems with the traffic over NFS as far as +reliability -- I'm sure there is a performance penalty, but the reliability +and scalability gains more than offset that. + +FWIW, if I were to do this anew, I would probably opt for iSCSI over GigE with +a NetApp. + +Adi + +From pgsql-performance-owner@postgresql.org Fri Apr 8 23:10:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 199A6535CC + for ; + Fri, 8 Apr 2005 23:10:55 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56795-06 + for ; + Fri, 8 Apr 2005 22:10:53 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 55BB7535C6 + for ; + Fri, 8 Apr 2005 23:10:52 +0100 (BST) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7212697 for pgsql-performance@postgresql.org; + Fri, 08 Apr 2005 15:12:48 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Functionscan estimates +Date: Fri, 8 Apr 2005 15:15:50 -0700 +User-Agent: KMail/1.7.1 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504081515.50340.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/179 +X-Sequence-Number: 11576 + +Folks, + +I'm wondering if it might be useful to be able to add estimated selectivity to +a function definition for purposes of query estimation. Currently function +scans automatically return a flat default 1000 estimated rows. It seems +like the DBA ought to be able to ALTER FUNCTION and give it a row estimate +for planning purposes. + +Thoughts? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Apr 8 23:38:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7431E535FF + for ; + Fri, 8 Apr 2005 23:38:37 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64539-01 + for ; + Fri, 8 Apr 2005 22:38:27 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 6587F535D1 + for ; + Fri, 8 Apr 2005 23:38:26 +0100 (BST) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j38McL4h015989 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Fri, 8 Apr 2005 16:38:25 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j38McKBO017514; + Fri, 8 Apr 2005 16:38:20 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j38McKFS017513; + Fri, 8 Apr 2005 16:38:20 -0600 (MDT) (envelope-from mfuhr) +Date: Fri, 8 Apr 2005 16:38:20 -0600 +From: Michael Fuhr +To: Josh Berkus +Cc: pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +Message-ID: <20050408223820.GA17450@winnie.fuhr.org> +References: <200504081515.50340.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200504081515.50340.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/180 +X-Sequence-Number: 11577 + +On Fri, Apr 08, 2005 at 03:15:50PM -0700, Josh Berkus wrote: +> +> I'm wondering if it might be useful to be able to add estimated selectivity to +> a function definition for purposes of query estimation. Currently function +> scans automatically return a flat default 1000 estimated rows. It seems +> like the DBA ought to be able to ALTER FUNCTION and give it a row estimate +> for planning purposes. + +About a month ago I mentioned that I'd find that useful. In a +followup, Christopher Kings-Lynne brought up the idea of a GUC +variable that could give hints about the expected row count. + +http://archives.postgresql.org/pgsql-hackers/2005-03/msg00146.php +http://archives.postgresql.org/pgsql-hackers/2005-03/msg00153.php + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Fri Apr 8 23:46:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D2E4F538AD + for ; + Fri, 8 Apr 2005 23:46:09 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65805-05 + for ; + Fri, 8 Apr 2005 22:46:04 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id D722953883 + for ; + Fri, 8 Apr 2005 23:46:03 +0100 (BST) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j38Mjv0e004762; + Fri, 8 Apr 2005 18:45:57 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id ECAF2529D0; Fri, 8 Apr 2005 18:45:56 -0400 (CLT) +Date: Fri, 8 Apr 2005 18:45:56 -0400 +From: Alvaro Herrera +To: Michael Fuhr +Cc: Josh Berkus , pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +Message-ID: <20050408224556.GC19458@dcc.uchile.cl> +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <20050408223820.GA17450@winnie.fuhr.org> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.345 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/181 +X-Sequence-Number: 11578 + +On Fri, Apr 08, 2005 at 04:38:20PM -0600, Michael Fuhr wrote: +> On Fri, Apr 08, 2005 at 03:15:50PM -0700, Josh Berkus wrote: +> > +> > I'm wondering if it might be useful to be able to add estimated selectivity to +> > a function definition for purposes of query estimation. Currently function +> > scans automatically return a flat default 1000 estimated rows. It seems +> > like the DBA ought to be able to ALTER FUNCTION and give it a row estimate +> > for planning purposes. +> +> About a month ago I mentioned that I'd find that useful. In a +> followup, Christopher Kings-Lynne brought up the idea of a GUC +> variable that could give hints about the expected row count. + +That seems pretty limited ... what happens if the query contains more +that one SRF? + +Maybe issuing some sort of special call to the function (say, with +some boolean in the call info struct) on which it returns planning data; +thus the planner can call the function itself. The hard part would be +figuring out how to do it without breaking backwards compatibility with +functions that don't know how to handle that. (And how to do it in +plpgsql). + +-- +Alvaro Herrera () +"La principal caracter�stica humana es la tonter�a" +(Augusto Monterroso) + +From pgsql-performance-owner@postgresql.org Fri Apr 8 23:59:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 81D3F53682 + for ; + Fri, 8 Apr 2005 23:59:35 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68071-07 + for ; + Fri, 8 Apr 2005 22:59:29 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 91295536F2 + for ; + Fri, 8 Apr 2005 23:59:28 +0100 (BST) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7212779; Fri, 08 Apr 2005 16:01:26 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Alvaro Herrera +Subject: Re: Functionscan estimates +Date: Fri, 8 Apr 2005 16:04:27 -0700 +User-Agent: KMail/1.7.1 +Cc: Michael Fuhr , pgsql-performance@postgresql.org +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> + <20050408224556.GC19458@dcc.uchile.cl> +In-Reply-To: <20050408224556.GC19458@dcc.uchile.cl> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200504081604.27845.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/182 +X-Sequence-Number: 11579 + +Alvaro, Michael, + +> > About a month ago I mentioned that I'd find that useful. =A0In a +> > followup, Christopher Kings-Lynne brought up the idea of a GUC +> > variable that could give hints about the expected row count. +> +> That seems pretty limited ... what happens if the query contains more +> that one SRF? + +Yeah, I'd see that as a pretty bad idea too. I don't want to tell the plan= +ner=20 +how many rows I expect "all functions" to return, I want to tell it how man= +y=20 +*one particular* function will return. + +> Maybe issuing some sort of special call to the function (say, with +> some boolean in the call info struct) on which it returns planning data; +> thus the planner can call the function itself. =A0The hard part would be +> figuring out how to do it without breaking backwards compatibility with +> functions that don't know how to handle that. =A0(And how to do it in +> plpgsql). + +Or in pl/perl, or pl/python, or plsh .... doesn't sound feasable. =20 + +My solution would be a lot simpler, since we could simply populate=20 +pg_proc.proestrows with "1000" by default if not changed by the DBA. In an= +=20 +even better world, we could tie it to a table, saying that, for example,=20 +proestrows =3D my_table*0.02. + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Apr 9 00:58:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 99B9953573 + for ; + Sat, 9 Apr 2005 00:57:44 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78020-10 + for ; + Fri, 8 Apr 2005 23:57:35 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 5563E5321A + for ; + Sat, 9 Apr 2005 00:57:34 +0100 (BST) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j38NvVlL009741; + Fri, 8 Apr 2005 19:57:31 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id A9C6352A34; Fri, 8 Apr 2005 19:57:31 -0400 (CLT) +Date: Fri, 8 Apr 2005 19:57:31 -0400 +From: Alvaro Herrera +To: Josh Berkus +Cc: Michael Fuhr , pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +Message-ID: <20050408235731.GA6279@dcc.uchile.cl> +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> + <20050408224556.GC19458@dcc.uchile.cl> + <200504081604.27845.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200504081604.27845.josh@agliodbs.com> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.345 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/183 +X-Sequence-Number: 11580 + +On Fri, Apr 08, 2005 at 04:04:27PM -0700, Josh Berkus wrote: + +> My solution would be a lot simpler, since we could simply populate +> pg_proc.proestrows with "1000" by default if not changed by the DBA. In an +> even better world, we could tie it to a table, saying that, for example, +> proestrows = my_table*0.02. + +The problem with that approach is that it can't differ depending on the +arguments to the function, so it too seems limited to me. + +Ideally an estimator would be able to peek at other table statistics and +do some computation with them, just like other nodes are able to. + +Another idea would be have an estimator function (pg_proc.proestimator) +for each regular function. The estimator would be a very cheap function +to be called with the same arguments, and it would return the estimated +number of tuples the other function would return. The default estimator +could be "return 1000". + +-- +Alvaro Herrera () +"A wizard is never late, Frodo Baggins, nor is he early. + He arrives precisely when he means to." (Gandalf, en LoTR FoTR) + +From pgsql-performance-owner@postgresql.org Sat Apr 9 05:01:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 45A4553902 + for ; + Sat, 9 Apr 2005 05:01:16 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44106-04 + for ; + Sat, 9 Apr 2005 04:01:06 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C29B533B5 + for ; + Sat, 9 Apr 2005 05:01:05 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3940uDk019039; + Sat, 9 Apr 2005 00:00:56 -0400 (EDT) +To: Alvaro Herrera +Cc: Josh Berkus , Michael Fuhr , + pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +In-reply-to: <20050408235731.GA6279@dcc.uchile.cl> +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> + <20050408224556.GC19458@dcc.uchile.cl> + <200504081604.27845.josh@agliodbs.com> + <20050408235731.GA6279@dcc.uchile.cl> +Comments: In-reply-to Alvaro Herrera + message dated "Fri, 08 Apr 2005 19:57:31 -0400" +Date: Sat, 09 Apr 2005 00:00:56 -0400 +Message-ID: <19038.1113019256@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/184 +X-Sequence-Number: 11581 + +Not too many releases ago, there were several columns in pg_proc that +were intended to support estimation of the runtime cost and number of +result rows of set-returning functions. I believe in fact that these +were the remains of Joe Hellerstein's thesis on expensive-function +evaluation, and are exactly what he was talking about here: +http://archives.postgresql.org/pgsql-hackers/2002-06/msg00085.php + +But with all due respect to Joe, I think the reason that stuff got +trimmed is that it didn't work very well. In most cases it's +*hard* to write an estimator for a SRF. Let's see you produce +one for dblink() for instance ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Apr 9 12:25:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 70B51536AA + for ; + Sat, 9 Apr 2005 12:25:57 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43400-06 + for ; + Sat, 9 Apr 2005 11:25:48 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 22D465362C + for ; + Sat, 9 Apr 2005 12:25:47 +0100 (BST) +Received: (qmail 11864 invoked from network); 9 Apr 2005 13:26:12 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 9 Apr 2005 13:26:12 +0200 +Date: Sat, 09 Apr 2005 13:25:47 +0200 +To: josh@agliodbs.com, "Alvaro Herrera" , + tgl@sss.pgh.pa.us +Subject: Re: Functionscan estimates +Cc: "Michael Fuhr" , pgsql-performance@postgresql.org +References: <200504081515.50340.josh@agliodbs.com> + <200504081604.27845.josh@agliodbs.com> + <20050408224556.GC19458@dcc.uchile.cl> + <20050408223820.GA17450@winnie.fuhr.org> +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <200504081604.27845.josh@agliodbs.com> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/185 +X-Sequence-Number: 11582 + + +> My solution would be a lot simpler, since we could simply populate +> pg_proc.proestrows with "1000" by default if not changed by the DBA. In +> an +> even better world, we could tie it to a table, saying that, for example, +> proestrows = my_table*0.02. + + What if the estimated row is a function of a parameter ? + Say a function takes as a parameter : + - a number to use in a LIMIT + - it's a function to generate a certain number of values from a +predetermined set (like, array -> set returning function) + + In all those cases it's no use to have just a fixed number. + + Id suggest two solutions : + - The ideal solution which is impossible to do : + The function tells the planner about its stats, looking at its parameters + + - A solution that would be possible to do + pg_proc.proestrows is... the name of another function, defined by the +user, which takes the exact same parameters as the set returning function +we're talking about, and which returns estimates. + + For instance, in pseudo-sql : + +CREATE FUNCTION int_array_srf( INTEGER[] ) RETURNS SETOF INTEGER LANGUAGE +plpgsql AS $$ +BEGIN + FOR _i IN 1..icount($1) + RETURN NEXT $1[_i]; + END +END In the two cases above, this would give : + +CREATE FUNCTION array_srf_estimator( INTEGER[] ) RETURNS INTEGER LANGUAGE +plpgsql AS $$ +BEGIN + RETURN icount( $1 ); +END; + +ALTER FUNCTION array_srf SET ESTIMATOR array_srf_estimator; + + Another interesting case would be the famous "Top 5 by category" case +where we use a SRF to emulate an index skip scan. Say we have a table +Categories and a table Users, each User having columns "categories" and +"score" and we want the N users with best score in each category : + +CREATE FUNCTION top_n_by_category( INTEGER ) RETURN SETOF users%ROWTYPE +LANGUAGE plpgsql AS $$ +DECLARE + _cat_id INTEGER; + _n ALIAS FOR $1; + _user users%ROWTYPE; +BEGIN + FOR _cat_id IN SELECT category_id FROM categories DO + FOR _user IN SELECT * FROM users WHERE category_id = _cat_id ORDER BY +score DESC LIMIT _n DO + RETURN NEXT _user; + END + END +END + +CREATE FUNCTION top_n_by_category_estimator( INTEGER ) RETURN INTEGER +LANGUAGE plpgsql AS $$ +BEGIN + RETURN $1 * (the estimated number of rows for the categories table taken + from the table statistics); +END; + +ALTER FUNCTION top_n_by_category SET ESTIMATOR top_n_by_category_estimator; + + Got it ? + + The array_srf case would be extremely useful as this type of function is +generally used to join against other tables, and having estimates is +useful for that. + The top_n case would be useless if we're just returning the rows from the +function directly, but would be useful if we'll join them to other tables. + + This sounds pretty simple, powerful, and versatile. + + Additionally, in some cases (most notably the array case) it's easy to +estimate the statistics on the returned values because they're all in the +array already, so the mechanism could be extended to have a way of +returning a pseudo pg_stats for a Set Returning function. + + For instance, say you have a SRF which returns N random rows from a +table. It could have an estimator which would return a rowcount of N, and +a statistics estimator which would return the sats rows for the source +table, appropriately modified. + + This sounds harder to do. + + WHat do you think ? + + + + + + + + + + + + + + + + + + +From pgsql-performance-owner@postgresql.org Sat Apr 9 12:29:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 51AD25362C + for ; + Sat, 9 Apr 2005 12:29:19 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43465-05 + for ; + Sat, 9 Apr 2005 11:29:10 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 21E69539EA + for ; + Sat, 9 Apr 2005 12:29:09 +0100 (BST) +Received: (qmail 12008 invoked from network); 9 Apr 2005 13:29:35 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 9 Apr 2005 13:29:35 +0200 +To: "Tom Lane" , "Alvaro Herrera" +Cc: "Josh Berkus" , + "Michael Fuhr" , pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +References: <200504081515.50340.josh@agliodbs.com> + <19038.1113019256@sss.pgh.pa.us> + <20050408235731.GA6279@dcc.uchile.cl> + <200504081604.27845.josh@agliodbs.com> + <20050408224556.GC19458@dcc.uchile.cl> + <20050408223820.GA17450@winnie.fuhr.org> +Message-ID: +Date: Sat, 09 Apr 2005 13:29:10 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <19038.1113019256@sss.pgh.pa.us> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/186 +X-Sequence-Number: 11583 + + +> But with all due respect to Joe, I think the reason that stuff got +> trimmed is that it didn't work very well. In most cases it's +> *hard* to write an estimator for a SRF. Let's see you produce +> one for dblink() for instance ... + + Good one... + Well in some cases it'll be impossible, but suppose I have a function +get_id_for_something() which just grabs an ID using dblink, then I know it +returns one row, and pg would be interested in that information too ! + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:51:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9AA95534B0 + for ; + Sat, 9 Apr 2005 14:19:15 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70704-09 + for ; + Sat, 9 Apr 2005 13:19:11 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id CC0C953431 + for ; + Sat, 9 Apr 2005 14:19:10 +0100 (BST) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 5F2F230952; Sat, 9 Apr 2005 15:18:43 +0200 (MET DST) +Date: Sat, 09 Apr 2005 08:19:12 -0500 +From: BarryS +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.3) Gecko/20041202 Debian/1.7.3.x.1-39 +X-Accept-Language: en +MIME-Version: 1.0 +X-Newsgroups: pgsql.performance +Subject: Re: Postgresql vs SQLserver for this application ? +References: + +In-Reply-To: + +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +Message-ID: <5-2dnWnNnuvSS8rfRVn-tA@giganews.com> +Lines: 53 +X-Complaints-To: abuse@giganews.com +X-DMCA-Notifications: http://www.giganews.com/info/dmca.html +X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers +X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint + properly +X-Postfilter: 1.3.32 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/200 +X-Sequence-Number: 11597 + + +Well, quite honestly, if you need this performance (5000 ins / sec) and +features (clustering, replication) - you should be looking at DB2 or Oracle. + +That is not to say that PG can not do the job, or that its not a great +database, but the reason that DB2 and Oracle are still in wide use is +because they answer the exact question you asked. + +-Barry + +bsimon@loxane.com wrote: +> +> hi all. +> +> We are designing a quite big application that requires a +> high-performance database backend. +> The rates we need to obtain are at least 5000 inserts per second and 15 +> selects per second for one connection. There should only be 3 or 4 +> simultaneous connections. +> I think our main concern is to deal with the constant flow of data +> coming from the inserts that must be available for selection as fast as +> possible. (kind of real time access ...) +> +> As a consequence, the database should rapidly increase up to more than +> one hundred gigs. We still have to determine how and when we shoud +> backup old data to prevent the application from a performance drop. We +> intend to develop some kind of real-time partionning on our main table +> keep the flows up. +> +> At first, we were planning to use SQL Server as it has features that in +> my opinion could help us a lot : +> - replication +> - clustering +> +> Recently we started to study Postgresql as a solution for our project : +> - it also has replication +> - Postgis module can handle geographic datatypes (which would +> facilitate our developments) +> - We do have a strong knowledge on Postgresql administration (we +> use it for production processes) +> - it is free (!) and we could save money for hardware purchase. +> +> Is SQL server clustering a real asset ? How reliable are Postgresql +> replication tools ? Should I trust Postgresql performance for this kind +> of needs ? +> +> My question is a bit fuzzy but any advices are most welcome... +> hardware,tuning or design tips as well :)) +> +> Thanks a lot. +> +> Benjamin. +> + +From pgsql-performance-owner@postgresql.org Sat Apr 9 16:17:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EEC4D53431 + for ; + Sat, 9 Apr 2005 16:17:27 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03858-01 + for ; + Sat, 9 Apr 2005 15:17:24 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id DB4B252A56 + for ; + Sat, 9 Apr 2005 16:17:23 +0100 (BST) +Received: by flake.decibel.org (Postfix, from userid 1001) + id EB4F81548B; Sat, 9 Apr 2005 10:17:21 -0500 (CDT) +Date: Sat, 9 Apr 2005 10:17:21 -0500 +From: "Jim C. Nasby" +To: Joel Fradkin +Cc: 'Tom Lane' , + 'PostgreSQL Perform' +Subject: Re: Any way to speed this up? +Message-ID: <20050409151721.GF93835@decibel.org> +References: <11372.1112892168@sss.pgh.pa.us> + <007b01c53b95$450c5850$797ba8c0@jfradkin> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <007b01c53b95$450c5850$797ba8c0@jfradkin> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/187 +X-Sequence-Number: 11584 + +2 things to point out from this last run: + +50% of the time is taken scanning tblassociate + -> Seq Scan on tblassociate a (cost=0.00..38388.79 rows=199922 width=53) (actual time=62.000..10589.000 rows=176431 loops=1) + Filter: ((clientnum)::text = 'SAKS'::text) + +If you had an index on clientnum and didn't cast it to text in the view, +you might be able to use an indexscan, which could be faster (depends on +how big the table actually is). + +This sort is taking about 25% of the time: + -> Sort (cost=85542.59..86042.39 rows=199922 width=75) (actual time=19641.000..19955.000 rows=159960 loops=1)" + Sort Key: a.locationid + -> Merge Right Join (cost=60850.40..62453.22 rows=199922 width=75) (actual time=13500.000..14734.000 rows=176431 loops=1) + +I suspect it shouldn't take 5 seconds to sort 160k rows in memory, and +that this sort is spilling to disk. If you increase your working memory +the sort might fit entirely in memory. As a quick test, you could set +working memory to 80% of system memory and see how that changes the +speed. But you wouldn't want to set it that high in production. + +On Thu, Apr 07, 2005 at 01:14:33PM -0400, Joel Fradkin wrote: +> Here is the result after putting it back to 4 the original value (I had done +> that prior to your suggestion of using 2 or 3) to see what might change. +> I also vacummed and thought I saw records deleted in associate, which I +> found odd as this is a test site and no new records were added or deleted. +> +> "Merge Join (cost=86788.09..87945.00 rows=10387 width=112) (actual +> time=19703.000..21154.000 rows=159959 loops=1)" +> " Merge Cond: ("outer".locationid = "inner".locationid)" +> " -> Sort (cost=1245.50..1246.33 rows=332 width=48) (actual +> time=62.000..62.000 rows=441 loops=1)" +> " Sort Key: l.locationid" +> " -> Index Scan using ix_location on tbllocation l +> (cost=0.00..1231.60 rows=332 width=48) (actual time=15.000..62.000 rows=441 +> loops=1)" +> " Index Cond: ('SAKS'::text = (clientnum)::text)" +> " -> Sort (cost=85542.59..86042.39 rows=199922 width=75) (actual +> time=19641.000..19955.000 rows=159960 loops=1)" +> " Sort Key: a.locationid" +> " -> Merge Right Join (cost=60850.40..62453.22 rows=199922 +> width=75) (actual time=13500.000..14734.000 rows=176431 loops=1)" +> " Merge Cond: (("outer".id = "inner".jobtitleid) AND +> ("outer"."?column4?" = "inner"."?column10?"))" +> " -> Sort (cost=554.11..570.13 rows=6409 width=37) (actual +> time=94.000..94.000 rows=6391 loops=1)" +> " Sort Key: jt.id, (jt.clientnum)::text" +> " -> Seq Scan on tbljobtitle jt (cost=0.00..148.88 +> rows=6409 width=37) (actual time=0.000..63.000 rows=6391 loops=1)" +> " Filter: (1 = presentationid)" +> " -> Sort (cost=60296.29..60796.09 rows=199922 width=53) +> (actual time=13406.000..13859.000 rows=176431 loops=1)" +> " Sort Key: a.jobtitleid, (a.clientnum)::text" +> " -> Seq Scan on tblassociate a (cost=0.00..38388.79 +> rows=199922 width=53) (actual time=62.000..10589.000 rows=176431 loops=1)" +> " Filter: ((clientnum)::text = 'SAKS'::text)" +> "Total runtime: 22843.000 ms" +> +> Joel Fradkin +> +> -----Original Message----- +> From: Tom Lane [mailto:tgl@sss.pgh.pa.us] +> Sent: Thursday, April 07, 2005 11:43 AM +> To: Joel Fradkin +> Cc: 'PostgreSQL Perform' +> Subject: Re: [PERFORM] Any way to speed this up? +> +> "Joel Fradkin" writes: +> > random_page_cost = 1.2#4 # units are one sequential page +> > fetch cost +> +> That is almost certainly overoptimistic; it's causing the planner to +> use indexscans when it shouldn't. Try 2 or 3 or thereabouts. +> +> regards, tom lane +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if your +> joining column's datatypes do not match +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sat Apr 9 16:23:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B33153879 + for ; + Sat, 9 Apr 2005 16:23:01 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04965-09 + for ; + Sat, 9 Apr 2005 15:22:59 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 19B79537B8 + for ; + Sat, 9 Apr 2005 16:22:58 +0100 (BST) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 0748F1522F; Sat, 9 Apr 2005 10:22:57 -0500 (CDT) +Date: Sat, 9 Apr 2005 10:22:57 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Alvaro Herrera , + Josh Berkus , Michael Fuhr , + pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +Message-ID: <20050409152257.GG93835@decibel.org> +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> + <20050408224556.GC19458@dcc.uchile.cl> + <200504081604.27845.josh@agliodbs.com> + <20050408235731.GA6279@dcc.uchile.cl> + <19038.1113019256@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <19038.1113019256@sss.pgh.pa.us> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/188 +X-Sequence-Number: 11585 + +On Sat, Apr 09, 2005 at 12:00:56AM -0400, Tom Lane wrote: +> Not too many releases ago, there were several columns in pg_proc that +> were intended to support estimation of the runtime cost and number of +> result rows of set-returning functions. I believe in fact that these +> were the remains of Joe Hellerstein's thesis on expensive-function +> evaluation, and are exactly what he was talking about here: +> http://archives.postgresql.org/pgsql-hackers/2002-06/msg00085.php +> +> But with all due respect to Joe, I think the reason that stuff got +> trimmed is that it didn't work very well. In most cases it's +> *hard* to write an estimator for a SRF. Let's see you produce +> one for dblink() for instance ... + +Actually, if the remote database supported a way to get a rows estimate +from the query passed to db_link, it would be trivial, since you'd just +pass that back. + +In fact, having such a function (estimate_rows_for_sql(text)) would +probably be very useful to functions that wanted to support returning a +rows estimate. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sat Apr 9 16:46:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C87B53761 + for ; + Sat, 9 Apr 2005 16:46:52 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16566-01 + for ; + Sat, 9 Apr 2005 15:46:48 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A26EB53374 + for ; + Sat, 9 Apr 2005 16:46:47 +0100 (BST) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j39FjN52022292; + Sat, 9 Apr 2005 11:45:23 -0400 (EDT) +To: "Jim C. Nasby" +Cc: Alvaro Herrera , + Josh Berkus , Michael Fuhr , + pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +In-reply-to: <20050409152257.GG93835@decibel.org> +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> + <20050408224556.GC19458@dcc.uchile.cl> + <200504081604.27845.josh@agliodbs.com> + <20050408235731.GA6279@dcc.uchile.cl> + <19038.1113019256@sss.pgh.pa.us> + <20050409152257.GG93835@decibel.org> +Comments: In-reply-to "Jim C. Nasby" + message dated "Sat, 09 Apr 2005 10:22:57 -0500" +Date: Sat, 09 Apr 2005 11:45:23 -0400 +Message-ID: <22291.1113061523@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/189 +X-Sequence-Number: 11586 + +"Jim C. Nasby" writes: +> On Sat, Apr 09, 2005 at 12:00:56AM -0400, Tom Lane wrote: +>> But with all due respect to Joe, I think the reason that stuff got +>> trimmed is that it didn't work very well. In most cases it's +>> *hard* to write an estimator for a SRF. Let's see you produce +>> one for dblink() for instance ... + +> Actually, if the remote database supported a way to get a rows estimate +> from the query passed to db_link, it would be trivial, since you'd just +> pass that back. + +This assumes that (1) you have the complete query argument at the time +of estimation, and (2) it's OK to contact the remote database and do an +EXPLAIN at that time. Both of these seem pretty shaky assumptions. + +The larger point is that writing an estimator for an SRF is frequently a +task about as difficult as writing the SRF itself, and sometimes much +*more* difficult due to lack of information. I don't foresee a whole +lot of use of an estimator hook designed as proposed here. In +particular, if the API is such that we can only use the estimator when +all the function arguments are plan-time constants, it's not going to be +very helpful. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sun Apr 10 05:37:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 23AC153CBC + for ; + Sun, 10 Apr 2005 05:37:23 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23837-07 + for ; + Sun, 10 Apr 2005 04:37:00 +0000 (GMT) +Received: from zeus.gigaweb.cz (zeus.gigaweb.cz [81.0.236.19]) + by svr1.postgresql.org (Postfix) with SMTP id 3ACA0539D3 + for ; + Sun, 10 Apr 2005 05:36:57 +0100 (BST) +Received: (qmail 6148 invoked from network); 10 Apr 2005 04:36:56 -0000 +Received: from unknown (HELO localhost) (81.0.236.19) + by 0 with SMTP; 10 Apr 2005 04:36:56 -0000 +Received: from pha-84-242-127-3.nat.karneval.cz + (pha-84-242-127-3.nat.karneval.cz [84.242.127.3]) + by email.gigaweb.cz (IMP) with HTTP + for ; Sun, 10 Apr 2005 06:36:56 +0200 +Message-ID: <1113107816.4258ad687c034@email.gigaweb.cz> +Date: Sun, 10 Apr 2005 06:36:56 +0200 +From: tv@fuzzy.cz +To: pgsql-performance@postgresql.org +Subject: performance - triggers, row existence etc. +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/190 +X-Sequence-Number: 11587 + +Hello, + +I'm just in the middle of performance tunning of our database running +on PostgreSQL, and I've several questions (I've searched the online +docs, but without success). + +1) When I first use the EXPLAIN ANALYZE command, the time is much + larger than in case of subsequent invocations of EXPLAIN ANALYZE. + I suppose the plan prepared during the first invocation is cached + somewhere, but I'm not sure where and for how long. + + I suppose the execution plans are connection specific, but + I'm not sure whether this holds for the sql queries inside the + triggers too. I've done some testing but the things are somehow + more difficult thanks to persistent links (the commands will + be executed from PHP). + +2) Is there some (performance) difference between BEFORE and AFTER + triggers? I believe there's no measurable difference. + +3) Vast majority of SQL commands inside the trigger checks whether there + exists a row that suits some conditions (same IP, visitor ID etc.) + Currently I do this by + + SELECT INTO tmp id FROM ... JOIN ... WHERE ... LIMIT 1 + IF NOT FOUND THEN + .... + END IF; + + and so on. I believe this is fast and low-cost solution (compared + to the COUNT(*) way I've used before), but is there some even better + (faster) way to check row existence? + +Thanks +t.v. + +From pgsql-performance-owner@postgresql.org Sun Apr 10 06:25:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B1F55387A + for ; + Sun, 10 Apr 2005 06:25:47 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36289-02 + for ; + Sun, 10 Apr 2005 05:25:37 +0000 (GMT) +Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A18253713 + for ; + Sun, 10 Apr 2005 06:25:36 +0100 (BST) +Received: from localhost (mailbox.samurai.com [205.207.28.82]) + by mailbox.samurai.com (Postfix) with ESMTP id 6976618CC6E; + Sun, 10 Apr 2005 01:25:36 -0400 (EDT) +Received: from mailbox.samurai.com ([205.207.28.82]) + by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, + port 10024) + with LMTP id 80685-02-7; Sun, 10 Apr 2005 01:25:33 -0400 (EDT) +Received: from [220.101.4.182] (r220-101-4-182.cpe.unwired.net.au + [220.101.4.182]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mailbox.samurai.com (Postfix) with ESMTP id E4A3918CC2A; + Sun, 10 Apr 2005 01:25:29 -0400 (EDT) +Message-ID: <4258B8C5.7030305@samurai.com> +Date: Sun, 10 Apr 2005 15:25:25 +1000 +From: Neil Conway +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: Alvaro Herrera , + Josh Berkus , Michael Fuhr , + pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> + <20050408224556.GC19458@dcc.uchile.cl> + <200504081604.27845.josh@agliodbs.com> + <20050408235731.GA6279@dcc.uchile.cl> + <19038.1113019256@sss.pgh.pa.us> +In-Reply-To: <19038.1113019256@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at mailbox.samurai.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/191 +X-Sequence-Number: 11588 + +Tom Lane wrote: +> Not too many releases ago, there were several columns in pg_proc that +> were intended to support estimation of the runtime cost and number of +> result rows of set-returning functions. I believe in fact that these +> were the remains of Joe Hellerstein's thesis on expensive-function +> evaluation + +FYI, Hellerstein's thesis on xfunc optimization is available here: + + ftp://ftp.cs.wisc.edu/pub/tech-reports/reports/1996/tr1304.ps.Z + +There's also a paper on this subject by Hellerstein that was published +in Transactions on Database Systems: + + http://www.cs.berkeley.edu/~jmh/miscpapers/todsxfunc.pdf + +I haven't had a chance to digest either one yet, but it might be worth a +look. + +-Neil + +From pgsql-performance-owner@postgresql.org Sun Apr 10 06:44:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 43590538EF + for ; + Sun, 10 Apr 2005 06:44:11 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37769-06 + for ; + Sun, 10 Apr 2005 05:44:10 +0000 (GMT) +Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) + by svr1.postgresql.org (Postfix) with ESMTP id D802E538C9 + for ; + Sun, 10 Apr 2005 06:44:09 +0100 (BST) +Received: from localhost (mailbox.samurai.com [205.207.28.82]) + by mailbox.samurai.com (Postfix) with ESMTP id 1D86318CC05; + Sun, 10 Apr 2005 01:44:10 -0400 (EDT) +Received: from mailbox.samurai.com ([205.207.28.82]) + by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, + port 10024) + with LMTP id 81227-02-8; Sun, 10 Apr 2005 01:44:08 -0400 (EDT) +Received: from [220.101.4.182] (r220-101-4-182.cpe.unwired.net.au + [220.101.4.182]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mailbox.samurai.com (Postfix) with ESMTP id 5656418CC2C; + Sun, 10 Apr 2005 01:44:05 -0400 (EDT) +Message-ID: <4258BD20.7090907@samurai.com> +Date: Sun, 10 Apr 2005 15:44:00 +1000 +From: Neil Conway +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: "Jim C. Nasby" , + Alvaro Herrera , + Josh Berkus , Michael Fuhr , + pgsql-performance@postgresql.org +Subject: Re: Functionscan estimates +References: <200504081515.50340.josh@agliodbs.com> + <20050408223820.GA17450@winnie.fuhr.org> + <20050408224556.GC19458@dcc.uchile.cl> + <200504081604.27845.josh@agliodbs.com> + <20050408235731.GA6279@dcc.uchile.cl> + <19038.1113019256@sss.pgh.pa.us> + <20050409152257.GG93835@decibel.org> + <22291.1113061523@sss.pgh.pa.us> +In-Reply-To: <22291.1113061523@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at mailbox.samurai.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/192 +X-Sequence-Number: 11589 + +Tom Lane wrote: +> The larger point is that writing an estimator for an SRF is frequently a +> task about as difficult as writing the SRF itself + +True, although I think this doesn't necessarily kill the idea. If +writing an estimator for a given SRF is too difficult, the user is no +worse off than they are today. Hopefully there would be a fairly large +class of SRFs for which writing an estimator would be relatively simple, +and result in improved planner behavior. + +> I don't foresee a whole lot of use of an estimator hook designed as +> proposed here. In particular, if the API is such that we can only +> use the estimator when all the function arguments are plan-time +> constants, it's not going to be very helpful. + +Yes :( One approach might be to break the function's domain into pieces +and have the estimator function calculate the estimated result set size +for each piece. So, given a trivial function like: + +foo(int): + if $1 < 10 then produce 100 rows + else produce 10000 rows + +If the planner has encoded the distribution of input tuples to the +function as a histogram, it could invoke the SRF's estimator function +for the boundary values of each histogram bucket, and use that to get an +idea of the function's likely result set size at runtime. + +And yes, the idea as sketched is totally unworkable :) For one thing, +the difficulty of doing this grows rapidly as the number of arguments to +the function increases. But perhaps there is some variant of this idea +that might work... + +Another thought is that the estimator could provide information on the +cost of evaluating the function, the number of tuples produced by the +function, and even the distribution of those tuples. + +BTW, why is this on -performance? It should be on -hackers. + +-Neil + +From pgsql-performance-owner@postgresql.org Sun Apr 10 14:10:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 219E753650 + for ; + Sun, 10 Apr 2005 14:10:04 +0100 (BST) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97467-04 + for ; + Sun, 10 Apr 2005 13:09:52 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 78D2C53657 + for ; + Sun, 10 Apr 2005 14:09:51 +0100 (BST) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3AD9qGR016159; (envelope-from ) Sun, + 10 Apr 2005 08:09:52 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3AD9ots019699 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Sun, + 10 Apr 2005 08:09:51 -0500 (CDT) +Message-ID: <4259259A.7090504@arbash-meinel.com> +Date: Sun, 10 Apr 2005 08:09:46 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: tv@fuzzy.cz +Cc: pgsql-performance@postgresql.org +Subject: Re: performance - triggers, row existence etc. +References: <1113107816.4258ad687c034@email.gigaweb.cz> +In-Reply-To: <1113107816.4258ad687c034@email.gigaweb.cz> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig1331E127074036E0F475E918" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/193 +X-Sequence-Number: 11590 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig1331E127074036E0F475E918 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +tv@fuzzy.cz wrote: + +>Hello, +> +>I'm just in the middle of performance tunning of our database running +>on PostgreSQL, and I've several questions (I've searched the online +>docs, but without success). +> +>1) When I first use the EXPLAIN ANALYZE command, the time is much +> larger than in case of subsequent invocations of EXPLAIN ANALYZE. +> I suppose the plan prepared during the first invocation is cached +> somewhere, but I'm not sure where and for how long. +> +> +> +This is actually true for any command. If you just use \timing and not +explain analyze, you will see that the first time is usually +significantly longer than the rest. + +It's because the tables you are using are being cached in RAM (by the OS +& by postgres). +It's not a planning difference, it's a bulk data cache difference. + +When and how long is dependent on how much RAM you have, and how much of +the database you are using. + +> I suppose the execution plans are connection specific, but +> I'm not sure whether this holds for the sql queries inside the +> triggers too. I've done some testing but the things are somehow +> more difficult thanks to persistent links (the commands will +> be executed from PHP). +> +> +Connection specific???? +If you were doing PREPARE myquery AS SELECT ...; Then myquery would only +exist for that connection. And cursors & temp tables are only for the +given connection. +But otherwise I don't think the connection matters. + +>2) Is there some (performance) difference between BEFORE and AFTER +> triggers? I believe there's no measurable difference. +> +> +I don't know that there is a performance difference, but there is a +semantic one. If you are trying to (potentially) prevent the row from +being inserted you must do that BEFORE, since the row doesn't exist yet. +If you are trying to update a foreign key reference to the new object, +you must do that AFTER, so that the row exists to reference. + +>3) Vast majority of SQL commands inside the trigger checks whether there +> exists a row that suits some conditions (same IP, visitor ID etc.) +> Currently I do this by +> +> SELECT INTO tmp id FROM ... JOIN ... WHERE ... LIMIT 1 +> IF NOT FOUND THEN +> .... +> END IF; +> +> and so on. I believe this is fast and low-cost solution (compared +> to the COUNT(*) way I've used before), but is there some even better +> (faster) way to check row existence? +> +> +> +SELECT ... WHERE EXISTS ...; +I'm not sure what you are trying to do, but this makes a good joined +command. + +SELECT what_I_want FROM table WHERE EXISTS (SELECT what_I_need FROM +othertable); + +In general, though, SELECT WHERE LIMIT 1 is about as fast as you can get. + +>Thanks +>t.v. +> +> +John +=:-> + + +--------------enig1331E127074036E0F475E918 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.6 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCWSWeJdeBCYSNAAMRAsNgAKDP60wU78IHtYegCYeb8AQDASXsrgCghKUL +H0+IvAyjtALOdBtPMWsLI7c= +=a+Jj +-----END PGP SIGNATURE----- + +--------------enig1331E127074036E0F475E918-- + +From pgsql-performance-owner@postgresql.org Sun Apr 10 22:17:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 748195358F + for ; + Sun, 10 Apr 2005 22:12:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56156-02 + for ; + Mon, 11 Apr 2005 01:12:38 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 52DF152952 + for ; + Sun, 10 Apr 2005 22:12:37 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3B1Cf018664; + Sun, 10 Apr 2005 21:12:41 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504110112.j3B1Cf018664@candle.pha.pa.us> +Subject: Re: Compressing WAL +In-Reply-To: <20050405040457.GK93835@decibel.org> +To: "Jim C. Nasby" +Date: Sun, 10 Apr 2005 21:12:41 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/194 +X-Sequence-Number: 11591 + +Jim C. Nasby wrote: +> Maybe better for -hackers, but here it goes anyway... +> +> Has anyone looked at compressing WAL's before writing to disk? On a +> system generating a lot of WAL it seems there might be some gains to be +> had WAL data could be compressed before going to disk, since today's +> machines are generally more I/O bound than CPU bound. And unlike the +> base tables, you generally don't need to read the WAL, so you don't +> really need to worry about not being able to quickly scan through the +> data without decompressing it. + +I have never heard anyone talk about it, but it seems useful. I think +compressing the page images written on first page modification since +checkpoint would be a big win. + +Is this a TODO? + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Sun Apr 10 22:30:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 35399536E0; + Sun, 10 Apr 2005 22:30:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61397-10; Mon, 11 Apr 2005 01:30:24 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id DBAA253813; + Sun, 10 Apr 2005 22:30:10 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7218249; Sun, 10 Apr 2005 18:32:07 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Neil Conway +Subject: Re: Functionscan estimates +Date: Sun, 10 Apr 2005 18:29:38 -0700 +User-Agent: KMail/1.6.2 +Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +References: <200504081515.50340.josh@agliodbs.com> + <22291.1113061523@sss.pgh.pa.us> <4258BD20.7090907@samurai.com> +In-Reply-To: <4258BD20.7090907@samurai.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504101829.38841.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/195 +X-Sequence-Number: 11592 + +People: + +(HACKERS: Please read this entire thread at +http://archives.postgresql.org/pgsql-performance/2005-04/msg00179.php +Sorry for crossing this over.) + +> > The larger point is that writing an estimator for an SRF is frequently a +> > task about as difficult as writing the SRF itself +> +> True, although I think this doesn't necessarily kill the idea. If +> writing an estimator for a given SRF is too difficult, the user is no +> worse off than they are today. Hopefully there would be a fairly large +> class of SRFs for which writing an estimator would be relatively simple, +> and result in improved planner behavior. + +For that matter, even supplying an estimate constant would be a vast +improvement over current functionality. I would suggest, in fact, that we +allow the use of either a constant number, or an estimator function, in that +column. Among other things, this would allow implementing the constant +number right now and the use of an estimating function later, in case we can +do the one but not the other for 8.1. + +To be more sophisticated about the estimator function, it could take a subset +of the main functions arguments, based on $1 numbering, for example: +CREATE FUNCTION some_func ( INT, TEXT, TEXT, INT, INT ) ... +ALTER FUNCTION some_func WITH ESTIMATOR some_func_est( $4, $5 ) + +This would make writing estimators which would work for several functions +easier. Estimators would be a special type of functions which would take +any params and RETURN ESTIMATOR, which would be implicitly castable from some +general numeric type (like INT or FLOAT). + +> > I don't foresee a whole lot of use of an estimator hook designed as +> > proposed here. In particular, if the API is such that we can only +> > use the estimator when all the function arguments are plan-time +> > constants, it's not going to be very helpful. + +Actually, 95% of the time I use SRFs they are accepting constants and not row +references. And I use a lot of SRFs. + +> +> Yes :( One approach might be to break the function's domain into pieces +> and have the estimator function calculate the estimated result set size +> for each piece. So, given a trivial function like: +> +> foo(int): +> if $1 < 10 then produce 100 rows +> else produce 10000 rows +> +> If the planner has encoded the distribution of input tuples to the +> function as a histogram, it could invoke the SRF's estimator function +> for the boundary values of each histogram bucket, and use that to get an +> idea of the function's likely result set size at runtime. +> +> And yes, the idea as sketched is totally unworkable :) For one thing, +> the difficulty of doing this grows rapidly as the number of arguments to +> the function increases. But perhaps there is some variant of this idea +> that might work... +> +> Another thought is that the estimator could provide information on the +> cost of evaluating the function, the number of tuples produced by the +> function, and even the distribution of those tuples. + +Another possibility would be to support default values for all estimator +functions and have functions called in row context passed DEFAULT, thus +leaving it up to the estimator writer to supply median values for context +cases. Or to simply take the "first" values and use those. + +While any of these possibilites aren't ideal, they are an improvement over the +current "flat 1000" estimate. As I said, even the ability to set a +per-function flat constant estimate would be an improvement. + +> BTW, why is this on -performance? It should be on -hackers. + +'cause I spend more time reading -performance, and I started the thread. +Crossed over now. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sun Apr 10 22:41:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 562F5534A9 + for ; + Sun, 10 Apr 2005 22:41:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63873-10 + for ; + Mon, 11 Apr 2005 01:41:35 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 2DD485349C + for ; + Sun, 10 Apr 2005 22:41:34 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7218288; Sun, 10 Apr 2005 18:43:34 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: KeithW@narrowpathinc.com +Subject: Re: 4 way JOIN using aliases +Date: Sun, 10 Apr 2005 18:41:05 -0700 +User-Agent: KMail/1.6.2 +Cc: "PostgreSQL Perform" +References: <20050407140133.M89867@narrowpathinc.com> +In-Reply-To: <20050407140133.M89867@narrowpathinc.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200504101841.05234.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/196 +X-Sequence-Number: 11593 + +Keith, + +> Thanks to all on the NOVICE list that gave me help I now have a query +> running that returns the results I am after. :-) =A0Now of course I want = +it +> to run faster. =A0Currently it clocks in at ~160ms. =A0I have checked ove= +r the +> indexes and I belive that the tables are indexed properly. =A0The largest +> table, tbl_item, only has 2000 rows. =A0Is it possible to reduce the time= + of +> this query further? =A0 + +Probably not, no. For a 7-way join including 2 LEFT JOINs on the=20 +unrestricted contents of all tables, 160ms is pretty darned good. If thes= +e=20 +tables were large, you'd be looking at a much longer estimation time. The= +=20 +only real way to speed it up would be to find a way to eliminate the left=20 +joins. Also, PostgreSQL 8.0 might optimize this query a little better. + +The only thing I can see to tweak is that the estimate on the number of row= +s=20 +in tbl_item is wrong; probably you need to ANALYZE tbl_item. But I doubt= +=20 +that will make a difference in execution time. + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sun Apr 10 22:55:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ED16A53593 + for ; + Sun, 10 Apr 2005 22:55:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68494-01 + for ; + Mon, 11 Apr 2005 01:55:08 +0000 (GMT) +Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) + by svr1.postgresql.org (Postfix) with ESMTP id E125C53564 + for ; + Sun, 10 Apr 2005 22:55:07 -0300 (ADT) +Received: from localhost (mailbox.samurai.com [205.207.28.82]) + by mailbox.samurai.com (Postfix) with ESMTP id F375F18CC64; + Sun, 10 Apr 2005 21:55:10 -0400 (EDT) +Received: from mailbox.samurai.com ([205.207.28.82]) + by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, + port 10024) + with LMTP id 14199-01-7; Sun, 10 Apr 2005 21:55:09 -0400 (EDT) +Received: from [61.88.101.19] (unknown [61.88.101.19]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mailbox.samurai.com (Postfix) with ESMTP id A5E7918CC3D; + Sun, 10 Apr 2005 21:55:08 -0400 (EDT) +Message-ID: <4259D8FA.9060307@samurai.com> +Date: Mon, 11 Apr 2005 11:55:06 +1000 +From: Neil Conway +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: KeithW@narrowpathinc.com +Cc: PostgreSQL Perform +Subject: Re: 4 way JOIN using aliases +References: <20050407140133.M89867@narrowpathinc.com> +In-Reply-To: <20050407140133.M89867@narrowpathinc.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at mailbox.samurai.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/197 +X-Sequence-Number: 11594 + +Keith Worthington wrote: +> -> Seq Scan on tbl_current (cost=0.00..1775.57 rows=76457 +> width=31) (actual time=22.870..25.024 rows=605 loops=1) + +This rowcount is way off -- have you run ANALYZE recently? + +-Neil + +From pgsql-performance-owner@postgresql.org Mon Apr 11 00:17:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E3BC75348F + for ; + Mon, 11 Apr 2005 00:16:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83687-01 + for ; + Mon, 11 Apr 2005 03:16:33 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 614DD5331E + for ; + Mon, 11 Apr 2005 00:16:32 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so2490000wra + for ; + Sun, 10 Apr 2005 20:16:32 -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; + b=HrcYlWNhNdPS7KqkoVxyQnFzy9YLrFilEGx4G2o/PY56HfSEKWuG+JBAnvxmfaq2SAJO3h4kvIydUmNh52H3nYv0Kjk9VVYIBo2xmm0nvr3fS7BNAPO000H+WoZInUmZ3gUB8hrJEZFE2mSkHxlbw1923GqPweJGtnygPut2clE= +Received: by 10.54.21.37 with SMTP id 37mr1709205wru; + Sun, 10 Apr 2005 20:16:32 -0700 (PDT) +Received: by 10.54.97.13 with HTTP; Sun, 10 Apr 2005 20:16:30 -0700 (PDT) +Message-ID: <6c21003b05041020166d32111c@mail.gmail.com> +Date: Sun, 10 Apr 2005 22:16:30 -0500 +From: Don Drake +Reply-To: Don Drake +To: pgsql-performance@postgresql.org +Subject: Server crashing +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.211 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/198 +X-Sequence-Number: 11595 + +My server is crashing on a delete statement. + +Here's the error message in the log file: + +LOCATION: ShutdownXLOG, xlog.c:3090 +LOG: 00000: database system is shut down +LOCATION: ShutdownXLOG, xlog.c:3104 +LOG: 00000: database system was shut down at 2005-04-10 21:54:34 CDT +LOCATION: StartupXLOG, xlog.c:2596 +LOG: 00000: checkpoint record is at C/665D45E0 +LOCATION: StartupXLOG, xlog.c:2628 +LOG: 00000: redo record is at C/665D45E0; undo record is at 0/0; shutdown TRUE +LOCATION: StartupXLOG, xlog.c:2653 +LOG: 00000: next transaction ID: 109177; next OID: 92547340 +LOCATION: StartupXLOG, xlog.c:2656 +LOG: 00000: database system is ready +LOCATION: StartupXLOG, xlog.c:2946 +LOG: 00000: recycled transaction log file "0000000C00000063" +LOCATION: MoveOfflineLogs, xlog.c:1656 +LOG: 00000: recycled transaction log file "0000000C00000064" +LOCATION: MoveOfflineLogs, xlog.c:1656 +LOG: 00000: recycled transaction log file "0000000C00000065" +LOCATION: MoveOfflineLogs, xlog.c:1656 +WARNING: 25P01: there is no transaction in progress +LOCATION: EndTransactionBlock, xact.c:1607 +WARNING: 25P01: there is no transaction in progress +LOCATION: EndTransactionBlock, xact.c:1607 +ERROR: 42601: syntax error at end of input at character 77 +LOCATION: yyerror, scan.l:565 +WARNING: 25P01: there is no transaction in progress +LOCATION: EndTransactionBlock, xact.c:1607 +ERROR: 42601: syntax error at end of input at character 77 +LOCATION: yyerror, scan.l:565 +WARNING: 25P01: there is no transaction in progress +LOCATION: EndTransactionBlock, xact.c:1607 +WARNING: 25001: there is already a transaction in progress +LOCATION: BeginTransactionBlock, xact.c:1545 +ERROR: 42601: syntax error at end of input at character 77 +LOCATION: yyerror, scan.l:565 +WARNING: 25001: there is already a transaction in progress +LOCATION: BeginTransactionBlock, xact.c:1545 +ERROR: 42601: syntax error at end of input at character 77 +LOCATION: yyerror, scan.l:565 +LOG: 00000: received fast shutdown request +LOCATION: pmdie, postmaster.c:1736 +LOG: 00000: aborting any active transactions +LOCATION: pmdie, postmaster.c:1743 +FATAL: 57P01: terminating connection due to administrator command +LOCATION: ProcessInterrupts, postgres.c:1955 +FATAL: 57P01: terminating connection due to administrator command +LOCATION: ProcessInterrupts, postgres.c:1955 +FATAL: 57P01: terminating connection due to administrator command +LOCATION: ProcessInterrupts, postgres.c:1955 +FATAL: 57P01: terminating connection due to administrator command +LOCATION: ProcessInterrupts, postgres.c:1955 +LOG: 00000: shutting down +LOCATION: ShutdownXLOG, xlog.c:3090 +LOG: 00000: database system is shut down +LOCATION: ShutdownXLOG, xlog.c:3104 + + +I just turned off SQL command logging, stopped and started the process +and now this command which worked just fine before is causing the DB +to crash. I'm running Postgres 7.4.7 on Solaris 9 with PostGIS 0.9.1. + +The data I'm deleting is the parent table with many inherited child tables. + +Any ideas? + +-Don +-- +Donald Drake +President +Drake Consulting +http://www.drakeconsult.com/ +http://www.MailLaunder.com/ +http://www.mobilemeridian.com/ +312-560-1574 + +From pgsql-performance-owner@postgresql.org Mon Apr 11 01:58:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E122352D95 + for ; + Mon, 11 Apr 2005 01:58:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06754-09 + for ; + Mon, 11 Apr 2005 04:58:06 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DC4652A5C + for ; + Mon, 11 Apr 2005 01:58:04 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3B4vpiV000842; (envelope-from ) Sun, + 10 Apr 2005 23:57:51 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3B4vnDO028479 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Sun, + 10 Apr 2005 23:57:50 -0500 (CDT) +Message-ID: <425A03CF.8000604@arbash-meinel.com> +Date: Sun, 10 Apr 2005 23:57:51 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "S.Thanga Prakash" +Cc: pgsql-performance@postgresql.org +Subject: Re: help on explain analyse +References: +In-Reply-To: +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig32A18E070E1751932EAA0089" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/209 +X-Sequence-Number: 11606 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig32A18E070E1751932EAA0089 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +S.Thanga Prakash wrote: + +>hi, +> +> I am using psql 7.1.3 +> +>I didn't find option analyse in explain command.. +> +>how to get time taken by SQL procedure/query? +> +>regards, +>stp.. +> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 7: don't forget to increase your free space map settings +> +> +I don't believe it was added until 7.2. It is highly recommended that +you upgrade. Performance and stability have both been improved +tremendously between 7.1 and 8.0. + +John +=:-> + + +--------------enig32A18E070E1751932EAA0089 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCWgPPJdeBCYSNAAMRAv9EAJ9WsYWjT2an2VINYD6B9CKl6edD6ACg0QrM +6SN9lQCBKyPgA3IuLfCmFa8= +=zcbg +-----END PGP SIGNATURE----- + +--------------enig32A18E070E1751932EAA0089-- + +From pgsql-performance-owner@postgresql.org Mon Apr 11 02:03:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BEE85356F + for ; + Mon, 11 Apr 2005 02:03:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09530-09 + for ; + Mon, 11 Apr 2005 05:03:07 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C29A53565 + for ; + Mon, 11 Apr 2005 02:03:06 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 9BC4F24FDD; + Mon, 11 Apr 2005 13:03:03 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 7E3F024FCE; + Mon, 11 Apr 2005 13:03:03 +0800 (WST) +Message-ID: <425A050D.9050602@familyhealth.com.au> +Date: Mon, 11 Apr 2005 13:03:09 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: thanga@midascomm.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Is Indexed View Supported in psql 7.1.3?? +References: <2038.192.168.13.108.1112790695.squirrel@192.168.13.108> +In-Reply-To: <2038.192.168.13.108.1112790695.squirrel@192.168.13.108> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/210 +X-Sequence-Number: 11607 + +> I like to know whether Indexed View supported in psql 7.1.3.? + +No... + +> Is there any performance analysis tool for psql.? + +No, we keep telling you to upgrade to newer PostgreSQL. Then you can +use EXPLAIN ANALYZE. + +Chris + +From pgsql-performance-owner@postgresql.org Mon Apr 11 02:35:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D6DE65336B + for ; + Mon, 11 Apr 2005 02:35:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83165-02 + for ; + Mon, 11 Apr 2005 05:35:36 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 9C80552A8D + for ; + Mon, 11 Apr 2005 02:35:35 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Sun, 10 Apr 2005 22:38:34 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Sun, 10 Apr 2005 22:38:30 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005041022382922002 + for ; + Sun, 10 Apr 2005 22:38:29 -0700 +X-ASG-Debug-ID: 1113197728-16231-0-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail1 (mail1.hq.corp [192.168.160.5]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id F407220080FE + for ; + Sun, 10 Apr 2005 22:35:28 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Sun, 10 Apr 2005 22:38:21 -0700 +Message-ID: <425A0C8C.3040300@sfnet.cc> +Date: Sun, 10 Apr 2005 22:35:08 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: thanga@midascomm.com +Cc: pgsql-performance@postgresql.org +X-ASG-Orig-Subj: Re: [PERFORM] Is Indexed View Supported in psql 7.1.3?? +Subject: Re: Is Indexed View Supported in psql 7.1.3?? +References: <2038.192.168.13.108.1112790695.squirrel@192.168.13.108> +In-Reply-To: <2038.192.168.13.108.1112790695.squirrel@192.168.13.108> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 11 Apr 2005 05:38:21.0365 (UTC) + FILETIME=[ABFFF650:01C53E58] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: -0.41 +X-Barracuda-Spam-Status: No, SCORE=-0.41 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_05 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.205 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + -0.41 BAYES_05 BODY: Bayesian spam probability is 1 to 5% + [score: 0.0328] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.198 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/211 +X-Sequence-Number: 11608 + +stp, + +I cannot help you with the first point, but as far as performance +analysis, I share with you what I've been using. + +1) pgbench -- which comes with PostgreSQL +2) OSDB (http://osdb.sourceforge.net/) +3) pg_autotune (http://pgfoundry.org/projects/pgautotune/) +4) PQA (http://pgfoundry.org/projects/pqa/) + +You did not mention how your database is being used/going to be used. If +its already in production, use PQA, but I personally have not +implemented yet since seemed to be to take a performance hit of 15-25% +when running it. Your mileage may vary. + +I use pgbench for quick tests and OSDB for more disk thrash testing. + +I am new to this; maybe someone else may be able to speak from more +experience. + +Regards. + +Steve Poe + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 11 03:29:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 87F6853877 + for ; + Mon, 11 Apr 2005 03:29:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02776-08 + for ; + Mon, 11 Apr 2005 06:29:26 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 47D2C53475 + for ; + Mon, 11 Apr 2005 03:29:26 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3B6TPdC022321; + Mon, 11 Apr 2005 02:29:25 -0400 (EDT) +To: Don Drake +Cc: pgsql-performance@postgresql.org +Subject: Re: Server crashing +In-reply-to: <6c21003b05041020166d32111c@mail.gmail.com> +References: <6c21003b05041020166d32111c@mail.gmail.com> +Comments: In-reply-to Don Drake + message dated "Sun, 10 Apr 2005 22:16:30 -0500" +Date: Mon, 11 Apr 2005 02:29:25 -0400 +Message-ID: <22320.1113200965@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/212 +X-Sequence-Number: 11609 + +Don Drake writes: +> My server is crashing on a delete statement. +> Here's the error message in the log file: + +> LOG: 00000: received fast shutdown request +> LOCATION: pmdie, postmaster.c:1736 + +That says that something sent the postmaster a SIGINT signal. +I think it's highly unlikely that the DELETE statement did it. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 11 03:41:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 84D0E53980 + for ; + Mon, 11 Apr 2005 03:41:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06154-05 + for ; + Mon, 11 Apr 2005 06:41:04 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id F3EB753974 + for ; + Mon, 11 Apr 2005 03:41:03 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3B6ewje022411; + Mon, 11 Apr 2005 02:40:58 -0400 (EDT) +To: =?UTF-8?B?SmFyb3PFgmF3IFBhxYJrYQ==?= +Cc: pgsql-performance@postgresql.org +Subject: Re: Never ending delete story +In-reply-to: <42544F01.7090208@mrt-system.pl> +References: <42544F01.7090208@mrt-system.pl> +Comments: In-reply-to =?UTF-8?B?SmFyb3PFgmF3IFBhxYJrYQ==?= + + message dated "Wed, 06 Apr 2005 23:05:05 +0200" +Date: Mon, 11 Apr 2005 02:40:58 -0400 +Message-ID: <22410.1113201658@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/213 +X-Sequence-Number: 11610 + +=?UTF-8?B?SmFyb3PFgmF3IFBhxYJrYQ==?= writes: +> We are running PostgreSQL server version 7.4.6 on RedHat 9 (Shrike) on +> single Pentium 4 (2.66 GHz) box with SCSI disc and 512 MB RAM. +> Our database contains several tables (small size) and one special table +> with ~1000000 records (it contains log entries from system activity).We +> decided that its time to do a little clean-up and it's still running +> (for about 12 hours) and it seems that it won't stop :(( + +Do you have any foreign keys linking *to* (not from) this table? +If so, they probably need indexes on the far end. Also check for +datatype discrepancies. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 11 10:00:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B1AE2536F1 + for ; + Mon, 11 Apr 2005 10:00:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08754-09 + for ; + Mon, 11 Apr 2005 13:00:05 +0000 (GMT) +Received: from ns.aprote.ee (ns.aprote.ee [80.235.78.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 59B2C536E0 + for ; + Mon, 11 Apr 2005 09:59:58 -0300 (ADT) +Received: Message by Barricade ns.aprote.ee with ESMTP id j3BD1gsC000308 + for ; Mon, 11 Apr 2005 16:01:43 +0300 +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.6556.0 +Subject: Re: performance - triggers, row existence etc. +Date: Mon, 11 Apr 2005 15:59:56 +0300 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: performance - triggers, row existence etc. +Thread-Index: AcU+llxteWGjgGLVTduHOuEjXKRPBg== +From: "Tambet Matiisen" +To: , +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/214 +X-Sequence-Number: 11611 + +... +>=20 +> 2) Is there some (performance) difference between BEFORE and AFTER +> triggers? I believe there's no measurable difference. +>=20 + +BEFORE triggers might be faster, because you get a chance to reject the +record before it is inserted into table. Common practice is to put +validity checks into BEFORE triggers and updates of other tables into +AFTER triggers. See also +http://archives.postgresql.org/pgsql-sql/2005-04/msg00088.php. + +> 3) Vast majority of SQL commands inside the trigger checks=20 +> whether there +> exists a row that suits some conditions (same IP, visitor ID etc.) +> Currently I do this by +>=20 +> SELECT INTO tmp id FROM ... JOIN ... WHERE ... LIMIT 1 +> IF NOT FOUND THEN +> .... +> END IF; +>=20 +> and so on. I believe this is fast and low-cost solution (compared +> to the COUNT(*) way I've used before), but is there some=20 +> even better +> (faster) way to check row existence? +>=20 + +You could save one temporary variable by using PERFORM: + +PERFORM 1 FROM ... JOIN ... WHERE ... LIMIT 1; +IF NOT FOUND THEN +... +END IF; + +You might want to consider, if you need FOR UPDATE in those queries, so +that the referenced row maintains it's state until the end of +transaction. BTW, foreign keys weren't enough? + + Tambet + +From pgsql-performance-owner@postgresql.org Mon Apr 11 11:24:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EA3A55368E + for ; + Mon, 11 Apr 2005 11:24:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39721-05 + for ; + Mon, 11 Apr 2005 14:24:15 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D04D5321B + for ; + Mon, 11 Apr 2005 11:24:14 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 67so2803071wri + for ; + Mon, 11 Apr 2005 07:24:19 -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:references; + b=XJkR1HxZPIBfdbSocZpXB2cW4IjK6Z2BNEiRY+VETujdW8nn7TIMDf+Y4R2B2vE5vmweTdbdfql79X90cMbwfSNpe4ytPEIOMsoMqiB1owKaO+sg70E8Dn5IVf2JWUri5gwrOTtox/odDkc5JOE1OI6kJQqPv3SbzdZuo/ZN5MU= +Received: by 10.54.21.37 with SMTP id 37mr2144227wru; + Mon, 11 Apr 2005 07:24:18 -0700 (PDT) +Received: by 10.54.97.13 with HTTP; Mon, 11 Apr 2005 07:24:18 -0700 (PDT) +Message-ID: <6c21003b0504110724711a9685@mail.gmail.com> +Date: Mon, 11 Apr 2005 09:24:18 -0500 +From: Don Drake +Reply-To: Don Drake +To: Tom Lane +Subject: Re: Server crashing +Cc: pgsql-performance@postgresql.org +In-Reply-To: <22320.1113200965@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <6c21003b05041020166d32111c@mail.gmail.com> + <22320.1113200965@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.218 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/215 +X-Sequence-Number: 11612 + +Well, a vacuum on the entire DB seemed to have cleaned things up. + +No other user was logged into the server, and I certainly did not send +the signal. + +I did clean up the serverlog file by truncating it ( > serverlog) +while the DB was running, I don't think it liked that since it crashed +the DB. I've done this on my Linux server many times and it never +complained. I won't be doing that again. + +-Don + +On Apr 11, 2005 1:29 AM, Tom Lane wrote: +> Don Drake writes: +> > My server is crashing on a delete statement. +> > Here's the error message in the log file: +> +> > LOG: 00000: received fast shutdown request +> > LOCATION: pmdie, postmaster.c:1736 +> +> That says that something sent the postmaster a SIGINT signal. +> I think it's highly unlikely that the DELETE statement did it. +> +> regards, tom lane +> + + +-- +Donald Drake +President +Drake Consulting +http://www.drakeconsult.com/ +http://www.MailLaunder.com/ +http://www.mobilemeridian.com/ +312-560-1574 + +From pgsql-performance-owner@postgresql.org Mon Apr 11 12:15:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F153D5389A + for ; + Mon, 11 Apr 2005 12:15:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57285-09 + for ; + Mon, 11 Apr 2005 15:15:38 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 45475538C1 + for ; + Mon, 11 Apr 2005 12:15:37 -0300 (ADT) +Received: by rproxy.gmail.com with SMTP id j1so1152236rnf + for ; + Mon, 11 Apr 2005 08:15: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=c0NjS+bhhUH72x53FBJ1xHR1OULjrVxETqXXLDrsMmzflqG5KdVjrJKvihHe4AtZqUvprFGO5GOrn1bOSRrPz3MKOfKjO4MhGB2Jn4N2bL4j9nIy1XoAxH8eYWPcZG2jZtHoHB0wHz2J41xPDj1BE/R7dG9E9KJjMgbls7zpiZw= +Received: by 10.39.3.56 with SMTP id f56mr2862593rni; + Mon, 11 Apr 2005 08:15:36 -0700 (PDT) +Received: by 10.38.97.43 with HTTP; Mon, 11 Apr 2005 08:15:36 -0700 (PDT) +Message-ID: <674d1f8a05041108154d08f587@mail.gmail.com> +Date: Mon, 11 Apr 2005 20:45:36 +0530 +From: Gourish Singbal +Reply-To: Gourish Singbal +To: Don Drake +Subject: Re: Server crashing +Cc: Tom Lane , pgsql-performance@postgresql.org +In-Reply-To: <6c21003b0504110724711a9685@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <6c21003b05041020166d32111c@mail.gmail.com> + <22320.1113200965@sss.pgh.pa.us> + <6c21003b0504110724711a9685@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.258 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/216 +X-Sequence-Number: 11613 + +by Truncating the serverlog do you mean the data_log (as in my case) +log file of the postgresql sever ?. If thats the file you truncated +than i think its not a good habit..since you might need it at some +point of time for some debugging purpose in production. + +You could use something like assuming there is a dummy file of 0 bytes +in logs folder.. + +cp data_log data_log_$current_time +cat logs/dummy_file>data_log +gzip data_log_$current_time +mv data_log_$current_time.gz logs/data_log_$current_time.gz + +Hope this helps + +Best +Gourish Singbal + + +On Apr 11, 2005 7:54 PM, Don Drake wrote: +> Well, a vacuum on the entire DB seemed to have cleaned things up. +> +> No other user was logged into the server, and I certainly did not send +> the signal. +> +> I did clean up the serverlog file by truncating it ( > serverlog) +> while the DB was running, I don't think it liked that since it crashed +> the DB. I've done this on my Linux server many times and it never +> complained. I won't be doing that again. +> +> -Don +> +> On Apr 11, 2005 1:29 AM, Tom Lane wrote: +> > Don Drake writes: +> > > My server is crashing on a delete statement. +> > > Here's the error message in the log file: +> > +> > > LOG: 00000: received fast shutdown request +> > > LOCATION: pmdie, postmaster.c:1736 +> > +> > That says that something sent the postmaster a SIGINT signal. +> > I think it's highly unlikely that the DELETE statement did it. +> > +> > regards, tom lane +> > +> +> -- +> Donald Drake +> President +> Drake Consulting +> http://www.drakeconsult.com/ +> http://www.MailLaunder.com/ +> http://www.mobilemeridian.com/ +> 312-560-1574 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if your +> joining column's datatypes do not match +> + + +-- +Best, +Gourish Singbal + +From pgsql-performance-owner@postgresql.org Mon Apr 11 14:14:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6274553720 + for ; + Mon, 11 Apr 2005 14:14:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00499-03 + for ; + Mon, 11 Apr 2005 17:14:29 +0000 (GMT) +Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D7055363B + for ; + Mon, 11 Apr 2005 14:14:28 -0300 (ADT) +Received: from jfradkin ([66.15.127.235]) + by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IES00L4NL816QQ1@vms042.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 11 Apr 2005 12:14:26 -0500 (CDT) +Date: Mon, 11 Apr 2005 13:14:32 -0400 +From: "Joel Fradkin" +Subject: Is there somthing I need to do on my production server? +To: "PostgreSQL Perform" +Message-id: <002c01c53eb9$ee07af00$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=iso-8859-1 +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.26 tagged_above=0 required=5 tests=AWL +X-Spam-Level: * +X-Archive-Number: 200504/217 +X-Sequence-Number: 11614 + +I am running 8.0.1 on a desktop xp system and a AS4 redhat system. +The redhat will be my production server in a week or so and it is = +returning +slower the my desk top? +I understand about the perc cards on the Dell (redhat) but my Dell 2 = +proc +box runs much faster (MSSQL) then my desktop, so I am wondering if I = +messed +up Linux or have a postgres config issue.=20 + +On my desktop (1 proc 2 gigs of memor) I get: +"Merge Join=A0 (cost=3D7135.56..7296.25 rows=3D7906 width=3D228) (actual +time=3D5281.000..6266.000 rows=3D160593 loops=3D1)" +"=A0 Merge Cond: ("outer".locationid =3D "inner".locationid)" +"=A0 ->=A0 Sort=A0 (cost=3D955.78..957.07 rows=3D514 width=3D79) (actual +time=3D0.000..0.000 rows=3D441 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0 Sort Key: l.locationid" +"=A0=A0=A0=A0=A0=A0=A0 ->=A0 Index Scan using ix_location on tbllocation = +l=A0 +(cost=3D0.00..932.64 rows=3D514 width=3D79) (actual time=3D0.000..0.000 = +rows=3D441 +loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Index Cond: ('SAKS'::text =3D = +(clientnum)::text)" +"=A0 ->=A0 Sort=A0 (cost=3D6179.77..6187.46 rows=3D3076 width=3D173) = +(actual +time=3D5281.000..5424.000 rows=3D160594 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0 Sort Key: a.locationid" +"=A0=A0=A0=A0=A0=A0=A0 ->=A0 Merge Left Join=A0 (cost=3D154.41..6001.57 = +rows=3D3076 width=3D173) +(actual time=3D94.000..2875.000 rows=3D177041 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Merge Cond: = +((("outer".clientnum)::text =3D +"inner"."?column4?") AND ("outer".jobtitleid =3D "inner".id))" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Index Scan using = +ix_tblassoc_jobtitleid on tblassociate +a=A0 (cost=3D0.00..5831.49 rows=3D3076 width=3D134) (actual = +time=3D0.000..676.000 +rows=3D177041 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Index Cond: = +((clientnum)::text =3D 'SAKS'::text)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Sort=A0 = +(cost=3D154.41..154.50 rows=3D34 width=3D67) (actual +time=3D78.000..204.000 rows=3D158255 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Sort Key: = +(jt.clientnum)::text, jt.id" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Seq = +Scan on tbljobtitle jt=A0 (cost=3D0.00..153.55 +rows=3D34 width=3D67) (actual time=3D0.000..31.000 rows=3D6603 = +loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= +=A0 Filter: (1 =3D presentationid)" +"Total runtime: 6563.000 ms" +On my production (4 proc, 8 gigs of memory) +"Merge Join=A0 (cost=3D69667.87..70713.46 rows=3D15002 width=3D113) = +(actual +time=3D12140.091..12977.841 rows=3D160593 loops=3D1)" +"=A0 Merge Cond: ("outer".locationid =3D "inner".locationid)" +"=A0 ->=A0 Sort=A0 (cost=3D790.03..791.11 rows=3D433 width=3D49) (actual +time=3D2.936..3.219 rows=3D441 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0 Sort Key: l.locationid" +"=A0=A0=A0=A0=A0=A0=A0 ->=A0 Index Scan using ix_location on tbllocation = +l=A0 +(cost=3D0.00..771.06 rows=3D433 width=3D49) (actual time=3D0.062..1.981 = +rows=3D441 +loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Index Cond: ('SAKS'::text =3D = +(clientnum)::text)" +"=A0 ->=A0 Sort=A0 (cost=3D68877.84..69320.17 rows=3D176933 width=3D75) = +(actual +time=3D12137.081..12305.125 rows=3D160594 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0 Sort Key: a.locationid" +"=A0=A0=A0=A0=A0=A0=A0 ->=A0 Merge Right Join=A0 = +(cost=3D46271.48..48961.53 rows=3D176933 +width=3D75) (actual time=3D9096.623..10092.311 rows=3D177041 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Merge Cond: = +((("outer".clientnum)::text =3D +"inner"."?column10?") AND ("outer".id =3D "inner".jobtitleid))" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Index Scan using = +ix_tbljobtitle_id on tbljobtitle jt=A0 +(cost=3D0.00..239.76 rows=3D6604 width=3D37) (actual = +time=3D0.068..12.157 rows=3D5690 +loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Filter: (1 = +=3D presentationid)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Sort=A0 = +(cost=3D46271.48..46713.81 rows=3D176933 width=3D53) +(actual time=3D9081.546..9295.495 rows=3D177041 loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Sort Key: = +(a.clientnum)::text, a.jobtitleid" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Seq = +Scan on tblassociate a=A0 (cost=3D0.00..30849.25 +rows=3D176933 width=3D53) (actual time=3D543.931..1674.518 rows=3D177041 = +loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= +=A0 Filter: ((clientnum)::text =3D 'SAKS'::text)" +"Total runtime: 13101.402 ms" +=A0 +I am at a bit of a loss as I would have thought my soon to be production = +box +should be blowing away my desktop? +=A0 +Also stupid newb question? +I am a bit confused looking at the results of explain analyze. +I would have thought the explain analyze select * from viwassoclist = +where +clientnum =3D'SAKS' +Would first limit the result set by clientnum =3D =91SAKS=94 is this the = +bottom +line? +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ->=A0 Seq = +Scan on tblassociate a=A0 (cost=3D0.00..30849.25 +rows=3D176933 width=3D53) (actual time=3D543.931..1674.518 rows=3D177041 = +loops=3D1)" +"=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= +=A0 Filter: ((clientnum)::text =3D 'SAKS'::text)" +which if I understand this (not saying I do) is taking actual +time=3D543.931..1674.518 rows=3D177041 loops=3D1 +this means 1 loop takes between 543 and 1674 milisecs to return 177041 = +rows? +And the analyzer thought I would take cost=3D0.00..30849.25? +=A0 +I am just trying to understand if I can do the sql different to get a = +faster +result. +I am going to try and eliminate my left outer joins and aggregates on = +select +throughout the app as well as eliminate some unions that exist. +=A0 + + +Joel Fradkin +=A0 +Wazagua, Inc. +2520 Trailmate Dr +Sarasota, Florida 34243 +Tel.=A0 941-753-7111 ext 305 +=A0 +jfradkin@wazagua.com +www.wazagua.com +Powered by Wazagua +Providing you with the latest Web-based technology & advanced tools. +=A9 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA,=A0Inc +=A0This email message is for the use of the intended recipient(s) and = +may +contain confidential and privileged information.=A0 Any unauthorized = +review, +use, disclosure or distribution is prohibited.=A0 If you are not the = +intended +recipient, please contact the sender by reply email and delete and = +destroy +all copies of the original message, including attachments. +=A0 + +=A0 + + + +From pgsql-performance-owner@postgresql.org Mon Apr 11 15:00:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D64952A31; + Mon, 11 Apr 2005 14:59:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13473-06; Mon, 11 Apr 2005 17:59:52 +0000 (GMT) +Received: from joeconway.com (wsip-24-249-201-67.sd.sd.cox.net + [24.249.201.67]) + by svr1.postgresql.org (Postfix) with ESMTP id 993B253927; + Mon, 11 Apr 2005 14:59:50 -0300 (ADT) +Received: from [206.19.64.3] (account jconway HELO [172.16.1.115]) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 2746463; Mon, 11 Apr 2005 11:58:56 -0700 +Message-ID: <425ABB17.305@joeconway.com> +Date: Mon, 11 Apr 2005 10:59:51 -0700 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; + rv:1.7.6) Gecko/20050323 Fedora/1.7.6-1.3.2 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Aditya +Cc: Jeff Frost , + Josh Berkus , sfpug@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: [sfpug] DATA directory on network attached storage +References: <200502091350.24885.josh@agliodbs.com> + + <20050408192136.GD72199@mighty.grot.org> +In-Reply-To: <20050408192136.GD72199@mighty.grot.org> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/218 +X-Sequence-Number: 11615 + +Aditya wrote: +> We have not, AFAICT, had any problems with the traffic over NFS as far as +> reliability -- I'm sure there is a performance penalty, but the reliability +> and scalability gains more than offset that. + +My experience agrees with yours. However we did find one gotcha -- see +the thread starting here for details: +http://archives.postgresql.org/pgsql-hackers/2004-12/msg00479.php + +In a nutshell, be careful when using an nfs mounted data directory +combined with an init script that creates a new data dir when it doesn't +find one. + +> FWIW, if I were to do this anew, I would probably opt for iSCSI over GigE with +> a NetApp. + +Any particular reason? Our NetApp technical rep advised nfs over iSCSI, +IIRC because of performance. + +Joe + +From pgsql-performance-owner@postgresql.org Tue Apr 12 01:22:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F394952A31; + Mon, 11 Apr 2005 15:20:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22346-04; Mon, 11 Apr 2005 18:20:34 +0000 (GMT) +Received: from mighty.grot.org (66-117-150-96.web.lmi.net [66.117.150.96]) + by svr1.postgresql.org (Postfix) with ESMTP id E785053CDA; + Mon, 11 Apr 2005 15:20:32 -0300 (ADT) +Received: by mighty.grot.org (Postfix, from userid 515) + id F24F65D6A; Mon, 11 Apr 2005 18:20:32 +0000 (GMT) +Date: Mon, 11 Apr 2005 18:20:32 +0000 +From: Aditya +To: Joe Conway +Cc: Jeff Frost , + Josh Berkus , sfpug@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: [sfpug] DATA directory on network attached storage +Message-ID: <20050411182032.GA48183@mighty.grot.org> +References: <200502091350.24885.josh@agliodbs.com> + + <20050408192136.GD72199@mighty.grot.org> + <425ABB17.305@joeconway.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <425ABB17.305@joeconway.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/222 +X-Sequence-Number: 11619 + +On Mon, Apr 11, 2005 at 10:59:51AM -0700, Joe Conway wrote: +> >FWIW, if I were to do this anew, I would probably opt for iSCSI over GigE +> >with +> >a NetApp. +> +> Any particular reason? Our NetApp technical rep advised nfs over iSCSI, +> IIRC because of performance. + +I would mount the Netapp volume(s) as a block level device on my server using +iSCSI (vs. a file-based device like NFS) so that filesystem parameters could +be more finely tuned and one could really make use of jumbo frames over GigE. + +But that level of tuning depends on load after all and with a Netapp you can +have both, so maybe start with having your databases on an NFS volume on the +Netapp, and when you have a better idea of the tuning requirements, move it +over to a iSCSI LUN. + +I'm not sure I understand why NFS would perform better than iSCSI -- in any +case, some large Oracle dbs at my current job are moving to iSCSI on Netapp +and in that environment both Oracle and Netapp advise iSCSI (probably because +Oracle uses the block-level device directly), so I suspend the difference in +performance is minimal. + +Adi + +From pgsql-performance-owner@postgresql.org Mon Apr 11 15:29:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B2C0C53239 + for ; + Mon, 11 Apr 2005 15:29:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23451-06 + for ; + Mon, 11 Apr 2005 18:29:16 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 17C0E5295F + for ; + Mon, 11 Apr 2005 15:29:15 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IES00FFIOOR9FJ0@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 11 Apr 2005 13:29:16 -0500 (CDT) +Date: Mon, 11 Apr 2005 14:29:22 -0400 +From: "Joel Fradkin" +Subject: Re: Is there somthing I need to do on my production server? +In-reply-to: <002c01c53eb9$ee07af00$797ba8c0@jfradkin> +To: "'PostgreSQL Perform'" +Message-id: <000001c53ec4$625336e0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/219 +X-Sequence-Number: 11616 + + + +Here is the config for the AS4 server. +# ----------------------------- +# PostgreSQL configuration file +# ----------------------------- +# +# This file consists of lines of the form: +# +# name =3D value +# +# (The '=3D' is optional.) White space may be used. Comments are = +introduced +# with '#' anywhere on a line. The complete list of option names and +# allowed values can be found in the PostgreSQL documentation. The +# commented-out settings shown in this file represent the default = +values. +# +# Please note that re-commenting a setting is NOT sufficient to revert = +it +# to the default value, unless you restart the postmaster. +# +# Any option can also be given as a command line switch to the +# postmaster, e.g. 'postmaster -c log_connections=3Don'. Some options +# can be changed at run-time with the 'SET' SQL command. +# +# This file is read on postmaster startup and when the postmaster +# receives a SIGHUP. If you edit the file on a running system, you have +# to SIGHUP the postmaster for the changes to take effect, or use +# "pg_ctl reload". Some settings, such as listen_address, require +# a postmaster shutdown and restart to take effect. + + +#------------------------------------------------------------------------= +--- +# 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 =3D 'ConfigDir' # use data in another = +directory +#data_directory =3D '/pgdata/data' +# hba_file =3D 'ConfigDir/pg_hba.conf' # the host-based = +authentication file +# ident_file =3D 'ConfigDir/pg_ident.conf' # the IDENT configuration = +file + +# If external_pid_file is not explicitly set, no extra pid file is = +written. +# external_pid_file =3D '(none)' # write an extra pid file + + +#------------------------------------------------------------------------= +--- +# CONNECTIONS AND AUTHENTICATION +#------------------------------------------------------------------------= +--- + +# - Connection Settings - + +#listen_addresses =3D 'localhost' # what IP interface(s) to listen on; + # defaults to localhost, '*' =3D any + +listen_addresses =3D '*' +port =3D 5432 +max_connections =3D 100 + # note: increasing max_connections costs about 500 bytes of = +shared + # memory per connection slot, in addition to costs from +shared_buffers + # and max_locks_per_transaction. +#superuser_reserved_connections =3D 2 +#unix_socket_directory =3D '' +#unix_socket_group =3D '' +#unix_socket_permissions =3D 0777 # octal +#rendezvous_name =3D '' # defaults to the computer name + +# - Security & Authentication - + +#authentication_timeout =3D 60 # 1-600, in seconds +#ssl =3D false +#password_encryption =3D true +#krb_server_keyfile =3D '' +#db_user_namespace =3D false + +#------------------------------------------------------------------------= +--- +# RESOURCE USAGE (except WAL) +#------------------------------------------------------------------------= +--- + +# - Memory - + +shared_buffers =3D 12288 #5000 min 16, at least max_connections*2, 8KB = +each +#work_mem =3D 1024 # min 64, size in KB +work_mem =3D 16384 # 8192 +#maintenance_work_mem =3D 16384 # min 1024, size in KB +#max_stack_depth =3D 2048 # min 100, size in KB + +# - Free Space Map - + +max_fsm_pages =3D 100000 #30000 # min max_fsm_relations*16, 6 bytes = +each +max_fsm_relations =3D 1500 #1000 # min 100, ~50 bytes each + +# - Kernel Resource Usage - + +#max_files_per_process =3D 1000 # min 25 +#preload_libraries =3D '' + +# - Cost-Based Vacuum Delay - + +#vacuum_cost_delay =3D 0 # 0-1000 milliseconds +#vacuum_cost_page_hit =3D 1 # 0-10000 credits +#vacuum_cost_pagE_miss =3D 10 # 0-10000 credits +#vacuum_cost_page_dirty =3D 20 # 0-10000 credits +#vacuum_cost_limit =3D 200 # 0-10000 credits + +# - Background writer - + +#bgwriter_delay =3D 200 # 10-10000 milliseconds between rounds +#bgwriter_percent =3D 1 # 0-100% of dirty buffers in each = +round +#bgwriter_maxpages =3D 100 # 0-1000 buffers max per round + + +#------------------------------------------------------------------------= +--- +# WRITE AHEAD LOG +#------------------------------------------------------------------------= +--- + +# - Settings - +fsync =3D true # turns forced synchronization on or = +off +wal_sync_method =3D open_sync# fsync # the default varies across +platforms: + # fsync, fdatasync, open_sync, or +open_datasync +wal_buffers =3D 2048#8 # min 4, 8KB each +#commit_delay =3D 0 # range 0-100000, in microseconds +#commit_siblings =3D 5 # range 1-1000 + +# - Checkpoints - + +checkpoint_segments =3D 100 #3 # in logfile segments, min 1, 16MB = +each +#checkpoint_timeout =3D 300 # range 30-3600, in seconds +#checkpoint_warning =3D 30 # 0 is off, in seconds + +# - Archiving - + +#archive_command =3D '' # command to use to archive a logfile +segment + + +#------------------------------------------------------------------------= +--- +# QUERY TUNING +#------------------------------------------------------------------------= +--- + +# - Planner Method Configuration - + +#enable_hashagg =3D true +#enable_hashjoin =3D true +#enable_indexscan =3D true +#enable_mergejoin =3D false +#enable_nestloop =3D true +#enable_seqscan =3D true +#enable_sort =3D true +#enable_tidscan =3D true + +# - Planner Cost Constants - + +effective_cache_size =3D 262144 #40000 typically 8KB each +#random_page_cost =3D 4 # units are one sequential page fetch = +cost +random_page_cost =3D 2 +#cpu_tuple_cost =3D 0.01 # (same) +#cpu_index_tuple_cost =3D 0.001 # (same) +#cpu_operator_cost =3D 0.0025 # (same) + +# - Genetic Query Optimizer - + +#geqo =3D true +#geqo_threshold =3D 12 +#geqo_effort =3D 5 # range 1-10 +#geqo_pool_size =3D 0 # selects default based on effort +#geqo_generations =3D 0 # selects default based on effort +#geqo_selection_bias =3D 2.0 # range 1.5-2.0 + +# - Other Planner Options - + +default_statistics_target =3D 250#10 # range 1-1000 +#from_collapse_limit =3D 8 +#join_collapse_limit =3D 8 # 1 disables collapsing of explicit = +JOINs + + +#------------------------------------------------------------------------= +--- +# ERROR REPORTING AND LOGGING +#------------------------------------------------------------------------= +--- + +# - Where to Log - + +#log_destination =3D 'stderr' # Valid values are combinations of = +stderr, + # syslog and eventlog, depending on + # platform. + +# This is relevant when logging to stderr: +redirect_stderr =3D true # Enable capturing of stderr into log = +files. +# These are only relevant if redirect_stderr is true: +log_directory =3D 'pg_log' # Directory where log files are written. + # May be specified absolute or relative to +PGDATA +log_filename =3D 'postgresql-%a.log' # Log file name pattern. + # May include strftime() escapes +log_truncate_on_rotation =3D true # If true, 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 false, meaning append to = +existing + # files in all cases. +log_rotation_age =3D 1440 # Automatic rotation of logfiles will = +happen +after + # so many minutes. 0 to disable. +log_rotation_size =3D 0 # 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 =3D 'LOCAL0' +#syslog_ident =3D 'postgres' + + +# - When to Log - + +#client_min_messages =3D notice # Values, in order of decreasing = +detail: + # debug5, debug4, debug3, debug2, = +debug1, + # log, notice, warning, error + +#log_min_messages =3D notice # Values, in order of decreasing = +detail: + # debug5, debug4, debug3, debug2, = +debug1, + # info, notice, warning, error, log, +fatal, + # panic + +#log_error_verbosity =3D default # terse, default, or verbose messages + +#log_min_error_statement =3D panic # Values in order of increasing = +severity: + # debug5, debug4, debug3, debug2, = +debug1, + # info, notice, warning, error, +panic(off) + +#log_min_duration_statement =3D -1 # -1 is disabled, in milliseconds. + +#silent_mode =3D false # DO NOT USE without syslog or +redirect_stderr + +# - What to Log - + +#debug_print_parse =3D false +#debug_print_rewritten =3D false +#debug_print_plan =3D false +#debug_pretty_print =3D false +#log_connections =3D false +#log_disconnections =3D false +#log_duration =3D false +#log_line_prefix =3D '' # e.g. '<%u%%%d> ' + # %u=3Duser name %d=3Ddatabase name + # %r=3Dremote host and port + # %p=3DPID %t=3Dtimestamp %i=3Dcommand = +tag + # %c=3Dsession id %l=3Dsession line = +number + # %s=3Dsession start timestamp = +%x=3Dtransaction +id + # %q=3Dstop here in non-session = +processes + # %%=3D'%' +#log_statement =3D 'none' # none, mod, ddl, all +#log_hostname =3D false + +______________________________ + + +#------------------------------------------------------------------------= +--- +# RUNTIME STATISTICS +#------------------------------------------------------------------------= +--- + +# - Statistics Monitoring - + +#log_parser_stats =3D false +#log_planner_stats =3D false +#log_executor_stats =3D false +#log_statement_stats =3D false + +# - Query/Index Statistics Collector - + +#stats_start_collector =3D true +#stats_command_string =3D false +#stats_block_level =3D false +#stats_row_level =3D false +#stats_reset_on_server_start =3D true +#------------------------------------------------------------------------= +--- +# CLIENT CONNECTION DEFAULTS +#------------------------------------------------------------------------= +--- + +# - Statement Behavior - + +#search_path =3D '$user,public' # schema names +#default_tablespace =3D '' # a tablespace name, or '' for default +#check_function_bodies =3D true +#default_transaction_isolation =3D 'read committed' +#default_transaction_read_only =3D false +#statement_timeout =3D 0 # 0 is disabled, in milliseconds + +# - Locale and Formatting - + +#datestyle =3D 'iso, mdy' +#timezone =3D unknown # actually, defaults to TZ environment +setting +#australian_timezones =3D false +#extra_float_digits =3D 0 # min -15, max 2 +#client_encoding =3D sql_ascii # actually, defaults to database = +encoding + +# These settings are initialized by initdb -- they might be changed +lc_monetary =3D 'en_US.UTF-8' # locale for monetary = +formatting +lc_numeric =3D 'en_US.UTF-8' # locale for number formatting +lc_time =3D 'en_US.UTF-8' # locale for time formatting + +# - Other Defaults - + +#explain_pretty_print =3D true +#dynamic_library_path =3D '$libdir' + + +#------------------------------------------------------------------------= +--- +# LOCK MANAGEMENT +#------------------------------------------------------------------------= +--- + +#deadlock_timeout =3D 1000 # in milliseconds +#max_locks_per_transaction =3D 64 # min 10, ~200*max_connections bytes = +each + + +#------------------------------------------------------------------------= +--- +# VERSION/PLATFORM COMPATIBILITY +#------------------------------------------------------------------------= +--- + +# - Previous Postgres Versions - + +#add_missing_from =3D true +#regex_flavor =3D advanced # advanced, extended, or basic +#sql_inheritance =3D true +#default_with_oids =3D true + +# - Other Platforms & Clients - + +#transform_null_equals =3D false + + + + + + + + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 11 17:17:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B8AD537FE; + Mon, 11 Apr 2005 17:17:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60924-03; Mon, 11 Apr 2005 20:17:34 +0000 (GMT) +Received: from joeconway.com (wsip-24-249-201-67.sd.sd.cox.net + [24.249.201.67]) + by svr1.postgresql.org (Postfix) with ESMTP id 6DCBA536E7; + Mon, 11 Apr 2005 17:17:33 -0300 (ADT) +Received: from [206.19.64.3] (account jconway HELO [172.16.1.115]) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 2746794; Mon, 11 Apr 2005 14:16:40 -0700 +Message-ID: <425ADB5E.7060007@joeconway.com> +Date: Mon, 11 Apr 2005 13:17:34 -0700 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; + rv:1.7.6) Gecko/20050323 Fedora/1.7.6-1.3.2 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Aditya +Cc: Jeff Frost , + Josh Berkus , sfpug@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: [sfpug] DATA directory on network attached storage +References: <200502091350.24885.josh@agliodbs.com> + + <20050408192136.GD72199@mighty.grot.org> + <425ABB17.305@joeconway.com> + <20050411182032.GA48183@mighty.grot.org> +In-Reply-To: <20050411182032.GA48183@mighty.grot.org> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/220 +X-Sequence-Number: 11617 + +Aditya wrote: +> On Mon, Apr 11, 2005 at 10:59:51AM -0700, Joe Conway wrote: +>>Any particular reason? Our NetApp technical rep advised nfs over iSCSI, +>>IIRC because of performance. +> +> I would mount the Netapp volume(s) as a block level device on my server using +> iSCSI (vs. a file-based device like NFS) so that filesystem parameters could +> be more finely tuned and one could really make use of jumbo frames over GigE. + +Actually, we're using jumbo frames over GigE with nfs too. + +> I'm not sure I understand why NFS would perform better than iSCSI -- in any +> case, some large Oracle dbs at my current job are moving to iSCSI on Netapp +> and in that environment both Oracle and Netapp advise iSCSI (probably because +> Oracle uses the block-level device directly), so I suspend the difference in +> performance is minimal. + +We also have Oracle DBs via nfs mounted Netapp, again per the local +guru's advice. It might be one of those things that is still being +debated even within Netapp's ranks (or maybe our info is dated - worth a +check). + +Thanks, + +Joe + +From pgsql-performance-owner@postgresql.org Mon Apr 11 21:41:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E78A5344F + for ; + Mon, 11 Apr 2005 21:41:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31075-07 + for ; + Tue, 12 Apr 2005 00:41:10 +0000 (GMT) +Received: from mxsf32.cluster1.charter.net (mxsf32.cluster1.charter.net + [209.225.28.156]) + by svr1.postgresql.org (Postfix) with ESMTP id 7382B5344E + for ; + Mon, 11 Apr 2005 21:41:09 -0300 (ADT) +Received: from mxip11.cluster1.charter.net (mxip11a.cluster1.charter.net + [209.225.28.141]) + by mxsf32.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id + j3C0fB8b006563 + for ; Mon, 11 Apr 2005 20:41:11 -0400 +Received: from pc-68-118-180-13.will.ct.charter.com (HELO [192.168.116.102]) + (68.118.180.13) + by mxip11.cluster1.charter.net with ESMTP; 11 Apr 2005 20:41:03 -0400 +X-Ironport-AV: i="3.92,95,1112587200"; + d="scan'208"; a="1022360654:sNHT566498826" +Message-ID: <425B19C2.1050703@NarrowPathInc.com> +Date: Mon, 11 Apr 2005 20:43:46 -0400 +From: Keith Worthington +Reply-To: KeithW@NarrowPathInc.com +Organization: Narrow Path, Inc. +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Neil Conway +Cc: PostgreSQL Perform +Subject: Re: 4 way JOIN using aliases +References: <20050407140133.M89867@narrowpathinc.com> + <4259D8FA.9060307@samurai.com> +In-Reply-To: <4259D8FA.9060307@samurai.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.105 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/221 +X-Sequence-Number: 11618 + +Neil Conway wrote: +> Keith Worthington wrote: +> +>> -> Seq Scan on tbl_current (cost=0.00..1775.57 rows=76457 +>> width=31) (actual time=22.870..25.024 rows=605 loops=1) +> +> +> This rowcount is way off -- have you run ANALYZE recently? +> +> -Neil +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster +> +> + +Neil, + +I run vacuumdb with the analyze option every morning via a cron job. In +my ignorance I do not know if that is the same thing. + +-- +Kind Regards, +Keith + +From pgsql-performance-owner@postgresql.org Tue Apr 12 07:47:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D8CA53825 + for ; + Tue, 12 Apr 2005 07:47:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34042-01 + for ; + Tue, 12 Apr 2005 10:46:51 +0000 (GMT) +Received: from viper.eo.pl (viper.eo.pl [217.17.46.133]) + by svr1.postgresql.org (Postfix) with ESMTP id 10DC353802 + for ; + Tue, 12 Apr 2005 07:46:49 -0300 (ADT) +Received: from xxx.hq.eo.pl ([192.168.20.129] helo=localhost.localdomain) + by viper with asmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) + id 1DLIup-0006ft-FF + for pgsql-performance@postgresql.org; Tue, 12 Apr 2005 12:46:49 +0200 +Received: from depesz by localhost.localdomain with local (Exim 4.50) + id 1DLIup-00030C-2L + for pgsql-performance@postgresql.org; Tue, 12 Apr 2005 12:46:43 +0200 +Date: Tue, 12 Apr 2005 12:46:43 +0200 +From: hubert lubaczewski +To: pgsql-performance@postgresql.org +Subject: profiling postgresql queries? +Message-ID: <20050412104643.GB11445@eo.pl> +Reply-To: hubert.lubaczewski@eo.pl +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-2 +Content-Disposition: inline +X-info-en-1: this message *may* reflect my personal opinion. it is *not* +X-info-en-2: intended to reflect those of my employer, or anyone else. +X-info-pl-1: wszelkie opinie =?iso-8859-2?Q?wyra=BFone_?= + =?iso-8859-2?Q?w_tym_li=B6cie_prezentuj=B1_wy=B3=B1cznie_pogl=B1dy?= +X-info-pl-2: autora listu. opinie =?iso-8859-2?Q?te_?= + =?iso-8859-2?Q?w_=BFadnym__razie_nie__wyra=BFaj=B1__pogl=B1d=F3w?= +X-info-pl-3: pracodawcy autora =?iso-8859-2?Q?listu_?= + =?iso-8859-2?Q?_ani__innych__zwi=B1zanych__z__nim__os=F3b=2E?= +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/223 +X-Sequence-Number: 11620 + +hi +i'm not totally sure i should ask on this mailing list - so if you think +i should better ask someplace else, please let me know. + +the problem i have is that specific queries (inserts and updates) take a +long time to run. + +of course i do vacuum analyze frequently. i also use explain analyze on +queries. + +the problem is that both the inserts and updated operate on +heavy-tirggered tables. +and it made me wonder - is there a way to tell how much time of backend +was spent on triggers, index updates and so on? +like: +total query time: 1 secons +trigger a: 0.50 second +trigger b: 0.25 second +index update: 0.1 second + +something like this. + +is it possible? +will it be ever possible? + +hubert + +-- +hubert lubaczewski +Network Operations Center +eo Networks Sp. z o.o. + +From pgsql-performance-owner@postgresql.org Tue Apr 12 10:42:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D57A52A39 + for ; + Tue, 12 Apr 2005 10:41:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92463-04 + for ; + Tue, 12 Apr 2005 13:41:55 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 41AD3534B4 + for ; + Tue, 12 Apr 2005 10:41:54 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: 4 way JOIN using aliases +Date: Tue, 12 Apr 2005 08:41:55 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A9@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] 4 way JOIN using aliases +Thread-Index: AcU++PKqPvSAh16oRtSNEjMLYEWxgwAbFI/Q +From: "Dave Held" +To: "PostgreSQL Perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.074 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/224 +X-Sequence-Number: 11621 + +> -----Original Message----- +> From: Keith Worthington [mailto:KeithW@narrowpathinc.com] +> Sent: Monday, April 11, 2005 7:44 PM +> To: Neil Conway +> Cc: PostgreSQL Perform +> Subject: Re: [PERFORM] 4 way JOIN using aliases +>=20 +> Neil Conway wrote: +> > Keith Worthington wrote: +> >=20 +> >> -> Seq Scan on tbl_current =20 +> (cost=3D0.00..1775.57 rows=3D76457 +> >> width=3D31) (actual time=3D22.870..25.024 rows=3D605 loops=3D1) +> >=20 +> >=20 +> > This rowcount is way off -- have you run ANALYZE recently? +> > [...] +>=20 +> I run vacuumdb with the analyze option every morning via a=20 +> cron job. In my ignorance I do not know if that is the same +> thing. + +Pass it an --analyze option if you aren't already. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Tue Apr 12 11:11:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3DDA0534FC + for ; + Tue, 12 Apr 2005 11:11:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02681-08 + for ; + Tue, 12 Apr 2005 14:11:11 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 66DA3534E2 + for ; + Tue, 12 Apr 2005 11:11:10 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3CEArdT015426; + Tue, 12 Apr 2005 10:10:53 -0400 (EDT) +To: hubert.lubaczewski@eo.pl +Cc: pgsql-performance@postgresql.org +Subject: Re: profiling postgresql queries? +In-reply-to: <20050412104643.GB11445@eo.pl> +References: <20050412104643.GB11445@eo.pl> +Comments: In-reply-to hubert lubaczewski + message dated "Tue, 12 Apr 2005 12:46:43 +0200" +Date: Tue, 12 Apr 2005 10:10:53 -0400 +Message-ID: <15425.1113315053@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/225 +X-Sequence-Number: 11622 + +hubert lubaczewski writes: +> and it made me wonder - is there a way to tell how much time of backend +> was spent on triggers, index updates and so on? + +In CVS tip, EXPLAIN ANALYZE will break out the time spent in each +trigger. This is not in any released version, but if you're desperate +you could load up a play server with your data and test. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 12 11:12:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7850D536F7 + for ; + Tue, 12 Apr 2005 11:12:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04934-04 + for ; + Tue, 12 Apr 2005 14:12:37 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D799535A4 + for ; + Tue, 12 Apr 2005 11:12:35 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1901125wri + for ; + Tue, 12 Apr 2005 07:12:40 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; + b=Bj3MnGHicaDcePb/cld93hJMULPJQ0GwA21CTKTb31AmUCg08orGaxTVy43mD6JZHPvbJprZ/FmS/rYRL5PRp1J8P0/rUnBRROB3HvOdN32mwMQ8UCUfWzhKfZueHreJ7Zvn+IMtSEhppzEyUpY1btixTygH35X+GJTFzzoccgw= +Received: by 10.54.79.17 with SMTP id c17mr1071842wrb; + Tue, 12 Apr 2005 07:12:39 -0700 (PDT) +Received: from ?10.80.1.43? ([194.248.208.82]) + by mx.gmail.com with ESMTP id 64sm908888wra.2005.04.12.07.12.38; + Tue, 12 Apr 2005 07:12:39 -0700 (PDT) +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Transfer-Encoding: 7bit +Message-Id: <0201deb23790cee173bdd2d3f0e96642@gmail.com> +Content-Type: text/plain; charset=US-ASCII; format=flowed +To: PostgreSQL Perform +From: Bendik R.Johansen +Subject: Slow update +Date: Tue, 12 Apr 2005 16:12:32 +0200 +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.398 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/226 +X-Sequence-Number: 11623 + +Hello, +I am having a bit of trouble updating a single integer column. +My table has around 10 columns and 260 000 records. + + +update no.records set uid = 2; +(uid is an integer. It has a btree index) + +This update takes more than 20 minutes to execute. Is this normal? This +will be totally unacceptable when my table grows. +Any ideas? + + + +From pgsql-performance-owner@postgresql.org Tue Apr 12 11:18:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A2F99534E2 + for ; + Tue, 12 Apr 2005 11:18:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07785-01 + for ; + Tue, 12 Apr 2005 14:18:28 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 8BDC5534C8 + for ; + Tue, 12 Apr 2005 11:18:27 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1903182wri + for ; + Tue, 12 Apr 2005 07:18:32 -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:references; + b=oew6XsOMBEC3UFY5CaNKk3sPVDG79auczjaryuaiEgktcz+2dKQMVwYOSHt8/aUizoEDEEwxg5aeZUfL2Oi4ZvKUCniqBIhiZgVOzavjc4uKSg5+3r3qmB1xmREs54CB5GjydA0SLd3MbVOeiqdscQZv2UdJHOBi1UBZYljx25Y= +Received: by 10.54.10.67 with SMTP id 67mr817443wrj; + Tue, 12 Apr 2005 07:18:32 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Tue, 12 Apr 2005 07:18:31 -0700 (PDT) +Message-ID: <33c6269f05041207182473d08b@mail.gmail.com> +Date: Tue, 12 Apr 2005 10:18:31 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Tom Lane +Subject: Re: profiling postgresql queries? +Cc: hubert.lubaczewski@eo.pl, pgsql-performance@postgresql.org +In-Reply-To: <15425.1113315053@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +References: <20050412104643.GB11445@eo.pl> <15425.1113315053@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.263 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/227 +X-Sequence-Number: 11624 + +Speaking of triggers... + +Is there any plan to speed up plpgsql tiggers? Fairly simple +crosstable insert triggers seem to slow my inserts to a crawl. + +Is the best thing just to write triggers in C (I really don't want to +put this stuff in the application logic because it really doesn't +belong there). + +Alex Turner +netEconomist + +On Apr 12, 2005 10:10 AM, Tom Lane wrote: +> hubert lubaczewski writes: +> > and it made me wonder - is there a way to tell how much time of backend +> > was spent on triggers, index updates and so on? +> +> In CVS tip, EXPLAIN ANALYZE will break out the time spent in each +> trigger. This is not in any released version, but if you're desperate +> you could load up a play server with your data and test. +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + +From pgsql-performance-owner@postgresql.org Tue Apr 12 11:35:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 91923534C8 + for ; + Tue, 12 Apr 2005 11:35:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14532-04 + for ; + Tue, 12 Apr 2005 14:35:45 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 91B41534EB + for ; + Tue, 12 Apr 2005 11:35:44 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3CEZeTe015726; + Tue, 12 Apr 2005 10:35:40 -0400 (EDT) +To: "Bendik R.Johansen" +Cc: PostgreSQL Perform +Subject: Re: Slow update +In-reply-to: <0201deb23790cee173bdd2d3f0e96642@gmail.com> +References: <0201deb23790cee173bdd2d3f0e96642@gmail.com> +Comments: In-reply-to "Bendik R.Johansen" + message dated "Tue, 12 Apr 2005 16:12:32 +0200" +Date: Tue, 12 Apr 2005 10:35:40 -0400 +Message-ID: <15725.1113316540@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/228 +X-Sequence-Number: 11625 + +"Bendik R.Johansen" writes: +> I am having a bit of trouble updating a single integer column. +> My table has around 10 columns and 260 000 records. + +> update no.records set uid = 2; +> (uid is an integer. It has a btree index) + +> This update takes more than 20 minutes to execute. Is this normal? + +Takes about 20 seconds to update a table of that size on my machine... + +What PG version is this? We used to have some performance issues with +very large numbers of equal keys in btree indexes. Does dropping the +index make it faster? + +Are there foreign keys referencing this table from other tables? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 12 11:46:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D547D53689 + for ; + Tue, 12 Apr 2005 11:44:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17262-06 + for ; + Tue, 12 Apr 2005 14:44:25 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 29122534F3 + for ; + Tue, 12 Apr 2005 11:44:24 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3CEi0N6021160 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Tue, 12 Apr 2005 08:44:02 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3CEi0bk088490; + Tue, 12 Apr 2005 08:44:00 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3CEhxkY088489; + Tue, 12 Apr 2005 08:43:59 -0600 (MDT) (envelope-from mfuhr) +Date: Tue, 12 Apr 2005 08:43:59 -0600 +From: Michael Fuhr +To: hubert lubaczewski +Cc: pgsql-performance@postgresql.org +Subject: Re: profiling postgresql queries? +Message-ID: <20050412144359.GA88387@winnie.fuhr.org> +References: <20050412104643.GB11445@eo.pl> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050412104643.GB11445@eo.pl> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/229 +X-Sequence-Number: 11626 + +On Tue, Apr 12, 2005 at 12:46:43PM +0200, hubert lubaczewski wrote: +> +> the problem is that both the inserts and updated operate on +> heavy-tirggered tables. +> and it made me wonder - is there a way to tell how much time of backend +> was spent on triggers, index updates and so on? +> like: +> total query time: 1 secons +> trigger a: 0.50 second +> trigger b: 0.25 second +> index update: 0.1 second + +EXPLAIN ANALYZE in 8.1devel (CVS HEAD) prints a few statistics for +triggers: + +EXPLAIN ANALYZE UPDATE foo SET x = 10 WHERE x = 20; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ + Index Scan using foo_x_idx on foo (cost=0.00..14.44 rows=10 width=22) (actual time=0.184..0.551 rows=7 loops=1) + Index Cond: (x = 20) + Trigger row_trig1: time=1.625 calls=7 + Trigger row_trig2: time=1.346 calls=7 + Trigger stmt_trig1: time=1.436 calls=1 + Total runtime: 9.659 ms +(6 rows) + +8.1devel changes frequently (sometimes requiring initdb) and isn't +suitable for production, but if the trigger statistics would be +helpful then you could set up a test server and load a copy of your +database into it. Just beware that because it's bleeding edge, it +might destroy your data and it might behave differently than released +versions. + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Tue Apr 12 11:46:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DD256537D1 + for ; + Tue, 12 Apr 2005 11:46:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17576-08 + for ; + Tue, 12 Apr 2005 14:46:02 +0000 (GMT) +Received: from viper.eo.pl (viper.eo.pl [217.17.46.133]) + by svr1.postgresql.org (Postfix) with ESMTP id 37C0A53789 + for ; + Tue, 12 Apr 2005 11:45:58 -0300 (ADT) +Received: from xxx.hq.eo.pl ([192.168.20.129] helo=localhost.localdomain) + by viper with asmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) + id 1DLMeM-0006o5-Gj; Tue, 12 Apr 2005 16:46:01 +0200 +Received: from depesz by localhost.localdomain with local (Exim 4.50) + id 1DLMeL-0003V5-7j; Tue, 12 Apr 2005 16:45:57 +0200 +Date: Tue, 12 Apr 2005 16:45:57 +0200 +From: hubert lubaczewski +To: Alex Turner +Cc: pgsql-performance@postgresql.org +Subject: Re: profiling postgresql queries? +Message-ID: <20050412144557.GA13383@eo.pl> +Reply-To: hubert.lubaczewski@eo.pl +References: <20050412104643.GB11445@eo.pl> <15425.1113315053@sss.pgh.pa.us> + <33c6269f05041207182473d08b@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="jI8keyz6grp/JLjh" +Content-Disposition: inline +In-Reply-To: <33c6269f05041207182473d08b@mail.gmail.com> +X-info-en-1: this message *may* reflect my personal opinion. it is *not* +X-info-en-2: intended to reflect those of my employer, or anyone else. +X-info-pl-1: wszelkie opinie =?iso-8859-2?Q?wyra=BFone_?= + =?iso-8859-2?Q?w_tym_li=B6cie_prezentuj=B1_wy=B3=B1cznie_pogl=B1dy?= +X-info-pl-2: autora listu. opinie =?iso-8859-2?Q?te_?= + =?iso-8859-2?Q?w_=BFadnym__razie_nie__wyra=BFaj=B1__pogl=B1d=F3w?= +X-info-pl-3: pracodawcy autora =?iso-8859-2?Q?listu_?= + =?iso-8859-2?Q?_ani__innych__zwi=B1zanych__z__nim__os=F3b=2E?= +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/230 +X-Sequence-Number: 11627 + + +--jI8keyz6grp/JLjh +Content-Type: text/plain; charset=iso-8859-2 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +On Tue, Apr 12, 2005 at 10:18:31AM -0400, Alex Turner wrote: +> Speaking of triggers... +> Is there any plan to speed up plpgsql tiggers? Fairly simple +> crosstable insert triggers seem to slow my inserts to a crawl. + +plpgsql is quite fast actually. if some triggers slow inserts too much, +i guess you should be able to spped them up with some performance review +of trigger code. + +depesz + +--=20 +hubert lubaczewski +Network Operations Center +eo Networks Sp. z o.o. + +--jI8keyz6grp/JLjh +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (GNU/Linux) + +iD8DBQFCW98l5ZmPxbV4/n4RAmrCAJ9Pdrs64MJIx7YzrpBIWx9KBSu2iACfVkzv +yxMENNVYXHS0gSb/6xl9swk= +=JHBb +-----END PGP SIGNATURE----- + +--jI8keyz6grp/JLjh-- + +From pgsql-performance-owner@postgresql.org Tue Apr 12 12:00:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6CEF8534F4 + for ; + Tue, 12 Apr 2005 12:00:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24467-01 + for ; + Tue, 12 Apr 2005 15:00:29 +0000 (GMT) +Received: from viper.eo.pl (viper.eo.pl [217.17.46.133]) + by svr1.postgresql.org (Postfix) with ESMTP id A749A53498 + for ; + Tue, 12 Apr 2005 12:00:29 -0300 (ADT) +Received: from xxx.hq.eo.pl ([192.168.20.129] helo=localhost.localdomain) + by viper with asmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) + id 1DLMsH-0000Hw-8o; Tue, 12 Apr 2005 17:00:27 +0200 +Received: from depesz by localhost.localdomain with local (Exim 4.50) + id 1DLMsF-0004i6-Ph; Tue, 12 Apr 2005 17:00:19 +0200 +Date: Tue, 12 Apr 2005 17:00:19 +0200 +From: hubert lubaczewski +To: Michael Fuhr +Cc: pgsql-performance@postgresql.org +Subject: Re: profiling postgresql queries? +Message-ID: <20050412150019.GA13480@eo.pl> +Reply-To: hubert.lubaczewski@eo.pl +References: <20050412104643.GB11445@eo.pl> + <20050412144359.GA88387@winnie.fuhr.org> +Mime-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="cWoXeonUoKmBZSoM" +Content-Disposition: inline +In-Reply-To: <20050412144359.GA88387@winnie.fuhr.org> +X-info-en-1: this message *may* reflect my personal opinion. it is *not* +X-info-en-2: intended to reflect those of my employer, or anyone else. +X-info-pl-1: wszelkie opinie =?iso-8859-2?Q?wyra=BFone_?= + =?iso-8859-2?Q?w_tym_li=B6cie_prezentuj=B1_wy=B3=B1cznie_pogl=B1dy?= +X-info-pl-2: autora listu. opinie =?iso-8859-2?Q?te_?= + =?iso-8859-2?Q?w_=BFadnym__razie_nie__wyra=BFaj=B1__pogl=B1d=F3w?= +X-info-pl-3: pracodawcy autora =?iso-8859-2?Q?listu_?= + =?iso-8859-2?Q?_ani__innych__zwi=B1zanych__z__nim__os=F3b=2E?= +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/231 +X-Sequence-Number: 11628 + + +--cWoXeonUoKmBZSoM +Content-Type: text/plain; charset=iso-8859-2 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +On Tue, Apr 12, 2005 at 08:43:59AM -0600, Michael Fuhr wrote: +> 8.1devel changes frequently (sometimes requiring initdb) and isn't +> suitable for production, but if the trigger statistics would be +> helpful then you could set up a test server and load a copy of your +> database into it. Just beware that because it's bleeding edge, it +> might destroy your data and it might behave differently than released +> versions. + +great. this is exactly what i need. thanks for hint. + +depesz + +--=20 +hubert lubaczewski +Network Operations Center +eo Networks Sp. z o.o. + +--cWoXeonUoKmBZSoM +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (GNU/Linux) + +iD8DBQFCW+KD5ZmPxbV4/n4RAlsMAKCF66ayWe3eDHyepJLPJIzR8kfipwCeLfhM +43choUUXgPrdjQMdiUUrh/M= +=7ny5 +-----END PGP SIGNATURE----- + +--cWoXeonUoKmBZSoM-- + +From pgsql-performance-owner@postgresql.org Tue Apr 12 12:03:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BE40536F0 + for ; + Tue, 12 Apr 2005 12:03:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24814-04 + for ; + Tue, 12 Apr 2005 15:03:09 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id A1821535AB + for ; + Tue, 12 Apr 2005 12:03:08 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so2970292wra + for ; + Tue, 12 Apr 2005 08:03:08 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:in-reply-to:references:mime-version:content-type:message-id:content-transfer-encoding:cc:from:subject:date:to:x-mailer; + b=PWKgazxv/U77l8Im9miOWZqlbfTfefFkG2hwJWFIurHFuDn8UuPvYYtrF0RHPyJFaVYSQfSNNgA1RXZavSyUYW3D9CQwGWK7OowY/VQWV7TNLF/fBaw0y6uOn5P4T0GQc/ou8slzMrd+BN9uv/QLl8eHEl3iLUS9zrLMl31z0jk= +Received: by 10.54.94.16 with SMTP id r16mr973344wrb; + Tue, 12 Apr 2005 08:03:08 -0700 (PDT) +Received: from ?10.80.1.43? ([194.248.208.82]) + by mx.gmail.com with ESMTP id 12sm370546wrl.2005.04.12.08.03.07; + Tue, 12 Apr 2005 08:03:08 -0700 (PDT) +In-Reply-To: <15725.1113316540@sss.pgh.pa.us> +References: <0201deb23790cee173bdd2d3f0e96642@gmail.com> + <15725.1113316540@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <4bbbc6d3a436e415be630d768d609ef6@gmail.com> +Content-Transfer-Encoding: 7bit +Cc: PostgreSQL Perform +From: Bendik R.Johansen +Subject: Re: Slow update +Date: Tue, 12 Apr 2005 17:03:04 +0200 +To: Tom Lane +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/232 +X-Sequence-Number: 11629 + +Hello, thank you for the quick reply. + +I am running version 8.0.1 + +Below is the schema for the table i will be using. I tried dropping the +index, but it did not help. + + Table "no.records" + Column | Type | +Modifiers +-------------+-------------------------- ++------------------------------------------------------- + id | integer | not null default +nextval('"no".records_id_seq'::text) + origid | integer | + cid | character varying(16) | default ''::character varying + category | integer[] | + name | character varying(255) | not null default +''::character varying + address | character varying(128) | + street | character varying(127) | + postalcode | integer | + postalsite | character varying(64) | + email | character varying(64) | + website | character varying(64) | + phone | character varying(16) | + fax | character varying(16) | + contact | character varying(64) | + info | text | + position | point | + importid | integer | + exportid | integer | + created | timestamp with time zone | + creator | integer | + updated | timestamp with time zone | default +('now'::text)::timestamp(6) with time zone + updater | integer | + uid | integer | + relevance | real | not null default 0 + phonetic | text | + uncertainty | integer | default 99999999 + indexed | boolean | default false + record | text | +Indexes: + "records_pkey" PRIMARY KEY, btree (id) + "records_category_idx" gist (category) + "records_cid_idx" btree (cid) + "records_uid_idx" btree (uid) + + +On Apr 12, 2005, at 16:35, Tom Lane wrote: + +> "Bendik R.Johansen" writes: +>> I am having a bit of trouble updating a single integer column. +>> My table has around 10 columns and 260 000 records. +> +>> update no.records set uid = 2; +>> (uid is an integer. It has a btree index) +> +>> This update takes more than 20 minutes to execute. Is this normal? +> +> Takes about 20 seconds to update a table of that size on my machine... +> +> What PG version is this? We used to have some performance issues with +> very large numbers of equal keys in btree indexes. Does dropping the +> index make it faster? +> +> Are there foreign keys referencing this table from other tables? +> +> regards, tom lane +> + + +From pgsql-performance-owner@postgresql.org Tue Apr 12 12:17:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1BDD15336C + for ; + Tue, 12 Apr 2005 12:17:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27491-08 + for ; + Tue, 12 Apr 2005 15:17:07 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DA8FD53364 + for ; + Tue, 12 Apr 2005 12:17:02 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3CFGkXt016173; + Tue, 12 Apr 2005 11:16:46 -0400 (EDT) +To: "Bendik R. Johansen" +Cc: PostgreSQL Perform +Subject: Re: Slow update +In-reply-to: <4bbbc6d3a436e415be630d768d609ef6@gmail.com> +References: <0201deb23790cee173bdd2d3f0e96642@gmail.com> + <15725.1113316540@sss.pgh.pa.us> + <4bbbc6d3a436e415be630d768d609ef6@gmail.com> +Comments: In-reply-to "Bendik R. Johansen" + message dated "Tue, 12 Apr 2005 17:03:04 +0200" +Date: Tue, 12 Apr 2005 11:16:46 -0400 +Message-ID: <16172.1113319006@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/233 +X-Sequence-Number: 11630 + +"Bendik R. Johansen" writes: +> Below is the schema for the table i will be using. I tried dropping the +> index, but it did not help. + +> Indexes: +> "records_pkey" PRIMARY KEY, btree (id) +> "records_category_idx" gist (category) +> "records_cid_idx" btree (cid) +> "records_uid_idx" btree (uid) + +Hmm ... my suspicion would fall first on the GIST index, to tell you the +truth. Did you try dropping that one? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 12 12:38:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B795553389 + for ; + Tue, 12 Apr 2005 12:38:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37633-02 + for ; + Tue, 12 Apr 2005 15:37:59 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DB3953362 + for ; + Tue, 12 Apr 2005 12:37:58 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1929792wri + for ; + Tue, 12 Apr 2005 08:37:57 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:in-reply-to:references:mime-version:content-type:message-id:content-transfer-encoding:cc:from:subject:date:to:x-mailer; + b=qM487zk+db4eev2jtfbX5u+p66FgSRE/fCHmj8wxT2x2erme1HIaOUllINTBSAdFychJyYsPq5NGbjGArDRPOY0vgSFo0DqqZElst9LSWlRNOtp8Xukx+IHgHvfCrOscfxsruQHAhvbjV1nxj2dZwaix6S5PzOuc03lcDPlLSUc= +Received: by 10.54.16.39 with SMTP id 39mr53395wrp; + Tue, 12 Apr 2005 08:37:46 -0700 (PDT) +Received: from ?10.80.1.43? ([194.248.208.82]) + by mx.gmail.com with ESMTP id 38sm330355wrl.2005.04.12.08.37.45; + Tue, 12 Apr 2005 08:37:46 -0700 (PDT) +In-Reply-To: <16172.1113319006@sss.pgh.pa.us> +References: <0201deb23790cee173bdd2d3f0e96642@gmail.com> + <15725.1113316540@sss.pgh.pa.us> + <4bbbc6d3a436e415be630d768d609ef6@gmail.com> + <16172.1113319006@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <9e217f24329eaf693ab6921123213178@gmail.com> +Content-Transfer-Encoding: 7bit +Cc: PostgreSQL Perform +From: Bendik R.Johansen +Subject: Re: Slow update +Date: Tue, 12 Apr 2005 17:37:42 +0200 +To: Tom Lane +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/234 +X-Sequence-Number: 11631 + +Yes, I tried dropping it but it did not make a difference. +Could the table be corrupt or something? +Well, the important thing is that I now know that this is not typical +for PostgreSQL, so I will not have to rethink my whole project. + +Thanks, so far. + + +On Apr 12, 2005, at 17:16, Tom Lane wrote: + +> "Bendik R. Johansen" writes: +>> Below is the schema for the table i will be using. I tried dropping +>> the +>> index, but it did not help. +> +>> Indexes: +>> "records_pkey" PRIMARY KEY, btree (id) +>> "records_category_idx" gist (category) +>> "records_cid_idx" btree (cid) +>> "records_uid_idx" btree (uid) +> +> Hmm ... my suspicion would fall first on the GIST index, to tell you +> the +> truth. Did you try dropping that one? +> +> regards, tom lane +> + + +From pgsql-performance-owner@postgresql.org Tue Apr 12 12:40:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4BB2B5339B + for ; + Tue, 12 Apr 2005 12:40:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36965-06 + for ; + Tue, 12 Apr 2005 15:40:41 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6120653386 + for ; + Tue, 12 Apr 2005 12:40:40 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3CFecNN021384; + Tue, 12 Apr 2005 11:40:38 -0400 (EDT) +To: "Bendik R. Johansen" +Cc: PostgreSQL Perform +Subject: Re: Slow update +In-reply-to: <9e217f24329eaf693ab6921123213178@gmail.com> +References: <0201deb23790cee173bdd2d3f0e96642@gmail.com> + <15725.1113316540@sss.pgh.pa.us> + <4bbbc6d3a436e415be630d768d609ef6@gmail.com> + <16172.1113319006@sss.pgh.pa.us> + <9e217f24329eaf693ab6921123213178@gmail.com> +Comments: In-reply-to "Bendik R. Johansen" + message dated "Tue, 12 Apr 2005 17:37:42 +0200" +Date: Tue, 12 Apr 2005 11:40:38 -0400 +Message-ID: <21383.1113320438@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/235 +X-Sequence-Number: 11632 + +"Bendik R. Johansen" writes: +> Yes, I tried dropping it but it did not make a difference. +> Could the table be corrupt or something? + +You didn't directly answer the question about whether there were foreign +keys leading to this table. Checking foreign keys could be the problem, +particularly if the referencing columns don't have indexes. + +Also, maybe the table is just bloated? What does VACUUM VERBOSE say +about it? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 12 13:25:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9AAFF533BB + for ; + Tue, 12 Apr 2005 13:25:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52514-06 + for ; + Tue, 12 Apr 2005 16:25:17 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.207]) + by svr1.postgresql.org (Postfix) with ESMTP id 88FB0533B0 + for ; + Tue, 12 Apr 2005 13:25:09 -0300 (ADT) +Received: by rproxy.gmail.com with SMTP id a41so1561202rng + for ; + Tue, 12 Apr 2005 09:25:08 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:reply-to:from:to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:x-mimeole:thread-index:message-id; + b=cR3xXP0ibx0mUDSac0ob1Fh3uUOx7f8XoPZO0MrEC9gikPawiyefDVaVQXJJ0CoQI3v6/+V6fqKA13tJFfrm/bbRCyEorQxXe5OACkr9tzQez0QPWo5b7g64JV5qO6DAJ8qPH9i/fhDfynxcj16tJuF9+V7oHVqoqvFBXg0Yegg= +Received: by 10.38.71.62 with SMTP id t62mr4095366rna; + Tue, 12 Apr 2005 09:25:08 -0700 (PDT) +Received: from MATTSPC ([12.216.69.41]) + by mx.gmail.com with ESMTP id h17sm1386108rnb.2005.04.12.09.25.08; + Tue, 12 Apr 2005 09:25:08 -0700 (PDT) +Reply-To: +From: "Matthew Nuzum" +To: +Subject: performance hit for replication +Date: Tue, 12 Apr 2005 11:25:04 -0500 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Thread-Index: AcU/fC5mJDjLLC/eTEu0T7e3ur78Ag== +Message-ID: <425bf664.1fac7adf.258a.5c79@mx.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/236 +X-Sequence-Number: 11633 + +I'd like to create a fail-over server in case of a problem. Ideally, it +would be synchronized with our main database server, but I don't see any +major problem with having a delay of up to 4 hours between syncs. + +My database is a little shy of 10 Gigs, with much of that data being in an +archived log table. Every day a batch job is run which adds 100,000 records +over the course of 3 hours (the batch job does a lot of pre/post +processing). + +Doing a restore of the db backup in vmware takes about 3 hours. I suspect a +powerful server with a better disk setup could do it faster, but I don't +have servers like that at my disposal, so I need to assume worst-case of 3-4 +hours is typical. + +So, my question is this: My server currently works great, performance wise. +I need to add fail-over capability, but I'm afraid that introducing a +stressful task such as replication will hurt my server's performance. Is +there any foundation to my fears? I don't need to replicate the archived log +data because I can easily restore that in a separate step from the nightly +backup if disaster occurs. Also, my database load is largely selects. My +application works great with PostgreSQL 7.3 and 7.4, but I'm currently using +7.3. + +I'm eager to hear your thoughts and experiences, +-- +Matthew Nuzum +www.followers.net - Makers of "Elite Content Management System" +Earn a commission of $100 - $750 by recommending Elite CMS. Visit +http://www.elitecms.com/Contact_Us.partner for details. + + + +From pgsql-performance-owner@postgresql.org Tue Apr 12 13:37:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 21B50533B4 + for ; + Tue, 12 Apr 2005 13:37:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55973-04 + for ; + Tue, 12 Apr 2005 16:37:10 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 967A7533D8 + for ; + Tue, 12 Apr 2005 13:37:10 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3CGWOma027784; Tue, 12 Apr 2005 09:32:25 -0700 +Message-ID: <425BF92D.6060004@commandprompt.com> +Date: Tue, 12 Apr 2005 09:37:01 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: matt@followers.net +Cc: pgsql-performance@postgresql.org +Subject: Re: performance hit for replication +References: <425bf664.1fac7adf.258a.5c79@mx.gmail.com> +In-Reply-To: <425bf664.1fac7adf.258a.5c79@mx.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.028 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/237 +X-Sequence-Number: 11634 + + +>So, my question is this: My server currently works great, performance wise. +>I need to add fail-over capability, but I'm afraid that introducing a +>stressful task such as replication will hurt my server's performance. Is +>there any foundation to my fears? I don't need to replicate the archived log +>data because I can easily restore that in a separate step from the nightly +>backup if disaster occurs. Also, my database load is largely selects. My +>application works great with PostgreSQL 7.3 and 7.4, but I'm currently using +>7.3. +> +>I'm eager to hear your thoughts and experiences, +> +> +Well with replicator you are going to take a pretty big hit initially +during the full +sync but then you could use batch replication and only replicate every +2-3 hours. + +I am pretty sure Slony has similar capabilities. + +Sincerely, + +Joshua D. Drake + + + + +From pgsql-performance-owner@postgresql.org Tue Apr 12 13:53:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DEC87533ED + for ; + Tue, 12 Apr 2005 13:53:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59263-10 + for ; + Tue, 12 Apr 2005 16:53:15 +0000 (GMT) +Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) + by svr1.postgresql.org (Postfix) with SMTP id 7109F533F1 + for ; + Tue, 12 Apr 2005 13:53:13 -0300 (ADT) +Received: (qmail 5848 invoked from network); 12 Apr 2005 18:29:20 -0000 +Received: from unknown (HELO ?64.141.15.12?) (64.141.15.12) + by radius.wavefire.com with SMTP; 12 Apr 2005 18:29:20 -0000 +From: Darcy Buskermolen +Organization: Wavefire Technologies Corp +To: matt@followers.net +Subject: Re: performance hit for replication +Date: Tue, 12 Apr 2005 09:54:52 -0700 +User-Agent: KMail/1.7.2 +Cc: pgsql-performance@postgresql.org +References: <425bf664.1fac7adf.258a.5c79@mx.gmail.com> +In-Reply-To: <425bf664.1fac7adf.258a.5c79@mx.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504120954.52701.darcy@wavefire.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.295 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200504/238 +X-Sequence-Number: 11635 + +On Tuesday 12 April 2005 09:25, Matthew Nuzum wrote: +> I'd like to create a fail-over server in case of a problem. Ideally, it +> would be synchronized with our main database server, but I don't see any +> major problem with having a delay of up to 4 hours between syncs. +> +> My database is a little shy of 10 Gigs, with much of that data being in an +> archived log table. Every day a batch job is run which adds 100,000 records +> over the course of 3 hours (the batch job does a lot of pre/post +> processing). +> +> Doing a restore of the db backup in vmware takes about 3 hours. I suspect a +> powerful server with a better disk setup could do it faster, but I don't +> have servers like that at my disposal, so I need to assume worst-case of +> 3-4 hours is typical. +> +> So, my question is this: My server currently works great, performance wise. +> I need to add fail-over capability, but I'm afraid that introducing a +> stressful task such as replication will hurt my server's performance. Is +> there any foundation to my fears? I don't need to replicate the archived +> log data because I can easily restore that in a separate step from the +> nightly backup if disaster occurs. Also, my database load is largely +> selects. My application works great with PostgreSQL 7.3 and 7.4, but I'm +> currently using 7.3. +> +> I'm eager to hear your thoughts and experiences, + +Your application sounds like a perfact candidate for Slony-I +http://www.slony.info . Using Slony-I I see about a 5-7% performance hit in +terms of the number of insert.update/delete per second i can process. + +Depending on your network connection , DML volume, and the power of your +backup server, the replica could be as little as 10 seconds behind the +origin. A failover/switchover could occur in under 60 seconds. + +-- +Darcy Buskermolen +Wavefire Technologies Corp. + +http://www.wavefire.com +ph: 250.717.0200 +fx: 250.763.1759 + +From pgsql-performance-owner@postgresql.org Tue Apr 12 13:55:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 21A01533E2 + for ; + Tue, 12 Apr 2005 13:55:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62731-06 + for ; + Tue, 12 Apr 2005 16:55:44 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 60633533F8 + for ; + Tue, 12 Apr 2005 13:55:43 -0300 (ADT) +Received: by rproxy.gmail.com with SMTP id j1so1436582rnf + for ; + Tue, 12 Apr 2005 09:55:44 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:reply-to:from:to:cc:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:in-reply-to:x-mimeole:thread-index:message-id; + b=GSr3hmYgvQQFsfFKLnfkwN9Mlqf+YBRNtaVPwzO1HmiAcsGUnAbcSL7enMMfLVWcyxR8VcGRFkuYhF/iy+oq04iz3yf6JyduXDXiMDuSMjDHdIWCYTp3uKLgBkl2ty67g/iJp5GTGVSKq9+JmarGJjED8zLgNgQOkEBeKr/5f8Y= +Received: by 10.38.150.39 with SMTP id x39mr5097057rnd; + Tue, 12 Apr 2005 09:55:43 -0700 (PDT) +Received: from MATTSPC ([12.216.69.41]) + by mx.gmail.com with ESMTP id 73sm1446009rna.2005.04.12.09.55.43; + Tue, 12 Apr 2005 09:55:43 -0700 (PDT) +Reply-To: +From: "Matthew Nuzum" +To: "'Joshua D. Drake'" +Cc: +Subject: Re: performance hit for replication +Date: Tue, 12 Apr 2005 11:55:40 -0500 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +In-Reply-To: <425BF92D.6060004@commandprompt.com> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Thread-Index: AcU/fd/py30X0gUXS2iugSN2S/kfaAAAVRjg +Message-ID: <425bfd8f.0ca3402b.339b.6cfe@mx.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/239 +X-Sequence-Number: 11636 + +> >I'm eager to hear your thoughts and experiences, +> > +> > +> Well with replicator you are going to take a pretty big hit initially +> during the full +> sync but then you could use batch replication and only replicate every +> 2-3 hours. +> +> Sincerely, +> +> Joshua D. Drake +> + +Thanks, I'm looking at your product and will contact you off list for more +details soon. + +Out of curiosity, does batch mode produce a lighter load? Live updating will +provide maximum data security, and I'm most interested in how it affects the +server. + +-- +Matthew Nuzum +www.followers.net - Makers of "Elite Content Management System" +Earn a commission of $100 - $750 by recommending Elite CMS. Visit +http://www.elitecms.com/Contact_Us.partner for details. + + +From pgsql-performance-owner@postgresql.org Tue Apr 12 14:13:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B53575335B + for ; + Tue, 12 Apr 2005 14:13:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69300-06 + for ; + Tue, 12 Apr 2005 17:13:35 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id BD98E52A9B + for ; + Tue, 12 Apr 2005 14:13:34 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3CH8oma001822; Tue, 12 Apr 2005 10:08:50 -0700 +Message-ID: <425C01B7.30603@commandprompt.com> +Date: Tue, 12 Apr 2005 10:13:27 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: matt@followers.net +Cc: pgsql-performance@postgresql.org +Subject: Re: performance hit for replication +References: <425bfd8f.0ca3402b.339b.6cfe@mx.gmail.com> +In-Reply-To: <425bfd8f.0ca3402b.339b.6cfe@mx.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/240 +X-Sequence-Number: 11637 + +Matthew Nuzum wrote: + +>>>I'm eager to hear your thoughts and experiences, +>>> +>>> +>>> +>>> +>>Well with replicator you are going to take a pretty big hit initially +>>during the full +>>sync but then you could use batch replication and only replicate every +>>2-3 hours. +>> +>>Sincerely, +>> +>>Joshua D. Drake +>> +>> +>> +> +>Thanks, I'm looking at your product and will contact you off list for more +>details soon. +> +>Out of curiosity, does batch mode produce a lighter load? +> +Well more of a burstier load. You could also do live replication but +replicator requires +some IO which VMWare just ins't that good at :) + +Sincerely, + +Joshua D. Drake + + +From pgsql-performance-owner@postgresql.org Tue Apr 12 15:14:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D160653437 + for ; + Tue, 12 Apr 2005 15:14:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89997-02 + for ; + Tue, 12 Apr 2005 18:14:43 +0000 (GMT) +Received: from mail.99main.com (mail.99main.com [208.28.184.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 72939533C4 + for ; + Tue, 12 Apr 2005 15:14:37 -0300 (ADT) +Received: from 99main.com (localhost [127.0.0.1]) + by mail.99main.com (8.12.8+Sun/8.12.8) with ESMTP id j3CIEQQL018074; + Tue, 12 Apr 2005 14:14:26 -0400 (EDT) +From: "Keith Worthington" +To: "Dave Held" , + "PostgreSQL Perform" +Reply-To: KeithW@narrowpathinc.com +Subject: Re: 4 way JOIN using aliases +Date: Tue, 12 Apr 2005 14:14:26 -0400 +Message-Id: <20050412181234.M15392@narrowpathinc.com> +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A9@asg002.asg.local> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184A9@asg002.asg.local> +X-Mailer: Open WebMail 2.50 20050106 +X-OriginatingIP: 68.235.22.242 (npkeithw) +MIME-Version: 1.0 +Content-Type: text/plain; + charset=iso-8859-1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/241 +X-Sequence-Number: 11638 + +On Tue, 12 Apr 2005 08:41:55 -0500, Dave Held wrote +> > -----Original Message----- +> > From: Keith Worthington [mailto:KeithW@narrowpathinc.com] +> > Sent: Monday, April 11, 2005 7:44 PM +> > To: Neil Conway +> > Cc: PostgreSQL Perform +> > Subject: Re: [PERFORM] 4 way JOIN using aliases +> > +> > Neil Conway wrote: +> > > Keith Worthington wrote: +> > > +> > >> -> Seq Scan on tbl_current +> > (cost=0.00..1775.57 rows=76457 +> > >> width=31) (actual time=22.870..25.024 rows=605 loops=1) +> > > +> > > +> > > This rowcount is way off -- have you run ANALYZE recently? +> > > [...] +> > +> > I run vacuumdb with the analyze option every morning via a +> > cron job. In my ignorance I do not know if that is the same +> > thing. +> +> Pass it an --analyze option if you aren't already. +> +> __ +> David B. Held +> + +Here is the command I have in the cron file. + +vacuumdb --full --analyze --verbose --username dbuser --dbname ${IPA_DB} >> +${IPA_LOG_DIR}/ipavcmdb.log 2>&1 + +If this performs the analyze as I thought it should I do not know why the row +count is so badly off. + +Kind Regards, +Keith + +From pgsql-performance-owner@postgresql.org Tue Apr 12 15:22:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 921F453A99 + for ; + Tue, 12 Apr 2005 15:22:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92427-03 + for ; + Tue, 12 Apr 2005 18:22:15 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id CBE7B53A77 + for ; + Tue, 12 Apr 2005 15:22:14 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: 4 way JOIN using aliases +Date: Tue, 12 Apr 2005 13:22:12 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184AD@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] 4 way JOIN using aliases +Thread-Index: AcU/i/CyWcOfsEgsQRC7EpeM8babqgAAGpdg +From: "Dave Held" +To: "PostgreSQL Perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/242 +X-Sequence-Number: 11639 + +> -----Original Message----- +> From: Keith Worthington [mailto:keithw@narrowpathinc.com] +> Sent: Tuesday, April 12, 2005 1:14 PM +> To: Dave Held; PostgreSQL Perform +> Subject: Re: [PERFORM] 4 way JOIN using aliases +>=20 +> > > I run vacuumdb with the analyze option every morning via a=20 +> > > cron job. In my ignorance I do not know if that is the same +> > > thing. +> >=20 +> > Pass it an --analyze option if you aren't already. +>=20 +> Here is the command I have in the cron file. +>=20 +> vacuumdb --full --analyze --verbose --username dbuser=20 +> --dbname ${IPA_DB} >> +> ${IPA_LOG_DIR}/ipavcmdb.log 2>&1 +>=20 +> If this performs the analyze as I thought it should I do not=20 +> know why the row +> count is so badly off. + +You may need to increase the statistics target for the relevant +columns. Look at: + +http://www.postgresql.org/docs/7.4/static/sql-altertable.html + +In particular, the SET STATISTICS clause. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Tue Apr 12 18:04:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2094053B15 + for ; + Tue, 12 Apr 2005 18:04:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46588-04 + for ; + Tue, 12 Apr 2005 21:04:08 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id D477853A77 + for ; + Tue, 12 Apr 2005 18:04:07 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 2F0C630952; Tue, 12 Apr 2005 23:03:26 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: performance hit for replication +Date: Tue, 12 Apr 2005 16:25:14 -0400 +Organization: cbbrowne Computing Inc +Lines: 31 +Message-ID: <60d5szu4id.fsf@dba2.int.libertyrms.com> +References: <425bf664.1fac7adf.258a.5c79@mx.gmail.com> + <425BF92D.6060004@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:+3C1/OuQuTH45Vfl0T2PjyL7AaU= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.172 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/243 +X-Sequence-Number: 11640 + +jd@commandprompt.com ("Joshua D. Drake") writes: +>>So, my question is this: My server currently works great, +>>performance wise. I need to add fail-over capability, but I'm +>>afraid that introducing a stressful task such as replication will +>>hurt my server's performance. Is there any foundation to my fears? I +>>don't need to replicate the archived log data because I can easily +>>restore that in a separate step from the nightly backup if disaster +>>occurs. Also, my database load is largely selects. My application +>>works great with PostgreSQL 7.3 and 7.4, but I'm currently using +>>7.3. +>> +>>I'm eager to hear your thoughts and experiences, +>> +> Well with replicator you are going to take a pretty big hit +> initially during the full sync but then you could use batch +> replication and only replicate every 2-3 hours. +> +> I am pretty sure Slony has similar capabilities. + +Yes, similar capabilities, similar "pretty big hit." + +There's a downside to "batch replication" that some of the data +structures grow in size if you have appreciable periods between +batches. +-- +(format nil "~S@~S" "cbbrowne" "acm.org") +http://www.ntlug.org/~cbbrowne/slony.html +Rules of the Evil Overlord #78. "I will not tell my Legions of Terror +"And he must be taken alive!" The command will be: ``And try to take +him alive if it is reasonably practical.''" + + +From pgsql-novice-owner@postgresql.org Tue Apr 12 23:30:05 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 349CD53CFE + for ; + Tue, 12 Apr 2005 23:29:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34618-07 + for ; + Wed, 13 Apr 2005 02:29:50 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.193]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F1E553848 + for ; Tue, 12 Apr 2005 23:29:49 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 40so1469811nzk + for ; Tue, 12 Apr 2005 19:29:53 -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=aTB7kQxsSjKZut5jXBXQwPv6RVxp4W4GkeQp9NDBkyIOtXejAVoGDHzeWL54TPaYgrXs/JNfQ/9sh2mrfBnXNSFC6x1SKixXotqNjrb1Pvp3P4iYW8ntKzM+vOi7kI556OiM8dW9GfYLHCmQlgIX/9ZFMkkITP+dx8mWFE8U6b4= +Received: by 10.36.86.19 with SMTP id j19mr6298nzb; + Tue, 12 Apr 2005 19:29:53 -0700 (PDT) +Received: by 10.36.96.6 with HTTP; Tue, 12 Apr 2005 19:29:53 -0700 (PDT) +Message-ID: +Date: Wed, 13 Apr 2005 12:29:53 +1000 +From: Slavisa Garic +Reply-To: Slavisa Garic +To: pgsql-performance@postgresql.org, pgsql-novice@postgresql.org +Subject: Many connections lingering +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.398 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/157 +X-Sequence-Number: 13040 + +Hi all, + +I've just noticed an interesting behaviour with PGSQL. My software is +made up of few different modules that interact through PGSQL database. +Almost every query they do is an individual transaction and there is a +good reason for that. After every query done there is some processing +done by those modules and I didn't want to lock the database in a +single transaction while that processing is happening. Now, the +interesting behaviour is this. I've ran netstat on the machine where +my software is running and I searched for tcp connections to my PGSQL +server. What i found was hundreds of lines like this: + +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39504 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:40720 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39135 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43002 remus.dstc.monash:41631 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41119 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41311 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash.:8649 remus.dstc.monash:41369 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:40479 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39454 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39133 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43002 remus.dstc.monash:41501 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39132 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41308 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43002 remus.dstc.monash:40667 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41179 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39323 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41434 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43002 remus.dstc.monash:40282 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41050 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41177 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39001 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:41305 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:38937 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39128 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:40600 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43002 remus.dstc.monash:41624 TIME_WA= +IT =20 +tcp 0 0 remus.dstc.monash:43002 remus.dstc.monash:39000 TIME_WA= +IT=20 + +Now could someone explain to me what this really means and what effect +it might have on the machine (the same machine where I ran this +query)? Would there eventually be a shortage of available ports if +this kept growing? The reason I am asking this is because one of my +modules was raising exception saying that TCP connection could not be +establish to a server it needed to connect to. This may sound +confusing so I'll try to explain this. + +We have this scenario, there is a PGSQL server (postmaster) which is +running on machine A. Then there is a custom server called DBServer +which is running on machine B. This server accepts connections from a +client called an Agent. Agent may ran on any machine out there and it +would connect back to DBServer asking for some information. The +communication between these two is in the form of SQL queries. When +agent sends a query to DBServer it passes that query to machine A +postmaster and then passes back the result of the query to that Agent. +The connection problem I mentioned in the paragraph above happens when +Agent tries to connect to DBServer. + +So the only question I have here is would those lingering socket +connections above have any effect on the problem I am having. If not I +am sorry for bothering you all with this, if yes I would like to know +what I could do to avoid that. + +Any help would be appreciated, +Regards, +Slavisa + +From pgsql-novice-owner@postgresql.org Tue Apr 12 23:52:08 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 484685295D; + Tue, 12 Apr 2005 23:52:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40354-07; Wed, 13 Apr 2005 02:51:54 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6A06753848; + Tue, 12 Apr 2005 23:51:53 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3D2ptc2002315; + Tue, 12 Apr 2005 22:51:55 -0400 (EDT) +To: Slavisa Garic +Cc: pgsql-performance@postgresql.org, pgsql-novice@postgresql.org +Subject: Re: Many connections lingering +In-reply-to: +References: +Comments: In-reply-to Slavisa Garic + message dated "Wed, 13 Apr 2005 12:29:53 +1000" +Date: Tue, 12 Apr 2005 22:51:55 -0400 +Message-ID: <2314.1113360715@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/158 +X-Sequence-Number: 13041 + +Slavisa Garic writes: +> ... Now, the +> interesting behaviour is this. I've ran netstat on the machine where +> my software is running and I searched for tcp connections to my PGSQL +> server. What i found was hundreds of lines like this: + +> tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39504 TIME_WAIT +> tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:40720 TIME_WAIT +> tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39135 TIME_WAIT + +This is a network-level issue: the TCP stack on your machine knows the +connection has been closed, but it hasn't seen an acknowledgement of +that fact from the other machine, and so it's remembering the connection +number so that it can definitively say "that connection is closed" if +the other machine asks. I'd guess that either you have a flaky network +or there's something bogus about the TCP stack on the client machine. +An occasional dropped FIN packet is no surprise, but hundreds of 'em +are suspicious. + +> Now could someone explain to me what this really means and what effect +> it might have on the machine (the same machine where I ran this +> query)? Would there eventually be a shortage of available ports if +> this kept growing? The reason I am asking this is because one of my +> modules was raising exception saying that TCP connection could not be +> establish to a server it needed to connect to. + +That kinda sounds like "flaky network" to me, but I could be wrong. +In any case, you'd have better luck asking kernel or network hackers +about this than database weenies ;-) + + regards, tom lane + +From pgsql-novice-owner@postgresql.org Wed Apr 13 01:18:02 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3967D5398E; + Wed, 13 Apr 2005 00:27:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55611-03; Wed, 13 Apr 2005 03:27:26 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id E0498539B2; + Wed, 13 Apr 2005 00:27:25 -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 1DLYX0-00012K-00; Tue, 12 Apr 2005 23:27:10 -0400 +To: Tom Lane +Cc: Slavisa Garic , + pgsql-performance@postgresql.org, pgsql-novice@postgresql.org +Subject: Re: [PERFORM] Many connections lingering +References: + <2314.1113360715@sss.pgh.pa.us> +In-Reply-To: <2314.1113360715@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 12 Apr 2005 23:27:09 -0400 +Message-ID: <87u0mbjr02.fsf@stark.xeocode.com> +Lines: 58 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/160 +X-Sequence-Number: 13043 + + +Tom Lane writes: + +> Slavisa Garic writes: +> > ... Now, the +> > interesting behaviour is this. I've ran netstat on the machine where +> > my software is running and I searched for tcp connections to my PGSQL +> > server. What i found was hundreds of lines like this: +> +> > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39504 TIME_WAIT +> > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:40720 TIME_WAIT +> > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39135 TIME_WAIT +> +> This is a network-level issue: the TCP stack on your machine knows the +> connection has been closed, but it hasn't seen an acknowledgement of +> that fact from the other machine, and so it's remembering the connection +> number so that it can definitively say "that connection is closed" if +> the other machine asks. I'd guess that either you have a flaky network +> or there's something bogus about the TCP stack on the client machine. +> An occasional dropped FIN packet is no surprise, but hundreds of 'em +> are suspicious. + +No, what Tom's describing is a different pair of states called FIN_WAIT_1 and +FIN_WAIT_2. TIME_WAIT isn't waiting for a packet, just a timeout. This is to +prevent any delayed packets from earlier in the connection causing problems +with a subsequent good connection. Otherwise you could get data from the old +connection mixed in the data for later ones. + +> > Now could someone explain to me what this really means and what effect +> > it might have on the machine (the same machine where I ran this +> > query)? Would there eventually be a shortage of available ports if +> > this kept growing? The reason I am asking this is because one of my +> > modules was raising exception saying that TCP connection could not be +> > establish to a server it needed to connect to. + +What it does indicate is that each query you're making is probably not just a +separate transaction but a separate TCP connection. That's probably not +necessary. If you have a single long-lived process you could just keep the TCP +connection open and issue a COMMIT after each transaction. That's what I would +recommend doing. + + +Unless you have thousands of these TIME_WAIT connections they probably aren't +actually directly the cause of your failure to establish connections. But yes +it can happen. + +What's more likely happening here is that you're stressing the server by +issuing so many connection attempts that you're triggering some bug, either in +the TCP stack or Postgres that is causing some connection attempts to not be +handled properly. + +I'm skeptical that there's a bug in Postgres since lots of people do in fact +run web servers configured to open a new connection for every page. But this +wouldn't happen to be a Windows server would it? Perhaps the networking code +in that port doesn't do the right thing in this case? + +-- +greg + + +From pgsql-novice-owner@postgresql.org Wed Apr 13 02:01:56 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 337B2533B9; + Wed, 13 Apr 2005 02:01:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84856-05; Wed, 13 Apr 2005 05:01:52 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 21371533B3; + Wed, 13 Apr 2005 02:01:51 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3D51e6n003373; + Wed, 13 Apr 2005 01:01:40 -0400 (EDT) +To: Greg Stark +Cc: Slavisa Garic , + pgsql-performance@postgresql.org, pgsql-novice@postgresql.org +Subject: Re: [PERFORM] Many connections lingering +In-reply-to: <87u0mbjr02.fsf@stark.xeocode.com> +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "12 Apr 2005 23:27:09 -0400" +Date: Wed, 13 Apr 2005 01:01:40 -0400 +Message-ID: <3372.1113368500@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/162 +X-Sequence-Number: 13045 + +Greg Stark writes: +> Tom Lane writes: +>> This is a network-level issue: the TCP stack on your machine knows the +>> connection has been closed, but it hasn't seen an acknowledgement of +>> that fact from the other machine, and so it's remembering the connection +>> number so that it can definitively say "that connection is closed" if +>> the other machine asks. + +> No, what Tom's describing is a different pair of states called FIN_WAIT_1 and +> FIN_WAIT_2. TIME_WAIT isn't waiting for a packet, just a timeout. + +D'oh, obviously it's been too many years since I read Stevens ;-) + +So AFAICS this status report doesn't actually indicate any problem, +other than massively profligate use of separate connections. Greg's +correct that there's some risk of resource exhaustion at the TCP level, +but it's not very likely. I'd be more concerned about the amount of +resources wasted in starting a separate Postgres backend for each +connection. PG backends are fairly heavyweight objects --- if you +are at all concerned about performance, you want to get a decent number +of queries done in each connection. Consider using a connection pooler. + + regards, tom lane + +From pgsql-novice-owner@postgresql.org Wed Apr 13 02:09:11 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CEDC53997 + for ; + Wed, 13 Apr 2005 02:09:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88115-03 + for ; + Wed, 13 Apr 2005 05:09:04 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 55E35537EB + for ; Wed, 13 Apr 2005 02:09:03 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 40so1496718nzk + for ; Tue, 12 Apr 2005 22:09:03 -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=KV6KCoPQW2x1/dBQHKm3yJRJgX0K9O5hoiYIXLvxvZncgj80lq7ybny3lfOOK1ySKu7I6aC8OVOZ7bq3RaPBOO0mMzDLtoqkTm4l4qWn6ykjFN9dYHZGt4LQxdG5a08SWQTX+f6BVFN4/OPWcaR3+clsBhodIVPGe5yD/59LBVM= +Received: by 10.36.89.8 with SMTP id m8mr12305nzb; + Tue, 12 Apr 2005 22:09:03 -0700 (PDT) +Received: by 10.36.96.6 with HTTP; Tue, 12 Apr 2005 22:09:03 -0700 (PDT) +Message-ID: +Date: Wed, 13 Apr 2005 15:09:03 +1000 +From: Slavisa Garic +Reply-To: Slavisa Garic +To: Greg Stark +Subject: Re: [PERFORM] Many connections lingering +Cc: Tom Lane , pgsql-performance@postgresql.org, + pgsql-novice@postgresql.org +In-Reply-To: <87u0mbjr02.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/163 +X-Sequence-Number: 13046 + +Hi Greg, + +This is not a Windows server. Both server and client are the same +machine (done for testing purposes) and it is a Fedora RC2 machine. +This also happens on debian server and client in which case they were +two separate machines. + +There are thousands (2+) of these waiting around and each one of them +dissapears after 50ish seconds. I tried psql command line and +monitored that connection in netstats. After I did a graceful exit +(\quit) the connection changed to TIME_WAIT and it was sitting there +for around 50 seconds. I thought I could do what you suggested with +having one connection and making each query a full BEGIN/QUERY/COMMIT +transaction but I thought I could avoid that :). + +This is a serious problem for me as there are multiple users using our +software on our server and I would want to avoid having connections +open for a long time. In the scenario mentioned below I haven't +explained the magnitute of the communications happening between Agents +and DBServer. There could possibly be 100 or more Agents per +experiment, per user running on remote machines at the same time, +hence we need short transactions/pgsql connections. Agents need a +reliable connection because failure to connect could mean a loss of +computation results that were gathered over long periods of time. + +Thanks for the help by the way :), +Regards, +Slavisa + +On 12 Apr 2005 23:27:09 -0400, Greg Stark wrote: +>=20 +> Tom Lane writes: +>=20 +> > Slavisa Garic writes: +> > > ... Now, the +> > > interesting behaviour is this. I've ran netstat on the machine where +> > > my software is running and I searched for tcp connections to my PGSQL +> > > server. What i found was hundreds of lines like this: +> > +> > > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39504 T= +IME_WAIT +> > > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:40720 T= +IME_WAIT +> > > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39135 T= +IME_WAIT +> > +> > This is a network-level issue: the TCP stack on your machine knows the +> > connection has been closed, but it hasn't seen an acknowledgement of +> > that fact from the other machine, and so it's remembering the connectio= +n +> > number so that it can definitively say "that connection is closed" if +> > the other machine asks. I'd guess that either you have a flaky network +> > or there's something bogus about the TCP stack on the client machine. +> > An occasional dropped FIN packet is no surprise, but hundreds of 'em +> > are suspicious. +>=20 +> No, what Tom's describing is a different pair of states called FIN_WAIT_1= + and +> FIN_WAIT_2. TIME_WAIT isn't waiting for a packet, just a timeout. This is= + to +> prevent any delayed packets from earlier in the connection causing proble= +ms +> with a subsequent good connection. Otherwise you could get data from the = +old +> connection mixed in the data for later ones. +>=20 +> > > Now could someone explain to me what this really means and what effec= +t +> > > it might have on the machine (the same machine where I ran this +> > > query)? Would there eventually be a shortage of available ports if +> > > this kept growing? The reason I am asking this is because one of my +> > > modules was raising exception saying that TCP connection could not be +> > > establish to a server it needed to connect to. +>=20 +> What it does indicate is that each query you're making is probably not ju= +st a +> separate transaction but a separate TCP connection. That's probably not +> necessary. If you have a single long-lived process you could just keep th= +e TCP +> connection open and issue a COMMIT after each transaction. That's what I = +would +> recommend doing. +>=20 +> Unless you have thousands of these TIME_WAIT connections they probably ar= +en't +> actually directly the cause of your failure to establish connections. But= + yes +> it can happen. +>=20 +> What's more likely happening here is that you're stressing the server by +> issuing so many connection attempts that you're triggering some bug, eith= +er in +> the TCP stack or Postgres that is causing some connection attempts to not= + be +> handled properly. +>=20 +> I'm skeptical that there's a bug in Postgres since lots of people do in f= +act +> run web servers configured to open a new connection for every page. But t= +his +> wouldn't happen to be a Windows server would it? Perhaps the networking c= +ode +> in that port doesn't do the right thing in this case? +>=20 +> -- +> greg +>=20 +> + +From pgsql-performance-owner@postgresql.org Wed Apr 13 05:03:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 05F3353AE2 + for ; + Wed, 13 Apr 2005 05:03:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36974-04 + for ; + Wed, 13 Apr 2005 08:02:57 +0000 (GMT) +Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net + [194.217.242.90]) + by svr1.postgresql.org (Postfix) with ESMTP id D3FF953AD7 + for ; + Wed, 13 Apr 2005 05:02:56 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-32.mail.demon.net with esmtp (Exim 4.42) + id 1DLcpt-000PGN-7e + for pgsql-performance@postgresql.org; Wed, 13 Apr 2005 08:02:57 +0000 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: performance hit for replication +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Wed, 13 Apr 2005 09:02:56 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] performance hit for replication +Thread-Index: AcU/fC5mJDjLLC/eTEu0T7e3ur78AgAggXoA +From: "Dave Page" +To: , +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/249 +X-Sequence-Number: 11646 + +=20 + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org=20 +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> Matthew Nuzum +> Sent: 12 April 2005 17:25 +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] performance hit for replication +>=20 +> So, my question is this: My server currently works great,=20 +> performance wise. +> I need to add fail-over capability, but I'm afraid that introducing a +> stressful task such as replication will hurt my server's=20 +> performance. Is +> there any foundation to my fears? I don't need to replicate=20 +> the archived log +> data because I can easily restore that in a separate step=20 +> from the nightly +> backup if disaster occurs. Also, my database load is largely=20 +> selects. My +> application works great with PostgreSQL 7.3 and 7.4, but I'm=20 +> currently using +> 7.3.=20 + +If it's possible to upgrade to 8.0 then perhaps you could make use of +PITR and continuously ship log files to your standby machine. + +http://www.postgresql.org/docs/8.0/interactive/backup-online.html + +I can't help further with this as I've yet to give it a go myself, but +others here may have tried it. + +Regards, Dave. + +From pgsql-novice-owner@postgresql.org Wed Apr 13 09:31:22 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D96595347C; + Wed, 13 Apr 2005 09:31:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12793-09; Wed, 13 Apr 2005 12:31:16 +0000 (GMT) +Received: from a2s1.a2webhosting.com (host-180.a2webhosting.com + [69.39.89.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 8E6A853468; + Wed, 13 Apr 2005 09:31:15 -0300 (ADT) +Received: from user-1120jhm.dsl.mindspring.com ([66.32.78.54] + helo=[192.168.1.10]) + by a2s1.a2webhosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1DLh1a-0005cN-Sb; Wed, 13 Apr 2005 08:31:19 -0400 +In-Reply-To: +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> + +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: pgsql-novice@postgresql.org, Tom Lane , + pgsql-performance@postgresql.org, Greg Stark +From: John DeSoi +Subject: Re: [PERFORM] Many connections lingering +Date: Wed, 13 Apr 2005 08:31:13 -0400 +To: Slavisa Garic +X-Mailer: Apple Mail (2.619) +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - a2s1.a2webhosting.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] +X-AntiAbuse: Sender Address Domain - pgedit.com +X-Source: +X-Source-Args: +X-Source-Dir: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/166 +X-Sequence-Number: 13049 + + +On Apr 13, 2005, at 1:09 AM, Slavisa Garic wrote: + +> This is not a Windows server. Both server and client are the same +> machine (done for testing purposes) and it is a Fedora RC2 machine. +> This also happens on debian server and client in which case they were +> two separate machines. +> +> There are thousands (2+) of these waiting around and each one of them +> dissapears after 50ish seconds. I tried psql command line and +> monitored that connection in netstats. After I did a graceful exit +> (\quit) the connection changed to TIME_WAIT and it was sitting there +> for around 50 seconds. I thought I could do what you suggested with +> having one connection and making each query a full BEGIN/QUERY/COMMIT +> transaction but I thought I could avoid that :). + + +If you do a bit of searching on TIME_WAIT you'll find this is a common +TCP/IP related problem, but the behavior is within the specs of the +protocol. I don't know how to do it on Linux, but you should be able +to change TIME_WAIT to a shorter value. For the archives, here is a +pointer on changing TIME_WAIT on Windows: + +http://www.winguides.com/registry/display.php/878/ + + +John DeSoi, Ph.D. +http://pgedit.com/ +Power Tools for PostgreSQL + + +From pgsql-performance-owner@postgresql.org Wed Apr 13 11:41:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7043053676 + for ; + Wed, 13 Apr 2005 11:40:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53555-10 + for ; + Wed, 13 Apr 2005 14:40:55 +0000 (GMT) +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by svr1.postgresql.org (Postfix) with ESMTP id 273CC53675 + for ; + Wed, 13 Apr 2005 11:40:54 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEW00GFE3GAWPA3@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Wed, 13 Apr 2005 09:40:59 -0500 (CDT) +Date: Wed, 13 Apr 2005 10:41:08 -0400 +From: "Joel Fradkin" +Subject: speed of querry? +To: "PostgreSQL Perform" +Message-id: <001b01c54036$d49a2290$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/250 +X-Sequence-Number: 11647 + +I must be missing something important, because I am just not seeing why = +this +query is slower on a 4 processor 8 gig machine running redhat AS4. + +The SQL: +explain analyze SELECT a.clientnum, a.associateid, a.associatenum, +a.lastname, a.firstname, jt.value AS jobtitle, l.name AS "location", +l.locationid AS mainlocationid, l.divisionid, l.regionid, l.districtid, +(a.lastname::text || ', '::text) || a.firstname::text AS assocname, +a.isactive, a.isdeleted + FROM tblassociate a + left JOIN tbljobtitle jt ON a.jobtitleid =3D jt.id AND = +jt.clientnum::text =3D +a.clientnum::text AND 1 =3D jt.presentationid + JOIN tbllocation l ON a.locationid =3D l.locationid AND = +l.clientnum::text =3D +a.clientnum::text +where a.clientnum =3D 'SAKS';=20 + +Machine 1 my desktop: +"Merge Join (cost=3D74970.51..75975.46 rows=3D8244 width=3D113) (actual +time=3D5141.000..6363.000 rows=3D160593 loops=3D1)" +" Merge Cond: ("outer".locationid =3D "inner".locationid)" +" -> Sort (cost=3D656.22..657.11 rows=3D354 width=3D49) (actual +time=3D16.000..16.000 rows=3D441 loops=3D1)" +" Sort Key: l.locationid" +" -> Index Scan using ix_location on tbllocation l +(cost=3D0.00..641.23 rows=3D354 width=3D49) (actual time=3D0.000..0.000 = +rows=3D441 +loops=3D1)" +" Index Cond: ('SAKS'::text =3D (clientnum)::text)" +" -> Sort (cost=3D74314.29..74791.06 rows=3D190710 width=3D75) = +(actual +time=3D5125.000..5316.000 rows=3D160594 loops=3D1)" +" Sort Key: a.locationid" +" -> Merge Right Join (cost=3D0.00..52366.50 rows=3D190710 = +width=3D75) +(actual time=3D16.000..1973.000 rows=3D177041 loops=3D1)" +" Merge Cond: ((("outer".clientnum)::text =3D +("inner".clientnum)::text) AND ("outer".id =3D "inner".jobtitleid))" +" -> Index Scan using ix_tbljobtitle_id on tbljobtitle jt +(cost=3D0.00..244.75 rows=3D6622 width=3D37) (actual = +time=3D0.000..16.000 rows=3D5690 +loops=3D1)" +" Filter: (1 =3D presentationid)" +" -> Index Scan using ix_tblassoc_jobtitleid on = +tblassociate a +(cost=3D0.00..50523.83 rows=3D190710 width=3D53) (actual = +time=3D0.000..643.000 +rows=3D177041 loops=3D1)" +" Index Cond: ((clientnum)::text =3D 'SAKS'::text)" +"Total runtime: 6719.000 ms" + +Test Linux machine: +"Merge Join (cost=3D48126.04..49173.57 rows=3D15409 width=3D113) = +(actual +time=3D11832.165..12678.025 rows=3D160593 loops=3D1)" +" Merge Cond: ("outer".locationid =3D "inner".locationid)" +" -> Sort (cost=3D807.64..808.75 rows=3D443 width=3D49) (actual +time=3D2.418..2.692 rows=3D441 loops=3D1)" +" Sort Key: l.locationid" +" -> Index Scan using ix_location on tbllocation l +(cost=3D0.00..788.17 rows=3D443 width=3D49) (actual time=3D0.036..1.677 = +rows=3D441 +loops=3D1)" +" Index Cond: ('SAKS'::text =3D (clientnum)::text)" +" -> Sort (cost=3D47318.40..47758.44 rows=3D176015 width=3D75) = +(actual +time=3D11829.660..12002.746 rows=3D160594 loops=3D1)" +" Sort Key: a.locationid" +" -> Merge Right Join (cost=3D24825.80..27512.71 rows=3D176015 +width=3D75) (actual time=3D8743.848..9750.775 rows=3D177041 loops=3D1)" +" Merge Cond: ((("outer".clientnum)::text =3D +"inner"."?column10?") AND ("outer".id =3D "inner".jobtitleid))" +" -> Index Scan using ix_tbljobtitle_id on tbljobtitle jt +(cost=3D0.00..239.76 rows=3D6604 width=3D37) (actual = +time=3D0.016..11.323 rows=3D5690 +loops=3D1)" +" Filter: (1 =3D presentationid)" +" -> Sort (cost=3D24825.80..25265.84 rows=3D176015 = +width=3D53) +(actual time=3D8729.320..8945.292 rows=3D177041 loops=3D1)" +" Sort Key: (a.clientnum)::text, a.jobtitleid" +" -> Index Scan using ix_associate_clientnum on +tblassociate a (cost=3D0.00..9490.20 rows=3D176015 width=3D53) (actual +time=3D0.036..1071.867 rows=3D177041 loops=3D1)" +" Index Cond: ((clientnum)::text =3D = +'SAKS'::text)" +"Total runtime: 12802.019 ms" + +I tried to remove the left outer thinking it would speed it up, and it = +used +a seq search on tblassoc and ran 2 times slower. + + +Joel Fradkin +=20 +Wazagua, Inc. +2520 Trailmate Dr +Sarasota, Florida 34243 +Tel. 941-753-7111 ext 305 +=20 +jfradkin@wazagua.com +www.wazagua.com +Powered by Wazagua +Providing you with the latest Web-based technology & advanced tools. +C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc + This email message is for the use of the intended recipient(s) and may +contain confidential and privileged information. Any unauthorized = +review, +use, disclosure or distribution is prohibited. If you are not the = +intended +recipient, please contact the sender by reply email and delete and = +destroy +all copies of the original message, including attachments. +=20 + +=20 + + + +From pgsql-performance-owner@postgresql.org Wed Apr 13 12:45:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 267065349B + for ; + Wed, 13 Apr 2005 12:45:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79112-02 + for ; + Wed, 13 Apr 2005 15:45:52 +0000 (GMT) +Received: from khan.acc.umu.se (khan.acc.umu.se [130.239.18.139]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FDDE5349A + for ; + Wed, 13 Apr 2005 12:45:51 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by amavisd-new (Postfix) with ESMTP id 295D6D221 + for ; + Wed, 13 Apr 2005 17:45:49 +0200 (MEST) +Received: from shaka.acc.umu.se (shaka.acc.umu.se [130.239.18.148]) + by khan.acc.umu.se (Postfix) with ESMTP id A9D98D204 + for ; + Wed, 13 Apr 2005 17:45:46 +0200 (MEST) +Received: by shaka.acc.umu.se (Postfix, from userid 23132) + id 5DA0F17213; Wed, 13 Apr 2005 17:45:46 +0200 (MEST) +Date: Wed, 13 Apr 2005 17:45:46 +0200 +From: Nichlas =?iso-8859-1?Q?L=F6fdahl?= +To: pgsql-performance@postgresql.org +Subject: Foreign keys and partial indexes +Message-ID: <20050413154545.GA19181@shaka.acc.umu.se> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at acc.umu.se +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/251 +X-Sequence-Number: 11648 + +Hello! + +I have a partial index (btree(col) WHERE col > 0) on table2 ('col' contains alot of NULL-values). + +There's also a foreign key on the column pointing to the primary key of table1 (ON UPDATE CASCADE ON DELETE SET NULL). During update/delete, it seems like it cannot use the partial index to find corresponding rows matching the foreign key (doing a full seqscan instead)? + +Is there any special reason for not letting the planner use the partial index when appropriate? + + + +\d table1 + Table "public.table1" + Column | Type | Modifiers +--------+---------+----------- + id | integer | not null + text | text | +Indexes: + "table1_pkey" primary key, btree (id) + +\d table2 + Table "public.table2" + Column | Type | Modifiers +--------+---------+----------- + id | integer | not null + col | integer | + value | integer | +Indexes: + "table2_pkey" primary key, btree (id) + + + +CREATE INDEX col_part_key ON table2 USING btree(col) WHERE col > 0; +ANALYZE table2; +EXPLAIN ANALYZE DELETE FROM table2 WHERE col=1; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- + Index Scan using col_part_key on table2 (cost=0.00..6.01 rows=6 width=6) (actual time=0.592..1.324 rows=8 loops=1) + Index Cond: (col = 1) + Total runtime: 4.904 ms + + + +Delete manually WITHOUT foreign key: + + +test=> begin work; +BEGIN +Time: 0.808 ms +test=> explain analyze delete from table1 where id=1; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Index Scan using table1_pkey on table1 (cost=0.00..3.01 rows=2 width=6) (actual time=0.312..0.324 rows=1 loops=1) + Index Cond: (id = 1) + Total runtime: 0.623 ms +(3 rows) + +Time: 3.912 ms +test=> explain analyze delete from table2 where col=1; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- + Index Scan using col_part_key on table2 (cost=0.00..14.70 rows=36 width=6) (actual time=0.338..0.557 rows=8 loops=1) + Index Cond: (col = 1) + Total runtime: 0.881 ms +(3 rows) + +Time: 3.802 ms +test=> rollback; +ROLLBACK + + + + +Delete WITH foreign key: + + +test=> ALTER TABLE table2 ADD CONSTRAINT col_fkey FOREIGN KEY (col) REFERENCES table1(id) ON UPDATE CASCADE ON DELETE SET NULL; +ALTER TABLE +Time: 3783.009 ms + +test=> begin work; +BEGIN +Time: 1.509 ms +test=> explain analyze delete from table1 where id=1; +rollback; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Index Scan using table1_pkey on table1 (cost=0.00..3.01 rows=2 width=6) (actual time=0.769..0.781 rows=1 loops=1) + Index Cond: (id = 1) + Total runtime: 1.027 ms +(3 rows) + +Time: 3458.585 ms +test=> rollback; +ROLLBACK +Time: 1.506 ms + + +/Nichlas + +From pgsql-performance-owner@postgresql.org Wed Apr 13 13:05:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 93344533FA + for ; + Wed, 13 Apr 2005 13:05:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85376-05 + for ; + Wed, 13 Apr 2005 16:05:07 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E5C3D53232 + for ; + Wed, 13 Apr 2005 13:05:06 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3DG51jB007850; + Wed, 13 Apr 2005 12:05:01 -0400 (EDT) +To: Nichlas =?iso-8859-1?Q?L=F6fdahl?= +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign keys and partial indexes +In-reply-to: <20050413154545.GA19181@shaka.acc.umu.se> +References: <20050413154545.GA19181@shaka.acc.umu.se> +Comments: In-reply-to Nichlas =?iso-8859-1?Q?L=F6fdahl?= + message dated "Wed, 13 Apr 2005 17:45:46 +0200" +Date: Wed, 13 Apr 2005 12:05:01 -0400 +Message-ID: <7849.1113408301@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/252 +X-Sequence-Number: 11649 + +Nichlas =?iso-8859-1?Q?L=F6fdahl?= writes: +> I have a partial index (btree(col) WHERE col > 0) on table2 ('col' contains alot of NULL-values). + +> There's also a foreign key on the column pointing to the primary key of table1 (ON UPDATE CASCADE ON DELETE SET NULL). During update/delete, it seems like it cannot use the partial index to find corresponding rows matching the foreign key (doing a full seqscan instead)? + +> Is there any special reason for not letting the planner use the partial index when appropriate? + +It doesn't know it's appropriate. There's nothing constraining the FK +to be positive, after all. + + regards, tom lane + +From pgsql-novice-owner@postgresql.org Mon Apr 18 22:36:03 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2479D53E1A; + Wed, 13 Apr 2005 14:03:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05454-02; Wed, 13 Apr 2005 17:03:33 +0000 (GMT) +Received: from mir3-fs.mir3.com (unknown [216.74.11.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 9824553E19; + Wed, 13 Apr 2005 14:03:32 -0300 (ADT) +Received: from amateljan.mirlogic.com ([172.16.2.68]) by mir3-fs.mir3.com with + Microsoft SMTPSVC(5.0.2195.5329); Wed, 13 Apr 2005 09:44:38 -0700 +Subject: Re: [PERFORM] Many connections lingering +From: Mark Lewis +To: Slavisa Garic +Cc: Greg Stark , Tom Lane , + pgsql-performance@postgresql.org, pgsql-novice@postgresql.org +In-Reply-To: +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> + +Content-Type: text/plain +Organization: MIR3, Inc. +Message-Id: <1113410549.5589.62.camel@amateljan.mirlogic.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 (1.4.4-3) +Date: Wed, 13 Apr 2005 09:42:29 -0700 +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 13 Apr 2005 16:44:38.0260 (UTC) + FILETIME=[14E98B40:01C54048] +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/242 +X-Sequence-Number: 13125 + +If there are potentially hundreds of clients at a time, then you may be +running into the maximum connection limit. + +In postgresql.conf, there is a max_connections setting which IIRC +defaults to 100. If you try to open more concurrent connections to the +backend than that, you will get a connection refused. + +If your DB is fairly gnarly and your performance needs are minimal it +should be safe to increase max_connections. An alternative approach +would be to add some kind of database broker program. Instead of each +agent connecting directly to the database, they could pass their data to +a broker, which could then implement connection pooling. + +-- Mark Lewis + +On Tue, 2005-04-12 at 22:09, Slavisa Garic wrote: +> This is a serious problem for me as there are multiple users using our +> software on our server and I would want to avoid having connections +> open for a long time. In the scenario mentioned below I haven't +> explained the magnitute of the communications happening between Agents +> and DBServer. There could possibly be 100 or more Agents per +> experiment, per user running on remote machines at the same time, +> hence we need short transactions/pgsql connections. Agents need a +> reliable connection because failure to connect could mean a loss of +> computation results that were gathered over long periods of time. + + + +From pgsql-performance-owner@postgresql.org Wed Apr 13 14:30:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5AF1153DF6 + for ; + Wed, 13 Apr 2005 14:30:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11380-10 + for ; + Wed, 13 Apr 2005 17:30:46 +0000 (GMT) +Received: from anchor-post-36.mail.demon.net (anchor-post-36.mail.demon.net + [194.217.242.86]) + by svr1.postgresql.org (Postfix) with ESMTP id 864AA5344E + for ; + Wed, 13 Apr 2005 14:30:45 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) + id 1DLlhM-0009si-JR; Wed, 13 Apr 2005 17:30:44 +0000 +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 1B3EF163F0; Wed, 13 Apr 2005 18:30:38 +0100 (BST) +Message-ID: <425D573B.3080208@archonet.com> +Date: Wed, 13 Apr 2005 18:30:35 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: PostgreSQL Perform +Subject: Re: speed of querry? +References: <001b01c54036$d49a2290$797ba8c0@jfradkin> +In-Reply-To: <001b01c54036$d49a2290$797ba8c0@jfradkin> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.059 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/255 +X-Sequence-Number: 11652 + +Joel Fradkin wrote: +> I must be missing something important, because I am just not seeing why this +> query is slower on a 4 processor 8 gig machine running redhat AS4. + +Well, the 4 processors aren't going to help with a single query. +However, assuming the configurations for both machines are comparable, +you shouldn't be seeing a doubling in query-time. + +I have, however, spotted something very strange towards the bottom of +each explain: + +> Machine 1 my desktop: + +> " -> Merge Right Join (cost=0.00..52366.50 rows=190710 width=75) +> (actual time=16.000..1973.000 rows=177041 loops=1)" +> " Merge Cond: ((("outer".clientnum)::text = +> ("inner".clientnum)::text) AND ("outer".id = "inner".jobtitleid))" + + +> Test Linux machine: + +> " -> Merge Right Join (cost=24825.80..27512.71 rows=176015 +> width=75) (actual time=8743.848..9750.775 rows=177041 loops=1)" +> " Merge Cond: ((("outer".clientnum)::text = +> "inner"."?column10?") AND ("outer".id = "inner".jobtitleid))" + +In the first, we match outer.clientnum to inner.clientnum, in the second +it's "?column10?" - are you sure the query was identical in each case. +I'm guessing the unidentified column in query 2 is the reason for the +sort a couple of lines below it, which seems to take up a large chunk of +time. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Wed Apr 13 14:37:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5295053E15 + for ; + Wed, 13 Apr 2005 14:37:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16106-01 + for ; + Wed, 13 Apr 2005 17:37:01 +0000 (GMT) +Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net + [194.217.242.85]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FF4A53E0D + for ; + Wed, 13 Apr 2005 14:37:00 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) + id 1DLlkk-000CUl-HP; Wed, 13 Apr 2005 17:34:14 +0000 +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 9BDFD165A8; Wed, 13 Apr 2005 18:36:57 +0100 (BST) +Message-ID: <425D58B7.5030909@archonet.com> +Date: Wed, 13 Apr 2005 18:36:55 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Slavisa Garic +Cc: pgsql-performance@postgresql.org +Subject: Re: [NOVICE] Many connections lingering +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.059 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/256 +X-Sequence-Number: 11653 + +Slavisa Garic wrote: +> This is a serious problem for me as there are multiple users using our +> software on our server and I would want to avoid having connections +> open for a long time. In the scenario mentioned below I haven't +> explained the magnitute of the communications happening between Agents +> and DBServer. There could possibly be 100 or more Agents per +> experiment, per user running on remote machines at the same time, +> hence we need short transactions/pgsql connections. Agents need a +> reliable connection because failure to connect could mean a loss of +> computation results that were gathered over long periods of time. + +Plenty of others have discussed the technical reasons why you are seeing +these connection issues. If you find it difficult to change your way of +working, you might find the pgpool connection-pooling project useful: + http://pgpool.projects.postgresql.org/ + +HTH +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Wed Apr 13 15:12:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 20B5B53E11; + Wed, 13 Apr 2005 15:11:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25274-09; Wed, 13 Apr 2005 18:11:51 +0000 (GMT) +Received: from smtp.osdl.org (fire.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id C559A53517; + Wed, 13 Apr 2005 15:11:49 -0300 (ADT) +Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j3DIBgs4009919 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Wed, 13 Apr 2005 11:11:43 -0700 +Received: from shell0.pdx.osdl.net (localhost [127.0.0.1]) + by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id j3DIBfiC007645; + Wed, 13 Apr 2005 11:11:41 -0700 +Received: (from markw@localhost) + by shell0.pdx.osdl.net (8.13.1/8.13.1/Submit) id j3DIBfU5007644; + Wed, 13 Apr 2005 11:11:41 -0700 +Date: Wed, 13 Apr 2005 11:11:41 -0700 +From: Mark Wong +To: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Cc: swm@alcove.com.au, josh@agliodbs.com +Subject: PLM pulling from CVS nightly for testing in STP +Message-ID: <20050413181141.GA7095@osdl.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.6i +X-MIMEDefang-Filter: osdl$Revision: 1.106 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/257 +X-Sequence-Number: 11654 + +Hi all, + +Just wanted everyone to know what we're pulling CVS HEAD nightly so it +can be tested in STP now. Let me know if you have any questions. + +Tests are not automatically run yet, but I hope to remedy that +shortly. + +For those not familiar with STP and PLM, here are a couple of links: + +STP + http://www.osdl.org/stp/ + +PLM + http://www.osdl.org/plm-cgi/plm + +Mark + +From pgsql-performance-owner@postgresql.org Wed Apr 13 15:29:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 03E755324B + for ; + Wed, 13 Apr 2005 15:29:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32783-10 + for ; + Wed, 13 Apr 2005 18:29:41 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 994E452A8F + for ; + Wed, 13 Apr 2005 15:29:40 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEW00LYHE1H6ID3@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Wed, 13 Apr 2005 13:29:42 -0500 (CDT) +Date: Wed, 13 Apr 2005 14:29:51 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: <425D573B.3080208@archonet.com> +To: "'Richard Huxton'" +Cc: "'PostgreSQL Perform'" +Message-id: <000001c54056$c8499dc0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/258 +X-Sequence-Number: 11655 + +are you sure the query was identical in each case.=20 + +I just ran a second time same results ensuring that the query is the = +same. +Not sure why it is doing a column10 thing. Any ideas what to look for? +Both data bases are a restore from the same backup file. + +One is running redhat the other XP, I believe both are the same version = +of +postgres except for the different platform (8.0.1 I am pretty sure). + +I just spent the morning with Dell hoping for some explanation from = +them. +They said I had to have the database on the same type of OS and hardware = +for +them to think the issue was hardware. They are escalating to the = +software +group. + +I did a default Redhat install so it very well may be an issue with my = +lack +of knowledge on Linux. + +He did mention by default the Perc4 do cache, so I may need to visit the +data center to set the percs to not cache. + +-- + Richard Huxton + Archonet Ltd + + +From pgsql-performance-owner@postgresql.org Wed Apr 13 15:30:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A8055324B; + Wed, 13 Apr 2005 15:30:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35023-02; Wed, 13 Apr 2005 18:30:37 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 1662253691; + Wed, 13 Apr 2005 15:30:36 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7229478; Wed, 13 Apr 2005 11:32:31 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Mark Wong +Subject: Re: PLM pulling from CVS nightly for testing in STP +Date: Wed, 13 Apr 2005 11:35:36 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org, + swm@alcove.com.au +References: <20050413181141.GA7095@osdl.org> +In-Reply-To: <20050413181141.GA7095@osdl.org> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504131135.37086.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/259 +X-Sequence-Number: 11656 + +Mark, + +> Just wanted everyone to know what we're pulling CVS HEAD nightly so it +> can be tested in STP now. Let me know if you have any questions. + +Way cool. How do I find the PLM number? How are you nameing these? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 13 17:42:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 972E553D94; + Wed, 13 Apr 2005 17:42:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74024-09; Wed, 13 Apr 2005 20:42:06 +0000 (GMT) +Received: from smtp.osdl.org (fire.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CC5853D83; + Wed, 13 Apr 2005 17:42:05 -0300 (ADT) +Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j3DKfns4024653 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Wed, 13 Apr 2005 13:41:49 -0700 +Received: from shell0.pdx.osdl.net (localhost [127.0.0.1]) + by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id j3DKfmsj017064; + Wed, 13 Apr 2005 13:41:49 -0700 +Received: (from markw@localhost) + by shell0.pdx.osdl.net (8.13.1/8.13.1/Submit) id j3DKfmBd017063; + Wed, 13 Apr 2005 13:41:48 -0700 +Date: Wed, 13 Apr 2005 13:41:48 -0700 +From: Mark Wong +To: Josh Berkus +Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org, + swm@alcove.com.au +Subject: Re: PLM pulling from CVS nightly for testing in STP +Message-ID: <20050413204148.GC7095@osdl.org> +References: <20050413181141.GA7095@osdl.org> + <200504131135.37086.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200504131135.37086.josh@agliodbs.com> +User-Agent: Mutt/1.5.6i +X-MIMEDefang-Filter: osdl$Revision: 1.109 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/260 +X-Sequence-Number: 11657 + +On Wed, Apr 13, 2005 at 11:35:36AM -0700, Josh Berkus wrote: +> Mark, +> +> > Just wanted everyone to know what we're pulling CVS HEAD nightly so it +> > can be tested in STP now. Let me know if you have any questions. +> +> Way cool. How do I find the PLM number? How are you nameing these? + +The naming convention I'm using is postgresql-YYYYMMDD, for example +postgresql-20050413, for the anonymous cvs export from today (April +13). I have a cronjob that'll do the export at 1AM PST8PDT. + +The search page for the PLM numbers is here: + https://www.osdl.org/plm-cgi/plm?module=search + +or you can use the stpbot on linuxnet.mit.edu#osdl. + +Mark + +From pgsql-performance-owner@postgresql.org Wed Apr 13 18:08:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AEF953790 + for ; + Wed, 13 Apr 2005 18:08:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83782-03 + for ; + Wed, 13 Apr 2005 21:07:11 +0000 (GMT) +Received: from atlas.jtan.com (atlas.jtan.com [207.106.84.159]) + by svr1.postgresql.org (Postfix) with ESMTP id 18E2853DAD + for ; + Wed, 13 Apr 2005 18:07:10 -0300 (ADT) +X-JTAN-Envelope-From: pgsql@tom-mack.com +X-JTAN-Envelope-To: pgsql-performance@postgresql.org +Received: from [10.100.2.130] (mail.cannontech.com [63.254.39.134]) + (authenticated bits=0) + by atlas.jtan.com (8.12.8p1/8.12.8) with ESMTP id j3DL72nk028432 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); + Wed, 13 Apr 2005 17:07:03 -0400 (EDT) +Message-ID: <425D89F1.4040907@tom-mack.com> +Date: Wed, 13 Apr 2005 16:06:57 -0500 +From: Tom Mack +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: twanger@bluetwanger.de +Subject: Problem with slow query (caused by improper nestloop?) +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/261 +X-Sequence-Number: 11658 + +Someone (twanger) sent me here from the IRC channel with the following: + +I have a query that normally takes 0.150 seconds, but after an insert +can take 14 seconds. + +Here's the scenario: + +Run this query: + select * + from cad_part + left join smart_part using (cannon_part_id) + where cad_import_id = 91 + order by cad_part_reference_letter, cad_part_id + +The result is returned in about 150ms. + +Then I run my import operation which adds 1 new cad_import row, about 30 +new cad_part rows, and about 100 new cad_line rows (which aren't +involved in the above query). In this case, the new cad_import row has a +PK of cad_import_id = 92. + +When I run the query again (only the where clause changed): + select * + from cad_part + left join smart_part using (cannon_part_id) + where cad_import_id = 92 + order by cad_part_reference_letter, cad_part_id + +it takes about 14 seconds (and has a different plan). + +I can repeat the first query (id=91) and it still executes in 150ms and +then repeat the second query and in still takes ~14 seconds. + +I've found two things that fix this. First, if I run analyze, the second +query will take 150ms. + +Second, if I set enable_nestloop to false the second query will use that +same plan that the first does and complete in 150ms. + +I've posted a bunch of details on my website including the size of the +tables (all pretty small), both query plans, and some of the schema. + +http://tom-mack.com/query_details.html + +I also just redid the query without the final order by clause with the +same results. + +So I guess my question is, am I doing something wrong? did I miss an +index or something? is this a bug (a 100x hit for not running analyze +seems a little severe)? should I just run "analyze cad_part" after my +inserts to that table? + +Thanks, + +--Tom + + + +From pgsql-performance-owner@postgresql.org Wed Apr 13 19:17:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EE8D853A83 + for ; + Wed, 13 Apr 2005 19:17:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02307-02 + for ; + Wed, 13 Apr 2005 22:16:53 +0000 (GMT) +Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id 15B0A53821 + for ; + Wed, 13 Apr 2005 19:16:52 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050413221654.GNIH23703.priv-edtnes51.telusplanet.net@localhost> + for ; + Wed, 13 Apr 2005 16:16:54 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Wed, 13 Apr 2005 15:16:54 -0700 +Message-ID: <1113430614.425d9a560e5b5@webmail.telus.net> +Date: Wed, 13 Apr 2005 15:16:54 -0700 +From: Mischa Sandberg +To: pgsql-performance@postgresql.org +Subject: Strange serialization problem +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> + + <425D58B7.5030909@archonet.com> +In-Reply-To: <425D58B7.5030909@archonet.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/262 +X-Sequence-Number: 11659 + +I have a performance problem; I'd like any suggestions on where to continue +investigation. + +A set of insert-only processes seems to serialize itself. :-( + +The processes appear to be blocked on disk IO, and probably the table drive, +rather than the pg_xlog drive. + +Each process is inserting a block of 10K rows into a table. +I'm guessing they are "serialized" because one process by itself takes 15-20 +secs; running ten processes in parallel averages 100-150 secs (each), with +elapsed (wall) time of 150-200 secs. + +Polling pg_locks shows each process has (been granted) only the locks you would +expect. I RARELY see an Exclusive lock on an index, and then only on one index +at a time. + +A sample from pg_locks: + +TABLE/INDEX GRANTED PID MODE +m_reason t 7340 AccessShare +message t 7340 AccessShare +message t 7340 RowExclusive +pk_message t 7340 AccessShare +tmp_message t 7340 AccessShare +("m_reason" is a one-row lookup table; see INSERT cmd below). + +-------------------------- +The query plan is quite reasonable (see below). + +On a side note, this is the first app I've had to deal with that is sweet to +pg_xlog, but hammers the drive bearing the base table (3x the traffic). + +"log_executor_stats" for a sample insert look reasonable (except the "elapsed"!) + +! system usage stats: +! 308.591728 elapsed 3.480000 user 1.270000 system sec +! [4.000000 user 1.390000 sys total] +! 0/0 [0/0] filesystem blocks in/out +! 18212/15 [19002/418] page faults/reclaims, 0 [0] swaps +! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent +! 0/0 [0/0] voluntary/involuntary context switches +! buffer usage stats: +! Shared blocks: 9675 read, 8781 written, buffer hit rate = 97.66% +! Local blocks: 504 read, 64 written, buffer hit rate = 0.00% +! Direct blocks: 0 read, 0 written + +Summarized "ps" output for the above backend process, sampled every 5 secs, +shows it is 94% in the 'D' state, 3% in the 'S' state. + +================ +== BACKGROUND == +================ + +**SOFTWARE +- PG 7.4.6, RedHat 8. + +---------------------------------- +**HARDWARE +Xeon 2x2 2.4GHz 2GB RAM +4 x 73GB SCSI; pg_xlog and base on separate drives. + +---------------------------------- +**APPLICATION + +Six machines post batches of 10K messages to the PG db server. +Machine #nn generates its ID keys as "nn00000000001"::bigint etc. + +Each process runs: +- "COPY tmp_message FROM STDIN" loads its own one-use TEMP table. +- " INSERT INTO message + SELECT tmp.* FROM tmp_message AS tmp + JOIN m_reason ON m_reason.name = tmp.reason + LEFT JOIN message USING (ID) WHERE message.ID is null + (check required because crash recovery logic requires idempotent insert) + "DROP TABLE tmp_message" --- call me paranoid, this is 7.4 + +The COPY step time is almost constant when #processes varies from 1 to 10. + +---------------------------------- +**POSTGRES +pg_autovacuum is running with default parameters. + +Non-default GUC values: +checkpoint_segments = 512 +default_statistics_target = 200 +effective_cache_size = 500000 +log_min_duration_statement = 1000 +max_fsm_pages = 1000000 +max_fsm_relations = 1000 +random_page_cost = 1 +shared_buffers = 10000 +sort_mem = 16384 +stats_block_level = true +stats_command_string = true +stats_row_level = true +vacuum_mem = 65536 +wal_buffers = 2000 + +Wal_buffers and checkpoint_segments look outrageous, +but were tuned for another process, that posts batches of 10000 6KB rows +in a single insert. +---------------------------------- +TABLE/INDEX STATISTICS + +---------------------------------- +MACHINE STATISTICS + +ps gives the backend process as >98% in (D) state, with <1% CPU. + +A "top" snapshot: +CPU states: cpu user nice system irq softirq iowait idle + total 2.0% 0.0% 0.8% 0.0% 0.0% 96.9% 0.0% + cpu00 2.5% 0.0% 1.9% 0.0% 0.0% 95.4% 0.0% + cpu01 1.7% 0.0% 0.1% 0.0% 0.3% 97.6% 0.0% + cpu02 0.5% 0.0% 0.7% 0.0% 0.0% 98.6% 0.0% + cpu03 3.1% 0.0% 0.5% 0.0% 0.0% 96.2% 0.0% +Mem: 2061552k av, 2041752k used, 19800k free, 0k shrd, 21020k buff + +iostat reports that the $PGDATA/base drive is being worked but not overworked. +The pg_xlog drive is underworked: + + KBPS TPS KBPS TPS KBPS TPS KBPS TPS +12:30 1 2 763 16 31 8 3336 269 +12:40 5 3 1151 22 5 5 2705 320 + ^pg_xlog^ ^base^ + +The base drive has run as much as 10MBPS, 5K TPS. +---------------------------------- +EXPLAIN ANALYZE output: +The plan is eminently reasonable. But there's no visible relationship +between the top level "actual time" and the "total runtime": + +Nested Loop Left Join + (cost=0.00..31109.64 rows=9980 width=351) + (actual time=0.289..2357.346 rows=9980 loops=1) + Filter: ("inner".id IS NULL) + -> Nested Loop + (cost=0.00..735.56 rows=9980 width=351) + (actual time=0.092..1917.677 rows=9980 loops=1) + Join Filter: (("outer".name)::text = ("inner".reason)::text) + -> Seq Scan on m_reason r + (cost=0.00..1.01 rows=1 width=12) + (actual time=0.008..0.050 rows=1 loops=1) + -> Seq Scan on tmp_message t + (cost=0.00..609.80 rows=9980 width=355) + (actual time=0.067..1756.617 rows=9980 loops=1) + -> Index Scan using pk_message on message + (cost=0.00..3.02 rows=1 width=8) + (actual time=0.014..0.014 rows=0 loops=9980) + Index Cond: ("outer".id = message.id) +Total runtime: 737401.687 ms + +-- +"Dreams come true, not free." -- S.Sondheim, ITW + + +From pgsql-performance-owner@postgresql.org Wed Apr 13 19:27:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E56853B1B + for ; + Wed, 13 Apr 2005 19:27:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03596-07 + for ; + Wed, 13 Apr 2005 22:27:21 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 3BE1553B32 + for ; + Wed, 13 Apr 2005 19:27:20 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 5F7D91526B; Wed, 13 Apr 2005 17:27:20 -0500 (CDT) +Date: Wed, 13 Apr 2005 17:27:20 -0500 +From: "Jim C. Nasby" +To: Bruce Momjian +Cc: pgsql-performance@postgresql.org +Subject: Re: Compressing WAL +Message-ID: <20050413222720.GE58835@decibel.org> +References: <20050405040457.GK93835@decibel.org> + <200504110112.j3B1Cf018664@candle.pha.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200504110112.j3B1Cf018664@candle.pha.pa.us> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.017 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/263 +X-Sequence-Number: 11660 + +On Sun, Apr 10, 2005 at 09:12:41PM -0400, Bruce Momjian wrote: +> I have never heard anyone talk about it, but it seems useful. I think +> compressing the page images written on first page modification since +> checkpoint would be a big win. + +Could you clarify that? Maybe I'm being naive, but it seems like you +could just put a compression routine between the log writer and the +filesystem. + +> Is this a TODO? + +ISTM it's at least worth hacking something together and doing some +performance testing... +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 13 20:36:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A4CB53EE8; + Wed, 13 Apr 2005 20:36:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23319-02; Wed, 13 Apr 2005 23:36:07 +0000 (GMT) +Received: from cmailg2.svr.pol.co.uk (cmailg2.svr.pol.co.uk [195.92.195.172]) + by svr1.postgresql.org (Postfix) with ESMTP id A3D7253ED8; + Wed, 13 Apr 2005 20:36:07 -0300 (ADT) +Received: from modem-2642.lion.dialup.pol.co.uk ([217.135.170.82] + helo=192.168.0.102) by cmailg2.svr.pol.co.uk with esmtp (Exim 4.14) + id 1DLrOx-0007G2-KL; Thu, 14 Apr 2005 00:36:07 +0100 +Subject: Re: Compressing WAL +From: Simon Riggs +To: Bruce Momjian +Cc: "Jim C. Nasby" , + pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +In-Reply-To: <200504110112.j3B1Cf018664@candle.pha.pa.us> +References: <200504110112.j3B1Cf018664@candle.pha.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Thu, 14 Apr 2005 00:33:42 +0100 +Message-Id: <1113435222.16721.1696.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/264 +X-Sequence-Number: 11661 + +On Sun, 2005-04-10 at 21:12 -0400, Bruce Momjian wrote: +> Jim C. Nasby wrote: +> > Maybe better for -hackers, but here it goes anyway... +> > +> > Has anyone looked at compressing WAL's before writing to disk? On a +> > system generating a lot of WAL it seems there might be some gains to be +> > had WAL data could be compressed before going to disk, since today's +> > machines are generally more I/O bound than CPU bound. And unlike the +> > base tables, you generally don't need to read the WAL, so you don't +> > really need to worry about not being able to quickly scan through the +> > data without decompressing it. +> +> I have never heard anyone talk about it, but it seems useful. I think +> compressing the page images written on first page modification since +> checkpoint would be a big win. + +Well it was discussed 2-3 years ago as part of the PITR preamble. You +may be surprised to read that over... + +A summary of thoughts to date on this are: + +xlog.c XLogInsert places backup blocks into the wal buffers before +insertion, so is the right place to do this. It would be possible to do +this before any LWlocks are taken, so would not not necessarily impair +scalability. + +Currently XLogInsert is a severe CPU bottleneck around the CRC +calculation, as identified recently by Tom. Digging further, the code +used seems to cause processor stalls on Intel CPUs, possibly responsible +for much of the CPU time. Discussions to move to a 32-bit CRC would also +be effected by this because of the byte-by-byte nature of the algorithm, +whatever the length of the generating polynomial. PostgreSQL's CRC +algorithm is the fastest BSD code available. Until improvement is made +there, I would not investigate compression further. Some input from +hardware tuning specialists is required... + +The current LZW compression code uses a 4096 byte lookback size, so that +would need to be modified to extend across a whole block. An +alternative, suggested originally by Tom and rediscovered by me because +I just don't read everybody's fine words in history, is to simply take +out the freespace in the middle of every heap block that consists of +zeros. + +Any solution in this area must take into account the variability of the +size of freespace in database blocks. Some databases have mostly full +blocks, others vary. There would also be considerable variation in +compressability of blocks, especially since some blocks (e.g. TOAST) are +likely to already be compressed. There'd need to be some testing done to +see exactly the point where the costs of compression produce realisable +benefits. + +So any solution must be able to cope with both compressed blocks and +non-compressed blocks. My current thinking is that this could be +achieved by using the spare fourth bit of the BkpBlocks portion of the +XLog structure, so that either all included BkpBlocks are compressed or +none of them are, and hope that allows benefit to shine through. Not +thought about heap/index issues. + +It is possible that an XLogWriter process could be used to assist in the +CRC and compression calculations also, an a similar process used to +assist decompression for recovery, in time. + +I regret I do not currently have time to pursue further. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Apr 13 22:12:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AF2253589 + for ; + Wed, 13 Apr 2005 22:11:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44378-06 + for ; + Thu, 14 Apr 2005 01:11:49 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F7925340D + for ; + Wed, 13 Apr 2005 22:11:48 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 40so1782685nzk + for ; + Wed, 13 Apr 2005 18:11:52 -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=gRa2wptz/An6pxVw4zP/1+S4TpoDoyQtVIY7FgMNGEfgax2Pb9jXk3K2JJ6hw7TXbds0buKbulLRT4aGEyGx+pn7AehDyoAgz/o9bObIdyOa5arSNWv/36OQjVmBRh1VJR1risYxfApdW2kGs2WdTHXASyeYl7OYrPDJcQDNybI= +Received: by 10.36.101.17 with SMTP id y17mr79387nzb; + Wed, 13 Apr 2005 18:11:51 -0700 (PDT) +Received: by 10.36.96.6 with HTTP; Wed, 13 Apr 2005 18:11:51 -0700 (PDT) +Message-ID: +Date: Thu, 14 Apr 2005 11:11:51 +1000 +From: Slavisa Garic +Reply-To: Slavisa Garic +To: Richard Huxton +Subject: Re: [NOVICE] Many connections lingering +Cc: pgsql-performance@postgresql.org +In-Reply-To: <425D58B7.5030909@archonet.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> + + <425D58B7.5030909@archonet.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/265 +X-Sequence-Number: 11662 + +Hi, + +This looks very interesting. I'll give it a better look and see if the +performance penalties pgpool brings are not substantial in which case +this program could be very helpful, + +Thanks for the hint, +Slavisa + +On 4/14/05, Richard Huxton wrote: +> Slavisa Garic wrote: +> > This is a serious problem for me as there are multiple users using our +> > software on our server and I would want to avoid having connections +> > open for a long time. In the scenario mentioned below I haven't +> > explained the magnitute of the communications happening between Agents +> > and DBServer. There could possibly be 100 or more Agents per +> > experiment, per user running on remote machines at the same time, +> > hence we need short transactions/pgsql connections. Agents need a +> > reliable connection because failure to connect could mean a loss of +> > computation results that were gathered over long periods of time. +>=20 +> Plenty of others have discussed the technical reasons why you are seeing +> these connection issues. If you find it difficult to change your way of +> working, you might find the pgpool connection-pooling project useful: +> http://pgpool.projects.postgresql.org/ +>=20 +> HTH +> -- +> Richard Huxton +> Archonet Ltd +> + +From pgsql-novice-owner@postgresql.org Wed Apr 13 22:16:00 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4570A53482 + for ; + Wed, 13 Apr 2005 22:15:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45324-05 + for ; + Thu, 14 Apr 2005 01:15:48 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 6529553771 + for ; Wed, 13 Apr 2005 22:15:47 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 40so1783515nzk + for ; Wed, 13 Apr 2005 18:15:51 -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=JciyACC6/6Zr0Kf0dIvaUd8v+aAJujJouQc1sYDi2RV6YdqJfwFJ8xoTCCpBaD885yxSS21zTLx0T8Grs/FrgsqQ3Z1uC6W7btWvN8ro1AaL/P1hpJ1uzNFzHRLbyHGqtC7SN+4cdWvFc/5JNOJCkphNSXdp//YEzPaPXa6+Euk= +Received: by 10.36.113.5 with SMTP id l5mr79535nzc; + Wed, 13 Apr 2005 18:15:51 -0700 (PDT) +Received: by 10.36.96.6 with HTTP; Wed, 13 Apr 2005 18:15:51 -0700 (PDT) +Message-ID: +Date: Thu, 14 Apr 2005 11:15:51 +1000 +From: Slavisa Garic +Reply-To: Slavisa Garic +To: Mark Lewis +Subject: Re: [PERFORM] Many connections lingering +Cc: Greg Stark , Tom Lane , + pgsql-performance@postgresql.org, pgsql-novice@postgresql.org +In-Reply-To: <1113410549.5589.62.camel@amateljan.mirlogic.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> + + <1113410549.5589.62.camel@amateljan.mirlogic.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.315 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/191 +X-Sequence-Number: 13074 + +HI Mark, + +My DBServer module already serves as a broker. At the moment it opens +a new connection for every incoming Agent connection. I did it this +way because I wanted to leave synchronisation to PGSQL. I might have +to modify it a bit and use a shared, single connection for all agents. +I guess that is not a bad option I just have to ensure that the code +is not below par :), + +Also thank for the postgresql.conf hint, that limit was pretty low on +our server so this might help a bit, + +Regards, +Slavisa + +On 4/14/05, Mark Lewis wrote: +> If there are potentially hundreds of clients at a time, then you may be +> running into the maximum connection limit. +>=20 +> In postgresql.conf, there is a max_connections setting which IIRC +> defaults to 100. If you try to open more concurrent connections to the +> backend than that, you will get a connection refused. +>=20 +> If your DB is fairly gnarly and your performance needs are minimal it +> should be safe to increase max_connections. An alternative approach +> would be to add some kind of database broker program. Instead of each +> agent connecting directly to the database, they could pass their data to +> a broker, which could then implement connection pooling. +>=20 +> -- Mark Lewis +>=20 +> On Tue, 2005-04-12 at 22:09, Slavisa Garic wrote: +> > This is a serious problem for me as there are multiple users using our +> > software on our server and I would want to avoid having connections +> > open for a long time. In the scenario mentioned below I haven't +> > explained the magnitute of the communications happening between Agents +> > and DBServer. There could possibly be 100 or more Agents per +> > experiment, per user running on remote machines at the same time, +> > hence we need short transactions/pgsql connections. Agents need a +> > reliable connection because failure to connect could mean a loss of +> > computation results that were gathered over long periods of time. +>=20 +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 02:57:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5266C53D02 + for ; + Thu, 14 Apr 2005 02:57:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19171-06 + for ; + Thu, 14 Apr 2005 05:56:58 +0000 (GMT) +Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) + by svr1.postgresql.org (Postfix) with ESMTP id F402452967 + for ; + Thu, 14 Apr 2005 02:56:56 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc13) with ESMTP + id <2005041405565601500gsnp8e>; Thu, 14 Apr 2005 05:56:56 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Wed, 13 Apr 2005 22:56:55 -0700 + id 000D9006.425E0627.00003704 +Date: Wed, 13 Apr 2005 22:56:55 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050414055655.GB19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <13449.1112847297@sss.pgh.pa.us> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/267 +X-Sequence-Number: 11664 + +Tom Lane wrote: +> Greg Stark writes: +> > In any case the issue with the IDE protocol is that fundamentally you +> > can only have a single command pending. SCSI can have many commands +> > pending. +> +> That's the bottom line: the SCSI protocol was designed (twenty years ago!) +> to allow the drive to do physical I/O scheduling, because the CPU can +> issue multiple commands before the drive has to report completion of the +> first one. IDE isn't designed to do that. I understand that the latest +> revisions to the IDE/ATA specs allow the drive to do this sort of thing, +> but support for it is far from widespread. + +My question is: why does this (physical I/O scheduling) seem to matter +so much? + +Before you flame me for asking a terribly idiotic question, let me +provide some context. + +The operating system maintains a (sometimes large) buffer cache, with +each buffer being mapped to a "physical" (which in the case of RAID is +really a virtual) location on the disk. When the kernel needs to +flush the cache (e.g., during a sync(), or when it needs to free up +some pages), it doesn't write the pages in memory address order, it +writes them in *device* address order. And it, too, maintains a queue +of disk write requests. + +Now, unless some of the blocks on the disk are remapped behind the +scenes such that an ordered list of blocks in the kernel translates to +an out of order list on the target disk (which should be rare, since +such remapping usually happens only when the target block is bad), how +can the fact that the disk controller doesn't do tagged queuing +*possibly* make any real difference unless the kernel's disk +scheduling algorithm is suboptimal? In fact, if the kernel's +scheduling algorithm is close to optimal, wouldn't the disk queuing +mechanism *reduce* the overall efficiency of disk writes? After all, +the kernel's queue is likely to be much larger than the disk +controller's, and the kernel has knowledge of things like the +filesystem layout that the disk controller and disks do not have. If +the controller is only able to execute a subset of the write commands +that the kernel has in its queue, at the very least the controller may +end up leaving the head(s) in a suboptimal position relative to the +next set of commands that it hasn't received yet, unless it simply +writes the blocks in the order it receives it, right (admittedly, this +is somewhat trivially dealt with by having the controller exclude the +first and last blocks in the request from its internal sort). + + +I can see how you might configure the RAID controller so that the +kernel's scheduling algorithm will screw things up horribly. For +instance, if the controller has several RAID volumes configured in +such a way that the volumes share spindles, the kernel isn't likely to +know about that (since each volume appears as its own device), so +writes to multiple volumes can cause head movement where the kernel +might be treating the volumes as completely independent. But that +just means that you can't be dumb about how you configure your RAID +setup. + + +So what gives? Given the above, why is SCSI so much more efficient +than plain, dumb SATA? And why wouldn't you be much better off with a +set of dumb controllers in conjunction with (kernel-level) software +RAID? + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Thu Apr 14 03:37:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 24DD253DEF + for ; + Thu, 14 Apr 2005 03:37:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29548-05 + for ; + Thu, 14 Apr 2005 06:37:27 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id D952D53DCC + for ; + Thu, 14 Apr 2005 03:37:26 -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 1DLxyW-0006Rl-00; Thu, 14 Apr 2005 02:37:16 -0400 +To: Kevin Brown +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: <42515198.9090903@sfnet.cc> + <33c6269f05040412126b5bc719@mail.gmail.com> + + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> + <20050414055655.GB19518@filer> +In-Reply-To: <20050414055655.GB19518@filer> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Apr 2005 02:37:15 -0400 +Message-ID: <878y3lj23o.fsf@stark.xeocode.com> +Lines: 40 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/268 +X-Sequence-Number: 11665 + + +Kevin Brown writes: + +> My question is: why does this (physical I/O scheduling) seem to matter +> so much? +> +> Before you flame me for asking a terribly idiotic question, let me +> provide some context. +> +> The operating system maintains a (sometimes large) buffer cache, with +> each buffer being mapped to a "physical" (which in the case of RAID is +> really a virtual) location on the disk. When the kernel needs to +> flush the cache (e.g., during a sync(), or when it needs to free up +> some pages), it doesn't write the pages in memory address order, it +> writes them in *device* address order. And it, too, maintains a queue +> of disk write requests. + +I think you're being misled by analyzing the write case. + +Consider the read case. When a user process requests a block and that read +makes its way down to the driver level, the driver can't just put it aside and +wait until it's convenient. It has to go ahead and issue the read right away. + +In the 10ms or so that it takes to seek to perform that read *nothing* gets +done. If the driver receives more read or write requests it just has to sit on +them and wait. 10ms is a lifetime for a computer. In that time dozens of other +processes could have been scheduled and issued reads of their own. + +If any of those requests would have lied on the intervening tracks the drive +missed a chance to execute them. Worse, it actually has to backtrack to get to +them meaning another long seek. + +The same thing would happen if you had lots of processes issuing lots of small +fsynced writes all over the place. Postgres doesn't really do that though. It +sort of does with the WAL logs, but that shouldn't cause a lot of seeking. +Perhaps it would mean that having your WAL share a spindle with other parts of +the OS would have a bigger penalty on IDE drives than on SCSI drives though? + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 03:47:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DFCD353DFF + for ; + Thu, 14 Apr 2005 03:47:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31722-10 + for ; + Thu, 14 Apr 2005 06:47:10 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2DA2453DFC + for ; + Thu, 14 Apr 2005 03:47:10 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3E6l7JC027510; + Thu, 14 Apr 2005 02:47:07 -0400 (EDT) +To: Richard Huxton +Cc: Joel Fradkin , + PostgreSQL Perform +Subject: Re: speed of querry? +In-reply-to: <425D573B.3080208@archonet.com> +References: <001b01c54036$d49a2290$797ba8c0@jfradkin> + <425D573B.3080208@archonet.com> +Comments: In-reply-to Richard Huxton + message dated "Wed, 13 Apr 2005 18:30:35 +0100" +Date: Thu, 14 Apr 2005 02:47:06 -0400 +Message-ID: <27509.1113461226@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/269 +X-Sequence-Number: 11666 + +Richard Huxton writes: +> In the first, we match outer.clientnum to inner.clientnum, in the second +> it's "?column10?" - are you sure the query was identical in each case. +> I'm guessing the unidentified column in query 2 is the reason for the +> sort a couple of lines below it, which seems to take up a large chunk of +> time. + +The "?column10?" is because EXPLAIN isn't excessively bright about +reporting references to outputs of lower plan nodes. (Gotta fix that +sometime.) The real point here is that the planner thought that a scan +plus sort would be faster than scanning an index that exactly matched +the sort order the Merge Join needed ... and it was wrong :-( + +So this is just the usual sort of question of "are your stats up to +date, maybe you need to increase stats targets, or else play with +random_page_cost, etc" ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 14 05:36:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DF9FD53E1F + for ; + Thu, 14 Apr 2005 05:36:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61284-04 + for ; + Thu, 14 Apr 2005 08:36:10 +0000 (GMT) +Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) + by svr1.postgresql.org (Postfix) with ESMTP id 53BD953E16 + for ; + Thu, 14 Apr 2005 05:36:07 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc13) with ESMTP + id <2005041408360901500gtk3je>; Thu, 14 Apr 2005 08:36:09 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Thu, 14 Apr 2005 01:36:08 -0700 + id 000D9006.425E2B78.00004188 +Date: Thu, 14 Apr 2005 01:36:08 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050414083608.GC19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <878y3lj23o.fsf@stark.xeocode.com> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/270 +X-Sequence-Number: 11667 + +Greg Stark wrote: + + +> I think you're being misled by analyzing the write case. +> +> Consider the read case. When a user process requests a block and +> that read makes its way down to the driver level, the driver can't +> just put it aside and wait until it's convenient. It has to go ahead +> and issue the read right away. + +Well, strictly speaking it doesn't *have* to. It could delay for a +couple of milliseconds to see if other requests come in, and then +issue the read if none do. If there are already other requests being +fulfilled, then it'll schedule the request in question just like the +rest. + +> In the 10ms or so that it takes to seek to perform that read +> *nothing* gets done. If the driver receives more read or write +> requests it just has to sit on them and wait. 10ms is a lifetime for +> a computer. In that time dozens of other processes could have been +> scheduled and issued reads of their own. + +This is true, but now you're talking about a situation where the +system goes from an essentially idle state to one of furious +activity. In other words, it's a corner case that I strongly suspect +isn't typical in situations where SCSI has historically made a big +difference. + +Once the first request has been fulfilled, the driver can now schedule +the rest of the queued-up requests in disk-layout order. + + +I really don't see how this is any different between a system that has +tagged queueing to the disks and one that doesn't. The only +difference is where the queueing happens. In the case of SCSI, the +queueing happens on the disks (or at least on the controller). In the +case of SATA, the queueing happens in the kernel. + +I suppose the tagged queueing setup could begin the head movement and, +if another request comes in that requests a block on a cylinder +between where the head currently is and where it's going, go ahead and +read the block in question. But is that *really* what happens in a +tagged queueing system? It's the only major advantage I can see it +having. + + +> The same thing would happen if you had lots of processes issuing +> lots of small fsynced writes all over the place. Postgres doesn't +> really do that though. It sort of does with the WAL logs, but that +> shouldn't cause a lot of seeking. Perhaps it would mean that having +> your WAL share a spindle with other parts of the OS would have a +> bigger penalty on IDE drives than on SCSI drives though? + +Perhaps. + +But I rather doubt that has to be a huge penalty, if any. When a +process issues an fsync (or even a sync), the kernel doesn't *have* to +drop everything it's doing and get to work on it immediately. It +could easily gather a few more requests, bundle them up, and then +issue them. If there's a lot of disk activity, it's probably smart to +do just that. All fsync and sync require is that the caller block +until the data hits the disk (from the point of view of the kernel). +The specification doesn't require that the kernel act on the calls +immediately or write only the blocks referred to by the call in +question. + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Thu Apr 14 06:45:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EDD0F535FB + for ; + Thu, 14 Apr 2005 06:45:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81327-01 + for ; + Thu, 14 Apr 2005 09:45:08 +0000 (GMT) +Received: from mars.interactivemediafactory.net (mars.imfeurope.net + [194.2.222.161]) + by svr1.postgresql.org (Postfix) with ESMTP id A5B9753621 + for ; + Thu, 14 Apr 2005 06:45:05 -0300 (ADT) +Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) + by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id + j3E9j5UP070974 for ; + Thu, 14 Apr 2005 11:45:06 +0200 (CEST) + (envelope-from jc@directinfos.com) +Message-Id: + <6.2.0.14.0.20050414113816.051f7e68@pop.interactivemediafactory.net> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 +Date: Thu, 14 Apr 2005 11:45:03 +0200 +To: pgsql-performance@postgresql.org +From: Jacques Caron +Subject: Use of data within indexes +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/271 +X-Sequence-Number: 11668 + +Hi, + +Just wondering... Is Postgresql able to use data present within indexes +without looking up the table data? + +To be more explicit, let's say I have table with two fields a and b. If I +have an index on (a,b) and I do a request like "SELECT b FROM table WHERE +a=x", will Postgresql use only the index, or will it need to also read the +table page for that (those) row(s)? + +There might be a reason why this is not possible (I don't know if the +indexes have all necessary transaction ID information?) but otherwise this +could possibly provide an interesting performance gain for some operations, +in particular with some types of joins. Or maybe it already does it. + +Any hint welcome! + +Thanks, + +Jacques. + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 22:46:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DCB353736 + for ; + Thu, 14 Apr 2005 09:00:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19748-03 + for ; + Thu, 14 Apr 2005 11:59:57 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A0FB53728 + for ; + Thu, 14 Apr 2005 08:59:56 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP id 3E4F019B3BF + for ; + Thu, 14 Apr 2005 13:59:58 +0200 (CEST) +Message-ID: <425E5B38.6020407@trust-factory.com> +Date: Thu, 14 Apr 2005 13:59:52 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Foreign key slows down copy/insert +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/444 +X-Sequence-Number: 11841 + +I am new to cross references between tables, and I am trying to +understand how they impact performance. From reading the documentation I +was under the impression that deffering foreign keys would yield about +the same performance as dropping them before a copy, and adding them +after. However, I cannot see this in my test case. + +I have a table A with an int column ID that references table B column +ID. Table B has about 150k rows, and has an index on B.ID. When trying +to copy 1 million rows into A, I get the following \timings: + +1) drop FK, copy (200s), add FK (5s) +2) add FK defferable initially deffered, copy (I aborted after 30min) +3) add FK defferable initially deffered, begin, copy (200s), commit (I +aborted after 30min) + +How do I explain why test cases 2 and 3 do not come close to case 1? Am +I missing something obvious? + +Since the database I am working on has many FKs, I would rather not have +to drop/add them when I am loading large data sets. + +If it would help I can write this out in a reproducable scenario. I am +using postgresql 7.4.5 at the moment. + +Sincerely, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 14 09:21:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0EFAB53D95 + for ; + Thu, 14 Apr 2005 09:21:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25264-10 + for ; + Thu, 14 Apr 2005 12:21:28 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id EEF9D53D83 + for ; + Thu, 14 Apr 2005 09:21:25 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP id 4999219B3BF + for ; + Thu, 14 Apr 2005 14:21:28 +0200 (CEST) +Message-ID: <425E6045.4060201@trust-factory.com> +Date: Thu, 14 Apr 2005 14:21:25 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Foreign key slows down copy/insert +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/272 +X-Sequence-Number: 11669 + +I am new to cross references between tables, and I am trying to +understand how they impact performance. From reading the documentation I +was under the impression that deffering foreign keys would yield about +the same performance as dropping them before a copy, and adding them +after. However, I cannot see this in my test case. + +I have a table A with an int column ID that references table B column +ID. Table B has about 150k rows, and has an index on B.ID. When trying +to copy 1 million rows into A, I get the following \timings: + +1) drop FK, copy (200s), add FK (5s) +2) add FK defferable initially deffered, copy (I aborted after 30min) +3) add FK defferable initially deffered, begin, copy (200s), commit (I +aborted after 30min) + +How do I explain why test cases 2 and 3 do not come close to case 1? Am +I missing something obvious? + +Since the database I am working on has many FKs, I would rather not have +to drop/add them when I am loading large data sets. + +If it would help I can write this out in a reproducable scenario. I am +using postgresql 7.4.5 at the moment. + +Sincerely, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 10:52:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4164653F7B + for ; + Thu, 14 Apr 2005 10:52:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59762-09 + for ; + Thu, 14 Apr 2005 13:52:10 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 889035364E + for ; + Thu, 14 Apr 2005 10:52:09 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEX009TAVUXPFO2@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 14 Apr 2005 08:52:14 -0500 (CDT) +Date: Thu, 14 Apr 2005 09:52:21 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: <27509.1113461226@sss.pgh.pa.us> +To: "'Tom Lane'" , + "'Richard Huxton'" +Cc: "'PostgreSQL Perform'" +Message-id: <000001c540f9$311dd440$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/273 +X-Sequence-Number: 11670 + +I have done a vacuum and a vacuum analyze. +I can try again for kicks, but it is not in production so no new records = +are +added and vacuum analyze is ran after any mods to the indexes. + +I am still pursuing Dell on why the monster box is so much slower then = +the +desktop as well. + +Joel Fradkin +=20 +Wazagua, Inc. +2520 Trailmate Dr +Sarasota, Florida 34243 +Tel. 941-753-7111 ext 305 +=20 +jfradkin@wazagua.com +www.wazagua.com +Powered by Wazagua +Providing you with the latest Web-based technology & advanced tools. +C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc + This email message is for the use of the intended recipient(s) and may +contain confidential and privileged information. Any unauthorized = +review, +use, disclosure or distribution is prohibited. If you are not the = +intended +recipient, please contact the sender by reply email and delete and = +destroy +all copies of the original message, including attachments. +=20 + +=20 + +-----Original Message----- +From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 +Sent: Thursday, April 14, 2005 1:47 AM +To: Richard Huxton +Cc: Joel Fradkin; PostgreSQL Perform +Subject: Re: [PERFORM] speed of querry?=20 + +Richard Huxton writes: +> In the first, we match outer.clientnum to inner.clientnum, in the = +second=20 +> it's "?column10?" - are you sure the query was identical in each case. = + +> I'm guessing the unidentified column in query 2 is the reason for the=20 +> sort a couple of lines below it, which seems to take up a large chunk = +of=20 +> time. + +The "?column10?" is because EXPLAIN isn't excessively bright about +reporting references to outputs of lower plan nodes. (Gotta fix that +sometime.) The real point here is that the planner thought that a scan +plus sort would be faster than scanning an index that exactly matched +the sort order the Merge Join needed ... and it was wrong :-( + +So this is just the usual sort of question of "are your stats up to +date, maybe you need to increase stats targets, or else play with +random_page_cost, etc" ... + + regards, tom lane + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:04:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ED17053689 + for ; + Thu, 14 Apr 2005 11:04:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67896-06 + for ; + Thu, 14 Apr 2005 14:04:24 +0000 (GMT) +Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) + by svr1.postgresql.org (Postfix) with ESMTP id C4B3F53668 + for ; + Thu, 14 Apr 2005 11:04:20 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id 3DD4711DCB8; + Thu, 14 Apr 2005 22:02:18 +0800 (WST) +Received: from vscan02.westnet.com.au ([127.0.0.1]) + by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 18367-15; Thu, 14 Apr 2005 22:02:18 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan02.westnet.com.au (Postfix) with ESMTP id AD20811DCC6; + Thu, 14 Apr 2005 22:02:17 +0800 (WST) +Message-ID: <425E7868.6080807@familyhealth.com.au> +Date: Thu, 14 Apr 2005 22:04:24 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Jacques Caron +Cc: pgsql-performance@postgresql.org +Subject: Re: Use of data within indexes +References: + <6.2.0.14.0.20050414113816.051f7e68@pop.interactivemediafactory.net> +In-Reply-To: + <6.2.0.14.0.20050414113816.051f7e68@pop.interactivemediafactory.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/274 +X-Sequence-Number: 11671 + +> To be more explicit, let's say I have table with two fields a and b. If +> I have an index on (a,b) and I do a request like "SELECT b FROM table +> WHERE a=x", will Postgresql use only the index, or will it need to also +> read the table page for that (those) row(s)? + +It must read the table because of visibility considerations. + +> There might be a reason why this is not possible (I don't know if the +> indexes have all necessary transaction ID information?) but otherwise +> this could possibly provide an interesting performance gain for some +> operations, in particular with some types of joins. Or maybe it already +> does it. + +It's already been thought of :) + +The 4 or so columns that store visibility information are not in the +indexes, to do so would require a significant write cost. + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:07:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E611536C1 + for ; + Thu, 14 Apr 2005 11:07:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70703-05 + for ; + Thu, 14 Apr 2005 14:07:33 +0000 (GMT) +Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EB0953F74 + for ; + Thu, 14 Apr 2005 11:07:32 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id 6C5A511DD37; + Thu, 14 Apr 2005 22:05:32 +0800 (WST) +Received: from vscan02.westnet.com.au ([127.0.0.1]) + by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 19064-11; Thu, 14 Apr 2005 22:05:32 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan02.westnet.com.au (Postfix) with ESMTP id E1E6A11DD0E; + Thu, 14 Apr 2005 22:05:31 +0800 (WST) +Message-ID: <425E792B.4020500@familyhealth.com.au> +Date: Thu, 14 Apr 2005 22:07:39 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard van den Berg +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> +In-Reply-To: <425E6045.4060201@trust-factory.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/275 +X-Sequence-Number: 11672 + +> I am new to cross references between tables, and I am trying to +> understand how they impact performance. From reading the documentation I +> was under the impression that deffering foreign keys would yield about +> the same performance as dropping them before a copy, and adding them +> after. However, I cannot see this in my test case. + +Even if you defer them, it just defers the check, doesn't eliminate it... + +> I have a table A with an int column ID that references table B column +> ID. Table B has about 150k rows, and has an index on B.ID. When trying +> to copy 1 million rows into A, I get the following \timings: +> +> 1) drop FK, copy (200s), add FK (5s) +> 2) add FK defferable initially deffered, copy (I aborted after 30min) +> 3) add FK defferable initially deffered, begin, copy (200s), commit (I +> aborted after 30min) +> +> How do I explain why test cases 2 and 3 do not come close to case 1? Am +> I missing something obvious? + +Deferring makes no difference to FK checking speed... + +> Since the database I am working on has many FKs, I would rather not have +> to drop/add them when I am loading large data sets. + +Well, that's what people do - even pg_dump will restore data and add the +foreign key afterward... + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:20:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CA65253666 + for ; + Thu, 14 Apr 2005 11:20:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76592-09 + for ; + Thu, 14 Apr 2005 14:20:36 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 61D1A533AC + for ; + Thu, 14 Apr 2005 11:20:35 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so493928nzf + for ; + Thu, 14 Apr 2005 07:20:36 -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=AitmFXC9tJ4sE4ho7sBvtPX6Lo6GtQsNxf/2wcp4UyONbqDs6560xUowU7aq9nAAnAtmy9CzOJFLpaYZ+NofpkyDOMY0Rm3iOS1HYok22F2LYqeXSs+7cozsixO899lwlb24U9669NbqXJN7F8KKqXHRmkwann/G7r08VKCs0/g= +Received: by 10.36.77.17 with SMTP id z17mr114077nza; + Thu, 14 Apr 2005 07:20:36 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Thu, 14 Apr 2005 07:20:36 -0700 (PDT) +Message-ID: <758d5e7f0504140720754c7750@mail.gmail.com> +Date: Thu, 14 Apr 2005 16:20:36 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Joel Fradkin +Subject: Re: speed of querry? +Cc: PostgreSQL Perform +In-Reply-To: <000001c540f9$311dd440$797ba8c0@jfradkin> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <27509.1113461226@sss.pgh.pa.us> + <000001c540f9$311dd440$797ba8c0@jfradkin> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.754 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/276 +X-Sequence-Number: 11673 + +On 4/14/05, Joel Fradkin wrote: +> I have done a vacuum and a vacuum analyze. +> I can try again for kicks, but it is not in production so no new records = +are +> added and vacuum analyze is ran after any mods to the indexes. +>=20 +> I am still pursuing Dell on why the monster box is so much slower then th= +e +> desktop as well. + +First thing: Do something like: +ALTER TABLE tbljobtitle ALTER COLUMN clientnum SET STATISTICS 50; +make it for each column used, make it even higher than 50 for +many-values columns. +THEN make VACUUM ANALYZE; + +Then do a query couple of times (EXPLAIN ANALYZE also :)), then do: +SET enable_seqscan =3D off; +and rerun the query -- if it was significantly faster, you will want to do: +SET enable_seqscan =3D on; +and tweak: +SET random_page_cost =3D 2.1; +...and play with values. When you reach the random_page_cost which +suits your data, you will want to put it into postgresql.conf + +I am sorry if it is already known to you. :) Also, it is a rather simplist= +ic +approach to tuning PostgreSQL but it is worth doing. Especially the +statistics part. :) + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:26:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9C32553F81 + for ; + Thu, 14 Apr 2005 11:26:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81600-07 + for ; + Thu, 14 Apr 2005 14:26:31 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A3BD536C1 + for ; + Thu, 14 Apr 2005 11:26:30 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 9C8FE19B3C0; Thu, 14 Apr 2005 16:26:33 +0200 (CEST) +Message-ID: <425E7D96.6020201@trust-factory.com> +Date: Thu, 14 Apr 2005 16:26:30 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Christopher Kings-Lynne +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> +In-Reply-To: <425E792B.4020500@familyhealth.com.au> +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/277 +X-Sequence-Number: 11674 + +Hello Chris, + +Thanks for your answers. + +Christopher Kings-Lynne wrote: +> Deferring makes no difference to FK checking speed... + +But why then is the speed acceptable if I copy and then manually add the +FK? Is the check done by the FK so much different from when it is done +automatically using an active deffered FK? + +> Well, that's what people do - even pg_dump will restore data and add the +> foreign key afterward... + +If I have to go this route, is there a way of automatically dropping and +re-adding FKs? I can probably query pg_constraints and drop the +appropriate ones, but how do I re-add them after the copy/insert? + +Sincerely, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:35:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5865853F81 + for ; + Thu, 14 Apr 2005 11:35:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85169-07 + for ; + Thu, 14 Apr 2005 14:34:55 +0000 (GMT) +Received: from vscan01.westnet.com.au (vscan01.westnet.com.au [203.10.1.131]) + by svr1.postgresql.org (Postfix) with ESMTP id 03D8F53D83 + for ; + Thu, 14 Apr 2005 11:34:54 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id 2E09814E7CA; + Thu, 14 Apr 2005 22:32:58 +0800 (WST) +Received: from vscan01.westnet.com.au ([127.0.0.1]) + by localhost (vscan01.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 01971-17; Thu, 14 Apr 2005 22:32:58 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan01.westnet.com.au (Postfix) with ESMTP id AA34CCD03C; + Thu, 14 Apr 2005 22:32:57 +0800 (WST) +Message-ID: <425E7F94.4080602@familyhealth.com.au> +Date: Thu, 14 Apr 2005 22:35:00 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard van den Berg +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> +In-Reply-To: <425E7D96.6020201@trust-factory.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/278 +X-Sequence-Number: 11675 + +>> Deferring makes no difference to FK checking speed... +> +> +> But why then is the speed acceptable if I copy and then manually add the +> FK? Is the check done by the FK so much different from when it is done +> automatically using an active deffered FK? + +Yeah I think it uses a different query formulation... Actually I only +assume that deferred fk's don't use that - I guess your experiment +proves that. + +>> Well, that's what people do - even pg_dump will restore data and add +>> the foreign key afterward... +> +> If I have to go this route, is there a way of automatically dropping and +> re-adding FKs? I can probably query pg_constraints and drop the +> appropriate ones, but how do I re-add them after the copy/insert? + +Actually, you can just "disable" them if you want to be really dirty :) + You have to be confident that the data you're inserting does satisfy +the FK, however otherwise you can end up with invalid data. + +To see how to do that, try pg_dump with --disable-triggers mode enabled. + Just do a data-only dump. + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:44:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F0AAB53603 + for ; + Thu, 14 Apr 2005 11:44:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90182-07 + for ; + Thu, 14 Apr 2005 14:44:10 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 255A153613 + for ; + Thu, 14 Apr 2005 11:44:09 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3EEiEVJ000447; + Thu, 14 Apr 2005 10:44:14 -0400 (EDT) +To: Kevin Brown +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-reply-to: <20050414083608.GC19518@filer> +References: + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> <20050414083608.GC19518@filer> +Comments: In-reply-to Kevin Brown + message dated "Thu, 14 Apr 2005 01:36:08 -0700" +Date: Thu, 14 Apr 2005 10:44:14 -0400 +Message-ID: <446.1113489854@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/279 +X-Sequence-Number: 11676 + +Kevin Brown writes: +> I really don't see how this is any different between a system that has +> tagged queueing to the disks and one that doesn't. The only +> difference is where the queueing happens. In the case of SCSI, the +> queueing happens on the disks (or at least on the controller). In the +> case of SATA, the queueing happens in the kernel. + +That's basically what it comes down to: SCSI lets the disk drive itself +do the low-level I/O scheduling whereas the ATA spec prevents the drive +from doing so (unless it cheats, ie, caches writes). Also, in SCSI it's +possible for the drive to rearrange reads as well as writes --- which +AFAICS is just not possible in ATA. (Maybe in the newest spec...) + +The reason this is so much more of a win than it was when ATA was +designed is that in modern drives the kernel has very little clue about +the physical geometry of the disk. Variable-size tracks, bad-block +sparing, and stuff like that make for a very hard-to-predict mapping +from linear sector addresses to actual disk locations. Combine that +with the fact that the drive controller can be much smarter than it was +twenty years ago, and you can see that the case for doing I/O scheduling +in the kernel and not in the drive is pretty weak. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:45:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D66D536CB + for ; + Thu, 14 Apr 2005 11:45:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92161-01 + for ; + Thu, 14 Apr 2005 14:45:29 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id BD19C53613 + for ; + Thu, 14 Apr 2005 11:45:28 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 781F33527F; Thu, 14 Apr 2005 07:45:33 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 7694D35271; Thu, 14 Apr 2005 07:45:33 -0700 (PDT) +Date: Thu, 14 Apr 2005 07:45:33 -0700 (PDT) +From: Stephan Szabo +To: Richard van den Berg +Cc: Christopher Kings-Lynne , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +In-Reply-To: <425E7D96.6020201@trust-factory.com> +Message-ID: <20050414074154.M38465@megazone.bigpanda.com> +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/280 +X-Sequence-Number: 11677 + + +On Thu, 14 Apr 2005, Richard van den Berg wrote: + +> Hello Chris, +> +> Thanks for your answers. +> +> Christopher Kings-Lynne wrote: +> > Deferring makes no difference to FK checking speed... +> +> But why then is the speed acceptable if I copy and then manually add the +> FK? Is the check done by the FK so much different from when it is done +> automatically using an active deffered FK? + +Yes, because currently the check done by the FK on an insert type activity +is a per-row inserted check while the check done when adding a FK acts on +the entire table in a go which allows better optimization of that case +(while generally being worse on small number inserts especially on large +tables). At some point, if we can work out how to do all the semantics +properly, it'd probably be possible to replace the insert type check with +a per-statement check which would be somewhere in between. That requires +access to the affected rows inside the trigger which I don't believe is +available currently. + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:45:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7935A53D83 + for ; + Thu, 14 Apr 2005 11:45:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91700-02 + for ; + Thu, 14 Apr 2005 14:45:33 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 4CBAA53689 + for ; + Thu, 14 Apr 2005 11:45:32 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEX004RDYC0U2Z0@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 14 Apr 2005 09:45:37 -0500 (CDT) +Date: Thu, 14 Apr 2005 10:45:48 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: <758d5e7f0504140720754c7750@mail.gmail.com> +To: "'Dawid Kuroczko'" +Cc: "'PostgreSQL Perform'" +Message-id: <000b01c54100$a68d2300$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/281 +X-Sequence-Number: 11678 + +Josh from commandprompt.com had me alter the config to have +default_statistics_target =3D 250 + +Is this somehow related to what your asking me to do? +I did do an analyze, but have only ran the viw a few times. + +Joel Fradkin +=20 +-----Original Message----- +From: Dawid Kuroczko [mailto:qnex42@gmail.com]=20 +Sent: Thursday, April 14, 2005 9:21 AM +To: Joel Fradkin +Cc: PostgreSQL Perform +Subject: Re: [PERFORM] speed of querry? + +On 4/14/05, Joel Fradkin wrote: +> I have done a vacuum and a vacuum analyze. +> I can try again for kicks, but it is not in production so no new = +records +are +> added and vacuum analyze is ran after any mods to the indexes. +>=20 +> I am still pursuing Dell on why the monster box is so much slower then = +the +> desktop as well. + +First thing: Do something like: +ALTER TABLE tbljobtitle ALTER COLUMN clientnum SET STATISTICS 50; +make it for each column used, make it even higher than 50 for +many-values columns. +THEN make VACUUM ANALYZE; + +Then do a query couple of times (EXPLAIN ANALYZE also :)), then do: +SET enable_seqscan =3D off; +and rerun the query -- if it was significantly faster, you will want to = +do: +SET enable_seqscan =3D on; +and tweak: +SET random_page_cost =3D 2.1; +...and play with values. When you reach the random_page_cost which +suits your data, you will want to put it into postgresql.conf + +I am sorry if it is already known to you. :) Also, it is a rather +simplistic +approach to tuning PostgreSQL but it is worth doing. Especially the +statistics part. :) + + Regards, + Dawid + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:48:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C73753F8E + for ; + Thu, 14 Apr 2005 11:48:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92161-09 + for ; + Thu, 14 Apr 2005 14:48:54 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 0796B53F96 + for ; + Thu, 14 Apr 2005 11:48:52 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so490604wri + for ; + Thu, 14 Apr 2005 07:48:58 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Bq5mtuQOdbXr9WXfFeoeYX0x6HeTUFSAd7oGtYckHswyfGB0FkezEqWqWwQAdSSwfTX9VEct/aIvMvSDk7xZapOEaHBdwENQGvLsmGVHH0P9X4ebISniD/CLVEX7t7W2xxqtoXFHL+ytRFZGu//+3ZvHyA7gYBy9qpArfsCd3f4= +Received: by 10.54.68.9 with SMTP id q9mr793032wra; + Thu, 14 Apr 2005 07:48:58 -0700 (PDT) +Received: by 10.54.102.17 with HTTP; Thu, 14 Apr 2005 07:48:58 -0700 (PDT) +Message-ID: <37d451f7050414074876acdb82@mail.gmail.com> +Date: Thu, 14 Apr 2005 09:48:58 -0500 +From: Rosser Schwarz +Reply-To: Rosser Schwarz +To: Kevin Brown , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-Reply-To: <20050414083608.GC19518@filer> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> + <20050414055655.GB19518@filer> <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.258 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/282 +X-Sequence-Number: 11679 + +while you weren't looking, Kevin Brown wrote: + +[reordering bursty reads] + +> In other words, it's a corner case that I strongly suspect +> isn't typical in situations where SCSI has historically made a big +> difference. + +[...] + +> But I rather doubt that has to be a huge penalty, if any. When a +> process issues an fsync (or even a sync), the kernel doesn't *have* to +> drop everything it's doing and get to work on it immediately. It +> could easily gather a few more requests, bundle them up, and then +> issue them. + +To make sure I'm following you here, are you or are you not suggesting +that the kernel could sit on -all- IO requests for some small handful +of ms before actually performing any IO to address what you "strongly +suspect" is a "corner case"? + +/rls + +--=20 +:wq + +From pgsql-performance-owner@postgresql.org Thu Apr 14 11:54:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E75BE53F8D + for ; + Thu, 14 Apr 2005 11:54:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95859-03 + for ; + Thu, 14 Apr 2005 14:54:51 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id A247F53DFB + for ; + Thu, 14 Apr 2005 11:54: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 1DM5jy-0007jy-00; Thu, 14 Apr 2005 10:54:46 -0400 +To: pgsql-performance@postgresql.org +Subject: Intel SRCS16 SATA raid? +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Apr 2005 10:54:45 -0400 +Message-ID: <87zmw1h0i2.fsf@stark.xeocode.com> +Lines: 14 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/283 +X-Sequence-Number: 11680 + + +Our vendor is trying to sell us on an Intel SRCS16 SATA raid controller +instead of the 3ware one. + +Poking around it seems this does come with Linux drivers and there is a +battery backup option. So it doesn't seem to be completely insane. + +Anyone have any experience with these controllers? + +I'm also wondering about whether I'm better off with one of these SATA raid +controllers or just going with SCSI drives. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:02:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C688D53F98 + for ; + Thu, 14 Apr 2005 12:02:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99725-01 + for ; + Thu, 14 Apr 2005 15:02:43 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 8F6C653F8E + for ; + Thu, 14 Apr 2005 12:02:42 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3EF2TlQ015139 + for ; Thu, 14 Apr 2005 15:02:37 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3EF2TtH015133; + Thu, 14 Apr 2005 15:02:29 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Thu, 14 Apr 2005 15:02:27 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVAzXzsRKOboETIT4Gi4aUTlIAJ2QAMzOJg +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.192 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/284 +X-Sequence-Number: 11681 + +Imagine a system in "furious activity" with two (2) process regularly = +occuring + +Process One: Looooong read (or write). Takes 20ms to do seek, latency, = +and=20 + stream off. Runs over and over.=20 +Process Two: Single block read ( or write ). Typical database row = +access.=20 + Optimally, could be submillisecond. happens more or less = +randomly.=20 + + +Let's say process one starts, and then process two. Assume, for sake of = +this discussion,=20 +that P2's block lies w/in P1's swath. (But doesn't have to...) + +Now, everytime process two has to wait at LEAST 20ms to complete. In a = +queue-reordering +system, it could be a lot faster. And me, looking for disk service times = +on P2, keep +wondering "why does a single diskblock read keep taking >20ms?" + + +Soooo....it doesn't need to be "a read" or "a write". It doesn't need to = +be "furious activity" +(two processes is not furious, even for a single user desktop.) This is = +not a "corner case",=20 +and while it doesn't take into account kernel/drivecache/UBC buffering = +issues, I think it +shines a light on why command re-ordering might be useful. =20 + +YMMV.=20 + + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Kevin Brown +Sent: Thursday, April 14, 2005 4:36 AM +To: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +Greg Stark wrote: + + +> I think you're being misled by analyzing the write case. +>=20 +> Consider the read case. When a user process requests a block and that=20 +> read makes its way down to the driver level, the driver can't just put = + +> it aside and wait until it's convenient. It has to go ahead and issue=20 +> the read right away. + +Well, strictly speaking it doesn't *have* to. It could delay for a = +couple of milliseconds to see if other requests come in, and then issue = +the read if none do. If there are already other requests being = +fulfilled, then it'll schedule the request in question just like the = +rest. + +> In the 10ms or so that it takes to seek to perform that read +> *nothing* gets done. If the driver receives more read or write=20 +> requests it just has to sit on them and wait. 10ms is a lifetime for a = + +> computer. In that time dozens of other processes could have been=20 +> scheduled and issued reads of their own. + +This is true, but now you're talking about a situation where the system = +goes from an essentially idle state to one of furious activity. In = +other words, it's a corner case that I strongly suspect isn't typical in = +situations where SCSI has historically made a big difference. + +Once the first request has been fulfilled, the driver can now schedule = +the rest of the queued-up requests in disk-layout order. + + +I really don't see how this is any different between a system that has = +tagged queueing to the disks and one that doesn't. The only difference = +is where the queueing happens. In the case of SCSI, the queueing = +happens on the disks (or at least on the controller). In the case of = +SATA, the queueing happens in the kernel. + +I suppose the tagged queueing setup could begin the head movement and, = +if another request comes in that requests a block on a cylinder between = +where the head currently is and where it's going, go ahead and read the = +block in question. But is that *really* what happens in a tagged = +queueing system? It's the only major advantage I can see it having. + + +> The same thing would happen if you had lots of processes issuing lots=20 +> of small fsynced writes all over the place. Postgres doesn't really do = + +> that though. It sort of does with the WAL logs, but that shouldn't=20 +> cause a lot of seeking. Perhaps it would mean that having your WAL=20 +> share a spindle with other parts of the OS would have a bigger penalty = + +> on IDE drives than on SCSI drives though? + +Perhaps. + +But I rather doubt that has to be a huge penalty, if any. When a = +process issues an fsync (or even a sync), the kernel doesn't *have* to = +drop everything it's doing and get to work on it immediately. It could = +easily gather a few more requests, bundle them up, and then issue them. = +If there's a lot of disk activity, it's probably smart to do just that. = +All fsync and sync require is that the caller block until the data hits = +the disk (from the point of view of the kernel). The specification = +doesn't require that the kernel act on the calls immediately or write = +only the blocks referred to by the call in question. + + +--=20 +Kevin Brown kevin@sysexperts.com + +---------------------------(end of broadcast)--------------------------- +TIP 3: if posting/reading through Usenet, please send an appropriate + subscribe-nomail command to majordomo@postgresql.org so that your + message can get through to the mailing list cleanly + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:06:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A4AA053F91 + for ; + Thu, 14 Apr 2005 12:06:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99707-10 + for ; + Thu, 14 Apr 2005 15:06:07 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3121353F9A + for ; + Thu, 14 Apr 2005 12:06:06 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3EF5jGr000743; + Thu, 14 Apr 2005 11:05:47 -0400 (EDT) +To: Stephan Szabo +Cc: Richard van den Berg , + Christopher Kings-Lynne , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +In-reply-to: <20050414074154.M38465@megazone.bigpanda.com> +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <20050414074154.M38465@megazone.bigpanda.com> +Comments: In-reply-to Stephan Szabo + message dated "Thu, 14 Apr 2005 07:45:33 -0700" +Date: Thu, 14 Apr 2005 11:05:45 -0400 +Message-ID: <742.1113491145@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/285 +X-Sequence-Number: 11682 + +Stephan Szabo writes: +> ... At some point, if we can work out how to do all the semantics +> properly, it'd probably be possible to replace the insert type check with +> a per-statement check which would be somewhere in between. That requires +> access to the affected rows inside the trigger which I don't believe is +> available currently. + +Not necessarily. It occurs to me that maybe what we need is "lossy +storage" of the trigger events. If we could detect that the queue of +pending checks for a particular FK is getting large, we could discard +the whole queue and replace it with one entry that says "run the +wholesale check again when we are ready to fire triggers". I'm not +sure how to detect this efficiently, though --- the trigger manager +doesn't presently know anything about FKs being different from +any other kind of trigger. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:08:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6756C53676 + for ; + Thu, 14 Apr 2005 12:08:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01753-03 + for ; + Thu, 14 Apr 2005 15:08:28 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 04CE653F8D + for ; + Thu, 14 Apr 2005 12:08:27 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 0A40819B3C0; Thu, 14 Apr 2005 17:08:24 +0200 (CEST) +Message-ID: <425E8766.8070901@trust-factory.com> +Date: Thu, 14 Apr 2005 17:08:22 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Christopher Kings-Lynne +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <425E7F94.4080602@familyhealth.com.au> +In-Reply-To: <425E7F94.4080602@familyhealth.com.au> +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/286 +X-Sequence-Number: 11683 + +Christopher Kings-Lynne wrote: +>> But why then is the speed acceptable if I copy and then manually add +>> the FK? Is the check done by the FK so much different from when it is +>> done automatically using an active deffered FK? +> +> Yeah I think it uses a different query formulation... Actually I only +> assume that deferred fk's don't use that - I guess your experiment +> proves that. + +In my tests deferred or not deferred makes no difference in speed. I am +still quite surprised by how huge the difference is.. this makes FKs +quite unusable when added a lot of data to a table. + + +> Actually, you can just "disable" them if you want to be really dirty :) + +Thanks for the pointer. I got this from the archives: + +------------------------ +update pg_class set reltriggers=0 where relname = 'YOUR_TABLE_NAME'; + +to enable them after you are done, do + +update pg_class set reltriggers = count(*) from pg_trigger where +pg_class.oid=tgrelid and relname='YOUR_TABLE_NAME'; +------------------------ + +I assume the re-enabling will cause an error when the copy/insert added +data that does not satisfy the FK. In that case I'll indeed end up with +invalid data, but at least I will know about it. + +Thanks, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:10:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2760B53F8B + for ; + Thu, 14 Apr 2005 12:08:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02023-04 + for ; + Thu, 14 Apr 2005 15:08:47 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id A1BA053F90 + for ; + Thu, 14 Apr 2005 12:08:46 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3EF8alO015654 + for ; Thu, 14 Apr 2005 15:08:36 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3EF8YtL015638; + Thu, 14 Apr 2005 15:08:35 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Intel SRCS16 SATA raid? +Date: Thu, 14 Apr 2005 15:08:32 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Intel SRCS16 SATA raid? +Thread-Index: AcVBAlsjlb969l59ShOjJa5Dhu9ZFgAAR3gQ +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00, CASHCASHCASH, + USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.184 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/287 +X-Sequence-Number: 11684 + +sorry, don't remember whether it's SCSI or SATA II, but IIRC +the Areca controllers are just stellar for things.=20 + +If you do get SATA for db stuff..especially multiuser...i still +haven't seen anything to indicate an across-the-board primacy +for SATA over SCSI. I'd go w/SCSI, or if SATA for $$$ reasons, I'd +be sure to have many spindles and RAID 10.=20 + +my 0.02. I'm surely not an expert of any kind.=20 + + + + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Greg Stark +Sent: Thursday, April 14, 2005 10:55 AM +To: pgsql-performance@postgresql.org +Subject: [PERFORM] Intel SRCS16 SATA raid? + + + +Our vendor is trying to sell us on an Intel SRCS16 SATA raid controller = +instead of the 3ware one. + +Poking around it seems this does come with Linux drivers and there is a = +battery backup option. So it doesn't seem to be completely insane. + +Anyone have any experience with these controllers? + +I'm also wondering about whether I'm better off with one of these SATA = +raid controllers or just going with SCSI drives. + +--=20 +greg + + +---------------------------(end of broadcast)--------------------------- +TIP 8: explain analyze is your friend + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:14:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0981853F8C + for ; + Thu, 14 Apr 2005 12:14:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03948-07 + for ; + Thu, 14 Apr 2005 15:13:59 +0000 (GMT) +Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) + by svr1.postgresql.org (Postfix) with ESMTP id D200353F90 + for ; + Thu, 14 Apr 2005 12:13:58 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id 6D3A111DE51; + Thu, 14 Apr 2005 23:11:52 +0800 (WST) +Received: from vscan02.westnet.com.au ([127.0.0.1]) + by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 21378-15; Thu, 14 Apr 2005 23:11:52 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan02.westnet.com.au (Postfix) with ESMTP id E9BFA11DE3C; + Thu, 14 Apr 2005 23:11:51 +0800 (WST) +Message-ID: <425E88B7.6000203@familyhealth.com.au> +Date: Thu, 14 Apr 2005 23:13:59 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard van den Berg +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <425E7F94.4080602@familyhealth.com.au> + <425E8766.8070901@trust-factory.com> +In-Reply-To: <425E8766.8070901@trust-factory.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/288 +X-Sequence-Number: 11685 + +> Thanks for the pointer. I got this from the archives: +> +> ------------------------ +> update pg_class set reltriggers=0 where relname = 'YOUR_TABLE_NAME'; +> +> to enable them after you are done, do +> +> update pg_class set reltriggers = count(*) from pg_trigger where +> pg_class.oid=tgrelid and relname='YOUR_TABLE_NAME'; +> ------------------------ +> +> I assume the re-enabling will cause an error when the copy/insert added +> data that does not satisfy the FK. In that case I'll indeed end up with +> invalid data, but at least I will know about it. + +No it certainly won't warn you. You have _avoided_ the check entirely. + That's why I was warning you... + +If you wanted to be really careful, you could: + +being; +lock tables for writes... +turn off triggers +insert +delete where rows don't match fk constraint +turn on triggers +commit; + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:25:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2408A5296B + for ; + Thu, 14 Apr 2005 12:25:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09042-02 + for ; + Thu, 14 Apr 2005 15:25:45 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 4975F53B40 + for ; + Thu, 14 Apr 2005 12:25:44 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 4967819B3C0; Thu, 14 Apr 2005 17:25:38 +0200 (CEST) +Message-ID: <425E8B70.2060006@trust-factory.com> +Date: Thu, 14 Apr 2005 17:25:36 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Christopher Kings-Lynne +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <425E7F94.4080602@familyhealth.com.au> + <425E8766.8070901@trust-factory.com> + <425E88B7.6000203@familyhealth.com.au> +In-Reply-To: <425E88B7.6000203@familyhealth.com.au> +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/289 +X-Sequence-Number: 11686 + +Christopher Kings-Lynne wrote: +> No it certainly won't warn you. You have _avoided_ the check entirely. +> That's why I was warning you... + +I figured as much when I realized it was just a simple table update. I +was thinking more of a DB2 style "set integrity" command. + +> If you wanted to be really careful, you could: + +So I will be re-checking my own FKs. That's not really what I'd expect +from a FK. + +My problem with this really is that in my database it is hard to predict +which inserts will be huge (and thus need FKs dissabled), so I would +have to code it around all inserts. Instead I can code my own integirty +logic and avoid using FKs all together. + +Thanks, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + Have you visited our new DNA Portal? +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:28:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 28F4D53B74 + for ; + Thu, 14 Apr 2005 12:28:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08985-09 + for ; + Thu, 14 Apr 2005 15:28:11 +0000 (GMT) +Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) + by svr1.postgresql.org (Postfix) with ESMTP id 46F0B53AFA + for ; + Thu, 14 Apr 2005 12:28:10 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id E8B5A11DE1C; + Thu, 14 Apr 2005 23:26:04 +0800 (WST) +Received: from vscan02.westnet.com.au ([127.0.0.1]) + by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 22639-11; Thu, 14 Apr 2005 23:26:04 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan02.westnet.com.au (Postfix) with ESMTP id 8C94E11D5DB; + Thu, 14 Apr 2005 23:26:04 +0800 (WST) +Message-ID: <425E8C0B.8060408@familyhealth.com.au> +Date: Thu, 14 Apr 2005 23:28:11 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard van den Berg +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <425E7F94.4080602@familyhealth.com.au> + <425E8766.8070901@trust-factory.com> + <425E88B7.6000203@familyhealth.com.au> + <425E8B70.2060006@trust-factory.com> +In-Reply-To: <425E8B70.2060006@trust-factory.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/290 +X-Sequence-Number: 11687 + +> My problem with this really is that in my database it is hard to predict +> which inserts will be huge (and thus need FKs dissabled), so I would +> have to code it around all inserts. Instead I can code my own integirty +> logic and avoid using FKs all together. + +Just drop the fk and re-add it, until postgres gets more smarts. + +Chris + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:28:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 41EBC53B16 + for ; + Thu, 14 Apr 2005 12:28:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11287-01 + for ; + Thu, 14 Apr 2005 15:28:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3224253859 + for ; + Thu, 14 Apr 2005 12:28:30 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3EFSNUL001007; + Thu, 14 Apr 2005 11:28:23 -0400 (EDT) +To: Christopher Kings-Lynne +Cc: Richard van den Berg , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +In-reply-to: <425E88B7.6000203@familyhealth.com.au> +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <425E7F94.4080602@familyhealth.com.au> + <425E8766.8070901@trust-factory.com> + <425E88B7.6000203@familyhealth.com.au> +Comments: In-reply-to Christopher Kings-Lynne + message dated "Thu, 14 Apr 2005 23:13:59 +0800" +Date: Thu, 14 Apr 2005 11:28:23 -0400 +Message-ID: <1006.1113492503@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/291 +X-Sequence-Number: 11688 + +Christopher Kings-Lynne writes: +> No it certainly won't warn you. You have _avoided_ the check entirely. +> That's why I was warning you... + +> If you wanted to be really careful, you could: + +Probably the better bet is to drop and re-add the FK constraint. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:47:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E25353B33 + for ; + Thu, 14 Apr 2005 12:47:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17353-10 + for ; + Thu, 14 Apr 2005 15:47:29 +0000 (GMT) +Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BF6753B40 + for ; + Thu, 14 Apr 2005 12:47:27 -0300 (ADT) +Received: from tschibtschibojtschitsch (dsl-082-082-198-136.arcor-ip.net + [82.82.198.136]) + by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id j3EFlP728302 + for ; Thu, 14 Apr 2005 17:47:25 +0200 +Subject: recovery after long delete +From: Markus Bertheau +To: pgsql-performance@postgresql.org +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-cIOIkPG1UTZWCI6aolqG" +Date: Thu, 14 Apr 2005 17:47:23 +0200 +Message-Id: <1113493643.7249.35.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.121 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/292 +X-Sequence-Number: 11689 + + +--=-cIOIkPG1UTZWCI6aolqG +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +Hi. + +Our professor told us the following story: Oracle. A client issued a +selective delete statement on a big table. After two days he lost +patience and pulled the plug. Unfortunately while starting up, oracle +had to restore all the deleted rows, which took it another two days. He +reasoned that one better copies all rows that are not to be deleted in +another table drops the original table afterwards. (Concurrency, fks, +indexes are not the question here). So I wondered how this works in +PostgreSQL. As I understand it, what's going on is the following: + +1. The transaction 45 is started. It is recorded as in-progress. +2. The rows selected in the delete statement are one by one marked as +to-be-deleted by txn 45. Among them row 27. +3. If a concurrently running read committed txn 47 wants to update row +27, it blocks, awaiting whether txn 45 commits or aborts. +4.1 When txn 45 commits, it is marked as such. +5.1 txn 47 can continue, but as row 27 was deleted, it is not affected +by txn 47's update statement. +4.2 When txn 45 aborts, it is marked as such. This means the same as not +being marked at all. +5.2 txn 47 continues and updates row 27. + +Now if you pull the plug after 2, at startup, pg will go through the +in-progress txns and mark them as aborted. That's all the recovery in +this case. All rows are still there. O(1). + +How does oracle do that? Has all this something to do with mvcc? Why +does it take oracle so long to recover? + +Thanks + +Markus +--=20 +Markus Bertheau + +--=-cIOIkPG1UTZWCI6aolqG +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) + +iD8DBQBCXpCL2RUnMPztcykRAgg9AJ4hPhc/8PMPzCUUIj1DHcdtjE0PrwCeK49d +YXyz2RX62jFAvtncEC2q5yM= +=sjJO +-----END PGP SIGNATURE----- + +--=-cIOIkPG1UTZWCI6aolqG-- + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 22:44:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 18C8453B94 + for ; + Thu, 14 Apr 2005 12:52:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20249-03 + for ; + Thu, 14 Apr 2005 15:51:53 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 79AC853BA5 + for ; + Thu, 14 Apr 2005 12:51:51 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so510409wri + for ; + Thu, 14 Apr 2005 08:51:49 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Svr5F4Hts73xnWkRk04ZyFduZm4eQ95jITJPrLZ1nrzZ62unsku0thCiDdv6RkVxr5JBmh1CVHLl/c1Ipyd+RCcd7QSUCrqO81fA9daIWHK1VIyzCXW4b7G6MTItPuXWX1KMVSdJL3K/burm+U5l3PiDjp7Xes88kCSPInqj8Ig= +Received: by 10.54.68.9 with SMTP id q9mr846587wra; + Thu, 14 Apr 2005 08:51:47 -0700 (PDT) +Received: by 10.54.22.6 with HTTP; Thu, 14 Apr 2005 08:51:46 -0700 (PDT) +Message-ID: +Date: Thu, 14 Apr 2005 10:51:46 -0500 +From: Matthew Nuzum +Reply-To: newz@bearfruit.org +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-Reply-To: <446.1113489854@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> + <20050414055655.GB19518@filer> <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.398 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/442 +X-Sequence-Number: 11839 + +On 4/14/05, Tom Lane wrote: +>=20 +> That's basically what it comes down to: SCSI lets the disk drive itself +> do the low-level I/O scheduling whereas the ATA spec prevents the drive +> from doing so (unless it cheats, ie, caches writes). Also, in SCSI it's +> possible for the drive to rearrange reads as well as writes --- which +> AFAICS is just not possible in ATA. (Maybe in the newest spec...) +>=20 +> The reason this is so much more of a win than it was when ATA was +> designed is that in modern drives the kernel has very little clue about +> the physical geometry of the disk. Variable-size tracks, bad-block +> sparing, and stuff like that make for a very hard-to-predict mapping +> from linear sector addresses to actual disk locations. Combine that +> with the fact that the drive controller can be much smarter than it was +> twenty years ago, and you can see that the case for doing I/O scheduling +> in the kernel and not in the drive is pretty weak. +> =20 +>=20 + +So if you all were going to choose between two hard drives where: +drive A has capacity C and spins at 15K rpms, and +drive B has capacity 2 x C and spins at 10K rpms and +all other features are the same, the price is the same and C is enough +disk space which would you choose? + +I've noticed that on IDE drives, as the capacity increases the data +density increases and there is a pereceived (I've not measured it) +performance increase. + +Would the increased data density of the higher capacity drive be of +greater benefit than the faster spindle speed of drive A? + +--=20 +Matthew Nuzum +www.bearfruit.org + +From pgsql-performance-owner@postgresql.org Thu Apr 14 12:55:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 234DB535FA + for ; + Thu, 14 Apr 2005 12:55:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20825-06 + for ; + Thu, 14 Apr 2005 15:55:49 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 384255294A + for ; + Thu, 14 Apr 2005 12:55:48 -0300 (ADT) +Received: by rproxy.gmail.com with SMTP id a41so423946rng + for ; + Thu, 14 Apr 2005 08:55:48 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:reply-to:from:to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:x-mimeole:message-id; + b=Lp71ryPPqozICeY/5xxDMeTIfw8J2m5+toI1SaAW+FpvfT0ewdP9nT74VwuqW0/way3neNbEYGenzhe8CnGiFCaZH5jNqcDGuBjAqN45EpLQuA8DbcDfJNq8yLYOdSaJXFNwuTvupHTTaWdX8iMQeequsEziifDqbD+PL61BnQk= +Received: by 10.38.86.53 with SMTP id j53mr1985130rnb; + Thu, 14 Apr 2005 08:55:47 -0700 (PDT) +Received: from MATTSPC ([12.216.69.41]) + by mx.gmail.com with ESMTP id 79sm718502rna.2005.04.14.08.55.47; + Thu, 14 Apr 2005 08:55:47 -0700 (PDT) +Reply-To: +From: "Matthew Nuzum" +To: +Subject: Re: How to improve db performance with $7K? +Date: Thu, 14 Apr 2005 10:55:42 -0500 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +Thread-Index: AcVBCmlHOghtl6diTSCMaQNVQ5qOzg== +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Message-ID: <425e9283.0422c9db.394e.ffffb643@mx.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/293 +X-Sequence-Number: 11690 + +On 4/14/05, Tom Lane wrote: +> +> That's basically what it comes down to: SCSI lets the disk drive = +itself +> do the low-level I/O scheduling whereas the ATA spec prevents the = +drive +> from doing so (unless it cheats, ie, caches writes). =A0Also, in SCSI = +it's +> possible for the drive to rearrange reads as well as writes --- which +> AFAICS is just not possible in ATA. =A0(Maybe in the newest spec...) +> +> The reason this is so much more of a win than it was when ATA was +> designed is that in modern drives the kernel has very little clue = +about +> the physical geometry of the disk. =A0Variable-size tracks, bad-block +> sparing, and stuff like that make for a very hard-to-predict mapping +> from linear sector addresses to actual disk locations. =A0Combine that +> with the fact that the drive controller can be much smarter than it = +was +> twenty years ago, and you can see that the case for doing I/O = +scheduling +> in the kernel and not in the drive is pretty weak. +> +> + +So if you all were going to choose between two hard drives where: +drive A has capacity C and spins at 15K rpms, and +drive B has capacity 2 x C and spins at 10K rpms and +all other features are the same, the price is the same and C is enough +disk space which would you choose? + +I've noticed that on IDE drives, as the capacity increases the data +density increases and there is a pereceived (I've not measured it) +performance increase. + +Would the increased data density of the higher capacity drive be of +greater benefit than the faster spindle speed of drive A? + +--=20 +Matthew Nuzum +www.followers.net - Makers of =93Elite Content Management System=94 +View samples of Elite CMS in action by visiting +http://www.followers.net/portfolio/ + + + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 13:04:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6FF2C53616 + for ; + Thu, 14 Apr 2005 13:04:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22657-06 + for ; + Thu, 14 Apr 2005 16:04:03 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) + by svr1.postgresql.org (Postfix) with ESMTP id 85F8853557 + for ; + Thu, 14 Apr 2005 13:04:02 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so529993nzf + for ; + Thu, 14 Apr 2005 09:04:02 -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=nNk444moOlvVrzVjLVMnoKo0zfcCrJbvoe/xUkWdUSunBD0B97EjIaM1IdjemhyynrIkmTi/JeoZEaa74KybzOt3tVDA5YnsbMWfAP2tGe9syqWtkfuYfOpAu79E+bcyu99DcrNEtX6P0hzy9s2756tuOyIV9nD4nyWevM6aruw= +Received: by 10.36.8.17 with SMTP id 17mr123494nzh; + Thu, 14 Apr 2005 09:04:02 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Thu, 14 Apr 2005 09:04:02 -0700 (PDT) +Message-ID: <758d5e7f05041409044eadfcd1@mail.gmail.com> +Date: Thu, 14 Apr 2005 18:04:02 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Joel Fradkin +Subject: Re: speed of querry? +Cc: PERFORM +In-Reply-To: <000b01c54100$a68d2300$797ba8c0@jfradkin> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <758d5e7f0504140720754c7750@mail.gmail.com> + <000b01c54100$a68d2300$797ba8c0@jfradkin> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.755 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/294 +X-Sequence-Number: 11691 + +On 4/14/05, Joel Fradkin wrote: +> Josh from commandprompt.com had me alter the config to have +> default_statistics_target =3D 250 +>=20 +> Is this somehow related to what your asking me to do? +> I did do an analyze, but have only ran the viw a few times. + +well, he did suggest the right thing. However this parameter +applies to newly created tables, so either recreate the tables +or do the ALTER TABLE I've sent eariler. + +Basically it tells postgres how many values should it keep for +statistics per column. The config default_statistics_target +is the default (=3D used when creating table) and ALTER... is +a way to change it later. + +The more statistics PostgreSQL has means it can better +predict how much data will be returned -- and this directly +leads to a choice how to handle the data (order in which +tables should be read, whether to use index or not, which +algorithm use for join, etc.). The more statistics, the better +PostgreSQL is able to predict. The more statistics, the slower +planner is able to do the analysis. So you have to find +a value which will be as much as is needed to accurately +predict the results but not more! PostgreSQL's default of +10 is a bit conservative, hence the suggestions to increase +it. :) [ and so is random_page_cost or some people have +found that in their cases it is beneficial to reduce the value, +even as much as below 2. ] + +Hope this clairifies things a bit. + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Thu Apr 14 13:11:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CFB6A535FA + for ; + Thu, 14 Apr 2005 13:11:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27414-06 + for ; + Thu, 14 Apr 2005 16:11:44 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id AE10D53B94 + for ; + Thu, 14 Apr 2005 13:11:43 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 8921435398; Thu, 14 Apr 2005 09:11:41 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 6FDEE35394; Thu, 14 Apr 2005 09:11:41 -0700 (PDT) +Date: Thu, 14 Apr 2005 09:11:41 -0700 (PDT) +From: Stephan Szabo +To: Tom Lane +Cc: Richard van den Berg , + Christopher Kings-Lynne , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +In-Reply-To: <742.1113491145@sss.pgh.pa.us> +Message-ID: <20050414090931.P42874@megazone.bigpanda.com> +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <20050414074154.M38465@megazone.bigpanda.com> + <742.1113491145@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/295 +X-Sequence-Number: 11692 + +On Thu, 14 Apr 2005, Tom Lane wrote: + +> Stephan Szabo writes: +> > ... At some point, if we can work out how to do all the semantics +> > properly, it'd probably be possible to replace the insert type check with +> > a per-statement check which would be somewhere in between. That requires +> > access to the affected rows inside the trigger which I don't believe is +> > available currently. +> +> Not necessarily. It occurs to me that maybe what we need is "lossy +> storage" of the trigger events. If we could detect that the queue of +> pending checks for a particular FK is getting large, we could discard +> the whole queue and replace it with one entry that says "run the +> wholesale check again when we are ready to fire triggers". I'm not + +Yeah, but there's a potentially large middle ground where neither our +current plan nor check the entire table is particularly good for that we +might be able to handle better. It'd be nice to also fall back to check +the entire table for even larger changes. + +From pgsql-performance-owner@postgresql.org Thu Apr 14 13:21:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 22F1C53BF6 + for ; + Thu, 14 Apr 2005 13:21:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31338-01 + for ; + Thu, 14 Apr 2005 16:21:02 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 90F5553BF2 + for ; + Thu, 14 Apr 2005 13:21:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3EGKl3Z001429; + Thu, 14 Apr 2005 12:20:47 -0400 (EDT) +To: Dawid Kuroczko +Cc: Joel Fradkin , + PERFORM +Subject: Re: speed of querry? +In-reply-to: <758d5e7f05041409044eadfcd1@mail.gmail.com> +References: <758d5e7f0504140720754c7750@mail.gmail.com> + <000b01c54100$a68d2300$797ba8c0@jfradkin> + <758d5e7f05041409044eadfcd1@mail.gmail.com> +Comments: In-reply-to Dawid Kuroczko + message dated "Thu, 14 Apr 2005 18:04:02 +0200" +Date: Thu, 14 Apr 2005 12:20:47 -0400 +Message-ID: <1428.1113495647@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/296 +X-Sequence-Number: 11693 + +Dawid Kuroczko writes: +> Basically it tells postgres how many values should it keep for +> statistics per column. The config default_statistics_target +> is the default (= used when creating table) and ALTER... is +> a way to change it later. + +Not quite. default_statistics_target is the value used by ANALYZE for +any column that hasn't had an explicit ALTER SET STATISTICS done on it. +So you can change default_statistics_target and that will affect +existing tables. + +(It used to work the way you are saying, but that was a few releases +back...) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 14 13:22:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 12E1953B2E; + Thu, 14 Apr 2005 13:22:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30291-06; Thu, 14 Apr 2005 16:22:37 +0000 (GMT) +Received: from dfw-gate3.raytheon.com (dfw-gate3.raytheon.com + [199.46.199.232]) + by svr1.postgresql.org (Postfix) with ESMTP id B79F053C80; + Thu, 14 Apr 2005 13:22:33 -0300 (ADT) +Received: from ds02c00.directory.ray.com (ds02c00.directory.ray.com + [147.25.138.118]) + by dfw-gate3.raytheon.com (8.12.10/8.12.10) with ESMTP id + j3EGMOPO010867; Thu, 14 Apr 2005 11:22:24 -0500 (CDT) +Received: from ds02c00 (localhost [127.0.0.1]) + by ds02c00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j3EGMMup016620; Thu, 14 Apr 2005 16:22:23 GMT +Received: from ds02c00.directory.ray.com with LMTP by ds02c00 + (2.0.6/sieved-2-0-build-559); Thu, 14 Apr 2005 16:22:22 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02c00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j3EGMIZU016577 sender Richard_D_Levine@raytheon.com; + Thu, 14 Apr 2005 16:22:18 GMT +In-Reply-To: <87zmw1h0i2.fsf@stark.xeocode.com> +Subject: Re: Intel SRCS16 SATA raid? +To: Greg Stark +Cc: pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Thu, 14 Apr 2005 11:22:15 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/14/2005 11:22:18 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.212 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/297 +X-Sequence-Number: 11694 + +Greg, + +I posted this link under a different thread (the $7k server thread). It is +a very good read on why SCSI is better for servers than ATA. I didn't note +bias, though it is from a drive manufacturer. YMMV. There is an +interesting, though dated appendix on different manufacturers' drive +characteristics. + +http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interface_ATA_vs_SCSI_042003.pdf + +Enjoy, + +Rick + +pgsql-performance-owner@postgresql.org wrote on 04/14/2005 09:54:45 AM: + +> +> Our vendor is trying to sell us on an Intel SRCS16 SATA raid controller +> instead of the 3ware one. +> +> Poking around it seems this does come with Linux drivers and there is a +> battery backup option. So it doesn't seem to be completely insane. +> +> Anyone have any experience with these controllers? +> +> I'm also wondering about whether I'm better off with one of these SATA +raid +> controllers or just going with SCSI drives. +> +> -- +> greg +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 13:26:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 029AC536EF + for ; + Thu, 14 Apr 2005 13:26:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30291-10 + for ; + Thu, 14 Apr 2005 16:26:44 +0000 (GMT) +Received: from fep02-app.kolumbus.fi (fep02-0.kolumbus.fi [193.229.0.44]) + by svr1.postgresql.org (Postfix) with ESMTP id F29BF53C00 + for ; + Thu, 14 Apr 2005 13:26:42 -0300 (ADT) +Received: from [192.168.1.3] (really [84.230.96.65]) + by fep02-app.kolumbus.fi with ESMTP + id <20050414162641.TYDE8756.fep02-app.kolumbus.fi@[192.168.1.3]>; + Thu, 14 Apr 2005 19:26:41 +0300 +Message-ID: <425E99C1.6050506@kolumbus.fi> +Date: Thu, 14 Apr 2005 19:26:41 +0300 +From: Marko Ristola +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.6) Gecko/20050324 Debian/1.7.6-1 +X-Accept-Language: en +MIME-Version: 1.0 +To: Christopher Kings-Lynne +Cc: Richard van den Berg , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425E792B.4020500@familyhealth.com.au> + <425E7D96.6020201@trust-factory.com> + <425E7F94.4080602@familyhealth.com.au> + <425E8766.8070901@trust-factory.com> + <425E88B7.6000203@familyhealth.com.au> + <425E8B70.2060006@trust-factory.com> + <425E8C0B.8060408@familyhealth.com.au> +In-Reply-To: <425E8C0B.8060408@familyhealth.com.au> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.424 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/298 +X-Sequence-Number: 11695 + + +About the foreign key performance: + +Maybe foreign key checks could be delayed into the COMMIT phase. +In that position, you could check, that there are lots of foreign key +checks +for each foreign key pending, and do the foreign key check for an area +or for the whole table, if it is faster. + +I have heard, that the database must be in consistent state after COMMIT, +but it does not have necessarily to be okay inside a transaction. + +1. COMMIT wanted +2. If there are lots of foreign key checks pending, do either an area +foreign key check +(join result must be 0 rows), or a full table join. +3. If all foreign key checks are okay, complete the COMMIT operation. +4. If a foreign key check fails, go into the ROLLBACK NEEDED state. + +Maybe Tom Lane meant the same. + +set option delayed_foreign_keys=true; +BEGIN; +insert 1000 rows. +COMMIT; + +Regards, +Marko Ristola + +Christopher Kings-Lynne wrote: + +>> My problem with this really is that in my database it is hard to +>> predict which inserts will be huge (and thus need FKs dissabled), so +>> I would have to code it around all inserts. Instead I can code my own +>> integirty logic and avoid using FKs all together. +> +> +> Just drop the fk and re-add it, until postgres gets more smarts. +> +> Chris +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org + + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 13:34:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9748E53692 + for ; + Thu, 14 Apr 2005 13:34:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34969-04 + for ; + Thu, 14 Apr 2005 16:34:33 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AA3C7533AC + for ; + Thu, 14 Apr 2005 13:34:31 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3EGYUv7001506; + Thu, 14 Apr 2005 12:34:30 -0400 (EDT) +To: Markus Bertheau +Cc: pgsql-performance@postgresql.org +Subject: Re: recovery after long delete +In-reply-to: <1113493643.7249.35.camel@localhost.localdomain> +References: <1113493643.7249.35.camel@localhost.localdomain> +Comments: In-reply-to Markus Bertheau + message dated "Thu, 14 Apr 2005 17:47:23 +0200" +Date: Thu, 14 Apr 2005 12:34:30 -0400 +Message-ID: <1505.1113496470@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/299 +X-Sequence-Number: 11696 + +Markus Bertheau writes: +> Now if you pull the plug after 2, at startup, pg will go through the +> in-progress txns and mark them as aborted. That's all the recovery in +> this case. All rows are still there. O(1). + +Right. (Actually it's O(checkpoint interval), because we have to make +sure that everything we did since the last checkpoint actually got to +disk --- but in principle, there's zero recovery effort.) + +> How does oracle do that? Has all this something to do with mvcc? Why +> does it take oracle so long to recover? + +Oracle doesn't do MVCC the same way we do. They update rows in place +and put the previous version of a row into an "undo log". If the +transaction aborts, they have to go back through the undo log and put +back the previous version of the row. I'm not real clear on how that +applies to deletions, but I suppose it's the same deal: cost of undoing +a transaction in Oracle is proportional to the number of rows it +changed. There's also the little problem that the space available for +UNDO logs is limited :-( + +As against which, they don't have to VACUUM. So it's a tradeoff. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:22:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F1A254086 + for ; + Thu, 14 Apr 2005 15:22:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42015-09 + for ; + Thu, 14 Apr 2005 18:22:20 +0000 (GMT) +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by svr1.postgresql.org (Postfix) with ESMTP id 4878553BF5 + for ; + Thu, 14 Apr 2005 13:38:55 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEY00L8K3KL33K1@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 14 Apr 2005 11:38:52 -0500 (CDT) +Date: Thu, 14 Apr 2005 12:38:58 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: <1428.1113495647@sss.pgh.pa.us> +To: "'Tom Lane'" , + "'Dawid Kuroczko'" +Cc: "'PERFORM'" +Message-id: <000901c54110$79032aa0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7bit +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/311 +X-Sequence-Number: 11708 + +I did as described to alter table and did not see any difference in speed. +I am trying to undo the symbolic link to the data array and set it up on +raid 5 disks in the machine just to test if there is an issue with the +config of the raid 10 array or a problem with the controller. + +I am kinda lame at Linux so not sure I have got it yet still testing. +Still kind puzzled why it chose tow different option, but one is running +windows version of postgres, so maybe that has something to do with it. + +The data bases and configs (as far as page cost) are the same. + +Joel Fradkin + +Wazagua, Inc. +2520 Trailmate Dr +Sarasota, Florida 34243 +Tel. 941-753-7111 ext 305 + +jfradkin@wazagua.com +www.wazagua.com +Powered by Wazagua +Providing you with the latest Web-based technology & advanced tools. +C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc + This email message is for the use of the intended recipient(s) and may +contain confidential and privileged information. Any unauthorized review, +use, disclosure or distribution is prohibited. If you are not the intended +recipient, please contact the sender by reply email and delete and destroy +all copies of the original message, including attachments. + + + + +-----Original Message----- +From: Tom Lane [mailto:tgl@sss.pgh.pa.us] +Sent: Thursday, April 14, 2005 11:21 AM +To: Dawid Kuroczko +Cc: Joel Fradkin; PERFORM +Subject: Re: [PERFORM] speed of querry? + +Dawid Kuroczko writes: +> Basically it tells postgres how many values should it keep for +> statistics per column. The config default_statistics_target +> is the default (= used when creating table) and ALTER... is +> a way to change it later. + +Not quite. default_statistics_target is the value used by ANALYZE for +any column that hasn't had an explicit ALTER SET STATISTICS done on it. +So you can change default_statistics_target and that will affect +existing tables. + +(It used to work the way you are saying, but that was a few releases +back...) + + regards, tom lane + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:25:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BE4853202 + for ; + Thu, 14 Apr 2005 15:22:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42140-10 + for ; + Thu, 14 Apr 2005 18:22:34 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id BF85853FD3 + for ; + Thu, 14 Apr 2005 13:44:28 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3EGdUma012630; Thu, 14 Apr 2005 09:39:30 -0700 +Message-ID: <425E9DE2.7030005@commandprompt.com> +Date: Thu, 14 Apr 2005 09:44:18 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Mohan, Ross" +Cc: pgsql-performance@postgresql.org +Subject: Re: Intel SRCS16 SATA raid? +References: +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/312 +X-Sequence-Number: 11709 + + +> +> +>Our vendor is trying to sell us on an Intel SRCS16 SATA raid controller instead of the 3ware one. +> +> +Well I have never even heard of it. 3ware is the defacto authority of +reasonable SATA RAID. If you were to +go with a different brand I would go with LSI. The LSI 150-6 is a nice +card with a battery backup option as well. + +Oh and 3ware has BBU for certain models as well. + +Sincerely, + +Joshua D. Drake + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:22:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 389275296B + for ; + Thu, 14 Apr 2005 15:22:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43464-03 + for ; + Thu, 14 Apr 2005 18:22:18 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F33553F8F + for ; + Thu, 14 Apr 2005 13:44:45 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3EGihOS001569; + Thu, 14 Apr 2005 12:44:43 -0400 (EDT) +To: matt@followers.net +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-reply-to: <425e9283.0422c9db.394e.ffffb643@mx.gmail.com> +References: <425e9283.0422c9db.394e.ffffb643@mx.gmail.com> +Comments: In-reply-to "Matthew Nuzum" + message dated "Thu, 14 Apr 2005 10:55:42 -0500" +Date: Thu, 14 Apr 2005 12:44:43 -0400 +Message-ID: <1568.1113497083@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/310 +X-Sequence-Number: 11707 + +"Matthew Nuzum" writes: +> So if you all were going to choose between two hard drives where: +> drive A has capacity C and spins at 15K rpms, and +> drive B has capacity 2 x C and spins at 10K rpms and +> all other features are the same, the price is the same and C is enough +> disk space which would you choose? + +> I've noticed that on IDE drives, as the capacity increases the data +> density increases and there is a pereceived (I've not measured it) +> performance increase. + +> Would the increased data density of the higher capacity drive be of +> greater benefit than the faster spindle speed of drive A? + +Depends how they got the 2x capacity increase. If they got it by +increased bit density --- same number of tracks, but more sectors +per track --- then drive B actually has a higher transfer rate, +because in one rotation it can transfer twice as much data as drive A. +More tracks per cylinder (ie, more platters) can also be a speed win +since you can touch more data before you have to seek to another +cylinder. Drive B will lose if the 2x capacity was all from adding +cylinders (unless its seek-time spec is way better than A's ... which +is unlikely but not impossible, considering the cylinders are probably +closer together). + +Usually there's some-of-each involved, so it's hard to make any +definite statement without more facts. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 14 14:01:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ED0F253F8A + for ; + Thu, 14 Apr 2005 14:01:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15869-03 + for ; + Thu, 14 Apr 2005 17:01:34 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 5648F53C80 + for ; + Thu, 14 Apr 2005 14:01:32 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so532385wri + for ; + Thu, 14 Apr 2005 10:01:32 -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=gNz0HRmh78NeDHnKll/91H9Y/bopy+r2rd4zw38/jtMXWJni7Iv05UitgNESwTKFZxgLZVA5iI4hJnxyDzf85whd5UjcDriRsEx70+/3GuRXeJr897ial3LoyeFYziJNPsL4ibGpSSyhSmxUqAM7Jnkg+AUWMgZN3jkghX8Aods= +Received: by 10.54.79.17 with SMTP id c17mr100007wrb; + Thu, 14 Apr 2005 10:01:30 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 14 Apr 2005 10:01:30 -0700 (PDT) +Message-ID: <33c6269f05041410011fe1f283@mail.gmail.com> +Date: Thu, 14 Apr 2005 13:01:30 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: "Richard_D_Levine@raytheon.com" +Subject: Re: Intel SRCS16 SATA raid? +Cc: Greg Stark , pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org +In-Reply-To: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <87zmw1h0i2.fsf@stark.xeocode.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.499 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP, TO_ADDRESS_EQ_REAL +X-Spam-Level: +X-Archive-Number: 200504/300 +X-Sequence-Number: 11697 + +I have read a large chunk of this, and I would highly recommend it to +anyone who has been participating in the drive discussions. It is +most informative!! + +Alex Turner +netEconomist + +On 4/14/05, Richard_D_Levine@raytheon.com w= +rote: +> Greg, +>=20 +> I posted this link under a different thread (the $7k server thread). It = +is +> a very good read on why SCSI is better for servers than ATA. I didn't no= +te +> bias, though it is from a drive manufacturer. YMMV. There is an +> interesting, though dated appendix on different manufacturers' drive +> characteristics. +>=20 +> http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interfac= +e_ATA_vs_SCSI_042003.pdf +>=20 +> Enjoy, +>=20 +> Rick +>=20 +> pgsql-performance-owner@postgresql.org wrote on 04/14/2005 09:54:45 AM: +>=20 +> > +> > Our vendor is trying to sell us on an Intel SRCS16 SATA raid controller +> > instead of the 3ware one. +> > +> > Poking around it seems this does come with Linux drivers and there is a +> > battery backup option. So it doesn't seem to be completely insane. +> > +> > Anyone have any experience with these controllers? +> > +> > I'm also wondering about whether I'm better off with one of these SATA +> raid +> > controllers or just going with SCSI drives. +> > +> > -- +> > greg +> > +> > +> > ---------------------------(end of broadcast)--------------------------= +- +> > TIP 8: explain analyze is your friend +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if you= +r +> joining column's datatypes do not match +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 14:13:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D6AA53AB4 + for ; + Thu, 14 Apr 2005 14:13:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20841-04 + for ; + Thu, 14 Apr 2005 17:13:44 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id E1D3454054 + for ; + Thu, 14 Apr 2005 14:13:41 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so536192wri + for ; + Thu, 14 Apr 2005 10:13:42 -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=hkqBkJ+3B7J93WrAJsa5oBgI06ELnSJk8v7cF9NJk+W/6rQiS78tHFr+3Bv7y2qOGxOMexJv1aqh+iB0iTbCRls/8E314DJ3N4oMwilBuDVu9pGwPnm2H3ODfS6uYuKwiC9DMnDJfT4A8FNiQfCv+3/ZOGqNkZ14pZvCKIMJA7s= +Received: by 10.54.37.64 with SMTP id k64mr1188044wrk; + Thu, 14 Apr 2005 10:13:41 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 14 Apr 2005 10:13:41 -0700 (PDT) +Message-ID: <33c6269f05041410135875d7c5@mail.gmail.com> +Date: Thu, 14 Apr 2005 13:13:41 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: "Richard_D_Levine@raytheon.com" +Subject: Re: Intel SRCS16 SATA raid? +Cc: Greg Stark , pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org +In-Reply-To: <33c6269f05041410011fe1f283@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <87zmw1h0i2.fsf@stark.xeocode.com> + + <33c6269f05041410011fe1f283@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.505 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP, TO_ADDRESS_EQ_REAL +X-Spam-Level: +X-Archive-Number: 200504/301 +X-Sequence-Number: 11698 + +I have put together a little head to head performance of a 15k SCSI, +10k SCSI 10K SATA w/TCQ, 10K SATA wo/TCQ and 7.2K SATA drive +comparison at storage review + +http://www.storagereview.com/php/benchmark/compare_rtg_2001.php?typeID=3D10= +&testbedID=3D3&osID=3D4&raidconfigID=3D1&numDrives=3D1&devID_0=3D232&devID_= +1=3D40&devID_2=3D259&devID_3=3D267&devID_4=3D261&devID_5=3D248&devCnt=3D6 + +It does illustrate some of the weaknesses of SATA drives, but all in +all the Raptor drives put on a good show. + +Alex Turner +netEconomist + +On 4/14/05, Alex Turner wrote: +> I have read a large chunk of this, and I would highly recommend it to +> anyone who has been participating in the drive discussions. It is +> most informative!! +>=20 +> Alex Turner +> netEconomist +>=20 +> On 4/14/05, Richard_D_Levine@raytheon.com = + wrote: +> > Greg, +> > +> > I posted this link under a different thread (the $7k server thread). I= +t is +> > a very good read on why SCSI is better for servers than ATA. I didn't = +note +> > bias, though it is from a drive manufacturer. YMMV. There is an +> > interesting, though dated appendix on different manufacturers' drive +> > characteristics. +> > +> > http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interf= +ace_ATA_vs_SCSI_042003.pdf +> > +> > Enjoy, +> > +> > Rick +> > +> > pgsql-performance-owner@postgresql.org wrote on 04/14/2005 09:54:45 AM: +> > +> > > +> > > Our vendor is trying to sell us on an Intel SRCS16 SATA raid controll= +er +> > > instead of the 3ware one. +> > > +> > > Poking around it seems this does come with Linux drivers and there is= + a +> > > battery backup option. So it doesn't seem to be completely insane. +> > > +> > > Anyone have any experience with these controllers? +> > > +> > > I'm also wondering about whether I'm better off with one of these SAT= +A +> > raid +> > > controllers or just going with SCSI drives. +> > > +> > > -- +> > > greg +> > > +> > > +> > > ---------------------------(end of broadcast)------------------------= +--- +> > > TIP 8: explain analyze is your friend +> > +> > ---------------------------(end of broadcast)--------------------------= +- +> > TIP 9: the planner will ignore your desire to choose an index scan if y= +our +> > joining column's datatypes do not match +> > +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 14:22:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0A99053860 + for ; + Thu, 14 Apr 2005 14:22:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23752-04 + for ; + Thu, 14 Apr 2005 17:22:21 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id BCD98535EF + for ; + Thu, 14 Apr 2005 14:22:20 -0300 (ADT) +Received: (qmail 31847 invoked from network); 14 Apr 2005 19:22:24 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 14 Apr 2005 19:22:24 +0200 +Date: Thu, 14 Apr 2005 19:22:19 +0200 +To: "Richard van den Berg" , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <425E6045.4060201@trust-factory.com> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/302 +X-Sequence-Number: 11699 + + +> I have a table A with an int column ID that references table B column +> ID. Table B has about 150k rows, and has an index on B.ID. When trying +> to copy 1 million rows into A, I get the following \timings: + + You're using 7.4.5. It's possible that you have a type mismatch in your +foreign keys which prevents use of the index on B. + First of all, be really sure it's THAT foreign key, ie. do your COPY with +only ONE foreign key at a time if you have several, and see which one is +the killer. + + Then, supposing it's the column in A which REFERENCE's B(id) : + + SELECT id FROM A LIMIT 1; + (check type) + + SELECT id FROM B LIMIT 1; + (check type) + + EXPLAIN ANALYZE the following : + + SELECT * FROM B WHERE id = (SELECT id FROM A LIMIT 1); + + It should use the index. Does it ? + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 14:45:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A6A4F54060 + for ; + Thu, 14 Apr 2005 14:41:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29839-07 + for ; + Thu, 14 Apr 2005 17:41:30 +0000 (GMT) +Received: from b.mail.sonic.net (b.mail.sonic.net [64.142.19.5]) + by svr1.postgresql.org (Postfix) with ESMTP id BB8B253F77 + for ; + Thu, 14 Apr 2005 14:41:28 -0300 (ADT) +Received: from cookie.varlena.com (64-142-36-103.dsl.static.sonic.net + [64.142.36.103]) + by b.mail.sonic.net (8.13.3/8.13.3) with ESMTP id j3EHfQAL008604; + Thu, 14 Apr 2005 10:41:26 -0700 +Received: by cookie.varlena.com (Postfix, from userid 1000) + id 93D98CCE; Thu, 14 Apr 2005 10:39:03 -0700 (PDT) +Date: Thu, 14 Apr 2005 10:39:03 -0700 +To: Simon Riggs +Cc: elein , pgsql-performance@postgresql.org +Subject: Re: [Fwd: Re: Functionscan estimates] +Message-ID: <20050414173903.GY5278@varlena.com> +Mail-Followup-To: Simon Riggs , + pgsql-performance@postgresql.org +References: <1113464198.16721.1725.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1113464198.16721.1725.camel@localhost.localdomain> +User-Agent: Mutt/1.5.6+20040907i +From: elein@varlena.com (elein) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.058 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/304 +X-Sequence-Number: 11701 + +I'm not subscribed to performance at this time. I reviewed the +thread and owe everything I know about this to Wei Hong whose +brilliance exceeds all others :) All misinterpretations are +mine alone. + +I have not reviewed hellerstein's papers posted by neil, but I +will. + +My understanding of this issue is at a very high user level. +In Illustra SRF functions were not necessarily special functions. +All functions could have a cost associated with them, set by the writer of +the function in order for the planner to reorder function calls. +The stonebraker airplane level example was: + select ... from ... where f(id) = 3 and expensive_image_function(img) +The idea, of course is to weight the expensive function so it was +pushed to the end of the execution. + +The only difference I see with SRFs in Postgres is that you may want +the cost represented as one row returned and another weighting representing +the number of estimated rows. I think this conclusion has already +been drawn. + +It seems to make sense, if the optimizer can use this information, to +include wild and/or educated guesses for the costs of the SRF. + +I'm sure I haven't contributed here anything new, but perhaps +phrased it differently. + +Copy me on replies and I'll participate as I can. + +--elein + +On Thu, Apr 14, 2005 at 08:36:38AM +0100, Simon Riggs wrote: +> Elein, +> +> Any chance you could join this discussion on PERFORM ? +> +> I understand you did time with Illustra. I thought they had solved the +> optimizer plug-in issue...how did they do it? +> +> Best Regards, Simon Riggs +> +> +> -------- Forwarded Message -------- +> From: Tom Lane +> To: Alvaro Herrera +> Cc: Josh Berkus , Michael Fuhr , +> +> Subject: Re: [PERFORM] Functionscan estimates +> Date: Sat, 09 Apr 2005 00:00:56 -0400 +> Not too many releases ago, there were several columns in pg_proc that +> were intended to support estimation of the runtime cost and number of +> result rows of set-returning functions. I believe in fact that these +> were the remains of Joe Hellerstein's thesis on expensive-function +> evaluation, and are exactly what he was talking about here: +> http://archives.postgresql.org/pgsql-hackers/2002-06/msg00085.php +> +> But with all due respect to Joe, I think the reason that stuff got +> trimmed is that it didn't work very well. In most cases it's +> *hard* to write an estimator for a SRF. Let's see you produce +> one for dblink() for instance ... +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 14:43:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CD17F53DA7 + for ; + Thu, 14 Apr 2005 14:43:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30470-08 + for ; + Thu, 14 Apr 2005 17:43:50 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id BFA335333E + for ; + Thu, 14 Apr 2005 14:43:48 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Intel SRCS16 SATA raid? +Date: Thu, 14 Apr 2005 12:43:45 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184AF@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Intel SRCS16 SATA raid? +Thread-Index: AcVBGAy6l/ol4U6lT8aA/FIOW0yuRAAAGMJA +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.071 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/303 +X-Sequence-Number: 11700 + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com] +> Sent: Thursday, April 14, 2005 12:14 PM +> To: Richard_D_Levine@raytheon.com +> Cc: Greg Stark; pgsql-performance@postgresql.org; +> pgsql-performance-owner@postgresql.org +> Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +>=20 +>=20 +> I have put together a little head to head performance of a 15k SCSI, +> 10k SCSI 10K SATA w/TCQ, 10K SATA wo/TCQ and 7.2K SATA drive +> comparison at storage review +>=20 +> http://www.storagereview.com/php/benchmark/compare_rtg_2001.ph +> = +p?typeID=3D10&testbedID=3D3&osID=3D4&raidconfigID=3D1&numDrives=3D1&devI +> = +D_0=3D232&devID_1=3D40&devID_2=3D259&devID_3=3D267&devID_4=3D261&devID_5 +> =3D248&devCnt=3D6 +>=20 +> It does illustrate some of the weaknesses of SATA drives, but all in +> all the Raptor drives put on a good show. +> [...] + +I think it's a little misleading that your tests show 0ms seek times +for some of the write tests. The environmental test also selects a +missing data point as the winner. Besides that, it seems to me that +seek time is one of the most important features for a DB server, which +means that the SCSI drives are the clear winners and the non-WD SATA +drives are the embarrassing losers. Transfer rate is import, but +perhaps less so because DBs tend to read/write small blocks rather +than large files. On the server suite, which seems to me to be the +most relevant for DBs, the Atlas 15k spanks the other drives by a +fairly large margin (especially the lesser SATA drives). When you=20 +ignore the "consumer app" benchmarks, I wouldn't be so confident in=20 +saying that the Raptors "put on a good show". + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Thu Apr 14 14:50:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CBE053DA7; + Thu, 14 Apr 2005 14:50:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33976-01; Thu, 14 Apr 2005 17:50:45 +0000 (GMT) +Received: from dfw-gate6.raytheon.com (dfw-gate6.raytheon.com + [199.46.199.237]) + by svr1.postgresql.org (Postfix) with ESMTP id 412D853CAB; + Thu, 14 Apr 2005 14:50:44 -0300 (ADT) +Received: from ds02c00.directory.ray.com (ds02c00.directory.ray.com + [147.25.138.118]) + by dfw-gate6.raytheon.com (8.12.10/8.12.10) with ESMTP id + j3EHoWoa010912; Thu, 14 Apr 2005 12:50:34 -0500 (CDT) +Received: from ds02c00 (localhost [127.0.0.1]) + by ds02c00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j3EHoVdJ021848; Thu, 14 Apr 2005 17:50:31 GMT +Received: from ds02c00.directory.ray.com with LMTP by ds02c00 + (2.0.6/sieved-2-0-build-559); Thu, 14 Apr 2005 17:50:30 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02c00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j3EHnpor021530 sender Richard_D_Levine@raytheon.com; + Thu, 14 Apr 2005 17:49:54 GMT +In-Reply-To: <33c6269f05041410135875d7c5@mail.gmail.com> +Subject: Re: Intel SRCS16 SATA raid? +To: Alex Turner +Cc: Greg Stark , pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Thu, 14 Apr 2005 12:49:17 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/14/2005 12:49:54 PM +MIME-Version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: base64 +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.621 tagged_above=0 required=5 tests=AWL, + MIME_BASE64_BLANKS, NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/305 +X-Sequence-Number: 11702 + +TmljZSByZXNlYXJjaCBBbGV4Lg0KDQpZb3VyIGRhdGEgc3Ryb25nbHkgc3VwcG9ydCB0aGUgaW5m +b3JtYXRpb24gaW4gdGhlIHBhcGVyLiAgWW91ciBTQ1NJIGRyaXZlcw0KYmxldyBhd2F5IHRoZSBv +dGhlcnMgaW4gYWxsIG9mIHRoZSBzZXJ2ZXIgYmVuY2htYXJrcy4gIFRoZXkncmUgb25seQ0KbWFy +Z2luYWxseSBiZXR0ZXIgaW4gZGVza3RvcCB1c2UuDQoNCkkgZG8gZmluZCBpdCBzb21ld2hhdCBh +bWF6aW5nIHRoYXQgYSAxNUsgU0NTSSAzMjAgZHJpdmUgaXNuJ3QgZ29pbmcgdG8gaGVscA0KbWUg +cGxheSBVbnJlYWwgVG91cm5hbWVudCBtdWNoIGZhc3Rlci4gIFRoYXQncyBva2F5LiAgSSBzdWNr +IGF0IGl0IGFueXdheS4NCk15IGtpZCBoYXMgbmV2ZXIgbG9zdCB0byBtZS4gIFNoZSBlbmpveXMg +c2VlaW5nIGRhZGR5IGFzIGEgYmxvb2R5IHNtZWFyIGFuZA0KYm91bmNpbmcgYm9keSBwYXJ0cyBh +bnl3YXkuICBJdCBwcm9tb3RlcyB0b2dldGhlcm5lc3MuDQoNCkhlcmUncyBhIHF1b3RlIGZyb20g +dGhlIHBhcGVyOg0KDQoiW1NDU0ldIGludGVyZmFjZXMgc3VwcG9ydCBtdWx0aXBsZSBpbml0aWF0 +b3JzIG9yIGhvc3RzLiBUaGUNCmRyaXZlIG11c3Qga2VlcCB0cmFjayBvZiBzZXBhcmF0ZSBzZXRz +IG9mIGluZm9ybWF0aW9uIGZvciBlYWNoDQpob3N0IHRvIHdoaWNoIGl0IGlzIGF0dGFjaGVkLCBl +LmcuLCBtYWludGFpbmluZyB0aGUgcHJvY2Vzc29yDQpwb2ludGVyIHNldHMgZm9yIG11bHRpcGxl +IGluaXRpYXRvcnMgYW5kIHRhZ2dlZCBjb21tYW5kcy4NClRoZSBjYXBhYmlsaXR5IG9mIFNDU0kv +RkMgdG8gZWZmaWNpZW50bHkgcHJvY2VzcyBjb21tYW5kcw0KYW5kIHRhc2tzIGluIHBhcmFsbGVs +IGhhcyBhbHNvIHJlc3VsdGVkIGluIGEgaGlnaGVyIG92ZXJoZWFkDQrigJxrZXJuZWzigJ0gc3Ry +dWN0dXJlIGZvciB0aGUgZmlybXdhcmUuIg0KDQpIYXMgYW55b25lIGV2ZXIgc2VlbiBhIHN5c3Rl +bSB3aXRoIG11bHRpcGxlIGhvc3RzIG9yIGluaXRpYXRvcnMgb24gYSBTQ1NJDQpidXM/ICBTZWVt +cyBsaWtlIGl0IHdvdWxkIGJlIGEgdmVyeSBjb29sIHRoaW5nIGluIGFuIFNNUCBhcmNoaXRlY3R1 +cmUsIGJ1dA0KSSd2ZSBub3Qgc2VlbiBhbiBleGFtcGxlIGltcGxlbWVudGVkLg0KDQpSaWNrDQoN +CkFsZXggVHVybmVyIDxhcm10dWtAZ21haWwuY29tPiB3cm90ZSBvbiAwNC8xNC8yMDA1IDEyOjEz +OjQxIFBNOg0KDQo+IEkgaGF2ZSBwdXQgdG9nZXRoZXIgYSBsaXR0bGUgaGVhZCB0byBoZWFkIHBl +cmZvcm1hbmNlIG9mIGEgMTVrIFNDU0ksDQo+IDEwayBTQ1NJIDEwSyBTQVRBIHcvVENRLCAxMEsg +U0FUQSB3by9UQ1EgYW5kIDcuMksgU0FUQSBkcml2ZQ0KPiBjb21wYXJpc29uIGF0IHN0b3JhZ2Ug +cmV2aWV3DQo+DQo+IGh0dHA6Ly93d3cuc3RvcmFnZXJldmlldy5jb20vcGhwL2JlbmNobWFyay9j +b21wYXJlX3J0Z18yMDAxLnBocD8NCj4NCnR5cGVJRD0xMCZ0ZXN0YmVkSUQ9MyZvc0lEPTQmcmFp +ZGNvbmZpZ0lEPTEmbnVtRHJpdmVzPTEmZGV2SURfMD0yMzImZGV2SURfMT00MCZkZXZJRF8yPTI1 +OSZkZXZJRF8zPTI2NyZkZXZJRF80PTI2MSZkZXZJRF81PTI0OCZkZXZDbnQ9Ng0KDQo+DQo+IEl0 +IGRvZXMgaWxsdXN0cmF0ZSBzb21lIG9mIHRoZSB3ZWFrbmVzc2VzIG9mIFNBVEEgZHJpdmVzLCBi +dXQgYWxsIGluDQo+IGFsbCB0aGUgUmFwdG9yIGRyaXZlcyBwdXQgb24gYSBnb29kIHNob3cuDQo+ +DQo+IEFsZXggVHVybmVyDQo+IG5ldEVjb25vbWlzdA0KPg0KPiBPbiA0LzE0LzA1LCBBbGV4IFR1 +cm5lciA8YXJtdHVrQGdtYWlsLmNvbT4gd3JvdGU6DQo+ID4gSSBoYXZlIHJlYWQgYSBsYXJnZSBj +aHVuayBvZiB0aGlzLCBhbmQgSSB3b3VsZCBoaWdobHkgcmVjb21tZW5kIGl0IHRvDQo+ID4gYW55 +b25lIHdobyBoYXMgYmVlbiBwYXJ0aWNpcGF0aW5nIGluIHRoZSBkcml2ZSBkaXNjdXNzaW9ucy4g +IEl0IGlzDQo+ID4gbW9zdCBpbmZvcm1hdGl2ZSEhDQo+ID4NCj4gPiBBbGV4IFR1cm5lcg0KPiA+ +IG5ldEVjb25vbWlzdA0KPiA+DQo+ID4gT24gNC8xNC8wNSwgUmljaGFyZF9EX0xldmluZUByYXl0 +aGVvbi5jb20NCj4gPFJpY2hhcmRfRF9MZXZpbmVAcmF5dGhlb24uY29tPiB3cm90ZToNCj4gPiA+ +IEdyZWcsDQo+ID4gPg0KPiA+ID4gSSBwb3N0ZWQgdGhpcyBsaW5rIHVuZGVyIGEgZGlmZmVyZW50 +IHRocmVhZCAodGhlICQ3ayBzZXJ2ZXINCj4gdGhyZWFkKS4gIEl0IGlzDQo+ID4gPiBhIHZlcnkg +Z29vZCByZWFkIG9uIHdoeSBTQ1NJIGlzIGJldHRlciBmb3Igc2VydmVycyB0aGFuIEFUQS4gIEkN +Cj4gZGlkbid0IG5vdGUNCj4gPiA+IGJpYXMsIHRob3VnaCBpdCBpcyBmcm9tIGEgZHJpdmUgbWFu +dWZhY3R1cmVyLiAgWU1NVi4gIFRoZXJlIGlzIGFuDQo+ID4gPiBpbnRlcmVzdGluZywgdGhvdWdo +IGRhdGVkIGFwcGVuZGl4IG9uIGRpZmZlcmVudCBtYW51ZmFjdHVyZXJzJyBkcml2ZQ0KPiA+ID4g +Y2hhcmFjdGVyaXN0aWNzLg0KPiA+ID4NCj4gPiA+IGh0dHA6Ly93d3cuc2VhZ2F0ZS4NCj4NCmNv +bS9jb250ZW50L2RvY3MvcGRmL3doaXRlcGFwZXIvRDJjX01vcmVfdGhhbl9JbnRlcmZhY2VfQVRB +X3ZzX1NDU0lfMDQyMDAzLnBkZg0KDQo+ID4gPg0KPiA+ID4gRW5qb3ksDQo+ID4gPg0KPiA+ID4g +Umljaw0KPiA+ID4NCj4gPiA+IHBnc3FsLXBlcmZvcm1hbmNlLW93bmVyQHBvc3RncmVzcWwub3Jn +IHdyb3RlIG9uIDA0LzE0LzIwMDUgMDk6NTQ6NDUNCkFNOg0KPiA+ID4NCj4gPiA+ID4NCj4gPiA+ +ID4gT3VyIHZlbmRvciBpcyB0cnlpbmcgdG8gc2VsbCB1cyBvbiBhbiBJbnRlbCBTUkNTMTYgU0FU +QSByYWlkDQpjb250cm9sbGVyDQo+ID4gPiA+IGluc3RlYWQgb2YgdGhlIDN3YXJlIG9uZS4NCj4g +PiA+ID4NCj4gPiA+ID4gUG9raW5nIGFyb3VuZCBpdCBzZWVtcyB0aGlzIGRvZXMgY29tZSB3aXRo +IExpbnV4IGRyaXZlcnMgYW5kIHRoZXJlDQppcyBhDQo+ID4gPiA+IGJhdHRlcnkgYmFja3VwIG9w +dGlvbi4gU28gaXQgZG9lc24ndCBzZWVtIHRvIGJlIGNvbXBsZXRlbHkgaW5zYW5lLg0KPiA+ID4g +Pg0KPiA+ID4gPiBBbnlvbmUgaGF2ZSBhbnkgZXhwZXJpZW5jZSB3aXRoIHRoZXNlIGNvbnRyb2xs +ZXJzPw0KPiA+ID4gPg0KPiA+ID4gPiBJJ20gYWxzbyB3b25kZXJpbmcgYWJvdXQgd2hldGhlciBJ +J20gYmV0dGVyIG9mZiB3aXRoIG9uZSBvZiB0aGVzZQ0KU0FUQQ0KPiA+ID4gcmFpZA0KPiA+ID4g +PiBjb250cm9sbGVycyBvciBqdXN0IGdvaW5nIHdpdGggU0NTSSBkcml2ZXMuDQo+ID4gPiA+DQo+ +ID4gPiA+IC0tDQo+ID4gPiA+IGdyZWcNCj4gPiA+ID4NCj4gPiA+ID4NCj4gPiA+ID4gLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBvZg0KYnJvYWRjYXN0KS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLQ0KPiA+ID4gPiBUSVAgODogZXhwbGFpbiBhbmFseXplIGlzIHlvdXIgZnJpZW5k +DQo+ID4gPg0KPiA+ID4gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBvZg0KYnJvYWRj +YXN0KS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KPiA+ID4gVElQIDk6IHRoZSBwbGFubmVy +IHdpbGwgaWdub3JlIHlvdXIgZGVzaXJlIHRvIGNob29zZSBhbiBpbmRleCBzY2FuIGlmDQp5b3Vy +DQo+ID4gPiAgICAgICBqb2luaW5nIGNvbHVtbidzIGRhdGF0eXBlcyBkbyBub3QgbWF0Y2gNCj4g +PiA+DQo+ID4= + + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 14:55:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EEAC354031 + for ; + Thu, 14 Apr 2005 14:55:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32817-08 + for ; + Thu, 14 Apr 2005 17:55:24 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 11A1D54036 + for ; + Thu, 14 Apr 2005 14:55:23 -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 1DM8YY-0008Jd-00; Thu, 14 Apr 2005 13:55:11 -0400 +To: +Cc: +Subject: Re: How to improve db performance with $7K? +References: <425e9283.0422c9db.394e.ffffb643@mx.gmail.com> +In-Reply-To: <425e9283.0422c9db.394e.ffffb643@mx.gmail.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Apr 2005 13:55:10 -0400 +Message-ID: <87is2pgs5d.fsf@stark.xeocode.com> +Lines: 25 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/306 +X-Sequence-Number: 11703 + +"Matthew Nuzum" writes: + +> drive A has capacity C and spins at 15K rpms, and +> drive B has capacity 2 x C and spins at 10K rpms and +> all other features are the same, the price is the same and C is enough +> disk space which would you choose? + +In this case you always choose the 15k RPM drive, at least for Postgres. +The 15kRPM reduces the latency which improves performance when fsyncing +transaction commits. + +The real question is whether you choose the single 15kRPM drive or additional +drives at 10kRPM... Additional spindles would give a much bigger bandwidth +improvement but questionable latency improvement. + +> Would the increased data density of the higher capacity drive be of +> greater benefit than the faster spindle speed of drive A? + +actually a 2xC capacity drive probably just has twice as many platters which +means it would perform identically to the C capacity drive. If it has denser +platters that might improve performance slightly. + + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:03:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B72F353DBB + for ; + Thu, 14 Apr 2005 15:03:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36917-06 + for ; + Thu, 14 Apr 2005 18:03:39 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 76DF653DC3 + for ; + Thu, 14 Apr 2005 15:03:38 -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 1DM8ge-0008KE-00; Thu, 14 Apr 2005 14:03:32 -0400 +To: Kevin Brown +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <33c6269f050406083533d2045d@mail.gmail.com> + + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> + <20050414055655.GB19518@filer> <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> +In-Reply-To: <20050414083608.GC19518@filer> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Apr 2005 14:03:31 -0400 +Message-ID: <87d5sxgrrg.fsf@stark.xeocode.com> +Lines: 48 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/307 +X-Sequence-Number: 11704 + +Kevin Brown writes: + +> Greg Stark wrote: +> +> +> > I think you're being misled by analyzing the write case. +> > +> > Consider the read case. When a user process requests a block and +> > that read makes its way down to the driver level, the driver can't +> > just put it aside and wait until it's convenient. It has to go ahead +> > and issue the read right away. +> +> Well, strictly speaking it doesn't *have* to. It could delay for a +> couple of milliseconds to see if other requests come in, and then +> issue the read if none do. If there are already other requests being +> fulfilled, then it'll schedule the request in question just like the +> rest. + +But then the cure is worse than the disease. You're basically describing +exactly what does happen anyways, only you're delaying more requests than +necessary. That intervening time isn't really idle, it's filled with all the +requests that were delayed during the previous large seek... + +> Once the first request has been fulfilled, the driver can now schedule +> the rest of the queued-up requests in disk-layout order. +> +> I really don't see how this is any different between a system that has +> tagged queueing to the disks and one that doesn't. The only +> difference is where the queueing happens. + +And *when* it happens. Instead of being able to issue requests while a large +seek is happening and having some of them satisfied they have to wait until +that seek is finished and get acted on during the next large seek. + +If my theory is correct then I would expect bandwidth to be essentially +equivalent but the latency on SATA drives to be increased by about 50% of the +average seek time. Ie, while a busy SCSI drive can satisfy most requests in +about 10ms a busy SATA drive would satisfy most requests in 15ms. (add to that +that 10k RPM and 15kRPM SCSI drives have even lower seek times and no such +IDE/SATA drives exist...) + +In reality higher latency feeds into a system feedback loop causing your +application to run slower causing bandwidth demands to be lower as well. It's +often hard to distinguish root causes from symptoms when optimizing complex +systems. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:11:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A0FFA5296B + for ; + Thu, 14 Apr 2005 15:11:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40241-04 + for ; + Thu, 14 Apr 2005 18:11:28 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 556E054059 + for ; + Thu, 14 Apr 2005 15:11:27 -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 1DM8o7-0008LE-00; Thu, 14 Apr 2005 14:11:16 -0400 +To: Markus Bertheau +Cc: pgsql-performance@postgresql.org +Subject: Re: recovery after long delete +References: <1113493643.7249.35.camel@localhost.localdomain> +In-Reply-To: <1113493643.7249.35.camel@localhost.localdomain> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Apr 2005 14:11:15 -0400 +Message-ID: <877jj5grek.fsf@stark.xeocode.com> +Lines: 23 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/308 +X-Sequence-Number: 11705 + + +Markus Bertheau writes: + +> How does oracle do that? Has all this something to do with mvcc? Why +> does it take oracle so long to recover? + +Postgres does "pessimistic MVCC" where it keeps the old versions where they +are in the table. Only after it's committed can they be cleaned up and reused. +So aborting is a noop but committing requires additional cleanup (which is put +off until vacuum runs). + +Oracle does "optimistic MVCC" where it assumes most transactions will commit +and most transactions will be reading mostly committed data. So it immediately +does all the cleanup for the commit. It stores the old version in separate +storage spaces called the rollback segment and redo logs. Committing is a noop +(almost, there are some details, search for "delayed block cleanout") whereas +rolling back requires copying back all that old data from the redo logs back +to the table. + +Engineering is all about tradeoffs. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:21:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C5D6952AA3 + for ; + Thu, 14 Apr 2005 15:21:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43888-01 + for ; + Thu, 14 Apr 2005 18:21:16 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 6DE2854042 + for ; + Thu, 14 Apr 2005 15:21:15 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Thu, 14 Apr 2005 13:21:13 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B0@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVBHVCgo/5CzZI5QA6XiNMFG/ICkQAADLcg +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.071 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/309 +X-Sequence-Number: 11706 + +> -----Original Message----- +> From: Greg Stark [mailto:gsstark@mit.edu] +> Sent: Thursday, April 14, 2005 12:55 PM +> To: matt@followers.net +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to improve db performance with $7K? +>=20 +> "Matthew Nuzum" writes: +>=20 +> > drive A has capacity C and spins at 15K rpms, and +> > drive B has capacity 2 x C and spins at 10K rpms and +> > all other features are the same, the price is the same and=20 +> > C is enough disk space which would you choose? +>=20 +> In this case you always choose the 15k RPM drive, at least=20 +> for Postgres. The 15kRPM reduces the latency which improves +> performance when fsyncing transaction commits. + +I think drive B is clearly the best choice. Matt said "all +other features are the same", including price. I take that to +mean that the seek time and throughput are also identical. +However, I think it's fairly clear that there is no such pair +of actual devices. If Matt really meant that they have the same +cache size, interface, etc, then I would agree with you. The +15k drive is likely to have the better seek time. + +> The real question is whether you choose the single 15kRPM=20 +> drive or additional drives at 10kRPM... Additional spindles +> would give a much bigger bandwidth improvement but questionable +> latency improvement. + +Under the assumption that the seek times and throughput are +realistic rather than contrived as in the stated example, I would +say the 15k drive is the likely winner. It probably has the +better seek time, and it seems that latency is more important +than bandwidth for DB apps. + +> > Would the increased data density of the higher capacity drive +> > be of greater benefit than the faster spindle speed of drive +> > A? +>=20 +> actually a 2xC capacity drive probably just has twice as many=20 +> platters which means it would perform identically to the C +> capacity drive. If it has denser platters that might improve +> performance slightly. + +Well, according to the paper referenced by Richard, twice as many +platters means that it probably has slightly worse seek time +(because of the increased mass of the actuator/rw-head). Yet +another reason why the smaller drive might be preferable. Of +course, the data density is certainly a factor, as you say. But +since the drives are within a factor of 2, it seems likely that +real drives would have comparable densities. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:32:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 64C8153A15 + for ; + Thu, 14 Apr 2005 15:32:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47605-07 + for ; + Thu, 14 Apr 2005 18:31:50 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A04E5398E + for ; + Thu, 14 Apr 2005 15:31:49 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3EIV5lQ023696 + for ; Thu, 14 Apr 2005 18:31:21 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3EIV4tH023689; + Thu, 14 Apr 2005 18:31:05 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Thu, 14 Apr 2005 18:30:29 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVBHMKoaPdkWPdOS8GXkxr+by9TgQAAYOig +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.177 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/313 +X-Sequence-Number: 11710 + +I've been doing some reading up on this, trying to keep up here,=20 +and have found out that (experts, just yawn and cover your ears) + +1) some SATA drives (just type II, I think?) have a "Phase Zero" + implementation of Tagged Command Queueing (the special sauce + for SCSI). +2) This SATA "TCQ" is called NCQ and I believe it basically + allows the disk software itself to do the reordering + (this is called "simple" in TCQ terminology) It does not + yet allow the TCQ "head of queue" command, allowing the + current tagged request to go to head of queue, which is + a simple way of manifesting a "high priority" request. + +3) SATA drives are not yet multi-initiator? + +Largely b/c of 2 and 3, multi-initiator SCSI RAID'ed drives +are likely to whomp SATA II drives for a while yet (read: a +year or two) in multiuser PostGres applications.=20 + + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Greg Stark +Sent: Thursday, April 14, 2005 2:04 PM +To: Kevin Brown +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +Kevin Brown writes: + +> Greg Stark wrote: +>=20 +>=20 +> > I think you're being misled by analyzing the write case. +> >=20 +> > Consider the read case. When a user process requests a block and=20 +> > that read makes its way down to the driver level, the driver can't=20 +> > just put it aside and wait until it's convenient. It has to go ahead = + +> > and issue the read right away. +>=20 +> Well, strictly speaking it doesn't *have* to. It could delay for a=20 +> couple of milliseconds to see if other requests come in, and then=20 +> issue the read if none do. If there are already other requests being=20 +> fulfilled, then it'll schedule the request in question just like the=20 +> rest. + +But then the cure is worse than the disease. You're basically describing = +exactly what does happen anyways, only you're delaying more requests = +than necessary. That intervening time isn't really idle, it's filled = +with all the requests that were delayed during the previous large = +seek... + +> Once the first request has been fulfilled, the driver can now schedule = + +> the rest of the queued-up requests in disk-layout order. +>=20 +> I really don't see how this is any different between a system that has = + +> tagged queueing to the disks and one that doesn't. The only=20 +> difference is where the queueing happens. + +And *when* it happens. Instead of being able to issue requests while a = +large seek is happening and having some of them satisfied they have to = +wait until that seek is finished and get acted on during the next large = +seek. + +If my theory is correct then I would expect bandwidth to be essentially = +equivalent but the latency on SATA drives to be increased by about 50% = +of the average seek time. Ie, while a busy SCSI drive can satisfy most = +requests in about 10ms a busy SATA drive would satisfy most requests in = +15ms. (add to that that 10k RPM and 15kRPM SCSI drives have even lower = +seek times and no such IDE/SATA drives exist...) + +In reality higher latency feeds into a system feedback loop causing your = +application to run slower causing bandwidth demands to be lower as well. = +It's often hard to distinguish root causes from symptoms when optimizing = +complex systems. + +--=20 +greg + + +---------------------------(end of broadcast)--------------------------- +TIP 7: don't forget to increase your free space map settings + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:42:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F3D8539C4 + for ; + Thu, 14 Apr 2005 15:42:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50568-08 + for ; + Thu, 14 Apr 2005 18:42:30 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 1F7D55379B + for ; + Thu, 14 Apr 2005 15:42:29 -0300 (ADT) +Received: (qmail 3107 invoked from network); 14 Apr 2005 20:42:32 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 14 Apr 2005 20:42:32 +0200 +To: "Greg Stark" , matt@followers.net +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: <425e9283.0422c9db.394e.ffffb643@mx.gmail.com> + <87is2pgs5d.fsf@stark.xeocode.com> +Message-ID: +Date: Thu, 14 Apr 2005 20:42:26 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <87is2pgs5d.fsf@stark.xeocode.com> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/314 +X-Sequence-Number: 11711 + + +> The real question is whether you choose the single 15kRPM drive or +> additional +> drives at 10kRPM... Additional spindles would give a much bigger + + And the bonus question. + Expensive fast drives as a RAID for everything, or for the same price +many more slower drives (even SATA) so you can put the transaction log, +tables, indexes all on separate physical drives ? Like put one very +frequently used table on its own disk ? + For the same amount of money which one would be more interesting ? + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:45:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5DB1053B3D + for ; + Thu, 14 Apr 2005 15:45:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52673-05 + for ; + Thu, 14 Apr 2005 18:45:05 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 843FC53B08 + for ; + Thu, 14 Apr 2005 15:45:04 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Thu, 14 Apr 2005 11:48:03 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Thu, 14 Apr 2005 11:48:02 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005041411480201691 + for ; + Thu, 14 Apr 2005 11:48:02 -0700 +X-ASG-Debug-ID: 1113504300-17788-9-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail1 (mail1.hq.corp [192.168.160.5]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 10B07200C9DB + for ; + Thu, 14 Apr 2005 11:45:00 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Thu, 14 Apr 2005 11:47:56 -0700 +Message-ID: <425EBA0C.6030804@sfnet.cc> +Date: Thu, 14 Apr 2005 11:44:28 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Mohan, Ross" +Cc: pgsql-performance@postgresql.org +X-ASG-Orig-Subj: Re: [PERFORM] How to improve db performance with $7K? +Subject: Re: How to improve db performance with $7K? +References: +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 14 Apr 2005 18:47:56.0146 (UTC) + FILETIME=[78CF1D20:01C54122] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.289 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5000] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.189 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/315 +X-Sequence-Number: 11712 + +If SATA drives don't have the ability to replace SCSI for a multi-user +Postgres apps, but you needed to save on cost (ALWAYS an issue), +could/would you implement SATA for your logs (pg_xlog) and keep the rest +on SCSI? + +Steve Poe + +Mohan, Ross wrote: + +>I've been doing some reading up on this, trying to keep up here, +>and have found out that (experts, just yawn and cover your ears) +> +>1) some SATA drives (just type II, I think?) have a "Phase Zero" +> implementation of Tagged Command Queueing (the special sauce +> for SCSI). +>2) This SATA "TCQ" is called NCQ and I believe it basically +> allows the disk software itself to do the reordering +> (this is called "simple" in TCQ terminology) It does not +> yet allow the TCQ "head of queue" command, allowing the +> current tagged request to go to head of queue, which is +> a simple way of manifesting a "high priority" request. +> +>3) SATA drives are not yet multi-initiator? +> +>Largely b/c of 2 and 3, multi-initiator SCSI RAID'ed drives +>are likely to whomp SATA II drives for a while yet (read: a +>year or two) in multiuser PostGres applications. +> +> +> +>-----Original Message----- +>From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Greg Stark +>Sent: Thursday, April 14, 2005 2:04 PM +>To: Kevin Brown +>Cc: pgsql-performance@postgresql.org +>Subject: Re: [PERFORM] How to improve db performance with $7K? +> +> +>Kevin Brown writes: +> +> +> +>>Greg Stark wrote: +>> +>> +>> +>> +>>>I think you're being misled by analyzing the write case. +>>> +>>>Consider the read case. When a user process requests a block and +>>>that read makes its way down to the driver level, the driver can't +>>>just put it aside and wait until it's convenient. It has to go ahead +>>>and issue the read right away. +>>> +>>> +>>Well, strictly speaking it doesn't *have* to. It could delay for a +>>couple of milliseconds to see if other requests come in, and then +>>issue the read if none do. If there are already other requests being +>>fulfilled, then it'll schedule the request in question just like the +>>rest. +>> +>> +> +>But then the cure is worse than the disease. You're basically describing exactly what does happen anyways, only you're delaying more requests than necessary. That intervening time isn't really idle, it's filled with all the requests that were delayed during the previous large seek... +> +> +> +>>Once the first request has been fulfilled, the driver can now schedule +>>the rest of the queued-up requests in disk-layout order. +>> +>>I really don't see how this is any different between a system that has +>>tagged queueing to the disks and one that doesn't. The only +>>difference is where the queueing happens. +>> +>> +> +>And *when* it happens. Instead of being able to issue requests while a large seek is happening and having some of them satisfied they have to wait until that seek is finished and get acted on during the next large seek. +> +>If my theory is correct then I would expect bandwidth to be essentially equivalent but the latency on SATA drives to be increased by about 50% of the average seek time. Ie, while a busy SCSI drive can satisfy most requests in about 10ms a busy SATA drive would satisfy most requests in 15ms. (add to that that 10k RPM and 15kRPM SCSI drives have even lower seek times and no such IDE/SATA drives exist...) +> +>In reality higher latency feeds into a system feedback loop causing your application to run slower causing bandwidth demands to be lower as well. It's often hard to distinguish root causes from symptoms when optimizing complex systems. +> +> +> + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:46:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C977F539C4 + for ; + Thu, 14 Apr 2005 15:46:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50218-10 + for ; + Thu, 14 Apr 2005 18:46:16 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 21B5D53B54 + for ; + Thu, 14 Apr 2005 15:46:15 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Thu, 14 Apr 2005 13:46:12 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B1@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVBHMKoaPdkWPdOS8GXkxr+by9TgQAAYOigAADJLDA= +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/316 +X-Sequence-Number: 11713 + +> -----Original Message----- +> From: Mohan, Ross [mailto:RMohan@arbinet.com] +> Sent: Thursday, April 14, 2005 1:30 PM +> To: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to improve db performance with $7K? +>=20 +> Greg Stark wrote: +> >=20 +> > Kevin Brown writes: +> >=20 +> > > Greg Stark wrote: +> > >=20 +> > > > I think you're being misled by analyzing the write case. +> > > >=20 +> > > > Consider the read case. When a user process requests a block +> > > > and that read makes its way down to the driver level, the=20 +> > > > driver can't just put it aside and wait until it's convenient. +> > > > It has to go ahead and issue the read right away. +> > >=20 +> > > Well, strictly speaking it doesn't *have* to. It could delay +> > > for a couple of milliseconds to see if other requests come in, +> > > and then issue the read if none do. If there are already other=20 +> > > requests being fulfilled, then it'll schedule the request in +> > > question just like the rest. +> > +> > But then the cure is worse than the disease. You're basically=20 +> > describing exactly what does happen anyways, only you're=20 +> > delaying more requests than necessary. That intervening time=20 +> > isn't really idle, it's filled with all the requests that=20 +> > were delayed during the previous large seek... +> > [...] +>=20 +> [...] +> 1) some SATA drives (just type II, I think?) have a "Phase Zero" +> implementation of Tagged Command Queueing (the special sauce +> for SCSI). +> [...] +> Largely b/c of 2 and 3, multi-initiator SCSI RAID'ed drives +> are likely to whomp SATA II drives for a while yet (read: a +> year or two) in multiuser PostGres applications.=20 + +I would say it depends on the OS. What Kevin is describing sounds +just like the Anticipatory I/O Scheduler in Linux 2.6: + +http://www.linuxjournal.com/article/6931 + +For certain application contexts, it looks like a big win. Not +entirely sure if Postgres is one of them, though. If SCSI beats +SATA, it sounds like it will be mostly due to better seek times. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Thu Apr 14 15:58:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B91F35360E + for ; + Thu, 14 Apr 2005 15:58:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35029-01 + for ; + Thu, 14 Apr 2005 18:58:18 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 891E5529D4 + for ; + Thu, 14 Apr 2005 15:58:16 -0300 (ADT) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j3EIw9gH018728; + Thu, 14 Apr 2005 14:58:09 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id 43C0952B65; Thu, 14 Apr 2005 14:58:09 -0400 (CLT) +Date: Thu, 14 Apr 2005 14:58:09 -0400 +From: Alvaro Herrera +To: Simon Riggs , + pgsql-performance@postgresql.org +Cc: elein +Subject: Re: [Fwd: Re: Functionscan estimates] +Message-ID: <20050414185809.GD28198@dcc.uchile.cl> +References: <1113464198.16721.1725.camel@localhost.localdomain> + <20050414173903.GY5278@varlena.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050414173903.GY5278@varlena.com> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.344 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/317 +X-Sequence-Number: 11714 + +On Thu, Apr 14, 2005 at 10:39:03AM -0700, elein wrote: + +> All functions could have a cost associated with them, set by the writer of +> the function in order for the planner to reorder function calls. +> The stonebraker airplane level example was: +> select ... from ... where f(id) = 3 and expensive_image_function(img) +> The idea, of course is to weight the expensive function so it was +> pushed to the end of the execution. + +So there was only a constant cost associated with the function? No +estimator function, for example? + +-- +Alvaro Herrera () +"If you have nothing to say, maybe you need just the right tool to help you +not say it." (New York Times, about Microsoft PowerPoint) + +From pgsql-performance-owner@postgresql.org Thu Apr 14 16:17:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E0CF53C8D + for ; + Thu, 14 Apr 2005 16:17:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40435-04 + for ; + Thu, 14 Apr 2005 19:17:03 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id A29445360E + for ; + Thu, 14 Apr 2005 16:17:03 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3EJC6ma009883; Thu, 14 Apr 2005 12:12:06 -0700 +Message-ID: <425EC1A7.1030702@commandprompt.com> +Date: Thu, 14 Apr 2005 12:16:55 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Steve Poe +Cc: "Mohan, Ross" , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> +In-Reply-To: <425EBA0C.6030804@sfnet.cc> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/318 +X-Sequence-Number: 11715 + +Steve Poe wrote: + +> If SATA drives don't have the ability to replace SCSI for a multi-user + +I don't think it is a matter of not having the ability. SATA all in all +is fine as long as +it is battery backed. It isn't as high performing as SCSI but who says +it has to be? + +There are plenty of companies running databases on SATA without issue. Would +I put it on a database that is expecting to have 500 connections at all +times? No. +Then again, if you have an application with that requirement, you have +the money +to buy a big fat SCSI array. + +Sincerely, + +Joshua D. Drake + + + +> Postgres apps, but you needed to save on cost (ALWAYS an issue), +> could/would you implement SATA for your logs (pg_xlog) and keep the +> rest on SCSI? +> +> Steve Poe +> +> Mohan, Ross wrote: +> +>> I've been doing some reading up on this, trying to keep up here, and +>> have found out that (experts, just yawn and cover your ears) +>> +>> 1) some SATA drives (just type II, I think?) have a "Phase Zero" +>> implementation of Tagged Command Queueing (the special sauce +>> for SCSI). +>> 2) This SATA "TCQ" is called NCQ and I believe it basically +>> allows the disk software itself to do the reordering +>> (this is called "simple" in TCQ terminology) It does not +>> yet allow the TCQ "head of queue" command, allowing the +>> current tagged request to go to head of queue, which is +>> a simple way of manifesting a "high priority" request. +>> +>> 3) SATA drives are not yet multi-initiator? +>> +>> Largely b/c of 2 and 3, multi-initiator SCSI RAID'ed drives +>> are likely to whomp SATA II drives for a while yet (read: a +>> year or two) in multiuser PostGres applications. +>> +>> +>> -----Original Message----- +>> From: pgsql-performance-owner@postgresql.org +>> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Greg Stark +>> Sent: Thursday, April 14, 2005 2:04 PM +>> To: Kevin Brown +>> Cc: pgsql-performance@postgresql.org +>> Subject: Re: [PERFORM] How to improve db performance with $7K? +>> +>> +>> Kevin Brown writes: +>> +>> +>> +>>> Greg Stark wrote: +>>> +>>> +>>> +>>> +>>>> I think you're being misled by analyzing the write case. +>>>> +>>>> Consider the read case. When a user process requests a block and +>>>> that read makes its way down to the driver level, the driver can't +>>>> just put it aside and wait until it's convenient. It has to go +>>>> ahead and issue the read right away. +>>>> +>>> +>>> Well, strictly speaking it doesn't *have* to. It could delay for a +>>> couple of milliseconds to see if other requests come in, and then +>>> issue the read if none do. If there are already other requests +>>> being fulfilled, then it'll schedule the request in question just +>>> like the rest. +>>> +>> +>> +>> But then the cure is worse than the disease. You're basically +>> describing exactly what does happen anyways, only you're delaying +>> more requests than necessary. That intervening time isn't really +>> idle, it's filled with all the requests that were delayed during the +>> previous large seek... +>> +>> +>> +>>> Once the first request has been fulfilled, the driver can now +>>> schedule the rest of the queued-up requests in disk-layout order. +>>> +>>> I really don't see how this is any different between a system that +>>> has tagged queueing to the disks and one that doesn't. The only +>>> difference is where the queueing happens. +>>> +>> +>> +>> And *when* it happens. Instead of being able to issue requests while +>> a large seek is happening and having some of them satisfied they have +>> to wait until that seek is finished and get acted on during the next +>> large seek. +>> +>> If my theory is correct then I would expect bandwidth to be +>> essentially equivalent but the latency on SATA drives to be increased +>> by about 50% of the average seek time. Ie, while a busy SCSI drive +>> can satisfy most requests in about 10ms a busy SATA drive would +>> satisfy most requests in 15ms. (add to that that 10k RPM and 15kRPM +>> SCSI drives have even lower seek times and no such IDE/SATA drives +>> exist...) +>> +>> In reality higher latency feeds into a system feedback loop causing +>> your application to run slower causing bandwidth demands to be lower +>> as well. It's often hard to distinguish root causes from symptoms +>> when optimizing complex systems. +>> +>> +>> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if +> your +> joining column's datatypes do not match + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 22:45:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7802F5365E + for ; + Thu, 14 Apr 2005 17:54:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29285-09 + for ; + Thu, 14 Apr 2005 20:54:13 +0000 (GMT) +Received: from a.mail.sonic.net (a.mail.sonic.net [64.142.16.245]) + by svr1.postgresql.org (Postfix) with ESMTP id 45AED53617 + for ; + Thu, 14 Apr 2005 17:54:12 -0300 (ADT) +Received: from cookie.varlena.com (64-142-36-103.dsl.static.sonic.net + [64.142.36.103]) + by a.mail.sonic.net (8.13.3/8.13.3) with ESMTP id j3EKs6aS032236; + Thu, 14 Apr 2005 13:54:07 -0700 +Received: by cookie.varlena.com (Postfix, from userid 1000) + id A7115CCE; Thu, 14 Apr 2005 13:51:43 -0700 (PDT) +Date: Thu, 14 Apr 2005 13:51:43 -0700 +To: Alvaro Herrera +Cc: Simon Riggs , + pgsql-performance@postgresql.org, elein +Subject: Re: [Fwd: Re: Functionscan estimates] +Message-ID: <20050414205143.GB5278@varlena.com> +Mail-Followup-To: Alvaro Herrera , + Simon Riggs , pgsql-performance@postgresql.org +References: <1113464198.16721.1725.camel@localhost.localdomain> + <20050414173903.GY5278@varlena.com> + <20050414185809.GD28198@dcc.uchile.cl> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050414185809.GD28198@dcc.uchile.cl> +User-Agent: Mutt/1.5.6+20040907i +From: elein@varlena.com (elein) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/443 +X-Sequence-Number: 11840 + +Hmmm. My brain is being jostled and I'm confusing illustra-postgres, +informix-postgres and postgresql. Some things had functions and +some things had constants and I do not remember which products had +what combination. But probably how they are in postgresql, post +hellerstein, is how I am remembering. + +I can find out for sure, given a little time, by querying old contacts. +It would be best if I had a clear question to ask, though. + +--elein + + +On Thu, Apr 14, 2005 at 02:58:09PM -0400, Alvaro Herrera wrote: +> On Thu, Apr 14, 2005 at 10:39:03AM -0700, elein wrote: +> +> > All functions could have a cost associated with them, set by the writer of +> > the function in order for the planner to reorder function calls. +> > The stonebraker airplane level example was: +> > select ... from ... where f(id) = 3 and expensive_image_function(img) +> > The idea, of course is to weight the expensive function so it was +> > pushed to the end of the execution. +> +> So there was only a constant cost associated with the function? No +> estimator function, for example? +> +> -- +> Alvaro Herrera () +> "If you have nothing to say, maybe you need just the right tool to help you +> not say it." (New York Times, about Microsoft PowerPoint) +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 19:01:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EC3B5538BE + for ; + Thu, 14 Apr 2005 19:01:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46583-07 + for ; + Thu, 14 Apr 2005 22:01:19 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 35C6A538AA + for ; + Thu, 14 Apr 2005 19:01:18 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEY004F9II7ZUDA@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 14 Apr 2005 17:01:20 -0500 (CDT) +Date: Thu, 14 Apr 2005 18:01:19 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: <000901c54110$79032aa0$797ba8c0@jfradkin> +To: "'Tom Lane'" , + "'Dawid Kuroczko'" +Cc: "'PERFORM'" +Message-id: <000001c5413d$7d9897d0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/319 +X-Sequence-Number: 11716 + +Well so far I have 1.5 hours with commandpromt.com and 8 + hours with = +Dell +and have not seen any changes in the speed of my query. + +I did move the data base to the raid 5 drives and did see a 1 second +improvement from 13 secs to 12 secs (keep in mind it runs in 6 on the +optiplex). + +The dell guy ran Bonie and found 40meg per sec read/write speed for the +arrays. + +He also installed version 8.0.2 (went fine on AS4 he had to uninstall = +8.0.1 +first). + +He is going to get a 6650 in his test lab to see what he can fugure out. +I will say both commandprompt.com and Dell have been very professional = +and I +am impressed at the level of support available for Redhat from Dell and +postgres. As always I still feel this list has been my most useful = +asset, +but I am glad there are folks to call on. I am trying to go live soon = +and +need to get this resolved. + +I told the guy from Dell it makes no sense that a windows 2.4 single = +proc +with 750 meg of ram can go faster then a 4 proc (3.ghz) 8 gig machine. +Both databases were restored from the same file. Same view etc. + +Config files are set the same except for amount of cached ram, although +Commandprompt.com had me adjust a few items that should help going into +production, put planning stuff is basicly the same. + +This view returns in 3 secs on MSSQL server on the optiplex (750 meg 2.4 +box); and 6 secs using postgres on windows and 12-13 secs on the 4 = +processor +box. Needless to say I am very frustrated. Maybe Dell will turn up = +something +testing in their lab. It took a bit of perseverance to get to the right = +guy +at Dell (the first guy actually told me to load it all on a like machine = +and +if it was very much slower on my original they would pursue it otherwise = +it +was not an issue. I was like the machine cost 30K you going to send me = +one +to test that. But seriously I am open to trying anything (loading AS3, = +using +postgres 7.4)? The fellow at Dell does not think it is a hardware = +problem, +so if it is Linux (could very well be, but he seemed very sharp and did = +not +come up with anything yet) or postgres config (again Josh at +commandprompt.com was very sharp) then what do I do now to isolate the +issue? At least they are loading one in the lab (in theory, I cant send = +them +my database, so who knows what they will test). Dell changed the file = +system +to ext2 is that going to bite me in the butt? It did not seem to change = +the +speed of my explain analyze. + +Joel Fradkin +=20 + +Dawid Kuroczko writes: +> Basically it tells postgres how many values should it keep for +> statistics per column. The config default_statistics_target +> is the default (=3D used when creating table) and ALTER... is +> a way to change it later. + +Not quite. default_statistics_target is the value used by ANALYZE for +any column that hasn't had an explicit ALTER SET STATISTICS done on it. +So you can change default_statistics_target and that will affect +existing tables. + +(It used to work the way you are saying, but that was a few releases +back...) + + regards, tom lane + + +---------------------------(end of broadcast)--------------------------- +TIP 3: if posting/reading through Usenet, please send an appropriate + subscribe-nomail command to majordomo@postgresql.org so that your + message can get through to the mailing list cleanly + + +From pgsql-performance-owner@postgresql.org Thu Apr 14 19:17:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4E9DC53BE5 + for ; + Thu, 14 Apr 2005 19:17:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52518-04 + for ; + Thu, 14 Apr 2005 22:17:24 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id E3D3253BAF + for ; + Thu, 14 Apr 2005 19:17:23 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: speed of querry? +Date: Thu, 14 Apr 2005 17:17:22 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B2@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] speed of querry? +Thread-Index: AcVBIDgXvJqF49X4TeCCsTwTjuUvLQAHpQkA +From: "Dave Held" +To: "PERFORM" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/320 +X-Sequence-Number: 11717 + +> -----Original Message----- +> From: Joel Fradkin [mailto:jfradkin@wazagua.com] +> Sent: Thursday, April 14, 2005 11:39 AM +> To: 'Tom Lane'; 'Dawid Kuroczko' +> Cc: 'PERFORM' +> Subject: Re: [PERFORM] speed of querry? +>=20 +>=20 +> I did as described to alter table and did not see any=20 +> difference in speed. I am trying to undo the symbolic +> link to the data array and set it up on raid 5 disks in +> the machine just to test if there is an issue with the +> config of the raid 10 array or a problem with the controller. +>=20 +> I am kinda lame at Linux so not sure I have got it yet still +> testing. Still kind puzzled why it chose tow different option, +> but one is running windows version of postgres, so maybe that +> has something to do with it. + +That sounds like a plausible explanation. However, it could +simply be that the statistics gathered on each box are +sufficiently different to cause different plans. + +> The data bases and configs (as far as page cost) are the same. + +Did you do as Dawid suggested? + +> [...] +> Then do a query couple of times (EXPLAIN ANALYZE also :)), then +> do: +> SET enable_seqscan =3D off; +> and rerun the query -- if it was significantly faster, you will +> want to do: +> SET enable_seqscan =3D on; +> and tweak: +> SET random_page_cost =3D 2.1; +> ...and play with values. When you reach the random_page_cost +> which suits your data, you will want to put it into +> postgresql.conf +> [...] + +This is above and beyond toying with the column statistics. You +are basically telling the planner to use an index. Try this, +and post the EXPLAIN ANALYZE for the seqscan =3D off case on the +slow box if it doesn't speed things up for you. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Thu Apr 14 19:44:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5BC4153B51 + for ; + Thu, 14 Apr 2005 19:43:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56609-08 + for ; + Thu, 14 Apr 2005 22:43:17 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id C88A45360A + for ; + Thu, 14 Apr 2005 19:43:16 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so627532wri + for ; + Thu, 14 Apr 2005 15:43:19 -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=EbBT0WSTTrBpOUquZL9Gi6+rELA49umY2m1fYwoFxGi9sKTN2VLoCmeduE46hejdiugbC2XCZnenomO2/VLe9Or0qHHEXxkZjg/KDOP3UnGPaWRGzF7zHSGx1vhgJUiCGTskTdOLPcCEQU8y2/ugdagZgaMcgFqZ80ddERhOqyw= +Received: by 10.54.38.70 with SMTP id l70mr477270wrl; + Thu, 14 Apr 2005 15:43:19 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 14 Apr 2005 15:43:18 -0700 (PDT) +Message-ID: <33c6269f05041415435ed69ca5@mail.gmail.com> +Date: Thu, 14 Apr 2005 18:43:18 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Dave Held +Subject: Re: Intel SRCS16 SATA raid? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184AF@asg002.asg.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184AF@asg002.asg.local> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.273 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/321 +X-Sequence-Number: 11718 + +Just to clarify these are tests from http://www.storagereview.com, not +my own. I guess they couldn't get number for those parts. I think +everyone understands that a 0ms seek time impossible, and indicates a +missing data point. + +Thanks, + +Alex Turner +netEconomist + +On 4/14/05, Dave Held wrote: +> > -----Original Message----- +> > From: Alex Turner [mailto:armtuk@gmail.com] +> > Sent: Thursday, April 14, 2005 12:14 PM +> > To: Richard_D_Levine@raytheon.com +> > Cc: Greg Stark; pgsql-performance@postgresql.org; +> > pgsql-performance-owner@postgresql.org +> > Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +> > +> > +> > I have put together a little head to head performance of a 15k SCSI, +> > 10k SCSI 10K SATA w/TCQ, 10K SATA wo/TCQ and 7.2K SATA drive +> > comparison at storage review +> > +> > http://www.storagereview.com/php/benchmark/compare_rtg_2001.ph +> > p?typeID=3D10&testbedID=3D3&osID=3D4&raidconfigID=3D1&numDrives=3D1&dev= +I +> > D_0=3D232&devID_1=3D40&devID_2=3D259&devID_3=3D267&devID_4=3D261&devID_= +5 +> > =3D248&devCnt=3D6 +> > +> > It does illustrate some of the weaknesses of SATA drives, but all in +> > all the Raptor drives put on a good show. +> > [...] +>=20 +> I think it's a little misleading that your tests show 0ms seek times +> for some of the write tests. The environmental test also selects a +> missing data point as the winner. Besides that, it seems to me that +> seek time is one of the most important features for a DB server, which +> means that the SCSI drives are the clear winners and the non-WD SATA +> drives are the embarrassing losers. Transfer rate is import, but +> perhaps less so because DBs tend to read/write small blocks rather +> than large files. On the server suite, which seems to me to be the +> most relevant for DBs, the Atlas 15k spanks the other drives by a +> fairly large margin (especially the lesser SATA drives). When you +> ignore the "consumer app" benchmarks, I wouldn't be so confident in +> saying that the Raptors "put on a good show". +>=20 +> __ +> David B. Held +> Software Engineer/Array Services Group +> 200 14th Ave. East, Sartell, MN 56377 +> 320.534.3637 320.253.7800 800.752.8129 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 20:03:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 386C053668 + for ; + Thu, 14 Apr 2005 20:03:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63080-06 + for ; + Thu, 14 Apr 2005 23:03:03 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 7EF9753CB8 + for ; + Thu, 14 Apr 2005 20:03:01 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3EN31D18018; + Thu, 14 Apr 2005 19:03:01 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504142303.j3EN31D18018@candle.pha.pa.us> +Subject: Re: 8.0.1 much slower than 7.4.2? +In-Reply-To: +To: anon permutation +Date: Thu, 14 Apr 2005 19:03:01 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/322 +X-Sequence-Number: 11719 + + +I would ask this on the jdbc mailling list. They might know. + +--------------------------------------------------------------------------- + +anon permutation wrote: +> +> Hi, +> +> I have just upgraded our db from 7.4.2 to 8.0.1 and we are doing some +> testing. For some reason, we have discovered that our application performs +> much slower on 8.0.1. +> +> My initial reaction was to turn on log_min_duration_statement to see what's +> happening. However, log_min_duration_statement does not work for JDBC +> clients in 8.0.1. +> +> As a result, I modified log_statement to all. Without my application doing +> anything, I see statements below being executed non-stop. Who is triggering +> these statemetns? Is this normal? What am I doing wrong? +> +> I am using Fedora Core 1 - Kernel: 2.4.22-1.2174.nptl +> +> Please help. Thanks. +> +> +> +> +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT attnotnull FROM +> pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2 +> 2005-04-04 18:05:00 CST PARSELOG: statement: SELECT def.adsrc FROM +> pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid +> ) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND +> a.attnum = def.adnum) WHERE c.oid = $1 and a.attnum = $2 AND def.adsrc L +> IKE '%nextval(%' +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Thu Apr 14 20:15:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3139D53FB2 + for ; + Thu, 14 Apr 2005 20:15:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67184-04 + for ; + Thu, 14 Apr 2005 23:15:22 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) + by svr1.postgresql.org (Postfix) with ESMTP id B7B075360F + for ; + Thu, 14 Apr 2005 20:15:20 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so633530wri + for ; + Thu, 14 Apr 2005 16:15:24 -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=PRpSSsUrgQL8+NOTxlAj/BPWp6AluU8AJAcX2P2IGpzLDsZLSLuK9PYIJBAZXsVM/8c+J+Wj4+0OxsWqRO/B8/+TBM8LyE4A363Fv48LsdmN8BK2bvJNfdmLMduTgZfVYJ66q3t5CqEAFWB6Fhbr5jEzPIQjmND2u66qj1eIWGc= +Received: by 10.54.79.17 with SMTP id c17mr461940wrb; + Thu, 14 Apr 2005 16:15:24 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 14 Apr 2005 16:15:24 -0700 (PDT) +Message-ID: <33c6269f05041416155522cad8@mail.gmail.com> +Date: Thu, 14 Apr 2005 19:15:24 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Dave Held +Subject: Re: Intel SRCS16 SATA raid? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184AF@asg002.asg.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184AF@asg002.asg.local> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.273 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/323 +X-Sequence-Number: 11720 + +Looking at the numbers, the raptor with TCQ enabled was close or beat +the Atlas III 10k drive on most benchmarks. + +Naturaly a 15k drive is going to be faster in many areas, but it is +also much more expensive. It was only 44% better on the server tests +than the raptor with TCQ, but it costs nearly 300% more ($538 cdw.com, +$180 newegg.com). Note also that the 15k drive was the only drive +that kept up with the raptor on raw transfer speed, which is going to +matter for WAL. + +For those of us on a budget, a quality controller card with lots of +RAM is going to be our biggest friend because it can cache writes, and +improve performance. The 3ware controllers seem to be universally +benchmarked as the best SATA RAID 10 controllers where database +performance is concerned. Even the crappy tweakers.net review had the +3ware as the fastest controller for a MySQL data partition in RAID 10. + +The Raptor drives can be had for as little as $180/ea, which is quite +a good price point considering they can keep up with their SCSI 10k +RPM counterparts on almost all tests with NCQ enabled (Note that 3ware +controllers _don't_ support NCQ, although they claim their HBA based +queueing is 95% as good as NCQ on the drive). + +Alex Turner +netEconomist + +On 4/14/05, Dave Held wrote: +> > -----Original Message----- +> > From: Alex Turner [mailto:armtuk@gmail.com] +> > Sent: Thursday, April 14, 2005 12:14 PM +> > To: Richard_D_Levine@raytheon.com +> > Cc: Greg Stark; pgsql-performance@postgresql.org; +> > pgsql-performance-owner@postgresql.org +> > Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +> > +> > +> > I have put together a little head to head performance of a 15k SCSI, +> > 10k SCSI 10K SATA w/TCQ, 10K SATA wo/TCQ and 7.2K SATA drive +> > comparison at storage review +> > +> > http://www.storagereview.com/php/benchmark/compare_rtg_2001.ph +> > p?typeID=3D10&testbedID=3D3&osID=3D4&raidconfigID=3D1&numDrives=3D1&dev= +I +> > D_0=3D232&devID_1=3D40&devID_2=3D259&devID_3=3D267&devID_4=3D261&devID_= +5 +> > =3D248&devCnt=3D6 +> > +> > It does illustrate some of the weaknesses of SATA drives, but all in +> > all the Raptor drives put on a good show. +> > [...] +>=20 +> I think it's a little misleading that your tests show 0ms seek times +> for some of the write tests. The environmental test also selects a +> missing data point as the winner. Besides that, it seems to me that +> seek time is one of the most important features for a DB server, which +> means that the SCSI drives are the clear winners and the non-WD SATA +> drives are the embarrassing losers. Transfer rate is import, but +> perhaps less so because DBs tend to read/write small blocks rather +> than large files. On the server suite, which seems to me to be the +> most relevant for DBs, the Atlas 15k spanks the other drives by a +> fairly large margin (especially the lesser SATA drives). When you +> ignore the "consumer app" benchmarks, I wouldn't be so confident in +> saying that the Raptors "put on a good show". +>=20 +> __ +> David B. Held +> Software Engineer/Array Services Group +> 200 14th Ave. East, Sartell, MN 56377 +> 320.534.3637 320.253.7800 800.752.8129 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 22:38:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 174AA53A73 + for ; + Thu, 14 Apr 2005 22:38:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06383-02 + for ; + Fri, 15 Apr 2005 01:38:15 +0000 (GMT) +Received: from 3times25.net (66-23-211-34.clients.speedfactory.net + [66.23.211.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 50A6053317 + for ; + Thu, 14 Apr 2005 22:38:14 -0300 (ADT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP id 508B1743B1 + for ; + Thu, 14 Apr 2005 21:38:15 -0400 (EDT) +Message-ID: <425F1B06.902@3times25.net> +Date: Thu, 14 Apr 2005 21:38:14 -0400 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.6) Gecko/20050322 Red Hat/1.7.6-1.4.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Intel SRCS16 SATA raid? +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184AF@asg002.asg.local> + <33c6269f05041416155522cad8@mail.gmail.com> +In-Reply-To: <33c6269f05041416155522cad8@mail.gmail.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/324 +X-Sequence-Number: 11721 + +Alex Turner wrote: +> Looking at the numbers, the raptor with TCQ enabled was close or beat +> the Atlas III 10k drive on most benchmarks. +> +> Naturaly a 15k drive is going to be faster in many areas, but it is +> also much more expensive. It was only 44% better on the server tests +> than the raptor with TCQ, but it costs nearly 300% more ($538 cdw.com, +> $180 newegg.com). + +True, but that's a one time expense (300%) for a 44% gain ALL the time. + '44% better' is nothing to sneeze at. I'd easily pay the price for +the gain in a large server env. + +-- +Until later, Geoffrey + +From pgsql-performance-owner@postgresql.org Thu Apr 14 23:03:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AB82353FA5 + for ; + Thu, 14 Apr 2005 23:03:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13533-10 + for ; + Fri, 15 Apr 2005 02:03:35 +0000 (GMT) +Received: from rwcrmhc14.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) + by svr1.postgresql.org (Postfix) with ESMTP id 5DB3553B54 + for ; + Thu, 14 Apr 2005 23:03:34 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc14) with ESMTP + id <2005041502033801400hhrnee>; Fri, 15 Apr 2005 02:03:38 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Thu, 14 Apr 2005 19:03:37 -0700 + id 0004B01B.425F20F9.00005303 +Date: Thu, 14 Apr 2005 19:03:37 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050415020337.GD19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <446.1113489854@sss.pgh.pa.us> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/325 +X-Sequence-Number: 11722 + +Tom Lane wrote: +> Kevin Brown writes: +> > I really don't see how this is any different between a system that has +> > tagged queueing to the disks and one that doesn't. The only +> > difference is where the queueing happens. In the case of SCSI, the +> > queueing happens on the disks (or at least on the controller). In the +> > case of SATA, the queueing happens in the kernel. +> +> That's basically what it comes down to: SCSI lets the disk drive itself +> do the low-level I/O scheduling whereas the ATA spec prevents the drive +> from doing so (unless it cheats, ie, caches writes). Also, in SCSI it's +> possible for the drive to rearrange reads as well as writes --- which +> AFAICS is just not possible in ATA. (Maybe in the newest spec...) +> +> The reason this is so much more of a win than it was when ATA was +> designed is that in modern drives the kernel has very little clue about +> the physical geometry of the disk. Variable-size tracks, bad-block +> sparing, and stuff like that make for a very hard-to-predict mapping +> from linear sector addresses to actual disk locations. + +Yeah, but it's not clear to me, at least, that this is a first-order +consideration. A second-order consideration, sure, I'll grant that. + +What I mean is that when it comes to scheduling disk activity, +knowledge of the specific physical geometry of the disk isn't really +important. What's important is whether or not the disk conforms to a +certain set of expectations. Namely, that the general organization is +such that addressing the blocks in block number order guarantees +maximum throughput. + +Now, bad block remapping destroys that guarantee, but unless you've +got a LOT of bad blocks, it shouldn't destroy your performance, right? + +> Combine that with the fact that the drive controller can be much +> smarter than it was twenty years ago, and you can see that the case +> for doing I/O scheduling in the kernel and not in the drive is +> pretty weak. + +Well, I certainly grant that allowing the controller to do the I/O +scheduling is faster than having the kernel do it, as long as it can +handle insertion of new requests into the list while it's in the +middle of executing a request. The most obvious case is when the head +is in motion and the new request can be satisfied by reading from the +media between where the head is at the time of the new request and +where the head is being moved to. + +My argument is that a sufficiently smart kernel scheduler *should* +yield performance results that are reasonably close to what you can +get with that feature. Perhaps not quite as good, but reasonably +close. It shouldn't be an orders-of-magnitude type difference. + + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Thu Apr 14 23:24:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C1BA953FA8 + for ; + Thu, 14 Apr 2005 23:24:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18469-09 + for ; + Fri, 15 Apr 2005 02:24:24 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 893D153CFF + for ; + Thu, 14 Apr 2005 23:24:22 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so665098wri + for ; + Thu, 14 Apr 2005 19:24:22 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=rdjTUvnSwE/V3sL2U88ZYILcULUAd6fY0nT7oE4acrgejMr2snPvYmVPRmagpTUEmQ+5h05jmhe9Vq7qC0ljpqt1sunadHJcw+NvmXzrz0e0+ZuoHzNNAnEkgmIpPChrL9CdsWQt8HN0VXvatYUPdLbVfZEOmA4jkmFrxvAzsq4= +Received: by 10.54.7.48 with SMTP id 48mr1409701wrg; + Thu, 14 Apr 2005 19:24:22 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 14 Apr 2005 19:24:22 -0700 (PDT) +Message-ID: <33c6269f050414192472a58cf6@mail.gmail.com> +Date: Thu, 14 Apr 2005 22:24:22 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Kevin Brown , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-Reply-To: <20050415020337.GD19518@filer> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> + <20050414055655.GB19518@filer> <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.274 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/326 +X-Sequence-Number: 11723 + +3ware claim that their 'software' implemented command queueing +performs at 95% effectiveness compared to the hardware queueing on a +SCSI drive, so I would say that they agree with you. + +I'm still learning, but as I read it, the bits are split across the +platters and there is only 'one' head, but happens to be reading from +multiple platters. The 'further' in linear distance the data is from +the current position, the longer it's going to take to get there.=20 +This seems to be true based on a document that was circulated. A hard +drive takes considerable amount of time to 'find' a track on the +platter compared to the rotational speed, which would agree with the +fact that you can read 70MB/sec, but it takes up to 13ms to seek. + +the ATA protocol is just how the HBA communicates with the drive, +there is no reason why the HBA can't reschedule reads and writes just +the like SCSI drive would do natively, and this is what infact 3ware +claims. I get the feeling based on my own historical experience that +generaly drives don't just have a bunch of bad blocks. This all leads +me to believe that you can predict with pretty good accuracy how +expensive it is to retrieve a given block knowing it's linear +increment. + +Alex Turner +netEconomist + +On 4/14/05, Kevin Brown wrote: +> Tom Lane wrote: +> > Kevin Brown writes: +> > > I really don't see how this is any different between a system that ha= +s +> > > tagged queueing to the disks and one that doesn't. The only +> > > difference is where the queueing happens. In the case of SCSI, the +> > > queueing happens on the disks (or at least on the controller). In th= +e +> > > case of SATA, the queueing happens in the kernel. +> > +> > That's basically what it comes down to: SCSI lets the disk drive itself +> > do the low-level I/O scheduling whereas the ATA spec prevents the drive +> > from doing so (unless it cheats, ie, caches writes). Also, in SCSI it'= +s +> > possible for the drive to rearrange reads as well as writes --- which +> > AFAICS is just not possible in ATA. (Maybe in the newest spec...) +> > +> > The reason this is so much more of a win than it was when ATA was +> > designed is that in modern drives the kernel has very little clue about +> > the physical geometry of the disk. Variable-size tracks, bad-block +> > sparing, and stuff like that make for a very hard-to-predict mapping +> > from linear sector addresses to actual disk locations. +>=20 +> Yeah, but it's not clear to me, at least, that this is a first-order +> consideration. A second-order consideration, sure, I'll grant that. +>=20 +> What I mean is that when it comes to scheduling disk activity, +> knowledge of the specific physical geometry of the disk isn't really +> important. What's important is whether or not the disk conforms to a +> certain set of expectations. Namely, that the general organization is +> such that addressing the blocks in block number order guarantees +> maximum throughput. +>=20 +> Now, bad block remapping destroys that guarantee, but unless you've +> got a LOT of bad blocks, it shouldn't destroy your performance, right? +>=20 +> > Combine that with the fact that the drive controller can be much +> > smarter than it was twenty years ago, and you can see that the case +> > for doing I/O scheduling in the kernel and not in the drive is +> > pretty weak. +>=20 +> Well, I certainly grant that allowing the controller to do the I/O +> scheduling is faster than having the kernel do it, as long as it can +> handle insertion of new requests into the list while it's in the +> middle of executing a request. The most obvious case is when the head +> is in motion and the new request can be satisfied by reading from the +> media between where the head is at the time of the new request and +> where the head is being moved to. +>=20 +> My argument is that a sufficiently smart kernel scheduler *should* +> yield performance results that are reasonably close to what you can +> get with that feature. Perhaps not quite as good, but reasonably +> close. It shouldn't be an orders-of-magnitude type difference. +>=20 +> -- +> Kevin Brown kevin@sysexperts.co= +m +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Thu Apr 14 23:42:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 33A6F53FB6 + for ; + Thu, 14 Apr 2005 23:42:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21984-08 + for ; + Fri, 15 Apr 2005 02:41:53 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EED8553C9A + for ; + Thu, 14 Apr 2005 23:41:51 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3F2fu65028524; + Thu, 14 Apr 2005 22:41:56 -0400 (EDT) +To: Kevin Brown +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-reply-to: <20050415020337.GD19518@filer> +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> +Comments: In-reply-to Kevin Brown + message dated "Thu, 14 Apr 2005 19:03:37 -0700" +Date: Thu, 14 Apr 2005 22:41:56 -0400 +Message-ID: <28523.1113532916@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/327 +X-Sequence-Number: 11724 + +Kevin Brown writes: +> Tom Lane wrote: +>> The reason this is so much more of a win than it was when ATA was +>> designed is that in modern drives the kernel has very little clue about +>> the physical geometry of the disk. Variable-size tracks, bad-block +>> sparing, and stuff like that make for a very hard-to-predict mapping +>> from linear sector addresses to actual disk locations. + +> What I mean is that when it comes to scheduling disk activity, +> knowledge of the specific physical geometry of the disk isn't really +> important. + +Oh? + +Yes, you can probably assume that blocks with far-apart numbers are +going to require a big seek, and you might even be right in supposing +that a block with an intermediate number should be read on the way. +But you have no hope at all of making the right decisions at a more +local level --- say, reading various sectors within the same cylinder +in an optimal fashion. You don't know where the track boundaries are, +so you can't schedule in a way that minimizes rotational latency. +You're best off to throw all the requests at the drive together and +let the drive sort it out. + +This is not to say that there's not a place for a kernel-side scheduler +too. The drive will probably have a fairly limited number of slots in +its command queue. The optimal thing is for those slots to be filled +with requests that are in the same area of the disk. So you can still +get some mileage out of an elevator algorithm that works on logical +block numbers to give the drive requests for nearby block numbers at the +same time. But there's also a lot of use in letting the drive do its +own low-level scheduling. + +> My argument is that a sufficiently smart kernel scheduler *should* +> yield performance results that are reasonably close to what you can +> get with that feature. Perhaps not quite as good, but reasonably +> close. It shouldn't be an orders-of-magnitude type difference. + +That might be the case with respect to decisions about long seeks, +but not with respect to rotational latency. The kernel simply hasn't +got the information. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 15 02:03:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7286F53BA7 + for ; + Fri, 15 Apr 2005 02:03:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57981-08 + for ; + Fri, 15 Apr 2005 05:03:43 +0000 (GMT) +Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) + by svr1.postgresql.org (Postfix) with ESMTP id 5400E53BE5 + for ; + Fri, 15 Apr 2005 02:03:42 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc12) with ESMTP + id <2005041505033701400h7eqqe>; Fri, 15 Apr 2005 05:03:38 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Thu, 14 Apr 2005 22:03:36 -0700 + id 001490ED.425F4B28.00005F0B +Date: Thu, 14 Apr 2005 22:03:36 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050415050336.GE19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> <28523.1113532916@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <28523.1113532916@sss.pgh.pa.us> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/328 +X-Sequence-Number: 11725 + +Tom Lane wrote: +> Kevin Brown writes: +> > Tom Lane wrote: +> >> The reason this is so much more of a win than it was when ATA was +> >> designed is that in modern drives the kernel has very little clue about +> >> the physical geometry of the disk. Variable-size tracks, bad-block +> >> sparing, and stuff like that make for a very hard-to-predict mapping +> >> from linear sector addresses to actual disk locations. +> +> > What I mean is that when it comes to scheduling disk activity, +> > knowledge of the specific physical geometry of the disk isn't really +> > important. +> +> Oh? +> +> Yes, you can probably assume that blocks with far-apart numbers are +> going to require a big seek, and you might even be right in supposing +> that a block with an intermediate number should be read on the way. +> But you have no hope at all of making the right decisions at a more +> local level --- say, reading various sectors within the same cylinder +> in an optimal fashion. You don't know where the track boundaries are, +> so you can't schedule in a way that minimizes rotational latency. + +This is true, but has to be examined in the context of the workload. + +If the workload is a sequential read, for instance, then the question +becomes whether or not giving the controller a set of sequential +blocks (in block ID order) will get you maximum read throughput. +Given that the manufacturers all attempt to generate the biggest read +throughput numbers, I think it's reasonable to assume that (a) the +sectors are ordered within a cylinder such that reading block x + 1 +immediately after block x will incur the smallest possible amount of +delay if requested quickly enough, and (b) the same holds true when +block x + 1 is on the next cylinder. + +In the case of pure random reads, you'll end up having to wait an +average of half of a rotation before beginning the read. Where SCSI +buys you something here is when you have sequential chunks of reads +that are randomly distributed. The SCSI drive can determine which +block in the set to start with first. But for that to really be a big +win, the chunks themselves would have to span more than half a track +at least, else you'd have a greater than half a track gap in the +middle of your two sorted sector lists for that track (a really +well-engineered SCSI disk could take advantage of the fact that there +are multiple platters and fill the "gap" with reads from a different +platter). + + +Admittedly, this can be quite a big win. With an average rotational +latency of 4 milliseconds on a 7200 RPM disk, being able to begin the +read at the earliest possible moment will shave at most 25% off the +total average random-access latency, if the average seek time is 12 +milliseconds. + +> That might be the case with respect to decisions about long seeks, +> but not with respect to rotational latency. The kernel simply hasn't +> got the information. + +True, but that should reduce the total latency by something like 17% +(on average). Not trivial, to be sure, but not an order of magnitude, +either. + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Fri Apr 15 02:29:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6689253B57 + for ; + Fri, 15 Apr 2005 02:29:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65555-02 + for ; + Fri, 15 Apr 2005 05:28:56 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B947353AA6 + for ; + Fri, 15 Apr 2005 02:28:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3F5Ss4K029786; + Fri, 15 Apr 2005 01:28:54 -0400 (EDT) +To: Kevin Brown +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-reply-to: <20050415050336.GE19518@filer> +References: <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> <28523.1113532916@sss.pgh.pa.us> + <20050415050336.GE19518@filer> +Comments: In-reply-to Kevin Brown + message dated "Thu, 14 Apr 2005 22:03:36 -0700" +Date: Fri, 15 Apr 2005 01:28:54 -0400 +Message-ID: <29785.1113542934@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/329 +X-Sequence-Number: 11726 + +Kevin Brown writes: +> In the case of pure random reads, you'll end up having to wait an +> average of half of a rotation before beginning the read. + +You're assuming the conclusion. The above is true if the disk is handed +one request at a time by a kernel that doesn't have any low-level timing +information. If there are multiple random requests on the same track, +the drive has an opportunity to do better than that --- if it's got all +the requests in hand. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 15 05:14:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DA06F53B8A + for ; + Fri, 15 Apr 2005 05:14:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12096-01 + for ; + Fri, 15 Apr 2005 08:14:40 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D81E539B5 + for ; + Fri, 15 Apr 2005 05:14:39 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 3248619B3BF; Fri, 15 Apr 2005 10:14:34 +0200 (CEST) +Message-ID: <425F77E4.7030504@trust-factory.com> +Date: Fri, 15 Apr 2005 10:14:28 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: PFC +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> +In-Reply-To: +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/330 +X-Sequence-Number: 11727 + +PFC wrote: +> You're using 7.4.5. It's possible that you have a type mismatch in +> your foreign keys which prevents use of the index on B. + +I read about this pothole and made damn sure the types match. (Actually, +I kinda hoped that was the problem, it would have been an easy fix.) + +> First of all, be really sure it's THAT foreign key, ie. do your COPY +> with only ONE foreign key at a time if you have several, and see which +> one is the killer. + +I took exactly this route, and the first FK I tried already hit the +jackpot. The real table had 4 FKs. + +> EXPLAIN ANALYZE the following : +> +> SELECT * FROM B WHERE id = (SELECT id FROM A LIMIT 1); +> +> It should use the index. Does it ? + +It sure looks like it: + +Index Scan using ix_B on B (cost=0.04..3.06 rows=1 width=329) (actual +time=93.824..93.826 rows=1 loops=1) + Index Cond: (id = $0) + InitPlan + -> Limit (cost=0.00..0.04 rows=1 width=4) (actual +time=15.128..15.129 rows=1 loops=1) + -> Seq Scan on A (cost=0.00..47569.70 rows=1135570 +width=4) (actual time=15.121..15.121 rows=1 loops=1) + Total runtime: 94.109 ms + +The real problem seems to be what Chris and Stephen pointed out: even +though the FK check is deferred, it is done on a per-row bases. With 1M +rows, this just takes forever. + +Thanks for the help. + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 15 07:07:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A148D5354D + for ; + Fri, 15 Apr 2005 07:07:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42807-07 + for ; + Fri, 15 Apr 2005 10:07:46 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id B729453FBE + for ; + Fri, 15 Apr 2005 07:07:44 -0300 (ADT) +Received: (qmail 24079 invoked from network); 15 Apr 2005 12:07:48 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 15 Apr 2005 12:07:48 +0200 +To: "Kevin Brown" , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> +Message-ID: +Date: Fri, 15 Apr 2005 12:07:43 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <33c6269f050406151241b01148@mail.gmail.com> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/331 +X-Sequence-Number: 11728 + + + +> My argument is that a sufficiently smart kernel scheduler *should* +> yield performance results that are reasonably close to what you can +> get with that feature. Perhaps not quite as good, but reasonably +> close. It shouldn't be an orders-of-magnitude type difference. + + And a controller card (or drive) has a lot less RAM to use as a cache / +queue for reordering stuff than the OS has, potentially the OS can us most +of the available RAM, which can be gigabytes on a big server, whereas in +the drive there are at most a few tens of megabytes... + + However all this is a bit looking at the problem through the wrong end. +The OS should provide a multi-read call for the applications to pass a +list of blocks they'll need, then reorder them and read them the fastest +possible way, clustering them with similar requests from other threads. + + Right now when a thread/process issues a read() it will block until the +block is delivered to this thread. The OS does not know if this thread +will then need the next block (which can be had very cheaply if you know +ahead of time you'll need it) or not. Thus it must make guesses, read +ahead (sometimes), etc... + +From pgsql-performance-owner@postgresql.org Fri Apr 15 07:14:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DF43539D7 + for ; + Fri, 15 Apr 2005 07:14:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45958-05 + for ; + Fri, 15 Apr 2005 10:13:59 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id D22E55407D + for ; + Fri, 15 Apr 2005 07:13:58 -0300 (ADT) +Received: (qmail 24380 invoked from network); 15 Apr 2005 12:14:04 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 15 Apr 2005 12:14:04 +0200 +To: "Alex Turner" , "Kevin Brown" , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <33c6269f050414192472a58cf6@mail.gmail.com> + <20050415020337.GD19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050414083608.GC19518@filer> <878y3lj23o.fsf@stark.xeocode.com> + <20050414055655.GB19518@filer> <13449.1112847297@sss.pgh.pa.us> + <87wtrfmgt5.fsf@stark.xeocode.com> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <20050406224102.GM93835@decibel.org> +Message-ID: +Date: Fri, 15 Apr 2005 12:13:59 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <33c6269f050414192472a58cf6@mail.gmail.com> +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/332 +X-Sequence-Number: 11729 + + + +> platter compared to the rotational speed, which would agree with the +> fact that you can read 70MB/sec, but it takes up to 13ms to seek. + + Actually : + - the head has to be moved + this time depends on the distance, for instance moving from a cylinder to +the next is very fast (it needs to, to get good throughput) + - then you have to wait for the disk to spin until the information you +want comes in front of the head... statistically you have to wait a half +rotation. And this does not depend on the distance between the cylinders, +it depends on the position of the data in the cylinder. + The more RPMs you have, the less you wait, which is why faster RPMs +drives have faster seek (they must also have faster actuators to move the +head)... + +From pgsql-performance-owner@postgresql.org Fri Apr 15 07:23:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CE44E53215 + for ; + Fri, 15 Apr 2005 07:22:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48626-04 + for ; + Fri, 15 Apr 2005 10:22:53 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 93E4353FB3 + for ; + Fri, 15 Apr 2005 07:22:51 -0300 (ADT) +Received: (qmail 24854 invoked from network); 15 Apr 2005 12:22:58 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 15 Apr 2005 12:22:58 +0200 +Date: Fri, 15 Apr 2005 12:22:52 +0200 +To: "Richard van den Berg" +Subject: Re: Foreign key slows down copy/insert +Cc: pgsql-performance@postgresql.org +References: <425E6045.4060201@trust-factory.com> + <425F77E4.7030504@trust-factory.com> +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: +User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/333 +X-Sequence-Number: 11730 + + +> Index Scan using ix_B on B (cost=0.04..3.06 rows=1 width=329) (actual +> time=93.824..93.826 rows=1 loops=1) +> Index Cond: (id = $0) +> InitPlan +> -> Limit (cost=0.00..0.04 rows=1 width=4) (actual +> time=15.128..15.129 rows=1 loops=1) +> -> Seq Scan on A (cost=0.00..47569.70 rows=1135570 +> width=4) (actual time=15.121..15.121 rows=1 loops=1) +> Total runtime: 94.109 ms + + 94 ms for an index scan ? + this look really slow... + + was the index in the RAM cache ? does it fit ? is it faster the second +time ? If it's still that slow, something somewhere is severely screwed. + + B has 150K rows you say, so everything about B should fit in RAM, and you +should get 0.2 ms for an index scan, not 90 ms ! + Try this : + + Locate the files on disk which are involved in table B (table + indexes) +looking at the system catalogs + Look at the size of the files. Is the index severely bloated ? REINDEX ? +DROP/Recreate the index ? + Load them into the ram cache (just cat files | wc -b several times until +it's almost instantaneous) + Retry your query and your COPY + + I know it's stupid... but it's a lot faster to load an index in the cache +by plainly reading the file rather than accessing it randomly. + (even though, with this number of rows, it should not be THAT slow !) + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 08:16:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0FFB852965 + for ; + Fri, 15 Apr 2005 08:16:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65369-02 + for ; + Fri, 15 Apr 2005 11:16:11 +0000 (GMT) +Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 58E9F5407C + for ; + Fri, 15 Apr 2005 08:16:10 -0300 (ADT) +Received: from localhost (morework [127.0.0.1]) + by morework.geizhals.at (Postfix) with ESMTP id 73851DEB90; + Fri, 15 Apr 2005 13:16:11 +0200 (CEST) +Received: from [172.16.42.166] (unknown [172.16.42.166]) + by morework.geizhals.at (Postfix) with ESMTP; + Fri, 15 Apr 2005 13:16:11 +0200 (CEST) +Message-ID: <425FA27A.8010705@geizhals.at> +Date: Fri, 15 Apr 2005 13:16:10 +0200 +From: Marinos Yannikos +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Joshua D. Drake" +Cc: "Mohan, Ross" , + pgsql-performance@postgresql.org +Subject: Re: Intel SRCS16 SATA raid? +References: + <425E9DE2.7030005@commandprompt.com> +In-Reply-To: <425E9DE2.7030005@commandprompt.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/334 +X-Sequence-Number: 11731 + +Joshua D. Drake wrote: +> Well I have never even heard of it. 3ware is the defacto authority of +> reasonable SATA RAID. + +no! 3ware was rather early in this business, but there are plenty of +(IMHO, and some other people's opinion) better alternatives available. +3ware has good Linux drivers, but the performance of their current +controllers isn't that good. + +Have a look at this: http://www.tweakers.net/reviews/557/1 + +especially the sequential writes with RAID-5 on this page: + +http://www.tweakers.net/reviews/557/19 + +We have been a long-time user of a 3ware 8506 controller (8 disks, +RAID-5) and have purchased 2 Areca ARC-1120 now since we weren't +satisfied with the performance and the 2TB per array limit... + +-mjy + +From pgsql-performance-owner@postgresql.org Fri Apr 15 08:22:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ADC1354069 + for ; + Fri, 15 Apr 2005 08:22:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67037-03 + for ; + Fri, 15 Apr 2005 11:22:48 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id E71005407D + for ; + Fri, 15 Apr 2005 08:22:47 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 4E6E819B3BF; Fri, 15 Apr 2005 13:22:49 +0200 (CEST) +Message-ID: <425FA403.9030007@trust-factory.com> +Date: Fri, 15 Apr 2005 13:22:43 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: PFC +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425F77E4.7030504@trust-factory.com> +In-Reply-To: +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/335 +X-Sequence-Number: 11732 + +PFC wrote: +> 94 ms for an index scan ? +> this look really slow... + +That seems to be network latency. My psql client is connecting over +ethernet to the database server. Retrying the command gives very +different values, as low as 20ms. That 94ms was the highest I've seen. +Running the same command locally (via a Unix socket) yields 2.5 ms every +time. + +Am I correct is assuming that the timings are calculated locally by psql +on my client, thus including network latency? + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 15 08:36:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 23B5554078 + for ; + Fri, 15 Apr 2005 08:36:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70095-09 + for ; + Fri, 15 Apr 2005 11:36:54 +0000 (GMT) +Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) + by svr1.postgresql.org (Postfix) with ESMTP id 72CFE5405C + for ; + Fri, 15 Apr 2005 08:36:51 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id 769B311D55F; + Fri, 15 Apr 2005 19:34:45 +0800 (WST) +Received: from vscan02.westnet.com.au ([127.0.0.1]) + by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 19104-10; Fri, 15 Apr 2005 19:34:45 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan02.westnet.com.au (Postfix) with ESMTP id 2328611D5E6; + Fri, 15 Apr 2005 19:34:45 +0800 (WST) +Message-ID: <425FA758.8080304@familyhealth.com.au> +Date: Fri, 15 Apr 2005 19:36:56 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard van den Berg +Cc: PFC , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425F77E4.7030504@trust-factory.com> + <425FA403.9030007@trust-factory.com> +In-Reply-To: <425FA403.9030007@trust-factory.com> +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/336 +X-Sequence-Number: 11733 + +> Am I correct is assuming that the timings are calculated locally by psql +> on my client, thus including network latency? + +No explain analyze is done on the server... + +Chris + +From pgsql-performance-owner@postgresql.org Fri Apr 15 08:47:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 42EDB53FC5 + for ; + Fri, 15 Apr 2005 08:47:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74024-05 + for ; + Fri, 15 Apr 2005 11:47:28 +0000 (GMT) +Received: from m-monitor.net (unknown [207.44.134.28]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B2D553FBB + for ; + Fri, 15 Apr 2005 08:47:27 -0300 (ADT) +Received: (qmail 23500 invoked from network); 15 Apr 2005 11:47:30 -0000 +Received: from 203-206-51-107.dyn.iinet.net.au (HELO ?127.0.0.1?) + (203.206.51.107) by ev1s-207-44-134-28.ev1servers.net with SMTP; + 15 Apr 2005 11:47:30 -0000 +Message-ID: <425FAA33.2000008@meerkatsoft.com> +Date: Fri, 15 Apr 2005 21:49:07 +1000 +From: Alex +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: plperl vs plpgsql +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/337 +X-Sequence-Number: 11734 + +Hi, +i am thinking about swiching to plperl as it seems to me much more +flexible and easier to create functions. + +what is the recommended PL for postgres? or which one is most widely +used / most popular? +is there a performance difference between plpgsql and plperl ? + +porting to other systems is not a real issue as all my servers have perl +installed. + +Thanks for any advice + +Alex + + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 09:44:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D76DC5385D + for ; + Fri, 15 Apr 2005 09:44:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91320-05 + for ; + Fri, 15 Apr 2005 12:44:51 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id CCB6C537EA + for ; + Fri, 15 Apr 2005 09:44:50 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 3B1A019B3BF; Fri, 15 Apr 2005 14:44:50 +0200 (CEST) +Message-ID: <425FB73F.8080903@trust-factory.com> +Date: Fri, 15 Apr 2005 14:44:47 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Christopher Kings-Lynne +Cc: PFC , + pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425F77E4.7030504@trust-factory.com> + <425FA403.9030007@trust-factory.com> + <425FA758.8080304@familyhealth.com.au> +In-Reply-To: <425FA758.8080304@familyhealth.com.au> +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/338 +X-Sequence-Number: 11735 + +Christopher Kings-Lynne wrote: +> No explain analyze is done on the server... + +Yes, but the psql \timing is calculated on the client, right? That is +the value that PFC was refering to. + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 15 11:17:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 23FEA5359C + for ; + Fri, 15 Apr 2005 11:17:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25496-05 + for ; + Fri, 15 Apr 2005 14:17:29 +0000 (GMT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by svr1.postgresql.org (Postfix) with ESMTP id 1106E53FA9 + for ; + Fri, 15 Apr 2005 11:17:29 -0300 (ADT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by news.hub.org (8.13.1/8.13.1) with ESMTP id j3FEHQZL027634 + for ; Fri, 15 Apr 2005 14:17:26 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.13.1/8.13.1/Submit) id j3FDo30e018046 + for pgsql-performance@postgresql.org; Fri, 15 Apr 2005 13:50:03 GMT + (envelope-from news) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: plperl vs plpgsql +Date: Fri, 15 Apr 2005 08:57:33 -0400 +Organization: cbbrowne Computing Inc +Lines: 30 +Message-ID: +References: <425FAA33.2000008@meerkatsoft.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:68xvbNa400R+epUo6+rpaDgP2lc= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/345 +X-Sequence-Number: 11742 + +After takin a swig o' Arrakan spice grog, alex@meerkatsoft.com (Alex) belched out: +> i am thinking about swiching to plperl as it seems to me much more +> flexible and easier to create functions. +> +> what is the recommended PL for postgres? or which one is most widely +> used / most popular? +> is there a performance difference between plpgsql and plperl ? + +If what you're trying to do is "munge text," pl/perl will be a whole +lot more suitable than pl/pgsql because it has a rich set of text +mungeing tools and string functions which pl/pgsql lacks. + +If you intend to do a lot of work involving reading unmunged tuples +from this table and that, pl/pgsql provides a much more natural +syntax, and will probably be a bit faster as the query processor may +even be able to expand some of the actions, rather than needing to +treat Perl code as an "opaque blob." + +I would definitely be inclined to use the more natural language for +the given task... +-- +wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','acm.org'). +http://linuxdatabases.info/info/internet.html +"If you want to talk with some experts about something, go to the bar +where they hang out, buy a round of beers, and they'll surely talk +your ear off, leaving you wiser than before. + +If you, a stranger, show up at the bar, walk up to the table, and ask +them to fax you a position paper, they'll tell you to call their +office in the morning and ask for a rate sheet." -- Miguel Cruz + +From pgsql-performance-owner@postgresql.org Fri Apr 15 10:12:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A49C053CA3 + for ; + Fri, 15 Apr 2005 10:12:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03382-06 + for ; + Fri, 15 Apr 2005 13:11:55 +0000 (GMT) +Received: from unicorn.rentec.com (rtc10-252.rentec.com [216.223.240.9]) + by svr1.postgresql.org (Postfix) with ESMTP id ADC0B53BF4 + for ; + Fri, 15 Apr 2005 10:11:53 -0300 (ADT) +Received: from ram.rentec.com (mailhost [192.5.35.66]) + by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id j3FDBnFC017781 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); + Fri, 15 Apr 2005 09:11:50 -0400 (EDT) +X-Rentec: external +Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) + by ram.rentec.com (8.13.1/8.12.1) with ESMTP id j3FDBmZY018684; + Fri, 15 Apr 2005 09:11:48 -0400 (EDT) +Message-ID: <425FBD94.3060600@rentec.com> +Date: Fri, 15 Apr 2005 09:11:48 -0400 +From: Alan Stange +Reply-To: stange@rentec.com +Organization: Renaissance Technologies Corp. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: PFC +Cc: Kevin Brown , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Logged: Logged by unicorn.rentec.com as j3FDBnFC017781 at Fri Apr 15 + 09:11:50 2005 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/339 +X-Sequence-Number: 11736 + +PFC wrote: + +> +> +>> My argument is that a sufficiently smart kernel scheduler *should* +>> yield performance results that are reasonably close to what you can +>> get with that feature. Perhaps not quite as good, but reasonably +>> close. It shouldn't be an orders-of-magnitude type difference. +> +> +> And a controller card (or drive) has a lot less RAM to use as a +> cache / queue for reordering stuff than the OS has, potentially the +> OS can us most of the available RAM, which can be gigabytes on a big +> server, whereas in the drive there are at most a few tens of +> megabytes... +> +> However all this is a bit looking at the problem through the wrong +> end. The OS should provide a multi-read call for the applications to +> pass a list of blocks they'll need, then reorder them and read them +> the fastest possible way, clustering them with similar requests from +> other threads. +> +> Right now when a thread/process issues a read() it will block +> until the block is delivered to this thread. The OS does not know if +> this thread will then need the next block (which can be had very +> cheaply if you know ahead of time you'll need it) or not. Thus it +> must make guesses, read ahead (sometimes), etc... + +All true. Which is why high performance computing folks use +aio_read()/aio_write() and load up the kernel with all the requests they +expect to make. + +The kernels that I'm familiar with will do read ahead on files based on +some heuristics: when you read the first byte of a file the OS will +typically load up several pages of the file (depending on file size, +etc). If you continue doing read() calls without a seek() on the file +descriptor the kernel will get the hint that you're doing a sequential +read and continue caching up the pages ahead of time, usually using the +pages you just read to hold the new data so that one isn't bloating out +memory with data that won't be needed again. Throw in a seek() and the +amount of read ahead caching may be reduced. + + +One point that is being missed in all this discussion is that the file +system also imposes some constraints on how IO's can be done. For +example, simply doing a write(fd, buf, 100000000) doesn't emit a stream +of sequential blocks to the drives. Some file systems (UFS was one) +would force portions of large files into other cylinder groups so that +small files could be located near the inode data, thus avoiding/reducing +the size of seeks. Similarly, extents need to be allocated and the +bitmaps recording this data usually need synchronous updates, which will +require some seeks, etc. Not to mention the need to update inode data, +etc. Anyway, my point is that the allocation policies of the file +system can confuse the situation. + +Also, the seek times one sees reported are an average. One really needs +to look at the track-to-track seek time and also the "full stoke" seek +times. It takes a *long* time to move the heads across the whole +platter. I've seen people partition drives to only use small regions of +the drives to avoid long seeks and to better use the increased number of +bits going under the head in one rotation. A 15K drive doesn't need to +have a faster seek time than a 10K drive because the rotational speed is +higher. The average seek time might be faster just because the 15K +drives are smaller with fewer number of cylinders. + +-- Alan + +From pgsql-performance-owner@postgresql.org Fri Apr 15 10:12:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D469453CAD + for ; + Fri, 15 Apr 2005 10:12:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04116-05 + for ; + Fri, 15 Apr 2005 13:12:23 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id D080453B91 + for ; + Fri, 15 Apr 2005 10:12:21 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IEZ007RLOOOYAN7@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Fri, 15 Apr 2005 08:12:26 -0500 (CDT) +Date: Fri, 15 Apr 2005 09:12:25 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B2@asg002.asg.local> +To: "'Dave Held'" , + "'PERFORM'" +Message-id: <000001c541bc$c538fab0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/340 +X-Sequence-Number: 11737 + +It is still slower on the Linux box. (included is explain with SET +enable_seqscan =3D off; +explain analyze select * from viwassoclist where clientnum =3D'SAKS') = +See +below. + +I did a few other tests (changing drive arrays helped by 1 second was = +slower +on my raid 10 on the powervault). + +Pulling just raw data is much faster on the Linux box. +"Seq Scan on tblresponse_line (cost=3D100000000.00..100089717.78 = +rows=3D4032078 +width=3D67) (actual time=3D0.028..4600.431 rows=3D4032078 loops=3D1)" +"Total runtime: 6809.399 ms" +Windows box +"Seq Scan on tblresponse_line (cost=3D0.00..93203.68 rows=3D4031968 = +width=3D67) +(actual time=3D16.000..11316.000 rows=3D4031968 loops=3D1)" +"Total runtime: 16672.000 ms" + +I am going to reload the data bases, just to see what I get. +I am thinking I may have to flatten the files for postgres (eliminate = +joins +of any kind for reporting etc). Might make a good deal more data, but I +think from the app's point of view it is a good idea anyway, just not = +sure +how to handle editing. + +Joel Fradkin +=20 +"Merge Join (cost=3D49697.60..50744.71 rows=3D14987 width=3D113) = +(actual +time=3D11301.160..12171.072 rows=3D160593 loops=3D1)" +" Merge Cond: ("outer".locationid =3D "inner".locationid)" +" -> Sort (cost=3D788.81..789.89 rows=3D432 width=3D49) (actual +time=3D3.318..3.603 rows=3D441 loops=3D1)" +" Sort Key: l.locationid" +" -> Index Scan using ix_location on tbllocation l +(cost=3D0.00..769.90 rows=3D432 width=3D49) (actual time=3D0.145..2.283 = +rows=3D441 +loops=3D1)" +" Index Cond: ('SAKS'::text =3D (clientnum)::text)" +" -> Sort (cost=3D48908.79..49352.17 rows=3D177352 width=3D75) = +(actual +time=3D11297.774..11463.780 rows=3D160594 loops=3D1)" +" Sort Key: a.locationid" +" -> Merge Right Join (cost=3D26247.95..28942.93 rows=3D177352 +width=3D75) (actual time=3D8357.010..9335.362 rows=3D177041 loops=3D1)" +" Merge Cond: ((("outer".clientnum)::text =3D +"inner"."?column10?") AND ("outer".id =3D "inner".jobtitleid))" +" -> Index Scan using ix_tbljobtitle_id on tbljobtitle jt +(cost=3D0.00..243.76 rows=3D6604 width=3D37) (actual = +time=3D0.122..12.049 rows=3D5690 +loops=3D1)" +" Filter: (1 =3D presentationid)" +" -> Sort (cost=3D26247.95..26691.33 rows=3D177352 = +width=3D53) +(actual time=3D8342.271..8554.943 rows=3D177041 loops=3D1)" +" Sort Key: (a.clientnum)::text, a.jobtitleid" +" -> Index Scan using ix_associate_clientnum on +tblassociate a (cost=3D0.00..10786.17 rows=3D177352 width=3D53) (actual +time=3D0.166..1126.052 rows=3D177041 loops=3D1)" +" Index Cond: ((clientnum)::text =3D = +'SAKS'::text)" +"Total runtime: 12287.502 ms" + + +This is above and beyond toying with the column statistics. You +are basically telling the planner to use an index. Try this, +and post the EXPLAIN ANALYZE for the seqscan =3D off case on the +slow box if it doesn't speed things up for you. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +---------------------------(end of broadcast)--------------------------- +TIP 3: if posting/reading through Usenet, please send an appropriate + subscribe-nomail command to majordomo@postgresql.org so that your + message can get through to the mailing list cleanly + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 10:40:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1721453C8E + for ; + Fri, 15 Apr 2005 10:40:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11393-09 + for ; + Fri, 15 Apr 2005 13:40:16 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id C70C053B8A + for ; + Fri, 15 Apr 2005 10:40:15 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Intel SRCS16 SATA raid? +Date: Fri, 15 Apr 2005 08:40:13 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B3@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Intel SRCS16 SATA raid? +Thread-Index: AcVBSALT6MPWv/CzT++BAE8PAwahpAAd0Gmg +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/341 +X-Sequence-Number: 11738 + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com] +> Sent: Thursday, April 14, 2005 6:15 PM +> To: Dave Held +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +>=20 +> Looking at the numbers, the raptor with TCQ enabled was close or +> beat the Atlas III 10k drive on most benchmarks. + +And I would be willing to bet that the Atlas 10k is not using the +same generation of technology as the Raptors. + +> Naturaly a 15k drive is going to be faster in many areas, but it +> is also much more expensive. It was only 44% better on the server +> tests than the raptor with TCQ, but it costs nearly 300% more ($538 +> cdw.com, $180 newegg.com). + +State that in terms of cars. Would you be willing to pay 300% more +for a car that is 44% faster than your competitor's? Of course you +would, because we all recognize that the cost of speed/performance +does not scale linearly. Naturally, you buy the best speed that you +can afford, but when it comes to hard drives, the only major feature +whose price tends to scale anywhere close to linearly is capacity. + +> Note also that the 15k drive was the only drive that kept up with +> the raptor on raw transfer speed, which is going to matter for WAL. + +So get a Raptor for your WAL partition. ;) + +> [...] +> The Raptor drives can be had for as little as $180/ea, which is +> quite a good price point considering they can keep up with their +> SCSI 10k RPM counterparts on almost all tests with NCQ enabled +> (Note that 3ware controllers _don't_ support NCQ, although they +> claim their HBA based queueing is 95% as good as NCQ on the drive). + +Just keep in mind the points made by the Seagate article. You're +buying much more than just performance for that $500+. You're also +buying vibrational tolerance, high MTBF, better internal=20 +environmental controls, and a pretty significant margin on seek time, +which is probably your most important feature for disks storing tables. +An interesting test would be to stick several drives in a cabinet and +graph how performance is affected at the different price points/ +technologies/number of drives. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Fri Apr 15 10:55:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7770353F99 + for ; + Fri, 15 Apr 2005 10:55:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18887-01 + for ; + Fri, 15 Apr 2005 13:55:21 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C72553CCA + for ; + Fri, 15 Apr 2005 10:55:20 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3FDtGu4002699; + Fri, 15 Apr 2005 09:55:16 -0400 (EDT) +To: Richard van den Berg +Cc: Christopher Kings-Lynne , + PFC , pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +In-reply-to: <425FB73F.8080903@trust-factory.com> +References: <425E6045.4060201@trust-factory.com> + <425F77E4.7030504@trust-factory.com> + <425FA403.9030007@trust-factory.com> + <425FA758.8080304@familyhealth.com.au> + <425FB73F.8080903@trust-factory.com> +Comments: In-reply-to Richard van den Berg + + message dated "Fri, 15 Apr 2005 14:44:47 +0200" +Date: Fri, 15 Apr 2005 09:55:16 -0400 +Message-ID: <2697.1113573316@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/342 +X-Sequence-Number: 11739 + +Richard van den Berg writes: +> Christopher Kings-Lynne wrote: +>> No explain analyze is done on the server... + +> Yes, but the psql \timing is calculated on the client, right? That is +> the value that PFC was refering to. + +You didn't show us any \timing. The 94.109 ms figure is all server-side. + +As an example: + +regression=# \timing +Timing is on. +regression=# explain analyze select * from tenk1; + QUERY PLAN +------------------------------------------------------------------------------------------------------------- + Seq Scan on tenk1 (cost=0.00..458.00 rows=10000 width=244) (actual time=0.050..149.615 rows=10000 loops=1) + Total runtime: 188.518 ms +(2 rows) + +Time: 210.885 ms +regression=# + +Here, 188.5 is at the server, 210.8 is at the client. The difference is +not all network delay, either --- parse/plan overhead is in there too. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 15 11:06:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 035BA5391E + for ; + Fri, 15 Apr 2005 11:06:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21239-10 + for ; + Fri, 15 Apr 2005 14:06:10 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BCCB53BE3 + for ; + Fri, 15 Apr 2005 11:06:09 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3FE66AG002800; + Fri, 15 Apr 2005 10:06:06 -0400 (EDT) +To: "Joel Fradkin" +Cc: "'Dave Held'" , + "'PERFORM'" +Subject: Re: speed of querry? +In-reply-to: <000001c541bc$c538fab0$797ba8c0@jfradkin> +References: <000001c541bc$c538fab0$797ba8c0@jfradkin> +Comments: In-reply-to "Joel Fradkin" + message dated "Fri, 15 Apr 2005 09:12:25 -0400" +Date: Fri, 15 Apr 2005 10:06:06 -0400 +Message-ID: <2799.1113573966@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/343 +X-Sequence-Number: 11740 + +"Joel Fradkin" writes: +> "Merge Join (cost=49697.60..50744.71 rows=14987 width=113) (actual +> time=11301.160..12171.072 rows=160593 loops=1)" +> " Merge Cond: ("outer".locationid = "inner".locationid)" +> " -> Sort (cost=788.81..789.89 rows=432 width=49) (actual +> time=3.318..3.603 rows=441 loops=1)" +> " Sort Key: l.locationid" +> " -> Index Scan using ix_location on tbllocation l +> (cost=0.00..769.90 rows=432 width=49) (actual time=0.145..2.283 rows=441 +> loops=1)" +> " Index Cond: ('SAKS'::text = (clientnum)::text)" +> " -> Sort (cost=48908.79..49352.17 rows=177352 width=75) (actual +> time=11297.774..11463.780 rows=160594 loops=1)" +> " Sort Key: a.locationid" +> " -> Merge Right Join (cost=26247.95..28942.93 rows=177352 +> width=75) (actual time=8357.010..9335.362 rows=177041 loops=1)" +> " Merge Cond: ((("outer".clientnum)::text = +> "inner"."?column10?") AND ("outer".id = "inner".jobtitleid))" +> " -> Index Scan using ix_tbljobtitle_id on tbljobtitle jt +> (cost=0.00..243.76 rows=6604 width=37) (actual time=0.122..12.049 rows=5690 +> loops=1)" +> " Filter: (1 = presentationid)" +> " -> Sort (cost=26247.95..26691.33 rows=177352 width=53) +> (actual time=8342.271..8554.943 rows=177041 loops=1)" +> " Sort Key: (a.clientnum)::text, a.jobtitleid" +> " -> Index Scan using ix_associate_clientnum on +> tblassociate a (cost=0.00..10786.17 rows=177352 width=53) (actual +> time=0.166..1126.052 rows=177041 loops=1)" +> " Index Cond: ((clientnum)::text = 'SAKS'::text)" +> "Total runtime: 12287.502 ms" + +It strikes me as odd that the thing isn't considering hash joins for +at least some of these steps. Can you force it to (by setting +enable_mergejoin off)? If not, what are the datatypes of the join +columns exactly? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 15 11:10:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 166E05359C + for ; + Fri, 15 Apr 2005 11:10:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22491-08 + for ; + Fri, 15 Apr 2005 14:10:06 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 1DB9153215 + for ; + Fri, 15 Apr 2005 11:10:05 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id AA67619B3BF; Fri, 15 Apr 2005 16:10:09 +0200 (CEST) +Message-ID: <425FCB3C.8010809@trust-factory.com> +Date: Fri, 15 Apr 2005 16:10:04 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: Christopher Kings-Lynne , + PFC , pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +References: <425E6045.4060201@trust-factory.com> + <425F77E4.7030504@trust-factory.com> + <425FA403.9030007@trust-factory.com> + <425FA758.8080304@familyhealth.com.au> + <425FB73F.8080903@trust-factory.com> + <2697.1113573316@sss.pgh.pa.us> +In-Reply-To: <2697.1113573316@sss.pgh.pa.us> +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/344 +X-Sequence-Number: 11741 + +Tom Lane wrote: +> You didn't show us any \timing. The 94.109 ms figure is all server-side. + +Whoop, my mistake. I had been retesting without the explain, just the +query. I re-run the explain analyze a few times, and it only reports +90ms the first time. After that it reports 2ms even over the network +(the \timing on those are about 50ms which includes the network latency). + +Thanks, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 15 11:21:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6AD415391E; + Fri, 15 Apr 2005 11:21:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27146-10; Fri, 15 Apr 2005 14:21:30 +0000 (GMT) +Received: from dfw-gate1.raytheon.com (dfw-gate1.raytheon.com + [199.46.199.230]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FF3253766; + Fri, 15 Apr 2005 11:21:29 -0300 (ADT) +Received: from ds02c00.directory.ray.com (ds02c00.directory.ray.com + [147.25.138.118]) + by dfw-gate1.raytheon.com (8.12.10/8.12.10) with ESMTP id + j3FELKqb005570; Fri, 15 Apr 2005 09:21:20 -0500 (CDT) +Received: from ds02c00 (localhost [127.0.0.1]) + by ds02c00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j3FELE98016960; Fri, 15 Apr 2005 14:21:14 GMT +Received: from ds02c00.directory.ray.com with LMTP by ds02c00 + (2.0.6/sieved-2-0-build-559); Fri, 15 Apr 2005 14:21:13 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02c00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + j3FEL4md016855 sender Richard_D_Levine@raytheon.com; + Fri, 15 Apr 2005 14:21:04 GMT +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B3@asg002.asg.local> +Subject: Re: Intel SRCS16 SATA raid? +To: "Dave Held" +Cc: pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Fri, 15 Apr 2005 09:21:02 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/15/2005 09:21:04 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.213 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/346 +X-Sequence-Number: 11743 + +Dave wrote "An interesting test would be to stick several drives in a +cabinet and +graph how performance is affected at the different price points/ +technologies/number of drives." + + From the discussion on the $7k server thread, it seems the RAID controller +would +be an important data point also. And RAID level. And application +load/kind. + +Hmmm. I just talked myself out of it. Seems like I'd end up with +something +akin to those database benchmarks we all love to hate. + +Rick + +pgsql-performance-owner@postgresql.org wrote on 04/15/2005 08:40:13 AM: + +> > -----Original Message----- +> > From: Alex Turner [mailto:armtuk@gmail.com] +> > Sent: Thursday, April 14, 2005 6:15 PM +> > To: Dave Held +> > Cc: pgsql-performance@postgresql.org +> > Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +> > +> > Looking at the numbers, the raptor with TCQ enabled was close or +> > beat the Atlas III 10k drive on most benchmarks. +> +> And I would be willing to bet that the Atlas 10k is not using the +> same generation of technology as the Raptors. +> +> > Naturaly a 15k drive is going to be faster in many areas, but it +> > is also much more expensive. It was only 44% better on the server +> > tests than the raptor with TCQ, but it costs nearly 300% more ($538 +> > cdw.com, $180 newegg.com). +> +> State that in terms of cars. Would you be willing to pay 300% more +> for a car that is 44% faster than your competitor's? Of course you +> would, because we all recognize that the cost of speed/performance +> does not scale linearly. Naturally, you buy the best speed that you +> can afford, but when it comes to hard drives, the only major feature +> whose price tends to scale anywhere close to linearly is capacity. +> +> > Note also that the 15k drive was the only drive that kept up with +> > the raptor on raw transfer speed, which is going to matter for WAL. +> +> So get a Raptor for your WAL partition. ;) +> +> > [...] +> > The Raptor drives can be had for as little as $180/ea, which is +> > quite a good price point considering they can keep up with their +> > SCSI 10k RPM counterparts on almost all tests with NCQ enabled +> > (Note that 3ware controllers _don't_ support NCQ, although they +> > claim their HBA based queueing is 95% as good as NCQ on the drive). +> +> Just keep in mind the points made by the Seagate article. You're +> buying much more than just performance for that $500+. You're also +> buying vibrational tolerance, high MTBF, better internal +> environmental controls, and a pretty significant margin on seek time, +> which is probably your most important feature for disks storing tables. +> An interesting test would be to stick several drives in a cabinet and +> graph how performance is affected at the different price points/ +> technologies/number of drives. +> +> __ +> David B. Held +> Software Engineer/Array Services Group +> 200 14th Ave. East, Sartell, MN 56377 +> 320.534.3637 320.253.7800 800.752.8129 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 11:43:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6286154054 + for ; + Fri, 15 Apr 2005 11:43:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36726-10 + for ; + Fri, 15 Apr 2005 14:43:52 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B8CD5402D + for ; + Fri, 15 Apr 2005 11:43:51 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so807552wri + for ; + Fri, 15 Apr 2005 07:43:53 -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=kfl9+d/maRHID3N4mrNgMUBuxmn7q6RSsfiqGt+xOIHorAyA3P3qMsk6mw0hRbRBkqS7zsWIC4lf1BW5CH3mGeAlstcN/4Aym/HNkP6JFJFKE0GICbQp9ZDQCo2Sn73/XpEho7y/YpAVomNeBDZvaIKUr1WoO63tNQrgag2yvT0= +Received: by 10.54.33.54 with SMTP id g54mr1188774wrg; + Fri, 15 Apr 2005 07:43:47 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Fri, 15 Apr 2005 07:43:47 -0700 (PDT) +Message-ID: <33c6269f05041507437f3e8db3@mail.gmail.com> +Date: Fri, 15 Apr 2005 10:43:47 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Marinos Yannikos +Subject: Re: Intel SRCS16 SATA raid? +Cc: "Joshua D. Drake" , + "Mohan, Ross" , pgsql-performance@postgresql.org +In-Reply-To: <425FA27A.8010705@geizhals.at> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425E9DE2.7030005@commandprompt.com> <425FA27A.8010705@geizhals.at> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.274 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/347 +X-Sequence-Number: 11744 + +No offense to that review, but it was really wasn't that good, and +drew bad conclusions from the data. I posted it originaly and +immediately regretted it. + +See http://www.tweakers.net/reviews/557/18 + +Amazingly the controller with 1Gig cache manages a write throughput of +750MB/sec on a single drive. + +quote: +"Floating high above the crowd, the ARC-1120 has a perfect view on the +struggles of the other adapters. " + +It's because the adapter has 1Gig of RAM, nothing to do with the RAID +architecture, it's clearly caching the entire dataset. The drive +can't physicaly run that fast. These guys really don't know what they +are doing. + +Curiously: +http://www.tweakers.net/reviews/557/25 + +The 3ware does very well as a data drive for MySQL. + +The size of your cache is going to _directly_ affect RAID 5 +performance. Put a gig of memory in a 3ware 9500S and benchmark it +against the Areca then. + +Also - folks don't run data paritions on RAID 5 because the write +speed is too low. When you look at the results for RAID 10, the 3ware +leads the pack. + +See also: +http://www20.tomshardware.com/storage/20041227/areca-raid6-06.html + +I trust toms hardware a little more to set up a good review to be honest. + +The 3ware trounces the Areca in all IO/sec test. + +Alex Turner +netEconomist + +On 4/15/05, Marinos Yannikos wrote: +> Joshua D. Drake wrote: +> > Well I have never even heard of it. 3ware is the defacto authority of +> > reasonable SATA RAID. +>=20 +> no! 3ware was rather early in this business, but there are plenty of +> (IMHO, and some other people's opinion) better alternatives available. +> 3ware has good Linux drivers, but the performance of their current +> controllers isn't that good. +>=20 +> Have a look at this: http://www.tweakers.net/reviews/557/1 +>=20 +> especially the sequential writes with RAID-5 on this page: +>=20 +> http://www.tweakers.net/reviews/557/19 +>=20 +> We have been a long-time user of a 3ware 8506 controller (8 disks, +> RAID-5) and have purchased 2 Areca ARC-1120 now since we weren't +> satisfied with the performance and the 2TB per array limit... +>=20 +> -mjy +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster +> + +From pgsql-performance-owner@postgresql.org Fri Apr 15 12:02:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 77EE5540A0 + for ; + Fri, 15 Apr 2005 12:02:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44766-02 + for ; + Fri, 15 Apr 2005 15:02:00 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) + by svr1.postgresql.org (Postfix) with ESMTP id 85BE45409D + for ; + Fri, 15 Apr 2005 12:01:59 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so812985wri + for ; + Fri, 15 Apr 2005 08:01:56 -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=W5A/jNdxjHf7R1S9xsm5mc0VV4Y4NzkTLN/KeRYQUS9sD7/gJ0bAfnolrEX2wQ0YKKodWzmiFY+UEckPORI/G2Sa8byZp/KQT5GPp6psfxGdbK6ebtwFlmykej2RLGWwFMnvUyG6XpqurFtKfRrZPu7cWpxSnKdXGwSOsZGkY5I= +Received: by 10.54.16.68 with SMTP id 68mr759444wrp; + Fri, 15 Apr 2005 08:01:56 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Fri, 15 Apr 2005 08:01:56 -0700 (PDT) +Message-ID: <33c6269f050415080159674ca4@mail.gmail.com> +Date: Fri, 15 Apr 2005 11:01:56 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Dave Held +Subject: Re: Intel SRCS16 SATA raid? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B3@asg002.asg.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B3@asg002.asg.local> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.274 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/348 +X-Sequence-Number: 11745 + +The original thread was how much can I get for $7k + +You can't fit a 15k RPM SCSI solution into $7K ;) Some of us are on a budg= +et! + +10k RPM SATA drives give acceptable performance at a good price, thats +really the point here. + +I have never really argued that SATA is going to match SCSI +performance on multidrive arrays for IO/sec. But it's all about the +benjamins baby. If I told my boss we need $25k for a database +machine, he'd tell me that was impossible, and I have $5k to do it.=20 +If I tell him $7k - he will swallow that. We don't _need_ the amazing +performance of a 15k RPM drive config. Our biggest hit is reads, so +we can buy 3xSATA machines and load balance. It's all about the +application, and buying what is appropriate. I don't buy a Corvette +if all I need is a malibu. + +Alex Turner +netEconomist + +On 4/15/05, Dave Held wrote: +> > -----Original Message----- +> > From: Alex Turner [mailto:armtuk@gmail.com] +> > Sent: Thursday, April 14, 2005 6:15 PM +> > To: Dave Held +> > Cc: pgsql-performance@postgresql.org +> > Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +> > +> > Looking at the numbers, the raptor with TCQ enabled was close or +> > beat the Atlas III 10k drive on most benchmarks. +>=20 +> And I would be willing to bet that the Atlas 10k is not using the +> same generation of technology as the Raptors. +>=20 +> > Naturaly a 15k drive is going to be faster in many areas, but it +> > is also much more expensive. It was only 44% better on the server +> > tests than the raptor with TCQ, but it costs nearly 300% more ($538 +> > cdw.com, $180 newegg.com). +>=20 +> State that in terms of cars. Would you be willing to pay 300% more +> for a car that is 44% faster than your competitor's? Of course you +> would, because we all recognize that the cost of speed/performance +> does not scale linearly. Naturally, you buy the best speed that you +> can afford, but when it comes to hard drives, the only major feature +> whose price tends to scale anywhere close to linearly is capacity. +>=20 +> > Note also that the 15k drive was the only drive that kept up with +> > the raptor on raw transfer speed, which is going to matter for WAL. +>=20 +> So get a Raptor for your WAL partition. ;) +>=20 +> > [...] +> > The Raptor drives can be had for as little as $180/ea, which is +> > quite a good price point considering they can keep up with their +> > SCSI 10k RPM counterparts on almost all tests with NCQ enabled +> > (Note that 3ware controllers _don't_ support NCQ, although they +> > claim their HBA based queueing is 95% as good as NCQ on the drive). +>=20 +> Just keep in mind the points made by the Seagate article. You're +> buying much more than just performance for that $500+. You're also +> buying vibrational tolerance, high MTBF, better internal +> environmental controls, and a pretty significant margin on seek time, +> which is probably your most important feature for disks storing tables. +> An interesting test would be to stick several drives in a cabinet and +> graph how performance is affected at the different price points/ +> technologies/number of drives. +>=20 +> __ +> David B. Held +> Software Engineer/Array Services Group +> 200 14th Ave. East, Sartell, MN 56377 +> 320.534.3637 320.253.7800 800.752.8129 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly +> + +From pgsql-performance-owner@postgresql.org Fri Apr 15 12:09:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D7B7A54061 + for ; + Fri, 15 Apr 2005 12:09:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45778-08 + for ; + Fri, 15 Apr 2005 15:09:50 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 559925402D + for ; + Fri, 15 Apr 2005 12:09:49 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Intel SRCS16 SATA raid? +Date: Fri, 15 Apr 2005 10:09:45 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B4@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Intel SRCS16 SATA raid? +Thread-Index: AcVByjbooQLSpcf5TNyF1xWomtYO7gAAm47A +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/349 +X-Sequence-Number: 11746 + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com] +> Sent: Friday, April 15, 2005 9:44 AM +> To: Marinos Yannikos +> Cc: Joshua D. Drake; Mohan, Ross; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +>=20 +> No offense to that review, but it was really wasn't that good, +> and drew bad conclusions from the data. I posted it originaly +> and immediately regretted it. + +I didn't read the whole thing, but it didn't seem that bad to me. + +> See http://www.tweakers.net/reviews/557/18 +>=20 +> Amazingly the controller with 1Gig cache manages a write throughput +> of 750MB/sec on a single drive. +>=20 +> quote: +> "Floating high above the crowd, the ARC-1120 has a perfect view on +> the struggles of the other adapters. " +>=20 +> It's because the adapter has 1Gig of RAM, nothing to do with the RAID +> architecture, it's clearly caching the entire dataset. The drive +> can't physicaly run that fast.=20 + +And that's pretty much exactly what the article says. Even before the +part you quoted. Not sure what the problem is there. + +> These guys really don't know what they are doing. + +They weren't pretending that the drive array was serving up data at +that rate directly from the physical media. They clearly indicated +that they were testing controller cache speed with the small test. + +> Curiously: +> http://www.tweakers.net/reviews/557/25 +>=20 +> The 3ware does very well as a data drive for MySQL. +> [...] + +If you take a close look, they pretty much outright say that the Areca +controller does very poorly on the random accesses typical of DB work. +They also specifically mention that the 3ware still dominates the +competition in this area. + +Dave + + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Fri Apr 15 12:21:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 89E2B535C6; + Fri, 15 Apr 2005 12:21:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51525-04; Fri, 15 Apr 2005 15:21:25 +0000 (GMT) +Received: from tus-gate3.raytheon.com (tus-gate3.raytheon.com + [199.46.245.232]) + by svr1.postgresql.org (Postfix) with ESMTP id D762052959; + Fri, 15 Apr 2005 12:21:24 -0300 (ADT) +Received: from ds02t00.directory.ray.com (ds02t00.directory.ray.com + [147.25.154.117]) + by tus-gate3.raytheon.com (8.12.10/8.12.10) with ESMTP id + j3FFKoFC010180; Fri, 15 Apr 2005 08:20:50 -0700 (MST) +Received: from ds02t00 (localhost [127.0.0.1]) + by ds02t00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j3FFKmQj006620; Fri, 15 Apr 2005 15:20:48 GMT +Received: from ds02t00.directory.ray.com with LMTP by ds02t00 + (2.0.6/sieved-2-0-build-559); Fri, 15 Apr 2005 15:20:47 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02t00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j3FFKLCK006366 sender Richard_D_Levine@raytheon.com; + Fri, 15 Apr 2005 15:20:21 GMT +In-Reply-To: <33c6269f050415080159674ca4@mail.gmail.com> +Subject: Re: Intel SRCS16 SATA raid? +To: Alex Turner +Cc: Dave Held , + pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Fri, 15 Apr 2005 10:20:20 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/15/2005 10:20:21 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.213 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/350 +X-Sequence-Number: 11747 + +This is a different thread that the $7k server thread. +Greg Stark started it and wrote: + + "I'm also wondering about whether I'm better off with one of these + SATA raid + controllers or just going with SCSI drives." + + + +Rick + +pgsql-performance-owner@postgresql.org wrote on 04/15/2005 10:01:56 AM: + +> The original thread was how much can I get for $7k +> +> You can't fit a 15k RPM SCSI solution into $7K ;) Some of us are ona +budget! +> +> 10k RPM SATA drives give acceptable performance at a good price, thats +> really the point here. +> +> I have never really argued that SATA is going to match SCSI +> performance on multidrive arrays for IO/sec. But it's all about the +> benjamins baby. If I told my boss we need $25k for a database +> machine, he'd tell me that was impossible, and I have $5k to do it. +> If I tell him $7k - he will swallow that. We don't _need_ the amazing +> performance of a 15k RPM drive config. Our biggest hit is reads, so +> we can buy 3xSATA machines and load balance. It's all about the +> application, and buying what is appropriate. I don't buy a Corvette +> if all I need is a malibu. +> +> Alex Turner +> netEconomist +> +> On 4/15/05, Dave Held wrote: +> > > -----Original Message----- +> > > From: Alex Turner [mailto:armtuk@gmail.com] +> > > Sent: Thursday, April 14, 2005 6:15 PM +> > > To: Dave Held +> > > Cc: pgsql-performance@postgresql.org +> > > Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +> > > +> > > Looking at the numbers, the raptor with TCQ enabled was close or +> > > beat the Atlas III 10k drive on most benchmarks. +> > +> > And I would be willing to bet that the Atlas 10k is not using the +> > same generation of technology as the Raptors. +> > +> > > Naturaly a 15k drive is going to be faster in many areas, but it +> > > is also much more expensive. It was only 44% better on the server +> > > tests than the raptor with TCQ, but it costs nearly 300% more ($538 +> > > cdw.com, $180 newegg.com). +> > +> > State that in terms of cars. Would you be willing to pay 300% more +> > for a car that is 44% faster than your competitor's? Of course you +> > would, because we all recognize that the cost of speed/performance +> > does not scale linearly. Naturally, you buy the best speed that you +> > can afford, but when it comes to hard drives, the only major feature +> > whose price tends to scale anywhere close to linearly is capacity. +> > +> > > Note also that the 15k drive was the only drive that kept up with +> > > the raptor on raw transfer speed, which is going to matter for WAL. +> > +> > So get a Raptor for your WAL partition. ;) +> > +> > > [...] +> > > The Raptor drives can be had for as little as $180/ea, which is +> > > quite a good price point considering they can keep up with their +> > > SCSI 10k RPM counterparts on almost all tests with NCQ enabled +> > > (Note that 3ware controllers _don't_ support NCQ, although they +> > > claim their HBA based queueing is 95% as good as NCQ on the drive). +> > +> > Just keep in mind the points made by the Seagate article. You're +> > buying much more than just performance for that $500+. You're also +> > buying vibrational tolerance, high MTBF, better internal +> > environmental controls, and a pretty significant margin on seek time, +> > which is probably your most important feature for disks storing tables. +> > An interesting test would be to stick several drives in a cabinet and +> > graph how performance is affected at the different price points/ +> > technologies/number of drives. +> > +> > __ +> > David B. Held +> > Software Engineer/Array Services Group +> > 200 14th Ave. East, Sartell, MN 56377 +> > 320.534.3637 320.253.7800 800.752.8129 +> > +> > ---------------------------(end of +broadcast)--------------------------- +> > TIP 3: if posting/reading through Usenet, please send an appropriate +> > subscribe-nomail command to majordomo@postgresql.org so that your +> > message can get through to the mailing list cleanly +> > +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 12:43:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 556825374F + for ; + Fri, 15 Apr 2005 12:43:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60710-01 + for ; + Fri, 15 Apr 2005 15:43:43 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id F34B153750 + for ; + Fri, 15 Apr 2005 12:43:42 -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 1F623B80D + for ; + Fri, 15 Apr 2005 11:43:41 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v619.2) +In-Reply-To: <20050415020337.GD19518@filer> +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-14--18849255; + protocol="application/pkcs7-signature" +Message-Id: <9fde2d603a18b53b5b3f22ad47f3a064@khera.org> +From: Vivek Khera +Subject: Re: How to improve db performance with $7K? +Date: Fri, 15 Apr 2005 11:43:40 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/351 +X-Sequence-Number: 11748 + + +--Apple-Mail-14--18849255 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + +On Apr 14, 2005, at 10:03 PM, Kevin Brown wrote: + +> Now, bad block remapping destroys that guarantee, but unless you've +> got a LOT of bad blocks, it shouldn't destroy your performance, right? +> + +ALL disks have bad blocks, even when you receive them. you honestly +think that these large disks made today (18+ GB is the smallest now) +that there are no defects on the surfaces? + +/me remembers trying to cram an old donated 5MB (yes M) disk into an +old 8088 Zenith PC in college... + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +--Apple-Mail-14--18849255 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +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/11fZU8wggNAMIICqaADAgECAgMOah8wDQYJKoZI +hvcNAQEEBQAwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkp +IEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1 +MDQwNTIwMzEzMloXDTA2MDQwNTIwMzEzMlowgYoxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBN +ZW1iZXIxHjAcBgkqhkiG9w0BCQEWD3ZpdmVrQGtoZXJhLm9yZzEgMB4GCSqGSIb3DQEJARYRa2hl +cmFAa2NpbGluay5jb20xJTAjBgkqhkiG9w0BCQEWFnZpdmVrQG1haWxlcm1haWxlci5jb20wggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdo7hywGcY0VvK6WqqXXV77MS/t/4X3WkCaCXo +RSl2W58GP4P21hodPn7hlIxUoDOW7x9O+FbqTgE2Ejqr6yA00Mm90tGPFgjFjqPGAqg7xk6IDcv9 +uTyMia/FKEHSIynM6zqokXY8JklvdbJOiByE/8VeyEXOANWiflo8o4+GHnhMKpA9982YTXUqeKU6 +mMQVaLCBRjTDc7j2XkMC/UNcp2HMyDQdTqYVnhLxbvbLX8CNDBY/7OWFlB9evru46SpGWhe4lhv5 +DSgE2RdCKvDytzxRDvP49L8V0TnFjAVeC1C1Pj0/KQsoL/AP4APplROiD4QaUhshQl28pXxJtfbl +AgMBAAGjVzBVMEUGA1UdEQQ+MDyBD3ZpdmVrQGtoZXJhLm9yZ4ERa2hlcmFAa2NpbGluay5jb22B +FnZpdmVrQG1haWxlcm1haWxlci5jb20wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQAr +CWop3h28qPwofzLrkoT410J4d7Bqk6FLeVlKZfg/wXlS1MTqYMNcCm4x+JsJbjwsO0fb2elFIuGq +1razoSzPpgi89itydvUT0U0U/u+AkZA5rW4AptTpMZ70YW5u9wzkcvmifqZmcfbaaeGdZfruzUXZ +6qvdXDpNb3ZHeQw6PjGCAucwggLjAgEBMGkwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0 +ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFp +bCBJc3N1aW5nIENBAgMOah8wCQYFKw4DAhoFAKCCAVMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH +ATAcBgkqhkiG9w0BCQUxDxcNMDUwNDE1MTU0MzQwWjAjBgkqhkiG9w0BCQQxFgQUJqM+zeICwuGZ +VpJkumg9f9WoYYIweAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh +d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAk+2Tw5EdT78X +dhLJqAJ6NiT9aFo0X8/rsAfZhN+p3xFvHuKxhNgFFfm1rM+aVavocpxvCTZBQDYWkjxWt7kFwWhC +oqUzy6Z2p0xhvzSiuMqx7uNteny0Q9732kzHxVLn+kL/3P2tR/Xo3JViqJHY7nzhsujjnjpPRNv9 +3qImEjbJm7HaXnT6PgvKR0Cf3jZa84pJgPj4eQkNUXqsRUqMME3G66PWp8tuGD8CXUA+uJGVjO+t +2y/C996feTj36JAZZsp68+TKFR2GfEICYvqCAo0hXaMOOK0lUINeV6A9rNtKr6lRaBFkdh0muRLT +7qwKMmZDIJHdyf99StaqhICKMQAAAAAAAA== + +--Apple-Mail-14--18849255-- + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 12:52:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6999D53739 + for ; + Fri, 15 Apr 2005 12:52:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62039-07 + for ; + Fri, 15 Apr 2005 15:52:49 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id B23BF5294A + for ; + Fri, 15 Apr 2005 12:52:48 -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 04366B80D + for ; + Fri, 15 Apr 2005 11:52:48 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v619.2) +In-Reply-To: <33c6269f050415080159674ca4@mail.gmail.com> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B3@asg002.asg.local> + <33c6269f050415080159674ca4@mail.gmail.com> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-15--18302370; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: Intel SRCS16 SATA raid? +Date: Fri, 15 Apr 2005 11:52:47 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/352 +X-Sequence-Number: 11749 + + +--Apple-Mail-15--18302370 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + +On Apr 15, 2005, at 11:01 AM, Alex Turner wrote: + +> You can't fit a 15k RPM SCSI solution into $7K ;) Some of us are on a +> budget! +> + +I just bought a pair of Dual Opteron, 4GB RAM, LSI 320-2X RAID dual +channel with 8 36GB 15kRPM seagate drives. Each one of these boxes set +me back just over $7k, including onsite warrantee. + +They totally blow away the Dell Dual XEON with external 14 disk RAID +(also 15kRPM drives, manufacturer unknown) which also has 4GB RAM and a +Dell PERC 3/DC controller, the whole of which set me back over $15k. + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +--Apple-Mail-15--18302370 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +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/11fZU8wggNAMIICqaADAgECAgMOah8wDQYJKoZI +hvcNAQEEBQAwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkp +IEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1 +MDQwNTIwMzEzMloXDTA2MDQwNTIwMzEzMlowgYoxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBN +ZW1iZXIxHjAcBgkqhkiG9w0BCQEWD3ZpdmVrQGtoZXJhLm9yZzEgMB4GCSqGSIb3DQEJARYRa2hl +cmFAa2NpbGluay5jb20xJTAjBgkqhkiG9w0BCQEWFnZpdmVrQG1haWxlcm1haWxlci5jb20wggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdo7hywGcY0VvK6WqqXXV77MS/t/4X3WkCaCXo +RSl2W58GP4P21hodPn7hlIxUoDOW7x9O+FbqTgE2Ejqr6yA00Mm90tGPFgjFjqPGAqg7xk6IDcv9 +uTyMia/FKEHSIynM6zqokXY8JklvdbJOiByE/8VeyEXOANWiflo8o4+GHnhMKpA9982YTXUqeKU6 +mMQVaLCBRjTDc7j2XkMC/UNcp2HMyDQdTqYVnhLxbvbLX8CNDBY/7OWFlB9evru46SpGWhe4lhv5 +DSgE2RdCKvDytzxRDvP49L8V0TnFjAVeC1C1Pj0/KQsoL/AP4APplROiD4QaUhshQl28pXxJtfbl +AgMBAAGjVzBVMEUGA1UdEQQ+MDyBD3ZpdmVrQGtoZXJhLm9yZ4ERa2hlcmFAa2NpbGluay5jb22B +FnZpdmVrQG1haWxlcm1haWxlci5jb20wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQAr +CWop3h28qPwofzLrkoT410J4d7Bqk6FLeVlKZfg/wXlS1MTqYMNcCm4x+JsJbjwsO0fb2elFIuGq +1razoSzPpgi89itydvUT0U0U/u+AkZA5rW4AptTpMZ70YW5u9wzkcvmifqZmcfbaaeGdZfruzUXZ +6qvdXDpNb3ZHeQw6PjGCAucwggLjAgEBMGkwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0 +ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFp +bCBJc3N1aW5nIENBAgMOah8wCQYFKw4DAhoFAKCCAVMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH +ATAcBgkqhkiG9w0BCQUxDxcNMDUwNDE1MTU1MjQ3WjAjBgkqhkiG9w0BCQQxFgQU32Oze9iPzME0 +Cy38ek4c9gG75gYweAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh +d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAKsMGuJM0eUgQ +CQubMyf4yyherSMO/tT+BG3+s2LnUJjGyc9N9QKEaWri6FeqbmRAB7qWCn3kFKtkzCpIgPWgV0Yw +z6BK/hKGY1rMbvJBrV3P58YvdJNfwlUJLdYyWlp2pGToR8AnTWK7mg4nWCZM0abOidA+0gWhpZah +qcSpMTY7FKSUyqx/KFBbYcD3ITtpTSZ0fP59eFPchCEw6MU2/eV1mCsOcBeMcNBxassVf0Y3oxoD +n+gk4lENDngqmMLJKyZRX8f90GuKrFaz8koXwiWK8Rl1V4hs0Sx2r5i83KWne8pRYDYyrampzJNm +7BXShc7yHLXAVyX3ivOit/anwgAAAAAAAA== + +--Apple-Mail-15--18302370-- + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 12:58:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F2265376D + for ; + Fri, 15 Apr 2005 12:58:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65032-07 + for ; + Fri, 15 Apr 2005 15:58:22 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A1BF5294A + for ; + Fri, 15 Apr 2005 12:58:22 -0300 (ADT) +Received: from [192.168.1.102] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3FFrRma002989; Fri, 15 Apr 2005 08:53:27 -0700 +Message-ID: <425FE4B7.6080406@commandprompt.com> +Date: Fri, 15 Apr 2005 08:58:47 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> + <9fde2d603a18b53b5b3f22ad47f3a064@khera.org> +In-Reply-To: <9fde2d603a18b53b5b3f22ad47f3a064@khera.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.039 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/353 +X-Sequence-Number: 11750 + +Vivek Khera wrote: +> +> On Apr 14, 2005, at 10:03 PM, Kevin Brown wrote: +> +>> Now, bad block remapping destroys that guarantee, but unless you've +>> got a LOT of bad blocks, it shouldn't destroy your performance, right? +>> +> +> ALL disks have bad blocks, even when you receive them. you honestly +> think that these large disks made today (18+ GB is the smallest now) +> that there are no defects on the surfaces? + +That is correct. It is just that the HD makers will mark the bad blocks +so that the OS knows not to use them. You can also run the bad blocks +command to try and find new bad blocks. + +Over time hard drives get bad blocks. It doesn't always mean you have to +replace the drive but it does mean you need to maintain it and usually +at least backup, low level (if scsi) and mark bad blocks. Then restore. + +Sincerely, + +Joshua D. Drake + + +> +> /me remembers trying to cram an old donated 5MB (yes M) disk into an old +> 8088 Zenith PC in college... +> +> Vivek Khera, Ph.D. +> +1-301-869-4449 x806 +> + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Fri Apr 15 13:08:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 68927537B6 + for ; + Fri, 15 Apr 2005 13:08:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68414-05 + for ; + Fri, 15 Apr 2005 16:08:00 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) + by svr1.postgresql.org (Postfix) with ESMTP id 10377537B3 + for ; + Fri, 15 Apr 2005 13:07:59 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so831496wri + for ; + Fri, 15 Apr 2005 09:07:59 -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=NWyHiewVo8n1vB2uaGsdtyY5Gnm1u8ID+hkzWwOHjI4WgCpJ+i2AS8GcPbqA1KutDWBABH9mK3X913OowgvMNv+kL5jsDk+HqB63zt6ipicFtpNrnT7eFlDop7t00/0RCmG3hRaZXKH4aJjjBGXIgjs+rBAwNH6imoyPHkzMKEo= +Received: by 10.54.33.54 with SMTP id g54mr1278464wrg; + Fri, 15 Apr 2005 09:07:58 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Fri, 15 Apr 2005 09:07:58 -0700 (PDT) +Message-ID: <33c6269f0504150907690eef5@mail.gmail.com> +Date: Fri, 15 Apr 2005 12:07:58 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Vivek Khera +Subject: Re: Intel SRCS16 SATA raid? +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B3@asg002.asg.local> + <33c6269f050415080159674ca4@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.274 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/354 +X-Sequence-Number: 11751 + +I stand corrected! + +Maybe I should re-evaluate our own config! + +Alex T + +(The dell PERC controllers do pretty much suck on linux) + +On 4/15/05, Vivek Khera wrote: +>=20 +> On Apr 15, 2005, at 11:01 AM, Alex Turner wrote: +>=20 +> > You can't fit a 15k RPM SCSI solution into $7K ;) Some of us are on a +> > budget! +> > +>=20 +> I just bought a pair of Dual Opteron, 4GB RAM, LSI 320-2X RAID dual +> channel with 8 36GB 15kRPM seagate drives. Each one of these boxes set +> me back just over $7k, including onsite warrantee. +>=20 +> They totally blow away the Dell Dual XEON with external 14 disk RAID +> (also 15kRPM drives, manufacturer unknown) which also has 4GB RAM and a +> Dell PERC 3/DC controller, the whole of which set me back over $15k. +>=20 +> Vivek Khera, Ph.D. +> +1-301-869-4449 x806 +>=20 +>=20 +> + +From pgsql-performance-owner@postgresql.org Fri Apr 15 13:10:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 09984537BA + for ; + Fri, 15 Apr 2005 13:10:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68229-08 + for ; + Fri, 15 Apr 2005 16:10:17 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F4E1537B8 + for ; + Fri, 15 Apr 2005 13:10:15 -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 E1FA2B850 + for ; + Fri, 15 Apr 2005 12:10:14 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v619.2) +In-Reply-To: <425FE4B7.6080406@commandprompt.com> +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> + <9fde2d603a18b53b5b3f22ad47f3a064@khera.org> + <425FE4B7.6080406@commandprompt.com> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-19--17255361; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: How to improve db performance with $7K? +Date: Fri, 15 Apr 2005 12:10:14 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.046 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/355 +X-Sequence-Number: 11752 + + +--Apple-Mail-19--17255361 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + +On Apr 15, 2005, at 11:58 AM, Joshua D. Drake wrote: + +>> ALL disks have bad blocks, even when you receive them. you honestly +>> think that these large disks made today (18+ GB is the smallest now) +>> that there are no defects on the surfaces? +> +> That is correct. It is just that the HD makers will mark the bad blocks +> so that the OS knows not to use them. You can also run the bad blocks +> command to try and find new bad blocks. +> + +my point was that you cannot assume an linear correlation between block +number and physical location, since the bad blocks will be mapped all +over the place. + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +--Apple-Mail-19--17255361 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +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/11fZU8wggNAMIICqaADAgECAgMOah8wDQYJKoZI +hvcNAQEEBQAwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkp +IEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1 +MDQwNTIwMzEzMloXDTA2MDQwNTIwMzEzMlowgYoxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBN +ZW1iZXIxHjAcBgkqhkiG9w0BCQEWD3ZpdmVrQGtoZXJhLm9yZzEgMB4GCSqGSIb3DQEJARYRa2hl +cmFAa2NpbGluay5jb20xJTAjBgkqhkiG9w0BCQEWFnZpdmVrQG1haWxlcm1haWxlci5jb20wggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdo7hywGcY0VvK6WqqXXV77MS/t/4X3WkCaCXo +RSl2W58GP4P21hodPn7hlIxUoDOW7x9O+FbqTgE2Ejqr6yA00Mm90tGPFgjFjqPGAqg7xk6IDcv9 +uTyMia/FKEHSIynM6zqokXY8JklvdbJOiByE/8VeyEXOANWiflo8o4+GHnhMKpA9982YTXUqeKU6 +mMQVaLCBRjTDc7j2XkMC/UNcp2HMyDQdTqYVnhLxbvbLX8CNDBY/7OWFlB9evru46SpGWhe4lhv5 +DSgE2RdCKvDytzxRDvP49L8V0TnFjAVeC1C1Pj0/KQsoL/AP4APplROiD4QaUhshQl28pXxJtfbl +AgMBAAGjVzBVMEUGA1UdEQQ+MDyBD3ZpdmVrQGtoZXJhLm9yZ4ERa2hlcmFAa2NpbGluay5jb22B +FnZpdmVrQG1haWxlcm1haWxlci5jb20wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQAr +CWop3h28qPwofzLrkoT410J4d7Bqk6FLeVlKZfg/wXlS1MTqYMNcCm4x+JsJbjwsO0fb2elFIuGq +1razoSzPpgi89itydvUT0U0U/u+AkZA5rW4AptTpMZ70YW5u9wzkcvmifqZmcfbaaeGdZfruzUXZ +6qvdXDpNb3ZHeQw6PjGCAucwggLjAgEBMGkwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0 +ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFp +bCBJc3N1aW5nIENBAgMOah8wCQYFKw4DAhoFAKCCAVMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH +ATAcBgkqhkiG9w0BCQUxDxcNMDUwNDE1MTYxMDE0WjAjBgkqhkiG9w0BCQQxFgQUSHdW8L6kGaC4 +IvX1cCc68wpaslUweAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh +d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAbuGbHSDhZeGC +hYr0ydA8DM5IUDrOP+1k5W+vpwoF037rIuIHe8ivfRXABjIB5d3VAFmZUYVFqrnvVe01hqVdqhmy +BpUkog218TRcGX5DISb9C4chWjep6OaA8pws8LWcOQKmVGxN7gqK1PqyMMvv3ccNS8o9u0wu7eKA +wzG79A/MJwqFb4KJDzr1WjPgQ1bNdcT8jN9nWsieDhHSKkcop6O6gy4jQpzLMQpjoSvemMfzTc+O +9UDXz3fcGknukRwTSXtiq+mY8a5md8w8HBZ7UFWWivHEyt7rSfjhqy/5+mZdW7da1CWt+/u9hsq1 +uosJODK1aPx6etvAsQvE5VLQegAAAAAAAA== + +--Apple-Mail-19--17255361-- + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 13:17:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B45BD53771 + for ; + Fri, 15 Apr 2005 13:17:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72524-02 + for ; + Fri, 15 Apr 2005 16:16:56 +0000 (GMT) +Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 72A9B53758 + for ; + Fri, 15 Apr 2005 13:16:55 -0300 (ADT) +Received: from localhost (morework [127.0.0.1]) + by morework.geizhals.at (Postfix) with ESMTP id 1A352DEE72; + Fri, 15 Apr 2005 18:16:53 +0200 (CEST) +Received: from [172.16.42.166] (unknown [172.16.42.166]) + by morework.geizhals.at (Postfix) with ESMTP; + Fri, 15 Apr 2005 18:16:52 +0200 (CEST) +Message-ID: <425FE8F3.5010604@geizhals.at> +Date: Fri, 15 Apr 2005 18:16:51 +0200 +From: Marinos Yannikos +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alex Turner +Cc: "Joshua D. Drake" , + "Mohan, Ross" , pgsql-performance@postgresql.org +Subject: Re: Intel SRCS16 SATA raid? (somewhat OT) +References: + <425E9DE2.7030005@commandprompt.com> <425FA27A.8010705@geizhals.at> + <33c6269f05041507437f3e8db3@mail.gmail.com> +In-Reply-To: <33c6269f05041507437f3e8db3@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/356 +X-Sequence-Number: 11753 + +Alex Turner wrote: +> No offense to that review, but it was really wasn't that good, and +> drew bad conclusions from the data. I posted it originaly and +> immediately regretted it. +> +> See http://www.tweakers.net/reviews/557/18 +> +> Amazingly the controller with 1Gig cache manages a write throughput of +> 750MB/sec on a single drive. +> +> quote: +> "Floating high above the crowd, the ARC-1120 has a perfect view on the +> struggles of the other adapters. " +> +> It's because the adapter has 1Gig of RAM, nothing to do with the RAID +> architecture, it's clearly caching the entire dataset. The drive +> can't physicaly run that fast. These guys really don't know what they +> are doing. + +Perhaps you didn't read the whole page. It says right at the beginning: + +"Because of its simplicity and short test duration, the ATTO Disk +Benchmark is used a lot for comparing the 'peformance' of hard disks. +The tool measures the sequential transfer rate of a partition using a +test length of 32MB at most. Because of this small dataset, ATTO is +unsuitable for measuring media transfer rates of intelligent +RAID-adapters which are equipped with cache memory. The smart RAID +adapters will serve the requested data directly from their cache, as a +result of which the results have no relationship to the media transfer +rates of these cards. For this reason ATTO is an ideal tool to test the +cache transfer rates of intelligent RAID-adapters." + +Therefore, the results on this page are valid - they're supposed to show +the cache/transfer speed, the dataset is 32MB(!) and should fit in the +caches of all cards. + +> See also: +> http://www20.tomshardware.com/storage/20041227/areca-raid6-06.html +> +> I trust toms hardware a little more to set up a good review to be honest. + +I don't, for many (historical) reasons. + +> The 3ware trounces the Areca in all IO/sec test. + +Maybe, but with no mention of stripe size and other configuration +details, this is somewhat suspicious. I'll be able to offer benchmarks +for the 8506-8 vs. the 1120 shortly (1-2 weeks), if you're interested +(pg_bench, for example, to be a bit more on-topic). + +Regards, + Marinos + +From pgsql-performance-owner@postgresql.org Fri Apr 15 13:18:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F4175374F + for ; + Fri, 15 Apr 2005 13:18:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70965-08 + for ; + Fri, 15 Apr 2005 16:18:44 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id B9DA653757 + for ; + Fri, 15 Apr 2005 13:18:42 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3FGIblO010875 + for ; Fri, 15 Apr 2005 16:18:37 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3FGIbtH010871 + for ; Fri, 15 Apr 2005 16:18:37 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How to Improve + w/7K$? +Date: Fri, 15 Apr 2005 16:17:46 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How to Improve + w/7K$? +Thread-Index: AcVBzy3eIwTH0Y5uTqC5aqK8nWASqAAAgL4A +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.17 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/357 +X-Sequence-Number: 11754 + + +Sorry to blend threads, but in my kinda longish, somewhat thankless,=20 +essentially anonymous, and quite average career as a dba, I have=20 +found that the 7K would be best spent on a definitive end-to-end +"application critical path" test (pretty easy to instrument apps +and lash on test harnesses these days).=20 + + +If it's "the disk subsystem", then by all means, spend the 7K there.=20 + +If the "7K$" is for "hardware only", then disk is always a good choice. = +For +a really small shop, maybe it's an upgrade to a dual CPU opteron MOBO, = +eg.=20 +dunno. + +If, however, in the far-more-likely case that the application code +or system/business process is the throttle point, it'd be a great +use of money to have a test report showing that to the "higher ups".=20 +That's where the best scalability bang-for-buck can be made.=20 + + +- Ross + +p.s. having said this, and as already been noted "7K" ain't + going to buy that much....maybe the ability to go RAID 10? + =20 +p.p.s Why don't we start a PGSQL-7K listserv, to handle this EPIC = +thread? :-) + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of = +Richard_D_Levine@raytheon.com +Sent: Friday, April 15, 2005 11:20 AM +To: Alex Turner +Cc: Dave Held; pgsql-performance@postgresql.org; = +pgsql-performance-owner@postgresql.org +Subject: Re: [PERFORM] Intel SRCS16 SATA raid? + + +This is a different thread that the $7k server thread. +Greg Stark started it and wrote: + =20 + "I'm also wondering about whether I'm better off with one of these=20 + SATA raid =20 + controllers or just going with SCSI drives." =20 + =20 + =20 + +Rick + +pgsql-performance-owner@postgresql.org wrote on 04/15/2005 10:01:56 AM: + +> The original thread was how much can I get for $7k +> +> You can't fit a 15k RPM SCSI solution into $7K ;) Some of us are ona +budget! +> +> 10k RPM SATA drives give acceptable performance at a good price, thats = + +> really the point here. +> +> I have never really argued that SATA is going to match SCSI=20 +> performance on multidrive arrays for IO/sec. But it's all about the=20 +> benjamins baby. If I told my boss we need $25k for a database=20 +> machine, he'd tell me that was impossible, and I have $5k to do it. If = + +> I tell him $7k - he will swallow that. We don't _need_ the amazing=20 +> performance of a 15k RPM drive config. Our biggest hit is reads, so=20 +> we can buy 3xSATA machines and load balance. It's all about the=20 +> application, and buying what is appropriate. I don't buy a Corvette=20 +> if all I need is a malibu. +> +> Alex Turner +> netEconomist +> +> On 4/15/05, Dave Held wrote: +> > > -----Original Message----- +> > > From: Alex Turner [mailto:armtuk@gmail.com] +> > > Sent: Thursday, April 14, 2005 6:15 PM +> > > To: Dave Held +> > > Cc: pgsql-performance@postgresql.org +> > > Subject: Re: [PERFORM] Intel SRCS16 SATA raid? +> > > +> > > Looking at the numbers, the raptor with TCQ enabled was close or=20 +> > > beat the Atlas III 10k drive on most benchmarks. +> > +> > And I would be willing to bet that the Atlas 10k is not using the=20 +> > same generation of technology as the Raptors. +> > +> > > Naturaly a 15k drive is going to be faster in many areas, but it=20 +> > > is also much more expensive. It was only 44% better on the server = + +> > > tests than the raptor with TCQ, but it costs nearly 300% more=20 +> > > ($538 cdw.com, $180 newegg.com). +> > +> > State that in terms of cars. Would you be willing to pay 300% more=20 +> > for a car that is 44% faster than your competitor's? Of course you=20 +> > would, because we all recognize that the cost of speed/performance=20 +> > does not scale linearly. Naturally, you buy the best speed that you = + +> > can afford, but when it comes to hard drives, the only major feature = + +> > whose price tends to scale anywhere close to linearly is capacity. +> > +> > > Note also that the 15k drive was the only drive that kept up with=20 +> > > the raptor on raw transfer speed, which is going to matter for=20 +> > > WAL. +> > +> > So get a Raptor for your WAL partition. ;) +> > +> > > [...] +> > > The Raptor drives can be had for as little as $180/ea, which is=20 +> > > quite a good price point considering they can keep up with their=20 +> > > SCSI 10k RPM counterparts on almost all tests with NCQ enabled=20 +> > > (Note that 3ware controllers _don't_ support NCQ, although they=20 +> > > claim their HBA based queueing is 95% as good as NCQ on the=20 +> > > drive). +> > +> > Just keep in mind the points made by the Seagate article. You're=20 +> > buying much more than just performance for that $500+. You're also=20 +> > buying vibrational tolerance, high MTBF, better internal=20 +> > environmental controls, and a pretty significant margin on seek=20 +> > time, which is probably your most important feature for disks=20 +> > storing tables. An interesting test would be to stick several drives = + +> > in a cabinet and graph how performance is affected at the different=20 +> > price points/ technologies/number of drives. +> > +> > __ +> > David B. Held +> > Software Engineer/Array Services Group +> > 200 14th Ave. East, Sartell, MN 56377 +> > 320.534.3637 320.253.7800 800.752.8129 +> > +> > ---------------------------(end of +broadcast)--------------------------- +> > TIP 3: if posting/reading through Usenet, please send an appropriate +> > subscribe-nomail command to majordomo@postgresql.org so that = +your +> > message can get through to the mailing list cleanly +> > +> +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings + + +---------------------------(end of broadcast)--------------------------- +TIP 5: Have you checked our extensive FAQ? + + http://www.postgresql.org/docs/faq + +From pgsql-performance-owner@postgresql.org Fri Apr 15 15:01:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E9F54537AD + for ; + Fri, 15 Apr 2005 15:01:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06786-01 + for ; + Fri, 15 Apr 2005 18:01:50 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 062B6537A7 + for ; + Fri, 15 Apr 2005 15:01:49 -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 1DMV8P-0004S7-00; Fri, 15 Apr 2005 14:01:41 -0400 +To: Tom Lane +Cc: Kevin Brown , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> + <20050414055655.GB19518@filer> <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> <28523.1113532916@sss.pgh.pa.us> +In-Reply-To: <28523.1113532916@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 15 Apr 2005 14:01:41 -0400 +Message-ID: <87sm1rdim2.fsf@stark.xeocode.com> +Lines: 38 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/358 +X-Sequence-Number: 11755 + +Tom Lane writes: + +> Yes, you can probably assume that blocks with far-apart numbers are +> going to require a big seek, and you might even be right in supposing +> that a block with an intermediate number should be read on the way. +> But you have no hope at all of making the right decisions at a more +> local level --- say, reading various sectors within the same cylinder +> in an optimal fashion. You don't know where the track boundaries are, +> so you can't schedule in a way that minimizes rotational latency. +> You're best off to throw all the requests at the drive together and +> let the drive sort it out. + +Consider for example three reads, one at the beginning of the disk, one at the +very end, and one in the middle. If the three are performed in the logical +order (assuming the head starts at the beginning), then the drive has to seek, +say, 4ms to get to the middle and 4ms to get to the end. + +But if the middle block requires a full rotation to reach it from when the +head arrives that adds another 8ms of rotational delay (assuming a 7200RPM +drive). + +Whereas the drive could have seeked over to the last block, then seeked back +in 8ms and gotten there just in time to perform the read for free. + + +I'm not entirely convinced this explains all of the SCSI drives' superior +performance though. The above is about a worst-case scenario. should really +only have a small effect, and it's not like the drive firmware can really +schedule things perfectly either. + + +I think most of the difference is that the drive manufacturers just don't +package their high end drives with ATA interfaces. So there are no 10k RPM ATA +drives and no 15k RPM ATA drives. I think WD is making fast SATA drives but +most of the manufacturers aren't even doing that. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 15:12:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 846DB538BC + for ; + Fri, 15 Apr 2005 15:12:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08816-03 + for ; + Fri, 15 Apr 2005 18:12:19 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A4DA53853 + for ; + Fri, 15 Apr 2005 15:12:18 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Fri, 15 Apr 2005 11:15:18 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Fri, 15 Apr 2005 11:15:16 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005041511151604449 + for ; + Fri, 15 Apr 2005 11:15:16 -0700 +X-ASG-Debug-ID: 1113588734-32253-7-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail1 (mail1.hq.corp [192.168.160.5]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 4B1EA200D0F6 + for ; + Fri, 15 Apr 2005 11:12:14 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Fri, 15 Apr 2005 11:15:11 -0700 +Message-ID: <426003DC.2020008@sfnet.cc> +Date: Fri, 15 Apr 2005 11:11:40 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Mohan, Ross" +Cc: pgsql-performance@postgresql.org +X-ASG-Orig-Subj: Re: [PERFORM] Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? + and How to Improve w/7K$? +Subject: Re: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How +References: +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 15 Apr 2005 18:15:11.0809 (UTC) + FILETIME=[1062D310:01C541E7] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.313 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5006] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.181 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/359 +X-Sequence-Number: 11756 + +Ross, + +I agree with you, but I' am the lowly intergrator/analyst, I have to solve the problem without all +the authority (sounds like a project manager). I originally started this thread since I had the $7k budget. + +I am not a dba/developer. but I play one on t.v., so I can only assume that throwing money +at the application code means one understand what the bottleneck in the code and what it takes to fix it. + +In this situation, the code is hidden by the vendor that connects to the database. So, besides persisent requests of the vendor to improve the area of the application, the balance of tuning lies with the hardware. The answer is *both* hardware and application code. Finding the right balance is key. Your mileage may vary. + +Steve Poe + + + + +>If, however, in the far-more-likely case that the application code +>or system/business process is the throttle point, it'd be a great +>use of money to have a test report showing that to the "higher ups". +>That's where the best scalability bang-for-buck can be made. + + +- Ross + +>p.s. having said this, and as already been noted "7K" ain't +> going to buy that much....maybe the ability to go RAID 10? + +>p.p.s Why don't we start a PGSQL-7K listserv, to handle this EPIC thread? :-) + + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 15:15:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C82AA53853 + for ; + Fri, 15 Apr 2005 15:15:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08071-10 + for ; + Fri, 15 Apr 2005 18:15:15 +0000 (GMT) +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D4A853918 + for ; + Fri, 15 Apr 2005 15:15:14 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF000M1F2PEVYY8@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Fri, 15 Apr 2005 13:15:15 -0500 (CDT) +Date: Fri, 15 Apr 2005 14:15:15 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: <2799.1113573966@sss.pgh.pa.us> +To: "'Tom Lane'" +Cc: "'Dave Held'" , + "'PERFORM'" +Message-id: <000001c541e7$133f3f10$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/360 +X-Sequence-Number: 11757 + + + +Joel Fradkin +=20 +Turning off merg joins seems to of done it but what do I need to do so I = +am +not telling the system explicitly not to use them, I must be missing = +some +setting? + +On linux box. + +explain analyze select * from viwassoclist where clientnum =3D'SAKS' + +"Hash Join (cost=3D988.25..292835.36 rows=3D15773 width=3D113) (actual +time=3D23.514..3024.064 rows=3D160593 loops=3D1)" +" Hash Cond: ("outer".locationid =3D "inner".locationid)" +" -> Hash Left Join (cost=3D185.57..226218.77 rows=3D177236 = +width=3D75) (actual +time=3D21.147..2221.098 rows=3D177041 loops=3D1)" +" Hash Cond: (("outer".jobtitleid =3D "inner".id) AND +(("outer".clientnum)::text =3D ("inner".clientnum)::text))" +" -> Seq Scan on tblassociate a (cost=3D0.00..30851.25 = +rows=3D177236 +width=3D53) (actual time=3D0.390..1095.385 rows=3D177041 loops=3D1)" +" Filter: ((clientnum)::text =3D 'SAKS'::text)" +" -> Hash (cost=3D152.55..152.55 rows=3D6604 width=3D37) = +(actual +time=3D20.609..20.609 rows=3D0 loops=3D1)" +" -> Seq Scan on tbljobtitle jt (cost=3D0.00..152.55 = +rows=3D6604 +width=3D37) (actual time=3D0.033..12.319 rows=3D6603 loops=3D1)" +" Filter: (1 =3D presentationid)" +" -> Hash (cost=3D801.54..801.54 rows=3D454 width=3D49) (actual +time=3D2.196..2.196 rows=3D0 loops=3D1)" +" -> Index Scan using ix_location on tbllocation l +(cost=3D0.00..801.54 rows=3D454 width=3D49) (actual time=3D0.111..1.755 = +rows=3D441 +loops=3D1)" +" Index Cond: ('SAKS'::text =3D (clientnum)::text)" +"Total runtime: 3120.366 ms" + +here are the table defs and view if that helps. I posted the config a = +while +back, but can do it again if you need to see it. + +CREATE OR REPLACE VIEW viwassoclist AS=20 + SELECT a.clientnum, a.associateid, a.associatenum, a.lastname, = +a.firstname, +jt.value AS jobtitle, l.name AS "location", l.locationid AS = +mainlocationid, +l.divisionid, l.regionid, l.districtid, (a.lastname::text || ', '::text) = +|| +a.firstname::text AS assocname, a.isactive, a.isdeleted + FROM tblassociate a + LEFT JOIN tbljobtitle jt ON a.jobtitleid =3D jt.id AND = +jt.clientnum::text =3D +a.clientnum::text AND 1 =3D jt.presentationid + JOIN tbllocation l ON a.locationid =3D l.locationid AND = +l.clientnum::text =3D +a.clientnum::text; + +CREATE TABLE tblassociate +( + clientnum varchar(16) NOT NULL, + associateid int4 NOT NULL, + associatenum varchar(10), + firstname varchar(50), + middleinit varchar(5), + lastname varchar(50), + ssn varchar(18), + dob timestamp, + address varchar(100), + city varchar(50), + state varchar(50), + country varchar(50), + zip varchar(10), + homephone varchar(14), + cellphone varchar(14), + pager varchar(14), + associateaccount varchar(50), + doh timestamp, + dot timestamp, + rehiredate timestamp, + lastdayworked timestamp, + staffexecid int4, + jobtitleid int4, + locationid int4, + deptid int4, + positionnum int4, + worktypeid int4, + sexid int4, + maritalstatusid int4, + ethnicityid int4, + weight float8, + heightfeet int4, + heightinches int4, + haircolorid int4, + eyecolorid int4, + isonalarmlist bool NOT NULL DEFAULT false, + isactive bool NOT NULL DEFAULT true, + ismanager bool NOT NULL DEFAULT false, + issecurity bool NOT NULL DEFAULT false, + createdbyid int4, + isdeleted bool NOT NULL DEFAULT false, + militarybranchid int4, + militarystatusid int4, + patrontypeid int4, + identificationtypeid int4, + workaddress varchar(200), + testtypeid int4, + testscore int4, + pin int4, + county varchar(50), + CONSTRAINT pk_tblassociate PRIMARY KEY (clientnum, associateid), + CONSTRAINT ix_tblassociate UNIQUE (clientnum, associatenum) +) +CREATE TABLE tbljobtitle +( + clientnum varchar(16) NOT NULL, + id int4 NOT NULL, + value varchar(50), + code varchar(16), + isdeleted bool DEFAULT false, + presentationid int4 NOT NULL DEFAULT 1, + CONSTRAINT pk_tbljobtitle PRIMARY KEY (clientnum, id, presentationid) +) +CREATE TABLE tbllocation +( + clientnum varchar(16) NOT NULL, + locationid int4 NOT NULL, + districtid int4 NOT NULL, + regionid int4 NOT NULL, + divisionid int4 NOT NULL, + locationnum varchar(8), + name varchar(50), + clientlocnum varchar(50), + address varchar(100), + address2 varchar(100), + city varchar(50), + state varchar(2) NOT NULL DEFAULT 'zz'::character varying, + zip varchar(10), + countryid int4, + phone varchar(15), + fax varchar(15), + payname varchar(40), + contact char(36), + active bool NOT NULL DEFAULT true, + coiprogram text, + coilimit text, + coiuser varchar(255), + coidatetime varchar(32), + ec_note_field varchar(1050), + locationtypeid int4, + open_time timestamp, + close_time timestamp, + insurance_loc_id varchar(50), + lpregionid int4, + sic int4, + CONSTRAINT pk_tbllocation PRIMARY KEY (clientnum, locationid), + CONSTRAINT ix_tbllocation_1 UNIQUE (clientnum, locationnum, name), + CONSTRAINT ix_tbllocation_unique_number UNIQUE (clientnum, divisionid, +regionid, districtid, locationnum) +) + +It strikes me as odd that the thing isn't considering hash joins for +at least some of these steps. Can you force it to (by setting +enable_mergejoin off)? If not, what are the datatypes of the join +columns exactly? + + regards, tom lane + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 15:27:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CC89553431 + for ; + Fri, 15 Apr 2005 15:27:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12122-07 + for ; + Fri, 15 Apr 2005 18:27:14 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id BE7D95339D + for ; + Fri, 15 Apr 2005 15:27:12 -0300 (ADT) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j3FIj9Bw005839 + for ; Fri, 15 Apr 2005 18:45:10 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j3FIj6dI005797; + Fri, 15 Apr 2005 18:45:08 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Fri, 15 Apr 2005 18:26:57 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVB5ZZTju4oigYeQ52pq3CHzFZzaAAAl6oQ +From: "Mohan, Ross" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.164 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/361 +X-Sequence-Number: 11758 + +Greg, et al.=20 + +I never found any evidence of a "stop and get an intermediate request" +functionality in the TCQ protocol.=20 + +IIRC, what is there is + +1) Ordered +2) Head First +3) Simple + +implemented as choices. *VERY* roughly, that'd be like +(1) disk subsystem satisfies requests as submitted, (2) let's +the "this" request be put at the very head of the per se disk +queue after the currently-running disk request is complete, and +(3) is "let the per se disk and it's software reorder the requests +on-hand as per it's onboard software". (N.B. in the last, it's +the DISK not the controller making those decisions). (N.B. too, that +this last is essentially what NCQ (cf. TCQ) is doing ) + +I know we've been batting around a hypothetical case of SCSI +where it "stops and gets smth. on the way", but I can find +no proof (yet) that this is done, pro forma, by SCSI drives.=20 + +In other words, SCSI is a necessary, but not sufficient cause +for intermediate reading.=20 + +FWIW + +- Ross + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Greg Stark +Sent: Friday, April 15, 2005 2:02 PM +To: Tom Lane +Cc: Kevin Brown; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +Tom Lane writes: + +> Yes, you can probably assume that blocks with far-apart numbers are=20 +> going to require a big seek, and you might even be right in supposing=20 +> that a block with an intermediate number should be read on the way.=20 +> But you have no hope at all of making the right decisions at a more=20 +> local level --- say, reading various sectors within the same cylinder=20 +> in an optimal fashion. You don't know where the track boundaries are, = + +> so you can't schedule in a way that minimizes rotational latency.=20 +> You're best off to throw all the requests at the drive together and=20 +> let the drive sort it out. + +Consider for example three reads, one at the beginning of the disk, one = +at the very end, and one in the middle. If the three are performed in = +the logical order (assuming the head starts at the beginning), then the = +drive has to seek, say, 4ms to get to the middle and 4ms to get to the = +end. + +But if the middle block requires a full rotation to reach it from when = +the head arrives that adds another 8ms of rotational delay (assuming a = +7200RPM drive). + +Whereas the drive could have seeked over to the last block, then seeked = +back in 8ms and gotten there just in time to perform the read for free. + + +I'm not entirely convinced this explains all of the SCSI drives' = +superior performance though. The above is about a worst-case scenario. = +should really only have a small effect, and it's not like the drive = +firmware can really schedule things perfectly either. + + +I think most of the difference is that the drive manufacturers just = +don't package their high end drives with ATA interfaces. So there are no = +10k RPM ATA drives and no 15k RPM ATA drives. I think WD is making fast = +SATA drives but most of the manufacturers aren't even doing that. + +--=20 +greg + + +---------------------------(end of broadcast)--------------------------- +TIP 8: explain analyze is your friend + +From pgsql-performance-owner@postgresql.org Fri Apr 15 17:41:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 397D6540C0 + for ; + Fri, 15 Apr 2005 17:41:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52608-07 + for ; + Fri, 15 Apr 2005 20:40:57 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id B6566540B9 + for ; + Fri, 15 Apr 2005 17:40:55 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3FKet9g021529 + for pgsql-performance@postgresql.org; Fri, 15 Apr 2005 22:40:55 +0200 +Date: Fri, 15 Apr 2005 22:40:55 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: Re: clear function cache (WAS: SQL function inlining) +Message-ID: <20050415204055.GA20345@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +References: + <7635.1111596928@sss.pgh.pa.us> + <20050324133248.GB31203@nibiru.borg.metux.de> + <20050324134240.GD20726@dcc.uchile.cl> + <20050324141233.GA933@nibiru.borg.metux.de> + <20050324065516.P34192@megazone.bigpanda.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050324065516.P34192@megazone.bigpanda.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/362 +X-Sequence-Number: 11759 + +* Stephan Szabo wrote: +> +> On Thu, 24 Mar 2005, Enrico Weigelt wrote: +> +> > * Alvaro Herrera wrote: +> > > On Thu, Mar 24, 2005 at 02:32:48PM +0100, Enrico Weigelt wrote: +> > > +> > > > BTW: is it possible to explicitly clear the cache for immutable +> > > > functions ? +> > > +> > > What cache? There is no caching of function results. +> > +> > Not ? So what's immutable for ? +> +> For knowing that you can do things like use it in a functional index and +> I think for things like constant folding in a prepared plan. + +So when can I expect the function to be reevaluated ? +Next query ? Next session ? Random time ? + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de + cellphone: +49 174 7066481 +--------------------------------------------------------------------- + -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 15 17:44:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A05F753799 + for ; + Fri, 15 Apr 2005 17:44:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53219-06 + for ; + Fri, 15 Apr 2005 20:43:57 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 98FE3540C0 + for ; + Fri, 15 Apr 2005 17:43:57 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1047327wra + for ; + Fri, 15 Apr 2005 13:43:54 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:reply-to:from:to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:x-mimeole:thread-index:message-id; + b=q3e2p92gMVpPlzACwDWxN9M7J1WfkxzncpIdwFarVEDhyjctHnueSYfW4ogiwpLRr6SxQ/z22Nk7hwLZtosdzCCGfyYTZxAEVvaDHOzKz0SH9TyoGWMdSfPmZ3xXS5QTNyKgRvIyaVSvBMEfYR4JY5EBOjxk63GJtjYP+hQh8C8= +Received: by 10.54.46.52 with SMTP id t52mr1975299wrt; + Fri, 15 Apr 2005 13:43:49 -0700 (PDT) +Received: from MATTSPC ([12.216.69.41]) + by mx.gmail.com with ESMTP id 13sm41544wrl.2005.04.15.13.43.48; + Fri, 15 Apr 2005 13:43:49 -0700 (PDT) +Reply-To: +From: "Matthew Nuzum" +To: , "'Steve Poe'" +Subject: Re: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How +Date: Fri, 15 Apr 2005 15:43:47 -0500 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Thread-Index: AcVB+9HYWeMVlR8gQtODyE7UGXxEfQ== +Message-ID: <42602785.602f27fb.2c70.0ad4@mx.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.304 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/363 +X-Sequence-Number: 11760 + +I think there are many people who feel that $7,000 is a good budget for a +database server, me being one. + + * I agree with the threads that more disks are better. + * I also agree that SCSI is better, but can be hard to justify if your +budget is tight, and I have great certainty that 2x SATA drives on a good +controller is better than x SCSI drives for many work loads. + * I also feel that good database design and proper maintenance can be one +of the single biggest performance enhancers available. This can be labor +intensive, however, and sometimes throwing more hardware at a problem is +cheaper than restructuring a db. + +Either way, having a good hardware platform is an excellent place to start, +as much of your tuning will depend on certain aspects of your hardware. + +So if you need a db server, and you have $7k to spend, I'd say spend it. +>From this list, I've gathered that I/O and RAM are your two most important +investments. + +Once you get that figured out, you can still do some performance tuning on +your new server using the excellent advice from this mailing list. + +By the way, for all those who make this list work, I've rarely found such a +thorough, helpful and considerate group of people as these on the +performance list. + +-- +Matthew Nuzum +www.followers.net - Makers of "Elite Content Management System" +View samples of Elite CMS in action by visiting +http://www.followers.net/portfolio/ + + + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 17:56:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 027145388C + for ; + Fri, 15 Apr 2005 17:55:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58384-05 + for ; + Fri, 15 Apr 2005 20:55:13 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 33ED65388A + for ; + Fri, 15 Apr 2005 17:55:11 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3FKtCIL024210 + for pgsql-performance@postgresql.org; Fri, 15 Apr 2005 22:55:12 +0200 +Date: Fri, 15 Apr 2005 22:55:11 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: immutable functions vs. join for lookups ? +Message-ID: <20050415205511.GB20345@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/364 +X-Sequence-Number: 11761 + + +Hi folks, + +I like to use (immutable) functions for looking up serveral +(almost constant) things, i.e fetching a username by id. +This makes my queries more clear. + +But is this really performant ? + +Lets imagine: + +We've got an table with user accounts (uid,name,...). Then we've +got another one which contains some items assigned to users, and +so are linked to them by an uid field. +Now want to view the items with usernames instead of just uid: + +a) SELECT items.a, items.b, ..., users.username FROM items, users + WHERE items.uid = users.uid; + +c) CREATE FUNCTION id2username(oid) RETURNS text + LANGUAGE 'SQL' IMMUTABLE AS ' + SELECT username AS RESULT FROM users WHERE uid = $1'; + + SELECT items.a, items.b, ..., id2username(users.uid); + + +Which one is faster with + a) only a few users (<50) + b) many users ( >1k ) +while we have several 10k of items ? + + +thx +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de + cellphone: +49 174 7066481 +--------------------------------------------------------------------- + -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 15 18:02:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CE11540EC + for ; + Fri, 15 Apr 2005 18:02:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60622-07 + for ; + Fri, 15 Apr 2005 21:02:41 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id 58EB2540D2 + for ; + Fri, 15 Apr 2005 18:02:29 -0300 (ADT) +Received: (qmail 32586 invoked from network); 15 Apr 2005 21:02:30 -0000 +Received: from w080.z064003242.bna-tn.dsl.cnc.net (HELO ?192.168.1.22?) + (64.3.242.80) by 0 with SMTP; 15 Apr 2005 21:02:30 -0000 +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Transfer-Encoding: quoted-printable +Message-Id: <2784476415a96bb0912ebca41edb3d84@sitening.com> +Content-Type: text/plain; charset=WINDOWS-1252; format=flowed +To: PgSQL - Performance +From: Thomas F.O'Connell +Subject: pgbench Comparison of 7.4.7 to 8.0.2 +Date: Fri, 15 Apr 2005 16:02:29 -0500 +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/365 +X-Sequence-Number: 11762 + +I'm in the fortunate position of having a newly built database server=20 +that's pre-production. I'm about to run it through the ringer with some=20= + +simulations of business data and logic, but I wanted to post the=20 +results of some preliminary pgbench marking. + +http://www.sitening.com/pgbench.html + +To me, it looks like basic transactional performance is modestly=20 +improved at 8.0 across a variety of metrics. I think this bodes well=20 +for more realistic loads, but I'll be curious to see the results of=20 +some of the simulations. + +I've still got a little bit of preparatory time with this box, so I can=20= + +continue to do some experimentation. + +I'd be curious to see whether these numbers meet developer expectations=20= + +and to see whether the developer and user community have insight into=20 +other pgbench options that would be useful to see. + +Thanks! + +-tfo + +-- +Thomas F. O'Connell +Co-Founder, Information Architect +Sitening, LLC + +Strategic Open Source: Open Your i=99 + +http://www.sitening.com/ +110 30th Avenue North, Suite 6 +Nashville, TN 37203-6320 +615-260-0005= + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 18:13:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8F1B353803 + for ; + Fri, 15 Apr 2005 18:12:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63493-09 + for ; + Fri, 15 Apr 2005 21:12:49 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A1E5C537D4 + for ; + Fri, 15 Apr 2005 18:12:48 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3FLClMQ006777; + Fri, 15 Apr 2005 17:12:48 -0400 (EDT) +To: weigelt@metux.de +Cc: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-reply-to: <20050415205511.GB20345@nibiru.borg.metux.de> +References: <20050415205511.GB20345@nibiru.borg.metux.de> +Comments: In-reply-to Enrico Weigelt + message dated "Fri, 15 Apr 2005 22:55:11 +0200" +Date: Fri, 15 Apr 2005 17:12:47 -0400 +Message-ID: <6776.1113599567@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/366 +X-Sequence-Number: 11763 + +Enrico Weigelt writes: +> c) CREATE FUNCTION id2username(oid) RETURNS text +> LANGUAGE 'SQL' IMMUTABLE AS ' +> SELECT username AS RESULT FROM users WHERE uid = $1'; + +This is simply dangerous. The function is *NOT* immutable (it is +stable though). When ... not if ... your application breaks because +you got the wrong answers, you'll get no sympathy from anyone. + +The correct question to ask was "if I make a stable function like +this, is it likely to be faster than the join?". The answer is +"probably not; at best it will be equal to the join". The best the +planner is likely to be able to do with the function-based query +is equivalent to a nestloop with inner indexscan (assuming there is +an index on users.uid). If that's the best plan then the join case +should find it too ... but if you are selecting a lot of items rows +then it won't be the best plan. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 15 18:23:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BC161537F0 + for ; + Fri, 15 Apr 2005 18:23:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22964-01 + for ; + Fri, 15 Apr 2005 21:23:32 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CBF2539C6 + for ; + Fri, 15 Apr 2005 18:23:32 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3FLNYwd006866; + Fri, 15 Apr 2005 17:23:34 -0400 (EDT) +To: "Thomas F.O'Connell" +Cc: PgSQL - Performance +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +In-reply-to: <2784476415a96bb0912ebca41edb3d84@sitening.com> +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> +Comments: In-reply-to "Thomas F.O'Connell" + message dated "Fri, 15 Apr 2005 16:02:29 -0500" +Date: Fri, 15 Apr 2005 17:23:34 -0400 +Message-ID: <6865.1113600214@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/367 +X-Sequence-Number: 11764 + +"Thomas F.O'Connell" writes: +> http://www.sitening.com/pgbench.html + +You need to run *many* more transactions than that to get pgbench +numbers that aren't mostly noise. In my experience 1000 transactions +per client is a rock-bottom minimum to get repeatable numbers; 10000 per +is better. + +Also, in any run where #clients >= scaling factor, what you're measuring +is primarily contention to update the "branches" rows. Which is not +necessarily a bad thing to check, but it's generally not the most +interesting performance domain (if your app is like that you need to +redesign the app...) + +> To me, it looks like basic transactional performance is modestly +> improved at 8.0 across a variety of metrics. + +That's what I would expect --- we usually do some performance work in +every release cycle, but there was not a huge amount of it for 8.0. + +However, these numbers don't prove much either way. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 15 18:25:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 94FFB537F0 + for ; + Fri, 15 Apr 2005 18:25:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17091-10 + for ; + Fri, 15 Apr 2005 21:25:37 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F37053B83 + for ; + Fri, 15 Apr 2005 18:25:36 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Fri, 15 Apr 2005 14:28:41 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Fri, 15 Apr 2005 14:28:35 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005041514283405044 + for ; + Fri, 15 Apr 2005 14:28:34 -0700 +X-ASG-Debug-ID: 1113600332-10868-0-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail1 (mail1.hq.corp [192.168.160.5]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id BD225200D0FD + for ; + Fri, 15 Apr 2005 14:25:32 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Fri, 15 Apr 2005 14:28:26 -0700 +Message-ID: <42603127.5070108@sfnet.cc> +Date: Fri, 15 Apr 2005 14:24:55 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Thomas F.O'Connell" +Cc: PgSQL - Performance +X-ASG-Orig-Subj: Re: [PERFORM] pgbench Comparison of 7.4.7 to 8.0.2 +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> +In-Reply-To: <2784476415a96bb0912ebca41edb3d84@sitening.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 15 Apr 2005 21:28:26.0547 (UTC) + FILETIME=[0F637030:01C54202] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.316 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5000] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.724 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, NO_DNS_FOR_FROM +X-Spam-Level: +X-Archive-Number: 200504/368 +X-Sequence-Number: 11765 + +Tom, + +People's opinions on pgbench may vary, so take what I say with a grain +of salt. Here are my thoughts: + +1) Test with no less than 200 transactions per client. I've heard with +less than this, your results will vary too much with the direction of +the wind blowing. A high enough value will help rule out some "noise" +factor. If I am wrong, please let me know. + + +2) How is the database going to be used? What percentage will be +read/write if you had to guess? Pgbench is like a TPC-B with will help +guage the potential throughput of your tps. However, it may not stress +the server enough to help you make key performance changes. However, +benchmarks are like statistics...full of lies . + +3) Run not just a couple pgbench runs, but *many* (I do between 20-40 +runs) so you can rule out noise and guage improvement on median results. + +4) Find something that you test OLTP-type transactions. I used OSDB +since it is simple to implement and use. Although OSDL's OLTP testing +will closer to reality. + +Steve Poe + +From pgsql-performance-owner@postgresql.org Fri Apr 15 18:35:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C65453B8A + for ; + Fri, 15 Apr 2005 18:35:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25243-05 + for ; + Fri, 15 Apr 2005 21:35:18 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id C1C0E53BC2 + for ; + Fri, 15 Apr 2005 18:35:16 -0300 (ADT) +Received: from dyn-70-66.tor.dsl.tht.net (dyn-70-66.tor.dsl.tht.net + [134.22.70.66]) by tht.net (Postfix) with ESMTP + id EA7D876A02; Fri, 15 Apr 2005 17:35:20 -0400 (EDT) +Subject: Re: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How +From: Rod Taylor +To: matt@followers.net +Cc: 'Steve Poe' , pgsql-performance@postgresql.org +In-Reply-To: <42602785.602f27fb.2c70.0ad4@mx.gmail.com> +References: <42602785.602f27fb.2c70.0ad4@mx.gmail.com> +Content-Type: text/plain +Date: Fri, 15 Apr 2005 17:33:03 -0400 +Message-Id: <1113600783.3859.408.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/369 +X-Sequence-Number: 11766 + +On Fri, 2005-04-15 at 15:43 -0500, Matthew Nuzum wrote: +> I think there are many people who feel that $7,000 is a good budget for a +> database server, me being one. + +The budget for a database server is usually some %age of the value of +the data within the database or the value of it's availability. Big +budget hardware (well, going from $7k to $100k) often brings more +redundancy and reliability improvement than performance improvement. + +If you're going to lose $100k in business because the database was +unavailable for 12 hours, then kick $75k into the hardware and call a +profit of $25k over 3 years (hardware lifetime is 3 years, catastrophic +failure happens once every 3 or so years...). + +Ditto for backup systems. If the company depends on the data in the +database for it's survival, where bankruptcy or worse would happen as a +result of complete dataloss, then it would be a good idea to invest a +significant amount of the companies revenue into making damn sure that +doesn't happen. Call it an insurance policy. + + +Performance for me dictates which hardware is purchased and +configuration is used within $BUDGET, but $BUDGET itself is nearly +always defined by the value of the data stored. + + +> * I agree with the threads that more disks are better. +> * I also agree that SCSI is better, but can be hard to justify if your +> budget is tight, and I have great certainty that 2x SATA drives on a good +> controller is better than x SCSI drives for many work loads. +> * I also feel that good database design and proper maintenance can be one +> of the single biggest performance enhancers available. This can be labor +> intensive, however, and sometimes throwing more hardware at a problem is +> cheaper than restructuring a db. +> +> Either way, having a good hardware platform is an excellent place to start, +> as much of your tuning will depend on certain aspects of your hardware. +> +> So if you need a db server, and you have $7k to spend, I'd say spend it. +> >From this list, I've gathered that I/O and RAM are your two most important +> investments. +> +> Once you get that figured out, you can still do some performance tuning on +> your new server using the excellent advice from this mailing list. +> +> By the way, for all those who make this list work, I've rarely found such a +> thorough, helpful and considerate group of people as these on the +> performance list. +> +-- + + +From pgsql-performance-owner@postgresql.org Fri Apr 15 19:38:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7508C54073 + for ; + Fri, 15 Apr 2005 19:38:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45233-05 + for ; + Fri, 15 Apr 2005 22:38:21 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E8A753A2F + for ; + Fri, 15 Apr 2005 19:38:20 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3FMc9QN008325; + Fri, 15 Apr 2005 18:38:09 -0400 (EDT) +To: "Joel Fradkin" +Cc: "'Dave Held'" , + "'PERFORM'" +Subject: Re: speed of querry? +In-reply-to: <000001c541e7$133f3f10$797ba8c0@jfradkin> +References: <000001c541e7$133f3f10$797ba8c0@jfradkin> +Comments: In-reply-to "Joel Fradkin" + message dated "Fri, 15 Apr 2005 14:15:15 -0400" +Date: Fri, 15 Apr 2005 18:38:09 -0400 +Message-ID: <8324.1113604689@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/370 +X-Sequence-Number: 11767 + +"Joel Fradkin" writes: +> Turning off merg joins seems to of done it but what do I need to do so I am +> not telling the system explicitly not to use them, I must be missing some +> setting? + +> " -> Hash Left Join (cost=185.57..226218.77 rows=177236 width=75) (actual +> time=21.147..2221.098 rows=177041 loops=1)" +> " Hash Cond: (("outer".jobtitleid = "inner".id) AND +> (("outer".clientnum)::text = ("inner".clientnum)::text))" + +It's overestimating the cost of this join for some reason ... and I +think I see why. It's not accounting for the combined effect of the +two hash clauses, only for the "better" one. What are the statistics +for tbljobtitle.id and tbljobtitle.clientnum --- how many distinct +values of each, and are the distributions skewed to a few popular values? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 15 21:17:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 61589536AA + for ; + Fri, 15 Apr 2005 21:17:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72390-06 + for ; + Sat, 16 Apr 2005 00:17:34 +0000 (GMT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EE3F540CA + for ; + Fri, 15 Apr 2005 21:17:34 -0300 (ADT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by news.hub.org (8.13.1/8.13.1) with ESMTP id j3G0HXVf075229 + for ; Sat, 16 Apr 2005 00:17:33 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.13.1/8.13.1/Submit) id j3G077kN071994 + for pgsql-performance@postgresql.org; Sat, 16 Apr 2005 00:07:07 GMT + (envelope-from news) +From: Ron Mayer +X-Newsgroups: pgsql.performance +Subject: Re: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How +Date: Fri, 15 Apr 2005 17:10:45 -0700 +Organization: Hub.Org Networking Services +Lines: 58 +Message-ID: <42605805.4070603@cheapcomplexdevices.com> +References: <42602785.602f27fb.2c70.0ad4@mx.gmail.com> + <1113600783.3859.408.camel@home> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +To: Rod Taylor +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +In-Reply-To: <1113600783.3859.408.camel@home> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/371 +X-Sequence-Number: 11768 + +Rod Taylor wrote: + > On Fri, 2005-04-15 at 15:43 -0500, Matthew Nuzum wrote: + >> * I agree with the threads that more disks are better. + >> * I also agree that SCSI is better, but can be hard to justify + +Here's another approach to spend $7000 that we're currently +trying.... but it'll only work for certain systems if you can +use load balancing and/or application level partitioning +of your software. + +For $859 you can buy + a Dell SC1425 with (*see footnote) + 2 Xeon 2.8GHz processors (*see footnote) + 1 GB ram + 1 80GB hard drive. (*see footnote) + +Doing the math, it seems I could get 8 of +these systems for that $6870, giving me: + 16 Xeon processors (*see footnote), + 640 GB of disk space spread over 8 spindles + 8 GB of ram + 16 1Gbps network adapters. + + +Despite the non-optimal hardware (* see footnote), the price +of each system and extra redundancy may make up the difference +for some applications. + +For example, I didn't see many other $7000 proposals have +have nearly 10GB of ram, or over a dozen CPUs (even counting +the raid controllers), or over a half a terrabyte of storage , +or capable of 5-10 Gbit/sec of network traffic... The extra +capacity would allow me to have redundancy that would somewhat +make up for the flakier hardware, no raid, etc. + +Thoughts? Over the next couple months I'll be evaluating +a cluster of 4 systems almost exactly as I described (but +with cheaper dual hard drives in each system), for a GIS +system that does lend itself well to application-level +partitioning. + + Ron + +(* footnotes) + Yeah, I know some reports here say that dual Xeons can suck; + but Dell's throwing in the second one for free. + Yeah, I know some reports here say Dells can suck, but it + was easy to get a price quote online, and they're a nice + business partner of ours. + Yeah, I should get 2 hard drives in each system, but Dell + wanting an additional $160 for a 80GB hard drive is not a good deal. + Yeah, I know I'd be better off with 2GB ram, but Dell + wants $400 (half the price of an entire additional + system) for the upgrade from 1GB to 2. + + I also realize that application level partitioning needed + to take advantage of a loose cluster like this is not practical + for many applications. + +From pgsql-performance-owner@postgresql.org Fri Apr 15 21:53:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2494053700 + for ; + Fri, 15 Apr 2005 21:53:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79380-10 + for ; + Sat, 16 Apr 2005 00:53:50 +0000 (GMT) +Received: from rwcrmhc14.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) + by svr1.postgresql.org (Postfix) with ESMTP id ADB2653734 + for ; + Fri, 15 Apr 2005 21:53:48 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc14) with ESMTP + id <20050416005351014005ngd3e>; Sat, 16 Apr 2005 00:53:51 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Fri, 15 Apr 2005 17:53:50 -0700 + id 000C40BE.4260621E.00006540 +Date: Fri, 15 Apr 2005 17:53:50 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050416005350.GF19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> <28523.1113532916@sss.pgh.pa.us> + <20050415050336.GE19518@filer> <29785.1113542934@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <29785.1113542934@sss.pgh.pa.us> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/372 +X-Sequence-Number: 11769 + +Tom Lane wrote: +> Kevin Brown writes: +> > In the case of pure random reads, you'll end up having to wait an +> > average of half of a rotation before beginning the read. +> +> You're assuming the conclusion. The above is true if the disk is handed +> one request at a time by a kernel that doesn't have any low-level timing +> information. If there are multiple random requests on the same track, +> the drive has an opportunity to do better than that --- if it's got all +> the requests in hand. + +True, but see below. Actually, I suspect what matters is if they're +on the same cylinder (which may be what you're talking about here). +And in the above, I was assuming randomly distributed single-sector +reads. In that situation, we can't generically know what the +probability that more than one will appear on the same cylinder +without knowing something about the drive geometry. + + +That said, most modern drives have tens of thousands of cylinders (the +Seagate ST380011a, an 80 gigabyte drive, has 94,600 tracks per inch +according to its datasheet), but much, much smaller queue lengths +(tens of entries, hundreds at most, I'd expect. Hard data on this +would be appreciated). For purely random reads, the probability that +two or more requests in the queue happen to be in the same cylinder is +going to be quite small. + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Fri Apr 15 21:58:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9256A53700 + for ; + Fri, 15 Apr 2005 21:58:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80708-07 + for ; + Sat, 16 Apr 2005 00:58:23 +0000 (GMT) +Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F1FA53210 + for ; + Fri, 15 Apr 2005 21:58:22 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (sccrmhc12) with ESMTP + id <200504160058260120057et7e>; Sat, 16 Apr 2005 00:58:26 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Fri, 15 Apr 2005 17:58:25 -0700 + id 000C40BE.42606331.00006582 +Date: Fri, 15 Apr 2005 17:58:25 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050416005824.GG19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + <20050415020337.GD19518@filer> + <9fde2d603a18b53b5b3f22ad47f3a064@khera.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <9fde2d603a18b53b5b3f22ad47f3a064@khera.org> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/373 +X-Sequence-Number: 11770 + +Vivek Khera wrote: +> +> On Apr 14, 2005, at 10:03 PM, Kevin Brown wrote: +> +> >Now, bad block remapping destroys that guarantee, but unless you've +> >got a LOT of bad blocks, it shouldn't destroy your performance, right? +> > +> +> ALL disks have bad blocks, even when you receive them. you honestly +> think that these large disks made today (18+ GB is the smallest now) +> that there are no defects on the surfaces? + +Oh, I'm not at all arguing that you won't have bad blocks. My +argument is that the probability of any given block read or write +operation actually dealing with a remapped block is going to be +relatively small, unless the fraction of bad blocks to total blocks is +large (in which case you basically have a bad disk). And so the +ability to account for remapped blocks shouldn't itself represent a +huge improvement in overall throughput. + + + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Fri Apr 15 22:33:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 24D9F53660 + for ; + Fri, 15 Apr 2005 22:33:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88542-06 + for ; + Sat, 16 Apr 2005 01:33:29 +0000 (GMT) +Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C0FA52961 + for ; + Fri, 15 Apr 2005 22:33:28 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc12) with ESMTP + id <20050416013332014006gumme>; Sat, 16 Apr 2005 01:33:32 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Fri, 15 Apr 2005 18:33:31 -0700 + id 000C40BE.42606B6B.0000679A +Date: Fri, 15 Apr 2005 18:33:31 -0700 +From: Kevin Brown +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050416013331.GH19518@filer> +Mail-Followup-To: Kevin Brown , + pgsql-performance@postgresql.org +References: + <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> <20050414083608.GC19518@filer> + <37d451f7050414074876acdb82@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <37d451f7050414074876acdb82@mail.gmail.com> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/374 +X-Sequence-Number: 11771 + +Rosser Schwarz wrote: +> while you weren't looking, Kevin Brown wrote: +> +> [reordering bursty reads] +> +> > In other words, it's a corner case that I strongly suspect +> > isn't typical in situations where SCSI has historically made a big +> > difference. +> +> [...] +> +> > But I rather doubt that has to be a huge penalty, if any. When a +> > process issues an fsync (or even a sync), the kernel doesn't *have* to +> > drop everything it's doing and get to work on it immediately. It +> > could easily gather a few more requests, bundle them up, and then +> > issue them. +> +> To make sure I'm following you here, are you or are you not suggesting +> that the kernel could sit on -all- IO requests for some small handful +> of ms before actually performing any IO to address what you "strongly +> suspect" is a "corner case"? + +The kernel *can* do so. Whether or not it's a good idea depends on +the activity in the system. You'd only consider doing this if you +didn't already have a relatively large backlog of I/O requests to +handle. You wouldn't do this for every I/O request. + +Consider this: I/O operations to a block device are so slow compared +with the speed of other (non I/O) operations on the system that the +system can easily wait for, say, a hundredth of the typical latency on +the target device before issuing requests to it and not have any real +negative impact on the system's I/O throughput. A process running on +my test system, a 3 GHz Xeon, can issue a million read system calls +per second (I've measured it. I can post the rather trivial source +code if you're interested). That's the full round trip of issuing the +system call and having the kernel return back. That means that in the +span of a millisecond, the system could receive 1000 requests if the +system were busy enough. If the average latency for a random read +from the disk (including head movement and everything) is 10 +milliseconds, and we decide to delay the issuance of the first I/O +request for a tenth of a millisecond (a hundredth of the latency), +then the system might receive 100 additional I/O requests, which it +could then put into the queue and sort by block address before issuing +the read request. As long as the system knows what the last block +that was requested from that physical device was, it can order the +requests properly and then begin issuing them. Since the latency on +the target device is so high, this is likely to be a rather big win +for overall throughput. + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Sat Apr 16 07:47:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 26ABD53714 + for ; + Sat, 16 Apr 2005 07:47:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43539-06 + for ; + Sat, 16 Apr 2005 10:47:40 +0000 (GMT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BD2B53742 + for ; + Sat, 16 Apr 2005 07:47:40 -0300 (ADT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by news.hub.org (8.13.1/8.13.1) with ESMTP id j3GAlcRJ046337 + for ; Sat, 16 Apr 2005 10:47:39 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.13.1/8.13.1/Submit) id j3GAfBQR045002 + for pgsql-performance@postgresql.org; Sat, 16 Apr 2005 10:41:11 GMT + (envelope-from news) +Date: Sat, 16 Apr 2005 12:45:30 +0200 +From: Hannes Dorbath +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +X-Newsgroups: pgsql.performance +Subject: Re: Query Optimizer Failure / Possible Bug +References: + + <42515478$0$5507$8fe63b2a@news.disputo.net> +In-Reply-To: <42515478$0$5507$8fe63b2a@news.disputo.net> +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +Lines: 161 +Message-ID: <4260e649$0$24290$8fe63b2a@news.disputo.net> +Organization: FirstUseNet Intermedia GmbH +X-Complaints-To: abuse@disputo.de +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/375 +X-Sequence-Number: 11772 + +Some people on the #postgresql irc channel pointed out that it's a known +issue. + +http://www.qaix.com/postgresql-database-development/246-557-select-based-on-function-result-read.shtml + +A more simple testcase is below. Adding OFFSET 0 to the inner query does +indeed fix it in my case. + + +SELECT + tmp.user_id AS foo, + tmp.user_id AS bar, + tmp.user_id AS baz +FROM + ( + SELECT + u.user_id + FROM + users u + ) AS tmp; + + + +Seq Scan on users (cost=0.00..1.53 rows=53 width=4) (actual +time=0.230..0.233 rows=1 loops=1) +Total runtime: 0.272 ms + + +--------------------------- + + +SELECT + tmp.user_id AS foo, + tmp.user_id AS bar, + tmp.user_id AS baz +FROM + ( + SELECT + (SELECT 1) AS user_id + FROM + users u + ) AS tmp; + + + + Seq Scan on users u (cost=0.03..1.56 rows=53 width=0) (actual +time=0.216..0.219 rows=1 loops=1) + InitPlan + -> Result (cost=0.00..0.01 rows=1 width=0) (actual +time=0.004..0.006 rows=1 loops=1) + -> Result (cost=0.00..0.01 rows=1 width=0) (actual +time=0.002..0.004 rows=1 loops=1) + -> Result (cost=0.00..0.01 rows=1 width=0) (actual +time=0.002..0.003 rows=1 loops=1) +Total runtime: 0.270 ms + + +--------------------------- + + +SELECT + tmp.user_id AS foo, + tmp.user_id AS bar, + tmp.user_id AS baz +FROM + ( + SELECT + (SELECT 1) AS user_id + FROM + users u + OFFSET 0 + ) AS tmp; + + +Subquery Scan tmp (cost=0.01..1.03 rows=1 width=4) (actual +time=0.032..0.042 rows=1 loops=1) + -> Limit (cost=0.01..1.02 rows=1 width=0) (actual time=0.026..0.033 +rows=1 loops=1) + InitPlan + -> Result (cost=0.00..0.01 rows=1 width=0) (actual +time=0.003..0.004 rows=1 loops=1) + -> Seq Scan on users u (cost=0.00..1.01 rows=1 width=0) +(actual time=0.022..0.027 rows=1 loops=1) +Total runtime: 0.090 ms + + + + +On 04.04.2005 17:18, Hannes Dorbath wrote: +> Mhh. I have no clue about the internals of PostgreSQL and query planing, +> but to me as user this should really be a thing the optimizer has to +> work out.. +> +> +> On 03.04.2005 10:01, PFC wrote: +> +>> +>> Noticed this problem,too. +>> You can always make the calculation you want done once inside a +>> set returning function so it'll behave like a table, but that's ugly. +>> +>> On Mon, 28 Mar 2005 16:14:44 +0200, Hannes Dorbath +>> wrote: +>> +>>> hm, a few days and not a single reply :| +>>> +>>> any more information needed? test data? simplified test case? anything? +>>> +>>> +>>> thanks +>>> +>>> +>>> Hannes Dorbath wrote: +>>> +>>>> The query and the corresponding EXPLAIN is at +>>>> http://hannes.imos.net/query.txt +>>>> I'd like to use the column q.replaced_serials for multiple +>>>> calculations +>>>> in the SELECT clause, but every time it is referenced there in some way +>>>> the whole query in the FROM clause returning q is executed again. +>>>> This doesn't make sense to me at all and eats performance. +>>>> If this wasn't clear enough, for every +>>>> q.replaced_serials AS some_column +>>>> in the SELECT clause there is new block of +>>>> --------------------------------------------------------------- +>>>> -> Aggregate (cost=884.23..884.23 rows=1 width=0) +>>>> -> Nested Loop (cost=0.00..884.23 rows=1 width=0) +>>>> -> Index Scan using ix_rma_ticket_serials_replace on +>>>> rma_ticket_serials rts (cost=0.00..122.35 +>>>> rows=190 width=4) +>>>> Index Cond: ("replace" = false) +>>>> -> Index Scan using pk_serials on serials s +>>>> (cost=0.00..3.51 rows=1 width=4) +>>>> Index Cond: (s.serial_id = "outer".serial_id) +>>>> Filter: ((article_no = $0) AND (delivery_id = $1)) +>>>> --------------------------------------------------------------- +>>>> in the EXPLAIN result. +>>>> For those who wonder why I do this FROM (SELECT...). I was +>>>> searching for +>>>> a way to use the result of an subselect for multiple calculations in +>>>> the +>>>> SELECT clause and return that calculation results as individual +>>>> columns. +>>>> I tested a bit further and found out that PG behaves the same in +>>>> case q +>>>> is a view. This makes me wonder how efficient the optimizer can work +>>>> with views - or even worse - nested views. +>>>> Tested and reproduced on PG 7.4.1 linux and 8.0.0 win32. +>>>> Thanks in advance, +>>>> Hannes Dorbath +>>> +>>> +>>> +>> +>> +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 5: Have you checked our extensive FAQ? +>> +>> http://www.postgresql.org/docs/faq +>> + +From pgsql-performance-owner@postgresql.org Sun Apr 17 03:06:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 668FF539B4 + for ; + Sun, 17 Apr 2005 03:06:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69137-10 + for ; + Sun, 17 Apr 2005 06:06:06 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F1B6539CB + for ; + Sun, 17 Apr 2005 03:06:04 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3H664KQ024182 + for pgsql-performance@postgresql.org; Sun, 17 Apr 2005 08:06:04 +0200 +Date: Sun, 17 Apr 2005 08:06:04 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +Message-ID: <20050417060603.GA23283@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20050415205511.GB20345@nibiru.borg.metux.de> + <6776.1113599567@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <6776.1113599567@sss.pgh.pa.us> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/376 +X-Sequence-Number: 11773 + +* Tom Lane wrote: +> Enrico Weigelt writes: +> > c) CREATE FUNCTION id2username(oid) RETURNS text +> > LANGUAGE 'SQL' IMMUTABLE AS ' +> > SELECT username AS RESULT FROM users WHERE uid = $1'; +> +> This is simply dangerous. The function is *NOT* immutable (it is +> stable though). When ... not if ... your application breaks because +> you got the wrong answers, you'll get no sympathy from anyone. + +In my case it is immutable. The username never changes. + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de + cellphone: +49 174 7066481 +--------------------------------------------------------------------- + -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sun Apr 17 05:37:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 46A9F53A72 + for ; + Sun, 17 Apr 2005 05:37:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07839-02 + for ; + Sun, 17 Apr 2005 08:37:06 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) + by svr1.postgresql.org (Postfix) with ESMTP id DFD8E53A5E + for ; + Sun, 17 Apr 2005 05:37:05 -0300 (ADT) +Received: by rproxy.gmail.com with SMTP id j1so827206rnf + for ; + Sun, 17 Apr 2005 01:37:07 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=XYh+fpum2wJWLiH97p1Bsosfe6f0nyN4VOHm6kJcwXIClW3//3/GO+D3+CYB8w3XFVrAauQkijT4XvzlhJgJ6o5fdfezqvFQjF4Ylx11AFO/eaNqiSFFEGtcy4y1ty+Gb9h9Qbl9FY5gaX1thcm3N/0qVo6AyIPNvdU7u01aoKg= +Received: by 10.38.82.20 with SMTP id f20mr4790022rnb; + Sun, 17 Apr 2005 01:37:07 -0700 (PDT) +Received: by 10.38.97.29 with HTTP; Sun, 17 Apr 2005 01:37:07 -0700 (PDT) +Message-ID: +Date: Sun, 17 Apr 2005 03:37:07 -0500 +From: Jaime Casanova +Reply-To: Jaime Casanova +To: weigelt@metux.de, pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-Reply-To: <20050417060603.GA23283@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <20050415205511.GB20345@nibiru.borg.metux.de> + <6776.1113599567@sss.pgh.pa.us> + <20050417060603.GA23283@nibiru.borg.metux.de> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.314 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/377 +X-Sequence-Number: 11774 + +On 4/17/05, Enrico Weigelt wrote: +> * Tom Lane wrote: +> > Enrico Weigelt writes: +> > > c) CREATE FUNCTION id2username(oid) RETURNS text +> > > LANGUAGE 'SQL' IMMUTABLE AS ' +> > > SELECT username AS RESULT FROM users WHERE uid =3D $1'; +> > +> > This is simply dangerous. The function is *NOT* immutable (it is +> > stable though). When ... not if ... your application breaks because +> > you got the wrong answers, you'll get no sympathy from anyone. +>=20 +> In my case it is immutable. The username never changes. +>=20 +Even if your data never changes it *can* change so the function should +be at most stable not immutable. + +regards, +Jaime Casanova + +From pgsql-performance-owner@postgresql.org Sun Apr 17 09:55:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 34C945343B + for ; + Sun, 17 Apr 2005 09:55:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65824-05 + for ; + Sun, 17 Apr 2005 12:55:07 +0000 (GMT) +Received: from m-monitor.net (unknown [207.44.134.28]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C47653715 + for ; + Sun, 17 Apr 2005 09:55:07 -0300 (ADT) +Received: (qmail 14901 invoked from network); 17 Apr 2005 12:55:11 -0000 +Received: from 203-206-51-107.dyn.iinet.net.au (HELO ?127.0.0.1?) + (203.206.51.107) by ev1s-207-44-134-28.ev1servers.net with SMTP; + 17 Apr 2005 12:55:10 -0000 +Message-ID: <42625D0F.5050308@meerkatsoft.com> +Date: Sun, 17 Apr 2005 22:56:47 +1000 +From: Alex +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Christopher Browne +Cc: pgsql-performance@postgresql.org +Subject: Re: plperl vs plpgsql +References: <425FAA33.2000008@meerkatsoft.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/378 +X-Sequence-Number: 11775 + +Is there a performance difference between the two? +which of the PL is most widely used. One problem i have with the plpgsql +is that the quoting is really a pain. + + + +Christopher Browne wrote: + +>After takin a swig o' Arrakan spice grog, alex@meerkatsoft.com (Alex) belched out: +> +> +>>i am thinking about swiching to plperl as it seems to me much more +>>flexible and easier to create functions. +>> +>>what is the recommended PL for postgres? or which one is most widely +>>used / most popular? +>>is there a performance difference between plpgsql and plperl ? +>> +>> +> +>If what you're trying to do is "munge text," pl/perl will be a whole +>lot more suitable than pl/pgsql because it has a rich set of text +>mungeing tools and string functions which pl/pgsql lacks. +> +>If you intend to do a lot of work involving reading unmunged tuples +>from this table and that, pl/pgsql provides a much more natural +>syntax, and will probably be a bit faster as the query processor may +>even be able to expand some of the actions, rather than needing to +>treat Perl code as an "opaque blob." +> +>I would definitely be inclined to use the more natural language for +>the given task... +> +> + + + +From pgsql-performance-owner@postgresql.org Sun Apr 17 10:32:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 506EF5372D + for ; + Sun, 17 Apr 2005 10:32:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74298-10 + for ; + Sun, 17 Apr 2005 13:32:45 +0000 (GMT) +Received: from viefep20-int.chello.at (viefep12-int.chello.at [213.46.255.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 11D7B5371B + for ; + Sun, 17 Apr 2005 10:32:42 -0300 (ADT) +Received: from [213.47.56.254] by viefep20-int.chello.at + (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP + id <20050417133245.RECG29474.viefep20-int.chello.at@[213.47.56.254]> + for ; + Sun, 17 Apr 2005 15:32:45 +0200 +Message-ID: <42626575.6040604@foo.at> +Date: Sun, 17 Apr 2005 15:32:37 +0200 +From: Stefan Weiss +Organization: Foo Orbital Operations +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: plperl vs plpgsql +References: <425FAA33.2000008@meerkatsoft.com> + + <42625D0F.5050308@meerkatsoft.com> +In-Reply-To: <42625D0F.5050308@meerkatsoft.com> +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/379 +X-Sequence-Number: 11776 + +On 2005-04-17 14:56, Alex wrote: +> Is there a performance difference between the two? + +As Christopher already pointed out, it depends on what you want to do. +If you're doing some complex string processing, it will be easier (and +in some cases) faster to do in plperl, if you're mainly dealing with +sets, plpgsql will be better suited. + +> which of the PL is most widely used. + +plpgsql. + +> One problem i have with the plpgsql +> is that the quoting is really a pain. + +In current versions of PostgreSQL you can use $$ quoting, which should +make your life easier: +http://www.postgresql.org/docs/8.0/static/plpgsql-structure.html +http://www.postgresql.org/docs/8.0/static/plperl.html + + +HTH, +stefan + +From pgsql-performance-owner@postgresql.org Sun Apr 17 10:57:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A7B8E53475 + for ; + Sun, 17 Apr 2005 10:57:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81850-07 + for ; + Sun, 17 Apr 2005 13:57:11 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id D10F253429 + for ; + Sun, 17 Apr 2005 10:57:10 -0300 (ADT) +Received: from hosting.commandprompt.com (hosting.commandprompt.com + [192.168.1.101]) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3HDpcmb013992; Sun, 17 Apr 2005 06:51:38 -0700 +Date: Sun, 17 Apr 2005 06:51:38 -0700 (PDT) +From: "Joshua D. Drake" +To: Alex +Cc: Christopher Browne , + pgsql-performance@postgresql.org +Subject: Re: plperl vs plpgsql +In-Reply-To: <42625D0F.5050308@meerkatsoft.com> +Message-ID: +References: <425FAA33.2000008@meerkatsoft.com> + + <42625D0F.5050308@meerkatsoft.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.026 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/380 +X-Sequence-Number: 11777 + +On Sun, 17 Apr 2005, Alex wrote: + +> Is there a performance difference between the two? + +Hello, + +It depends on what you are using it for. My experience is that for some +reason plPGSQL is faster when looping but other than that they should +be very similar. + + +> which of the PL is most widely used. One problem i have with the plpgsql is +> that the quoting is really a pain. + +plpgsql but I believe that will change in a short period of time. + +Sincerely, + +Joshua D. Drake + + + +-- +Command Prompt, Inc., Your PostgreSQL solutions company. 503-667-4564 +Custom programming, 24x7 support, managed services, and hosting +Open Source Authors: plPHP, pgManage, Co-Authors: plPerlNG +Reliable replication, Mammoth Replicator - http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Sun Apr 17 17:48:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 64E335356F + for ; + Sun, 17 Apr 2005 17:48:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93896-04 + for ; + Sun, 17 Apr 2005 20:47:58 +0000 (GMT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by svr1.postgresql.org (Postfix) with ESMTP id 624B5534AB + for ; + Sun, 17 Apr 2005 17:47:58 -0300 (ADT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by news.hub.org (8.13.1/8.13.1) with ESMTP id j3HKlwAY096224 + for ; Sun, 17 Apr 2005 20:47:58 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.13.1/8.13.1/Submit) id j3HKQ1nj090961 + for pgsql-performance@postgresql.org; Sun, 17 Apr 2005 20:26:01 GMT + (envelope-from news) +From: "R�diger Herrmann" +X-Newsgroups: pgsql.performance +Subject: refcurosr vs. setof +Date: Sun, 17 Apr 2005 22:05:29 +0200 +Organization: Hub.Org Networking Services +Lines: 16 +Message-ID: +Reply-To: "R�diger Herrmann" +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char FC hex) in message + header 'From': From: "R\374diger Herrmann"... +X-Archive-Number: 200504/381 +X-Sequence-Number: 11778 + +Hello, + +I need to write several PL/pgSQL functions all returning a "result set" wich +can be obtained by a single SELECT statement. +For now the functions are called by a Java application. +Both REFCURSOR and SETOF serve my purpose, but I was wondering if there is a +perfonance difference between the two. The result set can become quite +large. + +I hope not to ask this question the 1001 time, though I couldn't find +anything on the net.. Any hints are welcome. + +Regards +R�diger + + + +From pgsql-performance-owner@postgresql.org Sun Apr 17 20:48:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E32C3534A5 + for ; + Sun, 17 Apr 2005 20:48:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42833-02 + for ; + Sun, 17 Apr 2005 23:47:59 +0000 (GMT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by svr1.postgresql.org (Postfix) with ESMTP id D9A7D534BE + for ; + Sun, 17 Apr 2005 20:47:58 -0300 (ADT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by news.hub.org (8.13.1/8.13.1) with ESMTP id j3HNlw1j043859 + for ; Sun, 17 Apr 2005 23:47:58 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.13.1/8.13.1/Submit) id j3HNJrao037041 + for pgsql-performance@postgresql.org; Sun, 17 Apr 2005 23:19:53 GMT + (envelope-from news) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: plperl vs plpgsql +Date: Sun, 17 Apr 2005 19:17:18 -0400 +Organization: cbbrowne Computing Inc +Lines: 69 +Message-ID: +References: <425FAA33.2000008@meerkatsoft.com> + + <42625D0F.5050308@meerkatsoft.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:T/n4E6byNycla0RI6upuGOjRnaU= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/382 +X-Sequence-Number: 11779 + +After a long battle with technology, alex@meerkatsoft.com (Alex), an earthling, wrote: +> Christopher Browne wrote: +>>After takin a swig o' Arrakan spice grog, alex@meerkatsoft.com (Alex) belched out: +>>>i am thinking about swiching to plperl as it seems to me much more +>>>flexible and easier to create functions. +>>> +>>>what is the recommended PL for postgres? or which one is most widely +>>>used / most popular? +>>>is there a performance difference between plpgsql and plperl ? +>>> +>>> +>> +>>If what you're trying to do is "munge text," pl/perl will be a whole +>>lot more suitable than pl/pgsql because it has a rich set of text +>>mungeing tools and string functions which pl/pgsql lacks. +>> +>>If you intend to do a lot of work involving reading unmunged tuples +>>from this table and that, pl/pgsql provides a much more natural +>>syntax, and will probably be a bit faster as the query processor may +>>even be able to expand some of the actions, rather than needing to +>>treat Perl code as an "opaque blob." +>> +>>I would definitely be inclined to use the more natural language for +>>the given task... + +> Is there a performance difference between the two? +> which of the PL is most widely used. One problem i have with the +> plpgsql is that the quoting is really a pain. + +You seem to be inclined to play the mistaken game of "Which language +is the fastest?" which encourages myopic use of bad benchmarks. + +In 8.0, quoting in pl/pgsql is less of a pain, as you can use $$ as +the begin/end indicators. + +Performance will always depend on what you're doing. + +- If you doing heavy amounts of "text munging," Perl has highly + optimized library routines that you're likely to be taking + advantage of which will likely be way faster than any pl/pgsql + equivalent. + +- If you are writing "set operations," operating on table data, + the fact that pl/pgsql won't need to 'context switch' between + language mode and 'accessing data from the database' mode will + probably make it a bit quicker than pl/Perl. + +- If you need some sort of "ultimate fastness," then you might look to + writing in a language that compiles to assembler so that your loops + will run as quick and tight as possible, which would encourage + writing stored procedures in C. Alas, this is _way_ harder to debug + and deploy, and errors could pretty readily destroy your database + instance if they were sufficiently awful. + +pl/pgsql is almost certainly the most widely used procedural language, +if you're into "popularity contests." + +I would be very much inclined to start with whichever language makes +it the easiest to write and maintain the algorithms you plan to write. +I would only move to another language if the initial choice proved to +_systematically_ be a conspicuous bottleneck. +-- +output = ("cbbrowne" "@" "gmail.com") +http://linuxdatabases.info/info/linuxdistributions.html +"One of the most dangerous things in the universe is an ignorant +people with real grievances. That is nowhere near as dangerous, +however, as an informed and intelligent society with grievances. The +damage that vengeful intelligence can wreak, you cannot even imagine." +-- Miles Teg, Heretics of Dune + +From pgsql-performance-owner@postgresql.org Mon Apr 18 01:52:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 152D25340B + for ; + Mon, 18 Apr 2005 01:52:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50752-09 + for ; + Mon, 18 Apr 2005 04:52:07 +0000 (GMT) +Received: from eagle.ericsson.se (eagle.ericsson.se [193.180.251.53]) + by svr1.postgresql.org (Postfix) with ESMTP id 87541533E6 + for ; + Mon, 18 Apr 2005 01:52:05 -0300 (ADT) +Received: from esealmw128.eemea.ericsson.se ([153.88.254.121]) + by eagle.ericsson.se (8.12.10/8.12.10/WIREfire-1.8b) with ESMTP id + j3I4q1OY020693 + for ; Mon, 18 Apr 2005 06:52:04 +0200 +Received: from esealmw126.eemea.ericsson.se ([153.88.254.170]) by + esealmw128.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.211); + Mon, 18 Apr 2005 06:51:21 +0200 +Received: from erumomw002.eemea.ericsson.se ([159.107.202.98]) by + esealmw126.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.211); + Mon, 18 Apr 2005 06:51:21 +0200 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="koi8-r" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Subject: Postgresql works too slow +Date: Mon, 18 Apr 2005 08:50:55 +0400 +Message-ID: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Postgresql works too slow +Thread-Index: AcVD0jSe/rVwk6fjQ7SiSCvMXNfssQ== +From: "Nurlan Mukhanov (AL/EKZ)" +To: +X-OriginalArrivalTime: 18 Apr 2005 04:51:21.0432 (UTC) + FILETIME=[44149580:01C543D2] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/383 +X-Sequence-Number: 11780 + +Hello.=20 + +I'm trying to restore my database from dump in several parrallel = +processes, but restore process works too slow. +Number of rows about 100 000 000, +RAM: 8192M +CPU: Ultra Sparc 3 +Number of CPU: 4 +OS: SunOS sun 5.8 +RDBMS: PostgreSQL 8.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = +prstat info = +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + + PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP + 14231 postgres 41M 37M sleep 58 0 0:00.01 0.2% postgres/1 + 14136 postgres 41M 37M sleep 58 0 0:00.03 0.2% postgres/1 + 14211 postgres 41M 37M sleep 58 0 0:00.01 0.2% postgres/1 + 14270 postgres 41M 37M sleep 58 0 0:00.00 0.2% postgres/1 + 13767 postgres 41M 37M sleep 58 0 0:00.18 0.2% postgres/1 + 13684 postgres 41M 36M sleep 58 0 0:00.14 0.2% postgres/1 + + NPROC USERNAME SIZE RSS MEMORY TIME CPU + 74 root 272M 191M 2.3% 0:26.29 24% + 124 postgres 1520M 1306M 16% 0:03.05 5.0% + + +How to encrease postgresql speed? Why postgres took only 5.0% of CPU = +time? + +Nurlan Mukhanov=20 + +From pgsql-performance-owner@postgresql.org Mon Apr 18 02:43:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D179153986 + for ; + Mon, 18 Apr 2005 02:43:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64737-06 + for ; + Mon, 18 Apr 2005 05:43:12 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E7BB53982 + for ; + Mon, 18 Apr 2005 02:43:09 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Sun, 17 Apr 2005 22:46:10 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Sun, 17 Apr 2005 22:46:06 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005041722460609075 + for ; + Sun, 17 Apr 2005 22:46:06 -0700 +X-ASG-Debug-ID: 1113802982-23135-1-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail1 (mail1.hq.corp [192.168.160.5]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id F1102200D56C + for ; + Sun, 17 Apr 2005 22:43:02 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Sun, 17 Apr 2005 22:46:01 -0700 +Message-ID: <426348BD.3040002@sfnet.cc> +Date: Sun, 17 Apr 2005 22:42:21 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Nurlan Mukhanov (AL/EKZ)" +Cc: pgsql-performance@postgresql.org +X-ASG-Orig-Subj: Re: [PERFORM] Postgresql works too slow +Subject: Re: Postgresql works too slow +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> +In-Reply-To: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> +Content-Type: text/plain; charset=KOI8-R; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 18 Apr 2005 05:46:01.0224 (UTC) + FILETIME=[E6FD2080:01C543D9] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.364 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5021] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.181 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/384 +X-Sequence-Number: 11781 + +Nurlan, + +Try enabliing your checkpoint_segments. In my example, our database +restore took 75mins. After enabling checkpoints_segments to 20, we cut +it down to less than 30 minutes. Is your pg_xlog on a seperate disc..or +at least a partition? This will help too. A checkpoints_segments of 20, +if memory serves correctly, will occupy around 800-900M of disc space in +pg_xlog. + +Steve Poe + + +Nurlan Mukhanov (AL/EKZ) wrote: + +>Hello. +> +>I'm trying to restore my database from dump in several parrallel processes, but restore process works too slow. +>Number of rows about 100 000 000, +>RAM: 8192M +>CPU: Ultra Sparc 3 +>Number of CPU: 4 +>OS: SunOS sun 5.8 +>RDBMS: PostgreSQL 8.0 +> +>==================== prstat info ==================== +> +> PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP +> 14231 postgres 41M 37M sleep 58 0 0:00.01 0.2% postgres/1 +> 14136 postgres 41M 37M sleep 58 0 0:00.03 0.2% postgres/1 +> 14211 postgres 41M 37M sleep 58 0 0:00.01 0.2% postgres/1 +> 14270 postgres 41M 37M sleep 58 0 0:00.00 0.2% postgres/1 +> 13767 postgres 41M 37M sleep 58 0 0:00.18 0.2% postgres/1 +> 13684 postgres 41M 36M sleep 58 0 0:00.14 0.2% postgres/1 +> +> NPROC USERNAME SIZE RSS MEMORY TIME CPU +> 74 root 272M 191M 2.3% 0:26.29 24% +> 124 postgres 1520M 1306M 16% 0:03.05 5.0% +> +> +>How to encrease postgresql speed? Why postgres took only 5.0% of CPU time? +> +>Nurlan Mukhanov +> +>---------------------------(end of broadcast)--------------------------- +>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org +> +> +> + + +From pgsql-novice-owner@postgresql.org Mon Apr 18 03:09:18 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D6595367A + for ; + Mon, 18 Apr 2005 03:09:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75069-06 + for ; + Mon, 18 Apr 2005 06:09:12 +0000 (GMT) +Received: from themode.com (themode.com [161.58.169.198]) + by svr1.postgresql.org (Postfix) with ESMTP id E6FB653661 + for ; Mon, 18 Apr 2005 03:09:11 -0300 (ADT) +Received: from localhost (bde@localhost) + by themode.com (8.12.11/8.12.11) with ESMTP id j3I69BB3099068 + for ; Mon, 18 Apr 2005 02:09:11 -0400 (EDT) +Date: Mon, 18 Apr 2005 02:09:10 -0400 (EDT) +From: brew@theMode.com +X-X-Sender: mode@themode.com +To: pgsql-novice@postgresql.org +Subject: Storing Large Objects +In-Reply-To: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> +Message-ID: +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/224 +X-Sequence-Number: 13107 + + +Hi All...... + +I'm writing a php web application which sells mp3 music for production +use (a rather limited audience, as opposed to a general mp3 download +site). + +Since I've heard large objects were a bother I've written it so the mp3s +were in files with long obfuscated filenames and have put them in a +directory hidden behind basic authentication, planning a php front end to +the basic authentication and storing the file urls in the database. Now +I'm considering shortlived symbolic filenames to further make it difficult +to rip off the mp3 files by other users with valid log in credentials that +can get past the basic authentication. + +Basically it's turning into one big unwieldy kluge. + +I'm reading about large object php functions and am considering storing +the mp3s themselves as large objects in postgreSQL, rather than just the +filenames, and it's starting to look better and better! It would be very +easy to make it so that only the valid user could pull the mp3 large +object out of postgreSQL. + +Is storing large objects as easy as the php functions make it look? What +about the pg_dump difficulties with large objects? + +I'm using Debian Stable which has postgreSQL 7.2.1 and PHP 4.1.2 which so +far has been working fine with my small text databases, but I suspect if I +want to consider large objects I should really upgrade, eh? + +TIA.... + +brew + + ========================================================================== + Strange Brew (brew@theMode.com) + Check out my Stock Option Covered Call website http://www.callpix.com + and my Musician's Online Database Exchange http://www.TheMode.com + ========================================================================== + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 03:11:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 371FD536A5 + for ; + Mon, 18 Apr 2005 03:11:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74861-09 + for ; + Mon, 18 Apr 2005 06:11:42 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DF25E53875 + for ; + Mon, 18 Apr 2005 03:11:38 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3I6BZSE014025; + Mon, 18 Apr 2005 02:11:35 -0400 (EDT) +To: Steve Poe +Cc: "Nurlan Mukhanov (AL/EKZ)" , + pgsql-performance@postgresql.org +Subject: Re: Postgresql works too slow +In-reply-to: <426348BD.3040002@sfnet.cc> +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + <426348BD.3040002@sfnet.cc> +Comments: In-reply-to Steve Poe + message dated "Sun, 17 Apr 2005 22:42:21 -0700" +Date: Mon, 18 Apr 2005 02:11:35 -0400 +Message-ID: <14024.1113804695@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/385 +X-Sequence-Number: 11782 + +Steve Poe writes: +> Try enabliing your checkpoint_segments. In my example, our database +> restore took 75mins. After enabling checkpoints_segments to 20, we cut +> it down to less than 30 minutes. + +Increasing maintenance_work_mem might help too ... or several other +settings ... with no information about exactly *what* is slow, it's +hard to say. + + regards, tom lane + +From pgsql-novice-owner@postgresql.org Mon Apr 18 03:18:47 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0860453661 + for ; + Mon, 18 Apr 2005 03:18:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75089-09 + for ; + Mon, 18 Apr 2005 06:18:40 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A5B0534C5 + for ; Mon, 18 Apr 2005 03:18:39 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3I6IeD0014086; + Mon, 18 Apr 2005 02:18:40 -0400 (EDT) +To: brew@theMode.com +Cc: pgsql-novice@postgresql.org +Subject: Re: Storing Large Objects +In-reply-to: +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + +Comments: In-reply-to brew@theMode.com + message dated "Mon, 18 Apr 2005 02:09:10 -0400" +Date: Mon, 18 Apr 2005 02:18:40 -0400 +Message-ID: <14085.1113805120@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/225 +X-Sequence-Number: 13108 + +brew@theMode.com writes: +> I'm using Debian Stable which has postgreSQL 7.2.1 and PHP 4.1.2 which so +> far has been working fine with my small text databases, but I suspect if I +> want to consider large objects I should really upgrade, eh? + +[ jaw drops... ] Debian Stable is shipping 7.2.**1**? + +You might want to get yourself a more responsibly managed distro. +I won't necessarily argue with someone's decision to stick on the +7.2 major release, but not to adopt 7.2.* bug fixes is mere insanity. +7.2.1 was released more than three years ago and has multiple known +data-loss and security issues. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 18 03:41:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 51B375374B + for ; + Mon, 18 Apr 2005 03:41:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81430-09 + for ; + Mon, 18 Apr 2005 06:40:53 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 239E853365 + for ; + Mon, 18 Apr 2005 03:40:48 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 2C8C724FE2; + Mon, 18 Apr 2005 14:40:43 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 0EED524FE1; + Mon, 18 Apr 2005 14:40:43 +0800 (WST) +Message-ID: <42635675.2020309@familyhealth.com.au> +Date: Mon, 18 Apr 2005 14:40:53 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: Steve Poe , + "Nurlan Mukhanov (AL/EKZ)" , + pgsql-performance@postgresql.org +Subject: Re: Postgresql works too slow +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + <426348BD.3040002@sfnet.cc> <14024.1113804695@sss.pgh.pa.us> +In-Reply-To: <14024.1113804695@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/386 +X-Sequence-Number: 11783 + +>>Try enabliing your checkpoint_segments. In my example, our database +>>restore took 75mins. After enabling checkpoints_segments to 20, we cut +>>it down to less than 30 minutes. +> +> +> Increasing maintenance_work_mem might help too ... or several other +> settings ... with no information about exactly *what* is slow, it's +> hard to say. + +Try turning fsync = false for the duration of your reload. + +Chris + +From pgsql-novice-owner@postgresql.org Mon Apr 18 03:47:47 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3184F53777 + for ; + Mon, 18 Apr 2005 03:47:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86114-01 + for ; + Mon, 18 Apr 2005 06:47:37 +0000 (GMT) +Received: from themode.com (themode.com [161.58.169.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 2150C5374B + for ; Mon, 18 Apr 2005 03:47:36 -0300 (ADT) +Received: from localhost (bde@localhost) + by themode.com (8.12.11/8.12.11) with ESMTP id j3I6lb1Y005402 + for ; Mon, 18 Apr 2005 02:47:37 -0400 (EDT) +Date: Mon, 18 Apr 2005 02:47:37 -0400 (EDT) +From: brew@theMode.com +X-X-Sender: mode@themode.com +To: pgsql-novice@postgresql.org +Subject: Re: Storing Large Objects +In-Reply-To: <14085.1113805120@sss.pgh.pa.us> +Message-ID: +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + + <14085.1113805120@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/226 +X-Sequence-Number: 13109 + + +On Mon, 18 Apr 2005, Tom Lane wrote: + +> [ jaw drops... ] Debian Stable is shipping 7.2.**1**? +> +> You might want to get yourself a more responsibly managed distro. +> I won't necessarily argue with someone's decision to stick on the +> 7.2 major release, but not to adopt 7.2.* bug fixes is mere insanity. +> 7.2.1 was released more than three years ago and has multiple known +> data-loss and security issues. + +It's been recommended to me that I switch to testing, which is running +7.4.7 i think. And I've done that on my development laptop. +Maybe I should switch to that on my production server, too, since it's +working OK on my laptop. + +It's a more recent version of php, too. + +It's have been argued that Debian testing is at least as stable as +everybody elses stable and Debian stable is *really* stable. Although with +7.2.1 maybe not so secure..... + +brew + + ========================================================================== + Strange Brew (brew@theMode.com) + Check out my Stock Option Covered Call website http://www.callpix.com + and my Musician's Online Database Exchange http://www.TheMode.com + ========================================================================== + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 05:18:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DB9795383D + for ; + Mon, 18 Apr 2005 05:18:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04763-05 + for ; + Mon, 18 Apr 2005 08:18:06 +0000 (GMT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AAED537C9 + for ; + Mon, 18 Apr 2005 05:18:06 -0300 (ADT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by news.hub.org (8.13.1/8.13.1) with ESMTP id j3I8I4sx005483 + for ; Mon, 18 Apr 2005 08:18:05 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.13.1/8.13.1/Submit) id j3I85C1S002657 + for pgsql-performance@postgresql.org; Mon, 18 Apr 2005 08:05:12 GMT + (envelope-from news) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: How to improve db performance with $7K? +Date: Mon, 18 Apr 2005 01:05:09 -0700 +Organization: Hub.Org Networking Services +Lines: 139 +Message-ID: +References: + <425EBA0C.6030804@sfnet.cc> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: <425EBA0C.6030804@sfnet.cc> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/388 +X-Sequence-Number: 11785 + +Problem with this strategy. You want battery-backed write caching for +best performance & safety. (I've tried IDE for WAL before w/ write +caching off -- the DB got crippled whenever I had to copy files from/to +the drive on the WAL partition -- ended up just moving WAL back on the +same SCSI drive as the main DB.) That means in addition to a $$$ SCSI +caching controller, you also need a $$$ SATA caching controller. From my +glance at prices, advanced SATA controllers seem to cost nearly as their +SCSI counterparts. + +This also looks to be the case for the drives themselves. Sure you can +get super cheap 7200RPM SATA drives but they absolutely suck for +database work. Believe me, I gave it a try once -- ugh. The highend WD +10K Raptors look pretty good though -- the benchmarks @ storagereview +seem to put these drives at about 90% of SCSI 10Ks for both single-user +and multi-user. However, they're also priced like SCSIs -- here's what I +found @ Mwave (going through pricewatch to find WD740GDs): + +Seagate 7200 SATA -- 80GB $59 +WD 10K SATA -- 72GB $182 +Seagate 10K U320 -- 72GB $289 + +Using the above prices for a fixed budget for RAID-10, you could get: + +SATA 7200 -- 680MB per $1000 +SATA 10K -- 200MB per $1000 +SCSI 10K -- 125MB per $1000 + +For a 99% read-only DB that required lots of disk space (say something +like Wikipedia or blog host), using consumer level SATA probably is ok. +For anything else, I'd consider SATA 10K if (1) I do not need 15K RPM +and (2) I don't have SCSI intrastructure already. + + +Steve Poe wrote: +> If SATA drives don't have the ability to replace SCSI for a multi-user +> Postgres apps, but you needed to save on cost (ALWAYS an issue), +> could/would you implement SATA for your logs (pg_xlog) and keep the rest +> on SCSI? +> +> Steve Poe +> +> Mohan, Ross wrote: +> +>> I've been doing some reading up on this, trying to keep up here, and +>> have found out that (experts, just yawn and cover your ears) +>> +>> 1) some SATA drives (just type II, I think?) have a "Phase Zero" +>> implementation of Tagged Command Queueing (the special sauce +>> for SCSI). +>> 2) This SATA "TCQ" is called NCQ and I believe it basically +>> allows the disk software itself to do the reordering +>> (this is called "simple" in TCQ terminology) It does not +>> yet allow the TCQ "head of queue" command, allowing the +>> current tagged request to go to head of queue, which is +>> a simple way of manifesting a "high priority" request. +>> +>> 3) SATA drives are not yet multi-initiator? +>> +>> Largely b/c of 2 and 3, multi-initiator SCSI RAID'ed drives +>> are likely to whomp SATA II drives for a while yet (read: a +>> year or two) in multiuser PostGres applications. +>> +>> +>> -----Original Message----- +>> From: pgsql-performance-owner@postgresql.org +>> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Greg Stark +>> Sent: Thursday, April 14, 2005 2:04 PM +>> To: Kevin Brown +>> Cc: pgsql-performance@postgresql.org +>> Subject: Re: [PERFORM] How to improve db performance with $7K? +>> +>> +>> Kevin Brown writes: +>> +>> +>> +>>> Greg Stark wrote: +>>> +>>> +>>> +>>> +>>>> I think you're being misled by analyzing the write case. +>>>> +>>>> Consider the read case. When a user process requests a block and +>>>> that read makes its way down to the driver level, the driver can't +>>>> just put it aside and wait until it's convenient. It has to go ahead +>>>> and issue the read right away. +>>>> +>>> +>>> Well, strictly speaking it doesn't *have* to. It could delay for a +>>> couple of milliseconds to see if other requests come in, and then +>>> issue the read if none do. If there are already other requests being +>>> fulfilled, then it'll schedule the request in question just like the +>>> rest. +>>> +>> +>> +>> But then the cure is worse than the disease. You're basically +>> describing exactly what does happen anyways, only you're delaying more +>> requests than necessary. That intervening time isn't really idle, it's +>> filled with all the requests that were delayed during the previous +>> large seek... +>> +>> +>> +>>> Once the first request has been fulfilled, the driver can now +>>> schedule the rest of the queued-up requests in disk-layout order. +>>> +>>> I really don't see how this is any different between a system that +>>> has tagged queueing to the disks and one that doesn't. The only +>>> difference is where the queueing happens. +>>> +>> +>> +>> And *when* it happens. Instead of being able to issue requests while a +>> large seek is happening and having some of them satisfied they have to +>> wait until that seek is finished and get acted on during the next +>> large seek. +>> +>> If my theory is correct then I would expect bandwidth to be +>> essentially equivalent but the latency on SATA drives to be increased +>> by about 50% of the average seek time. Ie, while a busy SCSI drive can +>> satisfy most requests in about 10ms a busy SATA drive would satisfy +>> most requests in 15ms. (add to that that 10k RPM and 15kRPM SCSI +>> drives have even lower seek times and no such IDE/SATA drives exist...) +>> +>> In reality higher latency feeds into a system feedback loop causing +>> your application to run slower causing bandwidth demands to be lower +>> as well. It's often hard to distinguish root causes from symptoms when +>> optimizing complex systems. +>> +>> +>> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if your +> joining column's datatypes do not match +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 05:13:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8738053661 + for ; + Mon, 18 Apr 2005 05:13:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03575-03 + for ; + Mon, 18 Apr 2005 08:13:43 +0000 (GMT) +Received: from ns.trainorthornton.co.uk (ns.trainorthornton.co.uk + [194.216.113.35]) + by svr1.postgresql.org (Postfix) with ESMTP id CF49C53642 + for ; + Mon, 18 Apr 2005 05:13:41 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by ns.trainorthornton.co.uk (Postfix) with ESMTP id 7B07115D5B4 + for ; + Mon, 18 Apr 2005 09:04:20 +0100 (BST) +Received: from ns.trainorthornton.co.uk ([127.0.0.1]) + by localhost (ns.trainorthornton.co.uk [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 20477-03 for ; + Mon, 18 Apr 2005 09:04:20 +0100 (BST) +Received: from monolith (unknown [217.46.214.91]) + by ns.trainorthornton.co.uk (Postfix) with SMTP id EDCF115D4E4 + for ; + Mon, 18 Apr 2005 09:04:19 +0100 (BST) +Date: Mon, 18 Apr 2005 09:07:23 +0100 +From: Nick Trainor +Subject: UNSUBSCRIBE +To: +Mime-Version: 1.0 +Organization: Trainor Thornton +X-Mailer: GoldMine [5.50.10424] +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable +Message-Id: <20050418080420.EDCF115D4E4@ns.trainorthornton.co.uk> +X-Virus-Scanned: by amavisd-new at trainorthornton.co.uk +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/387 +X-Sequence-Number: 11784 + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 06:00:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DE71953661 + for ; + Mon, 18 Apr 2005 06:00:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12422-08 + for ; + Mon, 18 Apr 2005 09:00:41 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) + by svr1.postgresql.org (Postfix) with ESMTP id 84328541C2 + for ; + Mon, 18 Apr 2005 06:00:36 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so1496520nzf + for ; + Mon, 18 Apr 2005 02:00: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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=RxmpFDdn9Vz6YtECVwnW3llna+JZaLE5tPusEd75zGmekfD4Xrr3b3ToSs20eGOWNpauJvGGkzJ4jC+ZSTC4tqJz3/mMIZlSHkrEisWOO/ELSqsnoyQU318RmQxBvCzAqABxA3pbdQfmY5r882+/sgBi76N88DtIMQwGxcB9bv8= +Received: by 10.36.8.17 with SMTP id 17mr349953nzh; + Mon, 18 Apr 2005 02:00:38 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Mon, 18 Apr 2005 02:00:38 -0700 (PDT) +Message-ID: <758d5e7f05041802004ee56be4@mail.gmail.com> +Date: Mon, 18 Apr 2005 11:00:38 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-Reply-To: <20050415205511.GB20345@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <20050415205511.GB20345@nibiru.borg.metux.de> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.757 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/389 +X-Sequence-Number: 11786 + +On 4/15/05, Enrico Weigelt wrote: +> a) SELECT items.a, items.b, ..., users.username FROM items, users +> WHERE items.uid =3D users.uid; +>=20 +> c) CREATE FUNCTION id2username(oid) RETURNS text +> LANGUAGE 'SQL' IMMUTABLE AS ' +> SELECT username AS RESULT FROM users WHERE uid =3D $1'; + +You will be told that this function is not immutable but stable, and this +is quite right. But consider such a function: + +CREATE OR REPLACE FUNCTION id2username (oid int) RETURNS TEXT AS $$ + BEGIN + IF oid =3D 0 THEN RETURN 'foo'; + ELSIF oid =3D 1 THEN RETURN 'bar'; + END IF; + END; +$$ LANGUAGE plpgsql IMMUTABLE; + +versus a lookup table with similar data. Logic suggests it should be faste= +r +than a table... It got me worried when I added: "RAISE WARNING 'Called'" +after begin and I got lots of "Called" warnings when using this IMMUTABLE +function in select... And the timings for ~6000 values in aaa table +(and two values in lookup table) are: + +There is a query, output of the EXPLAIN ANALYZE, Time of EXPLAIN +ANALYZE and "Real time" of SELECT (without EXPLAIN ANALYZE): + +a) simple select from temp table, and a lookup cost: + EXPLAIN ANALYZE SELECT n FROM aaa; + Seq Scan on aaa (cost=3D0.00..87.92 rows=3D5992 width=3D4) (actual +time=3D0.011..24.849 rows=3D6144 loops=3D1) + Total runtime: 51.881 ms +(2 rows) +Time: 52,882 ms +Real time: 16,261 ms + + EXPLAIN ANALYZE SELECT id2username(n) FROM aaa limit 2; +Limit (cost=3D0.00..0.03 rows=3D2 width=3D4) (actual time=3D0.111..0.150 +rows=3D2 loops=3D1) + -> Seq Scan on aaa (cost=3D0.00..104.80 rows=3D6144 width=3D4) (actual +time=3D0.102..0.129 rows=3D2 loops=3D1) + Total runtime: 0.224 ms +(3 rows) +Time: 1,308 ms +Real time: 1,380 ms + +b) natural join with lookup table: + EXPLAIN ANALYZE SELECT username FROM aaa NATURAL JOIN lookup; + Hash Join (cost=3D2.45..155.09 rows=3D3476 width=3D32) (actual +time=3D0.306..83.677 rows=3D6144 loops=3D1) + Hash Cond: ("outer".n =3D "inner".n) + -> Seq Scan on aaa (cost=3D0.00..87.92 rows=3D5992 width=3D4) (actual +time=3D0.006..25.517 rows=3D6144 loops=3D1) + -> Hash (cost=3D2.16..2.16 rows=3D116 width=3D36) (actual +time=3D0.237..0.237 rows=3D0 loops=3D1) + -> Seq Scan on lookup (cost=3D0.00..2.16 rows=3D116 width=3D36) +(actual time=3D0.016..0.034 rows=3D2 loops=3D1) + Total runtime: 107.378 ms +(6 rows) +Time: 109,040 ms +Real time: 25,364 ms + +c) IMMUTABLE "static" lookup function: + EXPLAIN ANALYZE SELECT id2username(n) FROM aaa; +Seq Scan on aaa (cost=3D0.00..104.80 rows=3D6144 width=3D4) (actual +time=3D0.089..116.397 rows=3D6144 loops=3D1) + Total runtime: 143.800 ms +(2 rows) +Time: 144,869 ms +Real time: 102,428 ms + +d) self-join with a function ;) + EXPLAIN ANALYZE SELECT * FROM (SELECT n, id2username(n) AS username +FROM (SELECT DISTINCT n FROM aaa) AS values) AS v_lookup RIGHT JOIN +aaa USING (n); + Hash Left Join (cost=3D506.82..688.42 rows=3D6144 width=3D36) (actual +time=3D102.382..182.661 rows=3D6144 loops=3D1) + Hash Cond: ("outer".n =3D "inner".n) + -> Seq Scan on aaa (cost=3D0.00..89.44 rows=3D6144 width=3D4) (actual +time=3D0.012..24.360 rows=3D6144 loops=3D1) + -> Hash (cost=3D506.82..506.82 rows=3D2 width=3D36) (actual +time=3D102.217..102.217 rows=3D0 loops=3D1) + -> Subquery Scan v_lookup (cost=3D476.05..506.82 rows=3D2 +width=3D36) (actual time=3D53.626..102.057 rows=3D2 loops=3D1) + -> Subquery Scan "values" (cost=3D476.05..506.80 rows=3D2 +width=3D4) (actual time=3D53.613..102.023 rows=3D2 loops=3D1) + -> Unique (cost=3D476.05..506.77 rows=3D2 width=3D4) +(actual time=3D53.456..101.772 rows=3D2 loops=3D1) + -> Sort (cost=3D476.05..491.41 rows=3D6144 +width=3D4) (actual time=3D53.440..76.710 rows=3D6144 loops=3D1) + Sort Key: n + -> Seq Scan on aaa=20 +(cost=3D0.00..89.44 rows=3D6144 width=3D4) (actual time=3D0.013..26.626 +rows=3D6144 loops=3D1) + Total runtime: 209.378 ms +(11 rows) +Time: 211,460 ms +Real time: 46,682 ms + +...so this IMMUTABLE is twice as slow (~100 ms) as the query joining +itself with a SELECT DISTINCT on an IMMUTABLE function (~50 ms), +which is twice as slow as JOIN against lookup table (~25 ms), and I feel +this IMMUTABLE function could be around ~20 ms (~16 ms plus +calling the function two times plus giving the values). + +Ah, and this is PostgreSQL 8.0.1 running under FreeBSD on a +CPU: Intel(R) Celeron(R) CPU 2.40GHz (2400.10-MHz 686-class CPU). + + Regards, + Dawid + +PS: I have a feeling that IMMUTABLE functions worked better in 7.4, +yet I am unable to confirm this. + +From pgsql-novice-owner@postgresql.org Mon Apr 18 08:13:27 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C982453826 + for ; + Mon, 18 Apr 2005 08:13:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47968-02 + for ; + Mon, 18 Apr 2005 11:13:23 +0000 (GMT) +Received: from pd3mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net + [24.71.223.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CB3B537CC + for ; Mon, 18 Apr 2005 08:13:22 -0300 (ADT) +Received: from pd3mr4so.prod.shaw.ca + (pd3mr4so-qfe3.prod.shaw.ca [10.0.141.180]) by l-daemon + (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) + with ESMTP id <0IF5006GN3456SE0@l-daemon> for + pgsql-novice@postgresql.org; Mon, 18 Apr 2005 05:12:05 -0600 (MDT) +Received: from pn2ml3so.prod.shaw.ca ([10.0.121.147]) + by pd3mr4so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 + (built Mar + 15 2004)) with ESMTP id <0IF50038W345UC40@pd3mr4so.prod.shaw.ca> for + pgsql-novice@postgresql.org; Mon, 18 Apr 2005 05:12:05 -0600 (MDT) +Received: from newmain.materia + (S010600e08120dfff.ed.shawcable.net [68.148.200.126]) + by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 + 2003)) + with ESMTP id <0IF500M05345XH@l-daemon> for pgsql-novice@postgresql.org; + Mon, 18 Apr 2005 05:12:05 -0600 (MDT) +Date: Mon, 18 Apr 2005 05:12:03 -0600 +From: Gordon Haverland +Subject: Debian stable, was Re: Storing Large Objects +In-reply-to: <14085.1113805120@sss.pgh.pa.us> +To: pgsql-novice@postgresql.org +Reply-To: ghaverla@shaw.ca +Message-id: <200504180512.04530.ghaverla@shaw.ca> +MIME-version: 1.0 +Content-type: text/plain; charset=iso-8859-1 +Content-transfer-encoding: 7bit +Content-disposition: inline +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + + <14085.1113805120@sss.pgh.pa.us> +User-Agent: KMail/1.7.2 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.274 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/227 +X-Sequence-Number: 13110 + +On Monday 18 April 2005 00:18, Tom Lane wrote: +> [ jaw drops... ] Debian Stable is shipping 7.2.**1**? +> +> You might want to get yourself a more responsibly managed +> distro. I won't necessarily argue with someone's decision to +> stick on the 7.2 major release, but not to adopt 7.2.* bug +> fixes is mere insanity. 7.2.1 was released more than three +> years ago and has multiple known data-loss and security issues. + +It's probably not quite so bad as you think. But it probably as +"stable" (sort of like the Canadian Shield bedrock is stable). +They backport patches to older software. The actual number is +7.2.1-2woody8 + +The changelog +(http://packages.debian.org/changelogs/pool/main/p/postgresql/postgresql_7.2.1-2woody8/changelog) +has entries on: + +Thu, 10 Feb 2005 15:20:03 +0100 +Tue, 1 Feb 2005 12:55:44 +0100 +Tue, 26 Oct 2004 15:54:22 +0200 +Thu, 13 May 2004 11:00:07 +0200 +3 Nov 2003 10:14:08 +0100 +8 Sep 2002 19:33:32 +0200 +5 Sep 2002 09:49:10 -0400 +Sun, 31 Mar 2002 21:25:41 +0100 +Fri, 29 Mar 2002 02:17:31 +0000 +Sat, 23 Mar 2002 09:43:05 +0000 +and I believe 40 more entries going back to +Fri, 26 Jan 2001 20:27:30 +0000 + +For stable, one can always look to www.backports.org to get newer +software versions, instead of using the sometimes "ancient" stuff +in "stable". Backports has 7.4.7-1 as the version it is +distributing. The changelog file isn't seen in the directory +with the various debs, but the date on the package is: +11-Feb-2005 08:10 + +I don't run stable myself, but for other people I have had them +doing updates against backports.org for some software. + +Gord (just another Debian user) + +From pgsql-performance-owner@postgresql.org Mon Apr 18 09:50:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D98353313 + for ; + Mon, 18 Apr 2005 09:50:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77920-04 + for ; + Mon, 18 Apr 2005 12:50:46 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 6825F536F8 + for ; + Mon, 18 Apr 2005 09:50:45 -0300 (ADT) +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.7226.0 +Subject: Re: immutable functions vs. join for lookups ? +Date: Mon, 18 Apr 2005 08:50:46 -0400 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] immutable functions vs. join for lookups ? +thread-index: AcVD9YCgK5OkV1MySZiFFSEcwnFk4wAHxVVQ +From: "Merlin Moncure" +To: "Dawid Kuroczko" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.16 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200504/390 +X-Sequence-Number: 11787 + +> d) self-join with a function ;) +> EXPLAIN ANALYZE SELECT * FROM (SELECT n, id2username(n) AS username +> FROM (SELECT DISTINCT n FROM aaa) AS values) AS v_lookup RIGHT JOIN +> aaa USING (n); + +That's pretty clever. =20 +It sure seems like the server was not caching the results of the +function...maybe the server thought it was to small a table to bother? =20 + +Merlin + +From pgsql-novice-owner@postgresql.org Mon Apr 18 09:53:12 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 43854537CE + for ; + Mon, 18 Apr 2005 09:53:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77223-10 + for ; + Mon, 18 Apr 2005 12:53:08 +0000 (GMT) +Received: from themode.com (themode.com [161.58.169.198]) + by svr1.postgresql.org (Postfix) with ESMTP id EBE5A5370A + for ; Mon, 18 Apr 2005 09:53:07 -0300 (ADT) +Received: from localhost (bde@localhost) + by themode.com (8.12.11/8.12.11) with ESMTP id j3ICrA0d064437 + for ; Mon, 18 Apr 2005 08:53:10 -0400 (EDT) +Date: Mon, 18 Apr 2005 08:53:10 -0400 (EDT) +From: brew@theMode.com +X-X-Sender: mode@themode.com +To: pgsql-novice@postgresql.org +Subject: Re: Debian stable, was Re: Storing Large Objects +In-Reply-To: <200504180512.04530.ghaverla@shaw.ca> +Message-ID: +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + + <14085.1113805120@sss.pgh.pa.us> + <200504180512.04530.ghaverla@shaw.ca> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/229 +X-Sequence-Number: 13112 + + +On Mon, 18 Apr 2005, Gordon Haverland wrote: + +> For stable, one can always look to www.backports.org to get newer +> software versions, instead of using the sometimes "ancient" stuff in +> "stable". Backports has 7.4.7-1 as the version it is distributing. + +Hey, that's pretty neat. I love apt-get (lazy?), getting a newer version +of postgreSQL that is compiled against the stable libs looks pretty good. +I'll try it out on one of my test servers - I think it might be safer +eventually to do that on my production server rather than run Debian +testing. I'm rather nervous about that because apt-get testing once left +my laptop without php for a few days, that would be a disaster for a +production website! + +Thanks Gordon. + +brew + + ========================================================================== + Strange Brew (brew@theMode.com) + Check out my Stock Option Covered Call website http://www.callpix.com + and my Musician's Online Database Exchange http://www.TheMode.com + ========================================================================== + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 10:00:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B4E9053814 + for ; + Mon, 18 Apr 2005 10:00:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80257-10 + for ; + Mon, 18 Apr 2005 13:00:46 +0000 (GMT) +Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 2138D536FA + for ; + Mon, 18 Apr 2005 10:00:39 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF500IKM856FCY8@vms046.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 18 Apr 2005 08:00:43 -0500 (CDT) +Date: Mon, 18 Apr 2005 09:00:48 -0400 +From: "Joel Fradkin" +Subject: FW: speed of querry? +To: "PostgreSQL Perform" +Message-id: <000401c54416$a4e57e80$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/391 +X-Sequence-Number: 11788 + + +What are the statistics +for tbljobtitle.id and tbljobtitle.clientnum=20 +I added default_statistics_target =3D 250 to the config and re-loaded = +the data +base. If that is what you mean? + +--- how many distinct values of each,=20 + +tbljobtitle.id 6764 for all clients 1018 for SAKS +tbljobtitle.clientnum 237 distinct clientnums just 1 for SAKS + +and are the distributions skewed to a few popular values? +There are 3903 distinct values for jobtitle + +Not sure if I answered the questions, let me know if you need more info. +It appears there are 1018 job titles in the table for saks and 6764 for = +all +the clients. There can be more values as presentation layer can have = +more +then one value for an id. SAKS is not using presentation layer yet as = +there +are only 1018 distinct values 1 for each id. + +Joel + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 10:01:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E9F1536FA + for ; + Mon, 18 Apr 2005 10:01:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80205-10 + for ; + Mon, 18 Apr 2005 13:01:33 +0000 (GMT) +Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) + by svr1.postgresql.org (Postfix) with ESMTP id BB70F536D5 + for ; + Mon, 18 Apr 2005 10:01:33 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF500L7Q86PMHU1@vms046.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 18 Apr 2005 08:01:38 -0500 (CDT) +Date: Mon, 18 Apr 2005 09:01:43 -0400 +From: "Joel Fradkin" +Subject: FW: speed of querry? +To: "PostgreSQL Perform" +Message-id: <000501c54416$c5914b50$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: 7bit +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/392 +X-Sequence-Number: 11789 + +Another odd thing is when I tried turning off merge joins on the XP desktop +It took 32 secs to run compared to the 6 secs it was taking. +On the Linux (4proc box) it is now running in 3 secs with the mergejoins +turned off. + +Unfortunately it takes over 2 minutes to actually return the 160,000+ rows. +I am guessing that is either network (I have gig cards on a LAN) or perhaps +the ODBC driver (using PGADMIN III to do the select). + +I tried to run on psql on the server but it was putting it out to more. +If I do it and use > test.txt will it run it all out so I can get a time? +Does it display the time anywhere like in pgadminIII? + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 10:09:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F1D8B536FF + for ; + Mon, 18 Apr 2005 10:09:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83890-06 + for ; + Mon, 18 Apr 2005 13:09:12 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 1BBB853473 + for ; + Mon, 18 Apr 2005 10:09:11 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF500IFU8JEI4Y7@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 18 Apr 2005 08:09:15 -0500 (CDT) +Date: Mon, 18 Apr 2005 09:09:21 -0400 +From: "Joel Fradkin" +Subject: FW: speed of querry? +To: "PostgreSQL Perform" +Message-id: <000001c54417$d646fc00$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/393 +X-Sequence-Number: 11790 + +Sorry if this posts twice I posted and did not see it hit the list. + +What are the statistics +for tbljobtitle.id and tbljobtitle.clientnum=20 +I added default_statistics_target =3D 250 to the config and re-loaded = +the data +base. If that is what you mean? + +--- how many distinct values of each,=20 + +tbljobtitle.id 6764 for all clients 1018 for SAKS +tbljobtitle.clientnum 237 distinct clientnums just 1 for SAKS + +and are the distributions skewed to a few popular values? +There are 3903 distinct values for jobtitle + +Not sure if I answered the questions, let me know if you need more info. +It appears there are 1018 job titles in the table for saks and 6764 for = +all +the clients. There can be more values as presentation layer can have = +more +then one value for an id. SAKS is not using presentation layer yet as = +there +are only 1018 distinct values 1 for each id. + +Joel + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 10:19:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 849035370C + for ; + Mon, 18 Apr 2005 10:19:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87914-06 + for ; + Mon, 18 Apr 2005 13:19:17 +0000 (GMT) +Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net + [194.217.242.88]) + by svr1.postgresql.org (Postfix) with ESMTP id 295EC536FA + for ; + Mon, 18 Apr 2005 10:19:16 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-30.mail.demon.net with esmtp (Exim 4.42) + id 1DNW9d-000CO6-0w + for pgsql-performance@postgresql.org; Mon, 18 Apr 2005 13:19:09 +0000 +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.7226.0 +Subject: Re: speed of querry? +Date: Mon, 18 Apr 2005 14:18:57 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] speed of querry? +Thread-Index: AcVEGLIAWNPSxflOTj+ENoWuMJviCgAAGShQ +From: "Dave Page" +To: "Joel Fradkin" , + "PostgreSQL Perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/394 +X-Sequence-Number: 11791 + +=20 + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org=20 +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> Joel Fradkin +> Sent: 18 April 2005 14:02 +> To: PostgreSQL Perform +> Subject: FW: [PERFORM] speed of querry? +>=20 +> Another odd thing is when I tried turning off merge joins on=20 +> the XP desktop +> It took 32 secs to run compared to the 6 secs it was taking. +> On the Linux (4proc box) it is now running in 3 secs with the=20 +> mergejoins +> turned off. +>=20 +> Unfortunately it takes over 2 minutes to actually return the=20 +> 160,000+ rows. +> I am guessing that is either network (I have gig cards on a=20 +> LAN) or perhaps +> the ODBC driver (using PGADMIN III to do the select). + +pgAdmin III uses libpq, not the ODBC driver. + +Regards, Dave + +From pgsql-performance-owner@postgresql.org Mon Apr 18 10:31:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D37753313 + for ; + Mon, 18 Apr 2005 10:31:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92808-07 + for ; + Mon, 18 Apr 2005 13:31:49 +0000 (GMT) +Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 40D4D52C7A + for ; + Mon, 18 Apr 2005 10:31:48 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF500LUB9L2N3Y1@vms046.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 18 Apr 2005 08:31:51 -0500 (CDT) +Date: Mon, 18 Apr 2005 09:31:57 -0400 +From: "Joel Fradkin" +Subject: Re: speed of querry? +In-reply-to: + +To: "'Dave Page'" , + "'PostgreSQL Perform'" +Message-id: <000801c5441a$fe9010e0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/395 +X-Sequence-Number: 11792 + +pgAdmin III uses libpq, not the ODBC driver. + +Sorry I am not too aware of all the semantics. +I guess the question is if it is normal to take 2 mins to get 160K of +records, or is there something else I can do (I plan on limiting the = +query +screens using limit and offset; I realize this will only be effective = +for +the early part of the returned record set, but I believe they don't page +through a bunch of records, they probably add search criteria). But for +reporting I will need to return all the records and this seems slow to = +me +(but it might be in line with what I get now; I will have to do some +benchmarking). + +The application is a mixture of .net and asp and will soon have java. +So I am using the .net library for the .net pages and the ODBC driver = +for +the asp pages. + +I did find using a view for the location join sped up the query a great +deal, I will have to see if there are other places I can use that = +thinking +(instead of joining on the associate table and its dependants I can just +join on a view of that data, etc). + +Basically I have a view that does a join from location to district, = +region +and division tables. The old viwassoclist had those joined to the assoc +table in the viwassoclist, I changed it to use the view I created where = +the +tables were joined to the location table and in assoclist I just join to = +the +location view. This really made a huge difference in speed. + +Regards, Dave + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 11:19:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 85C4D53801 + for ; + Mon, 18 Apr 2005 11:19:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20065-10 + for ; + Mon, 18 Apr 2005 14:19:33 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D61F53762 + for ; + Mon, 18 Apr 2005 11:19:32 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so1597613nzf + for ; + Mon, 18 Apr 2005 07:19: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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=q6y8Kw1FF8rjEiA/D5eGLfn9NSnHGeyfy2BcrXByHk4hxyzeu8axcdxP6gUFdDbSixk+0QfEIehGf8/vL7SxZt6yNOm3xlNCVTgYAitUPkkq7g+SLJgufrPeHdu9b4icQuw0DzE/QtKw+9WrWVJW2jhYt7OuXPyDZLZX6Wi8wI4= +Received: by 10.36.12.3 with SMTP id 3mr372273nzl; + Mon, 18 Apr 2005 07:19:37 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Mon, 18 Apr 2005 07:19:37 -0700 (PDT) +Message-ID: <758d5e7f05041807194a78b55a@mail.gmail.com> +Date: Mon, 18 Apr 2005 16:19:37 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.758 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/396 +X-Sequence-Number: 11793 + +On 4/18/05, Merlin Moncure wrote: +> > d) self-join with a function ;) +> > EXPLAIN ANALYZE SELECT * FROM (SELECT n, id2username(n) AS username +> > FROM (SELECT DISTINCT n FROM aaa) AS values) AS v_lookup RIGHT JOIN +> > aaa USING (n); +>=20 +> That's pretty clever. +> It sure seems like the server was not caching the results of the +> function...maybe the server thought it was to small a table to bother? + +Nah, I don't thinks so. Having around 2 097 152 rows of 1s and 0s takes +48 seconds for id2username() query. +The "self join" you've quoted above takes 32 seconds. +SELECT n FROM aaa; takes 7 seconds. + +Thinking further... +SELECT CASE n WHEN 0 THEN 'foo' WHEN 1 THEN 'bar' END FROM aaa; +takes 9 seconds. + +CREATE OR REPLACE FUNCTION id2un_case(oid int) RETURNS text AS $$ +BEGIN RETURN CASE oid WHEN 0 THEN 'foo' WHEN 1 THEN 'bar' END; END; $$ +LANGUAGE plpgsql IMMUTABLE; +SELECT id2un_case(n) FROM aaa; +...takes 36 seconds + +...and to see how it depends on flags used: +SELECT count(id2un_case(n)) FROM aaa; +...id2un_case(n) IMMUTABLE takes 29900,114 ms +...id2un_case(n) IMMUTABLE STRICT takes 30187,958 ms +...id2un_case(n) STABLE takes 31457,560 ms +...id2un_case(n) takes 33545,178 ms +...id2un_case(n) VOLATILE takes 35150,920 ms +(and a count(CASE n WHEN ... END) FROM aaa takes: 2564,188 ms + + +I understand that these measurements are not too accurate. They +were done on idle system, and the queries were run couple of times +(to make sure they're cached :)). I believe either something is minor +performance difference between IMMUTABLE STABLE and even +VOLATILE plpgsql... :( + +Oh, and doing things like "ORDER BY n" or "WHERE n =3D 1" didn't help +either... + +I still wonder whether it's only my case or is there really something +wrong with these functions? + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Mon Apr 18 11:31:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E785A53702 + for ; + Mon, 18 Apr 2005 11:31:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28790-04 + for ; + Mon, 18 Apr 2005 14:30:56 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id B5B7A53695 + for ; + Mon, 18 Apr 2005 11:30:56 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 0D70D353B1; Mon, 18 Apr 2005 07:30:58 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 0BC393518C; Mon, 18 Apr 2005 07:30:58 -0700 (PDT) +Date: Mon, 18 Apr 2005 07:30:58 -0700 (PDT) +From: Stephan Szabo +To: Joel Fradkin +Cc: PostgreSQL Perform +Subject: Re: FW: speed of querry? +In-Reply-To: <000501c54416$c5914b50$797ba8c0@jfradkin> +Message-ID: <20050418072558.E7812@megazone.bigpanda.com> +References: <000501c54416$c5914b50$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/397 +X-Sequence-Number: 11794 + +On Mon, 18 Apr 2005, Joel Fradkin wrote: + +> Another odd thing is when I tried turning off merge joins on the XP desktop +> It took 32 secs to run compared to the 6 secs it was taking. +> On the Linux (4proc box) it is now running in 3 secs with the mergejoins +> turned off. +> +> Unfortunately it takes over 2 minutes to actually return the 160,000+ rows. +> I am guessing that is either network (I have gig cards on a LAN) or perhaps +> the ODBC driver (using PGADMIN III to do the select). +> +> I tried to run on psql on the server but it was putting it out to more. +> If I do it and use > test.txt will it run it all out so I can get a time? +> Does it display the time anywhere like in pgadminIII? + +Redirecting should turn the pager off. \timing will add a timing number +after queries. If you want to not be bothered by the pager, you can turn +if off with \pset pager off. + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 11:36:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 58A3F53B67 + for ; + Mon, 18 Apr 2005 11:36:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32029-01 + for ; + Mon, 18 Apr 2005 14:36:18 +0000 (GMT) +Received: from itapoa.terra.com.br (itapoa.terra.com.br [200.154.55.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A52653D7D + for ; + Mon, 18 Apr 2005 11:36:00 -0300 (ADT) +Received: from cuenca.terra.com.br (cuenca.terra.com.br [200.154.55.130]) + by itapoa.terra.com.br (Postfix) with ESMTP id 4077430CFEA + for ; + Mon, 18 Apr 2005 11:36:04 -0300 (BRT) +X-Terra-Karma: -2% +X-Terra-Hash: 1d27f70f4951edd6ac3f9af5a794db05 +Received-SPF: pass (cuenca.terra.com.br: domain of terra.com.br designates + 200.154.55.130 as permitted sender) client-ip=200.154.55.130; + envelope-from=rodrigo.miguel@terra.com.br; helo=rmsmnote; +Received: from rmsmnote (unknown [200.168.177.140]) + (authenticated user rodrmigu) + by cuenca.terra.com.br (Postfix) with ESMTP id EE9F613001B + for ; + Mon, 18 Apr 2005 11:36:03 -0300 (BRT) +From: "Rodrigo Moreno" +To: +Subject: How to improve postgres performace +Date: Mon, 18 Apr 2005 11:36:01 -0300 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.5510 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 +Thread-Index: AcVEI/FSkM+18tPnRmqfEik6OBtYjg== +Message-Id: <20050418143603.EE9F613001B@cuenca.terra.com.br> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.177 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200504/398 +X-Sequence-Number: 11795 + +Hi all, + +Some months ago i post a similar problem here i it was solved by running +vaccumdb time by time. +So, when i started using the postgres, i never been used the vacuumdb, and +after 2 months i started using once a week, after few weeks, i tried once a +day and now twice a day. + +At this weekend i have started to use pg_autovacuum with default settings. + +I really worried about that, because it's no enough anymore, and users claim +about performace. But running the vacuumdb full, everthing starts to run +better again, so i think the problem is not related to a specific query. + +What I can do to check what I have change to get more performance ? +Could I use vacuum verbose to check what is going on ? So, how ? + +Most all the time, even user querying the server the machine is 96%-100% +idle. The discs are SCSI, FreeBSD 5.3, the size of database is 1.1Gb, max 30 +connections and 10 concurrent conections. My server have 512Mb Ram and 256Mb +has changed to SHMAX. There is max 1000 inserted/excluded/Updated row by +day. + +These are my kernel params: +-------------------------- +options SHMMAXPGS=65536 +options SEMMNI=40 +options SEMMNS=240 +options SEMUME=40 +options SEMMNU=120 + +Postgresql.conf non-default settings +------------------------------------ +tcpip_socket = true +max_connections = 30 + +shared_buffers = 1024 +sort_mem = 2048 +vacuum_mem = 16384 + +wal_buffers = 16 +checkpoint_segments = 5 + +effective_cache_size = 16384 +random_page_cost = 2 + +stats_start_collector = true +stats_row_level = true + + +I follow the most of all discussions in this group and tried myself change +the parameters, but now, I don't know more what to do to get better +performance. + +Thanks a Lot +Rodrigo Moreno + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:00:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B9D0C538C9 + for ; + Mon, 18 Apr 2005 11:59:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39236-08 + for ; + Mon, 18 Apr 2005 14:59:14 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id A3A5F53837 + for ; + Mon, 18 Apr 2005 11:59:14 -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 1DNXiL-0006mc-00; Mon, 18 Apr 2005 10:59:05 -0400 +To: William Yu +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 18 Apr 2005 10:59:05 -0400 +Message-ID: <87pswsku6e.fsf@stark.xeocode.com> +Lines: 25 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/399 +X-Sequence-Number: 11796 + + +William Yu writes: + +> Using the above prices for a fixed budget for RAID-10, you could get: +> +> SATA 7200 -- 680MB per $1000 +> SATA 10K -- 200MB per $1000 +> SCSI 10K -- 125MB per $1000 + +What a lot of these analyses miss is that cheaper == faster because cheaper +means you can buy more spindles for the same price. I'm assuming you picked +equal sized drives to compare so that 200MB/$1000 for SATA is almost twice as +many spindles as the 125MB/$1000. That means it would have almost double the +bandwidth. And the 7200 RPM case would have more than 5x the bandwidth. + +While 10k RPM drives have lower seek times, and SCSI drives have a natural +seek time advantage, under load a RAID array with fewer spindles will start +hitting contention sooner which results into higher latency. If the controller +works well the larger SATA arrays above should be able to maintain their +mediocre latency much better under load than the SCSI array with fewer drives +would maintain its low latency response time despite its drives' lower average +seek time. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:17:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 762D4533A7 + for ; + Mon, 18 Apr 2005 12:17:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47908-04 + for ; + Mon, 18 Apr 2005 15:17:27 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id D94A55336D + for ; + Mon, 18 Apr 2005 12:17:26 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1488928wri + for ; + Mon, 18 Apr 2005 08:17:25 -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=m/UwFCkYLCo9YojbU/l06uvIXXi6BgewuzEyNCx1kp5r1oELevhaov15y5uOrh5w5zcU4KvX07+MlW6uc4ZSKZq6CNYQaPw1iHKIQ/Oy1F2raPxSROT0ZIgtBwX/XDYz3krJ5MCT6DVUcXwS8UdUMIPseGN0uTrEUWzZu4+6Oe0= +Received: by 10.54.31.32 with SMTP id e32mr3367668wre; + Mon, 18 Apr 2005 08:17:25 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 08:17:25 -0700 (PDT) +Message-ID: <33c6269f0504180817511b27a3@mail.gmail.com> +Date: Mon, 18 Apr 2005 11:17:25 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Greg Stark +Subject: Re: How to improve db performance with $7K? +Cc: William Yu , pgsql-performance@postgresql.org +In-Reply-To: <87pswsku6e.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.275 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/400 +X-Sequence-Number: 11797 + +This is fundamentaly untrue. + +A mirror is still a mirror. At most in a RAID 10 you can have two +simultaneous seeks. You are always going to be limited by the seek +time of your drives. It's a stripe, so you have to read from all +members of the stripe to get data, requiring all drives to seek.=20 +There is no advantage to seek time in adding more drives. By adding +more drives you can increase throughput, but the max throughput of the +PCI-X bus isn't that high (I think around 400MB/sec) You can easily +get this with a six or seven drive RAID 5, or a ten drive RAID 10. At +that point you start having to factor in the cost of a bigger chassis +to hold more drives, which can be big bucks. + +Alex Turner +netEconomist + +On 18 Apr 2005 10:59:05 -0400, Greg Stark wrote: +>=20 +> William Yu writes: +>=20 +> > Using the above prices for a fixed budget for RAID-10, you could get: +> > +> > SATA 7200 -- 680MB per $1000 +> > SATA 10K -- 200MB per $1000 +> > SCSI 10K -- 125MB per $1000 +>=20 +> What a lot of these analyses miss is that cheaper =3D=3D faster because c= +heaper +> means you can buy more spindles for the same price. I'm assuming you pick= +ed +> equal sized drives to compare so that 200MB/$1000 for SATA is almost twic= +e as +> many spindles as the 125MB/$1000. That means it would have almost double = +the +> bandwidth. And the 7200 RPM case would have more than 5x the bandwidth. +>=20 +> While 10k RPM drives have lower seek times, and SCSI drives have a natura= +l +> seek time advantage, under load a RAID array with fewer spindles will sta= +rt +> hitting contention sooner which results into higher latency. If the contr= +oller +> works well the larger SATA arrays above should be able to maintain their +> mediocre latency much better under load than the SCSI array with fewer dr= +ives +> would maintain its low latency response time despite its drives' lower av= +erage +> seek time. +>=20 +> -- +> greg +>=20 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if you= +r +> joining column's datatypes do not match +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:20:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F794533CD + for ; + Mon, 18 Apr 2005 12:20:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48070-08 + for ; + Mon, 18 Apr 2005 15:20:46 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id CC0C25336D + for ; + Mon, 18 Apr 2005 12:20:41 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Mon, 18 Apr 2005 10:20:36 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B5@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVEKIclgBOZ4XisRrSfVQSxdPU9OwAARNnA +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.067 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/401 +X-Sequence-Number: 11798 + +> -----Original Message----- +> From: Greg Stark [mailto:gsstark@mit.edu] +> Sent: Monday, April 18, 2005 9:59 AM +> To: William Yu +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to improve db performance with $7K? +>=20 +> William Yu writes: +>=20 +> > Using the above prices for a fixed budget for RAID-10, you=20 +> > could get: +> >=20 +> > SATA 7200 -- 680MB per $1000 +> > SATA 10K -- 200MB per $1000 +> > SCSI 10K -- 125MB per $1000 +>=20 +> What a lot of these analyses miss is that cheaper =3D=3D faster=20 +> because cheaper means you can buy more spindles for the same +> price. I'm assuming you picked equal sized drives to compare +> so that 200MB/$1000 for SATA is almost twice as many spindles +> as the 125MB/$1000. That means it would have almost double +> the bandwidth. And the 7200 RPM case would have more than 5x +> the bandwidth. +> [...] + +Hmm...so you're saying that at some point, quantity beats quality? +That's an interesting point. However, it presumes that you can +actually distribute your data over a larger number of drives. If +you have a db with a bottleneck of one or two very large tables, +the extra spindles won't help unless you break up the tables and +glue them together with query magic. But it's still a point to +consider. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-novice-owner@postgresql.org Mon Apr 18 12:02:39 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DF6A353B9B + for ; + Mon, 18 Apr 2005 12:02:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42277-09 + for ; + Mon, 18 Apr 2005 15:02:26 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.197.194]) + by svr1.postgresql.org (Postfix) with SMTP id 1E9165372D + for ; Mon, 18 Apr 2005 12:01:52 -0300 (ADT) +Received: (qmail 22894 invoked by uid 500); 18 Apr 2005 15:21:18 -0000 +Date: Mon, 18 Apr 2005 10:21:18 -0500 +From: Bruno Wolff III +To: brew@theMode.com +Cc: pgsql-novice@postgresql.org +Subject: Re: Storing Large Objects +Message-ID: <20050418152118.GA22606@wolff.to> +Mail-Followup-To: Bruno Wolff III , brew@theMode.com, + pgsql-novice@postgresql.org +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/230 +X-Sequence-Number: 13113 + +On Mon, Apr 18, 2005 at 02:09:10 -0400, + brew@theMode.com wrote: +> +> Since I've heard large objects were a bother I've written it so the mp3s +> were in files with long obfuscated filenames and have put them in a +> directory hidden behind basic authentication, planning a php front end to +> the basic authentication and storing the file urls in the database. Now +> I'm considering shortlived symbolic filenames to further make it difficult +> to rip off the mp3 files by other users with valid log in credentials that +> can get past the basic authentication. + +Why not put the files somewhere where only the application can get at them +instead of under the document root. That way they have to compromise your +application to get at them. No amount of url guessing will give direct +access. + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:30:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E09B1533CC + for ; + Mon, 18 Apr 2005 12:30:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52647-06 + for ; + Mon, 18 Apr 2005 15:30:39 +0000 (GMT) +Received: from terminus.dnttm.ro (terminus.dnttm.ro [193.226.98.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 24A52533C3 + for ; + Mon, 18 Apr 2005 12:30:37 -0300 (ADT) +Received: from nutzi (dnt-gw-softnrg.dnttm.ro [193.226.89.168]) + by terminus.dnttm.ro (8.13.3/8.12.9) with SMTP id j3IFUZqN025627 + for ; Mon, 18 Apr 2005 18:30:35 +0300 +Received: by nutzi (VPOP3 - Unregistered) with SMTP; + Mon, 18 Apr 2005 18:36:14 +0300 +Received: from 127.0.0.1 (AVG SMTP 7.0.308 [266.9.15]); + Mon, 18 Apr 2005 18:36:14 +0300 +Message-ID: <4263D3EE.5010409@softnrg.dnttm.ro> +Date: Mon, 18 Apr 2005 18:36:14 +0300 +From: Andrei Gaspar +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +To: pgsql-performance@postgresql.org +Subject: Sort and index +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Mime-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +X-Server: VPOP3 V1.2.0d Evaluation +X-Virus-Scanned: ClamAV 0.80/822/Tue Apr 12 07:55:55 2005 + clamav-milter version 0.80j on localhost +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/402 +X-Sequence-Number: 11799 + +Hi, + +I thought that an index can be used for sorting. +I'm a little confused about the following result: + +create index OperationsName on Operations(cOperationName); +explain SELECT * FROM Operations ORDER BY cOperationName; + QUERY PLAN +----------------------------------------------------------------------- + Sort (cost=185.37..189.20 rows=1532 width=498) + Sort Key: coperationname + -> Seq Scan on operations (cost=0.00..104.32 rows=1532 width=498) +(3 rows) + +Is this supposed to be so? + +Andrei + + +-- +No virus found in this outgoing message. +Checked by AVG Anti-Virus. +Version: 7.0.308 / Virus Database: 266.9.15 - Release Date: 4/16/2005 + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:44:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E24F1533CE + for ; + Mon, 18 Apr 2005 12:44:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56171-08 + for ; + Mon, 18 Apr 2005 15:44:06 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 2540E533C2 + for ; + Mon, 18 Apr 2005 12:44:03 -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 1DNYPj-0006yZ-00; Mon, 18 Apr 2005 11:43:55 -0400 +To: Alex Turner +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> +In-Reply-To: <33c6269f0504180817511b27a3@mail.gmail.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 18 Apr 2005 11:43:54 -0400 +Message-ID: <878y3gks3p.fsf@stark.xeocode.com> +Lines: 42 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/403 +X-Sequence-Number: 11800 + + +Alex Turner writes: + +> This is fundamentaly untrue. +> +> A mirror is still a mirror. At most in a RAID 10 you can have two +> simultaneous seeks. You are always going to be limited by the seek +> time of your drives. It's a stripe, so you have to read from all +> members of the stripe to get data, requiring all drives to seek. +> There is no advantage to seek time in adding more drives. + +Adding drives will not let you get lower response times than the average seek +time on your drives*. But it will let you reach that response time more often. + +The actual response time for a random access to a drive is the seek time plus +the time waiting for your request to actually be handled. Under heavy load +that could be many milliseconds. The more drives you have the fewer requests +each drive has to handle. + +Look at the await and svctime columns of iostat -x. + +Under heavy random access load those columns can show up performance problems +more accurately than the bandwidth columns. You could be doing less bandwidth +but be having latency issues. While reorganizing data to allow for more +sequential reads is the normal way to address that, simply adding more +spindles can be surprisingly effective. + +> By adding more drives you can increase throughput, but the max throughput of +> the PCI-X bus isn't that high (I think around 400MB/sec) You can easily get +> this with a six or seven drive RAID 5, or a ten drive RAID 10. At that point +> you start having to factor in the cost of a bigger chassis to hold more +> drives, which can be big bucks. + +You could use software raid to spread the drives over multiple PCI-X cards. +But if 400MB/s isn't enough bandwidth then you're probably in the realm of +"enterprise-class" hardware anyways. + +* (Actually even that's possible: you could limit yourself to a portion of the + drive surface to reduce seek time) + +-- +greg + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:44:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7326453440 + for ; + Mon, 18 Apr 2005 12:44:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57244-05 + for ; + Mon, 18 Apr 2005 15:44:48 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 7750B53465 + for ; + Mon, 18 Apr 2005 12:44:46 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Sort and index +Date: Mon, 18 Apr 2005 10:44:43 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Sort and index +Thread-Index: AcVELK5i23eMyb2nT0io0E3ThBqZQgAAFugw +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/404 +X-Sequence-Number: 11801 + +> -----Original Message----- +> From: Andrei Gaspar [mailto:andi@softnrg.dnttm.ro] +> Sent: Monday, April 18, 2005 10:36 AM +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Sort and index +>=20 +> I thought that an index can be used for sorting. +> I'm a little confused about the following result: +>=20 +> create index OperationsName on Operations(cOperationName); +> explain SELECT * FROM Operations ORDER BY cOperationName; +> QUERY PLAN +> -------------------------------------------------------------- +> --------- +> Sort (cost=3D185.37..189.20 rows=3D1532 width=3D498) +> Sort Key: coperationname +> -> Seq Scan on operations (cost=3D0.00..104.32 rows=3D1532 = +width=3D498) +> (3 rows) +>=20 +> Is this supposed to be so? + +Since you are fetching the entire table, you are touching all the rows. +If the query were to fetch the rows in index order, it would be seeking +all over the table's tracks. By fetching in sequence order, it has a +much better chance of fetching rows in a way that minimizes head seeks. +Since disk I/O is generally 10-100x slower than RAM, the in-memory sort=20 +can be surprisingly slow and still beat indexed disk access. Of course, +this is only true if the table can fit and be sorted entirely in memory +(which, with 1500 rows, probably can). + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:51:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 852455346A + for ; + Mon, 18 Apr 2005 12:51:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59633-10 + for ; + Mon, 18 Apr 2005 15:51:14 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 24223533CE + for ; + Mon, 18 Apr 2005 12:51:11 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3IFonvu022220; + Mon, 18 Apr 2005 11:50:52 -0400 (EDT) +To: "Merlin Moncure" +Cc: "Dawid Kuroczko" , + pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> +Comments: In-reply-to "Merlin Moncure" + message dated "Mon, 18 Apr 2005 08:50:46 -0400" +Date: Mon, 18 Apr 2005 11:50:49 -0400 +Message-ID: <22219.1113839449@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/405 +X-Sequence-Number: 11802 + +"Merlin Moncure" writes: +>> d) self-join with a function ;) +>> EXPLAIN ANALYZE SELECT * FROM (SELECT n, id2username(n) AS username +>> FROM (SELECT DISTINCT n FROM aaa) AS values) AS v_lookup RIGHT JOIN +>> aaa USING (n); + +> That's pretty clever. +> It sure seems like the server was not caching the results of the +> function...maybe the server thought it was to small a table to bother? + +No, it probably flattened the subquery on sight (looking at the actual +EXPLAIN output would confirm or disprove that). You could prevent the +flattening by adding OFFSET 0 in the subquery. However, the SELECT +DISTINCT sub-sub-query is expensive enough, and the join itself is +expensive enough, that you would need an *enormously* expensive +id2username() function to make this a win. + +It would be interesting sometime to try to teach the planner about +inlining SQL-language functions to become joins. That is, given + +create function id2name(int) returns text as +'select name from mytab where id = $1' language sql stable; + +select uid, id2name(uid) from othertab where something; + +I think that in principle this could automatically be converted to + +select uid, name from othertab left join mytab on (uid = id) where something; + +which is much more amenable to join optimization. There are some +pitfalls though, particularly that you'd have to be able to prove that +the function's query couldn't return more than one row (else the join +might produce more result rows than the original query). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 18 12:58:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 936BF5345F + for ; + Mon, 18 Apr 2005 12:58:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64892-03 + for ; + Mon, 18 Apr 2005 15:58:14 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BE6B353474 + for ; + Mon, 18 Apr 2005 12:58:10 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3IFwAEm022281; + Mon, 18 Apr 2005 11:58:10 -0400 (EDT) +To: "Rodrigo Moreno" +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve postgres performace +In-reply-to: <20050418143603.EE9F613001B@cuenca.terra.com.br> +References: <20050418143603.EE9F613001B@cuenca.terra.com.br> +Comments: In-reply-to "Rodrigo Moreno" + message dated "Mon, 18 Apr 2005 11:36:01 -0300" +Date: Mon, 18 Apr 2005 11:58:10 -0400 +Message-ID: <22280.1113839890@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/406 +X-Sequence-Number: 11803 + +"Rodrigo Moreno" writes: +> At this weekend i have started to use pg_autovacuum with default settings. + +> I really worried about that, because it's no enough anymore, and users claim +> about performace. But running the vacuumdb full, everthing starts to run +> better again, so i think the problem is not related to a specific query. + +It sounds like you may not have the FSM settings set large enough for +your database. The default settings are only enough for a small DB +(perhaps a few hundred meg). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 18 13:07:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9358F534C0 + for ; + Mon, 18 Apr 2005 13:07:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68854-02 + for ; + Mon, 18 Apr 2005 16:07:09 +0000 (GMT) +Received: from terminus.dnttm.ro (terminus.dnttm.ro [193.226.98.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 840FC534AA + for ; + Mon, 18 Apr 2005 13:07:01 -0300 (ADT) +Received: from nutzi (dnt-gw-softnrg.dnttm.ro [193.226.89.168]) + by terminus.dnttm.ro (8.13.3/8.12.9) with SMTP id j3IG61ul000331; + Mon, 18 Apr 2005 19:06:06 +0300 +Received: by nutzi (VPOP3 - Unregistered) with SMTP; + Mon, 18 Apr 2005 19:11:38 +0300 +Received: from 127.0.0.1 (AVG SMTP 7.0.308 [266.9.15]); + Mon, 18 Apr 2005 19:11:38 +0300 +Message-ID: <4263DC3A.5070509@softnrg.dnttm.ro> +Date: Mon, 18 Apr 2005 19:11:38 +0300 +From: Andrei Gaspar +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +To: Dave Held +Cc: pgsql-performance@postgresql.org +Subject: Re: Sort and index +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Mime-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +X-Server: VPOP3 V1.2.0d Evaluation +X-Virus-Scanned: ClamAV 0.80/822/Tue Apr 12 07:55:55 2005 + clamav-milter version 0.80j on localhost +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/407 +X-Sequence-Number: 11804 + +Thanks for the quick response +Andrei + +Dave Held wrote: + +>>-----Original Message----- +>>From: Andrei Gaspar [mailto:andi@softnrg.dnttm.ro] +>>Sent: Monday, April 18, 2005 10:36 AM +>>To: pgsql-performance@postgresql.org +>>Subject: [PERFORM] Sort and index +>> +>>I thought that an index can be used for sorting. +>>I'm a little confused about the following result: +>> +>>create index OperationsName on Operations(cOperationName); +>>explain SELECT * FROM Operations ORDER BY cOperationName; +>> QUERY PLAN +>>-------------------------------------------------------------- +>>--------- +>> Sort (cost=185.37..189.20 rows=1532 width=498) +>> Sort Key: coperationname +>> -> Seq Scan on operations (cost=0.00..104.32 rows=1532 width=498) +>>(3 rows) +>> +>>Is this supposed to be so? +>> +>> +> +>Since you are fetching the entire table, you are touching all the rows. +>If the query were to fetch the rows in index order, it would be seeking +>all over the table's tracks. By fetching in sequence order, it has a +>much better chance of fetching rows in a way that minimizes head seeks. +>Since disk I/O is generally 10-100x slower than RAM, the in-memory sort +>can be surprisingly slow and still beat indexed disk access. Of course, +>this is only true if the table can fit and be sorted entirely in memory +>(which, with 1500 rows, probably can). +> +>__ +>David B. Held +>Software Engineer/Array Services Group +>200 14th Ave. East, Sartell, MN 56377 +>320.534.3637 320.253.7800 800.752.8129 +> +>---------------------------(end of broadcast)--------------------------- +>TIP 4: Don't 'kill -9' the postmaster +> +> +> +> + + +-- +No virus found in this outgoing message. +Checked by AVG Anti-Virus. +Version: 7.0.308 / Virus Database: 266.9.15 - Release Date: 4/16/2005 + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 13:31:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BD269534A0 + for ; + Mon, 18 Apr 2005 13:31:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75347-06 + for ; + Mon, 18 Apr 2005 16:31:29 +0000 (GMT) +Received: from itapoa.terra.com.br (itapoa.terra.com.br [200.154.55.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 19BE553348 + for ; + Mon, 18 Apr 2005 13:31:28 -0300 (ADT) +Received: from talara.terra.com.br (talara.terra.com.br [200.154.55.136]) + by itapoa.terra.com.br (Postfix) with ESMTP + id 31DE930C32C; Mon, 18 Apr 2005 13:31:27 -0300 (BRT) +X-Terra-Karma: -2% +X-Terra-Hash: d7d9def80485a11d09fc162b7d21930b +Received-SPF: pass (talara.terra.com.br: domain of terra.com.br designates + 200.154.55.136 as permitted sender) client-ip=200.154.55.136; + envelope-from=rodrigo.miguel@terra.com.br; helo=rmsmnote; +Received: from rmsmnote (unknown [200.168.177.140]) + (authenticated user rodrmigu) + by talara.terra.com.br (Postfix) with ESMTP id E004E14C097; + Mon, 18 Apr 2005 13:31:26 -0300 (BRT) +From: "Rodrigo Moreno" +To: "'Tom Lane'" +Cc: +Subject: RES: How to improve postgres performace +Date: Mon, 18 Apr 2005 13:31:22 -0300 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.5510 +In-Reply-To: <22280.1113839890@sss.pgh.pa.us> +Thread-Index: AcVEL26fL8ObNEwLSgWHKe/EmotXpwABAoaw +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 +Message-Id: <20050418163126.E004E14C097@talara.terra.com.br> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.188 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200504/408 +X-Sequence-Number: 11805 + +Tom, + +How to check if the value it's enough ? The log generate by vacuum verbose +can help ? + +The current values for: + +max_fsm_pages = 1048576 +max_fsm_relations = 1000 + +this is enough ? + +Regards, +Rodrigo + +-----Mensagem original----- +De: Tom Lane [mailto:tgl@sss.pgh.pa.us] +Enviada em: segunda-feira, 18 de abril de 2005 12:58 +Para: Rodrigo Moreno +Cc: pgsql-performance@postgresql.org +Assunto: Re: [PERFORM] How to improve postgres performace + +"Rodrigo Moreno" writes: +> At this weekend i have started to use pg_autovacuum with default settings. + +> I really worried about that, because it's no enough anymore, and users +> claim about performace. But running the vacuumdb full, everthing +> starts to run better again, so i think the problem is not related to a +specific query. + +It sounds like you may not have the FSM settings set large enough for your +database. The default settings are only enough for a small DB (perhaps a +few hundred meg). + + regards, tom lane + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 13:56:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 472D6535C2 + for ; + Mon, 18 Apr 2005 13:56:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84865-09 + for ; + Mon, 18 Apr 2005 16:56:50 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) + by svr1.postgresql.org (Postfix) with ESMTP id A41785359B + for ; + Mon, 18 Apr 2005 13:56:48 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1518550wri + for ; + Mon, 18 Apr 2005 09:56:49 -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=esJv6lT7jOWzufw8tfOlQZ1v/B3tWTvohCe4mvo7U6ckK/qf5e7zW7ZP0pNtRC80WDW9KRMDCDhrVa5jNt1h31Bklb5UagLwBATsLN+UbM5iMd0vhfxVYwR0r+58KrLa3mntaDoPelxRfy0Zw89KwNl8YAkNWeJMO2MKrAxxl7E= +Received: by 10.54.69.3 with SMTP id r3mr1477329wra; + Mon, 18 Apr 2005 09:56:49 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 09:56:48 -0700 (PDT) +Message-ID: <33c6269f05041809566abf91d2@mail.gmail.com> +Date: Mon, 18 Apr 2005 12:56:48 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Greg Stark +Subject: Re: How to improve db performance with $7K? +Cc: William Yu , pgsql-performance@postgresql.org +In-Reply-To: <878y3gks3p.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.275 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/409 +X-Sequence-Number: 11806 + +[snip] +>=20 +> Adding drives will not let you get lower response times than the average = +seek +> time on your drives*. But it will let you reach that response time more o= +ften. +>=20 +[snip] + +I believe your assertion is fundamentaly flawed. Adding more drives +will not let you reach that response time more often. All drives are +required to fill every request in all RAID levels (except possibly +0+1, but that isn't used for enterprise applicaitons). Most requests +in OLTP require most of the request time to seek, not to read. Only +in single large block data transfers will you get any benefit from +adding more drives, which is atypical in most database applications.=20 +For most database applications, the only way to increase +transactions/sec is to decrease request service time, which is +generaly achieved with better seek times or a better controller card, +or possibly spreading your database accross multiple tablespaces on +seperate paritions. + +My assertion therefore is that simply adding more drives to an already +competent* configuration is about as likely to increase your database +effectiveness as swiss cheese is to make your car run faster. + +Alex Turner +netEconomist + +*Assertion here is that the DBA didn't simply configure all tables and +xlog on a single 7200 RPM disk, but has seperate physical drives for +xlog and tablespace at least on 10k drives. + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:11:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 183F8535EB + for ; + Mon, 18 Apr 2005 14:11:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95959-04 + for ; + Mon, 18 Apr 2005 17:11:05 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id A7785535A1 + for ; + Mon, 18 Apr 2005 14:11:03 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3IHAD0I029802 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Mon, 18 Apr 2005 11:10:16 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3IHADTe034526; + Mon, 18 Apr 2005 11:10:13 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3IHADrK034525; + Mon, 18 Apr 2005 11:10:13 -0600 (MDT) (envelope-from mfuhr) +Date: Mon, 18 Apr 2005 11:10:13 -0600 +From: Michael Fuhr +To: Dave Held +Cc: pgsql-performance@postgresql.org +Subject: Re: Sort and index +Message-ID: <20050418171013.GA34421@winnie.fuhr.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/410 +X-Sequence-Number: 11807 + +On Mon, Apr 18, 2005 at 10:44:43AM -0500, Dave Held wrote: +> > +> > I thought that an index can be used for sorting. +> > I'm a little confused about the following result: +> > +> > create index OperationsName on Operations(cOperationName); +> > explain SELECT * FROM Operations ORDER BY cOperationName; +> > QUERY PLAN +> > -------------------------------------------------------------- +> > --------- +> > Sort (cost=185.37..189.20 rows=1532 width=498) +> > Sort Key: coperationname +> > -> Seq Scan on operations (cost=0.00..104.32 rows=1532 width=498) +> > (3 rows) +> > +> > Is this supposed to be so? +> +> Since you are fetching the entire table, you are touching all the rows. +> If the query were to fetch the rows in index order, it would be seeking +> all over the table's tracks. By fetching in sequence order, it has a +> much better chance of fetching rows in a way that minimizes head seeks. +> Since disk I/O is generally 10-100x slower than RAM, the in-memory sort +> can be surprisingly slow and still beat indexed disk access. Of course, +> this is only true if the table can fit and be sorted entirely in memory +> (which, with 1500 rows, probably can). + +Out of curiosity, what are the results of the following queries? +(Queries run twice to make sure time differences aren't due to +caching.) + +SET enable_seqscan TO on; +SET enable_indexscan TO off; +EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; +EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; + +SET enable_seqscan TO off; +SET enable_indexscan TO on; +EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; +EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; + +SELECT version(); + +With 1500 rows of random data, I consistently see better performance +with an index scan (about twice as fast as a sequence scan), and +the planner uses an index scan if it has a choice (i.e., when +enable_seqscan and enable_indexscan are both on). But my test case +and postgresql.conf settings might be different enough from yours +to account for different behavior. + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:36:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 79BD7535F9 + for ; + Mon, 18 Apr 2005 14:36:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07163-05 + for ; + Mon, 18 Apr 2005 17:36:17 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 8124D531DE + for ; + Mon, 18 Apr 2005 14:36:14 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3IHY5IA028553; (envelope-from ) Mon, + 18 Apr 2005 12:36:00 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3IHGEXX011400 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Mon, + 18 Apr 2005 12:16:14 -0500 (CDT) +Message-ID: <4263EB5E.8000309@arbash-meinel.com> +Date: Mon, 18 Apr 2005 12:16:14 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alex Turner +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> +In-Reply-To: <33c6269f05041809566abf91d2@mail.gmail.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig6AA3D949B471AC57304693AF" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/414 +X-Sequence-Number: 11811 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig6AA3D949B471AC57304693AF +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Alex Turner wrote: + +>[snip] +> +> +>>Adding drives will not let you get lower response times than the average seek +>>time on your drives*. But it will let you reach that response time more often. +>> +>> +>> +>[snip] +> +>I believe your assertion is fundamentaly flawed. Adding more drives +>will not let you reach that response time more often. All drives are +>required to fill every request in all RAID levels (except possibly +>0+1, but that isn't used for enterprise applicaitons). +> +Actually 0+1 is the recommended configuration for postgres databases +(both for xlog and for the bulk data), because the write speed of RAID5 +is quite poor. +Hence you base assumption is not correct, and adding drives *does* help. + +>Most requests +>in OLTP require most of the request time to seek, not to read. Only +>in single large block data transfers will you get any benefit from +>adding more drives, which is atypical in most database applications. +>For most database applications, the only way to increase +>transactions/sec is to decrease request service time, which is +>generaly achieved with better seek times or a better controller card, +>or possibly spreading your database accross multiple tablespaces on +>seperate paritions. +> +> +This is probably true. However, if you are doing lots of concurrent +connections, and things are properly spread across multiple spindles +(using RAID0+1, or possibly tablespaces across multiple raids). +Then each seek occurs on a separate drive, which allows them to occur at +the same time, rather than sequentially. Having 2 processes competing +for seeking on the same drive is going to be worse than having them on +separate drives. +John +=:-> + + +--------------enig6AA3D949B471AC57304693AF +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCY+teJdeBCYSNAAMRAuzQAKC6qlwljycFzoK4WmZztklbc0DQqACg1qCp +lB+Dk7Bd+Beg0Xi40MW3jAM= +=kiOJ +-----END PGP SIGNATURE----- + +--------------enig6AA3D949B471AC57304693AF-- + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:32:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 33243535C5 + for ; + Mon, 18 Apr 2005 14:32:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06123-06 + for ; + Mon, 18 Apr 2005 17:32:27 +0000 (GMT) +Received: from mars.interactivemediafactory.net (mars.imfeurope.net + [194.2.222.161]) + by svr1.postgresql.org (Postfix) with ESMTP id 886DE53619 + for ; + Mon, 18 Apr 2005 14:32:26 -0300 (ADT) +Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) + by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id + j3IHWB3a002656; Mon, 18 Apr 2005 19:32:12 +0200 (CEST) + (envelope-from jc@directinfos.com) +Message-Id: + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 +Date: Mon, 18 Apr 2005 19:32:09 +0200 +To: Alex Turner +From: Jacques Caron +Subject: Re: How to improve db performance with $7K? +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <33c6269f05041809566abf91d2@mail.gmail.com> +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/411 +X-Sequence-Number: 11808 + +Hi, + +At 18:56 18/04/2005, Alex Turner wrote: +>All drives are required to fill every request in all RAID levels + +No, this is definitely wrong. In many cases, most drives don't actually +have the data requested, how could they handle the request? + +When reading one random sector, only *one* drive out of N is ever used to +service any given request, be it RAID 0, 1, 0+1, 1+0 or 5. + +When writing: +- in RAID 0, 1 drive +- in RAID 1, RAID 0+1 or 1+0, 2 drives +- in RAID 5, you need to read on all drives and write on 2. + +Otherwise, what would be the point of RAID 0, 0+1 or 1+0? + +Jacques. + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:32:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0EB2D535E3 + for ; + Mon, 18 Apr 2005 14:32:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05760-08 + for ; + Mon, 18 Apr 2005 17:32:54 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C67E8535E2 + for ; + Mon, 18 Apr 2005 14:32:48 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3IHWmix023920; + Mon, 18 Apr 2005 13:32:48 -0400 (EDT) +To: "Rodrigo Moreno" +Cc: pgsql-performance@postgresql.org +Subject: Re: RES: How to improve postgres performace +In-reply-to: <20050418163126.E004E14C097@talara.terra.com.br> +References: <20050418163126.E004E14C097@talara.terra.com.br> +Comments: In-reply-to "Rodrigo Moreno" + message dated "Mon, 18 Apr 2005 13:31:22 -0300" +Date: Mon, 18 Apr 2005 13:32:48 -0400 +Message-ID: <23919.1113845568@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/412 +X-Sequence-Number: 11809 + +"Rodrigo Moreno" writes: +> The current values for: +> max_fsm_pages = 1048576 +> max_fsm_relations = 1000 +> this is enough ? + +That max_fsm_pages value is enough to cover 8Gb, so it should work OK +for a database disk footprint up to 10 or so Gb. I don't know how many +tables in your installation so I can't say if max_fsm_relations is high +enough, but you can check that by looking at the tail end of the output +of VACUUM VERBOSE. (Or just count 'em ;-)) + +Offhand these look reasonable, though, so if you are seeing database +bloat over time it probably means you need to tweak your autovacuum +settings. I'm not much of an autovacuum expert, but maybe someone +else can help you there. + +You might want to keep track of physical file sizes over a period of +time and try to determine exactly where the bloat is happening. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:34:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9CE01535EE + for ; + Mon, 18 Apr 2005 14:34:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06209-09 + for ; + Mon, 18 Apr 2005 17:34:53 +0000 (GMT) +Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) + by svr1.postgresql.org (Postfix) with ESMTP id DA5DD535C2 + for ; + Mon, 18 Apr 2005 14:34:47 -0300 (ADT) +Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) + by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id j3IHYTfL015865 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); + Mon, 18 Apr 2005 13:34:30 -0400 (EDT) +X-Rentec: external +Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) + by wren.rentec.com (8.13.1/8.12.1) with ESMTP id j3IHYShG025805; + Mon, 18 Apr 2005 13:34:29 -0400 (EDT) +Message-ID: <4263EFA4.2000900@rentec.com> +Date: Mon, 18 Apr 2005 13:34:28 -0400 +From: Alan Stange +Reply-To: stange@rentec.com +Organization: Renaissance Technologies Corp. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alex Turner +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> +In-Reply-To: <33c6269f05041809566abf91d2@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Logged: Logged by unicorn.rentec.com as j3IHYTfL015865 at Mon Apr 18 + 13:34:30 2005 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/413 +X-Sequence-Number: 11810 + +Alex Turner wrote: + +>[snip] +> +> +>>Adding drives will not let you get lower response times than the average seek +>>time on your drives*. But it will let you reach that response time more often. +>> +>> +>> +>[snip] +> +>I believe your assertion is fundamentaly flawed. Adding more drives +>will not let you reach that response time more often. All drives are +>required to fill every request in all RAID levels (except possibly +>0+1, but that isn't used for enterprise applicaitons). Most requests +>in OLTP require most of the request time to seek, not to read. Only +>in single large block data transfers will you get any benefit from +>adding more drives, which is atypical in most database applications. +>For most database applications, the only way to increase +>transactions/sec is to decrease request service time, which is +>generaly achieved with better seek times or a better controller card, +>or possibly spreading your database accross multiple tablespaces on +>seperate paritions. +> +>My assertion therefore is that simply adding more drives to an already +>competent* configuration is about as likely to increase your database +>effectiveness as swiss cheese is to make your car run faster. +> +> + +Consider the case of a mirrored file system with a mostly read() +workload. Typical behavior is to use a round-robin method for issueing +the read operations to each mirror in turn, but one can use other +methods like a geometric algorithm that will issue the reads to the +drive with the head located closest to the desired track. Some +systems have many mirrors of the data for exactly this behavior. In +fact, one can carry this logic to the extreme and have one drive for +every cylinder in the mirror, thus removing seek latencies completely. +In fact this extreme case would also remove the rotational latency as +the cylinder will be in the disks read cache. :-) Of course, writing +data would be a bit slow! + +I'm not sure I understand your assertion that "all drives are required +to fill every request in all RAID levels". After all, in mirrored +reads only one mirror needs to read any given block of data, so I don't +know what goal is achieved in making other mirrors read the same data. + +My assertion (based on ample personal experience) is that one can +*always* get improved performance by adding more drives. Just limit the +drives to use the first few cylinders so that the average seek time is +greatly reduced and concatenate the drives together. One can then build +the usual RAID device out of these concatenated metadevices. Yes, one +is wasting lots of disk space, but that's life. If your goal is +performance, then you need to put your money on the table. The +system will be somewhat unreliable because of the device count, +additional SCSI buses, etc., but that too is life in the high +performance world. + +-- Alan + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:42:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 271B5535EE + for ; + Mon, 18 Apr 2005 14:42:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10938-09 + for ; + Mon, 18 Apr 2005 17:42:35 +0000 (GMT) +Received: from mars.interactivemediafactory.net (mars.imfeurope.net + [194.2.222.161]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D9EA53694 + for ; + Mon, 18 Apr 2005 14:42:27 -0300 (ADT) +Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) + by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id + j3IHgHpS003495; Mon, 18 Apr 2005 19:42:18 +0200 (CEST) + (envelope-from jc@directinfos.com) +Message-Id: + <6.2.0.14.0.20050418183007.03d0ce18@pop.interactivemediafactory.net> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 +Date: Mon, 18 Apr 2005 19:41:49 +0200 +To: Greg Stark +From: Jacques Caron +Subject: Re: How to improve db performance with $7K? +Cc: William Yu , pgsql-performance@postgresql.org +In-Reply-To: <87pswsku6e.fsf@stark.xeocode.com> +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/415 +X-Sequence-Number: 11812 + +Hi, + +At 16:59 18/04/2005, Greg Stark wrote: + +>William Yu writes: +> +> > Using the above prices for a fixed budget for RAID-10, you could get: +> > +> > SATA 7200 -- 680MB per $1000 +> > SATA 10K -- 200MB per $1000 +> > SCSI 10K -- 125MB per $1000 +> +>What a lot of these analyses miss is that cheaper == faster because cheaper +>means you can buy more spindles for the same price. I'm assuming you picked +>equal sized drives to compare so that 200MB/$1000 for SATA is almost twice as +>many spindles as the 125MB/$1000. That means it would have almost double the +>bandwidth. And the 7200 RPM case would have more than 5x the bandwidth. +> +>While 10k RPM drives have lower seek times, and SCSI drives have a natural +>seek time advantage, under load a RAID array with fewer spindles will start +>hitting contention sooner which results into higher latency. If the controller +>works well the larger SATA arrays above should be able to maintain their +>mediocre latency much better under load than the SCSI array with fewer drives +>would maintain its low latency response time despite its drives' lower average +>seek time. + +I would definitely agree. More factors in favor of more cheap drives: +- cheaper drives (7200 rpm) have larger disks (3.7" diameter against 2.6 or +3.3). That means the outer tracks hold more data, and the same amount of +data is held on a smaller area, which means less tracks, which means +reduced seek times. You can roughly count the real average seek time as +(average seek time over full disk * size of dataset / capacity of disk). +And you actually need to physicall seek less often too. + +- more disks means less data per disk, which means the data is further +concentrated on outer tracks, which means even lower seek times + +Also, what counts is indeed not so much the time it takes to do one single +random seek, but the number of random seeks you can do per second. Hence, +more disks means more seeks per second (if requests are evenly distributed +among all disks, which a good stripe size should achieve). + +Not taking into account TCQ/NCQ or write cache optimizations, the important +parameter (random seeks per second) can be approximated as: + +N * 1000 / (lat + seek * ds / (N * cap)) + +Where: +N is the number of disks +lat is the average rotational latency in milliseconds (500/(rpm/60)) +seek is the average seek over the full disk in milliseconds +ds is the dataset size +cap is the capacity of each disk + +Using this formula and a variety of disks, counting only the disks +themselves (no enclosures, controllers, rack space, power, maintenance...), +trying to maximize the number of seeks/second for a fixed budget (1000 +euros) with a dataset size of 100 GB makes SATA drives clear winners: you +can get more than 4000 seeks/second (with 21 x 80GB disks) where SCSI +cannot even make it to the 1400 seek/second point (with 8 x 36 GB disks). +Results can vary quite a lot based on the dataset size, which illustrates +the importance of "staying on the edges" of the disks. I'll try to make the +analysis more complete by counting some of the "overhead" (obviously 21 +drives has a lot of other implications!), but I believe SATA drives still +win in theory. + +It would be interesting to actually compare this to real-world (or +nearly-real-world) benchmarks to measure the effectiveness of features like +TCQ/NCQ etc. + +Jacques. + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:46:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0AE3D535C8 + for ; + Mon, 18 Apr 2005 14:46:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12798-03 + for ; + Mon, 18 Apr 2005 17:46:50 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A9FC535D8 + for ; + Mon, 18 Apr 2005 14:46:49 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Mon, 18 Apr 2005 10:49:49 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Mon, 18 Apr 2005 10:49:48 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005041810494810305 + for ; + Mon, 18 Apr 2005 10:49:48 -0700 +X-ASG-Debug-ID: 1113846405-32259-12-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail1 (mail1.hq.corp [192.168.160.5]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 05787202B608 + for ; + Mon, 18 Apr 2005 10:46:45 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Mon, 18 Apr 2005 10:49:43 -0700 +Message-ID: <4263F259.7030804@sfnet.cc> +Date: Mon, 18 Apr 2005 10:46:01 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alex Turner +Cc: pgsql-performance@postgresql.org +X-ASG-Orig-Subj: Re: [PERFORM] How to improve db performance with $7K? +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> +In-Reply-To: <33c6269f05041809566abf91d2@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 18 Apr 2005 17:49:43.0099 (UTC) + FILETIME=[007170B0:01C5443F] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.376 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5000] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.725 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, NO_DNS_FOR_FROM +X-Spam-Level: +X-Archive-Number: 200504/416 +X-Sequence-Number: 11813 + +Alex, + +In the situation of the animal hospital server I oversee, their +application is OLTP. Adding hard drives (6-8) does help performance. +Benchmarks like pgbench and OSDB agree with it, but in reality users +could not see noticeable change. However, moving the top 5/10 tables and +indexes to their own space made a greater impact. + +Someone who reads PostgreSQL 8.0 Performance Checklist is going to see +point #1 add more disks is the key. How about adding a subpoint to +explaining when more disks isn't enough or applicable? I maybe +generalizing the complexity of tuning an OLTP application, but some +clarity could help. + +Steve Poe + + + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 14:47:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 68206533CB + for ; + Mon, 18 Apr 2005 14:47:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12793-05 + for ; + Mon, 18 Apr 2005 17:47:03 +0000 (GMT) +Received: from linares.terra.com.br (linares.terra.com.br [200.154.55.228]) + by svr1.postgresql.org (Postfix) with ESMTP id DA7FA531DE + for ; + Mon, 18 Apr 2005 14:47:02 -0300 (ADT) +Received: from arica.terra.com.br (arica.terra.com.br [200.154.55.128]) + by linares.terra.com.br (Postfix) with ESMTP + id 050C4DDC4C0; Mon, 18 Apr 2005 14:47:02 -0300 (BRT) +X-Terra-Karma: -2% +X-Terra-Hash: fb165ddbfb6a3ea70ab708f8a94422a2 +Received-SPF: pass (arica.terra.com.br: domain of terra.com.br designates + 200.154.55.128 as permitted sender) client-ip=200.154.55.128; + envelope-from=rodrigo.miguel@terra.com.br; helo=rmsmnote; +Received: from rmsmnote (unknown [200.168.177.140]) + (authenticated user rodrmigu) + by arica.terra.com.br (Postfix) with ESMTP id BDD1219007F; + Mon, 18 Apr 2005 14:47:01 -0300 (BRT) +From: "Rodrigo Moreno" +To: "'Tom Lane'" +Cc: +Subject: RES: RES: How to improve postgres performace +Date: Mon, 18 Apr 2005 14:46:56 -0300 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.5510 +In-reply-to: <23919.1113845568@sss.pgh.pa.us> +Thread-Index: AcVEPKXHyI2JHmotSSqSmS++on9EzwAAVlAg +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 +Message-Id: <20050418174701.BDD1219007F@arica.terra.com.br> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.197 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200504/417 +X-Sequence-Number: 11814 + +> That max_fsm_pages value is enough to cover 8Gb, so it should work OK for +a database disk footprint up to 10 or so Gb. > I don't know how many tables +in your installation so I can't say if max_fsm_relations is high enough, but +you can check >that by looking at the tail end of the output of VACUUM +VERBOSE. (Or just count 'em ;-)) + +The last count in vacuum verbose shows me 92 relations, and I know the lower +value for max_fsm_relations is enough, maybe I'll change to 500. + +> Offhand these look reasonable, though, so if you are seeing database bloat +over time it probably means you need to tweak > your autovacuum settings. +I'm not much of an autovacuum expert, but maybe someone else can help you +there. + +I'll let the autovacuum running this week to see what happen. + +> You might want to keep track of physical file sizes over a period of time +and try to determine exactly where the bloat > is happening. + +There is two mostly used and bigger tables, I'll keep eyes on both tables. + +Thanks +Rodrigo Moreno + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:16:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DFC64534CF + for ; + Mon, 18 Apr 2005 15:16:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23567-02 + for ; + Mon, 18 Apr 2005 18:16:15 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) + by svr1.postgresql.org (Postfix) with ESMTP id 2123553609 + for ; + Mon, 18 Apr 2005 15:16:14 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1542956wri + for ; + Mon, 18 Apr 2005 11:16:15 -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=crhFDxWVV4i4i1HpdmDU2tgGcEMuom142Idlh9MqYqJpfT+74H6ERJgdqNHCDZolTSWICvTd+IV9j6/Z6XVBQQOtjbzoC0tNEgcuel27Xe4uMi2RdKmyVQY/guZ5AlCYXEuUtYikikhj8IooECa0tO4r5Z/TI3Ew0GxR2kWieVU= +Received: by 10.54.37.6 with SMTP id k6mr127214wrk; + Mon, 18 Apr 2005 11:16:15 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 11:16:15 -0700 (PDT) +Message-ID: <33c6269f05041811165228c814@mail.gmail.com> +Date: Mon, 18 Apr 2005 14:16:15 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Jacques Caron +Subject: Re: How to improve db performance with $7K? +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.275 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/418 +X-Sequence-Number: 11815 + +Ok - well - I am partially wrong... + +If you're stripe size is 64Kb, and you are reading 256k worth of data, +it will be spread across four drives, so you will need to read from +four devices to get your 256k of data (RAID 0 or 5 or 10), but if you +are only reading 64kb of data, I guess you would only need to read +from one disk. + +So my assertion that adding more drives doesn't help is pretty +wrong... particularly with OLTP because it's always dealing with +blocks that are smaller that the stripe size. + +Alex Turner +netEconomist + +On 4/18/05, Jacques Caron wrote: +> Hi, +>=20 +> At 18:56 18/04/2005, Alex Turner wrote: +> >All drives are required to fill every request in all RAID levels +>=20 +> No, this is definitely wrong. In many cases, most drives don't actually +> have the data requested, how could they handle the request? +>=20 +> When reading one random sector, only *one* drive out of N is ever used to +> service any given request, be it RAID 0, 1, 0+1, 1+0 or 5. +>=20 +> When writing: +> - in RAID 0, 1 drive +> - in RAID 1, RAID 0+1 or 1+0, 2 drives +> - in RAID 5, you need to read on all drives and write on 2. +>=20 +> Otherwise, what would be the point of RAID 0, 0+1 or 1+0? +>=20 +> Jacques. +>=20 +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:18:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E7DF953232 + for ; + Mon, 18 Apr 2005 15:18:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24454-02 + for ; + Mon, 18 Apr 2005 18:18:21 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) + by svr1.postgresql.org (Postfix) with ESMTP id 8321A52955 + for ; + Mon, 18 Apr 2005 15:18:21 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1543633wri + for ; + Mon, 18 Apr 2005 11:18:22 -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=IdYhJgfvzfxsJ7ooPrsZ2Dm95QmMOK7E34ObEgwirS79ZyZC63/RSbGiBrmULGVKr2mMZ9Vd7CbjB/pwweNb2kLM4XbTnHo0uVcjFBBduQVujyXoWN0QpSD/1gFRXbva4wTI4hAgmFJl5lqB+fXap3AL2sbX6hoPfAFJMGioryI= +Received: by 10.54.32.51 with SMTP id f51mr2496264wrf; + Mon, 18 Apr 2005 11:18:21 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 11:18:21 -0700 (PDT) +Message-ID: <33c6269f05041811187170139f@mail.gmail.com> +Date: Mon, 18 Apr 2005 14:18:21 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: John A Meinel +Subject: Re: How to improve db performance with $7K? +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <4263EB5E.8000309@arbash-meinel.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <4263EB5E.8000309@arbash-meinel.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.276 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/419 +X-Sequence-Number: 11816 + +Not true - the recommended RAID level is RAID 10, not RAID 0+1 (at +least I would never recommend 1+0 for anything). + +RAID 10 and RAID 0+1 are _quite_ different. One gives you very good +redundancy, the other is only slightly better than RAID 5, but +operates faster in degraded mode (single drive). + +Alex Turner +netEconomist + +On 4/18/05, John A Meinel wrote: +> Alex Turner wrote: +>=20 +> >[snip] +> > +> > +> >>Adding drives will not let you get lower response times than the averag= +e seek +> >>time on your drives*. But it will let you reach that response time more= + often. +> >> +> >> +> >> +> >[snip] +> > +> >I believe your assertion is fundamentaly flawed. Adding more drives +> >will not let you reach that response time more often. All drives are +> >required to fill every request in all RAID levels (except possibly +> >0+1, but that isn't used for enterprise applicaitons). +> > +> Actually 0+1 is the recommended configuration for postgres databases +> (both for xlog and for the bulk data), because the write speed of RAID5 +> is quite poor. +> Hence you base assumption is not correct, and adding drives *does* help. +>=20 +> >Most requests +> >in OLTP require most of the request time to seek, not to read. Only +> >in single large block data transfers will you get any benefit from +> >adding more drives, which is atypical in most database applications. +> >For most database applications, the only way to increase +> >transactions/sec is to decrease request service time, which is +> >generaly achieved with better seek times or a better controller card, +> >or possibly spreading your database accross multiple tablespaces on +> >seperate paritions. +> > +> > +> This is probably true. However, if you are doing lots of concurrent +> connections, and things are properly spread across multiple spindles +> (using RAID0+1, or possibly tablespaces across multiple raids). +> Then each seek occurs on a separate drive, which allows them to occur at +> the same time, rather than sequentially. Having 2 processes competing +> for seeking on the same drive is going to be worse than having them on +> separate drives. +> John +> =3D:-> +>=20 +>=20 +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:19:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 777515335B + for ; + Mon, 18 Apr 2005 15:19:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22752-07 + for ; + Mon, 18 Apr 2005 18:19:36 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 540B253359 + for ; + Mon, 18 Apr 2005 15:19:35 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1544034wri + for ; + Mon, 18 Apr 2005 11:19:36 -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=OcsE2R77c+kOBV/LxX6FAYLe7KtFJudaG064mFzoDUfx3pOxLVGaQXQQIlp3/v0E3sBd4tth1Dyslh72t3BNrKsexdf/Spb5pf+TwXJ4Jsr7Rie47X3mv1agd/oVeWJcF4Xz/SbjnI9O/RAvfj07OD4aD3sC6OIPnC1AiXJ4Xog= +Received: by 10.54.78.16 with SMTP id a16mr1177608wrb; + Mon, 18 Apr 2005 11:19:36 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 11:19:36 -0700 (PDT) +Message-ID: <33c6269f05041811191e5047fd@mail.gmail.com> +Date: Mon, 18 Apr 2005 14:19:36 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Steve Poe +Subject: Re: How to improve db performance with $7K? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <4263F259.7030804@sfnet.cc> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <4263F259.7030804@sfnet.cc> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.276 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/420 +X-Sequence-Number: 11817 + +I think the add more disks thing is really from the point of view that +one disk isn't enough ever. You should really have at least four +drives configured into two RAID 1s. Most DBAs will know this, but +most average Joes won't. + +Alex Turner +netEconomist + +On 4/18/05, Steve Poe wrote: +> Alex, +>=20 +> In the situation of the animal hospital server I oversee, their +> application is OLTP. Adding hard drives (6-8) does help performance. +> Benchmarks like pgbench and OSDB agree with it, but in reality users +> could not see noticeable change. However, moving the top 5/10 tables and +> indexes to their own space made a greater impact. +>=20 +> Someone who reads PostgreSQL 8.0 Performance Checklist is going to see +> point #1 add more disks is the key. How about adding a subpoint to +> explaining when more disks isn't enough or applicable? I maybe +> generalizing the complexity of tuning an OLTP application, but some +> clarity could help. +>=20 +> Steve Poe +>=20 +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:21:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A034E53359 + for ; + Mon, 18 Apr 2005 15:21:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25480-04 + for ; + Mon, 18 Apr 2005 18:21:06 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) + by svr1.postgresql.org (Postfix) with ESMTP id C6BA653371 + for ; + Mon, 18 Apr 2005 15:21:04 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1544516wri + for ; + Mon, 18 Apr 2005 11:21:06 -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=AmlKQvU4lczINKiXqr+6TJbLmbU0KSYBgsFJf8ofkb6d2P7UCKK1rzvayYnuQ5NOY3fJ0oPkUmuoH9EhpOnZ4kkKCizTX7FVZ+fLLXvX7E8gEObAmSUlSm0eNj5FqxGEUBd7ME8WUAKYDcTC/zrwBXYkSW5/GAJQaKjVTXD910k= +Received: by 10.54.32.51 with SMTP id f51mr2500056wrf; + Mon, 18 Apr 2005 11:21:04 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 11:21:04 -0700 (PDT) +Message-ID: <33c6269f0504181121385a1f0a@mail.gmail.com> +Date: Mon, 18 Apr 2005 14:21:04 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Jacques Caron +Subject: Re: How to improve db performance with $7K? +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <33c6269f05041811165228c814@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> + <33c6269f05041811165228c814@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.276 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/421 +X-Sequence-Number: 11818 + +So I wonder if one could take this stripe size thing further and say +that a larger stripe size is more likely to result in requests getting +served parallized across disks which would lead to increased +performance? + +Again, thanks to all people on this list, I know that I have learnt a +_hell_ of alot since subscribing. + +Alex Turner +netEconomist + +On 4/18/05, Alex Turner wrote: +> Ok - well - I am partially wrong... +>=20 +> If you're stripe size is 64Kb, and you are reading 256k worth of data, +> it will be spread across four drives, so you will need to read from +> four devices to get your 256k of data (RAID 0 or 5 or 10), but if you +> are only reading 64kb of data, I guess you would only need to read +> from one disk. +>=20 +> So my assertion that adding more drives doesn't help is pretty +> wrong... particularly with OLTP because it's always dealing with +> blocks that are smaller that the stripe size. +>=20 +> Alex Turner +> netEconomist +>=20 +> On 4/18/05, Jacques Caron wrote: +> > Hi, +> > +> > At 18:56 18/04/2005, Alex Turner wrote: +> > >All drives are required to fill every request in all RAID levels +> > +> > No, this is definitely wrong. In many cases, most drives don't actually +> > have the data requested, how could they handle the request? +> > +> > When reading one random sector, only *one* drive out of N is ever used = +to +> > service any given request, be it RAID 0, 1, 0+1, 1+0 or 5. +> > +> > When writing: +> > - in RAID 0, 1 drive +> > - in RAID 1, RAID 0+1 or 1+0, 2 drives +> > - in RAID 5, you need to read on all drives and write on 2. +> > +> > Otherwise, what would be the point of RAID 0, 0+1 or 1+0? +> > +> > Jacques. +> > +> > +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:24:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C79BA5336C + for ; + Mon, 18 Apr 2005 15:24:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26765-02 + for ; + Mon, 18 Apr 2005 18:24:29 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 651D353247 + for ; + Mon, 18 Apr 2005 15:24:28 -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 1DNaut-0007bI-00; Mon, 18 Apr 2005 14:24:15 -0400 +To: Jacques Caron +Cc: Alex Turner , Greg Stark , + William Yu , pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> +In-Reply-To: + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 18 Apr 2005 14:24:14 -0400 +Message-ID: <873btokkoh.fsf@stark.xeocode.com> +Lines: 14 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/422 +X-Sequence-Number: 11819 + + +Jacques Caron writes: + +> When writing: +> - in RAID 0, 1 drive +> - in RAID 1, RAID 0+1 or 1+0, 2 drives +> - in RAID 5, you need to read on all drives and write on 2. + +Actually RAID 5 only really needs to read from two drives. The existing parity +block and the block you're replacing. It just xors the old block, the new +block, and the existing parity block to generate the new parity block. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:28:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 50F955334B + for ; + Mon, 18 Apr 2005 15:28:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27651-03 + for ; + Mon, 18 Apr 2005 18:28:37 +0000 (GMT) +Received: from mars.interactivemediafactory.net (mars.imfeurope.net + [194.2.222.161]) + by svr1.postgresql.org (Postfix) with ESMTP id A0AA553346 + for ; + Mon, 18 Apr 2005 15:28:35 -0300 (ADT) +Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) + by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id + j3IISOrV007934; Mon, 18 Apr 2005 20:28:25 +0200 (CEST) + (envelope-from jc@directinfos.com) +Message-Id: <6.2.0.14.0.20050418202039.03f12008@wheresmymailserver.com> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 +Date: Mon, 18 Apr 2005 20:24:25 +0200 +To: Alex Turner +From: Jacques Caron +Subject: Re: How to improve db performance with $7K? +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <33c6269f05041811165228c814@mail.gmail.com> +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> + <33c6269f05041811165228c814@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/423 +X-Sequence-Number: 11820 + +Hi, + +At 20:16 18/04/2005, Alex Turner wrote: +>So my assertion that adding more drives doesn't help is pretty +>wrong... particularly with OLTP because it's always dealing with +>blocks that are smaller that the stripe size. + +When doing random seeks (which is what a database needs most of the time), +the number of disks helps improve the number of seeks per second (which is +the bottleneck in this case). When doing sequential reads, the number of +disks helps improve total throughput (which is the bottleneck in that case). + +In short: in always helps :-) + +Jacques. + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:28:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 81E5C5334C + for ; + Mon, 18 Apr 2005 15:28:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28120-01 + for ; + Mon, 18 Apr 2005 18:28:39 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id E295053347 + for ; + Mon, 18 Apr 2005 15:28:38 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3IIMmma013173; Mon, 18 Apr 2005 11:22:48 -0700 +Message-ID: <4263FC2E.6070207@commandprompt.com> +Date: Mon, 18 Apr 2005 11:27:58 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alex Turner +Cc: John A Meinel , + Greg Stark , William Yu , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <4263EB5E.8000309@arbash-meinel.com> + <33c6269f05041811187170139f@mail.gmail.com> +In-Reply-To: <33c6269f05041811187170139f@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.026 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/424 +X-Sequence-Number: 11821 + +Alex Turner wrote: +> Not true - the recommended RAID level is RAID 10, not RAID 0+1 (at +> least I would never recommend 1+0 for anything). + +Uhmm I was under the impression that 1+0 was RAID 10 and that 0+1 is NOT +RAID 10. + +Ref: http://www.acnc.com/raid.html + +Sincerely, + +Joshua D. Drake + + +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:32:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4797C52A7C; + Mon, 18 Apr 2005 15:32:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28977-07; Mon, 18 Apr 2005 18:31:52 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id B2AC852A6A; + Mon, 18 Apr 2005 15:31:50 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3IIVnO19950; + Mon, 18 Apr 2005 14:31:49 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504181831.j3IIVnO19950@candle.pha.pa.us> +Subject: Re: Compressing WAL +In-Reply-To: <1113435222.16721.1696.camel@localhost.localdomain> +To: Simon Riggs +Date: Mon, 18 Apr 2005 14:31:49 -0400 (EDT) +Cc: "Jim C. Nasby" , + pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/425 +X-Sequence-Number: 11822 + + +Added to TODO: + + * Compress WAL entries [wal] + +I have also added this email to TODO.detail. + +--------------------------------------------------------------------------- + +Simon Riggs wrote: +> On Sun, 2005-04-10 at 21:12 -0400, Bruce Momjian wrote: +> > Jim C. Nasby wrote: +> > > Maybe better for -hackers, but here it goes anyway... +> > > +> > > Has anyone looked at compressing WAL's before writing to disk? On a +> > > system generating a lot of WAL it seems there might be some gains to be +> > > had WAL data could be compressed before going to disk, since today's +> > > machines are generally more I/O bound than CPU bound. And unlike the +> > > base tables, you generally don't need to read the WAL, so you don't +> > > really need to worry about not being able to quickly scan through the +> > > data without decompressing it. +> > +> > I have never heard anyone talk about it, but it seems useful. I think +> > compressing the page images written on first page modification since +> > checkpoint would be a big win. +> +> Well it was discussed 2-3 years ago as part of the PITR preamble. You +> may be surprised to read that over... +> +> A summary of thoughts to date on this are: +> +> xlog.c XLogInsert places backup blocks into the wal buffers before +> insertion, so is the right place to do this. It would be possible to do +> this before any LWlocks are taken, so would not not necessarily impair +> scalability. +> +> Currently XLogInsert is a severe CPU bottleneck around the CRC +> calculation, as identified recently by Tom. Digging further, the code +> used seems to cause processor stalls on Intel CPUs, possibly responsible +> for much of the CPU time. Discussions to move to a 32-bit CRC would also +> be effected by this because of the byte-by-byte nature of the algorithm, +> whatever the length of the generating polynomial. PostgreSQL's CRC +> algorithm is the fastest BSD code available. Until improvement is made +> there, I would not investigate compression further. Some input from +> hardware tuning specialists is required... +> +> The current LZW compression code uses a 4096 byte lookback size, so that +> would need to be modified to extend across a whole block. An +> alternative, suggested originally by Tom and rediscovered by me because +> I just don't read everybody's fine words in history, is to simply take +> out the freespace in the middle of every heap block that consists of +> zeros. +> +> Any solution in this area must take into account the variability of the +> size of freespace in database blocks. Some databases have mostly full +> blocks, others vary. There would also be considerable variation in +> compressability of blocks, especially since some blocks (e.g. TOAST) are +> likely to already be compressed. There'd need to be some testing done to +> see exactly the point where the costs of compression produce realisable +> benefits. +> +> So any solution must be able to cope with both compressed blocks and +> non-compressed blocks. My current thinking is that this could be +> achieved by using the spare fourth bit of the BkpBlocks portion of the +> XLog structure, so that either all included BkpBlocks are compressed or +> none of them are, and hope that allows benefit to shine through. Not +> thought about heap/index issues. +> +> It is possible that an XLogWriter process could be used to assist in the +> CRC and compression calculations also, an a similar process used to +> assist decompression for recovery, in time. +> +> I regret I do not currently have time to pursue further. +> +> Best Regards, Simon Riggs +> + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:33:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4024352A7C + for ; + Mon, 18 Apr 2005 15:33:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29529-04 + for ; + Mon, 18 Apr 2005 18:33:28 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A1EC52955 + for ; + Mon, 18 Apr 2005 15:33:27 -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 1DNb3c-0007cE-00; Mon, 18 Apr 2005 14:33:16 -0400 +To: Tom Lane +Cc: "Merlin Moncure" , + "Dawid Kuroczko" , pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <22219.1113839449@sss.pgh.pa.us> +In-Reply-To: <22219.1113839449@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 18 Apr 2005 14:33:15 -0400 +Message-ID: <87u0m4j5p0.fsf@stark.xeocode.com> +Lines: 40 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/426 +X-Sequence-Number: 11823 + +Tom Lane writes: + +> It would be interesting sometime to try to teach the planner about +> inlining SQL-language functions to become joins. That is, given +> +> create function id2name(int) returns text as +> 'select name from mytab where id = $1' language sql stable; +> +> select uid, id2name(uid) from othertab where something; +> +> I think that in principle this could automatically be converted to +> +> select uid, name from othertab left join mytab on (uid = id) where something; + +The Inlining of the function is presumably a side-issue. I have tons of +queries that use subqueries in the select list for which the same behaviour +would be appropriate. + +Things like + +select uid, (select name from mytab where id = uid) as name from othertab ... + + +> There are some pitfalls though, particularly that you'd have to be able to +> prove that the function's query couldn't return more than one row (else the +> join might produce more result rows than the original query). + +Or just have a special join type that has the desired behaviour in that case. +Ie, pretend the query was really + +SELECT * FROM othertab LEFT SINGLE JOIN mytab ... + +Where "LEFT SINGLE JOIN" is an imaginary syntax that doesn't actually have to +exist in the parser, but exists in the planner/executor and behaves +differently in the case of duplicate matches. + +Actually I could see such a syntax being useful directly too. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:42:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 890A953350 + for ; + Mon, 18 Apr 2005 15:42:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30806-08 + for ; + Mon, 18 Apr 2005 18:42:11 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 80C9853349 + for ; + Mon, 18 Apr 2005 15:42:10 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3IIfflO029500 + for ; Mon, 18 Apr 2005 18:41:41 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3IIfftJ029490 + for ; Mon, 18 Apr 2005 18:41:41 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Mon, 18 Apr 2005 18:41:37 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVEQ7Hwb2th1Q4eQp6bNZ985mjNkQAAPi0g +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.159 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/427 +X-Sequence-Number: 11824 + +Don't you think "optimal stripe width" would be +a good question to research the binaries for? I'd +think that drives the answer, largely. (uh oh, pun alert) + +EG, oracle issues IO requests (this may have changed _just_=20 +recently) in 64KB chunks, regardless of what you ask for.=20 +So when I did my striping (many moons ago, when the Earth=20 +was young...) I did it in 128KB widths, and set the oracle=20 +"multiblock read count" according. For oracle, any stripe size +under 64KB=3Dstupid, anything much over 128K/258K=3Dwasteful.=20 + +I am eager to find out how PG handles all this.=20 + + +- Ross + + + +p.s. 'You want a database record? I=20 + gotcher record right here' = +http://en.wikipedia.org/wiki/Akashic_Records + + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Alex Turner +Sent: Monday, April 18, 2005 2:21 PM +To: Jacques Caron +Cc: Greg Stark; William Yu; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +So I wonder if one could take this stripe size thing further and say = +that a larger stripe size is more likely to result in requests getting = +served parallized across disks which would lead to increased = +performance? + +Again, thanks to all people on this list, I know that I have learnt a = +_hell_ of alot since subscribing. + +Alex Turner +netEconomist + +On 4/18/05, Alex Turner wrote: +> Ok - well - I am partially wrong... +>=20 +> If you're stripe size is 64Kb, and you are reading 256k worth of data, = + +> it will be spread across four drives, so you will need to read from=20 +> four devices to get your 256k of data (RAID 0 or 5 or 10), but if you=20 +> are only reading 64kb of data, I guess you would only need to read=20 +> from one disk. +>=20 +> So my assertion that adding more drives doesn't help is pretty=20 +> wrong... particularly with OLTP because it's always dealing with=20 +> blocks that are smaller that the stripe size. +>=20 +> Alex Turner +> netEconomist +>=20 +> On 4/18/05, Jacques Caron wrote: +> > Hi, +> > +> > At 18:56 18/04/2005, Alex Turner wrote: +> > >All drives are required to fill every request in all RAID levels +> > +> > No, this is definitely wrong. In many cases, most drives don't=20 +> > actually have the data requested, how could they handle the request? +> > +> > When reading one random sector, only *one* drive out of N is ever=20 +> > used to service any given request, be it RAID 0, 1, 0+1, 1+0 or 5. +> > +> > When writing: +> > - in RAID 0, 1 drive +> > - in RAID 1, RAID 0+1 or 1+0, 2 drives +> > - in RAID 5, you need to read on all drives and write on 2. +> > +> > Otherwise, what would be the point of RAID 0, 0+1 or 1+0? +> > +> > Jacques. +> > +> > +> + +---------------------------(end of broadcast)--------------------------- +TIP 6: Have you searched our list archives? + + http://archives.postgresql.org + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:51:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DA29753377 + for ; + Mon, 18 Apr 2005 15:51:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34377-07 + for ; + Mon, 18 Apr 2005 18:51:42 +0000 (GMT) +Received: from mars.interactivemediafactory.net (mars.imfeurope.net + [194.2.222.161]) + by svr1.postgresql.org (Postfix) with ESMTP id 792A453364 + for ; + Mon, 18 Apr 2005 15:51:41 -0300 (ADT) +Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) + by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id + j3IIpSNt010807; Mon, 18 Apr 2005 20:51:28 +0200 (CEST) + (envelope-from jc@directinfos.com) +Message-Id: <6.2.0.14.0.20050418202657.03cf3bd0@wheresmymailserver.com> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 +Date: Mon, 18 Apr 2005 20:43:45 +0200 +To: Alex Turner +From: Jacques Caron +Subject: Re: How to improve db performance with $7K? +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <33c6269f0504181121385a1f0a@mail.gmail.com> +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> + <33c6269f05041811165228c814@mail.gmail.com> + <33c6269f0504181121385a1f0a@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/429 +X-Sequence-Number: 11826 + +Hi, + +At 20:21 18/04/2005, Alex Turner wrote: +>So I wonder if one could take this stripe size thing further and say +>that a larger stripe size is more likely to result in requests getting +>served parallized across disks which would lead to increased +>performance? + +Actually, it would be pretty much the opposite. The smaller the stripe +size, the more evenly distributed data is, and the more disks can be used +to serve requests. If your stripe size is too large, many random accesses +within one single file (whose size is smaller than the stripe size/number +of disks) may all end up on the same disk, rather than being split across +multiple disks (the extreme case being stripe size = total size of all +disks, which means concatenation). If all accesses had the same cost (i.e. +no seek time, only transfer time), the ideal would be to have a stripe size +equal to the number of disks. + +But below a certain size, you're going to use multiple disks to serve one +single request which would not have taken much more time from a single disk +(reading even a large number of consecutive blocks within one cylinder does +not take much more time than reading a single block), so you would add +unnecessary seeks on a disk that could have served another request in the +meantime. You should definitely not go below the filesystem block size or +the database block size. + +There is a interesting discussion of the optimal stripe size in the vinum +manpage on FreeBSD: + +http://www.freebsd.org/cgi/man.cgi?query=vinum&apropos=0&sektion=0&manpath=FreeBSD+5.3-RELEASE+and+Ports&format=html + +(look for "Performance considerations", towards the end -- note however +that some of the calculations are not entirely correct). + +Basically it says the optimal stripe size is somewhere between 256KB and +4MB, preferably an odd number, and that some hardware RAID controllers +don't like big stripe sizes. YMMV, as always. + +Jacques. + + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 15:50:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7096253349 + for ; + Mon, 18 Apr 2005 15:50:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34589-06 + for ; + Mon, 18 Apr 2005 18:50:49 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C3B852C7A + for ; + Mon, 18 Apr 2005 15:50:46 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1553816wri + for ; + Mon, 18 Apr 2005 11:50:48 -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=kbZV1hHv5CfGBl8hPT8vIld/s04mrqNyrR7i579tNk9RoUqY1AJDMyS3cIsfnZAt7M58Ld5/RwOIf3zYARPZZm09KFGDO1E91Aii0ydZqokAFAyZdVc1BYbdtcS0nLDvLHChyCGcrHhq5M1AjMGEhfM7+63kz42MIHHRAYouHJ8= +Received: by 10.54.32.51 with SMTP id f51mr2540653wrf; + Mon, 18 Apr 2005 11:50:46 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 11:50:46 -0700 (PDT) +Message-ID: <33c6269f05041811504c737b6f@mail.gmail.com> +Date: Mon, 18 Apr 2005 14:50:46 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: "Joshua D. Drake" +Subject: Re: How to improve db performance with $7K? +Cc: John A Meinel , + Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <4263FC2E.6070207@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <4263EB5E.8000309@arbash-meinel.com> + <33c6269f05041811187170139f@mail.gmail.com> + <4263FC2E.6070207@commandprompt.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.276 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/428 +X-Sequence-Number: 11825 + +Mistype.. I meant 0+1 in the second instance :( + + +On 4/18/05, Joshua D. Drake wrote: +> Alex Turner wrote: +> > Not true - the recommended RAID level is RAID 10, not RAID 0+1 (at +> > least I would never recommend 1+0 for anything). +>=20 +> Uhmm I was under the impression that 1+0 was RAID 10 and that 0+1 is NOT +> RAID 10. +>=20 +> Ref: http://www.acnc.com/raid.html +>=20 +> Sincerely, +>=20 +> Joshua D. Drake +>=20 +>=20 +> > ---------------------------(end of broadcast)--------------------------= +- +> > TIP 3: if posting/reading through Usenet, please send an appropriate +> > subscribe-nomail command to majordomo@postgresql.org so that your +> > message can get through to the mailing list cleanly +>=20 +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 16:21:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 968695334B + for ; + Mon, 18 Apr 2005 16:21:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46429-09 + for ; + Mon, 18 Apr 2005 19:21:45 +0000 (GMT) +Received: from web51405.mail.yahoo.com (web51405.mail.yahoo.com + [206.190.38.184]) + by svr1.postgresql.org (Postfix) with SMTP id 86E5A5339D + for ; + Mon, 18 Apr 2005 16:21:41 -0300 (ADT) +Received: (qmail 84421 invoked by uid 60001); 18 Apr 2005 19:21:42 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=4QK53IGFPF6fKgdpF/c0c4XpvV8MSMwYss7nJ6+E8oaZ0LBSMqykup0RR7ZXcd8j/jZ8C3229YF2U3z4kBp21jXuPm2sLM36346G66CdWzTW5RKJNU3hdyBkuqtCpUx13QgcK6nyFb82VVvedJJVaD+MZsB5VgNOTeazXxGzyi4= + ; +Message-ID: <20050418192142.84419.qmail@web51405.mail.yahoo.com> +Received: from [192.88.67.254] by web51405.mail.yahoo.com via HTTP; + Mon, 18 Apr 2005 12:21:42 PDT +Date: Mon, 18 Apr 2005 12:21:42 -0700 (PDT) +From: Bill Chandler +Subject: Question on REINDEX +To: pgsql-perform +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.846 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/430 +X-Sequence-Number: 11827 + +All, + +A couple of questions regarding REINDEX command: + +Running PostgreSQL 7.4.2 on Solaris. + +1) When is it necessary to run REINDEX or drop/create +an index? All I could really find in the docs is: + +"In some situations it is worthwhile to rebuild +indexes periodically with the REINDEX command. (There +is also contrib/reindexdb which can reindex an entire +database.) However, PostgreSQL 7.4 has substantially +reduced the need for this activity compared to earlier +releases." + +What are these situations? We have a database with +some large tables. Currently we reindex (actually +drop/create) nightly. But as the tables have grown +this has become prohibitively time-consuming. +According to the above comment it may not be necessary +at all. + +2) If reindexing is necessary, how can this be done in +a non-obtrusive way in a production environment. Our +database is being updated constantly. REINDEX locks +client apps out while in progress. Same with "CREATE +INDEX" when we drop/create. The table can have over +10 million row. Recreating the indexes seems to take +hours. This is too long to lock the client apps out. +Is there any other solution? + +thanks, + +Bill + + + +__________________________________ +Do you Yahoo!? +Make Yahoo! your home page +http://www.yahoo.com/r/hs + +From pgsql-performance-owner@postgresql.org Mon Apr 18 16:30:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8995F5335D + for ; + Mon, 18 Apr 2005 16:26:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52550-03 + for ; + Mon, 18 Apr 2005 19:26:30 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) + by svr1.postgresql.org (Postfix) with ESMTP id 9EF3A5334B + for ; + Mon, 18 Apr 2005 16:26:29 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1564877wri + for ; + Mon, 18 Apr 2005 12:26:31 -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=QHj8ms6x4a6UCg4FMvKYbenfHcUXWTxMtRFHEFvQRtdhwmiKoRNBG9Uo+mHX8Q7XZ1k13PimVmxOY1mMZpMvofTQ0jhbOaiwY1SgErxkisrcgJi/lJLYWlUdHMPW1n49i9AKxNic7iA8SCPRZdcp2JOVOaBEW0eM5FW6ZZL4lHo= +Received: by 10.54.37.6 with SMTP id k6mr199426wrk; + Mon, 18 Apr 2005 12:26:31 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 12:26:31 -0700 (PDT) +Message-ID: <33c6269f050418122650848e37@mail.gmail.com> +Date: Mon, 18 Apr 2005 15:26:31 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Jacques Caron +Subject: Re: How to improve db performance with $7K? +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <6.2.0.14.0.20050418202657.03cf3bd0@wheresmymailserver.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <87pswsku6e.fsf@stark.xeocode.com> + <33c6269f0504180817511b27a3@mail.gmail.com> + <878y3gks3p.fsf@stark.xeocode.com> + <33c6269f05041809566abf91d2@mail.gmail.com> + <6.2.0.14.0.20050418192528.04238088@pop.interactivemediafactory.net> + <33c6269f05041811165228c814@mail.gmail.com> + <33c6269f0504181121385a1f0a@mail.gmail.com> + <6.2.0.14.0.20050418202657.03cf3bd0@wheresmymailserver.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.277 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/433 +X-Sequence-Number: 11830 + +On 4/18/05, Jacques Caron wrote: +> Hi, +>=20 +> At 20:21 18/04/2005, Alex Turner wrote: +> >So I wonder if one could take this stripe size thing further and say +> >that a larger stripe size is more likely to result in requests getting +> >served parallized across disks which would lead to increased +> >performance? +>=20 +> Actually, it would be pretty much the opposite. The smaller the stripe +> size, the more evenly distributed data is, and the more disks can be used +> to serve requests. If your stripe size is too large, many random accesses +> within one single file (whose size is smaller than the stripe size/number +> of disks) may all end up on the same disk, rather than being split across +> multiple disks (the extreme case being stripe size =3D total size of all +> disks, which means concatenation). If all accesses had the same cost (i.e= +. +> no seek time, only transfer time), the ideal would be to have a stripe si= +ze +> equal to the number of disks. +>=20 +[snip] + +Ahh yes - but the critical distinction is this: +The smaller the stripe size, the more disks will be used to serve _a_ +request - which is bad for OLTP because you want fewer disks per +request so that you can have more requests per second because the cost +is mostly seek. If more than one disk has to seek to serve a single +request, you are preventing that disk from serving a second request at +the same time. + +To have more throughput in MB/sec, you want a smaller stripe size so +that you have more disks serving a single request allowing you to +multiple by effective drives to get total bandwidth. + +Because OLTP is made up of small reads and writes to a small number of +different files, I would guess that you want those files split up +across your RAID, but not so much that a single small read or write +operation would traverse more than one disk. That would infer that +your optimal stripe size is somewhere on the right side of the bell +curve that represents your database read and write block count +distribution. If on average the dbwritter never flushes less than 1MB +to disk at a time, then I guess your best stripe size would be 1MB, +but that seems very large to me. + +So I think therefore that I may be contending the exact opposite of +what you are postulating! + +Alex Turner +netEconomist + +From pgsql-performance-owner@postgresql.org Mon Apr 18 16:27:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FAC653351 + for ; + Mon, 18 Apr 2005 16:27:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51847-03 + for ; + Mon, 18 Apr 2005 19:27:09 +0000 (GMT) +Received: from web51407.mail.yahoo.com (web51407.mail.yahoo.com + [206.190.38.186]) + by svr1.postgresql.org (Postfix) with SMTP id EE8BD5335C + for ; + Mon, 18 Apr 2005 16:27:07 -0300 (ADT) +Received: (qmail 51231 invoked by uid 60001); 18 Apr 2005 19:27:08 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=2Cd1N7KdK60k0lVgqUfIYScDvN4/sKowzB0WFfH4wI9GESTZ7uvrllEmeixjFs9zeuztkFrbEZHzUm3Rc7cXEwPX+zKHiAkHYzjx0nJJZYZqxqzynuMIP/yghbjM4gcr5yzV6xpbw8wewsU8ONiS6PYC8pxBgp/+zkZr+Qm9ahA= + ; +Message-ID: <20050418192708.51229.qmail@web51407.mail.yahoo.com> +Received: from [192.88.67.254] by web51407.mail.yahoo.com via HTTP; + Mon, 18 Apr 2005 12:27:08 PDT +Date: Mon, 18 Apr 2005 12:27:08 -0700 (PDT) +From: Bill Chandler +Subject: Question on vacuumdb +To: pgsql-perform +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.972 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, LONGWORDS +X-Spam-Level: * +X-Archive-Number: 200504/431 +X-Sequence-Number: 11828 + +All, + +If I run the command "vacuumdb mydb" I understand that +it does some disk space recovery (but not as much as +"vacuumdb --full mydb"). + +Question: if I run the command "vacuumdb --analyze +mydb" does it still do the aforementioned disk space +recovery AS WELL AS update query planning statistics? +Or are those two completely separate operations +requiring separate invocations of 'vacuumdb'. + +thanks, + +Bill + + + +__________________________________ +Do you Yahoo!? +Plan great trips with Yahoo! Travel: Now over 17,000 guides! +http://travel.yahoo.com/p-travelguide + +From pgsql-performance-owner@postgresql.org Mon Apr 18 16:29:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 25322533B7 + for ; + Mon, 18 Apr 2005 16:28:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52262-07 + for ; + Mon, 18 Apr 2005 19:28:52 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id DA5B2533B1 + for ; + Mon, 18 Apr 2005 16:28:51 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7249592; Mon, 18 Apr 2005 12:30:50 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Bill Chandler +Subject: Re: Question on REINDEX +Date: Mon, 18 Apr 2005 12:33:56 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-perform +References: <20050418192142.84419.qmail@web51405.mail.yahoo.com> +In-Reply-To: <20050418192142.84419.qmail@web51405.mail.yahoo.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504181233.56784.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/432 +X-Sequence-Number: 11829 + +Bill, + +> 1) When is it necessary to run REINDEX or drop/create +> an index? All I could really find in the docs is: + +If you need to VACUUM FULL, you need to REINDEX as well. For example, if you +drop millions of rows from a table. + +> 2) If reindexing is necessary, how can this be done in +> a non-obtrusive way in a production environment. Our +> database is being updated constantly. REINDEX locks +> client apps out while in progress. Same with "CREATE +> INDEX" when we drop/create. The table can have over +> 10 million row. Recreating the indexes seems to take +> hours. This is too long to lock the client apps out. +> Is there any other solution? + +Better to up your max_fsm_pages and do regular VACUUMs regularly and +frequently so that you don't have to REINDEX at all. + + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Apr 18 16:50:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 304F053388 + for ; + Mon, 18 Apr 2005 16:50:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59593-06 + for ; + Mon, 18 Apr 2005 19:50:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DF6D05334B + for ; + Mon, 18 Apr 2005 16:50:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3IJoQBh025152; + Mon, 18 Apr 2005 15:50:26 -0400 (EDT) +To: Greg Stark +Cc: "Merlin Moncure" , + "Dawid Kuroczko" , pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-reply-to: <87u0m4j5p0.fsf@stark.xeocode.com> +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <22219.1113839449@sss.pgh.pa.us> <87u0m4j5p0.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "18 Apr 2005 14:33:15 -0400" +Date: Mon, 18 Apr 2005 15:50:26 -0400 +Message-ID: <25151.1113853826@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/436 +X-Sequence-Number: 11833 + +Greg Stark writes: +> Tom Lane writes: +>> It would be interesting sometime to try to teach the planner about +>> inlining SQL-language functions to become joins. That is, given + +> The Inlining of the function is presumably a side-issue. I have tons of +> queries that use subqueries in the select list for which the same behaviour +> would be appropriate. + +Yeah, I was actually thinking about a two-step process: inline the +function to produce somethig equivalent to a handwritten scalar +sub-SELECT, and then try to convert sub-SELECTs into joins. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 18 16:34:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 70F6553393 + for ; + Mon, 18 Apr 2005 16:34:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54837-03 + for ; + Mon, 18 Apr 2005 19:34:31 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.197.194]) + by svr1.postgresql.org (Postfix) with SMTP id 9CE3653398 + for ; + Mon, 18 Apr 2005 16:34:29 -0300 (ADT) +Received: (qmail 5311 invoked by uid 500); 18 Apr 2005 19:53:58 -0000 +Date: Mon, 18 Apr 2005 14:53:58 -0500 +From: Bruno Wolff III +To: Bill Chandler +Cc: pgsql-perform +Subject: Re: Question on REINDEX +Message-ID: <20050418195358.GA4961@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Bill Chandler , + pgsql-perform +References: <20050418192142.84419.qmail@web51405.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050418192142.84419.qmail@web51405.mail.yahoo.com> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/434 +X-Sequence-Number: 11831 + +On Mon, Apr 18, 2005 at 12:21:42 -0700, + Bill Chandler wrote: +> +> Running PostgreSQL 7.4.2 on Solaris. +> +> 1) When is it necessary to run REINDEX or drop/create +> an index? All I could really find in the docs is: +> +> "In some situations it is worthwhile to rebuild +> indexes periodically with the REINDEX command. (There +> is also contrib/reindexdb which can reindex an entire +> database.) However, PostgreSQL 7.4 has substantially +> reduced the need for this activity compared to earlier +> releases." + +In pathologic cases it is possible to have a lot of empty space on a lot +of your index pages. Reindexing would change that to a smaller number. +In earlier versions, I think it was possible to have completely empty +pages and this happened for patterns of use (new values monotonically +increasing, oldest values deleted first) that were actually seen in +practice. + +From pgsql-performance-owner@postgresql.org Mon Apr 18 16:38:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 966BC5334B + for ; + Mon, 18 Apr 2005 16:38:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54338-10 + for ; + Mon, 18 Apr 2005 19:38:51 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.197.194]) + by svr1.postgresql.org (Postfix) with SMTP id 25C945339C + for ; + Mon, 18 Apr 2005 16:38:50 -0300 (ADT) +Received: (qmail 5431 invoked by uid 500); 18 Apr 2005 19:58:19 -0000 +Date: Mon, 18 Apr 2005 14:58:19 -0500 +From: Bruno Wolff III +To: Bill Chandler +Cc: pgsql-perform +Subject: Re: Question on vacuumdb +Message-ID: <20050418195819.GB4961@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Bill Chandler , + pgsql-perform +References: <20050418192708.51229.qmail@web51407.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050418192708.51229.qmail@web51407.mail.yahoo.com> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/435 +X-Sequence-Number: 11832 + +On Mon, Apr 18, 2005 at 12:27:08 -0700, + Bill Chandler wrote: +> All, +> +> If I run the command "vacuumdb mydb" I understand that +> it does some disk space recovery (but not as much as +> "vacuumdb --full mydb"). + +You are better off not using vacuum full unless some unusual event has +bloated your database. By running normal vacuums often enough (and with +a large enough fsm setting) your database should reach a steady state size. + +> Question: if I run the command "vacuumdb --analyze +> mydb" does it still do the aforementioned disk space +> recovery AS WELL AS update query planning statistics? +> Or are those two completely separate operations +> requiring separate invocations of 'vacuumdb'. + +It is better to do both with one command. + +From pgsql-performance-owner@postgresql.org Mon Apr 18 17:14:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B3B2D52AA7 + for ; + Mon, 18 Apr 2005 17:14:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68445-06 + for ; + Mon, 18 Apr 2005 20:13:55 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B8F06533C8 + for ; + Mon, 18 Apr 2005 17:13:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3IKDsTN025364; + Mon, 18 Apr 2005 16:13:54 -0400 (EDT) +To: josh@agliodbs.com +Cc: Bill Chandler , + pgsql-perform +Subject: Re: Question on REINDEX +In-reply-to: <200504181233.56784.josh@agliodbs.com> +References: <20050418192142.84419.qmail@web51405.mail.yahoo.com> + <200504181233.56784.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Mon, 18 Apr 2005 12:33:56 -0700" +Date: Mon, 18 Apr 2005 16:13:54 -0400 +Message-ID: <25363.1113855234@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/437 +X-Sequence-Number: 11834 + +Josh Berkus writes: +>> 1) When is it necessary to run REINDEX or drop/create +>> an index? All I could really find in the docs is: + +> If you need to VACUUM FULL, you need to REINDEX as well. For example, if you +> drop millions of rows from a table. + +That's probably a pretty good rule of thumb. It's worth noting that +VACUUM FULL tends to actively bloat indexes, not reduce them in size, +because it has to create new index entries for the rows it moves before +it can delete the old ones. So if a VACUUM FULL moves many rows you +are likely to see the indexes get bigger not smaller. + +> Better to up your max_fsm_pages and do regular VACUUMs regularly and +> frequently so that you don't have to REINDEX at all. + +Yes, definitely. Also consider using CLUSTER rather than VACUUM FULL +when you need to clean up after massive deletions from a table. It's +not any less intrusive in terms of locking, but it's often faster and it +avoids the index bloat problem (since it effectively does a REINDEX). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 18 17:37:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 43602533CC + for ; + Mon, 18 Apr 2005 17:37:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76748-07 + for ; + Mon, 18 Apr 2005 20:37:22 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A79053404 + for ; + Mon, 18 Apr 2005 17:37:18 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 1195130952; Mon, 18 Apr 2005 22:36:19 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: How to improve db performance with $7K? +Date: Mon, 18 Apr 2005 13:37:11 -0700 +Organization: Hub.Org Networking Services +Lines: 49 +Message-ID: +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: <87pswsku6e.fsf@stark.xeocode.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/438 +X-Sequence-Number: 11835 + +Oooops, I revived the never-ending $7K thread. :) + +Well part of my message is to first relook at the idea that SATA is +cheap but slow. Most people look at SATA from the view of consumer-level +drives, no NCQ/TCQ -- basically these drives are IDEs that can connect +to SATA cables. But if you then look at the server-level SATAs from WD, +you see performance close to server-level 10K SCSIs and pricing also close. + +Starting with the idea of using 20 consumer-level SATA drives versus 4 +10K SCSIs, the main problem of course is the lack of advanced queueing +in these drives. I'm sure there's some threshold where the number of +drives advantage exceeds the disadvantage of no queueing -- what that +is, I don't have a clue. + +Now if you stuffed a ton of memory onto a SATA caching controller and +these controllers did the queue management instead of the drives, that +would eliminate most of the performance issues. + +Then you're just left with the management issues. Getting those 20 +drives stuffed in a big case and keeping a close eye on the drives since +drive failure will be a much bigger deal. + + + +Greg Stark wrote: +> William Yu writes: +> +> +>>Using the above prices for a fixed budget for RAID-10, you could get: +>> +>>SATA 7200 -- 680MB per $1000 +>>SATA 10K -- 200MB per $1000 +>>SCSI 10K -- 125MB per $1000 +> +> +> What a lot of these analyses miss is that cheaper == faster because cheaper +> means you can buy more spindles for the same price. I'm assuming you picked +> equal sized drives to compare so that 200MB/$1000 for SATA is almost twice as +> many spindles as the 125MB/$1000. That means it would have almost double the +> bandwidth. And the 7200 RPM case would have more than 5x the bandwidth. +> +> While 10k RPM drives have lower seek times, and SCSI drives have a natural +> seek time advantage, under load a RAID array with fewer spindles will start +> hitting contention sooner which results into higher latency. If the controller +> works well the larger SATA arrays above should be able to maintain their +> mediocre latency much better under load than the SCSI array with fewer drives +> would maintain its low latency response time despite its drives' lower average +> seek time. +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 17:58:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9313852AA8 + for ; + Mon, 18 Apr 2005 17:58:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84549-06 + for ; + Mon, 18 Apr 2005 20:58:34 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B78652A35 + for ; + Mon, 18 Apr 2005 17:58:33 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3IKwTG13788; + Mon, 18 Apr 2005 16:58:29 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504182058.j3IKwTG13788@candle.pha.pa.us> +Subject: Re: How to improve db performance with $7K? +In-Reply-To: <20050414083608.GC19518@filer> +To: Kevin Brown +Date: Mon, 18 Apr 2005 16:58:29 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/439 +X-Sequence-Number: 11836 + +Kevin Brown wrote: +> Greg Stark wrote: +> +> +> > I think you're being misled by analyzing the write case. +> > +> > Consider the read case. When a user process requests a block and +> > that read makes its way down to the driver level, the driver can't +> > just put it aside and wait until it's convenient. It has to go ahead +> > and issue the read right away. +> +> Well, strictly speaking it doesn't *have* to. It could delay for a +> couple of milliseconds to see if other requests come in, and then +> issue the read if none do. If there are already other requests being +> fulfilled, then it'll schedule the request in question just like the +> rest. + +The idea with SCSI or any command queuing is that you don't have to wait +for another request to come in --- you can send the request as it +arrives, then if another shows up, you send that too, and the drive +optimizes the grouping at a later time, knowing what the drive is doing, +rather queueing in the kernel. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Mon Apr 18 19:49:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5916953349 + for ; + Mon, 18 Apr 2005 19:49:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20537-02 + for ; + Mon, 18 Apr 2005 22:49:43 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) + by svr1.postgresql.org (Postfix) with ESMTP id AB8285334B + for ; + Mon, 18 Apr 2005 19:49:41 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so1623350wri + for ; + Mon, 18 Apr 2005 15:49: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=b0ocue5LNy3CiL5fTMjy3/7/7Y7OZeWM4QQQgX5bKbOZnBLRq/Rf1zIknguKzkJC0pDV+nPBd7UIWHVG0tE/shmTjie8zjcsbKkAM47KqdGkivNRU5pVsCqi7wm32Wl9gB5Qq79FeZX2KtNXF3JJfl4b+GPCOvAm/2dqM4ZVLUE= +Received: by 10.54.69.3 with SMTP id r3mr1820559wra; + Mon, 18 Apr 2005 15:49:44 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Mon, 18 Apr 2005 15:49:44 -0700 (PDT) +Message-ID: <33c6269f0504181549571e004b@mail.gmail.com> +Date: Mon, 18 Apr 2005 18:49:44 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Bruce Momjian +Subject: Re: How to improve db performance with $7K? +Cc: Kevin Brown , + pgsql-performance@postgresql.org +In-Reply-To: <200504182058.j3IKwTG13788@candle.pha.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <20050414083608.GC19518@filer> + <200504182058.j3IKwTG13788@candle.pha.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.277 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/440 +X-Sequence-Number: 11837 + +Does it really matter at which end of the cable the queueing is done +(Assuming both ends know as much about drive geometry etc..)? + +Alex Turner +netEconomist + +On 4/18/05, Bruce Momjian wrote: +> Kevin Brown wrote: +> > Greg Stark wrote: +> > +> > +> > > I think you're being misled by analyzing the write case. +> > > +> > > Consider the read case. When a user process requests a block and +> > > that read makes its way down to the driver level, the driver can't +> > > just put it aside and wait until it's convenient. It has to go ahead +> > > and issue the read right away. +> > +> > Well, strictly speaking it doesn't *have* to. It could delay for a +> > couple of milliseconds to see if other requests come in, and then +> > issue the read if none do. If there are already other requests being +> > fulfilled, then it'll schedule the request in question just like the +> > rest. +>=20 +> The idea with SCSI or any command queuing is that you don't have to wait +> for another request to come in --- you can send the request as it +> arrives, then if another shows up, you send that too, and the drive +> optimizes the grouping at a later time, knowing what the drive is doing, +> rather queueing in the kernel. +>=20 +> -- +> Bruce Momjian | http://candle.pha.pa.us +> pgman@candle.pha.pa.us | (610) 359-1001 +> + If your life is a hard drive, | 13 Roberts Road +> + Christ can be your backup. | Newtown Square, Pennsylvania 19= +073 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if you= +r +> joining column's datatypes do not match +> + +From pgsql-performance-owner@postgresql.org Mon Apr 18 19:56:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E577C53393 + for ; + Mon, 18 Apr 2005 19:56:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21267-06 + for ; + Mon, 18 Apr 2005 22:56:34 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 59F5C53392 + for ; + Mon, 18 Apr 2005 19:56:32 -0300 (ADT) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j3IMuLH8015335; + Mon, 18 Apr 2005 18:56:21 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id 56EAA52D7E; Mon, 18 Apr 2005 18:56:21 -0400 (CLT) +Date: Mon, 18 Apr 2005 18:56:21 -0400 +From: Alvaro Herrera +To: Alex Turner +Cc: Bruce Momjian , + Kevin Brown , pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050418225621.GC28733@dcc.uchile.cl> +References: <20050414083608.GC19518@filer> + <200504182058.j3IKwTG13788@candle.pha.pa.us> + <33c6269f0504181549571e004b@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <33c6269f0504181549571e004b@mail.gmail.com> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.343 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/441 +X-Sequence-Number: 11838 + +On Mon, Apr 18, 2005 at 06:49:44PM -0400, Alex Turner wrote: +> Does it really matter at which end of the cable the queueing is done +> (Assuming both ends know as much about drive geometry etc..)? + +That is a pretty strong assumption, isn't it? Also you seem to be +assuming that the controller<->disk protocol (some internal, unknown to +mere mortals, mechanism) is equally powerful than the host<->controller +(SATA, SCSI, etc). + +I'm lost whether this thread is about what is possible with current, +in-market technology, or about what could in theory be possible [if you +were to design "open source" disk controllers and disks.] + +-- +Alvaro Herrera () +"La fuerza no est� en los medios f�sicos +sino que reside en una voluntad indomable" (Gandhi) + +From pgsql-novice-owner@postgresql.org Mon Apr 18 21:44:27 2005 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 065C05359F + for ; + Mon, 18 Apr 2005 21:44:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59203-03 + for ; + Tue, 19 Apr 2005 00:44:19 +0000 (GMT) +Received: from themode.com (themode.com [161.58.169.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 522BF534D4 + for ; Mon, 18 Apr 2005 21:44:18 -0300 (ADT) +Received: from localhost (bde@localhost) + by themode.com (8.12.11/8.12.11) with ESMTP id j3J0iLVa015045; + Mon, 18 Apr 2005 20:44:21 -0400 (EDT) +Date: Mon, 18 Apr 2005 20:44:21 -0400 (EDT) +From: brew@theMode.com +X-X-Sender: mode@themode.com +To: Bruno Wolff III +Cc: brew@theMode.com, pgsql-novice@postgresql.org +Subject: Re: Storing Large Objects +In-Reply-To: <20050418152118.GA22606@wolff.to> +Message-ID: +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + + <20050418152118.GA22606@wolff.to> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/241 +X-Sequence-Number: 13124 + + +Bruno.... + +> Why not put the files somewhere where only the application can get at +> them instead of under the document root. That way they have to +> compromise your application to get at them. No amount of url guessing +> will give direct access. + +Great idea. That's what I will do, no need to complicate my life (and +server) by storing the files as large objects in the database. It looks +like php's readfile function will do the job nicely. + +Thanks Bruno! + +brew + + ========================================================================== + Strange Brew (brew@theMode.com) + Check out my Stock Option Covered Call website http://www.callpix.com + and my Musician's Online Database Exchange http://www.TheMode.com + ========================================================================== + + +From pgsql-performance-owner@postgresql.org Mon Apr 18 22:51:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 346EB53374 + for ; + Mon, 18 Apr 2005 22:45:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78732-06 + for ; + Tue, 19 Apr 2005 01:45:16 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 3925A53326 + for ; + Mon, 18 Apr 2005 22:45:15 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3J1jFb28220; + Mon, 18 Apr 2005 21:45:15 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504190145.j3J1jFb28220@candle.pha.pa.us> +Subject: Re: How to improve db performance with $7K? +In-Reply-To: <33c6269f0504181549571e004b@mail.gmail.com> +To: Alex Turner +Date: Mon, 18 Apr 2005 21:45:15 -0400 (EDT) +Cc: Kevin Brown , + pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/445 +X-Sequence-Number: 11842 + +Alex Turner wrote: +> Does it really matter at which end of the cable the queueing is done +> (Assuming both ends know as much about drive geometry etc..)? + +Good question. If the SCSI system was moving the head from track 1 to +10, and a request then came in for track 5, could the system make the +head stop at track 5 on its way to track 10? That is something that +only the controller could do. However, I have no idea if SCSI does +that. + +The only part I am pretty sure about is that real-world experience shows +SCSI is better for a mixed I/O environment. Not sure why, exactly, but +the command queueing obviously helps, and I am not sure what else does. + + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Mon Apr 18 23:25:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CAF075346A + for ; + Mon, 18 Apr 2005 23:25:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93489-06 + for ; + Tue, 19 Apr 2005 02:25:38 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id BEC6853A49 + for ; + Mon, 18 Apr 2005 23:25:33 -0300 (ADT) +Received: from hosting.commandprompt.com (hosting.commandprompt.com + [192.168.1.101]) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3J2KPmb013719; Mon, 18 Apr 2005 19:20:25 -0700 +Date: Mon, 18 Apr 2005 19:20:25 -0700 (PDT) +From: "Joshua D. Drake" +To: Richard van den Berg +Cc: pgsql-performance@postgresql.org +Subject: Re: Foreign key slows down copy/insert +In-Reply-To: <425E5B38.6020407@trust-factory.com> +Message-ID: +References: <425E5B38.6020407@trust-factory.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/446 +X-Sequence-Number: 11843 + +> Since the database I am working on has many FKs, I would rather not have to +> drop/add them when I am loading large data sets. + +You may want to hunt the archives. IIRCC I saw a couple of posts in the +recent months about an update you can do to one of the system tables to disable +the key checks and then re-enable them after your done with the import. + +Sincerely, + +Joshua D. Drake +> + +-- +Command Prompt, Inc., Your PostgreSQL solutions company. 503-667-4564 +Custom programming, 24x7 support, managed services, and hosting +Open Source Authors: plPHP, pgManage, Co-Authors: plPerlNG +Reliable replication, Mammoth Replicator - http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Tue Apr 19 00:10:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DBB2B534A6 + for ; + Tue, 19 Apr 2005 00:10:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09067-04 + for ; + Tue, 19 Apr 2005 03:10:18 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 1312653405 + for ; + Tue, 19 Apr 2005 00:10:17 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3J3A10t030251 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Mon, 18 Apr 2005 21:10:04 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3J3A1Ks075768; + Mon, 18 Apr 2005 21:10:01 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3J3A1d2075767; + Mon, 18 Apr 2005 21:10:01 -0600 (MDT) (envelope-from mfuhr) +Date: Mon, 18 Apr 2005 21:10:01 -0600 +From: Michael Fuhr +To: =?iso-8859-1?Q?R=FCdiger?= Herrmann +Cc: pgsql-performance@postgresql.org +Subject: Re: refcurosr vs. setof +Message-ID: <20050419031001.GA75716@winnie.fuhr.org> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/447 +X-Sequence-Number: 11844 + +On Sun, Apr 17, 2005 at 10:05:29PM +0200, R�diger Herrmann wrote: +> +> I need to write several PL/pgSQL functions all returning a "result set" wich +> can be obtained by a single SELECT statement. +> For now the functions are called by a Java application. +> Both REFCURSOR and SETOF serve my purpose, but I was wondering if there is a +> perfonance difference between the two. The result set can become quite +> large. + +Here's an excerpt from the "Control Structures" section of the +PL/pgSQL documentation: + + The current implementation of RETURN NEXT for PL/pgSQL stores + the entire result set before returning from the function, as + discussed above. That means that if a PL/pgSQL function produces + a very large result set, performance may be poor: data will be + written to disk to avoid memory exhaustion, but the function + itself will not return until the entire result set has been + generated....Currently, the point at which data begins being + written to disk is controlled by the work_mem configuration + variable. + +You might want to test both ways in typical and worst-case scenarios +and see how each performs. + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Sat Apr 23 01:40:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3327E5383D + for ; + Tue, 19 Apr 2005 05:43:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99129-10 + for ; + Tue, 19 Apr 2005 08:42:57 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id EACB1539BC + for ; + Tue, 19 Apr 2005 05:42:56 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id A45E930952; Tue, 19 Apr 2005 10:41:54 +0200 (MET DST) +From: PriceComparison.com +X-Newsgroups: pgsql.performance +Subject: Re: postgresql faster in Linux than FreeBSD? +Date: Tue, 19 Apr 2005 00:21:06 -0500 +Organization: Database Forum +Lines: 45 +Message-ID: +X-Complaints-To: usenet@news.hub.org +User-Agent: droptable.com news gateway +X-Newsreader: droptable.com news gateway +X-Originating-IP: 151.213.190.53 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.298 tagged_above=0 required=5 + tests=FROM_HAS_MIXED_NUMS +X-Spam-Level: +X-Archive-Number: 200504/637 +X-Sequence-Number: 12034 + + +We have been using Postgresql for many years now... +We have always used it with the native OS it was build from, FreeBSD. +FreeBSD is rock solid stable. Very reliable. + +With so many rumors about Linux being faster especialy the 2.6.x +kernel, I have decided to give it another try. I have not used Linux in +6 years. The last linux I used was 5.2. + +I tried slackware 10.1 and Gentoo 2005.0 both at the same time. +I have used different file system seems rumors has it that JFS is +faster than ext3. + +After running benchmarks after benchmarks, I concluded Linux 2.6.x +kernel is indeed faster. Without much details I would guess Linux is +about 30% - 50% faster according to pgbench. + +Furthermore I like Gentoo very much since it allows lots of +optimizations while compiling. + +Stability was not as good as Freebsd. Under heavy loads I have seen +hangs and riad drivers are not as stable as Freebsd. + +Server performance between intel and amd was also very different. Intel +server performance for both pentium 4 and xeon was about the same +between Linux and BSD. But AMD cpu shows large speed improvement under +Linux. + +This is just from my experience that I would like to share for other +Postgresql users. + +Regards, + +Andrew +[url]http://www.PriceComparison.com[/url] +Online Shopping Starts Here! + + + +-- +PriceComparison.com +------------------------------------------------------------------------ +Posted via http://www.codecomments.com +------------------------------------------------------------------------ + + +From pgsql-performance-owner@postgresql.org Tue Apr 19 05:33:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5B36A5363A + for ; + Tue, 19 Apr 2005 05:33:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97412-07 + for ; + Tue, 19 Apr 2005 08:33:10 +0000 (GMT) +Received: from ns.aprote.ee (ns.aprote.ee [80.235.78.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 1CB3F53987 + for ; + Tue, 19 Apr 2005 05:33:06 -0300 (ADT) +Received: Message by Barricade ns.aprote.ee with ESMTP id j3J8Z8kT022767 + for ; Tue, 19 Apr 2005 11:35:08 +0300 +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.6556.0 +Subject: Re: Question on REINDEX +Date: Tue, 19 Apr 2005 11:33:06 +0300 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Question on REINDEX +Thread-Index: AcVEumkDrzxPIOqJR0u4yuUYs2v+EA== +From: "Tambet Matiisen" +To: "Tom Lane" , +Cc: "Bill Chandler" , + "pgsql-perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/448 +X-Sequence-Number: 11845 + + +>=20 +> Josh Berkus writes: +> >> 1) When is it necessary to run REINDEX or drop/create +> >> an index? All I could really find in the docs is: +>=20 +> > If you need to VACUUM FULL, you need to REINDEX as well. =20 +> For example,=20 +> > if you drop millions of rows from a table. +>=20 +> That's probably a pretty good rule of thumb. It's worth=20 +> noting that VACUUM FULL tends to actively bloat indexes, not=20 +> reduce them in size, because it has to create new index=20 +> entries for the rows it moves before it can delete the old=20 +> ones. So if a VACUUM FULL moves many rows you are likely to=20 +> see the indexes get bigger not smaller. +>=20 + +Is my current understanding correct: + +1) VACUUM defragments each page locally - moves free space to the end of +page. + +2) VACUUM FULL defragments table globally - tries to fill up all +partially free pages and deletes all resulting empty pages. + +3) Both VACUUM and VACUUM FULL do only local defragment for indexes. + +4) If you want indexes to become fully defragmented, you need to +REINDEX. + + +If you happen to use triggers for denormalization, like I do, then you +have a lot of updates, which means that tables and indexes become quicky +cluttered with pages, which contain mostly dead tuples. If those tables +and indexes fill up shared buffers, then PostgreSQL slows down, because +it has to do a lot more IO than normal. Regular VACUUM FULL helped, but +I needed REINDEX as well, otherwise indexes grew bigger than tables +itself! + +> > Better to up your max_fsm_pages and do regular VACUUMs regularly and +> > frequently so that you don't have to REINDEX at all. +>=20 +> Yes, definitely. Also consider using CLUSTER rather than=20 +> VACUUM FULL when you need to clean up after massive deletions=20 +> from a table. It's not any less intrusive in terms of=20 +> locking, but it's often faster and it avoids the index bloat=20 +> problem (since it effectively does a REINDEX). +>=20 + +Hmm, thanks for a tip. BTW, is output of=20 + +select count(1), sum(relpages) from pg_class where relkind in +('r','i','t') + +good estimate for max_fsm_relations and max_fsm_pages? +Are these parameters used only during VACUUM or in runtime too? + + Tambet + +From pgsql-performance-owner@postgresql.org Tue Apr 19 10:34:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 74EB85338A + for ; + Tue, 19 Apr 2005 10:34:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76822-10 + for ; + Tue, 19 Apr 2005 13:34:19 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 865E3533A9 + for ; + Tue, 19 Apr 2005 10:34:18 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Tue, 19 Apr 2005 08:34:19 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184BB@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVEaZu78Ey3TmJlSmWWEOHNQSCO4gAejWcw +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/449 +X-Sequence-Number: 11846 + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com] +> Sent: Monday, April 18, 2005 5:50 PM +> To: Bruce Momjian +> Cc: Kevin Brown; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to improve db performance with $7K? +>=20 +> Does it really matter at which end of the cable the queueing is done +> (Assuming both ends know as much about drive geometry etc..)? +> [...] + +The parenthetical is an assumption I'd rather not make. If my +performance depends on my kernel knowing how my drive is laid +out, I would always be wondering if a new drive is going to=20 +break any of the kernel's geometry assumptions. Drive geometry +doesn't seem like a kernel's business any more than a kernel +should be able to decode the ccd signal of an optical mouse. +The kernel should queue requests at a level of abstraction that +doesn't depend on intimate knowledge of drive geometry, and the +drive should queue requests on the concrete level where geometry +matters. A drive shouldn't guess whether a process is trying to +read a file sequentially, and a kernel shouldn't guess whether +sector 30 is contiguous with sector 31 or not. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Tue Apr 19 11:06:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AB43E53429 + for ; + Tue, 19 Apr 2005 11:06:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89151-08 + for ; + Tue, 19 Apr 2005 14:06:47 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 04E6853416 + for ; + Tue, 19 Apr 2005 11:06:46 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3JE6eRt021098; + Tue, 19 Apr 2005 10:06:40 -0400 (EDT) +To: "Tambet Matiisen" +Cc: josh@agliodbs.com, "Bill Chandler" , + "pgsql-perform" +Subject: Re: Question on REINDEX +In-reply-to: +References: +Comments: In-reply-to "Tambet Matiisen" + message dated "Tue, 19 Apr 2005 11:33:06 +0300" +Date: Tue, 19 Apr 2005 10:06:40 -0400 +Message-ID: <21097.1113919600@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/450 +X-Sequence-Number: 11847 + +"Tambet Matiisen" writes: +> Is my current understanding correct: + +> 1) VACUUM defragments each page locally - moves free space to the end of +> page. + +> 2) VACUUM FULL defragments table globally - tries to fill up all +> partially free pages and deletes all resulting empty pages. + +Both versions of VACUUM do within-page defragmentation. Also, both +versions will remove entirely-empty pages at the end of a table. +The difference is that VACUUM FULL actively attempts to make pages +at the end empty, by moving their contents into free space in earlier +pages. Plain VACUUM never does cross-page data movement, which is +how come it doesn't need as strong a lock. + +BTW, VACUUM FULL does the data movement back-to-front, and stops as soon +as it finds a tuple it cannot move down; which is a reasonable strategy +since the goal is merely to make the file shorter. But it's entirely +likely that there will be lots of empty space left at the end. For +instance the final state could have one 4K tuple in the last page and +up to 4K-1 free bytes in every earlier page. + +> 3) Both VACUUM and VACUUM FULL do only local defragment for indexes. + +> 4) If you want indexes to become fully defragmented, you need to +> REINDEX. + +I don't think "defragment" is a notion that applies to indexes, at least +not in the same way as for tables. It's true that there is no +cross-page data movement in either case. In the last release or two +we've been able to recognize and recycle entirely-empty pages in both +btree and hash indexes, but such pages are almost never returned to the +OS; they're put on a freelist for re-use within the index, instead. + +If you allow the table to grow to much more than its "normal" size, +ie, you allow many dead tuples to be formed, then getting back to +"normal" size is going to require VACUUM FULL + REINDEX (or you can use +CLUSTER or some varieties of ALTER TABLE). This is not the recommended +maintenance process however. Sufficiently frequent plain VACUUMs should +generally hold the free space to a tolerable level without requiring +any exclusive locking. + +> Hmm, thanks for a tip. BTW, is output of +> select count(1), sum(relpages) from pg_class where relkind in +> ('r','i','t') +> good estimate for max_fsm_relations and max_fsm_pages? + +Within that one database, yes --- don't forget you must sum these +numbers across all DBs in the cluster. Also you need some slop +in the max_fsm_pages setting because of quantization in the space +usage. It's probably easier to let VACUUM VERBOSE do the calculation +for you. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 19 11:35:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D32CF5337F + for ; + Tue, 19 Apr 2005 11:35:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02732-07 + for ; + Tue, 19 Apr 2005 14:35:41 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 9445F534A3 + for ; + Tue, 19 Apr 2005 11:35:38 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3JDmtlU015813 + for ; Tue, 19 Apr 2005 13:49:02 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3JDmstH015806; + Tue, 19 Apr 2005 13:48:54 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Tue, 19 Apr 2005 14:34:51 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVEgqOe3AigE4FXT8i+SN2Neg0z7AAaZ+fQ +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.154 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/451 +X-Sequence-Number: 11848 + +Good question. If the SCSI system was moving the head from track 1 to = +10, and a request then came in for track 5, could the system make the = +head stop at track 5 on its way to track 10? That is something that = +only the controller could do. However, I have no idea if SCSI does = +that. + +|| SCSI, AFAIK, does NOT do this. What SCSI can do is allow "next" = +request insertion into head + of request queue (queue-jumping), and/or defer request ordering to = +done by drive per se (queue + re-ordering). I have looked, in vain, for evidence that SCSI = +somehow magically "stops in the + middle of request to pick up data" (my words, not yours)=20 + +The only part I am pretty sure about is that real-world experience shows = +SCSI is better for a mixed I/O environment. Not sure why, exactly, but = +the command queueing obviously helps, and I am not sure what else does. + +|| TCQ is the secret sauce, no doubt. I think NCQ (the SATA version of = +per se drive request reordering)=20 + should go a looong way (but not all the way) toward making SATA = +'enterprise acceptable'. Multiple=20 + initiators (e.g. more than one host being able to talk to a drive) is = +a biggie, too. AFAIK only SCSI + drives/controllers do that for now.=20 + + + + +--=20 + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania = +19073 + +---------------------------(end of broadcast)--------------------------- +TIP 9: the planner will ignore your desire to choose an index scan if = +your + joining column's datatypes do not match + +From pgsql-performance-owner@postgresql.org Tue Apr 19 11:49:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DEF9A53482 + for ; + Tue, 19 Apr 2005 11:49:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08473-03 + for ; + Tue, 19 Apr 2005 14:49:23 +0000 (GMT) +Received: from cmailm4.svr.pol.co.uk (cmailm4.svr.pol.co.uk [195.92.193.211]) + by svr1.postgresql.org (Postfix) with ESMTP id DDEE353462 + for ; + Tue, 19 Apr 2005 11:49:21 -0300 (ADT) +Received: from modem-1357.llama.dialup.pol.co.uk ([217.135.181.77] + helo=192.168.0.102) by cmailm4.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DNu2S-000458-IB; Tue, 19 Apr 2005 15:49:20 +0100 +Subject: Re: Postgresql works too slow +From: Simon Riggs +To: "Nurlan Mukhanov (AL/EKZ)" +Cc: pgsql-performance@postgresql.org +In-Reply-To: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Tue, 19 Apr 2005 15:46:33 +0100 +Message-Id: <1113921994.16721.2162.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/452 +X-Sequence-Number: 11849 + +On Mon, 2005-04-18 at 08:50 +0400, Nurlan Mukhanov (AL/EKZ) wrote: +> I'm trying to restore my database from dump in several parrallel processes, but restore process works too slow. +> Number of rows about 100 000 000, +> RAM: 8192M +> CPU: Ultra Sparc 3 +> Number of CPU: 4 +> OS: SunOS sun 5.8 +> RDBMS: PostgreSQL 8.0 + +> How to encrease postgresql speed? Why postgres took only 5.0% of CPU time? + +When you say restore...what are you actually doing? +An archive recovery? +A reload? +A file-level restore of database? + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Tue Apr 19 12:06:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0252453344 + for ; + Tue, 19 Apr 2005 12:06:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13857-08 + for ; + Tue, 19 Apr 2005 15:06:37 +0000 (GMT) +Received: from mail.libertyrms.com (unknown [207.219.45.62]) + by svr1.postgresql.org (Postfix) with ESMTP id 961F553462 + for ; + Tue, 19 Apr 2005 12:06:36 -0300 (ADT) +Received: from dba5.int.libertyrms.com ([10.1.3.44]) + by mail.libertyrms.com with esmtp (Exim 4.22) id 1DNuJ9-0000tZ-Is + for pgsql-performance@postgresql.org; Tue, 19 Apr 2005 11:06:35 -0400 +Message-ID: <42651E7B.7080702@ca.afilias.info> +Date: Tue, 19 Apr 2005 11:06:35 -0400 +From: Brad Nicholson +User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Postgresql works too slow +References: + <70E6659A9338D8418379B4EC0CA5819137928D@erumomw002.eemea.ericsson.se> + <1113921994.16721.2162.camel@localhost.localdomain> +In-Reply-To: <1113921994.16721.2162.camel@localhost.localdomain> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-SA-Exim-Mail-From: bnichols@ca.afilias.info +X-SA-Exim-Scanned: No; SAEximRunCond expanded to false +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/453 +X-Sequence-Number: 11850 + +Simon Riggs wrote: + +>On Mon, 2005-04-18 at 08:50 +0400, Nurlan Mukhanov (AL/EKZ) wrote: +> +> +>>I'm trying to restore my database from dump in several parrallel processes, but restore process works too slow. +>>Number of rows about 100 000 000, +>>RAM: 8192M +>>CPU: Ultra Sparc 3 +>>Number of CPU: 4 +>>OS: SunOS sun 5.8 +>>RDBMS: PostgreSQL 8.0 +>> +>> +> +> +> +>>How to encrease postgresql speed? Why postgres took only 5.0% of CPU time? +>> +>> +> +>When you say restore...what are you actually doing? +>An archive recovery? +>A reload? +>A file-level restore of database? +> +> +> +If you are doing a restore off a pg_dump, did you dump the data as +inserts? This takes a lot more time to restore. + + +-- +Brad Nicholson 416-673-4106 +Database Administrator, Afilias Canada Corp. + + +From pgsql-performance-owner@postgresql.org Tue Apr 19 12:57:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5492653248 + for ; + Tue, 19 Apr 2005 12:57:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32696-10 + for ; + Tue, 19 Apr 2005 15:57:25 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id B029A53338 + for ; + Tue, 19 Apr 2005 12:57:25 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7253448; Tue, 19 Apr 2005 08:59:21 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: "Tambet Matiisen" +Subject: Re: Question on REINDEX +Date: Tue, 19 Apr 2005 08:57:16 -0700 +User-Agent: KMail/1.6.2 +Cc: "Tom Lane" , "Bill Chandler" , + "pgsql-perform" +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504190857.16634.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/454 +X-Sequence-Number: 11851 + +Tambet, + +> Hmm, thanks for a tip. BTW, is output of +> +> select count(1), sum(relpages) from pg_class where relkind in +> ('r','i','t') + +Well, if you do that for all databases in the cluster, it's the number you +start with. However, setting FSM_pages to that would be assuming that you +excpected 100% of the rows to be replaced by UPDATES or DELETEs before you +ran VACUUM. I generally run VACUUM a little sooner than that. + +See the end portion of: +http://www.powerpostgresql.com/PerfList + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Apr 19 13:10:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 220385339A + for ; + Tue, 19 Apr 2005 13:10:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44863-07 + for ; + Tue, 19 Apr 2005 16:10:27 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C4B952A31 + for ; + Tue, 19 Apr 2005 13:10:26 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3JGAM820841; + Tue, 19 Apr 2005 12:10:22 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504191610.j3JGAM820841@candle.pha.pa.us> +Subject: Re: How to improve db performance with $7K? +In-Reply-To: + +To: "Mohan, Ross" +Date: Tue, 19 Apr 2005 12:10:22 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/455 +X-Sequence-Number: 11852 + +Mohan, Ross wrote: +> The only part I am pretty sure about is that real-world experience shows SCSI is better for a mixed I/O environment. Not sure why, exactly, but the command queueing obviously helps, and I am not sure what else does. +> +> || TCQ is the secret sauce, no doubt. I think NCQ (the SATA version of per se drive request reordering) +> should go a looong way (but not all the way) toward making SATA 'enterprise acceptable'. Multiple +> initiators (e.g. more than one host being able to talk to a drive) is a biggie, too. AFAIK only SCSI +> drives/controllers do that for now. + +What is 'multiple initiators' used for in the real world? + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Tue Apr 19 13:13:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CCC5C536B6 + for ; + Tue, 19 Apr 2005 13:13:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45295-10 + for ; + Tue, 19 Apr 2005 16:13:18 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id F239C5363E + for ; + Tue, 19 Apr 2005 13:13:15 -0300 (ADT) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j3JGV2Bu013460 + for ; Tue, 19 Apr 2005 16:31:02 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j3JGV1dC013452; + Tue, 19 Apr 2005 16:31:01 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Tue, 19 Apr 2005 16:12:44 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVE+kx5R1PoSA/PQwSQyMeUTP++JQAAEAlg +From: "Mohan, Ross" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.15 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/456 +X-Sequence-Number: 11853 + +Clustered file systems is the first/best example that +comes to mind. Host A and Host B can both request from diskfarm, eg.=20 + + + +-----Original Message----- +From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]=20 +Sent: Tuesday, April 19, 2005 12:10 PM +To: Mohan, Ross +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +Mohan, Ross wrote: +> The only part I am pretty sure about is that real-world experience=20 +> shows SCSI is better for a mixed I/O environment. Not sure why,=20 +> exactly, but the command queueing obviously helps, and I am not sure=20 +> what else does. +>=20 +> || TCQ is the secret sauce, no doubt. I think NCQ (the SATA version=20 +> || of per se drive request reordering) +> should go a looong way (but not all the way) toward making SATA = +'enterprise acceptable'. Multiple=20 +> initiators (e.g. more than one host being able to talk to a drive) = +is a biggie, too. AFAIK only SCSI +> drives/controllers do that for now. + +What is 'multiple initiators' used for in the real world? + +--=20 + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania = +19073 + +From pgsql-performance-owner@postgresql.org Tue Apr 19 13:16:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E2B553208 + for ; + Tue, 19 Apr 2005 13:16:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47651-02 + for ; + Tue, 19 Apr 2005 16:16:07 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id C24BB5343E + for ; + Tue, 19 Apr 2005 13:16:04 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3JGG1U22546; + Tue, 19 Apr 2005 12:16:01 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504191616.j3JGG1U22546@candle.pha.pa.us> +Subject: Re: How to improve db performance with $7K? +In-Reply-To: + +To: "Mohan, Ross" +Date: Tue, 19 Apr 2005 12:16:01 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/457 +X-Sequence-Number: 11854 + +Mohan, Ross wrote: +> Clustered file systems is the first/best example that +> comes to mind. Host A and Host B can both request from diskfarm, eg. + +So one host writes to part of the disk and another host writes to a +different part? + +--------------------------------------------------------------------------- + +> -----Original Message----- +> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] +> Sent: Tuesday, April 19, 2005 12:10 PM +> To: Mohan, Ross +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to improve db performance with $7K? +> +> +> Mohan, Ross wrote: +> > The only part I am pretty sure about is that real-world experience +> > shows SCSI is better for a mixed I/O environment. Not sure why, +> > exactly, but the command queueing obviously helps, and I am not sure +> > what else does. +> > +> > || TCQ is the secret sauce, no doubt. I think NCQ (the SATA version +> > || of per se drive request reordering) +> > should go a looong way (but not all the way) toward making SATA 'enterprise acceptable'. Multiple +> > initiators (e.g. more than one host being able to talk to a drive) is a biggie, too. AFAIK only SCSI +> > drives/controllers do that for now. +> +> What is 'multiple initiators' used for in the real world? +> +> -- +> Bruce Momjian | http://candle.pha.pa.us +> pgman@candle.pha.pa.us | (610) 359-1001 +> + If your life is a hard drive, | 13 Roberts Road +> + Christ can be your backup. | Newtown Square, Pennsylvania 19073 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org +> + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Tue Apr 19 13:23:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 63EFB53446; + Tue, 19 Apr 2005 13:23:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50318-01; Tue, 19 Apr 2005 16:23:13 +0000 (GMT) +Received: from bos-gate5.raytheon.com (bos-gate5.raytheon.com + [199.46.198.234]) + by svr1.postgresql.org (Postfix) with ESMTP id 3DB5153435; + Tue, 19 Apr 2005 13:23:12 -0300 (ADT) +Received: from ds02e00.directory.ray.com (ds02e00.directory.ray.com + [147.25.130.245]) + by bos-gate5.raytheon.com (8.12.10/8.12.10) with ESMTP id + j3JGMgfX001736; Tue, 19 Apr 2005 12:22:45 -0400 (EDT) +Received: from ds02e00 (localhost [127.0.0.1]) + by ds02e00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j3JGMZgk015900; Tue, 19 Apr 2005 16:22:35 GMT +Received: from ds02e00.directory.ray.com with LMTP by ds02e00 + (2.0.6/sieved-2-0-build-559); Tue, 19 Apr 2005 16:22:34 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02e00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j3JGMJHX015779 sender Richard_D_Levine@raytheon.com; + Tue, 19 Apr 2005 16:22:19 GMT +In-Reply-To: <200504191610.j3JGAM820841@candle.pha.pa.us> +Subject: Re: How to improve db performance with $7K? +To: Bruce Momjian +Cc: pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org, + "Mohan, Ross" +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Tue, 19 Apr 2005 11:22:17 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/19/2005 11:22:20 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.212 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/458 +X-Sequence-Number: 11855 + + + +pgsql-performance-owner@postgresql.org wrote on 04/19/2005 11:10:22 AM: +> +> What is 'multiple initiators' used for in the real world? + +I asked this same question and got an answer off list: Somebody said their +SAN hardware used multiple initiators. I would try to check the archives +for you, but this thread is becoming more of a rope. + +Multiple initiators means multiple sources on the bus issuing I/O +instructions to the drives. In theory you can have two computers on the +same SCSI bus issuing I/O requests to the same drive, or to anything else +on the bus, but I've never seen this implemented. Others have noted this +feature as being a big deal, so somebody is benefiting from it. + +Rick +> +> -- +> Bruce Momjian | http://candle.pha.pa.us +> pgman@candle.pha.pa.us | (610) 359-1001 +> + If your life is a hard drive, | 13 Roberts Road +> + Christ can be your backup. | Newtown Square, Pennsylvania +19073 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings + + +From pgsql-performance-owner@postgresql.org Tue Apr 19 13:24:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A154B536B6 + for ; + Tue, 19 Apr 2005 13:24:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50456-01 + for ; + Tue, 19 Apr 2005 16:24:10 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C5B15363E + for ; + Tue, 19 Apr 2005 13:24:07 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3JGO2Pj022305; + Tue, 19 Apr 2005 12:24:02 -0400 (EDT) +To: Josh Berkus +Cc: "Tambet Matiisen" , + "Bill Chandler" , + "pgsql-perform" +Subject: Re: Question on REINDEX +In-reply-to: <200504190857.16634.josh@agliodbs.com> +References: + <200504190857.16634.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Tue, 19 Apr 2005 08:57:16 -0700" +Date: Tue, 19 Apr 2005 12:24:02 -0400 +Message-ID: <22304.1113927842@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/459 +X-Sequence-Number: 11856 + +Josh Berkus writes: +>> select count(1), sum(relpages) from pg_class where relkind in +>> ('r','i','t') + +> Well, if you do that for all databases in the cluster, it's the number you +> start with. However, setting FSM_pages to that would be assuming that you +> excpected 100% of the rows to be replaced by UPDATES or DELETEs before you +> ran VACUUM. I generally run VACUUM a little sooner than that. + +Not at all. What it says is that you expect 100% of the pages to have +useful amounts of free space, which is a *much* weaker criterion. + +I think you can usually get away with setting max_fsm_pages to less than +your actual disk footprint, but I'm not sure how much less. It'd +probably depend a lot on your usage pattern --- for instance, +insert-only history tables don't need any FSM space. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 19 13:26:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3730A5356B + for ; + Tue, 19 Apr 2005 13:26:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50165-08 + for ; + Tue, 19 Apr 2005 16:26:03 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 7088A53558 + for ; + Tue, 19 Apr 2005 13:26:02 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3JFd8lQ021139 + for ; Tue, 19 Apr 2005 15:39:18 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3JFd8tH021135; + Tue, 19 Apr 2005 15:39:08 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Tue, 19 Apr 2005 16:25:24 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVE+xX+fXtZgfKYQMCVvmKwBjPeEQAASN/A +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.146 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/460 +X-Sequence-Number: 11857 + +Well, more like they both are allowed to issue disk +requests and the magical "clustered file system" manages +locking, etc.=20 + +In reality, any disk is only reading/writing to one part of +the disk at any given time, of course, but that in the multiple +initiator deal, multiple streams of requests from multiple hosts +can be queued.=20 + + + +-----Original Message----- +From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]=20 +Sent: Tuesday, April 19, 2005 12:16 PM +To: Mohan, Ross +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +Mohan, Ross wrote: +> Clustered file systems is the first/best example that +> comes to mind. Host A and Host B can both request from diskfarm, eg. + +So one host writes to part of the disk and another host writes to a = +different part? + +-------------------------------------------------------------------------= +-- + +> -----Original Message----- +> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] +> Sent: Tuesday, April 19, 2005 12:10 PM +> To: Mohan, Ross +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to improve db performance with $7K? +>=20 +>=20 +> Mohan, Ross wrote: +> > The only part I am pretty sure about is that real-world experience +> > shows SCSI is better for a mixed I/O environment. Not sure why,=20 +> > exactly, but the command queueing obviously helps, and I am not sure = + +> > what else does. +> >=20 +> > || TCQ is the secret sauce, no doubt. I think NCQ (the SATA version +> > || of per se drive request reordering) +> > should go a looong way (but not all the way) toward making SATA = +'enterprise acceptable'. Multiple=20 +> > initiators (e.g. more than one host being able to talk to a = +drive) is a biggie, too. AFAIK only SCSI +> > drives/controllers do that for now. +>=20 +> What is 'multiple initiators' used for in the real world? +>=20 +> --=20 +> Bruce Momjian | http://candle.pha.pa.us +> pgman@candle.pha.pa.us | (610) 359-1001 +> + If your life is a hard drive, | 13 Roberts Road +> + Christ can be your backup. | Newtown Square, Pennsylvania = +19073 +>=20 +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +>=20 +> http://archives.postgresql.org +>=20 + +--=20 + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania = +19073 + +From pgsql-performance-owner@postgresql.org Tue Apr 19 14:51:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B96845395A + for ; + Tue, 19 Apr 2005 14:51:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09656-09 + for ; + Tue, 19 Apr 2005 17:51:11 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 391D353957 + for ; + Tue, 19 Apr 2005 14:51:10 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7253985; Tue, 19 Apr 2005 10:53:08 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Tom Lane +Subject: Re: Question on REINDEX +Date: Tue, 19 Apr 2005 10:56:16 -0700 +User-Agent: KMail/1.7.1 +Cc: "Tambet Matiisen" , + "Bill Chandler" , + "pgsql-perform" +References: + <200504190857.16634.josh@agliodbs.com> + <22304.1113927842@sss.pgh.pa.us> +In-Reply-To: <22304.1113927842@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504191056.16688.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/461 +X-Sequence-Number: 11858 + +Tom, + +> Not at all. What it says is that you expect 100% of the pages to have +> useful amounts of free space, which is a *much* weaker criterion. + +Hmmm. Good point. + +This seems to be another instance where my rule-of-thumb was based on false +logic but nevertheless arrived at correct numbers. I've seldom, if ever, set +FSM_pages above 50% of the pages in the active database ... and never run +out. + +Hmmmm .... actually, it seems like, if you are vacuuming regularly, you only +*do* need to track pages that have been touched by DELETE or UPDATE. Other +pages would have already been vacuumed and not have any useful free space +left. Yes? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Apr 19 15:02:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E19AC5349F + for ; + Tue, 19 Apr 2005 15:02:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16924-01 + for ; + Tue, 19 Apr 2005 18:02:42 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 08560534FC + for ; + Tue, 19 Apr 2005 15:02:41 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3JI2Z5U023184; + Tue, 19 Apr 2005 14:02:35 -0400 (EDT) +To: josh@agliodbs.com +Cc: "Tambet Matiisen" , + "Bill Chandler" , + "pgsql-perform" +Subject: Re: Question on REINDEX +In-reply-to: <200504191056.16688.josh@agliodbs.com> +References: + <200504190857.16634.josh@agliodbs.com> + <22304.1113927842@sss.pgh.pa.us> + <200504191056.16688.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Tue, 19 Apr 2005 10:56:16 -0700" +Date: Tue, 19 Apr 2005 14:02:34 -0400 +Message-ID: <23183.1113933754@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/462 +X-Sequence-Number: 11859 + +Josh Berkus writes: +>> Not at all. What it says is that you expect 100% of the pages to have +>> useful amounts of free space, which is a *much* weaker criterion. + +> Hmmmm .... actually, it seems like, if you are vacuuming regularly, you only +> *do* need to track pages that have been touched by DELETE or UPDATE. Other +> pages would have already been vacuumed and not have any useful free space +> left. Yes? + +Well, the space has to be remembered until it's reused. On the other +hand, there's nothing that says FSM has to be aware of all the free +space available at all times --- the real criterion to avoid bloat +is that after a VACUUM, enough space is logged in FSM to satisfy all +the insertions that will happen before the next VACUUM. So you could +have situations where free space is temporarily forgotten (for lack +of slots in FSM), but other free space gets used instead, and eventually +a later VACUUM re-finds that free space and puts it into FSM. + +I think it's true that the more often you vacuum, the less FSM you need, +but this doesn't have much to do with how much free space is actually +out there on disk. It's because you only need enough FSM to record the +free space you'll need until the next vacuum. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 19 15:29:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 53BEC537C4 + for ; + Tue, 19 Apr 2005 15:28:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73549-09 + for ; + Tue, 19 Apr 2005 18:28:52 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 073C7529DF + for ; + Tue, 19 Apr 2005 15:28:47 -0300 (ADT) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j3JISQWM020127; + Tue, 19 Apr 2005 14:28:26 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id DB38552C70; Tue, 19 Apr 2005 14:28:26 -0400 (CLT) +Date: Tue, 19 Apr 2005 14:28:26 -0400 +From: Alvaro Herrera +To: Tom Lane +Cc: Tambet Matiisen , josh@agliodbs.com, + Bill Chandler , + pgsql-perform +Subject: Re: Question on REINDEX +Message-ID: <20050419182826.GA18949@dcc.uchile.cl> +References: + <21097.1113919600@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <21097.1113919600@sss.pgh.pa.us> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.343 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/463 +X-Sequence-Number: 11860 + +On Tue, Apr 19, 2005 at 10:06:40AM -0400, Tom Lane wrote: + +> BTW, VACUUM FULL does the data movement back-to-front, and stops as soon +> as it finds a tuple it cannot move down; which is a reasonable strategy +> since the goal is merely to make the file shorter. But it's entirely +> likely that there will be lots of empty space left at the end. For +> instance the final state could have one 4K tuple in the last page and +> up to 4K-1 free bytes in every earlier page. + +Am I right in thinking that vacuum does at least two passes: one +front-to-back to find removable tuples, and other back-to-front for +movement? Because if it doesn't work this way, it wouldn't relabel +(change Xmin/Xmax) tuples in early pages. Or does it do something +different? + +I know maintenance_work_mem is used for storing TIDs of to-be-moved +tuples for index cleanup ... how does it relate to the above? + +-- +Alvaro Herrera () +"Crear es tan dif�cil como ser libre" (Elsa Triolet) + +From pgsql-performance-owner@postgresql.org Tue Apr 19 15:34:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E50FD537C7 + for ; + Tue, 19 Apr 2005 15:34:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28465-01 + for ; + Tue, 19 Apr 2005 18:34:46 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 89308537C6 + for ; + Tue, 19 Apr 2005 15:34:45 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3JIYZ82023414; + Tue, 19 Apr 2005 14:34:35 -0400 (EDT) +To: Alvaro Herrera +Cc: Tambet Matiisen , josh@agliodbs.com, + Bill Chandler , + pgsql-perform +Subject: Re: Question on REINDEX +In-reply-to: <20050419182826.GA18949@dcc.uchile.cl> +References: + <21097.1113919600@sss.pgh.pa.us> + <20050419182826.GA18949@dcc.uchile.cl> +Comments: In-reply-to Alvaro Herrera + message dated "Tue, 19 Apr 2005 14:28:26 -0400" +Date: Tue, 19 Apr 2005 14:34:35 -0400 +Message-ID: <23413.1113935675@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/464 +X-Sequence-Number: 11861 + +Alvaro Herrera writes: +> Am I right in thinking that vacuum does at least two passes: one +> front-to-back to find removable tuples, and other back-to-front for +> movement? + +VACUUM FULL, yes. VACUUM only does the first one. + +> I know maintenance_work_mem is used for storing TIDs of to-be-moved +> tuples for index cleanup ... how does it relate to the above? + +TIDs of to-be-deleted tuples, actually. Movable tuples aren't stored, +they're just found on-the-fly during the back-to-front pass. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 19 16:04:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 138075340A + for ; + Tue, 19 Apr 2005 16:04:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72285-08 + for ; + Tue, 19 Apr 2005 19:04:05 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id C033753388 + for ; + Tue, 19 Apr 2005 16:03:59 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7254287 for pgsql-performance@postgresql.org; + Tue, 19 Apr 2005 12:05:57 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "pgsql-perform" +Subject: Bad n_distinct estimation; hacks suggested? +Date: Tue, 19 Apr 2005 12:09:05 -0700 +User-Agent: KMail/1.7.1 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504191209.05181.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/465 +X-Sequence-Number: 11862 + +Folks, + +Params: PostgreSQL 8.0.1 on Solaris 10 +Statistics = 500 +(tablenames have been changed to protect NDA) + +e1=# select tablename, null_frac, correlation, n_distinct from pg_stats where +tablename = 'clickstream1' andattname = 'session_id'; + tablename | null_frac | correlation | n_distinct +----------------------+-----------+-------------+------------ + clickstream1 | 0 | 0.412034 | 378174 +(2 rows) + +e1=# select count(distinct session_id) from clickstream1; + count +--------- + 3174813 + +As you can see, n_distinct estimation is off by a factor of 10x and it's +causing query planning problems. Any suggested hacks to improve the +histogram on this? + +(BTW, increasing the stats to 1000 only doubles n_distinct, and doesn't solve +the problem) + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Apr 19 17:02:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 32A6853410 + for ; + Tue, 19 Apr 2005 17:02:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17723-08 + for ; + Tue, 19 Apr 2005 20:02:01 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id DF0E052A82 + for ; + Tue, 19 Apr 2005 17:01:59 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Bad n_distinct estimation; hacks suggested? +Date: Tue, 19 Apr 2005 15:01:57 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184BC@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Bad n_distinct estimation; hacks suggested? +Thread-Index: AcVFE0kLPRM6GCHtRweWJb82BnC6TwABzowg +From: "Dave Held" +To: "pgsql-perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/466 +X-Sequence-Number: 11863 + +> -----Original Message----- +> From: Josh Berkus [mailto:josh@agliodbs.com] +> Sent: Tuesday, April 19, 2005 2:09 PM +> To: pgsql-perform +> Subject: [PERFORM] Bad n_distinct estimation; hacks suggested? +>=20 +> [...] +> (BTW, increasing the stats to 1000 only doubles n_distinct,=20 +> and doesn't solve the problem) + +Speaking of which, is there a reason why statistics are limited +to 1000? Performance? + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Tue Apr 19 17:45:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0D5FA538C9 + for ; + Tue, 19 Apr 2005 17:45:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30221-03 + for ; + Tue, 19 Apr 2005 20:44:51 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 639EF538C4 + for ; + Tue, 19 Apr 2005 17:44:50 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3JKinEX025383; + Tue, 19 Apr 2005 16:44:49 -0400 (EDT) +To: josh@agliodbs.com +Cc: "pgsql-perform" +Subject: Re: Bad n_distinct estimation; hacks suggested? +In-reply-to: <200504191209.05181.josh@agliodbs.com> +References: <200504191209.05181.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Tue, 19 Apr 2005 12:09:05 -0700" +Date: Tue, 19 Apr 2005 16:44:49 -0400 +Message-ID: <25382.1113943489@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/467 +X-Sequence-Number: 11864 + +Josh Berkus writes: +> As you can see, n_distinct estimation is off by a factor of 10x and it's +> causing query planning problems. Any suggested hacks to improve the +> histogram on this? + +What's the histogram itself look like? (I'd like to see the whole +pg_stats row not just part of it ...) There's probably no point in +showing the target=1000 version, but maybe target=100 would be +informative. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Apr 19 18:29:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 35111533FB + for ; + Tue, 19 Apr 2005 18:29:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24165-05 + for ; + Tue, 19 Apr 2005 21:28:57 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 65D8D53374 + for ; + Tue, 19 Apr 2005 18:28:54 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [67.103.46.98] (account josh@agliodbs.com HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7254757; Tue, 19 Apr 2005 14:30:52 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Tom Lane +Subject: Re: Bad n_distinct estimation; hacks suggested? +Date: Tue, 19 Apr 2005 14:33:58 -0700 +User-Agent: KMail/1.7.1 +Cc: "pgsql-perform" +References: <200504191209.05181.josh@agliodbs.com> + <25382.1113943489@sss.pgh.pa.us> +In-Reply-To: <25382.1113943489@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200504191433.58960.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/468 +X-Sequence-Number: 11865 + +Tom, + +> What's the histogram itself look like? (I'd like to see the whole +> pg_stats row not just part of it ...) There's probably no point in +> showing the target=3D1000 version, but maybe target=3D100 would be +> informative. + +Here is the stats =3D 100 version. Notice that n_distinct has gone down. + + schemaname | tablename | attname | null_frac | avg_width |=20 +n_distinct | most_common_vals = + =20 +| most_common_freqs = + =20 +| histogram_bounds |=20 +correlation +=2D-----------+----------------------+------------+-----------+-----------+= +=2D-----------+------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D---------------------------------------------+--------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D---------------------------------------------------------------+--------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D------------------------------------------------------------------------= +=2D----------------------------------------------+------------- + public | web_site_activity_fa | session_id | 0 | 8 | = + =20 +96107 |=20 +{4393922,6049228,6026260,4394034,60341,4393810,2562999,2573850,3006299,4705= +488,2561499,4705258,3007378,4705490,60327,60352,2560950,2567640,2569852,300= +6604,4394329,2570739,2406633,2407292,3006356,4393603,4394121,6449083,256581= +5,4387881,2406770,2407081,2564340,3007328,2406578,2407295,2562813,2567603,4= +387835,71014,2566253,2566900,6103079,2289424,2407597,2567627,2568333,345744= +8,23450,23670,60743,70739,2406818,2406852,2407511,2562816,3007446,6306095,6= +0506,71902,591543,1169136,1447077,2285047,2406830,2573964,6222758,61393,709= +55,70986,71207,71530,262368,2289213,2406899,2567361,2775952,3006824,4387864= +,6239825,6244853,6422152,1739,58600,179293,278473,488407,1896390,2286976,24= +07020,2546720,2677019,2984333,3006133,3007497,3310286,3631413,3801909,43661= +16,4388025}=20 +|=20 +{0.00166667,0.00146667,0.0013,0.0011,0.000933333,0.0009,0.0008,0.0008,0.000= +733333,0.000733333,0.0007,0.000633333,0.0006,0.0006,0.000566667,0.000566667= +,0.000566667,0.000566667,0.000566667,0.000566667,0.000566667,0.000533333,0.= +0005,0.0005,0.0005,0.0005,0.0005,0.0005,0.000466667,0.000466667,0.000433333= +,0.000433333,0.000433333,0.000433333,0.0004,0.0004,0.0004,0.0004,0.0004,0.0= +00366667,0.000366667,0.000366667,0.000366667,0.000333333,0.000333333,0.0003= +33333,0.000333333,0.000333333,0.0003,0.0003,0.0003,0.0003,0.0003,0.0003,0.0= +003,0.0003,0.0003,0.0003,0.000266667,0.000266667,0.000266667,0.000266667,0.= +000266667,0.000266667,0.000266667,0.000266667,0.000266667,0.000233333,0.000= +233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233= +333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233333= +,0.000233333,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002= +,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002}=20 +|=20 +{230,58907,88648,156764,216759,240405,264601,289047,312630,339947,364452,38= +6486,409427,434075,455140,475759,500086,521530,544703,680376,981066,1313419= +,1712592,1860151,1882452,1905328,1927504,1948159,1970054,1990408,2014501,20= +38573,2062786,2087163,2110129,2132196,2155657,2181058,2204976,2228575,22562= +29,2283897,2352453,2407153,2457716,2542081,2572119,2624133,2699592,2771254,= +2832224,2908151,2951500,3005088,3032889,3137244,3158685,3179395,3203681,326= +1587,3304359,3325577,3566688,3621357,3645094,3718667,3740821,3762386,378316= +9,3804593,3826503,3904589,3931012,3957675,4141934,4265118,4288568,4316898,4= +365625,4473965,4535752,4559700,4691802,4749478,5977208,6000272,6021416,6045= +939,6078912,6111900,6145155,6176422,6206627,6238291,6271270,6303067,6334117= +,6365200,6395250,6424719,6888329}=20 +| 0.41744 + + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Apr 19 19:14:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1128D53429; + Tue, 19 Apr 2005 19:14:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98135-10; Tue, 19 Apr 2005 22:13:55 +0000 (GMT) +Received: from smtp.osdl.org (fire.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id B72C452A4C; + Tue, 19 Apr 2005 19:13:51 -0300 (ADT) +Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j3JMDjs4022586 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Tue, 19 Apr 2005 15:13:45 -0700 +Received: from shell0.pdx.osdl.net (localhost [127.0.0.1]) + by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id j3JMDitR002701; + Tue, 19 Apr 2005 15:13:44 -0700 +Received: (from markw@localhost) + by shell0.pdx.osdl.net (8.13.1/8.13.1/Submit) id j3JMDii9002700; + Tue, 19 Apr 2005 15:13:44 -0700 +Date: Tue, 19 Apr 2005 15:13:43 -0700 +From: Mark Wong +To: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Cc: swm@alcove.com.au, josh@agliodbs.com, + Mary Meredith +Subject: Re: [HACKERS] PLM pulling from CVS nightly for testing in STP +Message-ID: <20050419221343.GA2369@osdl.org> +References: <20050413181141.GA7095@osdl.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050413181141.GA7095@osdl.org> +User-Agent: Mutt/1.5.6i +X-MIMEDefang-Filter: osdl$Revision: 1.109 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/469 +X-Sequence-Number: 11866 + +I have dbt-2 tests automatically running against each pull from CVS +and have started to automatically compile results here: + http://developer.osdl.org/markw/postgrescvs/ + +I did start with a bit of a minimalistic approach, so I'm open for any +comments, feedback, etc. + +Mark + +From pgsql-performance-owner@postgresql.org Tue Apr 19 20:08:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A44D535AB + for ; + Tue, 19 Apr 2005 20:08:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36311-05 + for ; + Tue, 19 Apr 2005 23:08:33 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 685BB535A5 + for ; + Tue, 19 Apr 2005 20:08:33 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 2901315486; Tue, 19 Apr 2005 18:08:36 -0500 (CDT) +Date: Tue, 19 Apr 2005 18:08:36 -0500 +From: "Jim C. Nasby" +To: newz@bearfruit.org +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050419230836.GQ58835@decibel.org> +References: <33c6269f050406151241b01148@mail.gmail.com> + <20050406224102.GM93835@decibel.org> + <33c6269f0504061732195f6ae4@mail.gmail.com> + <87wtrfmgt5.fsf@stark.xeocode.com> + <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> + <878y3lj23o.fsf@stark.xeocode.com> + <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/470 +X-Sequence-Number: 11867 + +On Thu, Apr 14, 2005 at 10:51:46AM -0500, Matthew Nuzum wrote: +> So if you all were going to choose between two hard drives where: +> drive A has capacity C and spins at 15K rpms, and +> drive B has capacity 2 x C and spins at 10K rpms and +> all other features are the same, the price is the same and C is enough +> disk space which would you choose? +> +> I've noticed that on IDE drives, as the capacity increases the data +> density increases and there is a pereceived (I've not measured it) +> performance increase. +> +> Would the increased data density of the higher capacity drive be of +> greater benefit than the faster spindle speed of drive A? + +The increased data density will help transfer speed off the platter, but +that's it. It won't help rotational latency. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 21:03:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E0C90535F1 + for ; + Tue, 19 Apr 2005 21:03:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69046-06 + for ; + Wed, 20 Apr 2005 00:03:36 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id AD451535D3 + for ; + Tue, 19 Apr 2005 21:03:36 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 3405E15486; Tue, 19 Apr 2005 19:03:39 -0500 (CDT) +Date: Tue, 19 Apr 2005 19:03:39 -0500 +From: "Jim C. Nasby" +To: Jacques Caron +Cc: Greg Stark , William Yu , + pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050420000339.GR58835@decibel.org> +References: + <425EBA0C.6030804@sfnet.cc> + <87pswsku6e.fsf@stark.xeocode.com> + <6.2.0.14.0.20050418183007.03d0ce18@pop.interactivemediafactory.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + <6.2.0.14.0.20050418183007.03d0ce18@pop.interactivemediafactory.net> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/471 +X-Sequence-Number: 11868 + +On Mon, Apr 18, 2005 at 07:41:49PM +0200, Jacques Caron wrote: +> It would be interesting to actually compare this to real-world (or +> nearly-real-world) benchmarks to measure the effectiveness of features like +> TCQ/NCQ etc. + +I was just thinking that it would be very interesting to benchmark +different RAID configurations using dbt2. I don't know if this is +something that the lab is setup for or capable of, though. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 21:05:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5ECFE535F9 + for ; + Tue, 19 Apr 2005 21:05:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69745-07 + for ; + Wed, 20 Apr 2005 00:05:27 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 0393952A57 + for ; + Tue, 19 Apr 2005 21:05:27 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 741AE1548B; Tue, 19 Apr 2005 19:05:28 -0500 (CDT) +Date: Tue, 19 Apr 2005 19:05:28 -0500 +From: "Jim C. Nasby" +To: Dave Held +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050420000528.GS58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B5@asg002.asg.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B5@asg002.asg.local> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/472 +X-Sequence-Number: 11869 + +On Mon, Apr 18, 2005 at 10:20:36AM -0500, Dave Held wrote: +> Hmm...so you're saying that at some point, quantity beats quality? +> That's an interesting point. However, it presumes that you can +> actually distribute your data over a larger number of drives. If +> you have a db with a bottleneck of one or two very large tables, +> the extra spindles won't help unless you break up the tables and +> glue them together with query magic. But it's still a point to +> consider. + +Huh? Do you know how RAID10 works? +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 21:12:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A743653617 + for ; + Tue, 19 Apr 2005 21:12:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74264-04 + for ; + Wed, 20 Apr 2005 00:12:21 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 702EF5360E + for ; + Tue, 19 Apr 2005 21:12:21 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 9A6711548B; Tue, 19 Apr 2005 19:12:24 -0500 (CDT) +Date: Tue, 19 Apr 2005 19:12:24 -0500 +From: "Jim C. Nasby" +To: "Mohan, Ross" +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050420001224.GT58835@decibel.org> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/473 +X-Sequence-Number: 11870 + +On Mon, Apr 18, 2005 at 06:41:37PM -0000, Mohan, Ross wrote: +> Don't you think "optimal stripe width" would be +> a good question to research the binaries for? I'd +> think that drives the answer, largely. (uh oh, pun alert) +> +> EG, oracle issues IO requests (this may have changed _just_ +> recently) in 64KB chunks, regardless of what you ask for. +> So when I did my striping (many moons ago, when the Earth +> was young...) I did it in 128KB widths, and set the oracle +> "multiblock read count" according. For oracle, any stripe size +> under 64KB=stupid, anything much over 128K/258K=wasteful. +> +> I am eager to find out how PG handles all this. + +AFAIK PostgreSQL requests data one database page at a time (normally +8k). Of course the OS might do something different. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 21:15:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F31FE5360E; + Tue, 19 Apr 2005 21:15:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74275-08; Wed, 20 Apr 2005 00:15:21 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id AC74753608; + Tue, 19 Apr 2005 21:15:20 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id E499715486; Tue, 19 Apr 2005 19:15:23 -0500 (CDT) +Date: Tue, 19 Apr 2005 19:15:23 -0500 +From: "Jim C. Nasby" +To: Richard_D_Levine@raytheon.com +Cc: Bruce Momjian , pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org, "Mohan, Ross" +Subject: Re: How to improve db performance with $7K? +Message-ID: <20050420001523.GU58835@decibel.org> +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/474 +X-Sequence-Number: 11871 + +On Tue, Apr 19, 2005 at 11:22:17AM -0500, Richard_D_Levine@raytheon.com wrote: +> +> +> pgsql-performance-owner@postgresql.org wrote on 04/19/2005 11:10:22 AM: +> > +> > What is 'multiple initiators' used for in the real world? +> +> I asked this same question and got an answer off list: Somebody said their +> SAN hardware used multiple initiators. I would try to check the archives +> for you, but this thread is becoming more of a rope. +> +> Multiple initiators means multiple sources on the bus issuing I/O +> instructions to the drives. In theory you can have two computers on the +> same SCSI bus issuing I/O requests to the same drive, or to anything else +> on the bus, but I've never seen this implemented. Others have noted this +> feature as being a big deal, so somebody is benefiting from it. + +It's a big deal for Oracle clustering, which relies on shared drives. Of +course most people doing Oracle clustering are probably using a SAN and +not raw SCSI... +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 21:30:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B21153366 + for ; + Tue, 19 Apr 2005 21:30:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79186-10 + for ; + Wed, 20 Apr 2005 00:30:51 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id F0FC6529D4 + for ; + Tue, 19 Apr 2005 21:30:50 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 47B7C15486; Tue, 19 Apr 2005 19:30:54 -0500 (CDT) +Date: Tue, 19 Apr 2005 19:30:54 -0500 +From: "Jim C. Nasby" +To: Dawid Kuroczko +Cc: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +Message-ID: <20050420003054.GV58835@decibel.org> +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <758d5e7f05041807194a78b55a@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <758d5e7f05041807194a78b55a@mail.gmail.com> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/475 +X-Sequence-Number: 11872 + +You should re-run the function test using SQL as the function language +instead of plpgsql. There might be some performance to be had there. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 21:35:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 48A195321B + for ; + Tue, 19 Apr 2005 21:35:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79560-09 + for ; + Wed, 20 Apr 2005 00:35:13 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 4254953209 + for ; + Tue, 19 Apr 2005 21:35:13 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id D23BA15486; Tue, 19 Apr 2005 19:35:16 -0500 (CDT) +Date: Tue, 19 Apr 2005 19:35:16 -0500 +From: "Jim C. Nasby" +To: Rodrigo Moreno +Cc: pgsql-performance@postgresql.org +Subject: Re: How to improve postgres performace +Message-ID: <20050420003516.GW58835@decibel.org> +References: <20050418143603.EE9F613001B@cuenca.terra.com.br> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050418143603.EE9F613001B@cuenca.terra.com.br> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/476 +X-Sequence-Number: 11873 + +On Mon, Apr 18, 2005 at 11:36:01AM -0300, Rodrigo Moreno wrote: +> I really worried about that, because it's no enough anymore, and users claim +> about performace. But running the vacuumdb full, everthing starts to run +> better again, so i think the problem is not related to a specific query. + +Vacuum full will skew your results, unless you plan on running vacuum +full all the time. This is because you will always have some amount of +dead tuples in a table that has any update or delete activity. A regular +vacuum doesn't remove these tuples, it just marks them as available. So +over time, depending on how frequently a table is vacuumed, it will +settle down to a steady-state size that is greater than it's size after +a vacuum full. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 21:42:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B3F352953 + for ; + Tue, 19 Apr 2005 21:42:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83475-05 + for ; + Wed, 20 Apr 2005 00:42:31 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id D644352957 + for ; + Tue, 19 Apr 2005 21:42:30 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 2845E15486; Tue, 19 Apr 2005 19:42:34 -0500 (CDT) +Date: Tue, 19 Apr 2005 19:42:34 -0500 +From: "Jim C. Nasby" +To: Dave Held +Cc: pgsql-performance@postgresql.org +Subject: Re: Sort and index +Message-ID: <20050420004234.GX58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/477 +X-Sequence-Number: 11874 + +On Mon, Apr 18, 2005 at 10:44:43AM -0500, Dave Held wrote: +> Since you are fetching the entire table, you are touching all the rows. +> If the query were to fetch the rows in index order, it would be seeking +> all over the table's tracks. By fetching in sequence order, it has a +> much better chance of fetching rows in a way that minimizes head seeks. +> Since disk I/O is generally 10-100x slower than RAM, the in-memory sort +> can be surprisingly slow and still beat indexed disk access. Of course, +> this is only true if the table can fit and be sorted entirely in memory +> (which, with 1500 rows, probably can). + +Actually, the planner (at least in 7.4) isn't smart enough to consider +if the sort would fit in memory or not. I'm running a test right now to +see if it's actually faster to use an index in this case. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 22:00:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8E36C52957 + for ; + Tue, 19 Apr 2005 22:00:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87407-05 + for ; + Wed, 20 Apr 2005 01:00:41 +0000 (GMT) +Received: from smtp802.mail.sc5.yahoo.com (smtp802.mail.sc5.yahoo.com + [66.163.168.181]) + by svr1.postgresql.org (Postfix) with SMTP id 33A2553237 + for ; + Tue, 19 Apr 2005 22:00:39 -0300 (ADT) +Received: from unknown (HELO discord.dyndns.org) + (jeffroe996@sbcglobal.net@69.226.230.214 with plain) + by smtp802.mail.sc5.yahoo.com with SMTP; 20 Apr 2005 01:00:42 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.dyndns.org (8.13.1/8.13.1) with ESMTP id j3K10gLI010030 + for ; Tue, 19 Apr 2005 18:00:42 -0700 +Date: Tue, 19 Apr 2005 18:00:42 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.dyndns.org +To: pgsql-performance@postgresql.org +Subject: What to do with 6 disks? +In-Reply-To: <20050420001523.GU58835@decibel.org> +Message-ID: +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + + <20050420001523.GU58835@decibel.org> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.021 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/478 +X-Sequence-Number: 11875 + +Now that we've hashed out which drives are quicker and more money equals +faster... + +Let's say you had a server with 6 separate 15k RPM SCSI disks, what raid +option would you use for a standalone postgres server? + +a) 3xRAID1 - 1 for data, 1 for xlog, 1 for os? +b) 1xRAID1 for OS/xlog, 1xRAID5 for data +c) 1xRAID10 for OS/xlong/data +d) 1xRAID1 for OS, 1xRAID10 for data +e) ..... + +I was initially leaning towards b, but after talking to Josh a bit, I suspect +that with only 4 disks the raid5 might be a performance detriment vs 3 raid 1s +or some sort of split raid10 setup. + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Tue Apr 19 22:56:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1111B52957 + for ; + Tue, 19 Apr 2005 22:56:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38092-01 + for ; + Wed, 20 Apr 2005 01:55:56 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id BCE9C534D2 + for ; + Tue, 19 Apr 2005 22:55:55 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 3002615486; Tue, 19 Apr 2005 20:55:59 -0500 (CDT) +Date: Tue, 19 Apr 2005 20:55:59 -0500 +From: "Jim C. Nasby" +To: Jeff Frost +Cc: pgsql-performance@postgresql.org +Subject: Re: What to do with 6 disks? +Message-ID: <20050420015558.GY58835@decibel.org> +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + + <20050420001523.GU58835@decibel.org> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/479 +X-Sequence-Number: 11876 + +http://stats.distributed.net is setup with the OS, WAL, and temp on a +RAID1 and the database on a RAID10. The drives are 200G SATA with a +3ware raid card. I don't think the controller has battery-backed cache, +but I'm not sure. In any case, it's almost never disk-bound on the +mirror; when it's disk-bound it's usually the RAID10. But this is a +read-mostly database. If it was write-heavy, that might not be the case. + +Also, in general, I see very little disk activity from the OS itself, so +I don't think there's a large disadvantage to having it on the same +drives as part of your database. I would recommend different filesystems +for each, though. (ie: not one giant / partition) + +On Tue, Apr 19, 2005 at 06:00:42PM -0700, Jeff Frost wrote: +> Now that we've hashed out which drives are quicker and more money equals +> faster... +> +> Let's say you had a server with 6 separate 15k RPM SCSI disks, what raid +> option would you use for a standalone postgres server? +> +> a) 3xRAID1 - 1 for data, 1 for xlog, 1 for os? +> b) 1xRAID1 for OS/xlog, 1xRAID5 for data +> c) 1xRAID10 for OS/xlong/data +> d) 1xRAID1 for OS, 1xRAID10 for data +> e) ..... +> +> I was initially leaning towards b, but after talking to Josh a bit, I +> suspect that with only 4 disks the raid5 might be a performance detriment +> vs 3 raid 1s or some sort of split raid10 setup. +> +> -- +> Jeff Frost, Owner +> Frost Consulting, LLC http://www.frostconsultingllc.com/ +> Phone: 650-780-7908 FAX: 650-649-1954 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Apr 19 23:00:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A531534F2 + for ; + Tue, 19 Apr 2005 23:00:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41419-01 + for ; + Wed, 20 Apr 2005 02:00:29 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 610D0534D4 + for ; + Tue, 19 Apr 2005 23:00:29 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 9A62615486; Tue, 19 Apr 2005 21:00:33 -0500 (CDT) +Date: Tue, 19 Apr 2005 21:00:33 -0500 +From: "Jim C. Nasby" +To: pgsql-performance@postgresql.org +Subject: Slow copy with little CPU/disk usage +Message-ID: <20050420020033.GZ58835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/480 +X-Sequence-Number: 11877 + +A friend of mine has an application where he's copying in 4000 rows at a +time into a table that has about 4M rows. Each row is 40-50 bytes. This +is taking 25 seconds on a dual PIII-1GHz with 1G of RAM and a 2 disk +SATA mirror, running FBSD 4.10-stable. There's one index on the table. + +What's really odd is that neither the CPU or the disk are being +hammered. The box appears to be pretty idle; the postgresql proces is +using 4-5% CPU. + +I seem to recall others running into this before, but I can't remember +what the issue was and I can't find it in the archives. + +This is version 8.0, btw. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 20 00:01:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5B26B534EF + for ; + Wed, 20 Apr 2005 00:01:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88248-07 + for ; + Wed, 20 Apr 2005 03:01:35 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 155265337F + for ; + Wed, 20 Apr 2005 00:01:34 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3K31Q3I019632; + Tue, 19 Apr 2005 23:01:26 -0400 (EDT) +To: "Jim C. Nasby" +Cc: Dave Held , + pgsql-performance@postgresql.org +Subject: Re: Sort and index +In-reply-to: <20050420004234.GX58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050420004234.GX58835@decibel.org> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 19 Apr 2005 19:42:34 -0500" +Date: Tue, 19 Apr 2005 23:01:26 -0400 +Message-ID: <19631.1113966086@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/481 +X-Sequence-Number: 11878 + +"Jim C. Nasby" writes: +> Actually, the planner (at least in 7.4) isn't smart enough to consider +> if the sort would fit in memory or not. + +Really? Have you read cost_sort()? + +It's certainly possible that the calculation is all wet, but to claim +that the issue is not considered is just wrong. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 20 00:06:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 273F353429 + for ; + Wed, 20 Apr 2005 00:06:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91007-08 + for ; + Wed, 20 Apr 2005 03:05:56 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A3C75337F + for ; + Wed, 20 Apr 2005 00:05:55 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3K35se0019671; + Tue, 19 Apr 2005 23:05:54 -0400 (EDT) +To: "Jim C. Nasby" +Cc: pgsql-performance@postgresql.org +Subject: Re: Slow copy with little CPU/disk usage +In-reply-to: <20050420020033.GZ58835@decibel.org> +References: <20050420020033.GZ58835@decibel.org> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 19 Apr 2005 21:00:33 -0500" +Date: Tue, 19 Apr 2005 23:05:54 -0400 +Message-ID: <19670.1113966354@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/483 +X-Sequence-Number: 11880 + +"Jim C. Nasby" writes: +> A friend of mine has an application where he's copying in 4000 rows at a +> time into a table that has about 4M rows. Each row is 40-50 bytes. This +> is taking 25 seconds on a dual PIII-1GHz with 1G of RAM and a 2 disk +> SATA mirror, running FBSD 4.10-stable. There's one index on the table. + +If there's no hidden costs such as foreign key checks, that does seem +pretty dang slow. + +> What's really odd is that neither the CPU or the disk are being +> hammered. The box appears to be pretty idle; the postgresql proces is +> using 4-5% CPU. + +It's very hard to believe that *neither* disk nor CPU is maxed. +Can we see a reproducible test case, please? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 20 00:07:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8BA3353429 + for ; + Wed, 20 Apr 2005 00:06:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90658-10 + for ; + Wed, 20 Apr 2005 03:06:57 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 9C9C15340B + for ; + Wed, 20 Apr 2005 00:06:56 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 58E2E30952; Wed, 20 Apr 2005 05:05:50 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: What to do with 6 disks? +Date: Tue, 19 Apr 2005 20:06:54 -0700 +Organization: Hub.Org Networking Services +Lines: 23 +Message-ID: +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + + <20050420001523.GU58835@decibel.org> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/484 +X-Sequence-Number: 11881 + +My experience: + +1xRAID10 for postgres +1xRAID1 for OS + WAL + + +Jeff Frost wrote: +> Now that we've hashed out which drives are quicker and more money equals +> faster... +> +> Let's say you had a server with 6 separate 15k RPM SCSI disks, what raid +> option would you use for a standalone postgres server? +> +> a) 3xRAID1 - 1 for data, 1 for xlog, 1 for os? +> b) 1xRAID1 for OS/xlog, 1xRAID5 for data +> c) 1xRAID10 for OS/xlong/data +> d) 1xRAID1 for OS, 1xRAID10 for data +> e) ..... +> +> I was initially leaning towards b, but after talking to Josh a bit, I +> suspect that with only 4 disks the raid5 might be a performance +> detriment vs 3 raid 1s or some sort of split raid10 setup. +> + +From pgsql-performance-owner@postgresql.org Wed Apr 20 00:02:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3319C5352B + for ; + Wed, 20 Apr 2005 00:02:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91017-03 + for ; + Wed, 20 Apr 2005 03:02:29 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id D30B8534EF + for ; + Wed, 20 Apr 2005 00:02:28 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7255795; Tue, 19 Apr 2005 20:04:24 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Jeff Frost +Subject: Re: What to do with 6 disks? +Date: Tue, 19 Apr 2005 20:07:33 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + <20050420001523.GU58835@decibel.org> + +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504192007.33512.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/482 +X-Sequence-Number: 11879 + +Jeff, + +> Let's say you had a server with 6 separate 15k RPM SCSI disks, what raid +> option would you use for a standalone postgres server? +> +> a) 3xRAID1 - 1 for data, 1 for xlog, 1 for os? +> b) 1xRAID1 for OS/xlog, 1xRAID5 for data +> c) 1xRAID10 for OS/xlong/data +> d) 1xRAID1 for OS, 1xRAID10 for data +> e) ..... +> +> I was initially leaning towards b, but after talking to Josh a bit, I +> suspect that with only 4 disks the raid5 might be a performance detriment +> vs 3 raid 1s or some sort of split raid10 setup. + +Knowing that your installation is read-heavy, I'd recommend (d), with the WAL +on the same disk as the OS, i.e. + +RAID1 2 disks OS, pg_xlog +RAID 1+0 4 disks pgdata + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 20 00:40:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 039305395A + for ; + Wed, 20 Apr 2005 00:40:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99660-06 + for ; + Wed, 20 Apr 2005 03:40:43 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id E0AB852972 + for ; + Wed, 20 Apr 2005 00:40:42 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id B68A81548B; Tue, 19 Apr 2005 22:40:41 -0500 (CDT) +Date: Tue, 19 Apr 2005 22:40:41 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Dave Held , + pgsql-performance@postgresql.org +Subject: Re: Sort and index +Message-ID: <20050420034041.GC58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050420004234.GX58835@decibel.org> + <19631.1113966086@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <19631.1113966086@sss.pgh.pa.us> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/485 +X-Sequence-Number: 11882 + +On Tue, Apr 19, 2005 at 11:01:26PM -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> > Actually, the planner (at least in 7.4) isn't smart enough to consider +> > if the sort would fit in memory or not. +> +> Really? Have you read cost_sort()? +> +> It's certainly possible that the calculation is all wet, but to claim +> that the issue is not considered is just wrong. + +To be fair, no, I haven't looked at the code. This is based strictly on +anecdotal evidence on a 120M row table. I'm currently running a test to +see how an index scan compares to a seqscan. I also got the same results +when I added a where clause that would restrict it to about 7% of the +table. + +Actually, after running some tests (below), the plan cost does change +when I change sort_mem (it was originally 50000). + +stats=# \d email_contrib + Table "public.email_contrib" + Column | Type | Modifiers +------------+---------+----------- + project_id | integer | not null + id | integer | not null + date | date | not null + team_id | integer | + work_units | bigint | not null +Indexes: + "email_contrib_pkey" primary key, btree (project_id, id, date) + "email_contrib__pk24" btree (id, date) WHERE (project_id = 24) + "email_contrib__pk25" btree (id, date) WHERE (project_id = 25) + "email_contrib__pk8" btree (id, date) WHERE (project_id = 8) + "email_contrib__project_date" btree (project_id, date) +Foreign-key constraints: + "fk_email_contrib__id" FOREIGN KEY (id) REFERENCES stats_participant(id) ON UPDATE CASCADE + "fk_email_contrib__team_id" FOREIGN KEY (team_id) REFERENCES stats_team(team) ON UPDATE CASCADE + +stats=# explain select * from email_contrib where project_id=8 order by project_id, id, date; + QUERY PLAN +-------------------------------------------------------------------------------- + Sort (cost=3613476.05..3635631.71 rows=8862263 width=24) + Sort Key: project_id, id, date + -> Seq Scan on email_contrib (cost=0.00..2471377.50 rows=8862263 width=24) + Filter: (project_id = 8) +(4 rows) + +stats=# explain select * from email_contrib order by project_id, id, date; + QUERY PLAN +---------------------------------------------------------------------------------- + Sort (cost=25046060.83..25373484.33 rows=130969400 width=24) + Sort Key: project_id, id, date + -> Seq Scan on email_contrib (cost=0.00..2143954.00 rows=130969400 width=24) +(3 rows) + +stats=# select 8862263::float/130969400; + ?column? +-------------------- + 0.0676666687027657 +(1 row) + +stats=# explain select * from email_contrib where project_id=8 order by project_id, id, date; + QUERY PLAN +----------------------------------------------------------------------------------------------------- + Index Scan using email_contrib_pkey on email_contrib (cost=0.00..6832005.57 rows=8862263 width=24) + Index Cond: (project_id = 8) +(2 rows) + +stats=# explain select * from email_contrib order by project_id, id, date; + QUERY PLAN +--------------------------------------------------------------------------------------------------------- + Index Scan using email_contrib_pkey on email_contrib (cost=0.00..100055905.62 rows=130969400 width=24) +(1 row) + +stats=# set enable_seqscan=on; +SET +stats=# set sort_mem=1000; +SET +stats=# explain select * from email_contrib order by project_id, id, date; + QUERY PLAN +---------------------------------------------------------------------------------- + Sort (cost=28542316.63..28869740.13 rows=130969400 width=24) + Sort Key: project_id, id, date + -> Seq Scan on email_contrib (cost=0.00..2143954.00 rows=130969400 width=24) +(3 rows) + +stats=# + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 20 01:34:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 438B853335 + for ; + Wed, 20 Apr 2005 01:34:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14110-09 + for ; + Wed, 20 Apr 2005 04:34:35 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E4A153325 + for ; + Wed, 20 Apr 2005 01:34:34 -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 1DO6ux-0001UZ-00; Wed, 20 Apr 2005 00:34:27 -0400 +To: "Jim C. Nasby" +Cc: pgsql-performance@postgresql.org +Subject: Re: Slow copy with little CPU/disk usage +References: <20050420020033.GZ58835@decibel.org> +In-Reply-To: <20050420020033.GZ58835@decibel.org> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 20 Apr 2005 00:34:27 -0400 +Message-ID: <87d5sqdq24.fsf@stark.xeocode.com> +Lines: 12 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/486 +X-Sequence-Number: 11883 + +"Jim C. Nasby" writes: + +> What's really odd is that neither the CPU or the disk are being +> hammered. The box appears to be pretty idle; the postgresql proces is +> using 4-5% CPU. + +Is he committing every row? In that case you would see fairly low i/o +bandwidth usage because most of the time is being spent seeking and waiting +for rotational latency. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 01:37:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BDF4453325 + for ; + Wed, 20 Apr 2005 01:37:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13640-10 + for ; + Wed, 20 Apr 2005 04:37:22 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 782025324F + for ; + Wed, 20 Apr 2005 01:37:21 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050420043721.PLXI23608.priv-edtnes56.telusplanet.net@localhost>; + Tue, 19 Apr 2005 22:37:21 -0600 +Received: from 64.180.225.200 ( [64.180.225.200]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Tue, 19 Apr 2005 21:37:20 -0700 +Message-ID: <1113971840.4265dc810374c@webmail.telus.net> +Date: Tue, 19 Apr 2005 21:37:21 -0700 +From: Mischa Sandberg +To: Tom Lane +Cc: "Jim C. Nasby" , + pgsql-performance@postgresql.org +Subject: Re: Slow copy with little CPU/disk usage +References: <20050420020033.GZ58835@decibel.org> + <19670.1113966354@sss.pgh.pa.us> +In-Reply-To: <19670.1113966354@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 64.180.225.200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/487 +X-Sequence-Number: 11884 + +Quoting Tom Lane : + +> "Jim C. Nasby" writes: +> > A friend of mine has an application where he's copying in 4000 rows at a +> > time into a table that has about 4M rows. Each row is 40-50 bytes. This +> > is taking 25 seconds on a dual PIII-1GHz with 1G of RAM and a 2 disk +> > SATA mirror, running FBSD 4.10-stable. There's one index on the table. +> +> If there's no hidden costs such as foreign key checks, that does seem +> pretty dang slow. +> +> > What's really odd is that neither the CPU or the disk are being +> > hammered. The box appears to be pretty idle; the postgresql proces is +> > using 4-5% CPU. +-- +This sounds EXACTLY like my problem, if you make the box to a Xeon 2.4GHz, 2GB +RAM ... with two SCSI drives (xlog and base); loading 10K rows of about 200 +bytes each; takes about 20 secs at the best, and much longer at the worst. By +any chance does your friend have several client machines/processes trying to +mass-load rows at the same time? Or at least some other processes updating +that table in a bulkish way? What I get is low diskio, low cpu, even low +context-switches ... and I'm betting he should take a look at pg_locks. For my +own problem, I gather that an exclusive lock is necessary while updating +indexes and heap, and the multiple processes doing the update can make that +pathological. + +Anyway, have your friend check pg_locks. + + +"Dreams come true, not free." -- S.Sondheim, ITW + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 01:40:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0FB6952A56 + for ; + Wed, 20 Apr 2005 01:40:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15661-05 + for ; + Wed, 20 Apr 2005 04:40:27 +0000 (GMT) +Received: from smtp809.mail.sc5.yahoo.com (smtp809.mail.sc5.yahoo.com + [66.163.168.188]) + by svr1.postgresql.org (Postfix) with SMTP id 33C4353365 + for ; + Wed, 20 Apr 2005 01:40:22 -0300 (ADT) +Received: from unknown (HELO discord.dyndns.org) + (jeffroe996@sbcglobal.net@69.226.230.214 with plain) + by smtp809.mail.sc5.yahoo.com with SMTP; 20 Apr 2005 04:40:14 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.dyndns.org (8.13.1/8.13.1) with ESMTP id j3K4e83n023846; + Tue, 19 Apr 2005 21:40:08 -0700 +Date: Tue, 19 Apr 2005 21:40:08 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.dyndns.org +To: Josh Berkus +Cc: pgsql-performance@postgresql.org +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +In-Reply-To: <200504192007.33512.josh@agliodbs.com> +Message-ID: +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + <20050420001523.GU58835@decibel.org> + + <200504192007.33512.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/488 +X-Sequence-Number: 11885 + +> RAID1 2 disks OS, pg_xlog +> RAID 1+0 4 disks pgdata + +Looks like the consensus is RAID 1 for OS, pg_xlog and RAID10 for pgdata. Now +here's another performance related question: + +I've seen quite a few folks touting the Opteron as 2.5x faster with postgres +than a Xeon box. What makes the Opteron so quick? Is it that Postgres +really prefers to run in 64-bit mode? + +When I look at AMD's TPC-C scores where they are showing off the Opteron +http://www.amd.com/us-en/Processors/ProductInformation/0,,30_118_8796_8800~96125,00.html +It doesn't appear 2.5x as fast as the Xeon systems, though I have heard from a +few Postgres folks that a dual Opteron is 2.5x as fast as a dual Xeon. I +would think that AMD would be all over that press if they could show it, so +what am I missing? Is it a bus speed thing? Better south bridge on the +boards? + +-- +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 Apr 20 01:45:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 69F6353239 + for ; + Wed, 20 Apr 2005 01:45:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17606-08 + for ; + Wed, 20 Apr 2005 04:44:54 +0000 (GMT) +Received: from smtp814.mail.sc5.yahoo.com (smtp814.mail.sc5.yahoo.com + [66.163.170.84]) + by svr1.postgresql.org (Postfix) with SMTP id 346D95323D + for ; + Wed, 20 Apr 2005 01:44:53 -0300 (ADT) +Received: from unknown (HELO discord.dyndns.org) + (jeffroe996@sbcglobal.net@69.226.230.214 with plain) + by smtp814.mail.sc5.yahoo.com with SMTP; 20 Apr 2005 04:44:53 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.dyndns.org (8.13.1/8.13.1) with ESMTP id j3K4iqhP024114 + for ; Tue, 19 Apr 2005 21:44:52 -0700 +Date: Tue, 19 Apr 2005 21:44:52 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.dyndns.org +To: pgsql-performance@postgresql.org +Subject: How to tell what your postgresql server is doing +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/489 +X-Sequence-Number: 11886 + +Is there a way to look at the stats tables and tell what is jamming up your +postgres server the most? Other than seeing long running queries and watch +top, atop, iostat, vmstat in separate xterms...I'm wondering if postgres keeps +some stats on what it spends the most time doing or if there's a way to +extract that sort of info from other metrics it keeps in the stats table? + +Maybe a script which polls the stats table and correlates the info with stats +about the system in /proc? + +-- +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 Apr 20 02:20:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 27AC853397 + for ; + Wed, 20 Apr 2005 02:20:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25194-08 + for ; + Wed, 20 Apr 2005 05:19:55 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 3044653379 + for ; + Wed, 20 Apr 2005 02:19:54 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id A121524FE0; + Wed, 20 Apr 2005 13:19:51 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 7FDB624FDF; + Wed, 20 Apr 2005 13:19:51 +0800 (WST) +Message-ID: <4265E6E5.9010805@familyhealth.com.au> +Date: Wed, 20 Apr 2005 13:21:41 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Jeff Frost +Cc: pgsql-performance@postgresql.org +Subject: Re: How to tell what your postgresql server is doing +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/490 +X-Sequence-Number: 11887 + +> Is there a way to look at the stats tables and tell what is jamming up +> your postgres server the most? Other than seeing long running queries +> and watch top, atop, iostat, vmstat in separate xterms...I'm wondering +> if postgres keeps some stats on what it spends the most time doing or if +> there's a way to extract that sort of info from other metrics it keeps +> in the stats table? +> +> Maybe a script which polls the stats table and correlates the info with +> stats about the system in /proc? + +Turn on logging of all queries, sample for a few hours or one day. Then + run Practical Query Analyzer (PQA on pgfoundry.org) over it to get +aggregate query information. + +Chris + +From pgsql-performance-owner@postgresql.org Wed Apr 20 03:03:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E98095320B + for ; + Wed, 20 Apr 2005 03:02:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46416-02 + for ; + Wed, 20 Apr 2005 06:02:29 +0000 (GMT) +Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) + by svr1.postgresql.org (Postfix) with ESMTP id 8930652952 + for ; + Wed, 20 Apr 2005 03:02:28 -0300 (ADT) +Received: from [64.171.1.72] (account jrogers@neopolitan.com) + by mx1.neopolitan.us (CommuniGate Pro WebUser 4.1.8) + with HTTP id 8746574 for pgsql-performance@postgresql.org; + Tue, 19 Apr 2005 23:02:28 -0700 +From: "J. Andrew Rogers" +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +To: pgsql-performance@postgresql.org +X-Mailer: CommuniGate Pro WebUser Interface v.4.1.8 +Date: Tue, 19 Apr 2005 23:02:28 -0700 +Message-ID: +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset="ISO-8859-1"; format="flowed" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.776 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, RCVD_IN_NJABL_PROXY +X-Spam-Level: ** +X-Archive-Number: 200504/491 +X-Sequence-Number: 11888 + +>I've seen quite a few folks touting the Opteron as 2.5x +>faster with postgres than a Xeon box. What makes the +>Opteron so quick? Is it that Postgres really prefers to +>run in 64-bit mode? + + +I don't know about 2.5x faster (perhaps on specific types +of loads), but the reason Opterons rock for database +applications is their insanely good memory bandwidth and +latency that scales much better than the Xeon. Opterons +also have a ccNUMA-esque I/O fabric and two dedicated +on-die memory channels *per processor* -- no shared bus +there, closer to real UNIX server iron than a glorified +PC. + +We run a large Postgres database on a dual Opteron in +32-bit mode that crushes Xeons running at higher clock +speeds. It has little to do with bitness or theoretical +instruction dispatch, and everything to do with the +superior memory controller and I/O fabric. Databases are +all about moving chunks of data around and the Opteron +systems were engineered to do this very well and in a very +scalable fashion. For the money, it is hard to argue with +the price/performance of Opteron based servers. We +started with one dual Opteron postgres server just over a +year ago (with an equivalent uptime) and have considered +nothing but Opterons for database servers since. Opterons +really are clearly superior to Xeons for this application. + I don't work for AMD, just a satisfied customer. :-) + + +re: 6 disks. Unless you are tight on disk space, a hot +spare might be nice as well depending on your needs. + +Cheers, + +J. Andrew Rogers + +From pgsql-performance-owner@postgresql.org Wed Apr 20 03:21:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D2467539DC + for ; + Wed, 20 Apr 2005 03:21:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54276-01 + for ; + Wed, 20 Apr 2005 06:21:34 +0000 (GMT) +Received: from smtp818.mail.sc5.yahoo.com (smtp818.mail.sc5.yahoo.com + [66.163.170.4]) + by svr1.postgresql.org (Postfix) with SMTP id A3C6D5380C + for ; + Wed, 20 Apr 2005 03:21:32 -0300 (ADT) +Received: from unknown (HELO discord.dyndns.org) + (jeffroe996@sbcglobal.net@69.226.230.214 with plain) + by smtp818.mail.sc5.yahoo.com with SMTP; 20 Apr 2005 06:21:32 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.dyndns.org (8.13.1/8.13.1) with ESMTP id j3K6LWDO030257 + for ; Tue, 19 Apr 2005 23:21:32 -0700 +Date: Tue, 19 Apr 2005 23:21:32 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.dyndns.org +To: pgsql-performance@postgresql.org +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +In-Reply-To: +Message-ID: +References: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/492 +X-Sequence-Number: 11889 + +On Tue, 19 Apr 2005, J. Andrew Rogers wrote: + +> I don't know about 2.5x faster (perhaps on specific types of loads), but the +> reason Opterons rock for database applications is their insanely good memory +> bandwidth and latency that scales much better than the Xeon. Opterons also +> have a ccNUMA-esque I/O fabric and two dedicated on-die memory channels *per +> processor* -- no shared bus there, closer to real UNIX server iron than a +> glorified PC. + +Thanks J! That's exactly what I was suspecting it might be. Actually, I +found an anandtech benchmark that shows the Opteron coming in at close to 2.0x +performance: + +http://www.anandtech.com/linux/showdoc.aspx?i=2163&p=2 + +It's an Opteron 150 (2.4ghz) vs. Xeon 3.6ghz from August. I wonder if the +differences are more pronounced with the newer Opterons. + +-Jeff + +From pgsql-performance-owner@postgresql.org Wed Apr 20 05:35:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9344E53A28 + for ; + Wed, 20 Apr 2005 05:35:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89236-02 + for ; + Wed, 20 Apr 2005 08:35:52 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) + by svr1.postgresql.org (Postfix) with ESMTP id E43BA53AAD + for ; + Wed, 20 Apr 2005 05:35:47 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so138189nzf + for ; + Wed, 20 Apr 2005 01:35:48 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=NRZ+3wbTmkx/0Otp+rmn8zsgv9pO3S8ME4H+mP5o6voKtSqwdzXpAF1Yx4rKWYe7ehNl6qq0BEaebetFEewPnFv54KJ8egYz4QB3EYQOhtj7iRyHc19N1NN67NuCSyO4TFTCU1q0zM4uJFQg3qeDjnUn530wAtNvdFQTQW7QWZ8= +Received: by 10.36.61.11 with SMTP id j11mr59976nza; + Wed, 20 Apr 2005 01:35:48 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Wed, 20 Apr 2005 01:35:48 -0700 (PDT) +Message-ID: <758d5e7f0504200135367d56d5@mail.gmail.com> +Date: Wed, 20 Apr 2005 10:35:48 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-Reply-To: <20050420003054.GV58835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <758d5e7f05041807194a78b55a@mail.gmail.com> + <20050420003054.GV58835@decibel.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.761 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/493 +X-Sequence-Number: 11890 + +On 4/20/05, Jim C. Nasby wrote: +> You should re-run the function test using SQL as the function language +> instead of plpgsql. There might be some performance to be had there. + +Yay! You're right! I wonder why have I forgotten about LANGUAGE SQL. :) +It's 30 seconds vs 5 seconds for CASE ... END insisde PLpgsql vs CASE...END +LANGUAGE SQL. :) I.e. its almost the same as in-place entered SQL. + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Wed Apr 20 22:13:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 93C115351B + for ; + Wed, 20 Apr 2005 22:13:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01282-09 + for ; + Thu, 21 Apr 2005 01:13:12 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id CBC61533E5 + for ; + Wed, 20 Apr 2005 22:12:33 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 50C4124FDD; + Thu, 21 Apr 2005 09:12:23 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 1EAC124FCE; + Thu, 21 Apr 2005 09:12:23 +0800 (WST) +Message-ID: <42661860.6040105@familyhealth.com.au> +Date: Wed, 20 Apr 2005 16:52:48 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dawid Kuroczko +Cc: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <758d5e7f05041807194a78b55a@mail.gmail.com> + <20050420003054.GV58835@decibel.org> + <758d5e7f0504200135367d56d5@mail.gmail.com> +In-Reply-To: <758d5e7f0504200135367d56d5@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/545 +X-Sequence-Number: 11942 + +> Yay! You're right! I wonder why have I forgotten about LANGUAGE SQL. :) +> It's 30 seconds vs 5 seconds for CASE ... END insisde PLpgsql vs CASE...END +> LANGUAGE SQL. :) I.e. its almost the same as in-place entered SQL. +> +> Regards, +> Dawid +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if your +> joining column's datatypes do not match + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 05:51:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A796953AB5 + for ; + Wed, 20 Apr 2005 05:51:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92476-04 + for ; + Wed, 20 Apr 2005 08:51:20 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B50653AAD + for ; + Wed, 20 Apr 2005 05:51:18 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 7423A24FE2; + Wed, 20 Apr 2005 16:51:17 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 6FD9E24FE1; + Wed, 20 Apr 2005 16:51:17 +0800 (WST) +Message-ID: <42661878.6010802@familyhealth.com.au> +Date: Wed, 20 Apr 2005 16:53:12 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dawid Kuroczko +Cc: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <758d5e7f05041807194a78b55a@mail.gmail.com> + <20050420003054.GV58835@decibel.org> + <758d5e7f0504200135367d56d5@mail.gmail.com> +In-Reply-To: <758d5e7f0504200135367d56d5@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/494 +X-Sequence-Number: 11891 + +> Yay! You're right! I wonder why have I forgotten about LANGUAGE SQL. :) +> It's 30 seconds vs 5 seconds for CASE ... END insisde PLpgsql vs CASE...END +> LANGUAGE SQL. :) I.e. its almost the same as in-place entered SQL. + +Probably because simple SQL functions get inlined by the optimiser. + +Chris + +From pgsql-performance-owner@postgresql.org Wed Apr 20 05:55:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 29F1053A06 + for ; + Wed, 20 Apr 2005 05:55:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94146-02 + for ; + Wed, 20 Apr 2005 08:55:44 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) + by svr1.postgresql.org (Postfix) with ESMTP id C7C5653209 + for ; + Wed, 20 Apr 2005 05:55:42 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so144089nzf + for ; + Wed, 20 Apr 2005 01:55:44 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=urwKbh/x0Jn3zfLdn7mWqOx9TRVQbP8N0vtVfOlfqLgrD1J71mPJ22nunZ3nxm9L72rx8kVTFQu+Wzbfso1fWnIu5r+T48UiOwo/i6Yz1u2mcYRBAHY1ad6wPYDDcqeSHuoWLRJwR5fsIbpLdwD+gjlc1CivAXfTuGgdmPE79yQ= +Received: by 10.36.59.18 with SMTP id h18mr61267nza; + Wed, 20 Apr 2005 01:55:44 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Wed, 20 Apr 2005 01:55:44 -0700 (PDT) +Message-ID: <758d5e7f05042001558f24d0f@mail.gmail.com> +Date: Wed, 20 Apr 2005 10:55:44 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: pgsql-performance@postgresql.org +Subject: Re: How to improve db performance with $7K? +In-Reply-To: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.762 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/495 +X-Sequence-Number: 11892 + +On 4/19/05, Mohan, Ross wrote: +> Clustered file systems is the first/best example that +> comes to mind. Host A and Host B can both request from diskfarm, eg. + +Something like a Global File System? + +http://www.redhat.com/software/rha/gfs/ + +(I believe some other company did develop it some time in the past; +hmm, probably the guys doing LVM stuff?). + +Anyway the idea is that two machines have same filesystem mounted and +they share it. The locking I believe is handled by communication +between computers using "host to host" SCSI commands. + +I never used it, I've only heard about it from a friend who used to +work with it in CERN. + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Wed Apr 20 11:22:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B8DB95369A + for ; + Wed, 20 Apr 2005 11:22:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91656-10 + for ; + Wed, 20 Apr 2005 14:22:26 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 8E29953688 + for ; + Wed, 20 Apr 2005 11:22:25 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP id 872EC83D5E + for ; + Wed, 20 Apr 2005 16:22:27 +0200 (CEST) +Message-ID: <426665A0.1080102@trust-factory.com> +Date: Wed, 20 Apr 2005 16:22:24 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-perform +Subject: When are index scans used over seq scans? +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/496 +X-Sequence-Number: 11893 + +We have a table with 1M rows that contain sessions with a start and +finish timestamps. When joining this table with a 10k table with rounded +timestamps, explain shows me sequential scans are used, and the join +takes about 6 hours (2s per seq scan on session table * 10000): + + Nested Loop (cost=252.80..233025873.16 rows=1035480320 width=97) +Join Filter: (("outer".starttime <= "inner".ts) AND ("outer".finishtime +>= "inner".ts)) + -> Seq Scan on sessions us (cost=0.00..42548.36 rows=924536 +width=105) -> Materialize (cost=252.80..353.60 rows=10080 width=8) + -> Seq Scan on duration du (cost=0.00..252.80 rows=10080 width=8) + +However, during the initial loading of the data (we first load into text +tables, then convert to tables using timestamps etc, then run this +query) the same query took only 12 minutes. While debugging, I increased +cpu_tuple_cost to 0.1 (from 0.01). Now the explain shows an index scan, +and the run time comes down to 11 minutes: + + Nested Loop (cost=0.00..667700310.42 rows=1035480320 width=97) + -> Seq Scan on sessions us (cost=0.00..125756.60 rows=924536 width=105) + -> Index Scan using ix_du_ts on duration du (cost=0.00..604.46 +rows=1120 width=8) + Index Cond: (("outer".starttime <= du.ts) AND +("outer".finishtime >= du.ts)) + +I am glad that I found a way to force the use of the index, but still +can't explain why in the initial run the planner made the right choice, +but now I need to give it a hand. Could this have to do with the +statistics of the tables? I make very sure (during the initial load and +while testing) that I vacuum analyze all tables after I fill them. + +I'm runing postgres 7.4.7. + +Any help is appreciated. + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 11:35:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C387553690 + for ; + Wed, 20 Apr 2005 11:35:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33516-08 + for ; + Wed, 20 Apr 2005 14:34:56 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D787536AD + for ; + Wed, 20 Apr 2005 11:34:54 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3KEYuDC021367; (envelope-from ) Wed, + 20 Apr 2005 09:34:56 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3KEYseW028243 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 20 Apr 2005 09:34:55 -0500 (CDT) +Message-ID: <42666890.1000401@arbash-meinel.com> +Date: Wed, 20 Apr 2005 09:34:56 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard van den Berg +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> +In-Reply-To: <426665A0.1080102@trust-factory.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigB8AC96733943C648CF833E75" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/497 +X-Sequence-Number: 11894 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigB8AC96733943C648CF833E75 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Richard van den Berg wrote: + +>We have a table with 1M rows that contain sessions with a start and +>finish timestamps. When joining this table with a 10k table with rounded +>timestamps, explain shows me sequential scans are used, and the join +>takes about 6 hours (2s per seq scan on session table * 10000): +> +> Nested Loop (cost=252.80..233025873.16 rows=1035480320 width=97) +>Join Filter: (("outer".starttime <= "inner".ts) AND ("outer".finishtime +> +> +>>= "inner".ts)) +>> +>> +> -> Seq Scan on sessions us (cost=0.00..42548.36 rows=924536 +>width=105) -> Materialize (cost=252.80..353.60 rows=10080 width=8) +> -> Seq Scan on duration du (cost=0.00..252.80 rows=10080 width=8) +> +>However, during the initial loading of the data (we first load into text +>tables, then convert to tables using timestamps etc, then run this +>query) the same query took only 12 minutes. While debugging, I increased +>cpu_tuple_cost to 0.1 (from 0.01). Now the explain shows an index scan, +>and the run time comes down to 11 minutes: +> +> Nested Loop (cost=0.00..667700310.42 rows=1035480320 width=97) +> -> Seq Scan on sessions us (cost=0.00..125756.60 rows=924536 width=105) +> -> Index Scan using ix_du_ts on duration du (cost=0.00..604.46 +>rows=1120 width=8) +> Index Cond: (("outer".starttime <= du.ts) AND +>("outer".finishtime >= du.ts)) +> +>I am glad that I found a way to force the use of the index, but still +>can't explain why in the initial run the planner made the right choice, +>but now I need to give it a hand. Could this have to do with the +>statistics of the tables? I make very sure (during the initial load and +>while testing) that I vacuum analyze all tables after I fill them. +> +>I'm runing postgres 7.4.7. +> +>Any help is appreciated. +> +> +> +I believe the problem is that postgres doesn't recognize how restrictive +a date-range is unless it uses constants. +So saying: + +select blah from du WHERE time between '2004-10-10' and '2004-10-15'; +Will properly use the index, because it realizes it only returns a few rows. +However +select blah from du, us where du.ts between us.starttime and us.finishtime; +Doesn't know how selective that BETWEEN is. + +This has been discussed as a future improvement to the planner (in +8.*). I don't know the current status. + +Also, in the future, you really should post your table schema, and +explain analyze instead of just explain. (I realize that with a 6hr +query it is a little painful.) + +Notice that in the above plans, the expected number of rows drops from +10k down to 1k (which is probably where the planner decides to switch). +And if you actually did the analyze probably the number of rows is much +lower still. + +Probably you should try to find out the status of multi-table +selectivity. It was discussed in the last couple of months. + +John +=:-> + + +--------------enigB8AC96733943C648CF833E75 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCZmiQJdeBCYSNAAMRAn3mAKDARvtifbQlcn3FVJWVMWy98AfOjACgyPRa +ZDVmbjdr2LNnUNjw/Nb1Jo4= +=Fpxr +-----END PGP SIGNATURE----- + +--------------enigB8AC96733943C648CF833E75-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 11:39:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A0E853551 + for ; + Wed, 20 Apr 2005 11:39:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41368-09 + for ; + Wed, 20 Apr 2005 14:39:17 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 896A453514 + for ; + Wed, 20 Apr 2005 11:39:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3KEdLoN026711; + Wed, 20 Apr 2005 10:39:21 -0400 (EDT) +To: Richard van den Berg +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +In-reply-to: <426665A0.1080102@trust-factory.com> +References: <426665A0.1080102@trust-factory.com> +Comments: In-reply-to Richard van den Berg + + message dated "Wed, 20 Apr 2005 16:22:24 +0200" +Date: Wed, 20 Apr 2005 10:39:21 -0400 +Message-ID: <26710.1114007961@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/498 +X-Sequence-Number: 11895 + +Richard van den Berg writes: +> We have a table with 1M rows that contain sessions with a start and +> finish timestamps. When joining this table with a 10k table with rounded +> timestamps, explain shows me sequential scans are used, and the join +> takes about 6 hours (2s per seq scan on session table * 10000): + +> Nested Loop (cost=252.80..233025873.16 rows=1035480320 width=97) +> Join Filter: (("outer".starttime <= "inner".ts) AND ("outer".finishtime +>> = "inner".ts)) +> -> Seq Scan on sessions us (cost=0.00..42548.36 rows=924536 +> width=105) -> Materialize (cost=252.80..353.60 rows=10080 width=8) +> -> Seq Scan on duration du (cost=0.00..252.80 rows=10080 width=8) + +The explain shows no such thing. What is the *actual* runtime of +each plan per EXPLAIN ANALYZE, please? + +(In general, any time you are complaining about planner misbehavior, +it is utterly pointless to give only planner estimates and not reality. +By definition, you don't think the estimates are right.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:09:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FB375360F + for ; + Wed, 20 Apr 2005 12:09:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87484-09 + for ; + Wed, 20 Apr 2005 15:09:48 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 52F915360E + for ; + Wed, 20 Apr 2005 12:09:45 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 9862F30952; Wed, 20 Apr 2005 17:08:37 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +Date: Wed, 20 Apr 2005 08:09:37 -0700 +Organization: Hub.Org Networking Services +Lines: 49 +Message-ID: +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/499 +X-Sequence-Number: 11896 + +I posted this link a few months ago and there was some surprise over the +difference in postgresql compared to other DBs. (Not much surprise in +Opteron stomping on Xeon in pgsql as most people here have had that +experience -- the surprise was in how much smaller the difference was in +other DBs.) If it was across the board +100% in MS-SQL, MySQL, etc -- +you can chalk in up to overall better CPU architecture. Most of the time +though, the numbers I've seen show +0-30% for [insert DB here] and a +huge whopping +++++ for pgsql. Why the pronounced preference for +postgresql, I'm not sure if it was explained fully. + +BTW, the Anandtech test compares single CPU systems w/ 1GB of RAM. Go to +dual/quad and SMP Xeon will suffer even more since it has to share a +fixed amount of FSB/memory bandwidth amongst all CPUs. Xeons also seem +to suffer more from context-switch storms. Go > 4GB of RAM and the Xeon +suffers another hit due to the lack of a 64-bit IOMMU. Devices cannot +map to addresses > 4GB which means the OS has to do extra work in +copying data from/to > 4GB anytime you have IO. (Although this penalty +might exist all the time in 64-bit mode for Xeon if Linux/Windows took +the expedient and less-buggy route of using a single method versus +checking whether target addresses are > or < 4GB.) + + + +Jeff Frost wrote: +> On Tue, 19 Apr 2005, J. Andrew Rogers wrote: +> +>> I don't know about 2.5x faster (perhaps on specific types of loads), +>> but the reason Opterons rock for database applications is their +>> insanely good memory bandwidth and latency that scales much better +>> than the Xeon. Opterons also have a ccNUMA-esque I/O fabric and two +>> dedicated on-die memory channels *per processor* -- no shared bus +>> there, closer to real UNIX server iron than a glorified PC. +> +> +> Thanks J! That's exactly what I was suspecting it might be. Actually, +> I found an anandtech benchmark that shows the Opteron coming in at close +> to 2.0x performance: +> +> http://www.anandtech.com/linux/showdoc.aspx?i=2163&p=2 +> +> It's an Opteron 150 (2.4ghz) vs. Xeon 3.6ghz from August. I wonder if +> the differences are more pronounced with the newer Opterons. +> +> -Jeff +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if your +> joining column's datatypes do not match +> + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:15:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6846153690 + for ; + Wed, 20 Apr 2005 12:15:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34254-02 + for ; + Wed, 20 Apr 2005 15:15:42 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D34F535D2 + for ; + Wed, 20 Apr 2005 12:15:42 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 33D5183D5E; Wed, 20 Apr 2005 17:15:39 +0200 (CEST) +Message-ID: <42667219.7050907@trust-factory.com> +Date: Wed, 20 Apr 2005 17:15:37 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: John A Meinel +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <42666890.1000401@arbash-meinel.com> +In-Reply-To: <42666890.1000401@arbash-meinel.com> +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/500 +X-Sequence-Number: 11897 + +John A Meinel wrote: +> I believe the problem is that postgres doesn't recognize how restrictive +> a date-range is unless it uses constants. + +And it does when using BETWEEN with int for example? Impressive. :-) + +> select blah from du WHERE time between '2004-10-10' and '2004-10-15'; +> Will properly use the index, because it realizes it only returns a few +> rows. + +Correct, it does. + +> Probably you should try to find out the status of multi-table +> selectivity. It was discussed in the last couple of months. + +I can't find the posts you are refering to. What is the priciple of +multi-table selectivity? + +Your explanation sounds very plausible.. I don't mind changing the +cpu_tuple_cost before running BETWEEN with timestamps, they are easy +enough to spot. + +Thanks, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:25:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B23EB52A8B + for ; + Wed, 20 Apr 2005 12:25:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37641-01 + for ; + Wed, 20 Apr 2005 15:24:59 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id EB39F52967 + for ; + Wed, 20 Apr 2005 12:24:57 -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 A9890B80D + for ; + Wed, 20 Apr 2005 11:24:56 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <42605805.4070603@cheapcomplexdevices.com> +References: <42602785.602f27fb.2c70.0ad4@mx.gmail.com> + <1113600783.3859.408.camel@home> + <42605805.4070603@cheapcomplexdevices.com> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-17-412026744; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: Spend 7K *WHERE*? WAS Intel SRCS16 SATA raid? and How +Date: Wed, 20 Apr 2005 11:24:56 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/501 +X-Sequence-Number: 11898 + + +--Apple-Mail-17-412026744 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + +On Apr 15, 2005, at 8:10 PM, Ron Mayer wrote: + +> For example, I didn't see many other $7000 proposals have +> have nearly 10GB of ram, or over a dozen CPUs (even counting +> the raid controllers), or over a half a terrabyte of storage , +> or capable of 5-10 Gbit/sec of network traffic... The extra + +And how much are you spending on the switch that will carry 10Gb/sec +traffic? + +> capacity would allow me to have redundancy that would somewhat +> make up for the flakier hardware, no raid, etc. + +it would work for some class of applications which are pretty much +read-only. and don't forget to factor in the overhead of the +replication... + +> +> Thoughts? Over the next couple months I'll be evaluating +> a cluster of 4 systems almost exactly as I described (but +> with cheaper dual hard drives in each system), for a GIS +> system that does lend itself well to application-level +> partitioning. + +I'd go with fewer bigger boxes with RAID so i can sleep better at night +:-) + + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +--Apple-Mail-17-412026744 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +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/11fZU8wggNAMIICqaADAgECAgMOah8wDQYJKoZI +hvcNAQEEBQAwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkp +IEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1 +MDQwNTIwMzEzMloXDTA2MDQwNTIwMzEzMlowgYoxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBN +ZW1iZXIxHjAcBgkqhkiG9w0BCQEWD3ZpdmVrQGtoZXJhLm9yZzEgMB4GCSqGSIb3DQEJARYRa2hl +cmFAa2NpbGluay5jb20xJTAjBgkqhkiG9w0BCQEWFnZpdmVrQG1haWxlcm1haWxlci5jb20wggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdo7hywGcY0VvK6WqqXXV77MS/t/4X3WkCaCXo +RSl2W58GP4P21hodPn7hlIxUoDOW7x9O+FbqTgE2Ejqr6yA00Mm90tGPFgjFjqPGAqg7xk6IDcv9 +uTyMia/FKEHSIynM6zqokXY8JklvdbJOiByE/8VeyEXOANWiflo8o4+GHnhMKpA9982YTXUqeKU6 +mMQVaLCBRjTDc7j2XkMC/UNcp2HMyDQdTqYVnhLxbvbLX8CNDBY/7OWFlB9evru46SpGWhe4lhv5 +DSgE2RdCKvDytzxRDvP49L8V0TnFjAVeC1C1Pj0/KQsoL/AP4APplROiD4QaUhshQl28pXxJtfbl +AgMBAAGjVzBVMEUGA1UdEQQ+MDyBD3ZpdmVrQGtoZXJhLm9yZ4ERa2hlcmFAa2NpbGluay5jb22B +FnZpdmVrQG1haWxlcm1haWxlci5jb20wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQAr +CWop3h28qPwofzLrkoT410J4d7Bqk6FLeVlKZfg/wXlS1MTqYMNcCm4x+JsJbjwsO0fb2elFIuGq +1razoSzPpgi89itydvUT0U0U/u+AkZA5rW4AptTpMZ70YW5u9wzkcvmifqZmcfbaaeGdZfruzUXZ +6qvdXDpNb3ZHeQw6PjGCAucwggLjAgEBMGkwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0 +ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFp +bCBJc3N1aW5nIENBAgMOah8wCQYFKw4DAhoFAKCCAVMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH +ATAcBgkqhkiG9w0BCQUxDxcNMDUwNDIwMTUyNDU2WjAjBgkqhkiG9w0BCQQxFgQUZv3gSDeAPbhn +YhIRRzlIZTB7jDkweAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh +d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAnFVQpFOb3DRi +YoaG2hhSayueF6BFZUHpP/VxP0+g8AL+I6NdF3wctfrf+54RvwZdtrWoymlGI3qMI7ZQvfnD+mC6 +Ngff0tS4l2TRSQwivtUcq6ao34/NMQsU1tWsUF6cvH5q3i5TdkT7lAY1qJDRG7abBliQyCrEOK5S +EYz5oascDay6VA9jzOEDFwCvHj7dL/lcB/PHSP1OHY308RLAI2ljVGcEt5zP4qW2Fs0N37koez6/ +lSpeLthvkTUocmjTN1dunvxgLI7tyhxJS9MT4d0jDUBQ9l0/J30+nto8God6VYREXYfgVEZCNpXC +R1HaewZX/zYl76UrMpzGSC/HPQAAAAAAAA== + +--Apple-Mail-17-412026744-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:27:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 45A5B52951 + for ; + Wed, 20 Apr 2005 12:27:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37624-04 + for ; + Wed, 20 Apr 2005 15:27:23 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B7FD53875 + for ; + Wed, 20 Apr 2005 12:27:23 -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 E0B69B80D + for ; + Wed, 20 Apr 2005 11:27:22 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <425E5B38.6020407@trust-factory.com> +References: <425E5B38.6020407@trust-factory.com> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-18-412172723; + protocol="application/pkcs7-signature" +Message-Id: <5cb421b6dd5dca3586616b66390b0d40@khera.org> +From: Vivek Khera +Subject: Re: Foreign key slows down copy/insert +Date: Wed, 20 Apr 2005 11:27:22 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/502 +X-Sequence-Number: 11899 + + +--Apple-Mail-18-412172723 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + +On Apr 14, 2005, at 7:59 AM, Richard van den Berg wrote: + +> How do I explain why test cases 2 and 3 do not come close to case 1? +> Am I missing something obvious? + +there's cost involved with enforcing the FK: if you're indexes can't be +used then you're doing a boatload of sequence scans to find and lock +the referenced rows in the parent tables. + +Make sure you have indexes on your FK columns (on *both* tables), and +that the data type on both tables is the same. + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +--Apple-Mail-18-412172723 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +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/11fZU8wggNAMIICqaADAgECAgMOah8wDQYJKoZI +hvcNAQEEBQAwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkp +IEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1 +MDQwNTIwMzEzMloXDTA2MDQwNTIwMzEzMlowgYoxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBN +ZW1iZXIxHjAcBgkqhkiG9w0BCQEWD3ZpdmVrQGtoZXJhLm9yZzEgMB4GCSqGSIb3DQEJARYRa2hl +cmFAa2NpbGluay5jb20xJTAjBgkqhkiG9w0BCQEWFnZpdmVrQG1haWxlcm1haWxlci5jb20wggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdo7hywGcY0VvK6WqqXXV77MS/t/4X3WkCaCXo +RSl2W58GP4P21hodPn7hlIxUoDOW7x9O+FbqTgE2Ejqr6yA00Mm90tGPFgjFjqPGAqg7xk6IDcv9 +uTyMia/FKEHSIynM6zqokXY8JklvdbJOiByE/8VeyEXOANWiflo8o4+GHnhMKpA9982YTXUqeKU6 +mMQVaLCBRjTDc7j2XkMC/UNcp2HMyDQdTqYVnhLxbvbLX8CNDBY/7OWFlB9evru46SpGWhe4lhv5 +DSgE2RdCKvDytzxRDvP49L8V0TnFjAVeC1C1Pj0/KQsoL/AP4APplROiD4QaUhshQl28pXxJtfbl +AgMBAAGjVzBVMEUGA1UdEQQ+MDyBD3ZpdmVrQGtoZXJhLm9yZ4ERa2hlcmFAa2NpbGluay5jb22B +FnZpdmVrQG1haWxlcm1haWxlci5jb20wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQAr +CWop3h28qPwofzLrkoT410J4d7Bqk6FLeVlKZfg/wXlS1MTqYMNcCm4x+JsJbjwsO0fb2elFIuGq +1razoSzPpgi89itydvUT0U0U/u+AkZA5rW4AptTpMZ70YW5u9wzkcvmifqZmcfbaaeGdZfruzUXZ +6qvdXDpNb3ZHeQw6PjGCAucwggLjAgEBMGkwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0 +ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFp +bCBJc3N1aW5nIENBAgMOah8wCQYFKw4DAhoFAKCCAVMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH +ATAcBgkqhkiG9w0BCQUxDxcNMDUwNDIwMTUyNzIyWjAjBgkqhkiG9w0BCQQxFgQUGCwmJmlcJH+h +gsvfZ77fBk/d2z4weAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh +d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAYKkJGQZazJxd +hnT23J7F6iOnJbkssCCeKC4nue6dOS6YjZ3FAvEfs8+eBt9pdXpHgjl71RrkkrSooLodynwKYcHQ +HupoX7r7GVCcMIsfjxVBzJu2neT5NcIkb0qbuaT3DMMWJVUORoK/PhWV4DwlZgMN1Zb2Aqw/Wddn +nhQJ0lCHg6OJc0FfNT4PhzNhzE4NQLevTebfFf74C+pF1n4ay71Px1gTz5QkSPHcHCFlo2r2uXP2 +BqhDl45Id8nwGag9n6r4dJygGDjrWoLDPrBOUvBtcBT8NElWcmePZ0vQqj7LtZqF3Dlc08DdTqh3 +ZRAgA9PpWz0VuxhRYzcpkophaAAAAAAAAA== + +--Apple-Mail-18-412172723-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:36:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 02CBC53549 + for ; + Wed, 20 Apr 2005 12:36:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48549-01 + for ; + Wed, 20 Apr 2005 15:36:30 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AF375353E + for ; + Wed, 20 Apr 2005 12:36:29 -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 CB3DDB80D + for ; + Wed, 20 Apr 2005 11:36:29 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <200504192007.33512.josh@agliodbs.com> +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + <20050420001523.GU58835@decibel.org> + + <200504192007.33512.josh@agliodbs.com> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-19-412719777; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: What to do with 6 disks? +Date: Wed, 20 Apr 2005 11:36:29 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.039 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/503 +X-Sequence-Number: 11900 + + +--Apple-Mail-19-412719777 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + +On Apr 19, 2005, at 11:07 PM, Josh Berkus wrote: + +> RAID1 2 disks OS, pg_xlog +> RAID 1+0 4 disks pgdata +> + +This is my preferred setup, but I do it with 6 disks on RAID10 for +data, and since I have craploads of disk space I set checkpoint +segments to 256 (and checkpoint timeout to 5 minutes) + + + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +--Apple-Mail-19-412719777 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +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/11fZU8wggNAMIICqaADAgECAgMOah8wDQYJKoZI +hvcNAQEEBQAwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkp +IEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1 +MDQwNTIwMzEzMloXDTA2MDQwNTIwMzEzMlowgYoxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBN +ZW1iZXIxHjAcBgkqhkiG9w0BCQEWD3ZpdmVrQGtoZXJhLm9yZzEgMB4GCSqGSIb3DQEJARYRa2hl +cmFAa2NpbGluay5jb20xJTAjBgkqhkiG9w0BCQEWFnZpdmVrQG1haWxlcm1haWxlci5jb20wggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdo7hywGcY0VvK6WqqXXV77MS/t/4X3WkCaCXo +RSl2W58GP4P21hodPn7hlIxUoDOW7x9O+FbqTgE2Ejqr6yA00Mm90tGPFgjFjqPGAqg7xk6IDcv9 +uTyMia/FKEHSIynM6zqokXY8JklvdbJOiByE/8VeyEXOANWiflo8o4+GHnhMKpA9982YTXUqeKU6 +mMQVaLCBRjTDc7j2XkMC/UNcp2HMyDQdTqYVnhLxbvbLX8CNDBY/7OWFlB9evru46SpGWhe4lhv5 +DSgE2RdCKvDytzxRDvP49L8V0TnFjAVeC1C1Pj0/KQsoL/AP4APplROiD4QaUhshQl28pXxJtfbl +AgMBAAGjVzBVMEUGA1UdEQQ+MDyBD3ZpdmVrQGtoZXJhLm9yZ4ERa2hlcmFAa2NpbGluay5jb22B +FnZpdmVrQG1haWxlcm1haWxlci5jb20wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQAr +CWop3h28qPwofzLrkoT410J4d7Bqk6FLeVlKZfg/wXlS1MTqYMNcCm4x+JsJbjwsO0fb2elFIuGq +1razoSzPpgi89itydvUT0U0U/u+AkZA5rW4AptTpMZ70YW5u9wzkcvmifqZmcfbaaeGdZfruzUXZ +6qvdXDpNb3ZHeQw6PjGCAucwggLjAgEBMGkwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0 +ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFp +bCBJc3N1aW5nIENBAgMOah8wCQYFKw4DAhoFAKCCAVMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH +ATAcBgkqhkiG9w0BCQUxDxcNMDUwNDIwMTUzNjI5WjAjBgkqhkiG9w0BCQQxFgQU3uvmAkWcjCl0 +s3olos9r2p/4XlQweAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh +d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAIXjk7kD1sv8n +LapEMbepy/Wb9E1DzvGxn05buwPlj+tvr5ufIlb+bQlQQV7i4BRsCi8ggj1r/O04/I2kdTtNBWhr +K5q9WRxn6uYqeB5TA4Y2AB39ca60/E+LzAjMlQBycufSjFcsg5iJj9D7MjxHzgGuqEAhPeoPkMwg +nD12BGAOC4XAUHuCGF7Z/QmmKP6s2aWFwF8f+BUfi2L1q/uYGr8q4BXCg334DoDmEod0eMzRFDfI +FnjG+A4kxquwagEQJbhK4SK/I7dpVwc02fCd7BHDI/R7EUdMD04UY3ueOWRk8dIUXED4qgvHW9vn +5rPfLBIzzOzTTEINvS6CtPV6IgAAAAAAAA== + +--Apple-Mail-19-412719777-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:37:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 785F953860 + for ; + Wed, 20 Apr 2005 12:37:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48486-02 + for ; + Wed, 20 Apr 2005 15:37:39 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E99753658 + for ; + Wed, 20 Apr 2005 12:37:35 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3KFbY6h024347; (envelope-from ) Wed, + 20 Apr 2005 10:37:34 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3KFbXAo021531 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 20 Apr 2005 10:37:34 -0500 (CDT) +Message-ID: <4266773E.405@arbash-meinel.com> +Date: Wed, 20 Apr 2005 10:37:34 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard van den Berg +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <42666890.1000401@arbash-meinel.com> + <42667219.7050907@trust-factory.com> +In-Reply-To: <42667219.7050907@trust-factory.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig4BF4BA191A2E5D803529C098" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/504 +X-Sequence-Number: 11901 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig4BF4BA191A2E5D803529C098 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Richard van den Berg wrote: + +>John A Meinel wrote: +> +> +>>I believe the problem is that postgres doesn't recognize how restrictive +>>a date-range is unless it uses constants. +>> +>> +> +>And it does when using BETWEEN with int for example? Impressive. :-) +> +> +> +>>select blah from du WHERE time between '2004-10-10' and '2004-10-15'; +>>Will properly use the index, because it realizes it only returns a few +>>rows. +>> +>> +> +>Correct, it does. +> +> +> +>>Probably you should try to find out the status of multi-table +>>selectivity. It was discussed in the last couple of months. +>> +>> +> +>I can't find the posts you are refering to. What is the priciple of +>multi-table selectivity? +> +>Your explanation sounds very plausible.. I don't mind changing the +>cpu_tuple_cost before running BETWEEN with timestamps, they are easy +>enough to spot. +> +>Thanks, +> +> +> +Well, there was a thread titled "date - range" +There is also "recognizing range constraints" which started with "plan +for relatively simple query seems to be very inefficient". + +Sorry that I gave you poor search terms. + +Anyway, "date - range" gives an interesting workaround. Basically you +store date ranges with a different structure, which allows fast index +lookups. + +The other threads are just discussing the possibility of improving the +planner so that it recognizes WHERE a > b AND a < c, is generally more +restrictive. + +There was a discussion about how to estimate selectivity, but I think it +mostly boils down that except for pathological cases, a > b AND a < c is +always more restrictive than just a > b, or a < c. + +Some of it may be also be found in pgsql-hackers, rather than +pgsql-performance, but I'm not subscribed to -hackers, so most of it +should be in -performance. + +John +=:-> + +caveat, I'm not a developer, I just read a lot of the list. + +--------------enig4BF4BA191A2E5D803529C098 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCZnc+JdeBCYSNAAMRAnSDAKDFK/HalLyx+EL7p+rtNXgamXNzHQCgnoOk +2GDq+APGlAJVsy0Gs1J6Y0I= +=4kZT +-----END PGP SIGNATURE----- + +--------------enig4BF4BA191A2E5D803529C098-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:38:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0D42253813 + for ; + Wed, 20 Apr 2005 12:38:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48477-03 + for ; + Wed, 20 Apr 2005 15:38:08 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 65ECA53646 + for ; + Wed, 20 Apr 2005 12:38:07 -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 22D0BB80D + for ; + Wed, 20 Apr 2005 11:38:07 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: +References: <200504191610.j3JGAM820841@candle.pha.pa.us> + <20050420001523.GU58835@decibel.org> + + <200504192007.33512.josh@agliodbs.com> + +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-20-412817093; + protocol="application/pkcs7-signature" +Message-Id: <71ac0e6e17e61544522edec3fdecb087@khera.org> +From: Vivek Khera +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +Date: Wed, 20 Apr 2005 11:38:06 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/505 +X-Sequence-Number: 11902 + + +--Apple-Mail-20-412817093 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + +On Apr 20, 2005, at 12:40 AM, Jeff Frost wrote: + +> I've seen quite a few folks touting the Opteron as 2.5x faster with +> postgres than a Xeon box. What makes the Opteron so quick? Is it +> that Postgres really prefers to run in 64-bit mode? +> + +The I/O path on the opterons seems to be much faster, and having 64-bit +all the way to the disk controller helps... just be sure to run a +64-bit version of your OS. + + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + +--Apple-Mail-20-412817093 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +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/11fZU8wggNAMIICqaADAgECAgMOah8wDQYJKoZI +hvcNAQEEBQAwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkp +IEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1 +MDQwNTIwMzEzMloXDTA2MDQwNTIwMzEzMlowgYoxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBN +ZW1iZXIxHjAcBgkqhkiG9w0BCQEWD3ZpdmVrQGtoZXJhLm9yZzEgMB4GCSqGSIb3DQEJARYRa2hl +cmFAa2NpbGluay5jb20xJTAjBgkqhkiG9w0BCQEWFnZpdmVrQG1haWxlcm1haWxlci5jb20wggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdo7hywGcY0VvK6WqqXXV77MS/t/4X3WkCaCXo +RSl2W58GP4P21hodPn7hlIxUoDOW7x9O+FbqTgE2Ejqr6yA00Mm90tGPFgjFjqPGAqg7xk6IDcv9 +uTyMia/FKEHSIynM6zqokXY8JklvdbJOiByE/8VeyEXOANWiflo8o4+GHnhMKpA9982YTXUqeKU6 +mMQVaLCBRjTDc7j2XkMC/UNcp2HMyDQdTqYVnhLxbvbLX8CNDBY/7OWFlB9evru46SpGWhe4lhv5 +DSgE2RdCKvDytzxRDvP49L8V0TnFjAVeC1C1Pj0/KQsoL/AP4APplROiD4QaUhshQl28pXxJtfbl +AgMBAAGjVzBVMEUGA1UdEQQ+MDyBD3ZpdmVrQGtoZXJhLm9yZ4ERa2hlcmFAa2NpbGluay5jb22B +FnZpdmVrQG1haWxlcm1haWxlci5jb20wDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQAr +CWop3h28qPwofzLrkoT410J4d7Bqk6FLeVlKZfg/wXlS1MTqYMNcCm4x+JsJbjwsO0fb2elFIuGq +1razoSzPpgi89itydvUT0U0U/u+AkZA5rW4AptTpMZ70YW5u9wzkcvmifqZmcfbaaeGdZfruzUXZ +6qvdXDpNb3ZHeQw6PjGCAucwggLjAgEBMGkwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0 +ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFp +bCBJc3N1aW5nIENBAgMOah8wCQYFKw4DAhoFAKCCAVMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH +ATAcBgkqhkiG9w0BCQUxDxcNMDUwNDIwMTUzODA3WjAjBgkqhkiG9w0BCQQxFgQUE2IybSUA0fiA +wbNADTGjUmW0EmwweAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh +d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAEA6zz7Y2ojDE +yuskGqqX18ojmGi6qGgpSxggxb339W8qqx560CDPF34udZsv+JltgDWZBJOZMPf0KWBca3G0Xhb8 +dvv1nGUdPQ53VrAtMHWAgmPx3aIW04NI5h/rS/WOjpFTPNkYLBgVcHwJVLHcSMhaSgDrZx48cabo +tUtcnAtzDcFE65/TK2g7yZGjtZdJmHYI0WR8/dxYCXQXqLb1CJ3m6bOuOASe8ju6B0zRJdOCZUwW +HH4GVszcxPijI32w0VrUarwe2cU+ThxBgqVesimnN4UGWY1d6oexlvvAcy6qqlhD4pYcD3RJRRip +5dkWqS/p6Cw+DfM0ZQEFiLgnPAAAAAAAAA== + +--Apple-Mail-20-412817093-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:47:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1892E533A9 + for ; + Wed, 20 Apr 2005 12:47:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51919-04 + for ; + Wed, 20 Apr 2005 15:47:19 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id 371A25350F + for ; + Wed, 20 Apr 2005 12:47:17 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +Date: Wed, 20 Apr 2005 11:46:46 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Opteron vs Xeon (Was: What to do with 6 disks?) +Thread-Index: AcVFuySJpxdnui/TQ+qt9ZH0frn/MgAApJvw +From: "Anjan Dave" +To: "William Yu" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.137 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/506 +X-Sequence-Number: 11903 + +In terms of vendor specific models - + +Does anyone have any good/bad experiences/recommendations for a 4-way +Opteron from Sun (v40z, 6 internal drives) or HP (DL585 5 internal +drives) models? + +This is in comparison with the new Dell 6850 (it has PCIexpress, faster +FSB 667MHz, which doesn't match up with AMD's total IO bandwidth, but +much better than previous 6650s). + +Thanks, +Anjan + + +-----Original Message----- +From: William Yu [mailto:wyu@talisys.com]=20 +Sent: Wednesday, April 20, 2005 11:10 AM +To: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Opteron vs Xeon (Was: What to do with 6 disks?) + +I posted this link a few months ago and there was some surprise over the + +difference in postgresql compared to other DBs. (Not much surprise in=20 +Opteron stomping on Xeon in pgsql as most people here have had that=20 +experience -- the surprise was in how much smaller the difference was in + +other DBs.) If it was across the board +100% in MS-SQL, MySQL, etc --=20 +you can chalk in up to overall better CPU architecture. Most of the time + +though, the numbers I've seen show +0-30% for [insert DB here] and a=20 +huge whopping +++++ for pgsql. Why the pronounced preference for=20 +postgresql, I'm not sure if it was explained fully. + +BTW, the Anandtech test compares single CPU systems w/ 1GB of RAM. Go to + +dual/quad and SMP Xeon will suffer even more since it has to share a=20 +fixed amount of FSB/memory bandwidth amongst all CPUs. Xeons also seem=20 +to suffer more from context-switch storms. Go > 4GB of RAM and the Xeon=20 +suffers another hit due to the lack of a 64-bit IOMMU. Devices cannot=20 +map to addresses > 4GB which means the OS has to do extra work in=20 +copying data from/to > 4GB anytime you have IO. (Although this penalty=20 +might exist all the time in 64-bit mode for Xeon if Linux/Windows took=20 +the expedient and less-buggy route of using a single method versus=20 +checking whether target addresses are > or < 4GB.) + + + +Jeff Frost wrote: +> On Tue, 19 Apr 2005, J. Andrew Rogers wrote: +>=20 +>> I don't know about 2.5x faster (perhaps on specific types of loads),=20 +>> but the reason Opterons rock for database applications is their=20 +>> insanely good memory bandwidth and latency that scales much better=20 +>> than the Xeon. Opterons also have a ccNUMA-esque I/O fabric and two=20 +>> dedicated on-die memory channels *per processor* -- no shared bus=20 +>> there, closer to real UNIX server iron than a glorified PC. +>=20 +>=20 +> Thanks J! That's exactly what I was suspecting it might be. +Actually,=20 +> I found an anandtech benchmark that shows the Opteron coming in at +close=20 +> to 2.0x performance: +>=20 +> http://www.anandtech.com/linux/showdoc.aspx?i=3D2163&p=3D2 +>=20 +> It's an Opteron 150 (2.4ghz) vs. Xeon 3.6ghz from August. I wonder if + +> the differences are more pronounced with the newer Opterons. +>=20 +> -Jeff +>=20 +> ---------------------------(end of +broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if +your +> joining column's datatypes do not match +>=20 + +---------------------------(end of broadcast)--------------------------- +TIP 6: Have you searched our list archives? + + http://archives.postgresql.org + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:50:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C4DC53547 + for ; + Wed, 20 Apr 2005 12:50:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53329-09 + for ; + Wed, 20 Apr 2005 15:50:42 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 6DA0D5350F + for ; + Wed, 20 Apr 2005 12:50:40 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3KFoQr21758; + Wed, 20 Apr 2005 11:50:26 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504201550.j3KFoQr21758@candle.pha.pa.us> +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +In-Reply-To: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> +To: Anjan Dave +Date: Wed, 20 Apr 2005 11:50:26 -0400 (EDT) +Cc: William Yu , pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/507 +X-Sequence-Number: 11904 + +Anjan Dave wrote: +> In terms of vendor specific models - +> +> Does anyone have any good/bad experiences/recommendations for a 4-way +> Opteron from Sun (v40z, 6 internal drives) or HP (DL585 5 internal +> drives) models? +> +> This is in comparison with the new Dell 6850 (it has PCIexpress, faster +> FSB 667MHz, which doesn't match up with AMD's total IO bandwidth, but +> much better than previous 6650s). + +Dell cuts too many corners to be a good server. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Wed Apr 20 12:55:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2EA4E5350F + for ; + Wed, 20 Apr 2005 12:55:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53989-10 + for ; + Wed, 20 Apr 2005 15:54:52 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 603AD53530 + for ; + Wed, 20 Apr 2005 12:54:49 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 6264283D5E; Wed, 20 Apr 2005 17:54:48 +0200 (CEST) +Message-ID: <42667B45.5050101@trust-factory.com> +Date: Wed, 20 Apr 2005 17:54:45 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <26710.1114007961@sss.pgh.pa.us> +In-Reply-To: <26710.1114007961@sss.pgh.pa.us> +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/508 +X-Sequence-Number: 11905 + +Tom Lane wrote: +> The explain shows no such thing. What is the *actual* runtime of +> each plan per EXPLAIN ANALYZE, please? + +I took a simplified version of the problem (the actual query that took 6 +hours joins 3 tables). With cpu_tuple_cost = 0.1: + + Nested Loop (cost=0.00..667700310.42 rows=1035480320 width=97) (actual +time=31.468..42629.629 rows=6171334 loops=1) + -> Seq Scan on sessions us (cost=0.00..125756.60 rows=924536 +width=105) (actual time=31.366..3293.523 rows=924536 loops=1) + -> Index Scan using ix_du_ts on duration du (cost=0.00..604.46 +rows=1120 width=8) (actual time=0.004..0.011 rows=7 loops=924536) + Index Cond: (("outer".starttimetrunc <= du.ts) AND +("outer".finishtimetrunc >= du.ts)) + Total runtime: 44337.937 ms + +The explain analyze for cpu_tuple_cost = 0.01 is running now. If it +takes hours, I'll send it to the list tomorrow. + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 13:14:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 96D7953599 + for ; + Wed, 20 Apr 2005 13:14:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62179-08 + for ; + Wed, 20 Apr 2005 16:14:26 +0000 (GMT) +Received: from cellus.no (ns.cellus.no [193.91.191.71]) + by svr1.postgresql.org (Postfix) with ESMTP id C74B25354A + for ; + Wed, 20 Apr 2005 13:14:22 -0300 (ADT) +Received: from cd9089052.sdsl.catch.no (cD9089052.sdsl.catch.no + [217.8.144.82]) + by cellus.no (8.9.3/8.9.3) with ESMTP id SAA30608; + Wed, 20 Apr 2005 18:14:13 +0200 +From: Christian Sander =?iso-8859-1?q?R=F8snes?= +To: Bruce Momjian +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +Date: Wed, 20 Apr 2005 18:14:12 +0200 +User-Agent: KMail/1.6.2 +Cc: pgsql-performance@postgresql.org +References: <200504201550.j3KFoQr21758@candle.pha.pa.us> +In-Reply-To: <200504201550.j3KFoQr21758@candle.pha.pa.us> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504201814.12633.christian@aspiro.no> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/509 +X-Sequence-Number: 11906 + +On Wednesday 20 April 2005 17:50, Bruce Momjian wrote: +> Anjan Dave wrote: +> > In terms of vendor specific models - +> > +> > Does anyone have any good/bad experiences/recommendations for a 4-way +> > Opteron from Sun (v40z, 6 internal drives) or HP (DL585 5 internal +> > drives) models? +> > +> > This is in comparison with the new Dell 6850 (it has PCIexpress, faster +> > FSB 667MHz, which doesn't match up with AMD's total IO bandwidth, but +> > much better than previous 6650s). +> +> Dell cuts too many corners to be a good server. + +Hi + +Which corners do Dell cut compared to the competition ? + +Thanks + +Christian + +From pgsql-performance-owner@postgresql.org Wed Apr 20 13:18:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8016B53A9D + for ; + Wed, 20 Apr 2005 13:18:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63293-09 + for ; + Wed, 20 Apr 2005 16:18:44 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id DA7C9535CC + for ; + Wed, 20 Apr 2005 13:18:41 -0300 (ADT) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j3KGaRBu009692 + for ; Wed, 20 Apr 2005 16:36:28 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j3KGaQdA009688; + Wed, 20 Apr 2005 16:36:26 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Wed, 20 Apr 2005 16:17:50 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVFPaOaW4jBxy2cQd+odFDHm7Wa1gAhrhnA +From: "Mohan, Ross" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.142 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/510 +X-Sequence-Number: 11907 + +kewl.=20 + +Well, 8k request out of PG kernel might turn into an "X"Kb request at +disk/OS level, but duly noted.=20 + +Did you scan the code for this, or are you pulling this recollection = +from +the cognitive archives? :-) + + + +-----Original Message----- +From: Jim C. Nasby [mailto:decibel@decibel.org]=20 +Sent: Tuesday, April 19, 2005 8:12 PM +To: Mohan, Ross +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +On Mon, Apr 18, 2005 at 06:41:37PM -0000, Mohan, Ross wrote: +> Don't you think "optimal stripe width" would be +> a good question to research the binaries for? I'd +> think that drives the answer, largely. (uh oh, pun alert) +>=20 +> EG, oracle issues IO requests (this may have changed _just_ +> recently) in 64KB chunks, regardless of what you ask for.=20 +> So when I did my striping (many moons ago, when the Earth=20 +> was young...) I did it in 128KB widths, and set the oracle=20 +> "multiblock read count" according. For oracle, any stripe size +> under 64KB=3Dstupid, anything much over 128K/258K=3Dwasteful.=20 +>=20 +> I am eager to find out how PG handles all this. + +AFAIK PostgreSQL requests data one database page at a time (normally = +8k). Of course the OS might do something different. +--=20 +Jim C. Nasby, Database Consultant decibel@decibel.org=20 +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 20 13:33:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 19EB053727 + for ; + Wed, 20 Apr 2005 13:33:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67436-09 + for ; + Wed, 20 Apr 2005 16:33:11 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B5DE5369C + for ; + Wed, 20 Apr 2005 13:33:09 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +Date: Wed, 20 Apr 2005 12:33:08 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098971@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Opteron vs Xeon (Was: What to do with 6 disks?) +Thread-Index: AcVFxB4KdEcC+8wUSgilyXbESyfXqwAAN5Ow +From: "Anjan Dave" +To: =?iso-8859-1?Q?Christian_Sander_R=F8snes?= , + "Bruce Momjian" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.119 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/511 +X-Sequence-Number: 11908 + +There have been some discussions on this list and others in general = +about Dell's version of RAID cards, and server support, mainly linux = +support. + +Before I venture into having another vendor in the shop I want to know = +if there are any dos/don't's about 4-way Opteron offerings from Sun and = +HP. + +Don't want to put the topic on a different tangent, but I would be = +interested in the discussion of AMD Vs. XEON in terms of actual products = +available today. + +Thanks, +Anjan + +-----Original Message----- +From: Christian Sander R=F8snes [mailto:christian@aspiro.no]=20 +Sent: Wednesday, April 20, 2005 12:14 PM +To: Bruce Momjian +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Opteron vs Xeon (Was: What to do with 6 disks?) + +On Wednesday 20 April 2005 17:50, Bruce Momjian wrote: +> Anjan Dave wrote: +> > In terms of vendor specific models - +> > +> > Does anyone have any good/bad experiences/recommendations for a = +4-way +> > Opteron from Sun (v40z, 6 internal drives) or HP (DL585 5 internal +> > drives) models? +> > +> > This is in comparison with the new Dell 6850 (it has PCIexpress, = +faster +> > FSB 667MHz, which doesn't match up with AMD's total IO bandwidth, = +but +> > much better than previous 6650s). +> +> Dell cuts too many corners to be a good server. + +Hi + +Which corners do Dell cut compared to the competition ? + +Thanks + +Christian + +---------------------------(end of broadcast)--------------------------- +TIP 2: you can get off all lists at once with the unregister command + (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 13:34:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B46A535CC + for ; + Wed, 20 Apr 2005 13:34:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69743-05 + for ; + Wed, 20 Apr 2005 16:34:28 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 1FABE53727 + for ; + Wed, 20 Apr 2005 13:34:27 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7258163; Wed, 20 Apr 2005 09:36:23 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Anjan Dave" +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +Date: Wed, 20 Apr 2005 09:39:33 -0700 +User-Agent: KMail/1.7.1 +Cc: "William Yu" , pgsql-performance@postgresql.org +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> +In-Reply-To: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504200939.33763.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/512 +X-Sequence-Number: 11909 + +Anjan, + +> Does anyone have any good/bad experiences/recommendations for a 4-way +> Opteron from Sun (v40z, 6 internal drives) or HP (DL585 5 internal +> drives) models? + +Last I checked, the v40z only takes 5 drives, unless you yank the cd-rom and +get an extra disk tray. That's the main defect of the model, the second +being its truly phenominal noise level. Other than that (and price) and +excellent Opteron machine. + +The HPs are at root pretty good machines -- and take 6 drives, so I expect +you're mixed up there. However, they use HP's proprietary RAID controller +which is seriously defective. So you need to factor replacing the RAID +controller into the cost. + +> This is in comparison with the new Dell 6850 (it has PCIexpress, faster +> FSB 667MHz, which doesn't match up with AMD's total IO bandwidth, but +> much better than previous 6650s). + +Yes, but you can still expect the 6650 to have 1/2 the performance ... or +less ... of the above-name models. It: +1) is Xeon 32-bit +2) uses a cheap northbridge which makes the Xeon's cache contention even worse +3) depending on the model and options, may ship with a cheap Adaptec raid card +instead of an LSI or other good card + +If all you *need* is 1/2 the performance of an Opteron box, and you can get a +good deal, then go for it. But don't be under the illusion that Dell is +competitive with Sun, IBM, HP, Penguin or Microway on servers. + + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 20 13:44:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E128535EF + for ; + Wed, 20 Apr 2005 13:44:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71569-09 + for ; + Wed, 20 Apr 2005 16:44:21 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 91F99535AB + for ; + Wed, 20 Apr 2005 13:44:19 -0300 (ADT) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j3KH26Bu010652 + for ; Wed, 20 Apr 2005 17:02:06 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j3KH25dC010643; + Wed, 20 Apr 2005 17:02:05 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Wed, 20 Apr 2005 16:44:01 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVFhyRn2Hdt2sPPSfejL/YPmzLX0gAQL4Hw +From: "Mohan, Ross" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.138 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/513 +X-Sequence-Number: 11910 + +right, the oracle system uses a second "low latency" bus to=20 +manage locking information (at the block level) via a +distributed lock manager. (but this is slightly different +albeit related to a clustered file system and OS-managed +locking, eg)=20 + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Dawid = +Kuroczko +Sent: Wednesday, April 20, 2005 4:56 AM +To: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to improve db performance with $7K? + + +On 4/19/05, Mohan, Ross wrote: +> Clustered file systems is the first/best example that +> comes to mind. Host A and Host B can both request from diskfarm, eg. + +Something like a Global File System? + +http://www.redhat.com/software/rha/gfs/ + +(I believe some other company did develop it some time in the past; hmm, = +probably the guys doing LVM stuff?). + +Anyway the idea is that two machines have same filesystem mounted and = +they share it. The locking I believe is handled by communication between = +computers using "host to host" SCSI commands. + +I never used it, I've only heard about it from a friend who used to work = +with it in CERN. + + Regards, + Dawid + +---------------------------(end of broadcast)--------------------------- +TIP 8: explain analyze is your friend + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:52:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 38FFA52D42 + for ; + Wed, 20 Apr 2005 15:50:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08114-08 + for ; + Wed, 20 Apr 2005 18:50:04 +0000 (GMT) +Received: from wproxy.gmail.com (unknown [64.233.184.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 9707F53DB4 + for ; + Wed, 20 Apr 2005 14:12:09 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so219401wri + for ; + Wed, 20 Apr 2005 10:10:49 -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=BFCFuDNA6oMzHluyVf+1KhewIHQ4X3Dda33B71wt+0ZeTa1Lx3gl+wrG4ML9HejF81XCwqCM7BYC6qYyJTRwvf5g+bi1EnFNpz84JcQSDsVCOEt0X94tjx7kOr8okBXhB67g5qMYduFxYuVBKJ2ZmeX034W/O74vnY51eyEGx5I= +Received: by 10.54.16.28 with SMTP id 28mr115062wrp; + Wed, 20 Apr 2005 10:04:06 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 20 Apr 2005 10:04:04 -0700 (PDT) +Message-ID: <33c6269f050420100455955060@mail.gmail.com> +Date: Wed, 20 Apr 2005 13:04:04 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Dave Held +Subject: Re: How to improve db performance with $7K? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184BB@asg002.asg.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184BB@asg002.asg.local> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.277 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/522 +X-Sequence-Number: 11919 + +Whilst I admire your purist approach, I would say that if it is +beneficial to performance that a kernel understand drive geometry, +then it is worth investigating teaching it how to deal with that! + +I was less referrring to the kernel as I was to the controller. + +Lets say we invented a new protocol that including the drive telling +the controller how it was layed out at initialization time so that the +controller could make better decisions about re-ordering seeks. It +would be more cost effective to have that set of electronics just once +in the controller, than 8 times on each drive in an array, which would +yield better performance to cost ratio. Therefore I would suggest it +is something that should be investigated. After all, why implemented +TCQ on each drive, if it can be handled more effeciently at the other +end by the controller for less money?! + +Alex Turner +netEconomist + +On 4/19/05, Dave Held wrote: +> > -----Original Message----- +> > From: Alex Turner [mailto:armtuk@gmail.com] +> > Sent: Monday, April 18, 2005 5:50 PM +> > To: Bruce Momjian +> > Cc: Kevin Brown; pgsql-performance@postgresql.org +> > Subject: Re: [PERFORM] How to improve db performance with $7K? +> > +> > Does it really matter at which end of the cable the queueing is done +> > (Assuming both ends know as much about drive geometry etc..)? +> > [...] +>=20 +> The parenthetical is an assumption I'd rather not make. If my +> performance depends on my kernel knowing how my drive is laid +> out, I would always be wondering if a new drive is going to +> break any of the kernel's geometry assumptions. Drive geometry +> doesn't seem like a kernel's business any more than a kernel +> should be able to decode the ccd signal of an optical mouse. +> The kernel should queue requests at a level of abstraction that +> doesn't depend on intimate knowledge of drive geometry, and the +> drive should queue requests on the concrete level where geometry +> matters. A drive shouldn't guess whether a process is trying to +> read a file sequentially, and a kernel shouldn't guess whether +> sector 30 is contiguous with sector 31 or not. +>=20 +> __ +> David B. Held +> Software Engineer/Array Services Group +> 200 14th Ave. East, Sartell, MN 56377 +> 320.534.3637 320.253.7800 800.752.8129 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings +> + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:54:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C8D453690 + for ; + Wed, 20 Apr 2005 15:49:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06055-09 + for ; + Wed, 20 Apr 2005 18:49:18 +0000 (GMT) +Received: from stark.xeocode.com (unknown [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 325EB53D70 + for ; + Wed, 20 Apr 2005 14:11:46 -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 1DOIiD-0003WS-00; Wed, 20 Apr 2005 13:10:05 -0400 +To: josh@agliodbs.com +Cc: "Anjan Dave" , "William Yu" , + pgsql-performance@postgresql.org +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> + <200504200939.33763.josh@agliodbs.com> +In-Reply-To: <200504200939.33763.josh@agliodbs.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 20 Apr 2005 13:10:05 -0400 +Message-ID: <874qe1e5n6.fsf@stark.xeocode.com> +Lines: 13 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/523 +X-Sequence-Number: 11920 + +Josh Berkus writes: + +> Last I checked, the v40z only takes 5 drives, unless you yank the cd-rom and +> get an extra disk tray. That's the main defect of the model, the second +> being its truly phenominal noise level. Other than that (and price) and +> excellent Opteron machine. + +Incidentally, Sun sells a bunch of v20z and v40z machines on Ebay as some kind +of marketing strategy. You can pick one up for only a slightly absurd price if +you're happy with the configurations listed there. (And if you're in the US). + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:51:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 347345372C + for ; + Wed, 20 Apr 2005 15:50:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08752-04 + for ; + Wed, 20 Apr 2005 18:50:20 +0000 (GMT) +Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) + by svr1.postgresql.org (Postfix) with ESMTP id B499B53DB5 + for ; + Wed, 20 Apr 2005 14:13:41 -0300 (ADT) +Received: from terminus.dnttm.ro (terminus.dnttm.ro [193.226.98.11]) + by svr2.postgresql.org (Postfix) with ESMTP id 4A8A7F11A1 + for ; + Wed, 20 Apr 2005 18:03:11 +0100 (BST) +Received: from nutzi (dnt-gw-softnrg.dnttm.ro [193.226.89.168]) + by terminus.dnttm.ro (8.13.3/8.12.9) with SMTP id j3KH4xUd005370; + Wed, 20 Apr 2005 20:05:00 +0300 +Received: by nutzi (VPOP3 - Unregistered) with SMTP; + Wed, 20 Apr 2005 20:10:41 +0300 +Received: from 127.0.0.1 (AVG SMTP 7.0.308 [266.9.18]); + Wed, 20 Apr 2005 20:10:42 +0300 +Message-ID: <42668D12.1060701@softnrg.dnttm.ro> +Date: Wed, 20 Apr 2005 20:10:42 +0300 +From: Andrei Gaspar +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +To: Michael Fuhr +Cc: pgsql-performance@postgresql.org +Subject: Re: Sort and index +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050418171013.GA34421@winnie.fuhr.org> +In-Reply-To: <20050418171013.GA34421@winnie.fuhr.org> +X-Enigmail-Version: 0.90.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Mime-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +X-Server: VPOP3 V1.2.0d Evaluation +X-Virus-Scanned: ClamAV 0.80/842/Wed Apr 20 00:39:01 2005 + clamav-milter version 0.80j on localhost +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/521 +X-Sequence-Number: 11918 + +Michael Fuhr wrote: + +>On Mon, Apr 18, 2005 at 10:44:43AM -0500, Dave Held wrote: +> +> +>>>I thought that an index can be used for sorting. +>>>I'm a little confused about the following result: +>>> +>>>create index OperationsName on Operations(cOperationName); +>>>explain SELECT * FROM Operations ORDER BY cOperationName; +>>> QUERY PLAN +>>>-------------------------------------------------------------- +>>>--------- +>>> Sort (cost=185.37..189.20 rows=1532 width=498) +>>> Sort Key: coperationname +>>> -> Seq Scan on operations (cost=0.00..104.32 rows=1532 width=498) +>>>(3 rows) +>>> +>>>Is this supposed to be so? +>>> +>>> +>>Since you are fetching the entire table, you are touching all the rows. +>>If the query were to fetch the rows in index order, it would be seeking +>>all over the table's tracks. By fetching in sequence order, it has a +>>much better chance of fetching rows in a way that minimizes head seeks. +>>Since disk I/O is generally 10-100x slower than RAM, the in-memory sort +>>can be surprisingly slow and still beat indexed disk access. Of course, +>>this is only true if the table can fit and be sorted entirely in memory +>>(which, with 1500 rows, probably can). +>> +>> +> +>Out of curiosity, what are the results of the following queries? +>(Queries run twice to make sure time differences aren't due to +>caching.) +> +>SET enable_seqscan TO on; +>SET enable_indexscan TO off; +>EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; +>EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; +> +>SET enable_seqscan TO off; +>SET enable_indexscan TO on; +>EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; +>EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; +> +>SELECT version(); +> +>With 1500 rows of random data, I consistently see better performance +>with an index scan (about twice as fast as a sequence scan), and +>the planner uses an index scan if it has a choice (i.e., when +>enable_seqscan and enable_indexscan are both on). But my test case +>and postgresql.conf settings might be different enough from yours +>to account for different behavior. +> +> +> +Here is the output from the statements above. I know the times seem too +small to care, but what triggered my question is the fact that in the +logs there are a lot of lines like (i replaced the list of 43 fields +with *). +I use ODBC (8.0.1.1) and to change the application to cache the table +isn't feasible. + +2005-04-19 10:07:05 LOG: duration: 937.000 ms statement: PREPARE +"_PLAN35b0068" as SELECT * FROM Operations ORDER BY +cOperationName;EXECUTE "_PLAN35b0068" +2005-04-19 10:07:09 LOG: duration: 1344.000 ms statement: PREPARE +"_PLAN35b0068" as SELECT * FROM Operations ORDER BY +cOperationName;EXECUTE "_PLAN35b0068" +2005-04-19 10:07:15 LOG: duration: 1031.000 ms statement: PREPARE +"_PLAN35b0068" as SELECT * FROM Operations ORDER BY +cOperationName;EXECUTE "_PLAN35b0068" +2005-04-19 10:07:19 LOG: duration: 734.000 ms statement: PREPARE +"_PLAN35b0068" as SELECT * FROM Operations ORDER BY +cOperationName;EXECUTE "_PLAN35b0068" + +The times reported by explain analyze are so small though, the intervals +reported in pg_log are more real, + + +tkp=# SET enable_seqscan TO on; +SET +tkp=# SET enable_indexscan TO off; +SET +tkp=# EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- + Sort (cost=185.37..189.20 rows=1532 width=498) (actual +time=235.000..235.000 rows=1532 loops=1) + Sort Key: coperationname + -> Seq Scan on operations (cost=0.00..104.32 rows=1532 width=498) +(actual time=0.000..124.000 rows=1532 loops=1) + Total runtime: 267.000 ms +(4 rows) + +tkp=# EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Sort (cost=185.37..189.20 rows=1532 width=498) (actual +time=16.000..16.000 rows=1532 loops=1) + Sort Key: coperationname + -> Seq Scan on operations (cost=0.00..104.32 rows=1532 width=498) +(actual time=0.000..0.000 rows=1532 loops=1) + Total runtime: 31.000 ms +(4 rows) + +tkp=# +tkp=# SET enable_seqscan TO off; +SET +tkp=# SET enable_indexscan TO on; +SET +tkp=# EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; + QUERY PLAN + +--------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using operationsname on operations (cost=0.00..350.01 +rows=1532 width=498) (actual time=16.000..62.000 rows=1532 loops=1) + Total runtime: 62.000 ms +(2 rows) + +tkp=# EXPLAIN ANALYZE SELECT * FROM Operations ORDER BY cOperationName; + QUERY PLAN + +-------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using operationsname on operations (cost=0.00..350.01 +rows=1532 width=498) (actual time=0.000..16.000 rows=1532 loops=1) + Total runtime: 16.000 ms +(2 rows) + +tkp=# +tkp=# SELECT version(); + version +------------------------------------------------------------------------------------------ + PostgreSQL 8.0.2 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) +3.4.2 (mingw-special) +(1 row) + + + +-- +No virus found in this outgoing message. +Checked by AVG Anti-Virus. +Version: 7.0.308 / Virus Database: 266.9.18 - Release Date: 4/19/2005 + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 16:17:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 212515372D + for ; + Wed, 20 Apr 2005 15:49:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08443-03 + for ; + Wed, 20 Apr 2005 18:49:30 +0000 (GMT) +Received: from marnewexchange.mardomain.local (67-67-181-51.ded.swbell.net + [67.67.181.51]) + by svr1.postgresql.org (Postfix) with ESMTP id 5285453EB3 + for ; + Wed, 20 Apr 2005 14:16:38 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C545CC.9D6B679A" +Subject: postgres slowdown question +Date: Wed, 20 Apr 2005 12:16:05 -0500 +Message-ID: + <5A5058425C97FA409CE98C9B87B0CF3805FDE3@marnewexchange.mardomain.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: postgres slowdown question +Thread-Index: AcVFzKK+hZ0yeqWqR2a0FH95geii8A== +From: "Shachindra Agarwal" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.078 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, HTML_60_70, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200504/525 +X-Sequence-Number: 11922 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C545CC.9D6B679A +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +Dear Postgres Masters: + +=20 + +We are using postgres 7.4 in our java application on RedHat linux. The +Java application connects to Postgres via JDBC. The application goes +through a 'discovery' phase, whereas it adds large amount of data into +postgres. Typically, we are adding about a million records in various +tables. The application also issues multiple queries to the database at +the same time. We do not delete any records during the discovery phase. +Both the java application and the postgres are installed on the same +machine.=20 + +=20 + +At the beginning, the application is able to add in the order of 100 +record per minute. Gradually (after several hours), it slows down to +less than 10 records per minute. At this time, postgres processes take +between 80-99% of CPU. When we reindex the database, the speed bumps up +to about 30 records per minute. Now, postgres server takes between +50-70% CPU. + +=20 + +We have the following in the postgresql.conf : + +=20 + +max_fsm_pages =3D 500000 + +fsync =3D false + +=20 + +We certainly can not live with this kind of performance. I believe +postgres should be able to handle much larger datasets but I can not +point my finger as to what are we doing wrong. Can somebody please point +me to the right direction. + +=20 + +With kind regards, + +=20 + +-- Shachindra Agarwal.=20 + + +------_=_NextPart_001_01C545CC.9D6B679A +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + +
+ +

Dear Postgres Masters:

+ +

 

+ +

We are using postgres 7.4 in our java application on = +RedHat +linux. The Java application connects to Postgres via JDBC. The = +application goes +through a ‘discovery’ phase, whereas it adds large amount of = +data +into postgres. Typically, we are adding about a million records in = +various +tables. The application also issues multiple queries to the database at = +the +same time.  We do not delete any records during the discovery = +phase. Both +the java application and the postgres are installed on the same machine. = +

+ +

 

+ +

At the beginning, the application is able to add in = +the +order of 100 record per minute. Gradually (after several hours), it = +slows down +to less than 10 records per minute. At this time, postgres processes = +take +between 80-99% of CPU. When we reindex the database, the speed bumps up = +to +about 30 records per minute. Now, postgres server takes between 50-70% = +CPU.

+ +

 

+ +

We have the following in the postgresql.conf = +:

+ +

 

+ +

max_fsm_pages =3D 500000

+ +

fsync =3D false

+ +

 

+ +

We certainly can not live with this kind of = +performance. I +believe postgres should be able to handle much larger datasets but I can = +not +point my finger as to what are we doing wrong. Can somebody please point = +me to +the right direction.

+ +

 

+ +

With kind regards,

+ +

 

+ +

-- Shachindra Agarwal.

+ +
+ + + + + +------_=_NextPart_001_01C545CC.9D6B679A-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:49:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 347EF52AAD + for ; + Wed, 20 Apr 2005 15:49:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06252-08 + for ; + Wed, 20 Apr 2005 18:49:02 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 0117653E93 + for ; + Wed, 20 Apr 2005 14:16:28 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Wed, 20 Apr 2005 12:16:25 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184C2@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVFyzA3dqogSObgTGKqoPAseqH0RAAAJfFA +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.064 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/520 +X-Sequence-Number: 11917 + +> -----Original Message----- +> From: Alex Turner [mailto:armtuk@gmail.com] +> Sent: Wednesday, April 20, 2005 12:04 PM +> To: Dave Held +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to improve db performance with $7K? +>=20 +> [...] +> Lets say we invented a new protocol that including the drive telling +> the controller how it was layed out at initialization time so that the +> controller could make better decisions about re-ordering seeks. It +> would be more cost effective to have that set of electronics just once +> in the controller, than 8 times on each drive in an array, which would +> yield better performance to cost ratio.=20 + +Assuming that a single controller would be able to service 8 drives=20 +without delays. The fact that you want the controller to have fairly +intimate knowledge of the drives implies that this is a semi-soft=20 +solution requiring some fairly fat hardware compared to firmware that is +hard-wired for one drive. Note that your controller has to be 8x as = +fast +as the on-board drive firmware. There's definitely a balance there, and = + +it's not entirely clear to me where the break-even point is. + +> Therefore I would suggest it is something that should be investigated. = + +> After all, why implemented TCQ on each drive, if it can be handled = +more +> effeciently at the other end by the controller for less money?! + +Because it might not cost less. ;) However, I can see where you might=20 +want the controller to drive the actual hardware when you have a RAID +setup that requires synchronized seeks, etc. But in that case, it's=20 +doing one computation for multiple drives, so there really is a win. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Wed Apr 20 14:40:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B3CA54030 + for ; + Wed, 20 Apr 2005 14:40:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89572-03 + for ; + Wed, 20 Apr 2005 17:40:28 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) + by svr1.postgresql.org (Postfix) with ESMTP id A2FAF54042 + for ; + Wed, 20 Apr 2005 14:40:25 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so228584wri + for ; + Wed, 20 Apr 2005 10:40:26 -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=bf1VFeNqXnOZBsWc3Yh0zgZy6RUqnnqnZ2b86viFQkPYejdAIHJHlHDn70PiJGeNwGpPUBEp4eXjuMMJ8NuWynmtQjRMnZPQCJDvXp7L1B7dixvrEb07hjL2jXR6A92ruYTDQ3sIEFk1o/h8NKKt+FJpKM7Asn5UUnrMBrKKVmY= +Received: by 10.54.7.33 with SMTP id 33mr32219wrg; + Wed, 20 Apr 2005 10:40:25 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Wed, 20 Apr 2005 10:40:25 -0700 (PDT) +Message-ID: <33c6269f05042010407e6acbd9@mail.gmail.com> +Date: Wed, 20 Apr 2005 13:40:25 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: "Jim C. Nasby" +Subject: Re: How to improve db performance with $7K? +Cc: "Mohan, Ross" , + pgsql-performance@postgresql.org +In-Reply-To: <20050420001224.GT58835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <20050420001224.GT58835@decibel.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.277 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/514 +X-Sequence-Number: 11911 + +I wonder if thats something to think about adding to Postgresql? A +setting for multiblock read count like Oracle (Although having said +that I believe that Oracle natively caches pages much more +aggressively that postgresql, which allows the OS to do the file +caching). + +Alex Turner +netEconomist + +P.S. Oracle changed this with 9i, you can change the Database block +size on a tablespace by tablespace bassis making it smaller for OLTP +tablespaces and larger for Warehousing tablespaces (at least I think +it's on a tablespace, might be on a whole DB). + +On 4/19/05, Jim C. Nasby wrote: +> On Mon, Apr 18, 2005 at 06:41:37PM -0000, Mohan, Ross wrote: +> > Don't you think "optimal stripe width" would be +> > a good question to research the binaries for? I'd +> > think that drives the answer, largely. (uh oh, pun alert) +> > +> > EG, oracle issues IO requests (this may have changed _just_ +> > recently) in 64KB chunks, regardless of what you ask for. +> > So when I did my striping (many moons ago, when the Earth +> > was young...) I did it in 128KB widths, and set the oracle +> > "multiblock read count" according. For oracle, any stripe size +> > under 64KB=3Dstupid, anything much over 128K/258K=3Dwasteful. +> > +> > I am eager to find out how PG handles all this. +>=20 +> AFAIK PostgreSQL requests data one database page at a time (normally +> 8k). Of course the OS might do something different. +> -- +> Jim C. Nasby, Database Consultant decibel@decibel.org +> Give your computer some brain candy! www.distributed.net Team #1828 +>=20 +> Windows: "Where do you want to go today?" +> Linux: "Where do you want to go tomorrow?" +> FreeBSD: "Are you guys coming, or what?" +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster +> + +From pgsql-performance-owner@postgresql.org Wed Apr 20 14:54:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 22F6854032 + for ; + Wed, 20 Apr 2005 14:54:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94410-05 + for ; + Wed, 20 Apr 2005 17:53:56 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 4E53653FE6 + for ; + Wed, 20 Apr 2005 14:53:54 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7258539; Wed, 20 Apr 2005 10:55:51 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Tom Lane +Subject: Re: Bad n_distinct estimation; hacks suggested? +Date: Wed, 20 Apr 2005 10:59:01 -0700 +User-Agent: KMail/1.7.1 +Cc: "pgsql-perform" +References: <200504191209.05181.josh@agliodbs.com> + <25382.1113943489@sss.pgh.pa.us> + <200504191433.58960.josh@agliodbs.com> +In-Reply-To: <200504191433.58960.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504201059.02033.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/515 +X-Sequence-Number: 11912 + +Tom, + +Any thoughts? This is really messing up query execution all across the +database ... + +--Josh + +> Here is the stats = 100 version. Notice that n_distinct has gone down. +> +> schemaname | tablename | attname | null_frac | avg_width | +> n_distinct | most_common_vals +> +> | most_common_freqs +> | histogram_bounds | +> +> correlation + +>-------------------+------------- public | web_site_activity_fa | +> session_id | 0 | 8 | 96107 | +> {4393922,6049228,6026260,4394034,60341,4393810,2562999,2573850,3006299,4705 +>488,2561499,4705258,3007378,4705490,60327,60352,2560950,2567640,2569852,3006 +>604,4394329,2570739,2406633,2407292,3006356,4393603,4394121,6449083,2565815, +>4387881,2406770,2407081,2564340,3007328,2406578,2407295,2562813,2567603,4387 +>835,71014,2566253,2566900,6103079,2289424,2407597,2567627,2568333,3457448,23 +>450,23670,60743,70739,2406818,2406852,2407511,2562816,3007446,6306095,60506, +>71902,591543,1169136,1447077,2285047,2406830,2573964,6222758,61393,70955,709 +>86,71207,71530,262368,2289213,2406899,2567361,2775952,3006824,4387864,623982 +>5,6244853,6422152,1739,58600,179293,278473,488407,1896390,2286976,2407020,25 +>46720,2677019,2984333,3006133,3007497,3310286,3631413,3801909,4366116,438802 +>5} +> +> {0.00166667,0.00146667,0.0013,0.0011,0.000933333,0.0009,0.0008,0.0008,0.000 +>733333,0.000733333,0.0007,0.000633333,0.0006,0.0006,0.000566667,0.000566667, +>0.000566667,0.000566667,0.000566667,0.000566667,0.000566667,0.000533333,0.00 +>05,0.0005,0.0005,0.0005,0.0005,0.0005,0.000466667,0.000466667,0.000433333,0. +>000433333,0.000433333,0.000433333,0.0004,0.0004,0.0004,0.0004,0.0004,0.00036 +>6667,0.000366667,0.000366667,0.000366667,0.000333333,0.000333333,0.000333333 +>,0.000333333,0.000333333,0.0003,0.0003,0.0003,0.0003,0.0003,0.0003,0.0003,0. +>0003,0.0003,0.0003,0.000266667,0.000266667,0.000266667,0.000266667,0.0002666 +>67,0.000266667,0.000266667,0.000266667,0.000266667,0.000233333,0.000233333,0 +>.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000 +>233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.0002333 +>33,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0 +>002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002} +> +> {230,58907,88648,156764,216759,240405,264601,289047,312630,339947,364452,38 +>6486,409427,434075,455140,475759,500086,521530,544703,680376,981066,1313419, +>1712592,1860151,1882452,1905328,1927504,1948159,1970054,1990408,2014501,2038 +>573,2062786,2087163,2110129,2132196,2155657,2181058,2204976,2228575,2256229, +>2283897,2352453,2407153,2457716,2542081,2572119,2624133,2699592,2771254,2832 +>224,2908151,2951500,3005088,3032889,3137244,3158685,3179395,3203681,3261587, +>3304359,3325577,3566688,3621357,3645094,3718667,3740821,3762386,3783169,3804 +>593,3826503,3904589,3931012,3957675,4141934,4265118,4288568,4316898,4365625, +>4473965,4535752,4559700,4691802,4749478,5977208,6000272,6021416,6045939,6078 +>912,6111900,6145155,6176422,6206627,6238291,6271270,6303067,6334117,6365200, +>6395250,6424719,6888329} +> +> | 0.41744 + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:04:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 248235405A + for ; + Wed, 20 Apr 2005 15:03:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97887-01 + for ; + Wed, 20 Apr 2005 18:03:15 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FE1253AB8 + for ; + Wed, 20 Apr 2005 15:03:14 -0300 (ADT) +Received: from dyn-70-66.tor.dsl.tht.net (dyn-70-66.tor.dsl.tht.net + [134.22.70.66]) by tht.net (Postfix) with ESMTP + id ED8A176A51; Wed, 20 Apr 2005 14:03:13 -0400 (EDT) +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +From: Rod Taylor +To: josh@agliodbs.com +Cc: Anjan Dave , William Yu , + pgsql-performance@postgresql.org +In-Reply-To: <200504200939.33763.josh@agliodbs.com> +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> + <200504200939.33763.josh@agliodbs.com> +Content-Type: text/plain +Date: Wed, 20 Apr 2005 14:01:09 -0400 +Message-Id: <1114020069.66326.20.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.2 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/516 +X-Sequence-Number: 11913 + +> The HPs are at root pretty good machines -- and take 6 drives, so I expect +> you're mixed up there. However, they use HP's proprietary RAID controller +> which is seriously defective. So you need to factor replacing the RAID +> controller into the cost. + +Do you have any additional materials on what is defective with their +raid controllers? +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:11:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 84D84535C6 + for ; + Wed, 20 Apr 2005 15:11:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99384-05 + for ; + Wed, 20 Apr 2005 18:11:48 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.197]) + by svr1.postgresql.org (Postfix) with ESMTP id ADD915296F + for ; + Wed, 20 Apr 2005 15:11:47 -0300 (ADT) +Received: by rproxy.gmail.com with SMTP id z35so221897rne + for ; + Wed, 20 Apr 2005 11:11:48 -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=ixqVQ++4eku6taWnFRUfytrMESLUXiUSV955iT6rl7C/BEnoK+lxzMmhq2FU/6G7P1xUOgmrLT5tX0ODTp7zmLf6Bxr84UxQ/QbT70YJFiq4RwzlLUXineWBlQJokq2ZxgbZCh5pyv1oKPWFNTywIv1Q6A7CsgeywRkzQMHrhDw= +Received: by 10.38.150.79 with SMTP id x79mr1202984rnd; + Wed, 20 Apr 2005 11:11:48 -0700 (PDT) +Received: by 10.38.126.31 with HTTP; Wed, 20 Apr 2005 11:11:47 -0700 (PDT) +Message-ID: +Date: Wed, 20 Apr 2005 14:11:47 -0400 +From: Mike Rylander +Reply-To: Mike Rylander +To: Anjan Dave +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +Cc: pgsql-performance@postgresql.org +In-Reply-To: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098970@vt-pe2550-001.vantage.vantage.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.252 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/517 +X-Sequence-Number: 11914 + +On 4/20/05, Anjan Dave wrote: +> In terms of vendor specific models - +>=20 +> Does anyone have any good/bad experiences/recommendations for a 4-way +> Opteron from Sun (v40z, 6 internal drives) or HP (DL585 5 internal +> drives) models? + +We are going with the 90nm HPs for production. They "feel" like +beefier boxes than the Suns, but the Suns cost a LOT less, IIRC.=20 +We're only using the internal drives for the OS. PG gets access to a +fibre-channel array, HP StorageWorks 3000. I _can't wait_ to get this +in. + +Our dev box is a 130nm DL585 with 16G of RAM and an HP SCSI array, and +I have absolutely zero complaints. :) + +--=20 +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:15:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AA1C553757 + for ; + Wed, 20 Apr 2005 15:15:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00689-02 + for ; + Wed, 20 Apr 2005 18:15:18 +0000 (GMT) +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by svr1.postgresql.org (Postfix) with ESMTP id 87373536E2 + for ; + Wed, 20 Apr 2005 15:15:18 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF900JV4C1I8HY0@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Wed, 20 Apr 2005 13:15:19 -0500 (CDT) +Date: Wed, 20 Apr 2005 14:15:29 -0400 +From: "Joel Fradkin" +Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?) +In-reply-to: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098971@vt-pe2550-001.vantage.vantage.com> +To: "'Anjan Dave'" , + =?iso-8859-1?Q?'Christian_Sander_R=F8snes'?= , + "'Bruce Momjian'" +Cc: +Message-id: <003201c545d4$ef3f3f10$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=iso-8859-1 +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/518 +X-Sequence-Number: 11915 + +There have been some discussions on this list and others in general = +about +Dell's version of RAID cards, and server support, mainly linux support. + +I was pretty impressed with the Dell guy. He spent the day with me = +remotely +and went through my system 6650 with powervault. Changed my drives from = +ext3 +to ext2 with no journaling checked all the drivers and such. + +I did not see any marked improvement, but I don=92t think my issues are +related to the hardware. + +I am giving up on postgres and three developers two months of work and +trying MYSQL. + +I have posted several items and not got a response (not that I expect = +folks +to drop everything). I want to thank everyone who has been of help and = +there +are several. + +It just is running way slow on several of my views. I tried them today = +in +MYSQL and found that the MYSQL was beating out my MSSQL. + +On certain items I could get PG to work ok, but it never was faster the +MSSQL. On certain items it is taking several minutes compared to a few +seconds on MYSQL.=20 + +I really like the environment and feel I have learned a lot in the past = +few +months, but bottom line for me is speed. We bought a 30K Dell 6650 to = +get +better performance. I chose PG because MSSQL was 70K to license. I = +believe +the MYSQL will be 250.00 to license for us, but I may choose the 4k = +platinum +support just to feel safe about having some one to touch base with in = +the +event of an issue. + +Again thanks to everyone who has answered my newb questions and helped = +me +get it on the 3 spindles and tweek the install. Commandpromt.com was a = +big +help and if I wanted to budget a bunch more $ and mostly if I was at = +liberty +to share my database with them they may of helped me get through all the +issues. I am not sure I am walking away feeling real good about = +postgres, +because it just should not take a rocket scientist to get it to work, = +and I +used to think I was fairly smart and could figure stuff out and I hate +admitting defeat (especially since we have everything working with = +postgres +now). + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 15:48:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A2526533C8 + for ; + Wed, 20 Apr 2005 15:48:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07471-03 + for ; + Wed, 20 Apr 2005 18:48:31 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BC5152D90 + for ; + Wed, 20 Apr 2005 15:48:30 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7258775; Wed, 20 Apr 2005 11:50:26 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Wed, 20 Apr 2005 11:53:35 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <003201c545d4$ef3f3f10$797ba8c0@jfradkin> +In-Reply-To: <003201c545d4$ef3f3f10$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200504201153.36188.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/519 +X-Sequence-Number: 11916 + +Joel, + +> I did not see any marked improvement, but I don=92t think my issues are +> related to the hardware. + +If you won't believe it, then we certainly can't convince you. AFAIK your = +bad=20 +view is a bad query plan made worse by the Dell's hardware problems. + +> I am giving up on postgres and three developers two months of work and +> trying MYSQL. + +I'd suggest testing your *whole* application and not just this one query. = +And=20 +remember that you need to test InnoDB tables if you want transactions. + +> +> I have posted several items and not got a response (not that I expect fol= +ks +> to drop everything). I want to thank everyone who has been of help and +> there are several. + +Hmmm ... I see about 25 responses to some of your posts on this list. =20 +Including ones by some of our head developers. That's more than you'd get= +=20 +out of a paid MSSQL support contract, I know from experience. + +If you want anything more, then you'll need a "do-or-die" contract with a=20 +support company. If your frustration is because you can't find this kind of= +=20 +help than I completely understand ... I have a waiting list for performance= +=20 +contracts myself. (and, if you hired me the first thing I'd tell you is to= +=20 +junk the Dell) + +> I really like the environment and feel I have learned a lot in the past f= +ew +> months, but bottom line for me is speed. We bought a 30K Dell 6650 to get +> better performance.=20 + +Would have been smart to ask on this list *before* buying the Dell, hey? E= +ven=20 +a Google of this mailing list would have been informative. + +> I chose PG because MSSQL was 70K to license. I believe=20 +> the MYSQL will be 250.00 to license for us, but I may choose the 4k +> platinum support just to feel safe about having some one to touch base wi= +th +> in the event of an issue. + +Hmmm ... you're willing to pay MySQL $4k but expect the PG community to sol= +ve=20 +all your problems with free advice and a couple $100 with CMD? I sense an= +=20 +apples vs. barca loungers comparison here ... + +> I am not sure I am walking away feeling real good about +> postgres, because it just should not take a rocket scientist to get it to +> work, and I used to think I was fairly smart and could figure stuff out a= +nd +> I hate admitting defeat (especially since we have everything working with +> postgres now). + +While I understand your frustration (I've been frustrated more than a few=20 +times with issues that stump me on Linux, for example) it's extremely unfai= +r=20 +to lash out at a community that has provided you a lot of free advice becau= +se=20 +the advice hasn't fixed everything yet. By my reading, you first raised yo= +ur=20 +query issue 6 days ago. 6 days is not a lot of time for getting *free*=20 +troubleshooting help by e-mail. Certainly it's going to take more than 6 da= +ys=20 +to port to MySQL. =20 + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 20 16:02:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DDC085294D + for ; + Wed, 20 Apr 2005 16:02:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13708-01 + for ; + Wed, 20 Apr 2005 19:02:06 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id D377652961 + for ; + Wed, 20 Apr 2005 16:02:03 -0300 (ADT) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j3KJJoBw017342 + for ; Wed, 20 Apr 2005 19:19:51 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j3KJJodA017335; + Wed, 20 Apr 2005 19:19:50 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: How to improve db performance with $7K? +Date: Wed, 20 Apr 2005 19:01:05 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] How to improve db performance with $7K? +Thread-Index: AcVF0Avxq9azoP+LSEOP6jaLUXQAZwACvEhA +From: "Mohan, Ross" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/524 +X-Sequence-Number: 11921 + +Alex et al.,=20 + + +I wonder if thats something to think about adding to Postgresql? A = +setting for multiblock read count like Oracle (Although=20 + +|| I would think so, yea. GMTA: I was just having this micro-chat with = +Mr. Jim Nasby.=20 + +having said that I believe that Oracle natively caches pages much more = +aggressively that postgresql, which allows the OS to do the file = +caching). + +|| Yea...and it can rely on what is likely a lot more robust and = +nuanced caching algorithm, but...i don't + know enough (read: anything) about PG's to back that comment up.=20 + + +Alex Turner +netEconomist + +P.S. Oracle changed this with 9i, you can change the Database block size = +on a tablespace by tablespace bassis making it smaller for OLTP = +tablespaces and larger for Warehousing tablespaces (at least I think = +it's on a tablespace, might be on a whole DB). + +||Yes, it's tspace level.=20 + + + +On 4/19/05, Jim C. Nasby wrote: +> On Mon, Apr 18, 2005 at 06:41:37PM -0000, Mohan, Ross wrote: +> > Don't you think "optimal stripe width" would be +> > a good question to research the binaries for? I'd +> > think that drives the answer, largely. (uh oh, pun alert) +> > +> > EG, oracle issues IO requests (this may have changed _just_ +> > recently) in 64KB chunks, regardless of what you ask for. So when I=20 +> > did my striping (many moons ago, when the Earth was young...) I did=20 +> > it in 128KB widths, and set the oracle "multiblock read count"=20 +> > according. For oracle, any stripe size under 64KB=3Dstupid, anything = + +> > much over 128K/258K=3Dwasteful. +> > +> > I am eager to find out how PG handles all this. +>=20 +> AFAIK PostgreSQL requests data one database page at a time (normally=20 +> 8k). Of course the OS might do something different. +> -- +> Jim C. Nasby, Database Consultant decibel@decibel.org +> Give your computer some brain candy! www.distributed.net Team #1828 +>=20 +> Windows: "Where do you want to go today?" +> Linux: "Where do you want to go tomorrow?" +> FreeBSD: "Are you guys coming, or what?" +>=20 +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster +> + +From pgsql-performance-owner@postgresql.org Wed Apr 20 16:27:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2853C5294D + for ; + Wed, 20 Apr 2005 16:27:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19512-03 + for ; + Wed, 20 Apr 2005 19:27:46 +0000 (GMT) +Received: from ns.aprote.ee (ns.aprote.ee [80.235.78.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 7EF4B535DB + for ; + Wed, 20 Apr 2005 16:27:42 -0300 (ADT) +Received: Message by Barricade ns.aprote.ee with ESMTP id j3KJTk2v008227 + for ; Wed, 20 Apr 2005 22:29:46 +0300 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="----_=_NextPart_001_01C545DF.05136D70" +X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0 +Subject: Re: How to tell what your postgresql server is doing +Date: Wed, 20 Apr 2005 22:27:41 +0300 +Message-ID: +X-MS-Has-Attach: yes +X-MS-TNEF-Correlator: +Thread-Topic: How to tell what your postgresql server is doing +Thread-Index: AcVF3wUdXOrq54QFQwSRzvrKk4l8Cg== +From: "Tambet Matiisen" +To: "Jeff Frost" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/526 +X-Sequence-Number: 11923 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C545DF.05136D70 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +Stats are updated only after transaction ends. In case you have a really +long transaction you need something else.=20 + +To help myself I made a little Perl utility to parse strace output. It +recognizes read/write calls, extracts file handle, finds the file name +using information in /proc filesystem, then uses oid2name utility to +translate file name to PostgreSQL relation name. See attachment. + +It works well enough for me, but I didn't take time to polish it. +Basically it works with Linux /proc filesystem layout, expects +PostgreSQL data directory to be /home/postgres/data and oid2name in +/usr/lib/postgresql/bin. Usage is pgtrace . + + Tambet + +> -----Original Message----- +> From: Jeff Frost [mailto:jeff@frostconsultingllc.com]=20 +> Sent: Wednesday, April 20, 2005 7:45 AM +> To: pgsql-performance@postgresql.org +> Subject: How to tell what your postgresql server is doing +>=20 +>=20 +> Is there a way to look at the stats tables and tell what is=20 +> jamming up your=20 +> postgres server the most? Other than seeing long running=20 +> queries and watch=20 +> top, atop, iostat, vmstat in separate xterms...I'm wondering=20 +> if postgres keeps=20 +> some stats on what it spends the most time doing or if=20 +> there's a way to=20 +> extract that sort of info from other metrics it keeps in the=20 +> stats table? +>=20 +> Maybe a script which polls the stats table and correlates the=20 +> info with stats=20 +> about the system in /proc? +>=20 +> --=20 +> Jeff Frost, Owner +> Frost Consulting, LLC http://www.frostconsultingllc.com/ +> Phone: 650-780-7908 FAX: 650-649-1954 +>=20 + +------_=_NextPart_001_01C545DF.05136D70 +Content-Type: application/octet-stream; + name="pgtrace" +Content-Transfer-Encoding: base64 +Content-Description: pgtrace +Content-Disposition: attachment; + filename="pgtrace" + +IyEvdXNyL2Jpbi9wZXJsCgokI0FSR1YgPT0gMCBvciBkaWUgIlVzYWdlOiBwZ3RyYWNlIDxwaWQ+ +IjsKJHBpZCA9ICRBUkdWWzBdOwoKb3BlbihQR1RSQUNFLCJzdHJhY2UgLXAgJHBpZCAtZSB0cmFj +ZT1yZWFkLHdyaXRlIDI+JjEgfCIpIAogICAgb3IgZGllICJDYW4ndCBzdGFydCBzdHJhY2U6ICQh +IjsKCndoaWxlKCRsaW5lID0gPFBHVFJBQ0U+KQp7CiAgI3ByaW50ICRsaW5lOwogIGlmICgkbGlu +ZSA9fiAvKHJlYWR8d3JpdGUpXCgoXGQrKSwgLiosIChcZCspXCkgPSAoXGQrKS8pCiAgewogICAg +JG9wZXJhdGlvbiA9ICQxOwogICAgJGhhbmRsZSA9ICQyOwogICAgJHNpemUgPSAkMzsKICAgICRy +ZXN1bHQgPSAkNDsKICAgICRmaWxlbmFtZSA9IHJlYWRsaW5rICIvcHJvYy8kcGlkL2ZkLyRoYW5k +bGUiOwogICAgJGRhdGFiYXNlID0gIiI7CiAgICAkcmVsYXRpb24gPSAiIjsKICAgIGlmICgkZmls +ZW5hbWUgPX4gL1wvaG9tZVwvcG9zdGdyZXNcL2RhdGFcL2Jhc2VcLyhcZCspXC8oXGQrKS8pCiAg +ICB7CiAgICAgICRkYm9pZCA9ICQxOwogICAgICAkcmVsb2lkID0gJDI7CiAgICAgIGlmICgkZGF0 +YWJhc2VzeyRkYm9pZH0pCiAgICAgIHsKICAgICAgICAjcHJpbnQgIkRCSElUXG4iOwogICAgICAg +ICRkYXRhYmFzZSA9ICRkYXRhYmFzZXN7JGRib2lkfTsKICAgICAgfQogICAgICBlbHNlCiAgICAg +IHsKICAgICAgICAjcHJpbnQgIkRCTUlTU1xuIjsKICAgICAgICBteSAkb3V0cHV0ID0gYC91c3Iv +bGliL3Bvc3RncmVzcWwvYmluL29pZDJuYW1lIC1xIHwgZ3JlcCAkZGJvaWRgOwogICAgICAgIGlm +ICgkb3V0cHV0ID1+IC8oXHcrKVxzKj1ccyooXHcrKS8pCiAgICAgICAgewogICAgICAgICAgJGRh +dGFiYXNlID0gJDI7CiAgICAgICAgICAkZGF0YWJhc2VzeyRkYm9pZH0gPSAkZGF0YWJhc2U7CiAg +ICAgICAgfQogICAgICB9CiAgICAgIGlmICgkcmVsYXRpb25zeyRyZWxvaWR9KQogICAgICB7CiAg +ICAgICAgI3ByaW50ICJSRUxISVRcbiI7CiAgICAgICAgJHJlbGF0aW9uID0gJHJlbGF0aW9uc3sk +cmVsb2lkfTsKICAgICAgfQogICAgICBlbHNlCiAgICAgIHsKICAgICAgICAjcHJpbnQgIlJFTE1J +U1NcbiI7CiAgICAgICAgbXkgJG91dHB1dCA9IGAvdXNyL2xpYi9wb3N0Z3Jlc3FsL2Jpbi9vaWQy +bmFtZSAtcSAtZCAkZGF0YWJhc2UgLW8gJHJlbG9pZGA7CiAgICAgICAgaWYgKCRvdXRwdXQgPX4g +LyhcdyspXHMqPVxzKihcdyspLykKICAgICAgICB7CiAgICAgICAgICAkcmVsYXRpb24gPSAkMjsK +ICAgICAgICAgICRyZWxhdGlvbnN7JHJlbG9pZH0gPSAkcmVsYXRpb247CiAgICAgICAgfQogICAg +ICB9CiAgICB9CiAgICAkbm93ID0gbG9jYWx0aW1lOwogICAgaWYgKCRkYXRhYmFzZSAmJiAkcmVs +YXRpb24pCiAgICB7CiAgICAgIHByaW50ICIkbm93ICRvcGVyYXRpb24oJGRhdGFiYXNlLiRyZWxh +dGlvbiwgJHNpemUpID0gJHJlc3VsdFxuIjsKICAgIH0KICAgIGVsc2UKICAgIHsKICAgICAgcHJp +bnQgIiRub3cgJG9wZXJhdGlvbigkZmlsZW5hbWUsICRzaXplKSA9ICRyZXN1bHRcbiI7CiAgICB9 +CiAgfQp9CgpjbG9zZShQR1RSQUNFKTsK + +------_=_NextPart_001_01C545DF.05136D70-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 16:28:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D656153557 + for ; + Wed, 20 Apr 2005 16:28:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18633-09 + for ; + Wed, 20 Apr 2005 19:28:53 +0000 (GMT) +Received: from ylpvm43.prodigy.net (ylpvm43-ext.prodigy.net [207.115.57.74]) + by svr1.postgresql.org (Postfix) with ESMTP id 7334552967 + for ; + Wed, 20 Apr 2005 16:28:50 -0300 (ADT) +Received: from pimout5-ext.prodigy.net (pimout5-ext.prodigy.net + [207.115.63.73]) + by ylpvm43.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id + j3KJSsl8006284 + for ; Wed, 20 Apr 2005 15:28:54 -0400 +X-ORBL: [69.235.29.228] +Received: from [192.168.1.103] (adsl-69-235-29-228.dsl.irvnca.pacbell.net + [69.235.29.228]) + by pimout5-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id + j3KJSk0E056972 + for ; Wed, 20 Apr 2005 15:28:51 -0400 +Mime-Version: 1.0 (Apple Message framework v622) +Content-Transfer-Encoding: 7bit +Message-Id: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> +Content-Type: text/plain; charset=US-ASCII; format=flowed +To: pgsql-performance@postgresql.org +From: Richard Plotkin +Subject: Disk filling, CPU filling, renegade inserts and deletes? +Date: Wed, 20 Apr 2005 12:28:45 -0700 +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/527 +X-Sequence-Number: 11924 + +Hi, + +I'm having a pretty serious problem with postgresql's performance. +Currently, I have a cron task that is set to restart and vacuumdb -faz +every six hours. If that doesn't happen, the disk goes from 10% full +to 95% full within 2 days (and it's a 90GB disk...with the database +being a 2MB download after dump), and the CPU goes from running at +around a 2% load to a 99+% load right away (the stats look like a +square wave). + +So it's problem-hunting time, I guess. The problem has something to do +with the following errors (there are a lot; I'm posting a short sample) +NOTICE: relation "pg_depend" TID 43/27: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_depend" TID 43/28: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_depend" TID 43/29: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_depend" TID 43/30: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_depend" TID 43/31: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_depend" TID 43/32: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_type" TID 17/44: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_type" TID 17/45: InsertTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_attribute" TID 133/11: +InsertTransactionInProgress 209545 --- can't shrink relation +NOTICE: relation "pg_attribute" TID 133/12: +InsertTransactionInProgress 209545 --- can't shrink relation +NOTICE: relation "pg_attribute" TID 133/13: +InsertTransactionInProgress 209545 --- can't shrink relation +NOTICE: relation "pg_attribute" TID 133/14: +InsertTransactionInProgress 209545 --- can't shrink relation +NOTICE: relation "pg_attribute" TID 133/15: +InsertTransactionInProgress 209545 --- can't shrink relation +NOTICE: relation "pg_attribute" TID 133/16: +InsertTransactionInProgress 209545 --- can't shrink relation +NOTICE: relation "pg_attribute" TID 133/17: +InsertTransactionInProgress 209545 --- can't shrink relation +NOTICE: relation "pg_class" TID 41/18: DeleteTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_class" TID 41/19: DeleteTransactionInProgress +209545 --- can't shrink relation +NOTICE: relation "pg_class" TID 41/20: DeleteTransactionInProgress +209545 --- can't shrink relation + +When I vacuum full, I can't get rid of these errors unless I restart +the database (and then I restart, vacuum full, and everything's fine). +And once I do a successful vacuum full, CPU usage returns to normal, +and the disk is no longer almost full (back to 10% full). I'm at a loss +to figure out where the problem is coming from and how to fix it. + +My machine: XServe G5 Dual 2GHz running Mac OS X Server 10.3.9. +Postgresql 8.0.1 + +Thanks for any responses/ideas/solutions (best of all!), +Richard + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 16:39:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5511C536A0 + for ; + Wed, 20 Apr 2005 16:39:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22940-02 + for ; + Wed, 20 Apr 2005 19:39:05 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 275B45367E + for ; + Wed, 20 Apr 2005 16:39:04 -0300 (ADT) +Received: from dyn-70-66.tor.dsl.tht.net (dyn-70-66.tor.dsl.tht.net + [134.22.70.66]) by tht.net (Postfix) with ESMTP + id 926B176A11; Wed, 20 Apr 2005 15:39:03 -0400 (EDT) +Subject: Re: Disk filling, CPU filling, renegade inserts and +From: Rod Taylor +To: Richard Plotkin +Cc: pgsql-performance@postgresql.org +In-Reply-To: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> +Content-Type: text/plain +Date: Wed, 20 Apr 2005 15:36:58 -0400 +Message-Id: <1114025818.66326.34.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.2 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/528 +X-Sequence-Number: 11925 + +> I'm having a pretty serious problem with postgresql's performance. +> Currently, I have a cron task that is set to restart and vacuumdb -faz +> every six hours. If that doesn't happen, the disk goes from 10% full +> to 95% full within 2 days (and it's a 90GB disk...with the database +> being a 2MB download after dump), and the CPU goes from running at +> around a 2% load to a 99+% load right away (the stats look like a +> square wave). + +Are you running frequent queries which use temporary tables? + + +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 16:52:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 89ADF535DB + for ; + Wed, 20 Apr 2005 16:52:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24545-05 + for ; + Wed, 20 Apr 2005 19:52:38 +0000 (GMT) +Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DD795372D + for ; + Wed, 20 Apr 2005 16:52:35 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF900DLWGJNL1Z2@vms042.mailsrvcs.net> for + pgsql-performance@postgresql.org; Wed, 20 Apr 2005 14:52:36 -0500 (CDT) +Date: Wed, 20 Apr 2005 15:52:45 -0400 +From: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <200504201153.36188.josh@agliodbs.com> +To: +Cc: +Message-id: <000001c545e2$863d7ff0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/529 +X-Sequence-Number: 11926 + +Sorry if you feel I am lashing out at a community. +Just to say it again, I am very appreciative of all the help everyone = +has +supplied. + +I am running on more then just the 4 proc Dell (in fact my tests have = +been +mostly on desktops). + +I have MSSQL running on a 2 proc dell which until my load has increased +(over aprx 2 years) it was just fine. I totally agree that there are = +better +solutions based on this lists comments, but I have all Dell hardware now = +and +resist trying different vendors just to suit Postgres. I was under the +impression there were still issues with 64bit postgres and Linux (or at +least were when I purchased). I believed I could make my next aquistion = +a +opteron based hardware. + +Again I am not at all trying to critasize any one, so please except my +apology if I some how came across with that attitude. I am very = +disappointed +at this point. My views may not be that great (although I am not saying = +that +either), but they run ok on MSSQL and appear to run ok on MYSQL. + +I wish I did understand what I am doing wrong because I do not wish to +revisit engineering our application for MYSQL. + +I would of spent more $ with Command, but he does need my data base to = +help +me and I am not able to do that. + +I agree testing the whole app is the only way to see and unfortunately = +it is +a time consuming bit. I do not have to spend 4k on MYSQL, that is if I = +want +to have their premium support. I can spend $250.00 a server for the +commercial license if I find the whole app does run well. I just loaded = +the +data last night and only had time to convert one view this morning. I am +sure it is something I do not understand and not a problem with = +postgres. I +also am willing to take time to get more knowledgeable, but my time is +running out and I feel honestly stupid. + +I have been in the process of converting for over two months and have = +said +several times these lists are a godsend.=20 + +It was never my intention to make you feel like I was flaming anyone +involved. On the contrary, I feel many have taken time to look at my +questions and given excellent advice. I know I check the archives so +hopefully that time will help others after me.=20 + +I may yet find that MYSQL is not a good fit as well. I have my whole app +converted at this point and find pg works well for a lot of my usage. =20 + +There are some key reporting views that need to retrieve many rows with = +many +joins that just take too long to pull the data. I told my boss just now = +that +if I try to de-normalize many of these data sets (like 6 main groups of = +data +that the reporting may work, but as is many of my web pages are timing = +out +(these are pages that still work on MSSQL and the 2 proc machine). + +Thanks again for all the help and know I truly appreciate what time = +every +one has spent on my issues. + +I may find that revisiting the datasets is a way to make PG work, or as = +you +mentioned maybe I can get some one with more knowledge to step in = +locally. I +did ask Tom if he knew of anyone, maybe some one else on the list is = +aware +of a professional in the Tampa FL area. + +Realistically I don't think a 30k$ Dell is a something that needs to be +junked. I am pretty sure if I got MSSQL running on it, it would = +outperform +my two proc box. I can agree it may not have been the optimal platform. = +My +decision is not based solely on the performance on the 4 proc box. + +Joel Fradkin +=20 + +-----Original Message----- +From: Josh Berkus [mailto:josh@agliodbs.com]=20 +Sent: Wednesday, April 20, 2005 1:54 PM +To: Joel Fradkin +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + +Joel, + +> I did not see any marked improvement, but I don't think my issues are +> related to the hardware. + +If you won't believe it, then we certainly can't convince you. AFAIK = +your +bad=20 +view is a bad query plan made worse by the Dell's hardware problems. + +> I am giving up on postgres and three developers two months of work and +> trying MYSQL. + +I'd suggest testing your *whole* application and not just this one = +query. +And=20 +remember that you need to test InnoDB tables if you want transactions. + +> +> I have posted several items and not got a response (not that I expect +folks +> to drop everything). I want to thank everyone who has been of help and +> there are several. + +Hmmm ... I see about 25 responses to some of your posts on this list. =20 +Including ones by some of our head developers. That's more than you'd = +get=20 +out of a paid MSSQL support contract, I know from experience. + +If you want anything more, then you'll need a "do-or-die" contract with = +a=20 +support company. If your frustration is because you can't find this kind = +of=20 +help than I completely understand ... I have a waiting list for = +performance=20 +contracts myself. (and, if you hired me the first thing I'd tell you is = +to=20 +junk the Dell) + +> I really like the environment and feel I have learned a lot in the = +past +few +> months, but bottom line for me is speed. We bought a 30K Dell 6650 to = +get +> better performance.=20 + +Would have been smart to ask on this list *before* buying the Dell, hey? +Even=20 +a Google of this mailing list would have been informative. + +> I chose PG because MSSQL was 70K to license. I believe=20 +> the MYSQL will be 250.00 to license for us, but I may choose the 4k +> platinum support just to feel safe about having some one to touch base +with +> in the event of an issue. + +Hmmm ... you're willing to pay MySQL $4k but expect the PG community to +solve=20 +all your problems with free advice and a couple $100 with CMD? I sense = +an=20 +apples vs. barca loungers comparison here ... + +> I am not sure I am walking away feeling real good about +> postgres, because it just should not take a rocket scientist to get it = +to +> work, and I used to think I was fairly smart and could figure stuff = +out +and +> I hate admitting defeat (especially since we have everything working = +with +> postgres now). + +While I understand your frustration (I've been frustrated more than a = +few=20 +times with issues that stump me on Linux, for example) it's extremely = +unfair + +to lash out at a community that has provided you a lot of free advice +because=20 +the advice hasn't fixed everything yet. By my reading, you first raised +your=20 +query issue 6 days ago. 6 days is not a lot of time for getting *free*=20 +troubleshooting help by e-mail. Certainly it's going to take more than 6 +days=20 +to port to MySQL. =20 + +--=20 +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 17:06:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 55AA353727 + for ; + Wed, 20 Apr 2005 17:06:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28320-07 + for ; + Wed, 20 Apr 2005 20:06:16 +0000 (GMT) +Received: from ylpvm43.prodigy.net (ylpvm43-ext.prodigy.net [207.115.57.74]) + by svr1.postgresql.org (Postfix) with ESMTP id 28461536CF + for ; + Wed, 20 Apr 2005 17:06:15 -0300 (ADT) +Received: from pimout6-ext.prodigy.net (pimout6-ext.prodigy.net + [207.115.63.78]) + by ylpvm43.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id + j3KK6Kl8021129 + for ; Wed, 20 Apr 2005 16:06:20 -0400 +X-ORBL: [69.235.29.228] +Received: from [192.168.1.103] (adsl-69-235-29-228.dsl.irvnca.pacbell.net + [69.235.29.228]) + by pimout6-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id + j3KK6CbG095232 + for ; Wed, 20 Apr 2005 16:06:17 -0400 +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <1114025818.66326.34.camel@home> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <1114025818.66326.34.camel@home> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and +Date: Wed, 20 Apr 2005 13:05:27 -0700 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/530 +X-Sequence-Number: 11927 + +No, I don't think so. I don't think there are any temp table queries +(and I'll check), but even if there are, site traffic is very low, and +queries would be very infrequent. + +On Apr 20, 2005, at 12:36 PM, Rod Taylor wrote: + +>> I'm having a pretty serious problem with postgresql's performance. +>> Currently, I have a cron task that is set to restart and vacuumdb -faz +>> every six hours. If that doesn't happen, the disk goes from 10% full +>> to 95% full within 2 days (and it's a 90GB disk...with the database +>> being a 2MB download after dump), and the CPU goes from running at +>> around a 2% load to a 99+% load right away (the stats look like a +>> square wave). +> +> Are you running frequent queries which use temporary tables? +> +> +> -- +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 17:22:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 30731536E4 + for ; + Wed, 20 Apr 2005 17:22:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32800-06 + for ; + Wed, 20 Apr 2005 20:22:21 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id A6DEA53647 + for ; + Wed, 20 Apr 2005 17:22:19 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Wed, 20 Apr 2005 16:22:19 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785026FF6B5@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +Thread-Index: AcVF5hu4yC4jWo2fTmO+pj/B0ob4LAAAEwCw +From: "Anjan Dave" +To: , "Joel Fradkin" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.105 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/532 +X-Sequence-Number: 11929 + +He is running RHAS4, which is the latest 2.6.x kernel from RH. I believe +it should have done away with the RHAS3.0 Update 3 IO issue. + +anjan + +-----Original Message----- +From: Josh Berkus [mailto:josh@agliodbs.com]=20 +Sent: Wednesday, April 20, 2005 4:23 PM +To: Joel Fradkin +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + +Joel, + +> I have MSSQL running on a 2 proc dell which until my load has +increased +> (over aprx 2 years) it was just fine. I totally agree that there are +better +> solutions based on this lists comments, but I have all Dell hardware +now +> and resist trying different vendors just to suit Postgres. I was under +the +> impression there were still issues with 64bit postgres and Linux (or +at +> least were when I purchased). I believed I could make my next +aquistion a +> opteron based hardware. + +Yeah, sorry, the Dell stuff is a sore point with me. You can't imagine +the=20 +number of conversations I have that go like this: +"We're having a severe performance problem with PostgreSQL" +"What hardware/OS are you using?" +"Dell *650 with RHAS 3.0 ...." + +BTW, which Update version is your RHAS? If you're on Update3, you can +grab=20 +more performance right there by upgrading to Update4. + +> Again I am not at all trying to critasize any one, so please except my +> apology if I some how came across with that attitude. I am very +> disappointed at this point. My views may not be that great (although I +am +> not saying that either), but they run ok on MSSQL and appear to run ok +on +> MYSQL. + +Yeah. I think you'll find a few things that are vice-versa. For that=20 +matter, I can point to a number of queries we run better than Oracle, +and a=20 +number we don't. + +Your particular query problem seems to stem from some bad estimates. +Can you=20 +post an EXPLAIN ANALYZE based on all the advice people have given you so +far? + +> I wish I did understand what I am doing wrong because I do not wish to +> revisit engineering our application for MYSQL. + +I can imagine. =20 + +> I would of spent more $ with Command, but he does need my data base to +help +> me and I am not able to do that. + +Yes. For that matter, it'll take longer to troubleshoot on this list +because=20 +of your security concerns. + +> I agree testing the whole app is the only way to see and unfortunately +it +> is a time consuming bit. I do not have to spend 4k on MYSQL, that is +if I +> want to have their premium support. I can spend $250.00 a server for +the +> commercial license if I find the whole app does run well. I just +loaded the +> data last night and only had time to convert one view this morning. I +am +> sure it is something I do not understand and not a problem with +postgres. I +> also am willing to take time to get more knowledgeable, but my time is +> running out and I feel honestly stupid. + +You're not. You have a real query problem and it will require further=20 +troubleshooting to solve. Some of us make a pretty handsome living +solving=20 +these kinds of problems, it take a lot of expert knowledge. + +> It was never my intention to make you feel like I was flaming anyone +> involved. On the contrary, I feel many have taken time to look at my +> questions and given excellent advice. I know I check the archives so +> hopefully that time will help others after me. + +Well, I overreacted too. Sorry! + +> I may find that revisiting the datasets is a way to make PG work, or +as you +> mentioned maybe I can get some one with more knowledge to step in +locally. +> I did ask Tom if he knew of anyone, maybe some one else on the list is +> aware of a professional in the Tampa FL area. + +Well, Robert Treat is in Florida but I'm pretty sure he's busy +full-time. + +> Realistically I don't think a 30k$ Dell is a something that needs to +be +> junked. I am pretty sure if I got MSSQL running on it, it would +outperform +> my two proc box. I can agree it may not have been the optimal +platform. My +> decision is not based solely on the performance on the 4 proc box. + +Oh, certainly it's too late to buy a Sunfire or eServer instead. You +just=20 +could have gotten far more bang for the buck with some expert advice, +that's=20 +all. But don't bother with Dell support any further, they don't really +have=20 +the knowledge to help you. + +So ... new EXPLAIN ANALYZE ? + +--=20 + +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +---------------------------(end of broadcast)--------------------------- +TIP 8: explain analyze is your friend + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 17:17:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BD961536DB + for ; + Wed, 20 Apr 2005 17:17:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30433-09 + for ; + Wed, 20 Apr 2005 20:17:32 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 0035C53647 + for ; + Wed, 20 Apr 2005 17:17:28 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7259257; Wed, 20 Apr 2005 13:19:27 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Wed, 20 Apr 2005 13:22:37 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <000001c545e2$863d7ff0$797ba8c0@jfradkin> +In-Reply-To: <000001c545e2$863d7ff0$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504201322.37425.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/531 +X-Sequence-Number: 11928 + +Joel, + +> I have MSSQL running on a 2 proc dell which until my load has increased +> (over aprx 2 years) it was just fine. I totally agree that there are better +> solutions based on this lists comments, but I have all Dell hardware now +> and resist trying different vendors just to suit Postgres. I was under the +> impression there were still issues with 64bit postgres and Linux (or at +> least were when I purchased). I believed I could make my next aquistion a +> opteron based hardware. + +Yeah, sorry, the Dell stuff is a sore point with me. You can't imagine the +number of conversations I have that go like this: +"We're having a severe performance problem with PostgreSQL" +"What hardware/OS are you using?" +"Dell *650 with RHAS 3.0 ...." + +BTW, which Update version is your RHAS? If you're on Update3, you can grab +more performance right there by upgrading to Update4. + +> Again I am not at all trying to critasize any one, so please except my +> apology if I some how came across with that attitude. I am very +> disappointed at this point. My views may not be that great (although I am +> not saying that either), but they run ok on MSSQL and appear to run ok on +> MYSQL. + +Yeah. I think you'll find a few things that are vice-versa. For that +matter, I can point to a number of queries we run better than Oracle, and a +number we don't. + +Your particular query problem seems to stem from some bad estimates. Can you +post an EXPLAIN ANALYZE based on all the advice people have given you so far? + +> I wish I did understand what I am doing wrong because I do not wish to +> revisit engineering our application for MYSQL. + +I can imagine. + +> I would of spent more $ with Command, but he does need my data base to help +> me and I am not able to do that. + +Yes. For that matter, it'll take longer to troubleshoot on this list because +of your security concerns. + +> I agree testing the whole app is the only way to see and unfortunately it +> is a time consuming bit. I do not have to spend 4k on MYSQL, that is if I +> want to have their premium support. I can spend $250.00 a server for the +> commercial license if I find the whole app does run well. I just loaded the +> data last night and only had time to convert one view this morning. I am +> sure it is something I do not understand and not a problem with postgres. I +> also am willing to take time to get more knowledgeable, but my time is +> running out and I feel honestly stupid. + +You're not. You have a real query problem and it will require further +troubleshooting to solve. Some of us make a pretty handsome living solving +these kinds of problems, it take a lot of expert knowledge. + +> It was never my intention to make you feel like I was flaming anyone +> involved. On the contrary, I feel many have taken time to look at my +> questions and given excellent advice. I know I check the archives so +> hopefully that time will help others after me. + +Well, I overreacted too. Sorry! + +> I may find that revisiting the datasets is a way to make PG work, or as you +> mentioned maybe I can get some one with more knowledge to step in locally. +> I did ask Tom if he knew of anyone, maybe some one else on the list is +> aware of a professional in the Tampa FL area. + +Well, Robert Treat is in Florida but I'm pretty sure he's busy full-time. + +> Realistically I don't think a 30k$ Dell is a something that needs to be +> junked. I am pretty sure if I got MSSQL running on it, it would outperform +> my two proc box. I can agree it may not have been the optimal platform. My +> decision is not based solely on the performance on the 4 proc box. + +Oh, certainly it's too late to buy a Sunfire or eServer instead. You just +could have gotten far more bang for the buck with some expert advice, that's +all. But don't bother with Dell support any further, they don't really have +the knowledge to help you. + +So ... new EXPLAIN ANALYZE ? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 20 17:42:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9EFCA53528 + for ; + Wed, 20 Apr 2005 17:42:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37821-05 + for ; + Wed, 20 Apr 2005 20:42:29 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E9C3537DC + for ; + Wed, 20 Apr 2005 17:42:27 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3KKgPYu008389; (envelope-from ) Wed, + 20 Apr 2005 15:42:25 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3KKgNP5018863 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 20 Apr 2005 15:42:24 -0500 (CDT) +Message-ID: <4266BEB0.3050008@arbash-meinel.com> +Date: Wed, 20 Apr 2005 15:42:24 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +References: <000001c545e2$863d7ff0$797ba8c0@jfradkin> +In-Reply-To: <000001c545e2$863d7ff0$797ba8c0@jfradkin> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigED29CEC84FC8E0FF9959219D" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/533 +X-Sequence-Number: 11930 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigED29CEC84FC8E0FF9959219D +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Joel Fradkin wrote: +... + +>I would of spent more $ with Command, but he does need my data base to help +>me and I am not able to do that. +> +> +... + +What if someone were to write an anonymization script. Something that +changes any of the "data" of the database, but leaves all of the +relational information. It could turn all strings into some sort of +hashed version, so you don't give out any identifiable information. +It could even modify relational entries, as long as it updated both +ends, and this didn't affect the actual performance at all. + +I don't think this would be very hard to write. Especially if you can +give a list of the tables, and what columns need to be modified. + +Probably this would generally be a useful script to have for cases like +this where databases are confidential, but need to be tuned by someone else. + +Would that be reasonable? +I would think that by renaming columns, hashing the data in the columns, +and renaming tables, most of the proprietary information is removed, +without removing the database information. + +John +=:-> + + +--------------enigED29CEC84FC8E0FF9959219D +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCZr6wJdeBCYSNAAMRArWhAKC+MMmXfR4OKqJ2lSHVgFaXPN7R9ACeO2TR +Fo8gSJav6PMJZBLzu/+vO+I= +=LLOi +-----END PGP SIGNATURE----- + +--------------enigED29CEC84FC8E0FF9959219D-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 17:44:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DB01D53528 + for ; + Wed, 20 Apr 2005 17:44:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39026-06 + for ; + Wed, 20 Apr 2005 20:43:56 +0000 (GMT) +Received: from ylpvm15.prodigy.net (ylpvm15-ext.prodigy.net [207.115.57.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 33A8A5372D + for ; + Wed, 20 Apr 2005 17:43:55 -0300 (ADT) +Received: from pimout7-ext.prodigy.net (pimout7-ext.prodigy.net + [207.115.63.58]) + by ylpvm15.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id + j3KKe3NA008581 + for ; Wed, 20 Apr 2005 16:40:04 -0400 +X-ORBL: [69.235.29.228] +Received: from [192.168.1.103] (adsl-69-235-29-228.dsl.irvnca.pacbell.net + [69.235.29.228]) + by pimout7-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id + j3KKhp8L020712 + for ; Wed, 20 Apr 2005 16:43:56 -0400 +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <1114025818.66326.34.camel@home> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <1114025818.66326.34.camel@home> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <73a30faf07358bdb7935f97f50dd1189@richardplotkin.com> +Content-Transfer-Encoding: 7bit +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Wed, 20 Apr 2005 13:43:50 -0700 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/534 +X-Sequence-Number: 11931 + +As a follow-up, I've found a function that used the following code: + +CREATE TEMPORARY TABLE results +(nOrder integer, +page_id integer, +name text) +WITHOUT OIDS +ON COMMIT DROP; + +I would assume that the "WITHOUT OIDS" would be part of the source of +the problem, so I've commented it out. + +On Apr 20, 2005, at 12:36 PM, Rod Taylor wrote: + +>> I'm having a pretty serious problem with postgresql's performance. +>> Currently, I have a cron task that is set to restart and vacuumdb -faz +>> every six hours. If that doesn't happen, the disk goes from 10% full +>> to 95% full within 2 days (and it's a 90GB disk...with the database +>> being a 2MB download after dump), and the CPU goes from running at +>> around a 2% load to a 99+% load right away (the stats look like a +>> square wave). +> +> Are you running frequent queries which use temporary tables? +> +> +> -- +> + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 17:48:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C947152953 + for ; + Wed, 20 Apr 2005 17:48:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40295-03 + for ; + Wed, 20 Apr 2005 20:48:18 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id E0EDB537FB + for ; + Wed, 20 Apr 2005 17:48:16 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3KKmHtK008601; (envelope-from ) Wed, + 20 Apr 2005 15:48:17 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3KKmFs1020887 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 20 Apr 2005 15:48:16 -0500 (CDT) +Message-ID: <4266C010.5090003@arbash-meinel.com> +Date: Wed, 20 Apr 2005 15:48:16 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Shachindra Agarwal +Cc: pgsql-performance@postgresql.org +Subject: Re: postgres slowdown question +References: + <5A5058425C97FA409CE98C9B87B0CF3805FDE3@marnewexchange.mardomain.local> +In-Reply-To: + <5A5058425C97FA409CE98C9B87B0CF3805FDE3@marnewexchange.mardomain.local> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig5B2AE721528E1F8C167515EE" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/535 +X-Sequence-Number: 11932 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig5B2AE721528E1F8C167515EE +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: quoted-printable + +Shachindra Agarwal wrote: + +> Dear Postgres Masters: +> +> We are using postgres 7.4 in our java application on RedHat linux. The = + +> Java application connects to Postgres via JDBC. The application goes=20 +> through a =91discovery=92 phase, whereas it adds large amount of data i= +nto=20 +> postgres. Typically, we are adding about a million records in various=20 +> tables. The application also issues multiple queries to the database=20 +> at the same time. We do not delete any records during the discovery=20 +> phase. Both the java application and the postgres are installed on the = + +> same machine. +> +> At the beginning, the application is able to add in the order of 100=20 +> record per minute. Gradually (after several hours), it slows down to=20 +> less than 10 records per minute. At this time, postgres processes take = + +> between 80-99% of CPU. When we reindex the database, the speed bumps=20 +> up to about 30 records per minute. Now, postgres server takes between=20 +> 50-70% CPU. +> +> We have the following in the postgresql.conf : +> +> max_fsm_pages =3D 500000 +> +> fsync =3D false +> +> We certainly can not live with this kind of performance. I believe=20 +> postgres should be able to handle much larger datasets but I can not=20 +> point my finger as to what are we doing wrong. Can somebody please=20 +> point me to the right direction. +> +> With kind regards, +> +> -- Shachindra Agarwal. +> +A few questions first. How are you loading the data? Are you using=20 +INSERT or COPY? Are you using a transaction, or are you autocommitting=20 +each row? + +You really need a transaction, and preferably use COPY. Both can help=20 +performance a lot. (In some of the tests, single row inserts can be=20 +10-100x slower than doing it in bulk.) + +Also, it sounds like you have a foreign key issue. That as things fill=20 +up, the foreign key reference checks are slowing you down. +Are you using ANALYZE as you go? A lot of times when you only have <1000 = + +rows a sequential scan is faster than using an index, and if you don't=20 +inform postgres that you have more rows, it might still use the old seqsc= +an. + +There are other possibilities, but it would be nice to know about your=20 +table layout, and possibly an EXPLAIN ANALYZE of the inserts that are=20 +going slow. + +John +=3D:-> + +PS> I don't know if JDBC supports COPY, but it certainly should support=20 +transactions. + + + +--------------enig5B2AE721528E1F8C167515EE +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCZsAQJdeBCYSNAAMRAgc1AKDK15PKcX7QO8h+fvU1yB/+RyNIcQCfSYFe +o4DSG/sdnr2PssCEatyw16o= +=TkCR +-----END PGP SIGNATURE----- + +--------------enig5B2AE721528E1F8C167515EE-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 17:51:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 130BE5383D + for ; + Wed, 20 Apr 2005 17:51:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39001-10 + for ; + Wed, 20 Apr 2005 20:51:09 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1F23B53820 + for ; + Wed, 20 Apr 2005 17:51:08 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3KKpAv1004575; + Wed, 20 Apr 2005 16:51:10 -0400 (EDT) +To: Richard Plotkin +Cc: pgsql-performance@postgresql.org +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +In-reply-to: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> +Comments: In-reply-to Richard Plotkin + message dated "Wed, 20 Apr 2005 12:28:45 -0700" +Date: Wed, 20 Apr 2005 16:51:10 -0400 +Message-ID: <4574.1114030270@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/536 +X-Sequence-Number: 11933 + +Richard Plotkin writes: +> I'm having a pretty serious problem with postgresql's performance. +> Currently, I have a cron task that is set to restart and vacuumdb -faz +> every six hours. If that doesn't happen, the disk goes from 10% full +> to 95% full within 2 days (and it's a 90GB disk...with the database +> being a 2MB download after dump), and the CPU goes from running at +> around a 2% load to a 99+% load right away (the stats look like a +> square wave). + +Q: what have you got the FSM parameters set to? + +Q: what exactly is bloating? Without knowing which tables or indexes +are growing, it's hard to speculate about the exact causes. Use du and +oid2name, or look at pg_class.relpages after a plain VACUUM. + +It's likely that the real answer is "you need to vacuum more often +than every six hours", but I'm trying not to jump to conclusions. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 20 18:01:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 885E75364B + for ; + Wed, 20 Apr 2005 18:01:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43292-03 + for ; + Wed, 20 Apr 2005 21:01:49 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 93255537FA + for ; + Wed, 20 Apr 2005 18:01:46 -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 0CD5DB80D + for ; + Wed, 20 Apr 2005 17:01:48 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <200504201322.37425.josh@agliodbs.com> +References: <000001c545e2$863d7ff0$797ba8c0@jfradkin> + <200504201322.37425.josh@agliodbs.com> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <6ac440bd7e1a8252d76f28d57b6dddb5@khera.org> +Content-Transfer-Encoding: 7bit +From: Vivek Khera +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Wed, 20 Apr 2005 17:01:47 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/537 +X-Sequence-Number: 11934 + + +On Apr 20, 2005, at 4:22 PM, Josh Berkus wrote: + +>> Realistically I don't think a 30k$ Dell is a something that needs to +>> be +>> junked. I am pretty sure if I got MSSQL running on it, it would +>> outperform +>> my two proc box. I can agree it may not have been the optimal +>> platform. My +>> decision is not based solely on the performance on the 4 proc box. +> +> Oh, certainly it's too late to buy a Sunfire or eServer instead. You +> just +> could have gotten far more bang for the buck with some expert advice, +> that's +> all. But don't bother with Dell support any further, they don't +> really have +> the knowledge to help you. +> + +FWIW, I have a $20k Dell box (PE2650 with 14-disk external PowerVault +RAID enclosure) which I'm phasing out for a dual opteron box because it +can't handle the load. It will be re-purposed as a backup system. +Damn waste of money, but complaining customers can cost more... + +Trust me, it is likely your Dell hardware, as moving to the Opteron +system has improved performance tremendously with fewer disks. Same +amount of RAM and other basic configurations. Both have LSI based RAID +cards, even. + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 18:06:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1EE94538BB + for ; + Wed, 20 Apr 2005 18:06:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42372-10 + for ; + Wed, 20 Apr 2005 21:06:11 +0000 (GMT) +Received: from ylpvm29.prodigy.net (ylpvm29-ext.prodigy.net [207.115.57.60]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B3C053893 + for ; + Wed, 20 Apr 2005 18:06:06 -0300 (ADT) +Received: from pimout6-ext.prodigy.net (pimout6-ext.prodigy.net + [207.115.63.78]) + by ylpvm29.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id + j3KL5SD5022608 + for ; Wed, 20 Apr 2005 17:05:28 -0400 +X-ORBL: [69.235.29.228] +Received: from [192.168.1.103] (adsl-69-235-29-228.dsl.irvnca.pacbell.net + [69.235.29.228]) + by pimout6-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id + j3KL64bG060972 + for ; Wed, 20 Apr 2005 17:06:04 -0400 +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <4574.1114030270@sss.pgh.pa.us> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Wed, 20 Apr 2005 14:06:03 -0700 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/538 +X-Sequence-Number: 11935 + +Hi Tom, + +> Q: what have you got the FSM parameters set to? + +Here's from postgresql.conf -- FSM at default settings. +# - Memory - + +shared_buffers = 30400 # min 16, at least max_connections*2, +8KB each +work_mem = 32168 # min 64, size in KB +#maintenance_work_mem = 16384 # min 1024, size in KB +#max_stack_depth = 2048 # min 100, size in KB + +# - Free Space Map - + +#max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each +#max_fsm_relations = 1000 # min 100, ~50 bytes each + +# - Kernel Resource Usage - + +max_files_per_process = 750 #1000 # min 25 +#preload_libraries = '' + + +> Q: what exactly is bloating? Without knowing which tables or indexes +> are growing, it's hard to speculate about the exact causes. Use du and +> oid2name, or look at pg_class.relpages after a plain VACUUM. + +This I do not know. I've disabled the cron jobs and will let the +system bloat, then I will gather statistics (I'll give it 12-24 hours). + +> It's likely that the real answer is "you need to vacuum more often +> than every six hours", but I'm trying not to jump to conclusions. + +That could be it, except that I would expect the problem to then look +more like a gradual increase in CPU usage and a gradual increase in use +of disk space. Mine could be an invalid assumption, but the system +here looks like it goes from no problem to 100% problem within a +minute. + +Thanks again! +Richard + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 19:22:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D29775372C + for ; + Wed, 20 Apr 2005 19:22:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63815-07 + for ; + Wed, 20 Apr 2005 22:22:26 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 75440535A2 + for ; + Wed, 20 Apr 2005 19:22:25 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 19A4515520; Wed, 20 Apr 2005 17:22:28 -0500 (CDT) +Date: Wed, 20 Apr 2005 17:22:27 -0500 +From: "Jim C. Nasby" +To: Mischa Sandberg +Cc: Tom Lane , pgsql-performance@postgresql.org +Subject: Re: Slow copy with little CPU/disk usage +Message-ID: <20050420222227.GW58835@decibel.org> +References: <20050420020033.GZ58835@decibel.org> + <19670.1113966354@sss.pgh.pa.us> + <1113971840.4265dc810374c@webmail.telus.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1113971840.4265dc810374c@webmail.telus.net> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/539 +X-Sequence-Number: 11936 + +No, this is a single process. And there's known issues with context +storms on Xeons, so that might be what you're seeing. + +On Tue, Apr 19, 2005 at 09:37:21PM -0700, Mischa Sandberg wrote: +> Quoting Tom Lane : +> +> > "Jim C. Nasby" writes: +> > > A friend of mine has an application where he's copying in 4000 rows at a +> > > time into a table that has about 4M rows. Each row is 40-50 bytes. This +> > > is taking 25 seconds on a dual PIII-1GHz with 1G of RAM and a 2 disk +> > > SATA mirror, running FBSD 4.10-stable. There's one index on the table. +> > +> > If there's no hidden costs such as foreign key checks, that does seem +> > pretty dang slow. +> > +> > > What's really odd is that neither the CPU or the disk are being +> > > hammered. The box appears to be pretty idle; the postgresql proces is +> > > using 4-5% CPU. +> -- +> This sounds EXACTLY like my problem, if you make the box to a Xeon 2.4GHz, 2GB +> RAM ... with two SCSI drives (xlog and base); loading 10K rows of about 200 +> bytes each; takes about 20 secs at the best, and much longer at the worst. By +> any chance does your friend have several client machines/processes trying to +> mass-load rows at the same time? Or at least some other processes updating +> that table in a bulkish way? What I get is low diskio, low cpu, even low +> context-switches ... and I'm betting he should take a look at pg_locks. For my +> own problem, I gather that an exclusive lock is necessary while updating +> indexes and heap, and the multiple processes doing the update can make that +> pathological. +> +> Anyway, have your friend check pg_locks. +> +> +> "Dreams come true, not free." -- S.Sondheim, ITW +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 20 19:23:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CBB7653CCE + for ; + Wed, 20 Apr 2005 19:23:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63832-04 + for ; + Wed, 20 Apr 2005 22:23:01 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 9F5AE539B8 + for ; + Wed, 20 Apr 2005 19:23:00 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id A0C4215547; Wed, 20 Apr 2005 17:23:02 -0500 (CDT) +Date: Wed, 20 Apr 2005 17:23:02 -0500 +From: "Jim C. Nasby" +To: Greg Stark +Cc: pgsql-performance@postgresql.org +Subject: Re: Slow copy with little CPU/disk usage +Message-ID: <20050420222302.GX58835@decibel.org> +References: <20050420020033.GZ58835@decibel.org> + <87d5sqdq24.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87d5sqdq24.fsf@stark.xeocode.com> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/540 +X-Sequence-Number: 11937 + +No, he's using either COPY or \COPY. + +On Wed, Apr 20, 2005 at 12:34:27AM -0400, Greg Stark wrote: +> "Jim C. Nasby" writes: +> +> > What's really odd is that neither the CPU or the disk are being +> > hammered. The box appears to be pretty idle; the postgresql proces is +> > using 4-5% CPU. +> +> Is he committing every row? In that case you would see fairly low i/o +> bandwidth usage because most of the time is being spent seeking and waiting +> for rotational latency. +> +> -- +> greg +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 20 20:17:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C25A553585 + for ; + Wed, 20 Apr 2005 20:17:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76139-04 + for ; + Wed, 20 Apr 2005 23:17:01 +0000 (GMT) +Received: from marnewexchange.mardomain.local (67-67-181-51.ded.swbell.net + [67.67.181.51]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B3D252A68 + for ; + Wed, 20 Apr 2005 20:16:59 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: postgres slowdown question +Date: Wed, 20 Apr 2005 18:16:28 -0500 +Message-ID: + <5A5058425C97FA409CE98C9B87B0CF3805FE11@marnewexchange.mardomain.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] postgres slowdown question +Thread-Index: AcVF6i/oWsr0PeVKRPiLhNotMfSB7gAFAJDg +From: "Shachindra Agarwal" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/541 +X-Sequence-Number: 11938 + +Thanks for the note. Please see my responses below: + +-----Original Message----- +From: John A Meinel [mailto:john@arbash-meinel.com]=20 +Sent: Wednesday, April 20, 2005 3:48 PM +To: Shachindra Agarwal +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] postgres slowdown question + +Shachindra Agarwal wrote: + +> Dear Postgres Masters: +> +> We are using postgres 7.4 in our java application on RedHat linux. The + +> Java application connects to Postgres via JDBC. The application goes=20 +> through a 'discovery' phase, whereas it adds large amount of data into + +> postgres. Typically, we are adding about a million records in various=20 +> tables. The application also issues multiple queries to the database=20 +> at the same time. We do not delete any records during the discovery=20 +> phase. Both the java application and the postgres are installed on the + +> same machine. +> +> At the beginning, the application is able to add in the order of 100=20 +> record per minute. Gradually (after several hours), it slows down to=20 +> less than 10 records per minute. At this time, postgres processes take + +> between 80-99% of CPU. When we reindex the database, the speed bumps=20 +> up to about 30 records per minute. Now, postgres server takes between=20 +> 50-70% CPU. +> +> We have the following in the postgresql.conf : +> +> max_fsm_pages =3D 500000 +> +> fsync =3D false +> +> We certainly can not live with this kind of performance. I believe=20 +> postgres should be able to handle much larger datasets but I can not=20 +> point my finger as to what are we doing wrong. Can somebody please=20 +> point me to the right direction. +> +> With kind regards, +> +> -- Shachindra Agarwal. +> +A few questions first. How are you loading the data? Are you using=20 +INSERT or COPY? Are you using a transaction, or are you autocommitting=20 +each row? + +You really need a transaction, and preferably use COPY. Both can help=20 +performance a lot. (In some of the tests, single row inserts can be=20 +10-100x slower than doing it in bulk.) + +>> We are using JDBC which supports 'inserts' and 'transactions'. We are +using both. The business logic adds one business object at a time. Each +object is added within its own transaction. Each object add results in 5 +records in various tables in the the database. So, a commit is performed +after every 5 inserts. + +Also, it sounds like you have a foreign key issue. That as things fill=20 +up, the foreign key reference checks are slowing you down. +Are you using ANALYZE as you go? A lot of times when you only have <1000 + +rows a sequential scan is faster than using an index, and if you don't=20 +inform postgres that you have more rows, it might still use the old +seqscan. + +>> This could be the issue. I will start 'analyze' in a cron job. I will +update you with the results. + +There are other possibilities, but it would be nice to know about your=20 +table layout, and possibly an EXPLAIN ANALYZE of the inserts that are=20 +going slow. + +John +=3D:-> + +PS> I don't know if JDBC supports COPY, but it certainly should support=20 +transactions. + + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 20:35:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 46BCC53757 + for ; + Wed, 20 Apr 2005 20:35:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78746-09 + for ; + Wed, 20 Apr 2005 23:35:36 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id B581353675 + for ; + Wed, 20 Apr 2005 20:35:32 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3KNZYGP014677; (envelope-from ) Wed, + 20 Apr 2005 18:35:34 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3KNZXgA010032 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 20 Apr 2005 18:35:33 -0500 (CDT) +Message-ID: <4266E746.5010508@arbash-meinel.com> +Date: Wed, 20 Apr 2005 18:35:34 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Shachindra Agarwal , + pgsql-performance@postgresql.org +Subject: Re: postgres slowdown question +References: + <5A5058425C97FA409CE98C9B87B0CF3805FE11@marnewexchange.mardomain.local> +In-Reply-To: + <5A5058425C97FA409CE98C9B87B0CF3805FE11@marnewexchange.mardomain.local> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig931D427B07282408048652E1" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/542 +X-Sequence-Number: 11939 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig931D427B07282408048652E1 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Shachindra Agarwal wrote: + +>Thanks for the note. Please see my responses below: +> +> +... + +> +> +>>>We are using JDBC which supports 'inserts' and 'transactions'. We are +>>> +>>> +>using both. The business logic adds one business object at a time. Each +>object is added within its own transaction. Each object add results in 5 +>records in various tables in the the database. So, a commit is performed +>after every 5 inserts. +> +> +> +Well, 5 inserts per commit is pretty low. It would be nice to see more +like 100 inserts per commit. Would it be possible during the "discovery" +phase to put the begin/commit logic a little bit higher? +Remember, each COMMIT requires at least one fsync. (I realize you have +fsync off for now). But commit is pretty expensive. + +>Also, it sounds like you have a foreign key issue. That as things fill +>up, the foreign key reference checks are slowing you down. +>Are you using ANALYZE as you go? A lot of times when you only have <1000 +> +>rows a sequential scan is faster than using an index, and if you don't +>inform postgres that you have more rows, it might still use the old +>seqscan. +> +> +> +>>>This could be the issue. I will start 'analyze' in a cron job. I will +>>> +>>> +>update you with the results. +> +>There are other possibilities, but it would be nice to know about your +>table layout, and possibly an EXPLAIN ANALYZE of the inserts that are +>going slow. +> +>John +>=:-> +> +>PS> I don't know if JDBC supports COPY, but it certainly should support +>transactions. +> +> +Let us know if ANALYZE helps. If you are not deleting or updating +anything, you probably don't need to do VACUUM ANALYZE, but you might +think about it. It is a little more expensive since it has to go to +every tuple, rather than just a random sampling. + +John +=:-> + + +--------------enig931D427B07282408048652E1 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCZudHJdeBCYSNAAMRAjCYAKCZCvXRfYSSZWp2m7/BiqE6He+w2gCgtIOc +lWha19ZoEHoa+JSrRFMX5iw= +=nFCc +-----END PGP SIGNATURE----- + +--------------enig931D427B07282408048652E1-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 21:26:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CB5965355C + for ; + Wed, 20 Apr 2005 21:26:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91047-08 + for ; + Thu, 21 Apr 2005 00:25:56 +0000 (GMT) +Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) + by svr1.postgresql.org (Postfix) with ESMTP id D9E0B5354A + for ; + Wed, 20 Apr 2005 21:25:54 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IF900AZNT790433@vms046.mailsrvcs.net> for + pgsql-performance@postgresql.org; Wed, 20 Apr 2005 19:25:58 -0500 (CDT) +Date: Wed, 20 Apr 2005 20:26:08 -0400 +From: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <4266BEB0.3050008@arbash-meinel.com> +To: "'John A Meinel'" +Cc: , +Message-id: <001901c54608$b70ccfc0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/543 +X-Sequence-Number: 11940 + +I did think of something similar just loading the data tables with junk +records and I may visit that idea with Josh. + +I did just do some comparisons on timing of a plain select * from tbl = +where +indexed column =3D x and it was considerably slower then both MSSQL and = +MYSQL, +so I am still a bit confused. This still might be configuration issue (I = +ran +on my 2gig desktop and the 8 gig Linux box comparisons were all ran on = +the +same machines as far MSSQL, MYSQL, and Postgres. +I turned off postgres when running MYSQL and turned off MYSQL when = +running +postgres, MSSQL had one of the two running while I tested it. + +For the 360,000 records returned MYSQL did it in 40 seconds first run = +and 17 +seconds second run. + +MSSQL did it in 56 seconds first run and 16 seconds second run. + +Postgres was on the second run +Total query runtime: 17109 ms. +Data retrieval runtime: 72188 ms. +331640 rows retrieved. + +So like 89 on the second run. +The first run was 147 secs all told. + +These are all on my 2 meg desktop running XP. +I can post the config. I noticed the postgres was using 70% of the cpu = +while +MSSQL was 100%. + +Joel Fradkin +=20 + +>I would of spent more $ with Command, but he does need my data base to = +help +>me and I am not able to do that. +> +> +... + +What if someone were to write an anonymization script. Something that +changes any of the "data" of the database, but leaves all of the +relational information. It could turn all strings into some sort of +hashed version, so you don't give out any identifiable information. +It could even modify relational entries, as long as it updated both +ends, and this didn't affect the actual performance at all. + +I don't think this would be very hard to write. Especially if you can +give a list of the tables, and what columns need to be modified. + +Probably this would generally be a useful script to have for cases like +this where databases are confidential, but need to be tuned by someone = +else. + +Would that be reasonable? +I would think that by renaming columns, hashing the data in the columns, +and renaming tables, most of the proprietary information is removed, +without removing the database information. + +John +=3D:-> + + + +From pgsql-performance-owner@postgresql.org Wed Apr 20 21:45:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 04C7C53353 + for ; + Wed, 20 Apr 2005 21:45:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96904-06 + for ; + Thu, 21 Apr 2005 00:45:36 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id E9B035296E + for ; + Wed, 20 Apr 2005 21:45:34 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3L0jc97016434; (envelope-from ) Wed, + 20 Apr 2005 19:45:38 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3L0jbr9026232 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 20 Apr 2005 19:45:38 -0500 (CDT) +Message-ID: <4266F7B3.7050004@arbash-meinel.com> +Date: Wed, 20 Apr 2005 19:45:39 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin , + Postgresql Performance +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +References: <001901c54608$b70ccfc0$797ba8c0@jfradkin> +In-Reply-To: <001901c54608$b70ccfc0$797ba8c0@jfradkin> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig908EB5CB19F1D4D6FF634A4C" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/544 +X-Sequence-Number: 11941 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig908EB5CB19F1D4D6FF634A4C +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Joel Fradkin wrote: + +>I did think of something similar just loading the data tables with junk +>records and I may visit that idea with Josh. +> +>I did just do some comparisons on timing of a plain select * from tbl where +>indexed column = x and it was considerably slower then both MSSQL and MYSQL, +>so I am still a bit confused. This still might be configuration issue (I ran +>on my 2gig desktop and the 8 gig Linux box comparisons were all ran on the +>same machines as far MSSQL, MYSQL, and Postgres. +>I turned off postgres when running MYSQL and turned off MYSQL when running +>postgres, MSSQL had one of the two running while I tested it. +> +>For the 360,000 records returned MYSQL did it in 40 seconds first run and 17 +>seconds second run. +> +>MSSQL did it in 56 seconds first run and 16 seconds second run. +> +>Postgres was on the second run +>Total query runtime: 17109 ms. +>Data retrieval runtime: 72188 ms. +>331640 rows retrieved. +> +>So like 89 on the second run. +>The first run was 147 secs all told. +> +>These are all on my 2 meg desktop running XP. +>I can post the config. I noticed the postgres was using 70% of the cpu while +>MSSQL was 100%. +> +>Joel Fradkin +> +> +Why is MYSQL returning 360,000 rows, while Postgres is only returning +330,000? This may not be important at all, though. +I also assume you are selecting from a plain table, not a view. + +I suppose knowing your work_mem, and shared_buffers settings would be +useful. + +How were you measuring "data retrieval time"? And how does this compare +to what you were measuring on the other machines? It might be possible +that what you are really measuring is just the time it takes psql to +load up all the data into memory, and then print it out. And since psql +defaults to measuring entry lengths for each column, this may not be +truly comparable. +It *looks* like it only takes 18s for postgres to get the data, but then +it is taking 72s to transfer the data to you. That would be network +latency, or something like that, not database latency. +And I would say that 18s is very close to 16 or 17 seconds. + +I don't know what commands you were issuing, or how you measured, +though. You might be using some other interface (like ODBC), which I +can't say too much about. + +John +=:-> + + + +--------------enig908EB5CB19F1D4D6FF634A4C +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCZvezJdeBCYSNAAMRAvMUAKDElIXWAYM4BXNTTKYrW/P7+52pWgCgg7M8 +52rFCC5X8Ne8GDuKW4AXf1s= +=yLxP +-----END PGP SIGNATURE----- + +--------------enig908EB5CB19F1D4D6FF634A4C-- + +From pgsql-performance-owner@postgresql.org Wed Apr 20 23:50:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 89B2E53B85 + for ; + Wed, 20 Apr 2005 23:50:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22825-08 + for ; + Thu, 21 Apr 2005 02:50:05 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 5BC0653557 + for ; + Wed, 20 Apr 2005 23:50:03 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id D647B30952; Thu, 21 Apr 2005 04:48:58 +0200 (MET DST) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: Opteron vs Xeon +Date: Wed, 20 Apr 2005 21:56:03 -0400 +Organization: cbbrowne Computing Inc +Lines: 36 +Message-ID: +References: <200504201550.j3KFoQr21758@candle.pha.pa.us> + <200504201814.12633.christian@aspiro.no> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:QA3FrV1hvsPpXH3u2bx7Ja7oUSU= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.4 tagged_above=0 required=5 tests=AWL, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200504/546 +X-Sequence-Number: 11943 + +Quoth christian@aspiro.no (Christian Sander R�snes): +> On Wednesday 20 April 2005 17:50, Bruce Momjian wrote: +>> Anjan Dave wrote: +>> > In terms of vendor specific models - +>> > +>> > Does anyone have any good/bad experiences/recommendations for a +>> > 4-way Opteron from Sun (v40z, 6 internal drives) or HP (DL585 5 +>> > internal drives) models? +>> > +>> > This is in comparison with the new Dell 6850 (it has PCIexpress, +>> > faster FSB 667MHz, which doesn't match up with AMD's total IO +>> > bandwidth, but much better than previous 6650s). +>> +>> Dell cuts too many corners to be a good server. +> +> Hi +> +> Which corners do Dell cut compared to the competition ? + +They seem to be buying the "cheapest components of the week" such that +they need to customize BIOSes to make them work as opposed to getting +the "Grade A" stuff that works well out of the box. + +We got a bunch of quad-Xeon boxes in; the MegaRAID controllers took +plenty o' revisits from Dell folk before they got sorta stable. + +Dell replaced more SCSI drives on their theory that the problem was +bad disks than I care to remember. And if they were sufficiently +suspicious of the disk drives for that, that tells you that they don't +trust the disk they're selling terribly much, which leaves me even +less reassured... +-- +output = reverse("moc.liamg" "@" "enworbbc") +http://linuxdatabases.info/info/spreadsheets.html +Where do you *not* want to go today? "Confutatis maledictis, flammis +acribus addictis" ( + +From pgsql-performance-owner@postgresql.org Thu Apr 21 00:27:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CDFC053BF8 + for ; + Thu, 21 Apr 2005 00:27:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38414-04 + for ; + Thu, 21 Apr 2005 03:27:16 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 8852053B9B + for ; + Thu, 21 Apr 2005 00:27:07 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7260922; Wed, 20 Apr 2005 20:29:03 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Wed, 20 Apr 2005 20:32:14 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <001901c54608$b70ccfc0$797ba8c0@jfradkin> +In-Reply-To: <001901c54608$b70ccfc0$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504202032.14276.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.151 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200504/547 +X-Sequence-Number: 11944 + +Joel, + +Ok, please try this: + +ALTER TABLE tblresponseheader ALTER COLUMN clientnum SET STATISTICS 1000; +ALTER TABLE tblresponseheader ALTER COLUMN locationid SET STATISTICS 1000; +ALTER TABLE tbllocation ALTER COLUMN clientnum SET STATISTICS 1000; +ALTER TABLE tbllocation ALTER COLUMN divisionid SET STATISTICS 1000; +ALTER TABLE tbllocation ALTER COLUMN regionid SET STATISTICS 1000; +ANALYZE tblresponseheader; +ANALYZE tbllocation; + +Then run the EXPLAIN ANALYZE again. (on Linux) + + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 01:35:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E3FB552967 + for ; + Thu, 21 Apr 2005 01:35:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53330-01 + for ; + Thu, 21 Apr 2005 04:35:36 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 70DA353777 + for ; + Thu, 21 Apr 2005 01:35:34 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3L4ZWq5011217; + Thu, 21 Apr 2005 00:35:32 -0400 (EDT) +To: John A Meinel +Cc: Joel Fradkin , + Postgresql Performance +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <4266F7B3.7050004@arbash-meinel.com> +References: <001901c54608$b70ccfc0$797ba8c0@jfradkin> + <4266F7B3.7050004@arbash-meinel.com> +Comments: In-reply-to John A Meinel + message dated "Wed, 20 Apr 2005 19:45:39 -0500" +Date: Thu, 21 Apr 2005 00:35:32 -0400 +Message-ID: <11216.1114058132@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/548 +X-Sequence-Number: 11945 + +John A Meinel writes: +> Joel Fradkin wrote: +>> Postgres was on the second run +>> Total query runtime: 17109 ms. +>> Data retrieval runtime: 72188 ms. +>> 331640 rows retrieved. + +> How were you measuring "data retrieval time"? + +I suspect he's using pgadmin. We've seen reports before suggesting that +pgadmin can be amazingly slow, eg here +http://archives.postgresql.org/pgsql-performance/2004-10/msg00427.php +where the *actual* data retrieval time as shown by EXPLAIN ANALYZE +was under three seconds, but pgadmin claimed the query runtime was 22 +sec and data retrieval runtime was 72 sec. + +I wouldn't be too surprised if that time was being spent formatting +the data into a table for display inside pgadmin. It is a GUI after +all, not a tool for pushing vast volumes of data around. + +It'd be interesting to check the runtimes for the same query with +LIMIT 3000, ie, see if a tenth as much data takes a tenth as much +processing time or not. The backend code should be pretty darn +linear in this regard, but maybe pgadmin isn't. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 21 02:02:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 164DC53B42 + for ; + Thu, 21 Apr 2005 02:02:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58236-08 + for ; + Thu, 21 Apr 2005 05:02:50 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 0A05E53B19 + for ; + Thu, 21 Apr 2005 02:02:49 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id AEF2430952; Thu, 21 Apr 2005 07:01:39 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: How to improve db performance with $7K? +Date: Wed, 20 Apr 2005 22:02:42 -0700 +Organization: Hub.Org Networking Services +Lines: 81 +Message-ID: +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184BB@asg002.asg.local> + <33c6269f050420100455955060@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: <33c6269f050420100455955060@mail.gmail.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/549 +X-Sequence-Number: 11946 + +The Linux kernel is definitely headed this way. The 2.6 allows for +several different I/O scheduling algorithms. A brief overview about the +different modes: + +http://nwc.serverpipeline.com/highend/60400768 + +Although a much older article from the beta-2.5 days, more indepth info +from one of the programmers who developed the AS scheduler and worked on +the deadline scheduler: + +http://kerneltrap.org/node/657 + +I think I'm going to start testing the deadline scheduler for our data +processing server for a few weeks before trying it on our production +servers. + + + + +Alex Turner wrote: +> Whilst I admire your purist approach, I would say that if it is +> beneficial to performance that a kernel understand drive geometry, +> then it is worth investigating teaching it how to deal with that! +> +> I was less referrring to the kernel as I was to the controller. +> +> Lets say we invented a new protocol that including the drive telling +> the controller how it was layed out at initialization time so that the +> controller could make better decisions about re-ordering seeks. It +> would be more cost effective to have that set of electronics just once +> in the controller, than 8 times on each drive in an array, which would +> yield better performance to cost ratio. Therefore I would suggest it +> is something that should be investigated. After all, why implemented +> TCQ on each drive, if it can be handled more effeciently at the other +> end by the controller for less money?! +> +> Alex Turner +> netEconomist +> +> On 4/19/05, Dave Held wrote: +> +>>>-----Original Message----- +>>>From: Alex Turner [mailto:armtuk@gmail.com] +>>>Sent: Monday, April 18, 2005 5:50 PM +>>>To: Bruce Momjian +>>>Cc: Kevin Brown; pgsql-performance@postgresql.org +>>>Subject: Re: [PERFORM] How to improve db performance with $7K? +>>> +>>>Does it really matter at which end of the cable the queueing is done +>>>(Assuming both ends know as much about drive geometry etc..)? +>>>[...] +>> +>>The parenthetical is an assumption I'd rather not make. If my +>>performance depends on my kernel knowing how my drive is laid +>>out, I would always be wondering if a new drive is going to +>>break any of the kernel's geometry assumptions. Drive geometry +>>doesn't seem like a kernel's business any more than a kernel +>>should be able to decode the ccd signal of an optical mouse. +>>The kernel should queue requests at a level of abstraction that +>>doesn't depend on intimate knowledge of drive geometry, and the +>>drive should queue requests on the concrete level where geometry +>>matters. A drive shouldn't guess whether a process is trying to +>>read a file sequentially, and a kernel shouldn't guess whether +>>sector 30 is contiguous with sector 31 or not. +>> +>>__ +>>David B. Held +>>Software Engineer/Array Services Group +>>200 14th Ave. East, Sartell, MN 56377 +>>320.534.3637 320.253.7800 800.752.8129 +>> +>>---------------------------(end of broadcast)--------------------------- +>>TIP 7: don't forget to increase your free space map settings +>> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +From pgsql-performance-owner@postgresql.org Thu Apr 21 05:16:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 86EC753D06 + for ; + Thu, 21 Apr 2005 05:16:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00620-08 + for ; + Thu, 21 Apr 2005 08:15:50 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E2EA53CE7 + for ; + Thu, 21 Apr 2005 05:15:47 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id BC91C83D6E; Thu, 21 Apr 2005 10:15:47 +0200 (CEST) +Message-ID: <4267612C.10803@trust-factory.com> +Date: Thu, 21 Apr 2005 10:15:40 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <26710.1114007961@sss.pgh.pa.us> +In-Reply-To: <26710.1114007961@sss.pgh.pa.us> +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/550 +X-Sequence-Number: 11947 + +Tom Lane wrote: +> The explain shows no such thing. What is the *actual* runtime of +> each plan per EXPLAIN ANALYZE, please? + +Ok, it took 3.5 hours to complete. :-/ + +This is with the default cpu_tuple_cost = 0.01: + + Nested Loop (cost=252.80..233010147.16 rows=1035480320 width=98) +(actual time=0.369..12672213.137 rows=6171334 loops=1) + Join Filter: (("outer".starttimetrunc <= "inner".ts) AND +("outer".finishtimetrunc >= "inner".ts)) + -> Seq Scan on sessions us (cost=0.00..26822.36 rows=924536 +width=106) (actual time=0.039..5447.349 rows=924536 loops=1) + -> Materialize (cost=252.80..353.60 rows=10080 width=8) (actual +time=0.000..2.770 rows=10080 loops=924536) + -> Seq Scan on duration du (cost=0.00..252.80 rows=10080 +width=8) (actual time=0.019..13.397 rows=10080 loops=1) + Total runtime: 12674486.670 ms + +Once again with cpu_tuple_cost = 0.1: + + Nested Loop (cost=0.00..667684584.42 rows=1035480320 width=98) (actual +time=42.892..39877.928 rows=6171334 loops=1) + -> Seq Scan on sessions us (cost=0.00..110030.60 rows=924536 +width=106) (actual time=0.020..917.803 rows=924536 loops=1) + -> Index Scan using ix_du_ts on duration du (cost=0.00..604.46 +rows=1120 width=8) (actual time=0.004..0.011 rows=7 loops=924536) + Index Cond: (("outer".starttimetrunc <= du.ts) AND +("outer".finishtimetrunc >= du.ts)) + Total runtime: 41635.468 ms +(5 rows) + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 21 07:13:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B35853CA3 + for ; + Thu, 21 Apr 2005 07:13:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22470-07 + for ; + Thu, 21 Apr 2005 10:13:12 +0000 (GMT) +Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com + [66.111.4.25]) + by svr1.postgresql.org (Postfix) with ESMTP id AAD6053CA1 + for ; + Thu, 21 Apr 2005 07:13:11 -0300 (ADT) +Received: from web2.messagingengine.com (web2.internal [10.202.2.211]) + by frontend1.messagingengine.com (Postfix) with ESMTP id 24794C772D0 + for ; + Thu, 21 Apr 2005 06:13:13 -0400 (EDT) +Received: by web2.messagingengine.com (Postfix, from userid 99) + id 2B9D36F7; Thu, 21 Apr 2005 06:13:10 -0400 (EDT) +Message-Id: <1114078390.26441.232391808@webmail.messagingengine.com> +X-Sasl-Enc: 4SyexjuiD7vnH9F8E5oKhG/Ba7XirQDWvzYQvWDTVFoi 1114078390 +From: "David Roussel" +To: pgsql-performance@postgresql.org +Content-Disposition: inline +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset="ISO-8859-1" +MIME-Version: 1.0 +X-Mailer: MIME::Lite 1.5 (F2.73; T1.001; A1.64; B3.05; Q3.03) +Subject: How can an index be larger than a table +Date: Thu, 21 Apr 2005 11:13:10 +0100 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/551 +X-Sequence-Number: 11948 + +Hi, + +I have a series of tables with identical structure. Some contain a few +thousand rows and some contain 3,000,000 rows. Another applicate writes +the rows and my applicate reads then just by selecting where pk > +last_seen_pk limit 2000. + +I've found that one of the tables, when selecting from it that one of +the tables is many times slower than the others. + +For instance when reading data in batches of 2000 rows, it seems to take +26 seconds to query from dave_data_update_events with 1593600, but only +1 or two seconds to query from jane_data_update_events with 3100000 +rows! + +This is ther SQL used.... + + +| +|select +| events.event_id, ctrl.real_name, events.tsds, events.value, +| events.lds, events.correction, ctrl.type, ctrl.freq +|from dave_data_update_events events, dave_control ctrl +|where events.obj_id = ctrl.obj_id and +|events.event_id > 32128893::bigint +|order by events.event_id +|limit 2000 +| + +Here is the structure of the tables... + +| +|CREATE TABLE dave_control ( +| obj_id numeric(6,0) NOT NULL, +| real_name character varying(64) NOT NULL, +| "type" numeric(2,0) NOT NULL, +| freq numeric(2,0) NOT NULL +|); +| +|CREATE TABLE dave_data_update_events ( +| lds numeric(13,0) NOT NULL, +| obj_id numeric(6,0) NOT NULL, +| tsds numeric(13,0) NOT NULL, +| value character varying(22) NOT NULL, +| correction numeric(1,0) NOT NULL, +| delta_lds_tsds numeric(13,0) NOT NULL, +| event_id bigserial NOT NULL +|); +| +|CREATE UNIQUE INDEX dave_control_obj_id_idx ON dave_control USING btree +(obj_id); +|ALTER TABLE dave_control CLUSTER ON dave_control_obj_id_idx; +| +|CREATE UNIQUE INDEX dave_control_real_name_idx ON dave_control USING +btree (real_name); +| +|CREATE INDEX dave_data_update_events_lds_idx ON dave_data_update_events +USING btree (lds); +| +|CREATE INDEX dave_data_update_events_obj_id_idx ON +dave_data_update_events USING btree (obj_id); +| +|ALTER TABLE ONLY dave_control +| ADD CONSTRAINT dave_control_obj_id_key UNIQUE (obj_id); +| +|ALTER TABLE ONLY dave_control +| ADD CONSTRAINT dave_control_real_name_key UNIQUE (real_name); +| +|ALTER TABLE ONLY dave_data_update_events +| ADD CONSTRAINT dave_data_update_events_event_id_key UNIQUE +(event_id); +| + +There are several pairs of tables, but with names like rod, jane, +fredie, etc.. instead of dave. +The first thing to note about the scheme (not designed by me) is that +the control table is clustered on obj_id, but the data_update_events +table is not clustered. Does that mean the rows will be stored in order +of insert? That might be ok, because data_update_events table is like a +queue and I read it in the order the new rows are inserted. + +What also seems weird to me is that the control table has some unique +indexes created on it, but the data_upate_events table just has a unique +constraint. Will postgres use an index in the background to enforce +this constraint? + +When looking at the indexes on the all the tables in DbVisualiser my +colleague noticed that the cardinality of the indexes on the rod, jane +and fredie tables was consistent, but for dave the cardinality was +strange... + +| +|SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE +relname LIKE 'dave_data%'; +| +|relname relkind reltuples relpages +|======================================= ======= ========= ======== +|dave_data_update_events r 1593600.0 40209 +|dave_data_update_events_event_id_keyi1912320.0 29271 +|dave_data_update_events_event_id_seqS 1.0 1 +|dave_data_update_events_lds_idx i 1593600.0 6139 +|dave_data_update_events_obj_id_idx i 1593600.0 6139 +|iso_pjm_data_update_events_obj_id_idxi1593600.0 6139 +| + +Note that there are only 1593600 rows in the table, so why the 1912320 +figure? + +Of course I checked that the row count was correct... + +| +|EXPLAIN ANALYZE +|select count(*) from iso_pjm_data_update_events +| +|QUERY PLAN +|Aggregate (cost=60129.00..60129.00 rows=1 width=0) (actual +time=35933.292..35933.293 rows=1 loops=1) +| -> Seq Scan on iso_pjm_data_update_events (cost=0.00..56145.00 +rows=1593600 width=0) (actual time=0.213..27919.497 rows=1593600 +loops=1) +|Total runtime: 35933.489 ms +| + +and... + +| +|select count(*) from iso_pjm_data_update_events +| +|count +|1593600 +| + +so it's not that there are any undeleted rows lying around. + +So any comments on the index structure? Any ideas why the cardinality +of the index is greater than the number of rows in the table? Was it +because the table used to be larger? + +Also any ideas on how else to track down the big performance difference +between tables of the same structure? + + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 08:50:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 51C6053E13 + for ; + Thu, 21 Apr 2005 08:50:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54005-01 + for ; + Thu, 21 Apr 2005 11:49:55 +0000 (GMT) +Received: from hp.vpac.org (vpac.org [131.170.184.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 07F5053DC7 + for ; + Thu, 21 Apr 2005 08:49:52 -0300 (ADT) +Received: by hp.vpac.org (Postfix, from userid 557) + id A0EDFA1403C; Thu, 21 Apr 2005 21:49:53 +1000 (EST) +Received: from localhost (localhost [127.0.0.1]) + by hp.vpac.org (Postfix) with ESMTP id 9DB1B68103 + for ; + Thu, 21 Apr 2005 21:49:53 +1000 (EST) +Date: Thu, 21 Apr 2005 21:49:53 +1000 (EST) +From: "Shoaib Burq (VPAC)" +To: pgsql-performance@postgresql.org +Subject: two queries and dual cpu (perplexed) +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.204 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/552 +X-Sequence-Number: 11949 + +Hi everybody, + +One of our clients was using SQL-Server and decided to switch to +PostgreSQL 8.0.1. + +Hardware: Dual processor Intel(R) Xeon(TM) CPU 3.40GHz +OS: Enterprise Linux with 2.6.9-5 SMP kernel +Filesystem: ext3 +SHMMAX: $ cat /proc/sys/kernel/shmmax +6442450944 <--- beleive that's ~6.5 GB, total ram is 8GB +Database: 15GB in size with a few tables with over 80 million rows. + +Here is a snippit from the output of +SELECT oid , relname, relpages, reltuples + FROM pg_class ORDER BY relpages DESC; + oid | relname | relpages | reltuples +-----------+---------------------------------+----------+------------- + 16996 | CurrentAusClimate | 474551 | 8.06736e+07 + 16983 | ClimateChangeModel40 | 338252 | 5.31055e+07 + 157821816 | PK_CurrentAusClimate | 265628 | 8.06736e+07 + 157835995 | idx_climateid | 176645 | 8.06736e+07 + 157835996 | idx_ausposnum | 176645 | 8.06736e+07 + 157835997 | idx_climatevalue | 176645 | 8.06736e+07 + 157821808 | PK_ClimateModelChange_40 | 174858 | 5.31055e+07 + 157821788 | IX_iMonth001 | 116280 | 5.31055e+07 + 157821787 | IX_ClimateId | 116280 | 5.31055e+07 + 157821786 | IX_AusPosNumber | 116280 | 5.31055e+07 + 17034 | NeighbourhoodTable | 54312 | 1.00476e+07 + 157821854 | PK_NeighbourhoodTable | 27552 | 1.00476e+07 + 157821801 | IX_NeighbourhoodId | 22002 | 1.00476e+07 + 157821800 | IX_NAusPosNumber | 22002 | 1.00476e+07 + 157821799 | IX_AusPosNumber006 | 22002 | 1.00476e+07 +[...] + +To test the performance of the database we ran one of the most demanding +queries that exist with the following embarrassing results: + +Query Execution time on: +SQL-Server (dual processor xeon) 3min 11sec +PostgreSQL (SMP IBM Linux server) 5min 30sec + +Now I have not touch the $PGDATA/postgresql.conf (As I know very little +about memory tuning) Have run VACCUM & ANALYZE. + +The client understands that they may not match the performance for a +single query as there is no multithreading. So they asked me to +demonstrate the benefits of Postgresql's multiprocessing capabilities. + +To do that I modified the most demanding query to create a second query +and ran them in parallel: + +$ time ./run_test1.sh +$ cat ./run_test1.sh +/usr/bin/time -p psql -f ./q1.sql ausclimate > q1.out 2>q1.time & +/usr/bin/time -p psql -f ./q2.sql ausclimate > q2.out 2>q2.time + +and the time taken is *twice* that for the original. The modification was +minor. The queries do make use of both CPUs: + + 2388 postgres 16 0 79640 15m 11m R 80.9 0.2 5:05.81 postmaster + 2389 postgres 16 0 79640 15m 11m R 66.2 0.2 5:04.25 postmaster + +But I can't understand why there's no performance improvement and infact +there seems to be no benefit of multiprocessing. Any ideas? I don't know +enough about the locking procedures employed by postgres but one would +think this shouldn't be and issue with read-only queries. + +Please don't hesitate to ask me for more info like, the query or the +output of explain, or stats on memory usage. I just wanted to keep this +short and provide more info as the cogs start turning :-) + +Thanks & Regards +Shoaib + + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 09:14:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E47A953D04 + for ; + Thu, 21 Apr 2005 09:14:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60161-08 + for ; + Thu, 21 Apr 2005 12:14:35 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id DA82353E1E + for ; + Thu, 21 Apr 2005 09:14:33 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id 51F6C83D6D; Thu, 21 Apr 2005 14:14:35 +0200 (CEST) +Message-ID: <42679922.3040300@trust-factory.com> +Date: Thu, 21 Apr 2005 14:14:26 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: John A Meinel +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <42666890.1000401@arbash-meinel.com> + <42667219.7050907@trust-factory.com> + <4266773E.405@arbash-meinel.com> +In-Reply-To: <4266773E.405@arbash-meinel.com> +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/553 +X-Sequence-Number: 11950 + +Thanks a lot John for the correct search terms. :-) + +The suggestion in +http://archives.postgresql.org/pgsql-performance/2005-04/msg00029.php to +add a constraint that checks (finishtime >= starttime) does not make a +difference for me. Still seq scans are used. + +The width solution explained in +http://archives.postgresql.org/pgsql-performance/2005-04/msg00027.php +and +http://archives.postgresql.org/pgsql-performance/2005-04/msg00116.php +does make a huge difference when selecting 1 timestamp using a BETWEEN +(2ms vs 2sec), but as soon as I put 2 timestamps in a table and try a +join, everything goes south (7.7sec). I have 10k timestamps in the +duration table. :-( + +I'm getting more confused on how the planner decides to use indexes. For +example, if I try: + +explain analyze select us.oid from sessions us where '2005-04-10 +23:11:00' between us.starttimetrunc and us.finishtimetrunc; + + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using sessions_st_ft_idx2 on sessions us +(cost=0.00..18320.73 rows=4765 width=4) (actual time=0.063..2.455 +rows=279 loops=1) + Index Cond: (('2005-04-10 23:11:00'::timestamp without time zone <= +finishtimetrunc) AND ('2005-04-10 23:11:00'::timestamp without time zone +>= starttimetrunc)) + Total runtime: 2.616 ms + +is uses the index! However, if I change the date it does not: + +explain analyze select us.oid from sessions us where '2005-04-09 +23:11:00' between us.starttimetrunc and us.finishtimetrunc; + + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------- +Seq Scan on sessions us (cost=0.00..68173.04 rows=41575 width=4) +(actual time=553.424..1981.695 rows=64 loops=1) + Filter: (('2005-04-09 23:11:00'::timestamp without time zone >= +starttimetrunc) AND ('2005-04-09 23:11:00'::timestamp without time zone +<= finishtimetrunc)) + Total runtime: 1981.802 ms + +The times in sessions go from '2005-04-04 00:00:00' to '2005-04-10 +23:59:00' so both are valid times to query for, but April 10th is more +towards the end. A little experimenting shows that if I go earlier than +'2005-04-10 13:26:15' seq scans are being used. I was thinking this +timestamp would have something to do with the histogram_bounds in +pg_stats, but I cannot find a match: + + starttimetrunc | {"2005-04-04 00:05:00","2005-04-04 +11:49:00","2005-04-04 22:03:00","2005-04-05 10:54:00","2005-04-05 +21:08:00","2005-04-06 10:28:00","2005-04-07 01:57:00","2005-04-07 +15:55:00","2005-04-08 10:18:00","2005-04-08 17:12:00","2005-04-10 23:57:00"} + finishtimetrunc | {"2005-04-04 00:05:00.93","2005-04-04 +11:53:00.989999","2005-04-04 22:35:00.38","2005-04-05 +11:13:00.029999","2005-04-05 21:31:00.989999","2005-04-06 +10:45:01","2005-04-07 02:08:08.25","2005-04-07 16:20:00.93","2005-04-08 +10:25:00.409999","2005-04-08 17:15:00.949999","2005-04-11 02:08:19"} + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + Have you visited our new DNA Portal? +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sat Apr 23 01:42:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B2A653724 + for ; + Thu, 21 Apr 2005 09:24:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61945-07 + for ; + Thu, 21 Apr 2005 12:24:21 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 20F85536E9 + for ; + Thu, 21 Apr 2005 09:24:18 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id D544230952; Thu, 21 Apr 2005 14:23:11 +0200 (MET DST) +From: Daniel Schuchardt +X-Newsgroups: pgsql.performance +Subject: Re: two queries and dual cpu (perplexed) +Date: Thu, 21 Apr 2005 14:19:06 +0200 +Organization: Hub.Org Networking Services +Lines: 89 +Message-ID: +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: de-DE, de, en-us, en +In-Reply-To: +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/638 +X-Sequence-Number: 12035 + +Shoaib Burq (VPAC) schrieb: + +>Hi everybody, +> +>One of our clients was using SQL-Server and decided to switch to +>PostgreSQL 8.0.1. +> +>Hardware: Dual processor Intel(R) Xeon(TM) CPU 3.40GHz +>OS: Enterprise Linux with 2.6.9-5 SMP kernel +>Filesystem: ext3 +>SHMMAX: $ cat /proc/sys/kernel/shmmax +>6442450944 <--- beleive that's ~6.5 GB, total ram is 8GB +>Database: 15GB in size with a few tables with over 80 million rows. +> +>Here is a snippit from the output of +>SELECT oid , relname, relpages, reltuples +> FROM pg_class ORDER BY relpages DESC; +> oid | relname | relpages | reltuples +>-----------+---------------------------------+----------+------------- +> 16996 | CurrentAusClimate | 474551 | 8.06736e+07 +> 16983 | ClimateChangeModel40 | 338252 | 5.31055e+07 +> 157821816 | PK_CurrentAusClimate | 265628 | 8.06736e+07 +> 157835995 | idx_climateid | 176645 | 8.06736e+07 +> 157835996 | idx_ausposnum | 176645 | 8.06736e+07 +> 157835997 | idx_climatevalue | 176645 | 8.06736e+07 +> 157821808 | PK_ClimateModelChange_40 | 174858 | 5.31055e+07 +> 157821788 | IX_iMonth001 | 116280 | 5.31055e+07 +> 157821787 | IX_ClimateId | 116280 | 5.31055e+07 +> 157821786 | IX_AusPosNumber | 116280 | 5.31055e+07 +> 17034 | NeighbourhoodTable | 54312 | 1.00476e+07 +> 157821854 | PK_NeighbourhoodTable | 27552 | 1.00476e+07 +> 157821801 | IX_NeighbourhoodId | 22002 | 1.00476e+07 +> 157821800 | IX_NAusPosNumber | 22002 | 1.00476e+07 +> 157821799 | IX_AusPosNumber006 | 22002 | 1.00476e+07 +>[...] +> +>To test the performance of the database we ran one of the most demanding +>queries that exist with the following embarrassing results: +> +>Query Execution time on: +>SQL-Server (dual processor xeon) 3min 11sec +>PostgreSQL (SMP IBM Linux server) 5min 30sec +> +>Now I have not touch the $PGDATA/postgresql.conf (As I know very little +>about memory tuning) Have run VACCUM & ANALYZE. +> +>The client understands that they may not match the performance for a +>single query as there is no multithreading. So they asked me to +>demonstrate the benefits of Postgresql's multiprocessing capabilities. +> +>To do that I modified the most demanding query to create a second query +>and ran them in parallel: +> +>$ time ./run_test1.sh +>$ cat ./run_test1.sh +>/usr/bin/time -p psql -f ./q1.sql ausclimate > q1.out 2>q1.time & +>/usr/bin/time -p psql -f ./q2.sql ausclimate > q2.out 2>q2.time +> +>and the time taken is *twice* that for the original. The modification was +>minor. The queries do make use of both CPUs: +> +> 2388 postgres 16 0 79640 15m 11m R 80.9 0.2 5:05.81 postmaster +> 2389 postgres 16 0 79640 15m 11m R 66.2 0.2 5:04.25 postmaster +> +>But I can't understand why there's no performance improvement and infact +>there seems to be no benefit of multiprocessing. Any ideas? I don't know +>enough about the locking procedures employed by postgres but one would +>think this shouldn't be and issue with read-only queries. +> +>Please don't hesitate to ask me for more info like, the query or the +>output of explain, or stats on memory usage. I just wanted to keep this +>short and provide more info as the cogs start turning :-) +> +>Thanks & Regards +>Shoaib +> +> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> +> +> +I think you should post the SQL-Statement and EXPLAIN ANALYSE - Output +here to get a usefull awnser. +(EXPLAIN ANALYSE SELECT * FROM x WHERE ---) + +Daniel + +From pgsql-performance-owner@postgresql.org Thu Apr 21 09:24:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0433753756 + for ; + Thu, 21 Apr 2005 09:24:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62393-04 + for ; + Thu, 21 Apr 2005 12:24:23 +0000 (GMT) +Received: from sccrmhc14.comcast.net (sccrmhc14.comcast.net [204.127.202.59]) + by svr1.postgresql.org (Postfix) with ESMTP id D8FFE536BC + for ; + Thu, 21 Apr 2005 09:24:19 -0300 (ADT) +Received: from jefftrout.com ([24.61.201.181]) + by comcast.net (sccrmhc14) with SMTP + id <2005042112242201400f5jd5e>; Thu, 21 Apr 2005 12:24:23 +0000 +Received: (qmail 48030 invoked from network); 21 Apr 2005 12:24:56 -0000 +Received: from waltham-nat.ma.lycos.com (HELO ?10.124.7.66?) (209.202.205.1) + by 192.168.0.109 with SMTP; 21 Apr 2005 12:24:56 -0000 +In-Reply-To: +References: +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <8c459b7b96e6c310d641cebdfa8dcab6@torgo.978.org> +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Jeff +Subject: Re: two queries and dual cpu (perplexed) +Date: Thu, 21 Apr 2005 08:24:15 -0400 +To: "Shoaib Burq (VPAC)" +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.191 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, + RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200504/554 +X-Sequence-Number: 11951 + + +On Apr 21, 2005, at 7:49 AM, Shoaib Burq (VPAC) wrote: + +> Now I have not touch the $PGDATA/postgresql.conf (As I know very little +> about memory tuning) Have run VACCUM & ANALYZE. +> +You should really, really bump up shared_buffers and given you have 8GB +of ram this query would likely benefit from more work_mem. + +> and the time taken is *twice* that for the original. The modification +> was +> minor. The queries do make use of both CPUs: +> +Is this an IO intensive query? If running both in parellel results in +2x the run time and you have sufficient cpus it would (to me) indicate +you don't have enough IO bandwidth to satisfy the query. + +Can we see an explain analyze of the query? Could be a bad plan and a +bad plan will never give good performance. + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 09:33:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 614B65372F + for ; + Thu, 21 Apr 2005 09:33:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65143-01 + for ; + Thu, 21 Apr 2005 12:33:23 +0000 (GMT) +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 70B1753678 + for ; + Thu, 21 Apr 2005 09:33:20 -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 j3LCXQqp031149; + Thu, 21 Apr 2005 22:33:26 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + j3LCXQ4U031146; Thu, 21 Apr 2005 22:33:26 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Thu, 21 Apr 2005 22:33:26 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: Jeff +Cc: "Shoaib Burq (VPAC)" , + pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: <8c459b7b96e6c310d641cebdfa8dcab6@torgo.978.org> +Message-ID: +References: + <8c459b7b96e6c310d641cebdfa8dcab6@torgo.978.org> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/555 +X-Sequence-Number: 11952 + +On Thu, 21 Apr 2005, Jeff wrote: + +> +> On Apr 21, 2005, at 7:49 AM, Shoaib Burq (VPAC) wrote: +> +> > Now I have not touch the $PGDATA/postgresql.conf (As I know very little +> > about memory tuning) Have run VACCUM & ANALYZE. +> > +> You should really, really bump up shared_buffers and given you have 8GB +> of ram this query would likely benefit from more work_mem. + +I'd recommend shared_buffers = 10600. Its possible that work_mem in the +hundreds of megabytes might have a good impact, but its hard to say +without seeing the EXPLAIN ANALYZE output. + +Gavin + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 01:45:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CFB8538AA + for ; + Thu, 21 Apr 2005 09:36:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65782-01 + for ; + Thu, 21 Apr 2005 12:36:25 +0000 (GMT) +Received: from is.rice.edu (is.rice.edu [128.42.42.24]) + by svr1.postgresql.org (Postfix) with ESMTP id B26ED5388B + for ; + Thu, 21 Apr 2005 09:36:25 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by is.rice.edu (Postfix) with ESMTP id A92C84182B; + Thu, 21 Apr 2005 07:36:28 -0500 (CDT) +Received: from is.rice.edu ([127.0.0.1]) + by localhost (it.is.rice.edu [127.0.0.1]) (amavisd-new, + port 10024) with LMTP + id 11211-01-33; Thu, 21 Apr 2005 07:36:24 -0500 (CDT) +Received: by is.rice.edu (Postfix, from userid 18612) + id 085E441AF6; Thu, 21 Apr 2005 07:36:23 -0500 (CDT) +Date: Thu, 21 Apr 2005 07:36:23 -0500 +From: Kenneth Marshall +To: Jeff +Cc: "Shoaib Burq (VPAC)" , + pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +Message-ID: <20050421123623.GA9371@it.is.rice.edu> +References: + <8c459b7b96e6c310d641cebdfa8dcab6@torgo.978.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <8c459b7b96e6c310d641cebdfa8dcab6@torgo.978.org> +User-Agent: Mutt/1.4.2i +X-Virus-Scanned: by amavis-2.2.1 at is.rice.edu +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/639 +X-Sequence-Number: 12036 + +On Thu, Apr 21, 2005 at 08:24:15AM -0400, Jeff wrote: +> +> On Apr 21, 2005, at 7:49 AM, Shoaib Burq (VPAC) wrote: +> +> >Now I have not touch the $PGDATA/postgresql.conf (As I know very little +> >about memory tuning) Have run VACCUM & ANALYZE. +> > +> You should really, really bump up shared_buffers and given you have 8GB +> of ram this query would likely benefit from more work_mem. +> +> >and the time taken is *twice* that for the original. The modification +> >was +> >minor. The queries do make use of both CPUs: +> > +> Is this an IO intensive query? If running both in parellel results in +> 2x the run time and you have sufficient cpus it would (to me) indicate +> you don't have enough IO bandwidth to satisfy the query. +> + +I would add to Jeff's comments, that the default configuration parameters +are fairly-to-very conservative which tends to produce plans with more I/O. +Bumping your shared_buffers, work_mem, and effective_cache_size should +allow the planner to favor plans that utilize more memory but require +less I/O. Also, with small amounts of work_mem, hash joins cannot be +used and the planner will resort to nested loops. + +Ken + +From pgsql-performance-owner@postgresql.org Thu Apr 21 09:44:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 45C24536BC + for ; + Thu, 21 Apr 2005 09:44:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66516-03 + for ; + Thu, 21 Apr 2005 12:44:49 +0000 (GMT) +Received: from hp.vpac.org (vpac.org [131.170.184.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 132835294F + for ; + Thu, 21 Apr 2005 09:44:48 -0300 (ADT) +Received: by hp.vpac.org (Postfix, from userid 557) + id CE1F3A1403C; Thu, 21 Apr 2005 22:44:51 +1000 (EST) +Received: from localhost (localhost [127.0.0.1]) + by hp.vpac.org (Postfix) with ESMTP id CD00A68103; + Thu, 21 Apr 2005 22:44:51 +1000 (EST) +Date: Thu, 21 Apr 2005 22:44:51 +1000 (EST) +From: "Shoaib Burq (VPAC)" +To: Jeff +Cc: pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: <8c459b7b96e6c310d641cebdfa8dcab6@torgo.978.org> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/556 +X-Sequence-Number: 11953 + + +here's explain sorry about the mess: I can attach it as text-file if you +like. + +ausclimate=# explain ANALYZE select count(*) from "getfutureausclimate"; + + + +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + Aggregate (cost=1069345.85..1069345.85 rows=1 width=0) (actual +time=443241.241..443241.242 rows=1 loops=1) + -> Subquery Scan getfutureausclimate (cost=1069345.61..1069345.81 +rows=16 width=0) (actual time=411449.034..436165.259 rows=13276368 +loops=1) + -> Sort (cost=1069345.61..1069345.65 rows=16 width=58) (actual +time=411449.026..426001.199 rows=13276368 loops=1) + Sort Key: "Aus40_DEM"."AusPosNumber", +"CurrentAusClimate"."iMonth" + -> Nested Loop (cost=2.19..1069345.29 rows=16 width=58) +(actual time=135.390..366902.373 rows=13276368 loops=1) + -> Nested Loop (cost=2.19..1067304.07 rows=44 +width=68) (actual time=107.627..186390.137 rows=13276368 loops=1) + -> Nested Loop (cost=2.19..1067038.94 rows=44 +width=52) (actual time=87.255..49743.796 rows=13276368 loops=1) + -> Nested Loop (cost=2.19..8.09 rows=1 +width=32) (actual time=52.684..52.695 rows=1 loops=1) + -> Merge Join (cost=2.19..2.24 +rows=1 width=24) (actual time=28.000..28.007 rows=1 loops=1) + Merge Cond: +("outer"."ClimateId" = "inner"."ClimateId") + -> Sort (cost=1.17..1.19 +rows=7 width=10) (actual time=10.306..10.307 rows=3 loops=1) + Sort Key: +"ClimateVariables"."ClimateId" + -> Seq Scan on +"ClimateVariables" (cost=0.00..1.07 rows=7 width=10) (actual +time=10.277..10.286 rows=7 loops=1) + -> Sort (cost=1.02..1.02 +rows=1 width=14) (actual time=17.679..17.680 rows=1 loops=1) + Sort Key: +"GetFutureClimateParameters"."ClimateId" + -> Seq Scan on +"GetFutureClimateParameters" (cost=0.00..1.01 rows=1 width=14) (actual +time=17.669..17.671 rows=1 loops=1) + -> Index Scan using +"PK_ScenarioEmissionLevels" on "ScenarioEmissionLevels" (cost=0.00..5.83 +rows=1 width=18) (actual time=24.676..24.679 rows=1 loops=1) + Index Cond: +(("ScenarioEmissionLevels"."ScenarioId" = "outer"."ScenarioId") AND +("ScenarioEmissionLevels"."iYear" = "outer"."iYear") AND +("ScenarioEmissionLevels"."LevelId" = "outer"."LevelId")) + -> Index Scan using "IX_ClimateId" on +"ClimateChangeModel40" (cost=0.00..1063711.75 rows=265528 width=20) +(actual time=34.564..19435.855 rows=13276368 loops=1) + Index Cond: ("outer"."ClimateId" = +"ClimateChangeModel40"."ClimateId") + -> Index Scan using "PK_Aus40_DEM" on +"Aus40_DEM" (cost=0.00..6.01 rows=1 width=16) (actual time=0.005..0.006 +rows=1 loops=13276368) + Index Cond: ("outer"."AusPosNumber" = +"Aus40_DEM"."AusPosNumber") + -> Index Scan using "PK_CurrentAusClimate" on +"CurrentAusClimate" (cost=0.00..46.20 rows=11 width=14) (actual +time=0.007..0.009 rows=1 loops=13276368) + Index Cond: (("CurrentAusClimate"."ClimateId" = +"outer"."ClimateId") AND ("outer"."AusPosNumber" = +"CurrentAusClimate"."AusPosNum") AND ("CurrentAusClimate"."iMonth" = +"outer"."iMonth")) + Total runtime: 443983.269 ms +(25 rows) + + +Sheeeesshh... + +> You should really, really bump up shared_buffers and given you have 8GB +> of ram this query would likely benefit from more work_mem. + +I actually tried that and there was a decrease in performance. Are the +shared_buffers and work_mem the only things I should change to start with? +If so what's the reasoning. + + +> Is this an IO intensive query? If running both in parellel results in +> 2x the run time and you have sufficient cpus it would (to me) indicate +> you don't have enough IO bandwidth to satisfy the query. + +Yes I think so too: ... I am just compiling some io stats... + +Also will jump on to irc... + +> +Whoa! thanks all... I am overwhelmed with the help I am getting... I love +it! + + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 09:56:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F3ED5388D + for ; + Thu, 21 Apr 2005 09:56:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67676-09 + for ; + Thu, 21 Apr 2005 12:56:08 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CD7753885 + for ; + Thu, 21 Apr 2005 09:56:07 -0300 (ADT) +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.7226.0 +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Thu, 21 Apr 2005 08:56:09 -0400 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C263E@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +thread-index: AcVGLP6O+J6KlaLSQemhLZpjvXKgzAAQdo6A +From: "Merlin Moncure" +To: "Tom Lane" +Cc: "Postgresql Performance" , + "Joel Fradkin" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.058 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/557 +X-Sequence-Number: 11954 + +> John A Meinel writes: +> > Joel Fradkin wrote: +> >> Postgres was on the second run +> >> Total query runtime: 17109 ms. +> >> Data retrieval runtime: 72188 ms. +> >> 331640 rows retrieved. +>=20 +> > How were you measuring "data retrieval time"? +>=20 +> I suspect he's using pgadmin. We've seen reports before suggesting +that +> pgadmin can be amazingly slow, eg here +> http://archives.postgresql.org/pgsql-performance/2004-10/msg00427.php +> where the *actual* data retrieval time as shown by EXPLAIN ANALYZE +> was under three seconds, but pgadmin claimed the query runtime was 22 +> sec and data retrieval runtime was 72 sec. + +The problem is that pgAdmin takes your query results and puts it in a +grid. The grid is not designed to be used in that way for large +datasets. The time complexity is not linear and really breaks down +around 10k-100k rows depending on various factors. pgAdmin users just +have to become used to it and use limit or the filter feature at +appropriate times. + +The ms sql enterprise manager uses cursors which has its own set of +nasty issues (no mvcc). + +In fairness, unless you are running with \a switch, psql adds a fair +amount of time to the query too. + +Joel: +"Postgres was on the second run +Total query runtime: 17109 ms. +Data retrieval runtime: 72188 ms. +331640 rows retrieved." + +The Data retrieval runtime is time spend by pgAdmin formatting, etc. +The query runtime is the actual timing figure you should be concerned +with (you are not comparing apples to apples). I can send you a utility +I wrote in Delphi which adds only a few seconds overhead for 360k result +set. Or, go into psql, throw \a switch, and run query. + +or:=20 +psql -A -c "select * from myview where x" > output.txt + +it should finish the above in 16-17 sec plus the time to write out the +file. + +Joel, I have a lot of experience with all three databases you are +evaluating and you are making a huge mistake switching to mysql. you +can make a decent case for ms sql, but it's quite expensive at your +level of play as you know. + +Merlin + + + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 10:06:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 810465387A + for ; + Thu, 21 Apr 2005 10:06:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71255-05 + for ; + Thu, 21 Apr 2005 13:06:00 +0000 (GMT) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.183]) + by svr1.postgresql.org (Postfix) with ESMTP id B017B536EB + for ; + Thu, 21 Apr 2005 10:05:56 -0300 (ADT) +Received: from [212.227.126.207] (helo=mrelayng.kundenserver.de) + by moutng.kundenserver.de with esmtp (Exim 3.35 #1) + id 1DObNN-0005gh-00; Thu, 21 Apr 2005 15:05:49 +0200 +Received: from [80.129.141.79] (helo=pse.dyndns.org) + by mrelayng.kundenserver.de with asmtp (TLSv1:EDH-RSA-DES-CBC3-SHA:168) + (Exim 3.35 #1) id 1DObNM-0000kP-00; Thu, 21 Apr 2005 15:05:49 +0200 +Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) + id 1DObNL-0002Gt-69; Thu, 21 Apr 2005 15:05:47 +0200 +Message-ID: <4267A52A.8080504@pse-consulting.de> +Date: Thu, 21 Apr 2005 13:05:46 +0000 +From: Andreas Pflug +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: 'John A Meinel' , josh@agliodbs.com, + pgsql-performance@postgresql.org +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +References: <001901c54608$b70ccfc0$797ba8c0@jfradkin> +In-Reply-To: <001901c54608$b70ccfc0$797ba8c0@jfradkin> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + auth:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/558 +X-Sequence-Number: 11955 + +Joel Fradkin wrote: +> I did think of something similar just loading the data tables with junk +> records and I may visit that idea with Josh. +> +> I did just do some comparisons on timing of a plain select * from tbl where +> indexed column = x and it was considerably slower then both MSSQL and MYSQL, +> so I am still a bit confused. This still might be configuration issue (I ran +> on my 2gig desktop and the 8 gig Linux box comparisons were all ran on the +> same machines as far MSSQL, MYSQL, and Postgres. +> I turned off postgres when running MYSQL and turned off MYSQL when running +> postgres, MSSQL had one of the two running while I tested it. +> +> For the 360,000 records returned MYSQL did it in 40 seconds first run and 17 +> seconds second run. +> +> MSSQL did it in 56 seconds first run and 16 seconds second run. +> +> Postgres was on the second run +> Total query runtime: 17109 ms. +> Data retrieval runtime: 72188 ms. +> 331640 rows retrieved. + +Beware! + From the data, I can see that you're probably using pgAdmin3. +The time to execute your query including transfer of all data to the +client is 17s in this example, while displaying it (i.e. pure GUI and +memory alloc stuff) takes 72s. Execute to a file to avoid this. + +Regards, +Andreas + +From pgsql-performance-owner@postgresql.org Thu Apr 21 10:29:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1ED2352A48 + for ; + Thu, 21 Apr 2005 10:29:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77303-08 + for ; + Thu, 21 Apr 2005 13:29:10 +0000 (GMT) +Received: from pws.com.au (mail.pws.com.au [210.23.138.139]) + by svr1.postgresql.org (Postfix) with SMTP id B996D5394F + for ; + Thu, 21 Apr 2005 10:29:06 -0300 (ADT) +Received: (qmail 20934 invoked from network); 21 Apr 2005 13:29:07 -0000 +Received: from unknown (HELO wizzard.pws.com.au) + (russell@pws.com.au@138.217.54.70) + by mail.pws.com.au with SMTP; 21 Apr 2005 13:29:07 -0000 +From: Russell Smith +To: "Shoaib Burq (VPAC)" +Subject: Re: two queries and dual cpu (perplexed) +Date: Thu, 21 Apr 2005 23:29:05 +1000 +User-Agent: KMail/1.7.2 +Cc: Jeff , pgsql-performance@postgresql.org +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200504212329.06343.mr-russ@pws.com.au> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/559 +X-Sequence-Number: 11956 + +On Thu, 21 Apr 2005 10:44 pm, Shoaib Burq (VPAC) wrote: +> =A0-> =A0Nested Loop =A0(cost=3D2.19..1069345.29 rows=3D16 width=3D58) (= +actual time=3D135.390..366902.373 rows=3D13276368 loops=3D1) +> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-> =A0Nested Loop =A0(cost=3D2= +=2E19..1067304.07 rows=3D44 width=3D68) (actual time=3D107.627..186390.137 = +rows=3D13276368 loops=3D1) +> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-> =A0Nested Loop = +=A0(cost=3D2.19..1067038.94 rows=3D44 width=3D52) (actual time=3D87.255..49= +743.796 rows=3D13276368 loops=3D1) + +OUCH, OUCH, OUCH. + +Most if not all of the time is going on nested loop joins. The tuple estim= +ates are off by a factore of 10^6 which is means it's chosing the wrong +join type. + +you could set enable_seqscan to OFF; to test what he performance is like w= +ith a different plan, and then set it back on. + +However you really need to get the row count estimates up to something comp= +arable. within a factor of 10 at least. +A number of the other rows estimates seem to be off by a reasonable amount = +too. You may want to bump up the statistics on the relevant +columns. I can't find what they are from looking at that, I probably shoul= +d be able too, but it's late. + +If you get the stats up to something near the real values, then the planner= + will choose a different plan, which should give a huge performance +increase. + +Regards + +Russell Smith. + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 10:33:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2348053931 + for ; + Thu, 21 Apr 2005 10:32:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78159-06 + for ; + Thu, 21 Apr 2005 13:32:04 +0000 (GMT) +Received: from hp.vpac.org (vpac.org [131.170.184.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 90C345396F + for ; + Thu, 21 Apr 2005 10:32:03 -0300 (ADT) +Received: by hp.vpac.org (Postfix, from userid 557) + id E6B84A1403C; Thu, 21 Apr 2005 23:32:06 +1000 (EST) +Received: from localhost (localhost [127.0.0.1]) + by hp.vpac.org (Postfix) with ESMTP id E319D68103 + for ; + Thu, 21 Apr 2005 23:32:06 +1000 (EST) +Date: Thu, 21 Apr 2005 23:32:06 +1000 (EST) +From: "Shoaib Burq (VPAC)" +To: pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.102 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/560 +X-Sequence-Number: 11957 + + +here are some i/o stats with the unchanged postgresql.conf. Gonna change +it now and have another go. + + +[postgres@dbsql1 MultiCPU_test]$ vmstat 10 +procs -----------memory---------- ---swap-- -----io---- --system-- +----cpu---- + r b swpd free buff cache si so bi bo in cs us sy +id wa + 0 0 25808 710356 6348860 972052 2 4 73 29 1 3 1 0 +99 0 + 2 0 25808 647636 6348960 1034784 0 0 3226 3048 1054 92819 55 19 +25 1 + 2 0 25808 585684 6349032 1096660 0 0 3203 3057 1053 96375 55 19 +25 1 + 2 0 25808 521940 6349112 1160364 0 0 3388 2970 1052 95563 54 19 +26 1 + 2 0 25808 463636 6349184 1218568 0 0 2804 3037 1048 93560 55 19 +25 1 + 2 0 25808 405460 6349264 1276696 0 0 2794 3047 1046 96971 55 19 +25 1 + 2 0 25808 343956 6349340 1338160 0 0 3151 3040 1049 96629 55 20 +25 1 + 2 0 25808 287252 6349412 1394732 0 0 2666 2990 1045 95173 54 20 +25 1 + 2 0 25808 230804 6349484 1451168 0 0 2678 2966 1044 95577 54 19 +26 1 + 2 0 25808 169428 6349560 1512428 0 0 3164 3015 1048 98451 55 19 +25 1 + 2 0 25808 110484 6349640 1571304 0 0 2910 2970 1050 98214 55 20 +25 0 + 0 0 25808 50260 6349716 1631408 0 0 3049 3015 1049 99830 55 20 +25 1 + 1 0 25808 8512 6349788 1673156 0 0 2934 2959 1047 95940 54 19 +24 3 + 2 1 25808 8768 6349796 1672944 0 0 2552 2984 1043 97893 55 19 +18 8 + 1 1 25808 8384 6349824 1673256 0 0 2596 3032 1051 94646 55 19 +19 6 + 2 1 25808 8960 6349856 1672680 0 0 2982 3028 1052 94486 55 20 +19 6 + 1 1 25808 8960 6349884 1672584 0 0 3125 2919 1052 86969 52 20 +19 8 + 2 0 25808 6196 6349912 1675276 0 0 2809 3064 1046 99147 55 20 +19 5 + 1 1 25808 9216 6349976 1672152 0 0 2898 3076 1047 93271 55 19 +21 6 + 2 0 25808 6580 6349316 1663972 0 0 3150 2982 1048 94964 54 22 +20 4 + 2 0 25808 7692 6349348 1674480 0 0 2742 3006 1045 97488 54 21 +21 4 + 2 1 25808 8232 6346244 1676700 0 0 2900 3022 1048 92496 54 20 +19 8 + 2 0 25808 7104 6346192 1678044 0 0 3284 2958 1057 97265 55 20 +18 7 + 2 0 25808 8488 6346168 1676776 0 0 2609 3031 1047 93965 55 19 +20 7 + 2 1 25808 8680 6346184 1676488 0 0 3067 3044 1051 96594 55 19 +19 6 + 2 0 25808 8576 6346168 1676640 0 0 2900 3070 1047 96300 55 19 +20 6 + 2 1 25808 9152 6346156 1676176 0 0 3010 2993 1049 98271 55 20 +19 7 + 2 0 25808 7040 6346172 1678200 0 0 3242 3034 1050 97669 55 20 +21 4 + 1 1 25808 8900 6346192 1676344 0 0 2859 3014 1052 91220 53 19 +21 6 + 2 1 25808 8512 6346188 1676824 0 0 2737 2960 1049 100609 55 +20 18 6 + 2 0 25808 7204 6346236 1678000 0 0 2972 3045 1050 94851 55 19 +17 9 + 1 0 25808 7116 6346208 1678028 0 0 3053 2996 1048 98901 55 19 +20 5 + 2 1 25808 9180 6346196 1676068 0 0 2857 3067 1047 100629 56 +21 20 3 +procs -----------memory---------- ---swap-- -----io---- --system-- +----cpu---- + r b swpd free buff cache si so bi bo in cs us sy +id wa + 3 1 25808 8896 6346172 1676500 0 0 3138 3022 1049 97937 55 20 +20 5 + 2 1 25808 9088 6346188 1676212 0 0 2844 3022 1047 97664 55 19 +20 5 + 1 1 25808 8920 6346248 1676288 0 0 3017 3024 1049 99644 55 20 +17 7 + 1 1 25808 8064 6346116 1677168 0 0 2824 3037 1047 99171 55 20 +19 5 + 2 1 25820 8472 6344336 1678596 0 0 2969 2957 1047 96396 54 21 +18 7 + 2 1 25820 9208 6344300 1677884 0 0 3072 3031 1050 95017 54 19 +22 5 + 1 0 25820 7848 6344328 1679148 0 0 3229 3011 1050 97108 55 19 +20 5 + 2 1 25820 8960 6344348 1678040 0 0 2701 2954 1046 98485 54 20 +21 5 + 2 0 25820 7900 6344368 1679244 0 0 2604 2931 1044 97198 54 20 +19 7 + 2 0 25820 9240 6344424 1677896 0 0 2990 3015 1048 102414 56 +20 19 5 + 2 0 25820 8924 6344436 1678088 0 0 3256 2991 1049 96709 55 19 +21 5 + 1 1 25820 8900 6344456 1678204 0 0 2761 3030 1051 96498 55 20 +20 5 + 2 0 25820 7628 6344440 1679444 0 0 2952 3012 1053 96534 55 20 +19 6 + 2 0 25820 7080 6344472 1679956 0 0 2848 3079 1050 95074 56 19 +19 6 + 2 0 25820 8928 6344444 1678080 0 0 2985 3021 1049 96806 55 20 +18 7 + 2 1 25820 7976 6344976 1676892 11 0 3429 3062 1083 92817 55 19 +18 8 + 2 0 25820 8096 6345080 1676652 0 0 2662 2989 1056 91921 54 19 +17 10 + 1 0 25820 7424 6345128 1677352 0 0 2956 3029 1054 99385 56 19 +20 5 + 2 0 25820 6664 6345232 1677724 0 0 3358 3030 1064 95929 55 19 +21 5 + 1 0 25820 7268 6345320 1676956 0 0 2681 3012 1082 97744 54 20 +18 7 + 2 0 25820 6944 6345364 1677184 0 0 3156 3022 1061 98055 55 19 +22 4 + 2 0 25820 8668 6345420 1675428 0 0 2990 3018 1050 94734 55 19 +22 5 + 2 1 25820 8724 6345464 1675452 0 0 2677 2967 1055 100760 55 +20 18 7 + 2 1 25820 9260 6345508 1674796 0 0 3296 3233 1054 99711 55 20 +20 5 + 2 0 25820 6196 6345556 1677944 0 0 2861 2950 1066 93289 53 19 +23 6 + 2 0 25820 8052 6345620 1675908 0 0 3012 2920 1051 94428 54 19 +20 7 + 2 1 25820 9000 6345672 1675040 0 0 2645 2980 1045 99992 56 20 +17 8 + 2 1 25820 8296 6345728 1675732 0 0 3216 3058 1052 91934 54 19 +21 5 + 2 0 25820 7900 6345796 1676072 0 0 3009 3022 1052 96303 55 19 +20 7 + 2 0 25820 8516 6345844 1675344 0 0 2586 2956 1048 95812 54 20 +19 8 + 2 1 25820 9000 6345892 1674752 0 0 3225 3028 1055 99786 54 20 +21 5 + 0 1 25820 9128 6345768 1674684 0 1 2868 3016 1049 98301 55 21 +19 6 + 2 1 25820 8160 6345828 1675576 0 0 3079 3056 1050 93725 55 19 +21 5 + + + + +On Thu, 21 Apr 2005, Shoaib Burq (VPAC) wrote: + +> +> here's explain sorry about the mess: I can attach it as text-file if you +> like. +> +> ausclimate=# explain ANALYZE select count(*) from "getfutureausclimate"; +> +> +> +> QUERY PLAN +> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +> Aggregate (cost=1069345.85..1069345.85 rows=1 width=0) (actual +> time=443241.241..443241.242 rows=1 loops=1) +> -> Subquery Scan getfutureausclimate (cost=1069345.61..1069345.81 +> rows=16 width=0) (actual time=411449.034..436165.259 rows=13276368 +> loops=1) +> -> Sort (cost=1069345.61..1069345.65 rows=16 width=58) (actual +> time=411449.026..426001.199 rows=13276368 loops=1) +> Sort Key: "Aus40_DEM"."AusPosNumber", +> "CurrentAusClimate"."iMonth" +> -> Nested Loop (cost=2.19..1069345.29 rows=16 width=58) +> (actual time=135.390..366902.373 rows=13276368 loops=1) +> -> Nested Loop (cost=2.19..1067304.07 rows=44 +> width=68) (actual time=107.627..186390.137 rows=13276368 loops=1) +> -> Nested Loop (cost=2.19..1067038.94 rows=44 +> width=52) (actual time=87.255..49743.796 rows=13276368 loops=1) +> -> Nested Loop (cost=2.19..8.09 rows=1 +> width=32) (actual time=52.684..52.695 rows=1 loops=1) +> -> Merge Join (cost=2.19..2.24 +> rows=1 width=24) (actual time=28.000..28.007 rows=1 loops=1) +> Merge Cond: +> ("outer"."ClimateId" = "inner"."ClimateId") +> -> Sort (cost=1.17..1.19 +> rows=7 width=10) (actual time=10.306..10.307 rows=3 loops=1) +> Sort Key: +> "ClimateVariables"."ClimateId" +> -> Seq Scan on +> "ClimateVariables" (cost=0.00..1.07 rows=7 width=10) (actual +> time=10.277..10.286 rows=7 loops=1) +> -> Sort (cost=1.02..1.02 +> rows=1 width=14) (actual time=17.679..17.680 rows=1 loops=1) +> Sort Key: +> "GetFutureClimateParameters"."ClimateId" +> -> Seq Scan on +> "GetFutureClimateParameters" (cost=0.00..1.01 rows=1 width=14) (actual +> time=17.669..17.671 rows=1 loops=1) +> -> Index Scan using +> "PK_ScenarioEmissionLevels" on "ScenarioEmissionLevels" (cost=0.00..5.83 +> rows=1 width=18) (actual time=24.676..24.679 rows=1 loops=1) +> Index Cond: +> (("ScenarioEmissionLevels"."ScenarioId" = "outer"."ScenarioId") AND +> ("ScenarioEmissionLevels"."iYear" = "outer"."iYear") AND +> ("ScenarioEmissionLevels"."LevelId" = "outer"."LevelId")) +> -> Index Scan using "IX_ClimateId" on +> "ClimateChangeModel40" (cost=0.00..1063711.75 rows=265528 width=20) +> (actual time=34.564..19435.855 rows=13276368 loops=1) +> Index Cond: ("outer"."ClimateId" = +> "ClimateChangeModel40"."ClimateId") +> -> Index Scan using "PK_Aus40_DEM" on +> "Aus40_DEM" (cost=0.00..6.01 rows=1 width=16) (actual time=0.005..0.006 +> rows=1 loops=13276368) +> Index Cond: ("outer"."AusPosNumber" = +> "Aus40_DEM"."AusPosNumber") +> -> Index Scan using "PK_CurrentAusClimate" on +> "CurrentAusClimate" (cost=0.00..46.20 rows=11 width=14) (actual +> time=0.007..0.009 rows=1 loops=13276368) +> Index Cond: (("CurrentAusClimate"."ClimateId" = +> "outer"."ClimateId") AND ("outer"."AusPosNumber" = +> "CurrentAusClimate"."AusPosNum") AND ("CurrentAusClimate"."iMonth" = +> "outer"."iMonth")) +> Total runtime: 443983.269 ms +> (25 rows) +> +> +> Sheeeesshh... +> +> > You should really, really bump up shared_buffers and given you have 8GB +> > of ram this query would likely benefit from more work_mem. +> +> I actually tried that and there was a decrease in performance. Are the +> shared_buffers and work_mem the only things I should change to start with? +> If so what's the reasoning. +> +> +> > Is this an IO intensive query? If running both in parellel results in +> > 2x the run time and you have sufficient cpus it would (to me) indicate +> > you don't have enough IO bandwidth to satisfy the query. +> +> Yes I think so too: ... I am just compiling some io stats... +> +> Also will jump on to irc... +> +> > +> Whoa! thanks all... I am overwhelmed with the help I am getting... I love +> it! +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + +-- +Shoaib Burq +-- +VPAC - Geospatial Applications Developer +Building 91, 110 Victoria Street, +Carlton South, Vic 3053, Australia +_______________________________________________________________ +w: www.vpac.org | e: sab_AT_vpac_DOT_org | mob: +61.431-850039 + + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 10:53:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E6D553978 + for ; + Thu, 21 Apr 2005 10:53:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82661-08 + for ; + Thu, 21 Apr 2005 13:53:36 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 9304F53974 + for ; + Thu, 21 Apr 2005 10:53:35 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IFA00MB2ULFIHE2@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 21 Apr 2005 08:53:40 -0500 (CDT) +Date: Thu, 21 Apr 2005 09:53:51 -0400 +From: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <4266F7B3.7050004@arbash-meinel.com> +To: "'John A Meinel'" , + "'Postgresql Performance'" +Message-id: <000f01c54679$8d2f1f70$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/561 +X-Sequence-Number: 11958 + +Why is MYSQL returning 360,000 rows, while Postgres is only returning +330,000? This may not be important at all, though. +I also assume you are selecting from a plain table, not a view. + +Yes plain table. Difference in rows is one of the datasets had sears = +data in +it. It (speed differences found) is much worse on some of my views, = +which is +what forced me to start looking at other options. + +I suppose knowing your work_mem, and shared_buffers settings would be +useful. I have posted my configs, but will add the Tampa to the bottom +again. My desktop has +# - Memory - + +shared_buffers =3D 8000 # min 16, at least max_connections*2, 8KB +each +work_mem =3D 8000#1024 # min 64, size in KB +maintenance_work_mem =3D 16384 # min 1024, size in KB +#max_stack_depth =3D 2048 # min 100, size in KB + +# - Free Space Map - + +max_fsm_pages =3D 30000#20000 # min max_fsm_relations*16, 6 bytes +each +max_fsm_relations =3D 1000 # min 100, ~50 bytes each +# - Planner Cost Constants - + +effective_cache_size =3D 80000#1000 # typically 8KB each +random_page_cost =3D 2 # units are one sequential page fetch cost + +How were you measuring "data retrieval time"? And how does this compare +to what you were measuring on the other machines? It might be possible +that what you are really measuring is just the time it takes psql to +load up all the data into memory, and then print it out. And since psql +defaults to measuring entry lengths for each column, this may not be +truly comparable. +It *looks* like it only takes 18s for postgres to get the data, but then +it is taking 72s to transfer the data to you. That would be network +latency, or something like that, not database latency. +And I would say that 18s is very close to 16 or 17 seconds. +This was ran on the machine with database (as was MYSQL and MSSQL). +The PG timing was from PGADMIN and the 18 secs was second run, first run = +was +Same time to return the data and 70 secs to do the first part like 147 = +secs +all told, compared to the 40 seconds first run of MYSQL and 56 Seconds +MSSQL. MYSQL was done in their query tool, it returns the rows as well = +and +MSSQL was done in their query analyzer. All three tools appear to use a +similar approach. Just an FYI doing an explain analyze of my problem = +view +took much longer then actually returning the data in MSSQL and MYSQL. I = +have +done extensive testing with MYSQL (just this table and two of my problem +views). I am not using the transactional version, because I need the = +best +speed. + + +I don't know what commands you were issuing, or how you measured, +though. You might be using some other interface (like ODBC), which I +can't say too much about. + +John +=3D:-> + +This is the Linux box config. +# ----------------------------- +# PostgreSQL configuration file +# ----------------------------- +# +# This file consists of lines of the form: +# +# name =3D value +# +# (The '=3D' is optional.) White space may be used. Comments are = +introduced +# with '#' anywhere on a line. The complete list of option names and +# allowed values can be found in the PostgreSQL documentation. The +# commented-out settings shown in this file represent the default = +values. +# +# Please note that re-commenting a setting is NOT sufficient to revert = +it +# to the default value, unless you restart the postmaster. +# +# Any option can also be given as a command line switch to the +# postmaster, e.g. 'postmaster -c log_connections=3Don'. Some options +# can be changed at run-time with the 'SET' SQL command. +# +# This file is read on postmaster startup and when the postmaster +# receives a SIGHUP. If you edit the file on a running system, you have=20 +# to SIGHUP the postmaster for the changes to take effect, or use=20 +# "pg_ctl reload". Some settings, such as listen_address, require +# a postmaster shutdown and restart to take effect. + + +#------------------------------------------------------------------------= +--- +# 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 =3D 'ConfigDir' # use data in another directory +#data_directory =3D '/pgdata/data' +# hba_file =3D 'ConfigDir/pg_hba.conf' # the host-based authentication = +file +# ident_file =3D 'ConfigDir/pg_ident.conf' # the IDENT configuration = +file + +# If external_pid_file is not explicitly set, no extra pid file is = +written. +# external_pid_file =3D '(none)' # write an extra pid file + + +#------------------------------------------------------------------------= +--- +# CONNECTIONS AND AUTHENTICATION +#------------------------------------------------------------------------= +--- + +# - Connection Settings - + +#listen_addresses =3D 'localhost' # what IP interface(s) to listen on;=20 + # defaults to localhost, '*' =3D any + +listen_addresses =3D '*' +port =3D 5432 +max_connections =3D 100 + # note: increasing max_connections costs about 500 bytes of shared + # memory per connection slot, in addition to costs from +shared_buffers + # and max_locks_per_transaction. +#superuser_reserved_connections =3D 2 +#unix_socket_directory =3D '' +#unix_socket_group =3D '' +#unix_socket_permissions =3D 0777 # octal +#rendezvous_name =3D '' # defaults to the computer name + +# - Security & Authentication - + +#authentication_timeout =3D 60 # 1-600, in seconds +#ssl =3D false +#password_encryption =3D true +#krb_server_keyfile =3D '' +#db_user_namespace =3D false + + +#------------------------------------------------------------------------= +--- +# RESOURCE USAGE (except WAL) +#------------------------------------------------------------------------= +--- + +# - Memory - + +shared_buffers =3D 12288 #5000 min 16, at least max_connections*2, 8KB = +each +#work_mem =3D 1024 # min 64, size in KB +work_mem =3D 16384 # 8192 +#maintenance_work_mem =3D 16384 # min 1024, size in KB +#max_stack_depth =3D 2048 # min 100, size in KB + +# - Free Space Map - + +max_fsm_pages =3D 100000 #30000 # min max_fsm_relations*16, 6 bytes each +max_fsm_relations =3D 1500 #1000 # min 100, ~50 bytes each + +# - Kernel Resource Usage - + +#max_files_per_process =3D 1000 # min 25 +#preload_libraries =3D '' + +# - Cost-Based Vacuum Delay - + +#vacuum_cost_delay =3D 0 # 0-1000 milliseconds +#vacuum_cost_page_hit =3D 1 # 0-10000 credits +#vacuum_cost_pagE_miss =3D 10 # 0-10000 credits +#vacuum_cost_page_dirty =3D 20 # 0-10000 credits +#vacuum_cost_limit =3D 200 # 0-10000 credits + +# - Background writer - + +#bgwriter_delay =3D 200 # 10-10000 milliseconds between rounds +#bgwriter_percent =3D 1 # 0-100% of dirty buffers in each round +#bgwriter_maxpages =3D 100 # 0-1000 buffers max per round + + +#------------------------------------------------------------------------= +--- +# WRITE AHEAD LOG +#------------------------------------------------------------------------= +--- + +# - Settings - +fsync =3D true # turns forced synchronization on or off +wal_sync_method =3D open_sync# fsync # the default varies across +platforms: + # fsync, fdatasync, open_sync, or +open_datasync +wal_buffers =3D 2048#8 # min 4, 8KB each +#commit_delay =3D 0 # range 0-100000, in microseconds +#commit_siblings =3D 5 # range 1-1000 + +# - Checkpoints - + +checkpoint_segments =3D 100 #3 # in logfile segments, min 1, 16MB each +#checkpoint_timeout =3D 300 # range 30-3600, in seconds +#checkpoint_warning =3D 30 # 0 is off, in seconds + +# - Archiving - + +#archive_command =3D '' # command to use to archive a logfile +segment + + +#------------------------------------------------------------------------= +--- +# QUERY TUNING +#------------------------------------------------------------------------= +--- + +# - Planner Method Configuration - + +#enable_hashagg =3D true +#enable_hashjoin =3D true +#enable_indexscan =3D true +enable_mergejoin =3D false +#enable_nestloop =3D true +#enable_seqscan =3D true +#enable_sort =3D true +#enable_tidscan =3D true + +# - Planner Cost Constants - + +effective_cache_size =3D 262144 #40000 typically 8KB each +#random_page_cost =3D 4 # units are one sequential page fetch cost +random_page_cost =3D 2 +#cpu_tuple_cost =3D 0.01 # (same) +#cpu_index_tuple_cost =3D 0.001 # (same) +#cpu_operator_cost =3D 0.0025 # (same) + +# - Genetic Query Optimizer - + +#geqo =3D true +#geqo_threshold =3D 12 +#geqo_effort =3D 5 # range 1-10 +#geqo_pool_size =3D 0 # selects default based on effort +#geqo_generations =3D 0 # selects default based on effort +#geqo_selection_bias =3D 2.0 # range 1.5-2.0 + +# - Other Planner Options - + +default_statistics_target =3D 250#10 # range 1-1000 +#from_collapse_limit =3D 8 +#join_collapse_limit =3D 8 # 1 disables collapsing of explicit JOINs + + +#------------------------------------------------------------------------= +--- +# ERROR REPORTING AND LOGGING +#------------------------------------------------------------------------= +--- + +# - Where to Log - + +#log_destination =3D 'stderr' # Valid values are combinations of stderr, + # syslog and eventlog, depending on + # platform. + +# This is relevant when logging to stderr: +redirect_stderr =3D true # Enable capturing of stderr into log = +files. +# These are only relevant if redirect_stderr is true: +log_directory =3D 'pg_log' # Directory where log files are written. + # May be specified absolute or relative to +PGDATA +log_filename =3D 'postgresql-%a.log' # Log file name pattern. + # May include strftime() escapes +log_truncate_on_rotation =3D true # If true, any existing log file of = +the=20 + # 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 false, meaning append to = +existing=20 + # files in all cases. +log_rotation_age =3D 1440 # Automatic rotation of logfiles will = +happen +after + # so many minutes. 0 to disable. +log_rotation_size =3D 0 # 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 =3D 'LOCAL0' +#syslog_ident =3D 'postgres' + + +# - When to Log - + +#client_min_messages =3D notice # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # log, notice, warning, error + +#log_min_messages =3D notice # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # info, notice, warning, error, log, +fatal, + # panic + +#log_error_verbosity =3D default # terse, default, or verbose messages + +#log_min_error_statement =3D panic # Values in order of increasing = +severity: + # debug5, debug4, debug3, debug2, debug1, + # info, notice, warning, error, +panic(off) + =20 +#log_min_duration_statement =3D -1 # -1 is disabled, in milliseconds. + +#silent_mode =3D false # DO NOT USE without syslog or +redirect_stderr + +# - What to Log - + +#debug_print_parse =3D false +#debug_print_rewritten =3D false +#debug_print_plan =3D false +#debug_pretty_print =3D false +#log_connections =3D false +#log_disconnections =3D false +#log_duration =3D false +#log_line_prefix =3D '' # e.g. '<%u%%%d> '=20 + # %u=3Duser name %d=3Ddatabase name + # %r=3Dremote host and port + # %p=3DPID %t=3Dtimestamp %i=3Dcommand tag + # %c=3Dsession id %l=3Dsession line number + # %s=3Dsession start timestamp %x=3Dtransaction +id + # %q=3Dstop here in non-session processes + # %%=3D'%' +#log_statement =3D 'none' # none, mod, ddl, all +#log_hostname =3D false + + +#------------------------------------------------------------------------= +--- +# RUNTIME STATISTICS +#------------------------------------------------------------------------= +--- + +# - Statistics Monitoring - + +#log_parser_stats =3D false +#log_planner_stats =3D false +#log_executor_stats =3D false +#log_statement_stats =3D false + +# - Query/Index Statistics Collector - + +#stats_start_collector =3D true +#stats_command_string =3D false +#stats_block_level =3D false +#stats_row_level =3D false +#stats_reset_on_server_start =3D true + + +#------------------------------------------------------------------------= +--- +# CLIENT CONNECTION DEFAULTS +#------------------------------------------------------------------------= +--- + +# - Statement Behavior - + +#search_path =3D '$user,public' # schema names +#default_tablespace =3D '' # a tablespace name, or '' for default +#check_function_bodies =3D true +#default_transaction_isolation =3D 'read committed' +#default_transaction_read_only =3D false +#statement_timeout =3D 0 # 0 is disabled, in milliseconds + +# - Locale and Formatting - + +#datestyle =3D 'iso, mdy' +#timezone =3D unknown # actually, defaults to TZ environment +setting +#australian_timezones =3D false +#extra_float_digits =3D 0 # min -15, max 2 +#client_encoding =3D sql_ascii # actually, defaults to database encoding + +# These settings are initialized by initdb -- they might be changed +lc_messages =3D 'en_US.UTF-8' # locale for system error message +strings +lc_monetary =3D 'en_US.UTF-8' # locale for monetary formatting +lc_numeric =3D 'en_US.UTF-8' # locale for number formatting +lc_time =3D 'en_US.UTF-8' # locale for time formatting + +# - Other Defaults - + +#explain_pretty_print =3D true +#dynamic_library_path =3D '$libdir' + + +#------------------------------------------------------------------------= +--- +# LOCK MANAGEMENT +#------------------------------------------------------------------------= +--- + +#deadlock_timeout =3D 1000 # in milliseconds +#max_locks_per_transaction =3D 64 # min 10, ~200*max_connections bytes = +each + + +#------------------------------------------------------------------------= +--- +# VERSION/PLATFORM COMPATIBILITY +#------------------------------------------------------------------------= +--- + +# - Previous Postgres Versions - + +#add_missing_from =3D true +#regex_flavor =3D advanced # advanced, extended, or basic +#sql_inheritance =3D true +#default_with_oids =3D true + +# - Other Platforms & Clients - + +#transform_null_equals =3D false + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 11:25:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 48FBF539D6 + for ; + Thu, 21 Apr 2005 11:25:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91460-04 + for ; + Thu, 21 Apr 2005 14:24:59 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AFFA539C5 + for ; + Thu, 21 Apr 2005 11:24:58 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3LEP2en015075; + Thu, 21 Apr 2005 10:25:02 -0400 (EDT) +To: Richard van den Berg +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +In-reply-to: <4267612C.10803@trust-factory.com> +References: <426665A0.1080102@trust-factory.com> + <26710.1114007961@sss.pgh.pa.us> <4267612C.10803@trust-factory.com> +Comments: In-reply-to Richard van den Berg + + message dated "Thu, 21 Apr 2005 10:15:40 +0200" +Date: Thu, 21 Apr 2005 10:25:02 -0400 +Message-ID: <15074.1114093502@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/562 +X-Sequence-Number: 11959 + +Richard van den Berg writes: +> This is with the default cpu_tuple_cost = 0.01: + +> Nested Loop (cost=252.80..233010147.16 rows=1035480320 width=98) +> (actual time=0.369..12672213.137 rows=6171334 loops=1) +> Join Filter: (("outer".starttimetrunc <= "inner".ts) AND +> ("outer".finishtimetrunc >= "inner".ts)) +> -> Seq Scan on sessions us (cost=0.00..26822.36 rows=924536 +> width=106) (actual time=0.039..5447.349 rows=924536 loops=1) +> -> Materialize (cost=252.80..353.60 rows=10080 width=8) (actual +> time=0.000..2.770 rows=10080 loops=924536) +> -> Seq Scan on duration du (cost=0.00..252.80 rows=10080 +> width=8) (actual time=0.019..13.397 rows=10080 loops=1) +> Total runtime: 12674486.670 ms + +Hmm, that *is* showing rather a spectacularly large amount of time in +the join itself: if I did the arithmetic right, + +regression=# select 12672213.137 - (5447.349 + 2.770*924536 + 13.397); + ?column? +-------------- + 10105787.671 +(1 row) + +which is almost 80% of the entire runtime. Which is enormous. +What are those column datatypes exactly? Perhaps you are incurring a +datatype conversion cost? Straight timestamp-vs-timestamp comparison +is fairly cheap, but any sort of conversion will cost dearly. + +The planner's model for the time spent in the join itself is + (cpu_tuple_cost + 2 * cpu_operator_cost) * n_tuples +(the 2 because you have 2 operators in the join condition) +so you'd have to raise one or the other of these parameters +to model this situation accurately. But I have a hard time +believing that cpu_tuple_cost is really as high as 0.1. +It seems more likely that the cpu_operator_cost is underestimated, +which leads me to question what exactly is happening in those +comparisons. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 21 11:36:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 35B6F53A15 + for ; + Thu, 21 Apr 2005 11:36:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91828-10 + for ; + Thu, 21 Apr 2005 14:36:06 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D8CB539D8 + for ; + Thu, 21 Apr 2005 11:36:05 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IFA00GMIWKAK370@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 21 Apr 2005 09:36:10 -0500 (CDT) +Date: Thu, 21 Apr 2005 10:36:22 -0400 +From: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <11216.1114058132@sss.pgh.pa.us> +To: "'Tom Lane'" , + "'John A Meinel'" +Cc: "'Postgresql Performance'" +Message-id: <005201c5467f$7d6418b0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/563 +X-Sequence-Number: 11960 + + +I suspect he's using pgadmin. =20 +Yup I was, but I did try running on the linux box in psql, but it was +running to the screen and took forever because of that. + +The real issue is returning to my app using ODBC is very slow (Have not +tested the ODBC for MYSQL, MSSQL is ok (the two proc dell is running out = +of +steam but been good until this year when we about doubled our demand by +adding sears as a client). + +Using odbc to postgres on some of the views (Josh from Command is having = +me +do some very specific testing) is timing out with a 10 minute time = +limit. +These are pages that still respond using MSSQL (this is wehere = +production is +using the duel proc and the test is using the 4 proc). + +I have a tool that hooks to all three databases so I can try it with = +that +and see if I get different responses. + +Joel + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 11:42:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D56185294C + for ; + Thu, 21 Apr 2005 11:42:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96824-02 + for ; + Thu, 21 Apr 2005 14:42:22 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 93EC353A44 + for ; + Thu, 21 Apr 2005 11:42:17 -0300 (ADT) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j3LF05C0029052 + for ; Thu, 21 Apr 2005 15:00:06 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j3LF05dA029049; + Thu, 21 Apr 2005 15:00:05 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Thu, 21 Apr 2005 14:42:16 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +Thread-Index: AcVGf8K8zp56IzBSTYauQmp/D/GpfAAAHKcA +From: "Mohan, Ross" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.132 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/564 +X-Sequence-Number: 11961 + +FWIW, ODBC has variables to tweak, as well. fetch/buffer sizes, and the = +like.=20 + +Maybe one of the ODBC cognoscenti here can chime in more concretely.... + + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Joel = +Fradkin +Sent: Thursday, April 21, 2005 10:36 AM +To: 'Tom Lane'; 'John A Meinel' +Cc: 'Postgresql Performance' +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + + + +I suspect he's using pgadmin. =20 +Yup I was, but I did try running on the linux box in psql, but it was = +running to the screen and took forever because of that. + +The real issue is returning to my app using ODBC is very slow (Have not = +tested the ODBC for MYSQL, MSSQL is ok (the two proc dell is running out = +of steam but been good until this year when we about doubled our demand = +by adding sears as a client). + +Using odbc to postgres on some of the views (Josh from Command is having = +me do some very specific testing) is timing out with a 10 minute time = +limit. These are pages that still respond using MSSQL (this is wehere = +production is using the duel proc and the test is using the 4 proc). + +I have a tool that hooks to all three databases so I can try it with = +that and see if I get different responses. + +Joel + + +---------------------------(end of broadcast)--------------------------- +TIP 3: if posting/reading through Usenet, please send an appropriate + subscribe-nomail command to majordomo@postgresql.org so that your + message can get through to the mailing list cleanly + +From pgsql-performance-owner@postgresql.org Thu Apr 21 11:53:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 20FF85387F + for ; + Thu, 21 Apr 2005 11:53:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99015-09 + for ; + Thu, 21 Apr 2005 14:53:01 +0000 (GMT) +Received: from hp.vpac.org (vpac.org [131.170.184.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 315F65294F + for ; + Thu, 21 Apr 2005 11:52:58 -0300 (ADT) +Received: by hp.vpac.org (Postfix, from userid 557) + id 09697A140E2; Fri, 22 Apr 2005 00:53:03 +1000 (EST) +Received: from localhost (localhost [127.0.0.1]) + by hp.vpac.org (Postfix) with ESMTP id 05E1368103; + Fri, 22 Apr 2005 00:53:03 +1000 (EST) +Date: Fri, 22 Apr 2005 00:53:03 +1000 (EST) +From: "Shoaib Burq (VPAC)" +To: Jeff +Cc: pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: <8c459b7b96e6c310d641cebdfa8dcab6@torgo.978.org> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.082 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/565 +X-Sequence-Number: 11962 + + +> Is this an IO intensive query? If running both in parellel results in +> 2x the run time and you have sufficient cpus it would (to me) indicate +> you don't have enough IO bandwidth to satisfy the query. + +any tips on how to verify this? + + +From pgsql-odbc-owner@postgresql.org Thu Apr 21 11:53:46 2005 +X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F0D385388B; + Thu, 21 Apr 2005 11:53:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00706-02; Thu, 21 Apr 2005 14:53:38 +0000 (GMT) +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by svr1.postgresql.org (Postfix) with ESMTP id 58F35536EB; + Thu, 21 Apr 2005 11:53:35 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IFA00J9WXDE8HT3@vms048.mailsrvcs.net>; + Thu, 21 Apr 2005 09:53:40 -0500 (CDT) +Date: Thu, 21 Apr 2005 10:53:51 -0400 +From: "Joel Fradkin" +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: + +To: "'Mohan, Ross'" +Cc: , + "PostgreSQL Perform" +Message-id: <005c01c54681$eecaf0d0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/53 +X-Sequence-Number: 5212 + +Here is the connect string I am using. +It could be horrid as I cut it from ODBC program. + +Session("StringConn") =3D +"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D; +PWD=3D;ReadOnly=3D0;Protocol=3D6.4;FakeOidIndex=3D0;ShowOidColumn=3D0;Row= +Versioning=3D0; +ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100;Socket=3D4096;UnknownSiz= +es=3D0;MaxVar +charSize=3D254;MaxLongVarcharSize=3D8190;Debug=3D0;CommLog=3D0;Optimizer=3D= +1;Ksqo=3D1;Us +eDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar=3D0;BoolsAs= +Char=3D1;Pa +rse=3D0;CancelAsFreeStmt=3D0;ExtraSysTablePrefixes=3Ddd_;LFConversion=3D1= +;UpdatableC +ursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongVarBi= +nary=3D0;UseS +erverSidePrepare=3D0" + +Joel Fradkin +=20 + +-----Original Message----- +From: Mohan, Ross [mailto:RMohan@arbinet.com]=20 +Sent: Thursday, April 21, 2005 9:42 AM +To: jfradkin@wazagua.com +Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + +FWIW, ODBC has variables to tweak, as well. fetch/buffer sizes, and the +like.=20 + +Maybe one of the ODBC cognoscenti here can chime in more concretely.... + + + + + + +From pgsql-odbc-owner@postgresql.org Sat Apr 23 01:50:58 2005 +X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3845D53A77 + for ; + Thu, 21 Apr 2005 12:02:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02347-03 + for ; + Thu, 21 Apr 2005 15:02:07 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 58AC153A5A + for ; Thu, 21 Apr 2005 12:02:04 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3LEFBlQ000234 + for ; Thu, 21 Apr 2005 14:15:15 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3LEFAtJ000227; + Thu, 21 Apr 2005 14:15:11 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +Date: Thu, 21 Apr 2005 15:01:10 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +Thread-Index: AcVGge8n4HAcRx4ZS6GGvIC1oleSwAAAHi8g +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.129 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/57 +X-Sequence-Number: 5216 + +Joel, thanks. A couple of things jump out there for +me, not a problem for a routine ODBC connection, but +perhaps in the "lotsa stuff" context of your current +explorations, it might be relevant? + +I am completely shooting from the hip, here, but...if +it were my goose to cook, I'd be investigating + +Session("StringConn") =3D = +"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D; +PWD=3D;ReadOnly=3D0;Protocol=3D6.4; + +|| Protocol? Is this related to version? is the driver waaaay old? + + +FakeOidIndex=3D0;ShowOidColumn=3D0;RowVersioning=3D0; +ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100; + +|| Fetch great for OLTP, lousy for batch? + + +Socket=3D4096;UnknownSizes=3D0;MaxVarcharSize=3D254;MaxLongVarcharSize=3D= +8190; + +|| what ARE the datatypes and sizes in your particular case?=20 + +Debug=3D0; + +|| a run with debug=3D1 probably would spit up something = +interesting.... + +CommLog=3D0;Optimizer=3D1; + +|| Optimizer? that's a new one on me.... + +Ksqo=3D1;UseDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar=3D= +0;BoolsAsChar=3D1;Parse=3D0;CancelAsFreeStmt=3D;ExtraSysTablePrefixes=3Dd= +d_;LFConversion=3D1;UpdatableCursors=3D1;DisallowPremature=3D0;TrueIsMinu= +s1=3D0;BI=3D0;ByteaAsLongVarBinary=3D0;UseServerSidePrepare=3D0" + +|| that's about all I can see, prima facie. I'll be very curious to = +know if ODBC is + any part of your performance equation.=20 + + +HTH,=20 + +Ross + +-----Original Message----- +From: Joel Fradkin [mailto:jfradkin@wazagua.com]=20 +Sent: Thursday, April 21, 2005 10:54 AM +To: Mohan, Ross +Cc: pgsql-odbc@postgresql.org; PostgreSQL Perform +Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + + +Here is the connect string I am using. +It could be horrid as I cut it from ODBC program. + +Session("StringConn") =3D = +"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D; +PWD=3D;ReadOnly=3D0;Protocol=3D6.4;FakeOidIndex=3D0;ShowOidColumn=3D0;Row= +Versioning=3D0; +ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100;Socket=3D4096;UnknownSiz= +es=3D0;MaxVar +charSize=3D254;MaxLongVarcharSize=3D8190;Debug=3D0;CommLog=3D0;Optimizer=3D= +1;Ksqo=3D1;Us +eDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar=3D0;BoolsAs= +Char=3D1;Pa +rse=3D0;CancelAsFreeStmt=3D0;ExtraSysTablePrefixes=3Ddd_;LFConversion=3D1= +;UpdatableC +ursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongVarBi= +nary=3D0;UseS +erverSidePrepare=3D0" + +Joel Fradkin +=20 + +-----Original Message----- +From: Mohan, Ross [mailto:RMohan@arbinet.com]=20 +Sent: Thursday, April 21, 2005 9:42 AM +To: jfradkin@wazagua.com +Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + +FWIW, ODBC has variables to tweak, as well. fetch/buffer sizes, and the = +like.=20 + +Maybe one of the ODBC cognoscenti here can chime in more concretely.... + + + + + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 12:01:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 37C1F539D8 + for ; + Thu, 21 Apr 2005 12:01:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01834-06 + for ; + Thu, 21 Apr 2005 15:01:21 +0000 (GMT) +Received: from hp.vpac.org (vpac.org [131.170.184.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 03E88536EB + for ; + Thu, 21 Apr 2005 12:01:20 -0300 (ADT) +Received: by hp.vpac.org (Postfix, from userid 557) + id 780C5A1403C; Fri, 22 Apr 2005 01:01:19 +1000 (EST) +Received: from localhost (localhost [127.0.0.1]) + by hp.vpac.org (Postfix) with ESMTP id 741B268103; + Fri, 22 Apr 2005 01:01:19 +1000 (EST) +Date: Fri, 22 Apr 2005 01:01:19 +1000 (EST) +From: "Shoaib Burq (VPAC)" +To: Russell Smith +Cc: Jeff , +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: <200504212329.06343.mr-russ@pws.com.au> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=ISO-8859-1 +Content-Transfer-Encoding: 8BIT +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/567 +X-Sequence-Number: 11964 + + +Just tried it with the following changes: + +shared_buffers = 10600 +work_mem = 102400 +enable_seqscan = false + +still no improvement + +Ok here's the Plan with the enable_seqscan = false: +ausclimate=# explain ANALYZE select count(*) from "getfutureausclimate"; + +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + Aggregate (cost=101069350.74..101069350.74 rows=1 width=0) (actual +time=461651.787..461651.787 rows=1 loops=1) + -> Subquery Scan getfutureausclimate (cost=101069350.50..101069350.70 +rows=16 width=0) (actual time=426142.382..454571.397 rows=13276368 +loops=1) + -> Sort (cost=101069350.50..101069350.54 rows=16 width=58) +(actual time=426142.375..444428.278 rows=13276368 loops=1) + Sort Key: "Aus40_DEM"."AusPosNumber", +"CurrentAusClimate"."iMonth" + -> Nested Loop (cost=100000001.02..101069350.18 rows=16 +width=58) (actual time=72.740..366588.646 rows=13276368 loops=1) + -> Nested Loop (cost=100000001.02..101067308.96 +rows=44 width=68) (actual time=35.788..184032.873 rows=13276368 loops=1) + -> Nested Loop +(cost=100000001.02..101067043.83 rows=44 width=52) (actual +time=35.753..47971.652 rows=13276368 loops=1) + -> Nested Loop +(cost=100000001.02..100000012.98 rows=1 width=32) (actual +time=7.433..7.446 rows=1 loops=1) + -> Merge Join +(cost=100000001.02..100000007.13 rows=1 width=24) (actual +time=7.403..7.412 rows=1 loops=1) + Merge Cond: +("outer"."ClimateId" = "inner"."ClimateId") + -> Index Scan using +"PK_ClimateVariables" on "ClimateVariables" (cost=0.00..6.08 rows=7 +width=10) (actual time=0.011..0.015 rows=3 loops=1) + -> Sort +(cost=100000001.02..100000001.03 rows=1 width=14) (actual +time=7.374..7.375 rows=1 loops=1) + Sort Key: +"GetFutureClimateParameters"."ClimateId" + -> Seq Scan on +"GetFutureClimateParameters" (cost=100000000.00..100000001.01 rows=1 +width=14) (actual time=7.361..7.362 rows=1 loops=1) + -> Index Scan using +"PK_ScenarioEmissionLevels" on "ScenarioEmissionLevels" (cost=0.00..5.83 +rows=1 width=18) (actual time=0.021..0.024 rows=1 loops=1) + Index Cond: +(("ScenarioEmissionLevels"."ScenarioId" = "outer"."ScenarioId") AND +("ScenarioEmissionLevels"."iYear" = "outer"."iYear") AND +("ScenarioEmissionLevels"."LevelId" = "outer"."LevelId")) + -> Index Scan using "IX_ClimateId" on +"ClimateChangeModel40" (cost=0.00..1063711.75 rows=265528 width=20) +(actual time=28.311..17212.703 rows=13276368 loops=1) + Index Cond: ("outer"."ClimateId" = +"ClimateChangeModel40"."ClimateId") + -> Index Scan using "PK_Aus40_DEM" on +"Aus40_DEM" (cost=0.00..6.01 rows=1 width=16) (actual time=0.005..0.006 +rows=1 loops=13276368) + Index Cond: ("outer"."AusPosNumber" = +"Aus40_DEM"."AusPosNumber") + -> Index Scan using "PK_CurrentAusClimate" on +"CurrentAusClimate" (cost=0.00..46.20 rows=11 width=14) (actual +time=0.007..0.009 rows=1 loops=13276368) + Index Cond: (("CurrentAusClimate"."ClimateId" = +"outer"."ClimateId") AND ("outer"."AusPosNumber" = +"CurrentAusClimate"."AusPosNum") AND ("CurrentAusClimate"."iMonth" = +"outer"."iMonth")) + Total runtime: 462218.120 ms +(23 rows) + + + + + + +On Thu, 21 Apr 2005, Russell Smith wrote: + +> On Thu, 21 Apr 2005 10:44 pm, Shoaib Burq (VPAC) wrote: +> > �-> �Nested Loop �(cost=2.19..1069345.29 rows=16 width=58) (actual time=135.390..366902.373 rows=13276368 loops=1) +> > � � � � � � � � � � �-> �Nested Loop �(cost=2.19..1067304.07 rows=44 width=68) (actual time=107.627..186390.137 rows=13276368 loops=1) +> > � � � � � � � � � � � � � �-> �Nested Loop �(cost=2.19..1067038.94 rows=44 width=52) (actual time=87.255..49743.796 rows=13276368 loops=1) +> +> OUCH, OUCH, OUCH. +> +> Most if not all of the time is going on nested loop joins. The tuple estimates are off by a factore of 10^6 which is means it's chosing the wrong +> join type. +> +> you could set enable_seqscan to OFF; to test what he performance is like with a different plan, and then set it back on. +> +> However you really need to get the row count estimates up to something comparable. within a factor of 10 at least. +> A number of the other rows estimates seem to be off by a reasonable amount too. You may want to bump up the statistics on the relevant +> columns. I can't find what they are from looking at that, I probably should be able too, but it's late. +> +> If you get the stats up to something near the real values, then the planner will choose a different plan, which should give a huge performance +> increase. +> +> Regards +> +> Russell Smith. +> +> + +-- +Shoaib Burq +-- +VPAC - Geospatial Applications Developer +Building 91, 110 Victoria Street, +Carlton South, Vic 3053, Australia +_______________________________________________________________ +w: www.vpac.org | e: sab_AT_vpac_DOT_org | mob: +61.431-850039 + + + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 12:14:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C68E55387F + for ; + Thu, 21 Apr 2005 12:14:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06208-01 + for ; + Thu, 21 Apr 2005 15:14:25 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 40C5753A85 + for ; + Thu, 21 Apr 2005 12:14:24 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3LFELSY008330; (envelope-from ) Thu, + 21 Apr 2005 10:14:21 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3LFEJGV015541 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Thu, + 21 Apr 2005 10:14:20 -0500 (CDT) +Message-ID: <4267C34D.9010705@arbash-meinel.com> +Date: Thu, 21 Apr 2005 10:14:21 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Shoaib Burq (VPAC)" +Cc: Russell Smith , + Jeff , pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +References: +In-Reply-To: +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig46BEEC8F536CA754616F5660" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/569 +X-Sequence-Number: 11966 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig46BEEC8F536CA754616F5660 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Shoaib Burq (VPAC) wrote: + +>Just tried it with the following changes: +> +>shared_buffers = 10600 +>work_mem = 102400 +>enable_seqscan = false +> +>still no improvement +> +>Ok here's the Plan with the enable_seqscan = false: +>ausclimate=# explain ANALYZE select count(*) from "getfutureausclimate"; +> +> +Actually, you probably don't want enable_seqscan=off, you should try: +SET enable_nestloop TO off. +The problem is that it is estimating there will only be 44 rows, but in +reality there are 13M rows. It almost definitely should be doing a +seqscan with a sort and merge join. + +Also, please attach you explain analyzes, the wrapping is really hard to +read. + +I don't understand how postgres could get the number of rows that wrong. + +It seems to be misestimating the number of entries in IX_ClimateId + +Here: + +-> Index Scan using "PK_Aus40_DEM" on "Aus40_DEM" (cost=0.00..6.01 rows=1 width=16) (actual time=0.005..0.006 rows=1 loops=13276368) + Index Cond: ("outer"."AusPosNumber" = "Aus40_DEM"."AusPosNumber") +-> Index Scan using "PK_CurrentAusClimate" on "CurrentAusClimate" (cost=0.00..46.20 rows=11 width=14) (actual time=0.007..0.009 rows=1 loops=13276368) + +The first index scan is costing you 0.006*13276368=79s, and the second one is 119s. + +I can't figure out exactly what is where from the formatting, but the query that seems misestimated is: +-> Index Scan using "IX_ClimateId" on "ClimateChangeModel40" (cost=0.00..1063711.75 rows=265528 width=20) (actual time=28.311..17212.703 rows=13276368 loops=1) + Index Cond: ("outer"."ClimateId" = "ClimateChangeModel40"."ClimateId") + +Is there an unexpected correlaction between +ClimateChangeModel40"."ClimateId" and whatever "outer" is at this point? + +John +=:-> + + +--------------enig46BEEC8F536CA754616F5660 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCZ8NNJdeBCYSNAAMRAgS+AJ9vt/eV0zOXA5DYFs5J0bPayng+BwCfQKCJ +/+LRzkIYqSX5C0U6kuLya7c= +=+Ufz +-----END PGP SIGNATURE----- + +--------------enig46BEEC8F536CA754616F5660-- + +From pgsql-performance-owner@postgresql.org Thu Apr 21 12:54:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BB649536C0 + for ; + Thu, 21 Apr 2005 12:54:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16056-05 + for ; + Thu, 21 Apr 2005 15:54:40 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id EE68A534FB + for ; + Thu, 21 Apr 2005 12:54:39 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP id 4872883D6E + for ; + Thu, 21 Apr 2005 17:54:37 +0200 (CEST) +Message-ID: <4267CCB9.40807@trust-factory.com> +Date: Thu, 21 Apr 2005 17:54:33 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <42666890.1000401@arbash-meinel.com> + <42667219.7050907@trust-factory.com> + <4266773E.405@arbash-meinel.com> + <42679922.3040300@trust-factory.com> + <4267A1C1.9060706@arbash-meinel.com> +In-Reply-To: <4267A1C1.9060706@arbash-meinel.com> +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/570 +X-Sequence-Number: 11967 + +John A Meinel wrote: +> You might try doing: +> ALTER TABLE us ALTER COLUMN starttimetrunc SET STATISTICS 200; +> ALTER TABLE us ALTER COLUMN finishtimetrunc SET STATISTICS 200; +> VACUUM ANALYZE us; + +I've been looking into that. While increasing the statistics makes the +planner use the index for simple selects, it still does not for joins. + +Another thing that threw me off is that after a "vacuum analyze" a +"select * from us where 'x' between start and finish" uses seq scans, +while after just an "analyze" is uses the index! I thought both +statements were supposed to update the statistics in the same way? (This +is with 7.4.7.) + +> You have 2 tables, a duration, and a from->to table, right? How many +> rows in each? + +Duration: 10k +Sessions: 1M + +> Anyway, you can play around with it by using stuff like: +> SET enable_seqscan TO off; + +This doesn't help much. Instead of turning seqscans off this setting +increases its cost with 100M. Since my query already has a cost of about +400M-800M this doesn't matter much. + +For now, the only reliable way of forcing the use of the index is to set +cpu_tuple_cost = 1. + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 13:17:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9ACF3539E1 + for ; + Thu, 21 Apr 2005 13:16:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22648-10 + for ; + Thu, 21 Apr 2005 16:16:52 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 588F25391C + for ; + Thu, 21 Apr 2005 13:16:51 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id DE91083D6E; Thu, 21 Apr 2005 18:16:48 +0200 (CEST) +Message-ID: <4267D1ED.7010606@trust-factory.com> +Date: Thu, 21 Apr 2005 18:16:45 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <26710.1114007961@sss.pgh.pa.us> <4267612C.10803@trust-factory.com> + <15074.1114093502@sss.pgh.pa.us> +In-Reply-To: <15074.1114093502@sss.pgh.pa.us> +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/571 +X-Sequence-Number: 11968 + +Tom Lane wrote: +> which is almost 80% of the entire runtime. Which is enormous. +> What are those column datatypes exactly? + + Table "richard.sessions" + Column | Type | Modifiers +------------------------+-----------------------------+----------- +[unrelated columns removed] + starttimetrunc | timestamp without time zone | + finishtimetrunc | timestamp without time zone | +Indexes: + "rb_us_st_ft_idx" btree (starttimetrunc, finishtimetrunc) + "rb_us_st_ft_idx2" btree (finishtimetrunc, starttimetrunc) +Check constraints: + "date_check" CHECK (finishtimetrunc >= starttimetrunc) + + Table "richard.duration" + Column | Type | Modifiers +--------+-----------------------------+----------- + ts | timestamp without time zone | + +> Perhaps you are incurring a datatype conversion cost? + +Not that I can tell. + +> It seems more likely that the cpu_operator_cost is underestimated, + +As you perdicted, increasing cpu_operator_cost from 0.0025 to 0.025 also +causes the planner to use the index on duration. + +> which leads me to question what exactly is happening in those +> comparisons. + +Your guess is as good as mine (actually, yours is much better). I can +put together a reproducable test case if you like.. + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + Have you visited our new DNA Portal? +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 21 13:23:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0643A5388D + for ; + Thu, 21 Apr 2005 13:23:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23488-10 + for ; + Thu, 21 Apr 2005 16:23:32 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 303CE536A8 + for ; + Thu, 21 Apr 2005 13:23:31 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3LGNVMS016776; + Thu, 21 Apr 2005 12:23:31 -0400 (EDT) +To: Richard van den Berg +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +In-reply-to: <4267D1ED.7010606@trust-factory.com> +References: <426665A0.1080102@trust-factory.com> + <26710.1114007961@sss.pgh.pa.us> <4267612C.10803@trust-factory.com> + <15074.1114093502@sss.pgh.pa.us> + <4267D1ED.7010606@trust-factory.com> +Comments: In-reply-to Richard van den Berg + + message dated "Thu, 21 Apr 2005 18:16:45 +0200" +Date: Thu, 21 Apr 2005 12:23:31 -0400 +Message-ID: <16775.1114100611@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/572 +X-Sequence-Number: 11969 + +Richard van den Berg writes: +> Tom Lane wrote: +>> Perhaps you are incurring a datatype conversion cost? + +> Not that I can tell. + +No, apparently not. Hmm ... timestamp_cmp_internal is just a couple of +isnan() checks and one or two floating-point compares. Should be pretty +dang cheap. Unless isnan() is ridiculously expensive on your hardware? +More likely there is some bottleneck that we are not thinking of. + +Are the tables in question particularly wide (many columns)? + +>> which leads me to question what exactly is happening in those +>> comparisons. + +> Your guess is as good as mine (actually, yours is much better). I can +> put together a reproducable test case if you like.. + +I'm thinking it would be interesting to look at a gprof profile of the +nestloop case. If you can rebuild with profiling and get one, that +would be fine, or you can make up a test case that shows the same slow +joining behavior. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:00:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D703853A39 + for ; + Thu, 21 Apr 2005 14:00:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34735-01 + for ; + Thu, 21 Apr 2005 17:00:20 +0000 (GMT) +Received: from web51403.mail.yahoo.com (web51403.mail.yahoo.com + [206.190.38.182]) + by svr1.postgresql.org (Postfix) with SMTP id 9676C536EF + for ; + Thu, 21 Apr 2005 14:00:18 -0300 (ADT) +Received: (qmail 3000 invoked by uid 60001); 21 Apr 2005 17:00:18 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=B0NI9F57RFpvhBbXBR7ELPsVH3UueszpdyRl8ZJv4fPKz5N6I78w2idBhaTKUE91MQU2yQf0YbsVGPPT7nAZ7Li4g2Ax3sKFjgspoOpOHOQ+8i0knoSrdn7FHqQAWHB75egoRntg4hhiBhzutL3p3OGTMiNjFBR6o7ojLtVA+TE= + ; +Message-ID: <20050421170018.2998.qmail@web51403.mail.yahoo.com> +Received: from [192.88.67.254] by web51403.mail.yahoo.com via HTTP; + Thu, 21 Apr 2005 10:00:18 PDT +Date: Thu, 21 Apr 2005 10:00:18 -0700 (PDT) +From: Bill Chandler +Subject: Index bloat problem? +To: pgsql-perform +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.905 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/573 +X-Sequence-Number: 11970 + +All, + +Running PostgreSQL 7.4.2, Solaris. + +Client is reporting that the size of an index is +greater than the number of rows in the table (1.9 +million vs. 1.5 million). Index was automatically +created from a 'bigserial unique' column. + +Database contains several tables with exactly the same +columns (including 'bigserial unique' column). This +is the only table where this index is out of line with +the actual # of rows. + +Queries on this table take 40 seconds to retrieve 2000 +rows as opposed to 1-2 seconds on the other tables. + +We have been running 'VACUUM ANALYZE' very regularly. +In fact, our vacuum schedule has probably been +overkill. We have been running on a per-table basis +after every update (many per day, only inserts +occurring) and after every purge (one per day, +deleting a day's worth of data). + +It is theoretically possible that at some time a +process was run that deleted all rows in the table +followed by a VACUUM FULL. In this case we would have +dropped/recreated our own indexes on the table but not +the index automatically created for the bigserial +column. If that happened, could that cause these +symptoms? + +What about if an out-of-the-ordinary number of rows +were deleted (say 75% of rows in the table, as opposed +to normal 5%) followed by a 'VACUUM ANALYZE'? Could +things get out of whack because of that situation? + +thanks, + +Bill + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:22:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B448535B9 + for ; + Thu, 21 Apr 2005 14:22:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40368-09 + for ; + Thu, 21 Apr 2005 17:22:27 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 867C552A8B + for ; + Thu, 21 Apr 2005 14:22:24 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7263468; Thu, 21 Apr 2005 10:24:21 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Bill Chandler +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 10:22:03 -0700 +User-Agent: KMail/1.6.2 +Cc: pgsql-perform +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> +In-Reply-To: <20050421170018.2998.qmail@web51403.mail.yahoo.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200504211022.03541.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/574 +X-Sequence-Number: 11971 + +Bill, + +> What about if an out-of-the-ordinary number of rows +> were deleted (say 75% of rows in the table, as opposed +> to normal 5%) followed by a 'VACUUM ANALYZE'? =A0Could +> things get out of whack because of that situation? + +Yes. You'd want to run REINDEX after and event like that. As you should n= +ow. + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:32:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D06FA53DC3 + for ; + Thu, 21 Apr 2005 14:32:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45451-03 + for ; + Thu, 21 Apr 2005 17:32:12 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 4A63B53990 + for ; + Thu, 21 Apr 2005 14:32:11 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7263550; Thu, 21 Apr 2005 10:34:10 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: "David Roussel" +Subject: Re: How can an index be larger than a table +Date: Thu, 21 Apr 2005 10:31:51 -0700 +User-Agent: KMail/1.6.2 +Cc: pgsql-performance@postgresql.org +References: <1114078390.26441.232391808@webmail.messagingengine.com> +In-Reply-To: <1114078390.26441.232391808@webmail.messagingengine.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200504211031.51567.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/575 +X-Sequence-Number: 11972 + +David, + +> What also seems weird to me is that the control table has some unique +> indexes created on it, but the data_upate_events table just has a unique +> constraint. =A0Will postgres use an index in the background to enforce +> this constraint? + +If you somehow have a unique constraint without a unique index, something i= +s=20 +seriously broken. I suspect hacking of system tables. + +Otherwise, it sounds like you have index bloat due to mass deletions. Run= +=20 +REINDEX, or, preferably, VACUUM FULL and then REINDEX. + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:46:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 81E9C53F76 + for ; + Thu, 21 Apr 2005 14:46:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48656-04 + for ; + Thu, 21 Apr 2005 17:46:22 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) + by svr1.postgresql.org (Postfix) with ESMTP id 2645E53EEE + for ; + Thu, 21 Apr 2005 14:46:21 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 70so669414wra + for ; + Thu, 21 Apr 2005 10:46:22 -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=FvFaUy7ymI5bFjG9T4mD+ssDGWSMeCAbiCNQFwwfspBJ70gd0H/NC3blC1/fWolDw37n2FLOZsMNnkUw/I5m5UZdl6l5blCesZGoZ4zDLc7WFKd7hE1yXXG4yB2Ss81rh/TdIJrAU4Kbr4YF+FY+15/Wyn0wnUXYtHzDPv4GpnY= +Received: by 10.54.77.16 with SMTP id z16mr2036792wra; + Thu, 21 Apr 2005 10:33:30 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 21 Apr 2005 10:33:28 -0700 (PDT) +Message-ID: <33c6269f050421103311a3f3f8@mail.gmail.com> +Date: Thu, 21 Apr 2005 13:33:28 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Josh Berkus +Subject: Re: Index bloat problem? +Cc: Bill Chandler , + pgsql-perform +In-Reply-To: <200504211022.03541.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> + <200504211022.03541.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.278 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/579 +X-Sequence-Number: 11976 + +Is: + +REINDEX DATABASE blah + +supposed to rebuild all indices in the database, or must you specify +each table individualy? (I'm asking because I just tried it and it +only did system tables) + +Alex Turner +netEconomist + +On 4/21/05, Josh Berkus wrote: +> Bill, +>=20 +> > What about if an out-of-the-ordinary number of rows +> > were deleted (say 75% of rows in the table, as opposed +> > to normal 5%) followed by a 'VACUUM ANALYZE'? Could +> > things get out of whack because of that situation? +>=20 +> Yes. You'd want to run REINDEX after and event like that. As you should= + now. +>=20 +> -- +> Josh Berkus +> Aglio Database Solutions +> San Francisco +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +>=20 +> http://archives.postgresql.org +> + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:39:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C3BF534FB + for ; + Thu, 21 Apr 2005 14:39:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46490-08 + for ; + Thu, 21 Apr 2005 17:38:57 +0000 (GMT) +Received: from web51410.mail.yahoo.com (web51410.mail.yahoo.com + [206.190.38.189]) + by svr1.postgresql.org (Postfix) with SMTP id 8A68053981 + for ; + Thu, 21 Apr 2005 14:38:55 -0300 (ADT) +Received: (qmail 76288 invoked by uid 60001); 21 Apr 2005 17:38:55 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=ZjrvB8avDdSSp0j+E6fmD5g7pG4Lcyks4ZOcm2hXZERjy5OwOl3fpYEQOsVI+Npm8Imhe1OXbtJVLmD7iJ58ndrFLPX/jTY6p6tSRxp2E4hhZEGHVC8UJF6qm7DlzjJVzongB5KmzKmbUBwfy0kePyldzk9+EbGWDVNW/Jc6dio= + ; +Message-ID: <20050421173855.76286.qmail@web51410.mail.yahoo.com> +Received: from [192.88.67.254] by web51410.mail.yahoo.com via HTTP; + Thu, 21 Apr 2005 10:38:55 PDT +Date: Thu, 21 Apr 2005 10:38:55 -0700 (PDT) +From: Bill Chandler +Subject: Re: Index bloat problem? +To: Josh Berkus +Cc: pgsql-perform +In-Reply-To: 6667 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.898 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/576 +X-Sequence-Number: 11973 + + +--- Josh Berkus wrote: +> Bill, +> +> > What about if an out-of-the-ordinary number of +> rows +> > were deleted (say 75% of rows in the table, as +> opposed +> > to normal 5%) followed by a 'VACUUM ANALYZE'? +> �Could +> > things get out of whack because of that situation? +> +> Yes. You'd want to run REINDEX after and event like +> that. As you should now. +> +> -- +> Josh Berkus +> Aglio Database Solutions +> San Francisco +> + +Thank you. Though I must say, that is very +discouraging. REINDEX is a costly operation, timewise +and due to the fact that it locks out other processes +from proceeding. Updates are constantly coming in and +queries are occurring continuously. A REINDEX could +potentially bring the whole thing to a halt. + +Honestly, this seems like an inordinate amount of +babysitting for a production application. I'm not +sure if the client will be willing to accept it. + +Admittedly my knowledge of the inner workings of an +RDBMS is limited, but could somebody explain to me why +this would be so? If you delete a bunch of rows why +doesn't the index get updated at the same time? Is +this a common issue among all RDBMSs or is it +something that is PostgreSQL specific? Is there any +way around it? + +thanks, + +Bill + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:45:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A2B4153E0C + for ; + Thu, 21 Apr 2005 14:45:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47688-06 + for ; + Thu, 21 Apr 2005 17:45:12 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 74DA752A8B + for ; + Thu, 21 Apr 2005 14:45:09 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7263628; Thu, 21 Apr 2005 10:47:07 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Bill Chandler +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 10:42:38 -0700 +User-Agent: KMail/1.6.2 +Cc: pgsql-perform +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> +In-Reply-To: <20050421173855.76286.qmail@web51410.mail.yahoo.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504211042.38633.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/577 +X-Sequence-Number: 11974 + +Bill, + +> Honestly, this seems like an inordinate amount of +> babysitting for a production application. I'm not +> sure if the client will be willing to accept it. + +Well, then, tell them not to delete 75% of the rows in a table at once. I +imagine that operation brought processing to a halt, too. + +> Admittedly my knowledge of the inner workings of an +> RDBMS is limited, but could somebody explain to me why +> this would be so? If you delete a bunch of rows why +> doesn't the index get updated at the same time? + +It does get updated. What doesn't happen is the space getting reclaimed. In +a *normal* data situation, those dead nodes would be replaced with new index +nodes. However, a mass-delete-in-one-go messes that system up. + +> Is +> this a common issue among all RDBMSs or is it +> something that is PostgreSQL specific? + +Speaking from experience, this sort of thing affects MSSQL as well, although +the maintenance routines are different. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:45:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6283153ED7 + for ; + Thu, 21 Apr 2005 14:45:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47813-07 + for ; + Thu, 21 Apr 2005 17:45:13 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B809534FB + for ; + Thu, 21 Apr 2005 14:45:12 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7263629; Thu, 21 Apr 2005 10:47:07 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Bill Chandler +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 10:44:48 -0700 +User-Agent: KMail/1.6.2 +Cc: pgsql-perform +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> +In-Reply-To: <20050421173855.76286.qmail@web51410.mail.yahoo.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504211044.48794.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/578 +X-Sequence-Number: 11975 + +Bill, + +> Honestly, this seems like an inordinate amount of +> babysitting for a production application. I'm not +> sure if the client will be willing to accept it. + +Well, then, tell them not to delete 75% of the rows in a table at once. I +imagine that operation brought processing to a halt, too. + +If the client isn't willing to accept the consequences of their own bad data +management, I'm not really sure what you expect us to do about it. + +> Admittedly my knowledge of the inner workings of an +> RDBMS is limited, but could somebody explain to me why +> this would be so? If you delete a bunch of rows why +> doesn't the index get updated at the same time? + +It does get updated. What doesn't happen is the space getting reclaimed. In +a *normal* data situation, the dead nodes are recycled for new rows. But +doing a massive delete operation upsets that, and generally needs to be +followed by a REINDEX. + +> Is +> this a common issue among all RDBMSs or is it +> something that is PostgreSQL specific? + +Speaking from experience, this sort of thing affects MSSQL as well, although +the maintenance routines are different. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 15:04:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 10732539C5 + for ; + Thu, 21 Apr 2005 15:04:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53365-06 + for ; + Thu, 21 Apr 2005 18:04:06 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 9965753F7A + for ; + Thu, 21 Apr 2005 15:04:04 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 38C4930952; Thu, 21 Apr 2005 20:02:52 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 13:47:24 -0400 +Organization: cbbrowne Computing Inc +Lines: 29 +Message-ID: <60fyxk2f9v.fsf@dba2.int.libertyrms.com> +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> + <200504211022.03541.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:DUEbIw+FkfCjKIZfYCUSsTJX1XI= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.159 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/582 +X-Sequence-Number: 11979 + +josh@agliodbs.com (Josh Berkus) writes: +> Bill, +> +>> What about if an out-of-the-ordinary number of rows +>> were deleted (say 75% of rows in the table, as opposed +>> to normal 5%) followed by a 'VACUUM ANALYZE'? �Could +>> things get out of whack because of that situation? +> +> Yes. You'd want to run REINDEX after and event like that. As you should now. + +Based on Tom's recent comments, I'd be inclined to handle this via +doing a CLUSTER, which has the "triple heroism effect" of: + + a) Reorganizing the entire table to conform with the relevant index order, + b) Having the effect of VACUUM FULL, and + c) Having the effect of REINDEX + +all in one command. + +It has all of the "oops, that blocked me for 20 minutes" effect of +REINDEX and VACUUM FULL, but at least it doesn't have the effect +twice... +-- +(format nil "~S@~S" "cbbrowne" "acm.org") +http://www.ntlug.org/~cbbrowne/sap.html +Rules of the Evil Overlord #78. "I will not tell my Legions of Terror +"And he must be taken alive!" The command will be: ``And try to take +him alive if it is reasonably practical.''" + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 14:50:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C3CF0534FB + for ; + Thu, 21 Apr 2005 14:50:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49862-06 + for ; + Thu, 21 Apr 2005 17:50:49 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 67C7252A8B + for ; + Thu, 21 Apr 2005 14:50:48 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7263703; Thu, 21 Apr 2005 10:52:47 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Alex Turner +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 10:50:29 -0700 +User-Agent: KMail/1.6.2 +Cc: Bill Chandler , + pgsql-perform +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> + <200504211022.03541.josh@agliodbs.com> + <33c6269f050421103311a3f3f8@mail.gmail.com> +In-Reply-To: <33c6269f050421103311a3f3f8@mail.gmail.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504211050.29365.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/580 +X-Sequence-Number: 11977 + +Alex, + +> REINDEX DATABASE blah +> +> supposed to rebuild all indices in the database, or must you specify +> each table individualy? (I'm asking because I just tried it and it +> only did system tables) + +"DATABASE + + Recreate all system indexes of a specified database. Indexes on user tables +are not processed. Also, indexes on shared system catalogs are skipped except +in stand-alone mode (see below). " + +http://www.postgresql.org/docs/8.0/static/sql-reindex.html + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 15:04:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E3E8539BA + for ; + Thu, 21 Apr 2005 15:04:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53490-03 + for ; + Thu, 21 Apr 2005 18:04:06 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 99BC853F7B + for ; + Thu, 21 Apr 2005 15:04:04 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 40C7F30953; Thu, 21 Apr 2005 20:02:53 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: How can an index be larger than a table +Date: Thu, 21 Apr 2005 13:51:18 -0400 +Organization: cbbrowne Computing Inc +Lines: 27 +Message-ID: <60br882f3d.fsf@dba2.int.libertyrms.com> +References: <1114078390.26441.232391808@webmail.messagingengine.com> + <200504211031.51567.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:xIor25Dezx9UFGZNhdWxGiv7nNM= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.162 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/581 +X-Sequence-Number: 11978 + +josh@agliodbs.com (Josh Berkus) writes: +> David, +> +>> What also seems weird to me is that the control table has some unique +>> indexes created on it, but the data_upate_events table just has a unique +>> constraint. �Will postgres use an index in the background to enforce +>> this constraint? +> +> If you somehow have a unique constraint without a unique index, something is +> seriously broken. I suspect hacking of system tables. +> +> Otherwise, it sounds like you have index bloat due to mass deletions. Run +> REINDEX, or, preferably, VACUUM FULL and then REINDEX. + +There is in a sense no "best order" for this; VACUUM FULL will wind up +further injuring the indices when it reorganizes the table, which +means that whether you do it first or last, you'll have "index injury." + +This actually seems a plausible case for CLUSTER. (And as Douglas & +Douglas says, "You can become a hero by using CLUSTER." :-)) +-- +(format nil "~S@~S" "cbbrowne" "acm.org") +http://www.ntlug.org/~cbbrowne/sap.html +Rules of the Evil Overlord #78. "I will not tell my Legions of Terror +"And he must be taken alive!" The command will be: ``And try to take +him alive if it is reasonably practical.''" + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 15:24:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0AC3053975 + for ; + Thu, 21 Apr 2005 15:24:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58504-02 + for ; + Thu, 21 Apr 2005 18:24:23 +0000 (GMT) +Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) + by svr1.postgresql.org (Postfix) with ESMTP id DF97453F7F + for ; + Thu, 21 Apr 2005 15:24:18 -0300 (ADT) +Received: from ram.rentec.com (mailhost [192.5.35.66]) + by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id j3LIOCDV008637 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Thu, 21 Apr 2005 14:24:14 -0400 (EDT) +X-Rentec: external +Received: from [192.168.96.111] (bottlenose.rentec.com [192.168.96.111]) + by ram.rentec.com (8.13.1/8.12.1) with ESMTP id j3LIOC5S004496; + Thu, 21 Apr 2005 14:24:12 -0400 (EDT) +Message-ID: <4267EFF9.2000908@rentec.com> +Date: Thu, 21 Apr 2005 14:24:57 -0400 +From: Michael Guerin +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.7.3) Gecko/20040910 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Josh Berkus +Cc: Bill Chandler , + pgsql-perform +Subject: Re: Index bloat problem? +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> + <200504211044.48794.josh@agliodbs.com> +In-Reply-To: <200504211044.48794.josh@agliodbs.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Logged: Logged by unicorn.rentec.com as j3LIOCDV008637 at Thu Apr 21 + 14:24:14 2005 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/583 +X-Sequence-Number: 11980 + + +>>Is +>>this a common issue among all RDBMSs or is it +>>something that is PostgreSQL specific? +>> +>> +> +>Speaking from experience, this sort of thing affects MSSQL as well, although +>the maintenance routines are different. +> +> +> +Yes, this is true with MSSQL too, however sql server implements a defrag +index that doesn't lock up the table.. + +http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_30o9.asp + +"DBCC INDEXDEFRAG can defragment clustered and nonclustered indexes on +tables and views. DBCC INDEXDEFRAG defragments the leaf level of an +index so that the physical order of the pages matches the left-to-right +logical order of the leaf nodes, thus improving index-scanning performance. + +....Every five minutes, DBCC INDEXDEFRAG will report to the user an +estimated percentage completed. DBCC INDEXDEFRAG can be terminated at +any point in the process, and *any completed work is retained.*" + +-michael + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 15:29:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CDE6252951 + for ; + Thu, 21 Apr 2005 15:29:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59333-07 + for ; + Thu, 21 Apr 2005 18:29:08 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F7355294B + for ; + Thu, 21 Apr 2005 15:29:07 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7263941; Thu, 21 Apr 2005 11:31:06 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Michael Guerin +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 11:28:43 -0700 +User-Agent: KMail/1.6.2 +Cc: Bill Chandler , + pgsql-perform +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> + <200504211044.48794.josh@agliodbs.com> + <4267EFF9.2000908@rentec.com> +In-Reply-To: <4267EFF9.2000908@rentec.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504211128.43937.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/584 +X-Sequence-Number: 11981 + +Michael, + +> ....Every five minutes, DBCC INDEXDEFRAG will report to the user an +> estimated percentage completed. DBCC INDEXDEFRAG can be terminated at +> any point in the process, and *any completed work is retained.*" + +Keen. Sounds like something for our TODO list. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 15:38:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 65CBE53768 + for ; + Thu, 21 Apr 2005 15:38:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61913-07 + for ; + Thu, 21 Apr 2005 18:38:31 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id 809C25373A + for ; + Thu, 21 Apr 2005 15:38:30 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3LIcQ206766 + for ; Thu, 21 Apr 2005 13:38:27 -0500 +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <062f2ea825779496716ce4e72b02e62f@richardplotkin.com> +Content-Transfer-Encoding: 7bit +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Thu, 21 Apr 2005 11:38:22 -0700 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/585 +X-Sequence-Number: 11982 + +More info on what is bloating: + +It's only in one database (the one that's most used), and after running +oid2name on the bloated files, the result is (mysteriously) empty. +Here's the run on the three enormous files: + +$ /usr/local/bin/oid2name -d smt -o 160779 + From database "smt": + Filenode Table Name +---------------------- + +$ /usr/local/bin/oid2name -d smt -o 65782869 + From database "smt": + Filenode Table Name +---------------------- + +$ /usr/local/bin/oid2name -d smt -o 83345634 + From database "smt": + Filenode Table Name +---------------------- + +The file list looks like this (with normal sized files mostly removed): +1.0G ./106779 +1.0G ./106779.1 +1.0G ./106779.2 +1.0G ./106779.3 +978M ./106779.4 +1.0G ./65782869 +248M ./65782869.1 + 0B ./65782871 +8.0K ./65782873 +780M ./83345634 + 0B ./83345636 +8.0K ./83345638 + +So does the empty result mean it's a temporary table? There is one +temporary table (in the function previously mentioned) that does get +created and dropped with some regularity. + +Thanks again, +Richard + +On Apr 20, 2005, at 2:06 PM, Richard Plotkin wrote: + +> Hi Tom, +> +>> Q: what have you got the FSM parameters set to? +> +> Here's from postgresql.conf -- FSM at default settings. +> # - Memory - +> +> shared_buffers = 30400 # min 16, at least max_connections*2, +> 8KB each +> work_mem = 32168 # min 64, size in KB +> #maintenance_work_mem = 16384 # min 1024, size in KB +> #max_stack_depth = 2048 # min 100, size in KB +> +> # - Free Space Map - +> +> #max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes +> each +> #max_fsm_relations = 1000 # min 100, ~50 bytes each +> +> # - Kernel Resource Usage - +> +> max_files_per_process = 750 #1000 # min 25 +> #preload_libraries = '' +> +> +>> Q: what exactly is bloating? Without knowing which tables or indexes +>> are growing, it's hard to speculate about the exact causes. Use du +>> and +>> oid2name, or look at pg_class.relpages after a plain VACUUM. +> +> This I do not know. I've disabled the cron jobs and will let the +> system bloat, then I will gather statistics (I'll give it 12-24 +> hours). +> +>> It's likely that the real answer is "you need to vacuum more often +>> than every six hours", but I'm trying not to jump to conclusions. +> +> That could be it, except that I would expect the problem to then look +> more like a gradual increase in CPU usage and a gradual increase in +> use of disk space. Mine could be an invalid assumption, but the +> system here looks like it goes from no problem to 100% problem within +> a minute. +> +> Thanks again! +> Richard +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if +> your +> joining column's datatypes do not match +> + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 01:36:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 86906533E4 + for ; + Thu, 21 Apr 2005 15:41:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64288-04 + for ; + Thu, 21 Apr 2005 18:41:49 +0000 (GMT) +Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id A6DFE52964 + for ; + Thu, 21 Apr 2005 15:41:47 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050421184148.VLNO12171.priv-edtnes51.telusplanet.net@localhost>; + Thu, 21 Apr 2005 12:41:48 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 21 Apr 2005 11:41:48 -0700 +Message-ID: <1114108908.4267f3ec2e0ea@webmail.telus.net> +Date: Thu, 21 Apr 2005 11:41:48 -0700 +From: a3a18850@telus.net +To: Bill Chandler +Cc: pgsql-perform +Subject: Re: Index bloat problem? +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> +In-Reply-To: <20050421170018.2998.qmail@web51403.mail.yahoo.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.074 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO, FROM_ENDS_IN_NUMS, + FROM_HAS_MIXED_NUMS, NO_REAL_NAME +X-Spam-Level: ** +X-Archive-Number: 200504/636 +X-Sequence-Number: 12033 + +Quoting Bill Chandler : + +> Running PostgreSQL 7.4.2, Solaris. +> Client is reporting that the size of an index is +> greater than the number of rows in the table (1.9 +> million vs. 1.5 million). Index was automatically +> created from a 'bigserial unique' column. + +> We have been running 'VACUUM ANALYZE' very regularly. +> In fact, our vacuum schedule has probably been +> overkill. We have been running on a per-table basis +> after every update (many per day, only inserts +> occurring) and after every purge (one per day, +> deleting a day's worth of data). +> +> What about if an out-of-the-ordinary number of rows +> were deleted (say 75% of rows in the table, as opposed +> to normal 5%) followed by a 'VACUUM ANALYZE'? Could +> things get out of whack because of that situation? + +I gather you mean, out-of-the-ordinary for most apps, but not for this client? + +In case nobody else has asked: is your max_fsm_pages big enough to handle all +the deleted pages, across ALL tables hit by the purge? If not, you're +haemorrhaging pages, and VACUUM is probably warning you about exactly that. + +If that's not a problem, you might want to consider partitioning the data. +Take a look at inherited tables. For me, they're a good approximation of +clustered indexes (sigh, miss'em) and equivalent to table spaces. + +My app is in a similar boat to yours: up to 1/3 of a 10M-row table goes away +every day. For each of the child tables that is a candidate to be dropped, there +is a big prologue txn, whichs moves (INSERT then DELETE) the good rows into a +child table that is NOT to be dropped. Then BANG pull the plug on the tables you +don't want. MUCH faster than DELETE: the dropped tables' files' disk space goes +away in one shot, too. + +Just my 2c. + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:03:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B0D4C537C2 + for ; + Thu, 21 Apr 2005 16:03:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71759-01 + for ; + Thu, 21 Apr 2005 19:03:19 +0000 (GMT) +Received: from web51404.mail.yahoo.com (web51404.mail.yahoo.com + [206.190.38.183]) + by svr1.postgresql.org (Postfix) with SMTP id EA5DD535BC + for ; + Thu, 21 Apr 2005 16:03:17 -0300 (ADT) +Received: (qmail 26024 invoked by uid 60001); 21 Apr 2005 19:03:18 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=Za16fPfv6uo/Pd9DcAMMchymCR3m+TDF/ZWQyjVPpSNfqP03ABk0GInejo2CbN7A5iGcJCkne3ELWm/SAxlu7i/wj379btlFlBRNZTjkSjJIkenDp61VzSvtD/KuLZIdVO7dQp7nLAzl/FvsDacFTcBchBu/jAtHjAGLK0BoAMM= + ; +Message-ID: <20050421190318.26022.qmail@web51404.mail.yahoo.com> +Received: from [192.88.67.254] by web51404.mail.yahoo.com via HTTP; + Thu, 21 Apr 2005 12:03:18 PDT +Date: Thu, 21 Apr 2005 12:03:18 -0700 (PDT) +From: Bill Chandler +Subject: Re: Index bloat problem? +To: a3a18850@telus.net +Cc: pgsql-perform +In-Reply-To: 6667 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.893 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/586 +X-Sequence-Number: 11983 + +--- a3a18850@telus.net wrote: +> I gather you mean, out-of-the-ordinary for most +> apps, but not for this client? + +Actually, no. The normal activity is to delete 3-5% +of the rows per day, followed by a VACUUM ANALYZE. +Then over the course of the day (in multiple +transactions) about the same amount are INSERTed (each +transaction followed by a VACUUM ANALYZE on just the +updated table). So 75% deletion is just out of the +ordinary for this app. However, on occasion, deleting +75% of rows is a legitimate action for the client to +take. It would be nice if they didn't have to +remember to do things like REINDEX or CLUSTER or +whatever on just those occasions. + +> In case nobody else has asked: is your max_fsm_pages +> big enough to handle all +> the deleted pages, across ALL tables hit by the +> purge? If not, you're +> haemorrhaging pages, and VACUUM is probably warning +> you about exactly that. + +This parameter is most likely set incorrectly. So +that could be causing problems. Could that be a +culprit for the index bloat, though? + +> If that's not a problem, you might want to consider +> partitioning the data. +> Take a look at inherited tables. For me, they're a +> good approximation of +> clustered indexes (sigh, miss'em) and equivalent to +> table spaces. +> +> My app is in a similar boat to yours: up to 1/3 of a +> 10M-row table goes away +> every day. For each of the child tables that is a +> candidate to be dropped, there +> is a big prologue txn, whichs moves (INSERT then +> DELETE) the good rows into a +> child table that is NOT to be dropped. Then BANG +> pull the plug on the tables you +> don't want. MUCH faster than DELETE: the dropped +> tables' files' disk space goes +> away in one shot, too. +> +> Just my 2c. + +Thanks. + +Bill + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:05:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 92792535BC + for ; + Thu, 21 Apr 2005 16:05:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71174-09 + for ; + Thu, 21 Apr 2005 19:05:47 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D24453855 + for ; + Thu, 21 Apr 2005 16:05:44 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3LJ5iVA019912 + for pgsql-performance@postgresql.org; Thu, 21 Apr 2005 21:05:44 +0200 +Date: Thu, 21 Apr 2005 21:05:44 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: index not used +Message-ID: <20050421190543.GA16548@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/587 +X-Sequence-Number: 11984 + + +Hi folks, + + +I'm doing a simple lookup in a small table by an unique id, and I'm +wondering, why explains tells me seqscan is used instead the key. + +The table looks like: + + id bigint primary key, + a varchar, + b varchar, + c varchar + +and I'm quering: select * from foo where id = 2; + +I've got only 15 records in this table, but I wanna have it as +fast as possible since its used (as a map between IDs and names) +for larger queries. + + +thx +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de + cellphone: +49 174 7066481 +--------------------------------------------------------------------- + -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:12:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5280537AB + for ; + Thu, 21 Apr 2005 16:12:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73981-01 + for ; + Thu, 21 Apr 2005 19:12:11 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id 62DA553709 + for ; + Thu, 21 Apr 2005 16:12:09 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so618988wri + for ; + Thu, 21 Apr 2005 12:12:10 -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=rRTRP451t0c77U7QOIU3Y49WHSbNKFlG77zU35tgR2ctEnJRblPkD7SHtML8gLQRNEBEMyUQps78E06WMeduprN9UcXQZLplTIBwejqa50FT1PerTRp5fFajYXcbhg62Ov/0AX4pfvr2lhj7eTz5B5PrzRQp5XSi9y4j8IBhdHI= +Received: by 10.54.5.61 with SMTP id 61mr25242wre; + Thu, 21 Apr 2005 12:12:09 -0700 (PDT) +Received: by 10.54.86.16 with HTTP; Thu, 21 Apr 2005 12:12:09 -0700 (PDT) +Message-ID: <33c6269f0504211212b0163ac@mail.gmail.com> +Date: Thu, 21 Apr 2005 15:12:09 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: Bill Chandler +Subject: Re: Index bloat problem? +Cc: Josh Berkus , + pgsql-perform +In-Reply-To: <20050421173855.76286.qmail@web51410.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.278 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/588 +X-Sequence-Number: 11985 + +Same thing happens in Oracle + +ALTER INDEX rebuild + +To force a rebuild. It will mark the free blocks as 'free' below the +PCTFREE value for the tablespace. + +Basically If you build an index with 9999 entries. and each entry is +1/4 of a block, the database will write 2500 blocks to the disk. If +you delete a random 75% of the index values, you will now have 2500 +blocks that have 75% free space. The database will reuse that free +space in those blocks as you insert new values, but until then, you +still have 2500 blocks worth of data on a disk, that is only 25% full. + Rebuilding the index forces the system to physically re-allocate all +that data space, and now you have just 2499 entries, that use 625 +blocks. + +I'm not sure that 'blocks' is the correct term in postgres, it's +segments in Oracle, but the concept remains the same. + +Alex Turner +netEconomist + +On 4/21/05, Bill Chandler wrote: +>=20 +> --- Josh Berkus wrote: +> > Bill, +> > +> > > What about if an out-of-the-ordinary number of +> > rows +> > > were deleted (say 75% of rows in the table, as +> > opposed +> > > to normal 5%) followed by a 'VACUUM ANALYZE'? +> > Could +> > > things get out of whack because of that situation? +> > +> > Yes. You'd want to run REINDEX after and event like +> > that. As you should now. +> > +> > -- +> > Josh Berkus +> > Aglio Database Solutions +> > San Francisco +> > +>=20 +> Thank you. Though I must say, that is very +> discouraging. REINDEX is a costly operation, timewise +> and due to the fact that it locks out other processes +> from proceeding. Updates are constantly coming in and +> queries are occurring continuously. A REINDEX could +> potentially bring the whole thing to a halt. +>=20 +> Honestly, this seems like an inordinate amount of +> babysitting for a production application. I'm not +> sure if the client will be willing to accept it. +>=20 +> Admittedly my knowledge of the inner workings of an +> RDBMS is limited, but could somebody explain to me why +> this would be so? If you delete a bunch of rows why +> doesn't the index get updated at the same time? Is +> this a common issue among all RDBMSs or is it +> something that is PostgreSQL specific? Is there any +> way around it? +>=20 +> thanks, +>=20 +> Bill +>=20 +> __________________________________________________ +> Do You Yahoo!? +> Tired of spam? Yahoo! Mail has the best spam protection around +> http://mail.yahoo.com +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +>=20 +> http://archives.postgresql.org +> + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:22:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A44165384C + for ; + Thu, 21 Apr 2005 16:22:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76074-01 + for ; + Thu, 21 Apr 2005 19:22:28 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 916B553801 + for ; + Thu, 21 Apr 2005 16:22:26 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3LJMQ55023175 + for pgsql-performance@postgresql.org; Thu, 21 Apr 2005 21:22:26 +0200 +Date: Thu, 21 Apr 2005 21:22:26 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +Message-ID: <20050421192226.GB16548@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20050415205511.GB20345@nibiru.borg.metux.de> + <6776.1113599567@sss.pgh.pa.us> + <20050417060603.GA23283@nibiru.borg.metux.de> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/589 +X-Sequence-Number: 11986 + +* Jaime Casanova wrote: + + +> Even if your data never changes it *can* change so the function should +> be at most stable not immutable. + +okay, the planner sees that the table could potentionally change. +but - as the dba - I'd like to tell him, this table *never* changes +in practise (or at most there will be an insert once a year) + +isnt there any way to enforce the function to be really immutable ? + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de + cellphone: +49 174 7066481 +--------------------------------------------------------------------- + -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:23:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AEB9E5381C + for ; + Thu, 21 Apr 2005 16:23:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75490-08 + for ; + Thu, 21 Apr 2005 19:23:48 +0000 (GMT) +Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) + by svr1.postgresql.org (Postfix) with SMTP id CA8A55385D + for ; + Thu, 21 Apr 2005 16:23:46 -0300 (ADT) +Received: (qmail 6950 invoked from network); 21 Apr 2005 21:02:03 -0000 +Received: from unknown (HELO ?64.141.15.12?) (64.141.15.12) + by radius.wavefire.com with SMTP; 21 Apr 2005 21:02:03 -0000 +From: Darcy Buskermolen +Organization: Wavefire Technologies Corp +To: weigelt@metux.de +Subject: Re: index not used +Date: Thu, 21 Apr 2005 12:23:52 -0700 +User-Agent: KMail/1.7.2 +Cc: postgresql performance list +References: <20050421190543.GA16548@nibiru.borg.metux.de> +In-Reply-To: <20050421190543.GA16548@nibiru.borg.metux.de> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504211223.52612.darcy@wavefire.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/590 +X-Sequence-Number: 11987 + +On Thursday 21 April 2005 12:05, Enrico Weigelt wrote: +> Hi folks, +> +> +> I'm doing a simple lookup in a small table by an unique id, and I'm +> wondering, why explains tells me seqscan is used instead the key. +> +> The table looks like: +> +> id bigint primary key, +> a varchar, +> b varchar, +> c varchar +> +> and I'm quering: select * from foo where id = 2; +> +> I've got only 15 records in this table, but I wanna have it as +> fast as possible since its used (as a map between IDs and names) +> for larger queries. + +The over head to load the index, fetch the record in there, then check the +table for visibility and return the value, is far greater than just doing 15 +compares in the original table. + + + +> +> +> thx + +-- +Darcy Buskermolen +Wavefire Technologies Corp. + +http://www.wavefire.com +ph: 250.717.0200 +fx: 250.763.1759 + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:24:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C44E52964 + for ; + Thu, 21 Apr 2005 16:24:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75490-09 + for ; + Thu, 21 Apr 2005 19:24:01 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 791DD53827 + for ; + Thu, 21 Apr 2005 16:23:57 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3LJNwPY023279 + for pgsql-performance@postgresql.org; Thu, 21 Apr 2005 21:23:58 +0200 +Date: Thu, 21 Apr 2005 21:23:58 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +Message-ID: <20050421192357.GC16548@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <22219.1113839449@sss.pgh.pa.us> <87u0m4j5p0.fsf@stark.xeocode.com> + <25151.1113853826@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <25151.1113853826@sss.pgh.pa.us> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/591 +X-Sequence-Number: 11988 + +* Tom Lane wrote: + + +> Yeah, I was actually thinking about a two-step process: inline the +> function to produce somethig equivalent to a handwritten scalar +> sub-SELECT, and then try to convert sub-SELECTs into joins. + +... back to my original question ... + +What kind of query should I use ? +Is a join better than a function ? + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de + cellphone: +49 174 7066481 +--------------------------------------------------------------------- + -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:33:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D572538EF + for ; + Thu, 21 Apr 2005 16:33:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77158-08 + for ; + Thu, 21 Apr 2005 19:33:07 +0000 (GMT) +Received: from squigy.ddm.wox.org (p223ka.xDSL-1mm.sentex.ca [64.7.151.224]) + by svr1.postgresql.org (Postfix) with ESMTP id F06AA5381C + for ; + Thu, 21 Apr 2005 16:33:04 -0300 (ADT) +Received: from rama.ddm.wox.org (rama.ddm.wox.org [172.20.152.20]) + by squigy.ddm.wox.org (Postfix) with ESMTP id B6B688B802 + for ; + Thu, 21 Apr 2005 15:33:05 -0400 (EDT) +Received: by rama.ddm.wox.org (Postfix, from userid 5000) + id 9862F73043; Thu, 21 Apr 2005 15:33:05 -0400 (EDT) +Date: Thu, 21 Apr 2005 15:33:05 -0400 +From: Dave Chapeskie +To: pgsql-perform +Subject: Re: Index bloat problem? +Message-ID: <20050421193305.GA84813@ddm.wox.org> +Mail-Followup-To: Dave Chapeskie , + pgsql-perform +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> + <200504211044.48794.josh@agliodbs.com> + <4267EFF9.2000908@rentec.com> + <200504211128.43937.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200504211128.43937.josh@agliodbs.com> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.1 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/592 +X-Sequence-Number: 11989 + +On Thu, Apr 21, 2005 at 11:28:43AM -0700, Josh Berkus wrote: +> Michael, +> +> > ....Every five minutes, DBCC INDEXDEFRAG will report to the user an +> > estimated percentage completed. DBCC INDEXDEFRAG can be terminated at +> > any point in the process, and *any completed work is retained.*" +> +> Keen. Sounds like something for our TODO list. +> +> -- +> Josh Berkus +> Aglio Database Solutions +> San Francisco + +See http://archives.postgresql.org/pgsql-general/2005-03/msg01465.php +for my thoughts on a non-blocking alternative to REINDEX. I got no +replies to that message. :-( + + +I've almost got a working solution integrated in the backend that does +correct WAL logging and everything. (Writing the code to write and +replay WAL logs for complicated operations can be very annoying!) + +For now I've gone with a syntax of: + + REINDEX INDEX btree_index_name INCREMENTAL; + +(For now it's not a proper index AM (accessor method), instead the +generic index code knows this is only supported for btrees and directly +calls the btree_compress function.) + +It's not actually a REINDEX per-se in that it doesn't rebuild the whole +index. It holds brief exclusive locks on the index while it shuffles +items around to pack the leaf pages fuller. There were issues with the +code I attached to the above message that have been resolved with the +new code. With respect to the numbers provided in that e-mail the new +code also recycles more pages than before. + +Once I've finished it up I'll prepare and post a patch. + +-- +Dave Chapeskie +OpenPGP Key ID: 0x3D2B6B34 + +From pgsql-performance-owner@postgresql.org Thu Apr 21 16:50:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 75334537E3 + for ; + Thu, 21 Apr 2005 16:50:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80019-09 + for ; + Thu, 21 Apr 2005 19:49:53 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BD1B53678 + for ; + Thu, 21 Apr 2005 16:49:52 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7264412; Thu, 21 Apr 2005 12:51:51 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Dave Chapeskie +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 12:55:01 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-perform +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> + <200504211128.43937.josh@agliodbs.com> + <20050421193305.GA84813@ddm.wox.org> +In-Reply-To: <20050421193305.GA84813@ddm.wox.org> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504211255.01510.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/593 +X-Sequence-Number: 11990 + +Dave, + +> See http://archives.postgresql.org/pgsql-general/2005-03/msg01465.php +> for my thoughts on a non-blocking alternative to REINDEX. I got no +> replies to that message. :-( + +Well, sometimes you have to be pushy. Say, "Hey, comments please?" + +The hackers list is about 75 posts a day, it's easy for people to lose track +of stuff they meant to comment on. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 17:41:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 31F5653B3D + for ; + Thu, 21 Apr 2005 17:40:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95385-02 + for ; + Thu, 21 Apr 2005 20:39:44 +0000 (GMT) +Received: from web30314.mail.mud.yahoo.com (web30314.mail.mud.yahoo.com + [68.142.201.232]) + by svr1.postgresql.org (Postfix) with SMTP id C596A538E8 + for ; + Thu, 21 Apr 2005 17:39:26 -0300 (ADT) +Received: (qmail 72225 invoked by uid 60001); 21 Apr 2005 20:39:27 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=EgTFJIZ1HHVCM61feDxLMO2i5NmehzX43xGlEcbCqX0QpZnCTZLZfnuaa0alSCW+xeDP7WpwzjGmW1js5lR9roNCVDNOC5tsZrukEHuSWRl1zEYHDvLxwg5xKRas30mvVG0H94IulsVASRx7y0EdgkTJ5LIN76hbOlgx9MVOkec= + ; +Message-ID: <20050421203927.72223.qmail@web30314.mail.mud.yahoo.com> +Received: from [63.78.249.254] by web30314.mail.mud.yahoo.com via HTTP; + Thu, 21 Apr 2005 13:39:27 PDT +Date: Thu, 21 Apr 2005 13:39:27 -0700 (PDT) +From: Litao Wu +Subject: Re: index not used +To: weigelt@metux.de, + postgresql performance list +In-Reply-To: 6667 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.989 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD +X-Spam-Level: * +X-Archive-Number: 200504/594 +X-Sequence-Number: 11991 + +If id is PK, the query shoudl return 1 row only... +--- Enrico Weigelt wrote: +> +> Hi folks, +> +> +> I'm doing a simple lookup in a small table by an +> unique id, and I'm +> wondering, why explains tells me seqscan is used +> instead the key. +> +> The table looks like: +> +> id bigint primary key, +> a varchar, +> b varchar, +> c varchar +> +> and I'm quering: select * from foo where id = 2; +> +> I've got only 15 records in this table, but I wanna +> have it as +> fast as possible since its used (as a map between +> IDs and names) +> for larger queries. +> +> +> thx +> -- +> +--------------------------------------------------------------------- +> Enrico Weigelt == metux IT service +> +> phone: +49 36207 519931 www: +> http://www.metux.de/ +> fax: +49 36207 519932 email: +> contact@metux.de +> cellphone: +49 174 7066481 +> +--------------------------------------------------------------------- +> -- DSL ab 0 Euro. -- statische IP -- UUCP -- +> Hosting -- Webshops -- +> +--------------------------------------------------------------------- +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + + + +__________________________________ +Do you Yahoo!? +Yahoo! Small Business - Try our new resources site! +http://smallbusiness.yahoo.com/resources/ + +From pgsql-performance-owner@postgresql.org Thu Apr 21 17:47:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 49C0E53B1B + for ; + Thu, 21 Apr 2005 17:47:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96510-06 + for ; + Thu, 21 Apr 2005 20:46:55 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id EBCEF53B2C + for ; + Thu, 21 Apr 2005 17:46:17 -0300 (ADT) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j3LKkIn9012956; + Thu, 21 Apr 2005 16:46:18 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id ADE7852BE9; Thu, 21 Apr 2005 16:46:18 -0400 (CLT) +Date: Thu, 21 Apr 2005 16:46:18 -0400 +From: Alvaro Herrera +To: Richard Plotkin +Cc: pgsql-performance@postgresql.org +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Message-ID: <20050421204618.GD19744@dcc.uchile.cl> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + + <062f2ea825779496716ce4e72b02e62f@richardplotkin.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <062f2ea825779496716ce4e72b02e62f@richardplotkin.com> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.342 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/595 +X-Sequence-Number: 11992 + +On Thu, Apr 21, 2005 at 11:38:22AM -0700, Richard Plotkin wrote: +> More info on what is bloating: +> +> It's only in one database (the one that's most used), and after running +> oid2name on the bloated files, the result is (mysteriously) empty. +> Here's the run on the three enormous files: +> +> $ /usr/local/bin/oid2name -d smt -o 160779 +> From database "smt": +> Filenode Table Name +> ---------------------- + +Try -f instead of -o ... + +-- +Alvaro Herrera () +"World domination is proceeding according to plan" (Andrew Morton) + +From pgsql-performance-owner@postgresql.org Thu Apr 21 18:08:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ED8A653BA3 + for ; + Thu, 21 Apr 2005 18:08:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99791-02 + for ; + Thu, 21 Apr 2005 21:05:51 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id DF9CB535B9 + for ; + Thu, 21 Apr 2005 18:01:40 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3LL1gd10929 + for ; Thu, 21 Apr 2005 16:01:42 -0500 +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <20050421204618.GD19744@dcc.uchile.cl> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + + <062f2ea825779496716ce4e72b02e62f@richardplotkin.com> + <20050421204618.GD19744@dcc.uchile.cl> +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <25f772179a36fcacc7ac4169350d4781@richardplotkin.com> +Content-Transfer-Encoding: 7bit +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Thu, 21 Apr 2005 14:01:36 -0700 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/596 +X-Sequence-Number: 11993 + +That returned the same result. I also tried oid2name -d smt -x -i -S +and, separately -s, and also separately, -d with all other databases, +and none of the databases turned up any listing, in either oid or +filenode, for any of these three bloated files. One thing I've noticed +is that these oids are all extremely large numbers, whereas the rest of +the oids in /data/base/* are no higher than 40000 or 50000. + +On Apr 21, 2005, at 1:46 PM, Alvaro Herrera wrote: + +> On Thu, Apr 21, 2005 at 11:38:22AM -0700, Richard Plotkin wrote: +>> More info on what is bloating: +>> +>> It's only in one database (the one that's most used), and after +>> running +>> oid2name on the bloated files, the result is (mysteriously) empty. +>> Here's the run on the three enormous files: +>> +>> $ /usr/local/bin/oid2name -d smt -o 160779 +>> From database "smt": +>> Filenode Table Name +>> ---------------------- +> +> Try -f instead of -o ... +> +> -- +> Alvaro Herrera () +> "World domination is proceeding according to plan" (Andrew +> Morton) +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings +> + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 18:58:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E65E5425E + for ; + Thu, 21 Apr 2005 18:58:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04995-01 + for ; + Thu, 21 Apr 2005 21:54:37 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id ABE5953B4E + for ; + Thu, 21 Apr 2005 18:15:10 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 27459357FE; Thu, 21 Apr 2005 14:15:08 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 25B3C356F2; Thu, 21 Apr 2005 14:15:08 -0700 (PDT) +Date: Thu, 21 Apr 2005 14:15:08 -0700 (PDT) +From: Stephan Szabo +To: Enrico Weigelt +Cc: postgresql performance list +Subject: Re: index not used +In-Reply-To: <20050421190543.GA16548@nibiru.borg.metux.de> +Message-ID: <20050421140958.Y59173@megazone.bigpanda.com> +References: <20050421190543.GA16548@nibiru.borg.metux.de> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/597 +X-Sequence-Number: 11994 + +On Thu, 21 Apr 2005, Enrico Weigelt wrote: + +> I'm doing a simple lookup in a small table by an unique id, and I'm +> wondering, why explains tells me seqscan is used instead the key. +> +> The table looks like: +> +> id bigint primary key, +> a varchar, +> b varchar, +> c varchar +> +> and I'm quering: select * from foo where id = 2; +> +> I've got only 15 records in this table, but I wanna have it as +> fast as possible since its used (as a map between IDs and names) +> for larger queries. + +Two general things: + For 15 records, an index scan may not be faster. For simple tests + you can play with enable_seqscan to see, but for more complicated + queries it's a little harder to tell. + If you're using a version earlier than 8.0, you'll need to quote + or cast the value you're searching for due to problems with + cross-type comparisons (the 2 would be treated as int4). + +From pgsql-performance-owner@postgresql.org Thu Apr 21 20:40:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D0F80538AF + for ; + Thu, 21 Apr 2005 20:38:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14707-07 + for ; + Thu, 21 Apr 2005 23:38:32 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 765E9542D9 + for ; + Thu, 21 Apr 2005 19:15:20 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050421221522.JGNV23507.priv-edtnes56.telusplanet.net@localhost>; + Thu, 21 Apr 2005 16:15:22 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 21 Apr 2005 15:15:22 -0700 +Message-ID: <1114121722.426825fa4474f@webmail.telus.net> +Date: Thu, 21 Apr 2005 15:15:22 -0700 +From: Mischa Sandberg +To: Bill Chandler +Cc: a3a18850@telus.net, + pgsql-perform +Subject: Re: Index bloat problem? +References: <20050421190318.26022.qmail@web51404.mail.yahoo.com> +In-Reply-To: <20050421190318.26022.qmail@web51404.mail.yahoo.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/598 +X-Sequence-Number: 11995 + +Quoting Bill Chandler : + +> ... The normal activity is to delete 3-5% of the rows per day, +> followed by a VACUUM ANALYZE. +... +> However, on occasion, deleting 75% of rows is a +> legitimate action for the client to take. + +> > In case nobody else has asked: is your max_fsm_pages +> > big enough to handle all the deleted pages, +> > across ALL tables hit by the purge? + +> This parameter is most likely set incorrectly. So +> that could be causing problems. Could that be a +> culprit for the index bloat, though? + +Look at the last few lines of vacuum verbose output. +It will say something like: + +free space map: 55 relations, 88416 pages stored; 89184 total pages needed + Allocated FSM size: 1000 relations + 1000000 pages = 5920 kB shared memory. + +"1000000" here is [max_fsm_pages] from my postgresql.conf. +If the "total pages needed" is bigger than the pages +fsm is allocated for, then you are bleeding. +-- +"Dreams come true, not free." -- S.Sondheim, ITW + + +From pgsql-performance-owner@postgresql.org Thu Apr 21 20:41:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 59AF553B57 + for ; + Thu, 21 Apr 2005 20:41:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16734-04 + for ; + Thu, 21 Apr 2005 23:41:10 +0000 (GMT) +Received: from web51404.mail.yahoo.com (web51404.mail.yahoo.com + [206.190.38.183]) + by svr1.postgresql.org (Postfix) with SMTP id A178353BAD + for ; + Thu, 21 Apr 2005 19:59:24 -0300 (ADT) +Received: (qmail 11939 invoked by uid 60001); 21 Apr 2005 22:59:26 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=Zw9Y+WE+WnvNzpm9AR00fBsQSgHxcUcv5yfqdX5P1QXQhjhHnB6VYpfPMqx7H8UTwQ6gah5pT9d1N4sDdUU/McnjldQ0X+ueBcrXa7WSkU9iJvtUGcvzx5MFsUaKg66XQJfo56p3TnowCXIa7WrMOEZoEPsZlvTChe/jhnPObSQ= + ; +Message-ID: <20050421225926.11937.qmail@web51404.mail.yahoo.com> +Received: from [192.88.67.254] by web51404.mail.yahoo.com via HTTP; + Thu, 21 Apr 2005 15:59:26 PDT +Date: Thu, 21 Apr 2005 15:59:26 -0700 (PDT) +From: Bill Chandler +Subject: Re: Index bloat problem? +To: Mischa Sandberg , + pgsql-perform +In-Reply-To: 6667 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.887 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/599 +X-Sequence-Number: 11996 + +Mischa, + +Thanks. Yes, I understand that not having a large +enough max_fsm_pages is a problem and I think that it +is most likely the case for the client. What I wasn't +sure of was if the index bloat we're seeing is the +result of the "bleeding" you're talking about or +something else. + +If I deleted 75% of the rows but had a max_fsm_pages +setting that still exceeded the pages required (as +indicated in VACUUM output), would that solve my +indexing problem or would I still need to REINDEX +after such a purge? + +regards, + +Bill + +--- Mischa Sandberg wrote: +> Quoting Bill Chandler : +> +> > ... The normal activity is to delete 3-5% of the +> rows per day, +> > followed by a VACUUM ANALYZE. +> ... +> > However, on occasion, deleting 75% of rows is a +> > legitimate action for the client to take. +> +> > > In case nobody else has asked: is your +> max_fsm_pages +> > > big enough to handle all the deleted pages, +> > > across ALL tables hit by the purge? +> +> > This parameter is most likely set incorrectly. So +> > that could be causing problems. Could that be a +> > culprit for the index bloat, though? +> +> Look at the last few lines of vacuum verbose output. +> It will say something like: +> +> free space map: 55 relations, 88416 pages stored; +> 89184 total pages needed +> Allocated FSM size: 1000 relations + 1000000 pages +> = 5920 kB shared memory. +> +> "1000000" here is [max_fsm_pages] from my +> postgresql.conf. +> If the "total pages needed" is bigger than the pages +> +> fsm is allocated for, then you are bleeding. +> -- +> "Dreams come true, not free." -- S.Sondheim, ITW +> +> + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com + +From pgsql-performance-owner@postgresql.org Thu Apr 21 20:54:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BCB2E53799 + for ; + Thu, 21 Apr 2005 20:54:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22679-05 + for ; + Thu, 21 Apr 2005 23:54:06 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E9ED53790 + for ; + Thu, 21 Apr 2005 20:54:05 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3LNs75X000909; (envelope-from ) Thu, + 21 Apr 2005 18:54:07 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3LNs6QR018049 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Thu, + 21 Apr 2005 18:54:07 -0500 (CDT) +Message-ID: <42683D20.3060309@arbash-meinel.com> +Date: Thu, 21 Apr 2005 18:54:08 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Bill Chandler , pgsql-performance@postgresql.org +Subject: Re: Index bloat problem? +References: <20050421225926.11937.qmail@web51404.mail.yahoo.com> +In-Reply-To: <20050421225926.11937.qmail@web51404.mail.yahoo.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig1023F54D0CE8B811DA7182C0" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/601 +X-Sequence-Number: 11998 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig1023F54D0CE8B811DA7182C0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Bill Chandler wrote: + +>Mischa, +> +>Thanks. Yes, I understand that not having a large +>enough max_fsm_pages is a problem and I think that it +>is most likely the case for the client. What I wasn't +>sure of was if the index bloat we're seeing is the +>result of the "bleeding" you're talking about or +>something else. +> +>If I deleted 75% of the rows but had a max_fsm_pages +>setting that still exceeded the pages required (as +>indicated in VACUUM output), would that solve my +>indexing problem or would I still need to REINDEX +>after such a purge? +> +>regards, +> +>Bill +> +> +I don't believe VACUUM re-packs indexes. It just removes empty index +pages. So if you have 1000 index pages all with 1 entry in them, vacuum +cannot reclaim any pages. REINDEX re-packs the pages to 90% full. + +fsm just needs to hold enough pages that all requests have free space +that can be used before your next vacuum. It is just a map letting +postgres know where space is available for a new fill. + +John +=:-> + + +--------------enig1023F54D0CE8B811DA7182C0 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCaD0gJdeBCYSNAAMRAhdVAJ0fzLP8hNEyuAis+Ncv/wxosR85KACcDgT6 +4FhK7ITaWIJvdxOue5M4COU= +=uN+X +-----END PGP SIGNATURE----- + +--------------enig1023F54D0CE8B811DA7182C0-- + +From pgsql-performance-owner@postgresql.org Thu Apr 21 20:51:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3BCE25376D + for ; + Thu, 21 Apr 2005 20:51:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22247-03 + for ; + Thu, 21 Apr 2005 23:51:08 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id C608653488 + for ; + Thu, 21 Apr 2005 20:51:06 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7265281; Thu, 21 Apr 2005 16:53:08 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Bill Chandler +Subject: Re: Index bloat problem? +Date: Thu, 21 Apr 2005 16:56:18 -0700 +User-Agent: KMail/1.7.1 +Cc: Mischa Sandberg , + pgsql-perform +References: <20050421225926.11937.qmail@web51404.mail.yahoo.com> +In-Reply-To: <20050421225926.11937.qmail@web51404.mail.yahoo.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504211656.18324.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/600 +X-Sequence-Number: 11997 + +Bill, + +> If I deleted 75% of the rows but had a max_fsm_pages +> setting that still exceeded the pages required (as +> indicated in VACUUM output), would that solve my +> indexing problem or would I still need to REINDEX +> after such a purge? + +Depends on the performance you're expecting. The FSM relates the the re-use +of nodes, not taking up free space. So after you've deleted 75% of rows, +the index wouldn't shrink. It just wouldn't grow when you start adding rows. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 21 21:06:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D7F4952951 + for ; + Thu, 21 Apr 2005 21:06:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26641-07 + for ; + Fri, 22 Apr 2005 00:06:15 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id C6D6F5378E + for ; + Thu, 21 Apr 2005 21:06:13 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3M06F6f015626 + for pgsql-performance@postgresql.org; Fri, 22 Apr 2005 02:06:15 +0200 +Date: Fri, 22 Apr 2005 02:06:15 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: foreign key performance +Message-ID: <20050422000615.GA10930@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/602 +X-Sequence-Number: 11999 + + +Hi folks, + + +do foreign keys have any influence on performance (besides slowing +down huge inserts) ? do they bring any performance improvement ? + + +thx +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de + cellphone: +49 174 7066481 +--------------------------------------------------------------------- + -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 22 00:34:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CBCB653FDD + for ; + Fri, 22 Apr 2005 00:33:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81442-06 + for ; + Fri, 22 Apr 2005 03:33:52 +0000 (GMT) +Received: from hp.vpac.org (vpac.org [131.170.184.3]) + by svr1.postgresql.org (Postfix) with ESMTP id D8C4153FD3 + for ; + Fri, 22 Apr 2005 00:33:44 -0300 (ADT) +Received: by hp.vpac.org (Postfix, from userid 557) + id 897B2A1403C; Fri, 22 Apr 2005 13:33:31 +1000 (EST) +Received: from localhost (localhost [127.0.0.1]) + by hp.vpac.org (Postfix) with ESMTP id 8803A68103; + Fri, 22 Apr 2005 13:33:31 +1000 (EST) +Date: Fri, 22 Apr 2005 13:33:31 +1000 (EST) +From: "Shoaib Burq (VPAC)" +To: John A Meinel +Cc: Russell Smith , + Jeff , +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: <4267C34D.9010705@arbash-meinel.com> +Message-ID: +MIME-Version: 1.0 +Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1675299676-1114140811=:14851" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.058 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/603 +X-Sequence-Number: 12000 + + This message is in MIME format. The first part should be readable text, + while the remaining parts are likely unreadable without MIME-aware tools. + Send mail to mime@docserver.cac.washington.edu for more info. + +--8323328-1675299676-1114140811=:14851 +Content-Type: TEXT/PLAIN; charset=US-ASCII + +Please see attached the output from explain analyse. This is with the + + shared_buffers = 10600 + work_mem = 102400 + enable_seqscan = true + +BTW I guess should mention that I am doing the select count(*) on a View. + +Ran the Explain analyse with the nestedloop disabled but it was taking +forever... and killed it after 30mins. + +Thanks +shoaib +On Thu, 21 Apr 2005, John A Meinel wrote: + +> Shoaib Burq (VPAC) wrote: +> +> >Just tried it with the following changes: +> > +> >shared_buffers = 10600 +> >work_mem = 102400 +> >enable_seqscan = false +> > +> >still no improvement +> > +> >Ok here's the Plan with the enable_seqscan = false: +> >ausclimate=# explain ANALYZE select count(*) from "getfutureausclimate"; +> > +> > +> Actually, you probably don't want enable_seqscan=off, you should try: +> SET enable_nestloop TO off. +> The problem is that it is estimating there will only be 44 rows, but in +> reality there are 13M rows. It almost definitely should be doing a +> seqscan with a sort and merge join. +> +> Also, please attach you explain analyzes, the wrapping is really hard to +> read. +> +> I don't understand how postgres could get the number of rows that wrong. +> +> It seems to be misestimating the number of entries in IX_ClimateId +> +> Here: +> +> -> Index Scan using "PK_Aus40_DEM" on "Aus40_DEM" (cost=0.00..6.01 rows=1 width=16) (actual time=0.005..0.006 rows=1 loops=13276368) +> Index Cond: ("outer"."AusPosNumber" = "Aus40_DEM"."AusPosNumber") +> -> Index Scan using "PK_CurrentAusClimate" on "CurrentAusClimate" (cost=0.00..46.20 rows=11 width=14) (actual time=0.007..0.009 rows=1 loops=13276368) +> +> The first index scan is costing you 0.006*13276368=79s, and the second one is 119s. +> +> I can't figure out exactly what is where from the formatting, but the query that seems misestimated is: +> -> Index Scan using "IX_ClimateId" on "ClimateChangeModel40" (cost=0.00..1063711.75 rows=265528 width=20) (actual time=28.311..17212.703 rows=13276368 loops=1) +> Index Cond: ("outer"."ClimateId" = "ClimateChangeModel40"."ClimateId") +> +> Is there an unexpected correlaction between +> ClimateChangeModel40"."ClimateId" and whatever "outer" is at this point? +> +> John +> =:-> +> +> + + +--8323328-1675299676-1114140811=:14851 +Content-Type: TEXT/plain; name="explain_analyse_getfutureausclimate.txt" +Content-Transfer-Encoding: BASE64 +Content-ID: +Content-Description: +Content-Disposition: attachment; + filename="explain_analyse_getfutureausclimate.txt" + +YXVzY2xpbWF0ZT0jIEVYUExBSU4gQU5BTFlaRSAgc2VsZWN0IGNvdW50KCop +IGZyb20gImdldGZ1dHVyZWF1c2NsaW1hdGUiOw0KICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgDQoNCiAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +IA0KUVVFUlkgUExBTg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSQNCiBBZ2dyZWdhdGUgKGNvc3Q9 +MTA2OTM0NS44NS4uMTA2OTM0NS44NSByb3dzPTEgd2lkdGg9MCkgKGFjdHVh +bCB0aW1lPTQ0MzI0MS4yNDEuLjQ0MzI0MS4yNDIgcm93cz0xIGxvb3BzPTEp +DQogICAtPiBTdWJxdWVyeSBTY2FuIGdldGZ1dHVyZWF1c2NsaW1hdGUgKGNv +c3Q9MTA2OTM0NS42MS4uMTA2OTM0NS44MSByb3dzPTE2IHdpZHRoPTApIChh +Y3R1YWwgdGltZT00MTE0NDkuMDM0Li40MzYxNjUuMjU5IHJvd3M9MTMyNzYz +NjggbG9vcHM9MSkNCiAgICAgICAgIC0+IFNvcnQgKGNvc3Q9MTA2OTM0NS42 +MS4uMTA2OTM0NS42NSByb3dzPTE2IHdpZHRoPTU4KSAoYWN0dWFsIHRpbWU9 +NDExNDQ5LjAyNi4uNDI2MDAxLjE5OSByb3dzPTEzMjc2MzY4IGxvb3BzPTEp +DQogICAgICAgICAgICAgICBTb3J0IEtleTogIkF1czQwX0RFTSIuIkF1c1Bv +c051bWJlciIsICJDdXJyZW50QXVzQ2xpbWF0ZSIuImlNb250aCIgDQogICAg +ICAgICAgICAgICAtPiBOZXN0ZWQgTG9vcCAoY29zdD0yLjE5Li4xMDY5MzQ1 +LjI5IHJvd3M9MTYgd2lkdGg9NTgpIChhY3R1YWwgdGltZT0xMzUuMzkwLi4z +NjY5MDIuMzczIHJvd3M9MTMyNzYzNjggbG9vcHM9MSkNCiAgICAgICAgICAg +ICAgICAgICAgIC0+IE5lc3RlZCBMb29wIChjb3N0PTIuMTkuLjEwNjczMDQu +MDcgcm93cz00NCB3aWR0aD02OCkgKGFjdHVhbCB0aW1lPTEwNy42MjcuLjE4 +NjM5MC4xMzcgcm93cz0xMzI3NjM2OCBsb29wcz0xKSAgICAgDQogICAgICAg +ICAgICAgICAgICAgICAgICAgICAtPiBOZXN0ZWQgTG9vcCAoY29zdD0yLjE5 +Li4xMDY3MDM4Ljk0IHJvd3M9NDQgd2lkdGg9NTIpIChhY3R1YWwgdGltZT04 +Ny4yNTUuLjQ5NzQzLjc5NiByb3dzPTEzMjc2MzY4IGxvb3BzPTEpDQogICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtPiBOZXN0ZWQgTG9vcCAo +Y29zdD0yLjE5Li44LjA5IHJvd3M9MSB3aWR0aD0zMikgKGFjdHVhbCB0aW1l +PTUyLjY4NC4uNTIuNjk1IHJvd3M9MSBsb29wcz0xKQ0KICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgLT4gTWVyZ2UgSm9pbiAoY29z +dD0yLjE5Li4yLjI0IHJvd3M9MSB3aWR0aD0yNCkgKGFjdHVhbCB0aW1lPTI4 +LjAwMC4uMjguMDA3IHJvd3M9MSBsb29wcz0xKQ0KICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVyZ2UgQ29uZDogKCJv +dXRlciIuIkNsaW1hdGVJZCIgPSAiaW5uZXIiLiJDbGltYXRlSWQiKQ0KICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLT4g +U29ydCAoY29zdD0xLjE3Li4xLjE5IHJvd3M9NyB3aWR0aD0xMCkgKGFjdHVh +bCB0aW1lPTEwLjMwNi4uMTAuMzA3IHJvd3M9MyBsb29wcz0xKQ0KICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +U29ydCBLZXk6ICJDbGltYXRlVmFyaWFibGVzIi4iQ2xpbWF0ZUlkIg0KICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgLT4gU2VxIFNjYW4gb24gIkNsaW1hdGVWYXJpYWJsZXMiICAoY29zdD0w +LjAwLi4xLjA3IHJvd3M9NyB3aWR0aD0xMCkgKGFjdHVhbCB0aW1lPTEwLjI3 +Ny4uMTAuMjg2IHJvd3M9NyBsb29wcz0xKQ0KICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgLT4gU29ydCAoY29zdD0xLjAy +Li4xLjAyIHJvd3M9MSB3aWR0aD0xNCkgKGFjdHVhbCB0aW1lPTE3LjY3OS4u +MTcuNjgwIHJvd3M9MSBsb29wcz0xKQ0KICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU29ydCBLZXk6ICJHZXRG +dXR1cmVDbGltYXRlUGFyYW1ldGVycyIuIkNsaW1hdGVJZCIgDQogICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAt +PiBTZXEgU2NhbiBvbiAiR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRlcnMiICAo +Y29zdD0wLjAwLi4xLjAxIHJvd3M9MSB3aWR0aD0xNCkgKGFjdHVhbCB0aW1l +PTE3LjY2OS4uMTcuNjcxIHJvd3M9MSBsb29wcz0xKQ0KICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgLT4gSW5kZXggU2NhbiB1c2lu +ZyAiUEtfU2NlbmFyaW9FbWlzc2lvbkxldmVscyIgb24gIlNjZW5hcmlvRW1p +c3Npb25MZXZlbHMiICAoY29zdD0wLjAwLi41LjgzIHJvd3M9MSB3aWR0aD0x +OCkgKGFjdHVhbCB0aW1lPTI0LjY3Ni4uMjQuNjc5IHJvd3M9MSBsb29wcz0x +KQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgSW5kZXggQ29uZDogKCgiU2NlbmFyaW9FbWlzc2lvbkxldmVscyIuIlNj +ZW5hcmlvSWQiID0gIm91dGVyIi4iU2NlbmFyaW9JZCIpIEFORCAoIlNjZW5h +cmlvRW1pc3Npb25MZXZlbHMiLiJpWWVhciIgPSAib3V0ZXIiLiJpWWVhciIp +IEFORCAoIlNjZW5hcmlvRW1pc3Npb25MZXZlbHMiLiJMZXZlbElkIiA9ICJv +dXRlciIuIkxldmVsSWQiKSkNCiAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgIC0+IEluZGV4IFNjYW4gdXNpbmcgIklYX0NsaW1hdGVJZCIgb24g +IkNsaW1hdGVDaGFuZ2VNb2RlbDQwIiAgKGNvc3Q9MC4wMC4uMTA2MzcxMS43 +NSByb3dzPTI2NTUyOCB3aWR0aD0yMCkgKGFjdHVhbCB0aW1lPTM0LjU2NC4u +MTk0MzUuODU1IHJvd3M9MTMyNzYzNjggbG9vcHM9MSkNCiAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4IENvbmQ6ICgib3V0 +ZXIiLiJDbGltYXRlSWQiID0gIkNsaW1hdGVDaGFuZ2VNb2RlbDQwIi4iQ2xp +bWF0ZUlkIikNCiAgICAgICAgICAgICAgICAgICAgICAgICAgIC0+IEluZGV4 +IFNjYW4gdXNpbmcgIlBLX0F1czQwX0RFTSIgb24gIkF1czQwX0RFTSIgIChj +b3N0PTAuMDAuLjYuMDEgcm93cz0xIHdpZHRoPTE2KSAoYWN0dWFsIHRpbWU9 +MC4wMDUuLjAuMDA2IHJvd3M9MSBsb29wcz0xMzI3NjM2OCkNCiAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4IENvbmQ6ICgib3V0ZXIi +LiJBdXNQb3NOdW1iZXIiID0gIkF1czQwX0RFTSIuIkF1c1Bvc051bWJlciIp +ICAgDQogICAgICAgICAgICAgICAgICAgICAtPiBJbmRleCBTY2FuIHVzaW5n +ICJQS19DdXJyZW50QXVzQ2xpbWF0ZSIgb24gIkN1cnJlbnRBdXNDbGltYXRl +IiAgKGNvc3Q9MC4wMC4uNDYuMjAgcm93cz0xMSB3aWR0aD0xNCkgKGFjdHVh +bCB0aW1lPTAuMDA3Li4wLjAwOSByb3dzPTEgbG9vcHM9MTMyNzYzNjgpDQog +ICAgICAgICAgICAgICAgICAgICAgICAgICBJbmRleCBDb25kOiAoKCJDdXJy +ZW50QXVzQ2xpbWF0ZSIuIkNsaW1hdGVJZCIgPSAib3V0ZXIiLiJDbGltYXRl +SWQiKSBBTkQgKCJvdXRlciIuIkF1c1Bvc051bWJlciIgPSAiQ3VycmVudEF1 +c0NsaW1hdGUiLiJBdXNQb3NOdW0iKSBBTkQgKCJDdXJyZW50QXVzQ2xpbWF0 +ZSIuImlNb250aCIgPSAib3V0ZXIiLiJpTW9udGgiKSkNCiBUb3RhbCBydW50 +aW1lOiA0NDM5ODMuMjY5IG1zICgyNSByb3dzKQ0K +--8323328-1675299676-1114140811=:14851-- + +From pgsql-performance-owner@postgresql.org Fri Apr 22 00:55:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0560E53569 + for ; + Fri, 22 Apr 2005 00:55:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85574-07 + for ; + Fri, 22 Apr 2005 03:55:33 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 86D1F5345D + for ; + Fri, 22 Apr 2005 00:55:22 -0300 (ADT) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j3M3tM8T017333 + for ; + Thu, 21 Apr 2005 23:55:22 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id EF2DB52EA3; Thu, 21 Apr 2005 23:55:21 -0400 (CLT) +Date: Thu, 21 Apr 2005 23:55:21 -0400 +From: Alvaro Herrera +To: postgresql performance list +Subject: Re: foreign key performance +Message-ID: <20050422035521.GE24057@dcc.uchile.cl> +References: <20050422000615.GA10930@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <20050422000615.GA10930@nibiru.borg.metux.de> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.342 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/604 +X-Sequence-Number: 12001 + +On Fri, Apr 22, 2005 at 02:06:15AM +0200, Enrico Weigelt wrote: + +> do foreign keys have any influence on performance (besides slowing +> down huge inserts) ? do they bring any performance improvement ? + +No. They only cause additional tables to be visited to enforce them. + +-- +Alvaro Herrera () +"Ciencias pol�ticas es la ciencia de entender por qu� + los pol�ticos act�an como lo hacen" (netfunny.com) + +From pgsql-performance-owner@postgresql.org Fri Apr 22 00:58:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AA23253456 + for ; + Fri, 22 Apr 2005 00:58:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85229-08 + for ; + Fri, 22 Apr 2005 03:58:29 +0000 (GMT) +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D4E25367E + for ; + Fri, 22 Apr 2005 00:57:48 -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 j3M3vMTg004287; + Fri, 22 Apr 2005 13:57:24 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + j3M3vH6T004284; Fri, 22 Apr 2005 13:57:19 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Fri, 22 Apr 2005 13:57:17 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: "Shoaib Burq (VPAC)" +Cc: John A Meinel , + Russell Smith , Jeff , + pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: +Message-ID: +References: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/605 +X-Sequence-Number: 12002 + +On Fri, 22 Apr 2005, Shoaib Burq (VPAC) wrote: + +> Please see attached the output from explain analyse. This is with the +> +> shared_buffers = 10600 +> work_mem = 102400 +> enable_seqscan = true +> +> BTW I guess should mention that I am doing the select count(*) on a View. +> +> Ran the Explain analyse with the nestedloop disabled but it was taking +> forever... and killed it after 30mins. + +Try increasing stats collection on ClimateChangeModel40.ClimateId: + +alter table ClimateChangeModel40 alter column ClimateId set statistics 1000; +analyze ClimateChangeModel40; + +Gavin + +From pgsql-performance-owner@postgresql.org Fri Apr 22 02:57:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5395F53AA1 + for ; + Fri, 22 Apr 2005 02:57:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13617-05 + for ; + Fri, 22 Apr 2005 05:57:12 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D91C53A90 + for ; + Fri, 22 Apr 2005 02:57:11 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3M5vBfu027014; + Fri, 22 Apr 2005 01:57:11 -0400 (EDT) +To: Bill Chandler +Cc: pgsql-perform +Subject: Re: Index bloat problem? +In-reply-to: <20050421170018.2998.qmail@web51403.mail.yahoo.com> +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> +Comments: In-reply-to Bill Chandler + message dated "Thu, 21 Apr 2005 10:00:18 -0700" +Date: Fri, 22 Apr 2005 01:57:11 -0400 +Message-ID: <27013.1114149431@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/606 +X-Sequence-Number: 12003 + +Bill Chandler writes: +> Client is reporting that the size of an index is +> greater than the number of rows in the table (1.9 +> million vs. 1.5 million). + +This thread seems to have wandered away without asking the critical +question "what did you mean by that?" + +It's not possible for an index to have more rows than there are in +the table unless something is seriously broken. And there aren't +any SQL operations that let you inspect an index directly anyway. +So: what is the actual observation that led you to the above +conclusion? Facts, please, not inferences. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 22 05:08:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D30353DF3 + for ; + Fri, 22 Apr 2005 05:08:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45902-07 + for ; + Fri, 22 Apr 2005 08:08:04 +0000 (GMT) +Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net + [194.217.242.91]) + by svr1.postgresql.org (Postfix) with ESMTP id D36A85337D + for ; + Fri, 22 Apr 2005 05:08:03 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-33.mail.demon.net with esmtp (Exim 4.42) + id 1DOtCk-0005xp-Cd + for pgsql-performance@postgresql.org; Fri, 22 Apr 2005 08:08:04 +0000 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Fri, 22 Apr 2005 09:08:01 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +Thread-Index: AcVGcyPwWaLweJHjQ7KCoptZG1hs5wAnycmg +From: "Dave Page" +To: "Andreas Pflug" , + "Joel Fradkin" +Cc: "John A Meinel" , , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/607 +X-Sequence-Number: 12004 + +=20 + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org=20 +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> Andreas Pflug +> Sent: 21 April 2005 14:06 +> To: Joel Fradkin +> Cc: 'John A Meinel'; josh@agliodbs.com;=20 +> pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +>=20 +> Beware! +> From the data, I can see that you're probably using pgAdmin3. +> The time to execute your query including transfer of all data to the=20 +> client is 17s in this example, while displaying it (i.e. pure GUI and=20 +> memory alloc stuff) takes 72s. Execute to a file to avoid this. + +Perhaps we should add a guruhint there for longer runtimes? + +Regards, dave + +From pgsql-performance-owner@postgresql.org Fri Apr 22 05:44:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E9A1553DC0 + for ; + Fri, 22 Apr 2005 05:44:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53181-09 + for ; + Fri, 22 Apr 2005 08:44:10 +0000 (GMT) +Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com + [66.111.4.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 57859531DF + for ; + Fri, 22 Apr 2005 05:44:09 -0300 (ADT) +Received: from frontend3.messagingengine.com (frontend3.internal + [10.202.2.152]) + by frontend1.messagingengine.com (Postfix) with ESMTP id 4009AC77113; + Fri, 22 Apr 2005 04:44:11 -0400 (EDT) +X-Sasl-enc: h2bd2TYZnenNhYVW8aNn9OJ3Vf38rU1zTAtpkmMuR8jP 1114159449 +Received: from [192.168.0.8] (i-83-67-25-205.freedom2surf.net [83.67.25.205]) + by www.fastmail.fm (Postfix) with ESMTP id B9C3B88; + Fri, 22 Apr 2005 04:44:06 -0400 (EDT) +In-Reply-To: <27013.1114149431@sss.pgh.pa.us> +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> + <27013.1114149431@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <869771629a1d24a91b8df779f7cddfe9@diroussel.xsmail.com> +Content-Transfer-Encoding: 7bit +Cc: Bill Chandler , + pgsql-perform +From: David Roussel +Subject: Re: Index bloat problem? +Date: Fri, 22 Apr 2005 09:44:05 +0100 +To: Tom Lane +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/608 +X-Sequence-Number: 12005 + +On 22 Apr 2005, at 06:57, Tom Lane wrote: +> Bill Chandler writes: +>> Client is reporting that the size of an index is +>> greater than the number of rows in the table (1.9 +>> million vs. 1.5 million). +> +> This thread seems to have wandered away without asking the critical +> question "what did you mean by that?" +> +> It's not possible for an index to have more rows than there are in +> the table unless something is seriously broken. And there aren't +> any SQL operations that let you inspect an index directly anyway. +> So: what is the actual observation that led you to the above +> conclusion? Facts, please, not inferences. + +I work for the client in question. Glad you picked up on that point. I +covered the detail in my my post "How can an index be larger than a +table" on 21 Apr. 2005. I guess I was too detailed, and too much info +put people off. +http://archives.postgresql.org/pgsql-performance/2005-04/msg00553.php + +quoting from there... + +| +|SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE +relname LIKE 'dave_data%'; +| +|relname relkind reltuples relpages +|======================================= ======= ========= ======== +|dave_data_update_events r 1593600.0 40209 +|dave_data_update_events_event_id_key i 1912320.0 29271 +|dave_data_update_events_event_id_seq S 1.0 1 +|dave_data_update_events_lds_idx i 1593600.0 6139 +|dave_data_update_events_obj_id_idx i 1593600.0 6139 +|iso_pjm_data_update_events_obj_id_idx i 1593600.0 6139 +| + +Note that there are only 1593600 rows in the table, so why the 1912320 +figure? + +Of course I checked that the row count was correct... + +| +|EXPLAIN ANALYZE +|select count(*) from iso_pjm_data_update_events +| +|QUERY PLAN +|Aggregate (cost=60129.00..60129.00 rows=1 width=0) (actual +time=35933.292..35933.293 rows=1 loops=1) +| -> Seq Scan on iso_pjm_data_update_events (cost=0.00..56145.00 +rows=1593600 width=0) (actual time=0.213..27919.497 rows=1593600 +loops=1) +|Total runtime: 35933.489 ms +| + +and... + +| +|select count(*) from iso_pjm_data_update_events +| +|count +|1593600 +| + +so it's not that there are any undeleted rows lying around + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 06:04:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 87A8053DB1 + for ; + Fri, 22 Apr 2005 06:04:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59260-02 + for ; + Fri, 22 Apr 2005 09:04:23 +0000 (GMT) +Received: from localhost.net (cust.89.121.adsl.cistron.nl [195.64.89.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 94F7B53EEC + for ; + Fri, 22 Apr 2005 06:04:20 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by localhost.net (Postfix) with ESMTP + id E2E4983D6D; Fri, 22 Apr 2005 11:04:20 +0200 (CEST) +Message-ID: <4268BE11.6070200@trust-factory.com> +Date: Fri, 22 Apr 2005 11:04:17 +0200 +From: Richard van den Berg +Organization: Trust Factory +User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-perform +Subject: Re: When are index scans used over seq scans? +References: <426665A0.1080102@trust-factory.com> + <26710.1114007961@sss.pgh.pa.us> <4267612C.10803@trust-factory.com> + <15074.1114093502@sss.pgh.pa.us> + <4267D1ED.7010606@trust-factory.com> + <16775.1114100611@sss.pgh.pa.us> +In-Reply-To: <16775.1114100611@sss.pgh.pa.us> +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/609 +X-Sequence-Number: 12006 + +Tom Lane wrote: +> Are the tables in question particularly wide (many columns)? + +Yes they are. They both have 20 columns. If I cut down the duration +table to just 1 column of timestamps, the planner uses the index. + +Interesting, so I could store just the timestamps in another table (view +doesn't help) to speed up this query. + +I am using the debian package. How can I tell if profiling is enabled? + +Thanks a lot, + +-- +Richard van den Berg, CISSP +------------------------------------------- +Trust Factory B.V. | www.dna-portal.net +Bazarstraat 44a | www.trust-factory.com +2518AK The Hague | Phone: +31 70 3620684 +The Netherlands | Fax : +31 70 3603009 +------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 22 06:47:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B2EA53B20 + for ; + Fri, 22 Apr 2005 06:47:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68904-07 + for ; + Fri, 22 Apr 2005 09:47:34 +0000 (GMT) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.177]) + by svr1.postgresql.org (Postfix) with ESMTP id B4E2C53B0C + for ; + Fri, 22 Apr 2005 06:47:32 -0300 (ADT) +Received: from p50818B9C.dip0.t-ipconnect.de[80.129.139.156] + (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de with ESMTP (Nemesis), + id 0MKxQS-1DOul310z7-0000NS; Fri, 22 Apr 2005 11:47:33 +0200 +Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) + id 1DOul2-0007ci-1Z; Fri, 22 Apr 2005 11:47:32 +0200 +Message-ID: <4268C833.8080302@pse-consulting.de> +Date: Fri, 22 Apr 2005 09:47:31 +0000 +From: Andreas Pflug +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dave Page +Cc: pgsql-performance@postgresql.org +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +References: + +In-Reply-To: + +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/610 +X-Sequence-Number: 12007 + +Dave Page wrote: +> +> +> +>>-----Original Message----- +>>From: pgsql-performance-owner@postgresql.org +>>[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of +>>Andreas Pflug +>>Sent: 21 April 2005 14:06 +>>To: Joel Fradkin +>>Cc: 'John A Meinel'; josh@agliodbs.com; +>>pgsql-performance@postgresql.org +>>Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +>> +>>Beware! +>> From the data, I can see that you're probably using pgAdmin3. +>>The time to execute your query including transfer of all data to the +>>client is 17s in this example, while displaying it (i.e. pure GUI and +>>memory alloc stuff) takes 72s. Execute to a file to avoid this. +> +> +> Perhaps we should add a guruhint there for longer runtimes? + +Yup, easily done as replacement for the "max rows exceeded" message box. +Added to TODO.txt. + + +Regards, +Andreas + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 07:08:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F101E53B0C + for ; + Fri, 22 Apr 2005 07:08:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74182-02 + for ; + Fri, 22 Apr 2005 10:08:53 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 87D405369B + for ; + Fri, 22 Apr 2005 07:08:50 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so1314871nzf + for ; + Fri, 22 Apr 2005 03:08:50 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=giu9tBSLahQctvUml3qT7FHej95I04fnmmMpGW/I5e3KSgVVZWYU3EcBC8Soe+jQnMI8COKHor4pAbKRosWzmf3gTlrFGoqMs33LxyteBzwviLYkFMUdYBb/+MLvQHZUL6OAdHpaHEOUqOKl8f3gvIKZBoy7Vq6xqO08rz2+yWI= +Received: by 10.36.9.2 with SMTP id 2mr278627nzi; + Fri, 22 Apr 2005 03:08:50 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Fri, 22 Apr 2005 03:08:50 -0700 (PDT) +Message-ID: <758d5e7f0504220308453c0dbc@mail.gmail.com> +Date: Fri, 22 Apr 2005 12:08:50 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: weigelt@metux.de, pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-Reply-To: <20050421192357.GC16548@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> + <22219.1113839449@sss.pgh.pa.us> <87u0m4j5p0.fsf@stark.xeocode.com> + <25151.1113853826@sss.pgh.pa.us> + <20050421192357.GC16548@nibiru.borg.metux.de> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.764 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/611 +X-Sequence-Number: 12008 + +On 4/21/05, Enrico Weigelt wrote: +> * Tom Lane wrote: +>=20 +> +> > Yeah, I was actually thinking about a two-step process: inline the +> > function to produce somethig equivalent to a handwritten scalar +> > sub-SELECT, and then try to convert sub-SELECTs into joins. +>=20 +> ... back to my original question ... +>=20 +> What kind of query should I use ? +> Is a join better than a function ? + +It appears that JOINs are usually faster. So if performance is an +important issue, go with JOIN (and VIEWs probably). Functions are nicer +(in terms off look and feel). + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Fri Apr 22 07:15:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7525153A37 + for ; + Fri, 22 Apr 2005 07:15:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75139-02 + for ; + Fri, 22 Apr 2005 10:15:23 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 288B75367E + for ; + Fri, 22 Apr 2005 07:15:22 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 34so1316687nzf + for ; + Fri, 22 Apr 2005 03:15:25 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=mwaMTjSgnqCbnE+oRR9X1Zw1QJGiMkiZ8a9+5J9/CvTSNSWUgWTA/FF6J853N4cDbbJoD7sa71HoBJGDYpLaOMFj0RKlhFcjmMaAadOtMrIDyWtrSoDIjrEK3IGFRsF82/lWPYKT8GFZBMMiue9wK9NhbamjWEiix2RXyxo1J3k= +Received: by 10.36.12.2 with SMTP id 2mr278571nzl; + Fri, 22 Apr 2005 03:15:24 -0700 (PDT) +Received: by 10.36.22.15 with HTTP; Fri, 22 Apr 2005 03:15:24 -0700 (PDT) +Message-ID: <758d5e7f050422031579a04963@mail.gmail.com> +Date: Fri, 22 Apr 2005 12:15:24 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: weigelt@metux.de, pgsql-performance@postgresql.org +Subject: Re: immutable functions vs. join for lookups ? +In-Reply-To: <20050421192226.GB16548@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <20050415205511.GB20345@nibiru.borg.metux.de> + <6776.1113599567@sss.pgh.pa.us> + <20050417060603.GA23283@nibiru.borg.metux.de> + + <20050421192226.GB16548@nibiru.borg.metux.de> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.681 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP, + RCVD_IN_BL_SPAMCOP_NET +X-Spam-Level: * +X-Archive-Number: 200504/612 +X-Sequence-Number: 12009 + +On 4/21/05, Enrico Weigelt wrote: +> +> > Even if your data never changes it *can* change so the function should +> > be at most stable not immutable. +>=20 +> okay, the planner sees that the table could potentionally change. +> but - as the dba - I'd like to tell him, this table *never* changes +> in practise (or at most there will be an insert once a year) +>=20 +> isnt there any way to enforce the function to be really immutable ? + +Never say never. :) + +And to answer your question -- your IMMUTABLE function may reference +other functions (even VOLATILE). So you may create a "caller" immutable +function which just calls your non-immutable function. But from +performance standpoint there is not much difference (probably your +STABLE function will be faster than STABLE inside IMMUTABLE function). + +Ah, and please note that some time in future PostgreSQL may require +that IMMUTABLE function calls only IMMUTABLE functions. + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Fri Apr 22 08:48:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BFD8653B6F + for ; + Fri, 22 Apr 2005 08:48:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98694-10 + for ; + Fri, 22 Apr 2005 11:48:36 +0000 (GMT) +Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) + by svr1.postgresql.org (Postfix) with ESMTP id BEC6053B2C + for ; + Fri, 22 Apr 2005 08:48:34 -0300 (ADT) +Received: from jefftrout.com ([24.61.201.181]) + by comcast.net (rwcrmhc13) with SMTP + id <20050422114836015004b4o0e>; Fri, 22 Apr 2005 11:48:37 +0000 +Received: (qmail 61324 invoked from network); 22 Apr 2005 11:49:10 -0000 +Received: from waltham-nat.ma.lycos.com (HELO ?10.124.7.66?) (209.202.205.1) + by 192.168.0.109 with SMTP; 22 Apr 2005 11:49:10 -0000 +In-Reply-To: +References: +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: performance pgsql +From: Jeff +Subject: Re: two queries and dual cpu (perplexed) +Date: Fri, 22 Apr 2005 07:48:29 -0400 +To: "Shoaib Burq (VPAC)" +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.189 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, + RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200504/613 +X-Sequence-Number: 12010 + + +On Apr 21, 2005, at 11:33 PM, Shoaib Burq (VPAC) wrote: + +> +> BTW I guess should mention that I am doing the select count(*) on a +> View. +> + +A bit of a silly question... +but are you actually selecting all the rows from this query in +production or would it be more selective? ie select * from bigslowview +where bah = 'snort'? + + +> Ran the Explain analyse with the nestedloop disabled but it was taking +> forever... and killed it after 30mins. +> + +If it takes too long you can run just plain explain (no analyze) and it +will show you the plan. This is nearly always instant... it'll give +you a clue as to if your setting changes did anything. + +You may need to end up breaking some parts of this up into subqueries. +I've had to do this before. I had one query that just ran too dang +slow as a join so I modified it into a subquery type deal. Worked +great. However since you are selecting ALL rows I doubt that will help +much. + +Another option may be to use materialized views. Not sure how +"dynamic" your data model is. It could help. + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 11:06:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D727C53FE5 + for ; + Fri, 22 Apr 2005 11:06:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42263-10 + for ; + Fri, 22 Apr 2005 14:06:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EE6B753FD8 + for ; + Fri, 22 Apr 2005 11:06:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3ME6XU0000330; + Fri, 22 Apr 2005 10:06:33 -0400 (EDT) +To: David Roussel +Cc: Bill Chandler , + pgsql-perform +Subject: Re: Index bloat problem? +In-reply-to: <869771629a1d24a91b8df779f7cddfe9@diroussel.xsmail.com> +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> + <27013.1114149431@sss.pgh.pa.us> + <869771629a1d24a91b8df779f7cddfe9@diroussel.xsmail.com> +Comments: In-reply-to David Roussel + message dated "Fri, 22 Apr 2005 09:44:05 +0100" +Date: Fri, 22 Apr 2005 10:06:33 -0400 +Message-ID: <329.1114178793@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/614 +X-Sequence-Number: 12011 + +David Roussel writes: +> |dave_data_update_events r 1593600.0 40209 +> |dave_data_update_events_event_id_key i 1912320.0 29271 + +Hmm ... what PG version is this, and what does VACUUM VERBOSE on +that table show? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Apr 23 01:33:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F9625353F + for ; + Fri, 22 Apr 2005 16:44:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45153-02 + for ; + Fri, 22 Apr 2005 19:44:11 +0000 (GMT) +Received: from hub.org (hub.org [200.46.204.220]) + by svr1.postgresql.org (Postfix) with ESMTP id C5F2553458 + for ; + Fri, 22 Apr 2005 16:44:11 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by hub.org (Postfix) with ESMTP id 6211412A163 + for ; + Fri, 22 Apr 2005 16:44:11 -0300 (ADT) +Received: from hub.org ([200.46.204.220]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43142-07 for ; + Fri, 22 Apr 2005 19:44:04 +0000 (GMT) +Received: from ganymede.hub.org (blk-222-82-167.eastlink.ca [24.222.82.167]) + by hub.org (Postfix) with ESMTP id 01746129A79 + for ; + Fri, 22 Apr 2005 16:44:04 -0300 (ADT) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id 8D3FC33F2C; Fri, 22 Apr 2005 16:44:05 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 8C6D633E4A + for ; + Fri, 22 Apr 2005 16:44:05 -0300 (ADT) +X-Return-Path: +X-Received: from ganymede.hub.org ([unix socket]) + by ganymede.hub.org (Cyrus v2.2.12) with LMTPA; + Fri, 22 Apr 2005 12:50:50 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 830F5389B7 + for ; Fri, 22 Apr 2005 12:50:50 -0300 (ADT) +X-Received: from mail.postgresql.org [200.46.204.71] + by localhost with IMAP (fetchmail-6.2.5) + for scrappy@localhost (single-drop); + Fri, 22 Apr 2005 12:50:50 -0300 (ADT) +X-Received: from svr1.postgresql.org ([unix socket]) + by svr1.postgresql.org (Cyrus v2.2.12) with LMTPA; + Fri, 22 Apr 2005 12:50:14 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6A47F5372B + for ; Fri, 22 Apr 2005 12:50:14 -0300 (ADT) +X-Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74175-03 for ; + Fri, 22 Apr 2005 15:50:05 +0000 (GMT) +X-Received: from dfw-gate4.raytheon.com (dfw-gate4.raytheon.com + [199.46.199.233]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A937536DA + for ; + Fri, 22 Apr 2005 12:50:03 -0300 (ADT) +X-Received: from ds02c00.directory.ray.com (ds02c00.directory.ray.com + [147.25.138.118]) + by dfw-gate4.raytheon.com (8.12.10/8.12.10) with ESMTP id + j3MFo2pE008806 for ; + Fri, 22 Apr 2005 10:50:02 -0500 (CDT) +X-Received: from ds02c00 (localhost [127.0.0.1]) + by ds02c00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j3MFo005003798 + for ; Fri, 22 Apr 2005 15:50:00 GMT +X-Received: from ds02c00.directory.ray.com with LMTP by ds02c00 + (2.0.6/sieved-2-0-build-559) + for ; Fri, 22 Apr 2005 15:49:59 +0000 +X-Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02c00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j3MFnoL3003728 + sender Richard_D_Levine@raytheon.com for ; + Fri, 22 Apr 2005 15:49:51 GMT +Subject: Disk Edge Partitioning +To: pgsql-perform@postgresql.org +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Fri, 22 Apr 2005 10:49:50 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 04/22/2005 10:49:51 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +ReSent-Date: Fri, 22 Apr 2005 16:44:00 -0300 (ADT) +Resent-From: "Marc G. Fournier" +Resent-To: pgsql-performance@postgresql.org +ReSent-Subject: Disk Edge Partitioning +ReSent-Message-ID: <20050422164400.F1315@ganymede.hub.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.124 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, NO_REAL_NAME +X-Spam-Level: * +X-Archive-Number: 200504/635 +X-Sequence-Number: 12032 + +I saw an interesting thought in another thread about placing database data +in a partition that uses cylinders at the outer edge of the disk. I want +to try this. Are the lower number cylinders closer to the edge of a SCSI +disk or is it the other way around? What about ATA? + +Cheers, + +Rick + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 13:16:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EE87E53869 + for ; + Fri, 22 Apr 2005 13:16:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81081-09 + for ; + Fri, 22 Apr 2005 16:16:44 +0000 (GMT) +Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com + [66.111.4.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D17F53873 + for ; + Fri, 22 Apr 2005 13:16:43 -0300 (ADT) +Received: from web2.messagingengine.com (web2.internal [10.202.2.211]) + by frontend1.messagingengine.com (Postfix) with ESMTP id EC54EC77B44; + Fri, 22 Apr 2005 12:16:41 -0400 (EDT) +Received: by web2.messagingengine.com (Postfix, from userid 99) + id 1C34A27C4; Fri, 22 Apr 2005 12:16:36 -0400 (EDT) +Message-Id: <1114186596.23462.232500712@webmail.messagingengine.com> +X-Sasl-Enc: lCFOjmiOYPMGvTADdJng2HD01cyfdKT/owCSZx4NJf+e 1114186596 +From: "David Roussel" +To: "Tom Lane" +Cc: "Bill Chandler" , + "pgsql-perform" +Content-Disposition: inline +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset="ISO-8859-1" +MIME-Version: 1.0 +X-Mailer: MIME::Lite 1.5 (F2.73; T1.001; A1.64; B3.05; Q3.03) +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> + <27013.1114149431@sss.pgh.pa.us> + <869771629a1d24a91b8df779f7cddfe9@diroussel.xsmail.com> + <329.1114178793@sss.pgh.pa.us> +Subject: Re: Index bloat problem? +In-Reply-To: <329.1114178793@sss.pgh.pa.us> +Date: Fri, 22 Apr 2005 17:16:36 +0100 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/615 +X-Sequence-Number: 12012 + +On Fri, 22 Apr 2005 10:06:33 -0400, "Tom Lane" said: +> David Roussel writes: +> > |dave_data_update_events r 1593600.0 40209 +> > |dave_data_update_events_event_id_key i 1912320.0 29271 +> +> Hmm ... what PG version is this, and what does VACUUM VERBOSE on +> that table show? + +PG 7.4 + +The disparity seems to have sorted itself out now, so hampering futher +investigations. I guess the regular inserts of new data, and the nightly +deletion and index recreation did it. However, we did suffer reduced +performance and the strange cardinality for several days before it went +away. For what it's worth.. + +ndb=# vacuum verbose iso_pjm_data_update_events; +INFO: vacuuming "public.iso_pjm_data_update_events" +INFO: index "iso_pjm_data_update_events_event_id_key" now contains +1912320 row versions in 29271 pages +DETAIL: 21969 index pages have been deleted, 20000 are currently +reusable. +CPU 6.17s/0.88u sec elapsed 32.55 sec. +INFO: index "iso_pjm_data_update_events_lds_idx" now contains 1912320 +row versions in 7366 pages +DETAIL: 0 index pages have been deleted, 0 are currently reusable. +CPU 3.52s/0.57u sec elapsed 14.35 sec. +INFO: index "iso_pjm_data_update_events_obj_id_idx" now contains +1912320 row versions in 7366 pages +DETAIL: 0 index pages have been deleted, 0 are currently reusable. +CPU 3.57s/0.58u sec elapsed 12.87 sec. +INFO: "iso_pjm_data_update_events": found 0 removable, 1912320 +nonremovable row versions in 40209 pages +DETAIL: 159384 dead row versions cannot be removed yet. +There were 745191 unused item pointers. +0 pages are entirely empty. +CPU 18.26s/3.62u sec elapsed 74.35 sec. +VACUUM + +After each insert is does this... + +VACUUM ANALYZE iso_pjm_DATA_UPDATE_EVENTS +VACUUM ANALYZE iso_pjm_CONTROL + +Each night it does this... + +BEGIN +DROP INDEX iso_pjm_control_obj_id_idx +DROP INDEX iso_pjm_control_real_name_idx +DROP INDEX iso_pjm_data_update_events_lds_idx +DROP INDEX iso_pjm_data_update_events_obj_id_idx +CREATE UNIQUE INDEX iso_pjm_control_obj_id_idx ON +iso_pjm_control(obj_id) +CLUSTER iso_pjm_control_obj_id_idx ON iso_pjm_control +CREATE UNIQUE INDEX iso_pjm_control_real_name_idx ON +iso_pjm_control(real_name) +CREATE INDEX iso_pjm_data_update_events_lds_idx ON +iso_pjm_data_update_events(lds) +CREATE INDEX iso_pjm_data_update_events_obj_id_idx ON +iso_pjm_data_update_events(obj_id) +COMMIT + +Note there is no reference to iso_pjm_data_update_events_event_id_key +which is the index that went wacky on us. Does that seem weird to you? + +Thanks + +David + +From pgsql-performance-owner@postgresql.org Fri Apr 22 13:30:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 10B8953879 + for ; + Fri, 22 Apr 2005 13:30:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88129-03 + for ; + Fri, 22 Apr 2005 16:29:56 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id 82392537EB + for ; + Fri, 22 Apr 2005 13:29:55 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3MGTif30012; + Fri, 22 Apr 2005 11:29:54 -0500 +In-Reply-To: <4574.1114030270@sss.pgh.pa.us> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Fri, 22 Apr 2005 09:29:39 -0700 +To: Tom Lane +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/616 +X-Sequence-Number: 12013 + +I've also now tried looking at pg_class.relpages. I compared the +results before and after vacuum. The results stayed the same, except +for five rows that increased after the vacuum. Here is the select on +those rows after the vacuum: + + relname | relnamespace | reltype | relowner | +relam | relfilenode | reltablespace | relpages | reltuples | +reltoastrelid | reltoastidxid | relhasindex | relisshared | relkind | +relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs | +relhasoids | relhaspkey | relhasrules | relhassubclass | relacl +---------------------------------+--------------+---------+---------- ++-------+-------------+---------------+----------+----------- ++---------------+---------------+-------------+-------------+--------- ++----------+-----------+-------------+----------+----------+--------- ++------------+------------+-------------+---------------- ++--------------- + pg_attribute_relid_attnam_index | 11 | 0 | 1 | + 403 | 16686 | 0 | 292 | 10250 | +0 | 0 | f | f | i | 2 | + 0 | 0 | 0 | 0 | 0 | f | f + | f | f | + pg_class_oid_index | 11 | 0 | 1 | + 403 | 16690 | 0 | 18 | 2640 | +0 | 0 | f | f | i | 1 | + 0 | 0 | 0 | 0 | 0 | f | f + | f | f | + pg_depend_depender_index | 11 | 0 | 1 | + 403 | 16701 | 0 | 52 | 6442 | +0 | 0 | f | f | i | 3 | + 0 | 0 | 0 | 0 | 0 | f | f + | f | f | + pg_type_oid_index | 11 | 0 | 1 | + 403 | 16731 | 0 | 8 | 1061 | +0 | 0 | f | f | i | 1 | + 0 | 0 | 0 | 0 | 0 | f | f + | f | f | + pg_depend | 11 | 16677 | 1 | + 0 | 16676 | 0 | 32 | 4200 | +0 | 0 | t | f | r | 7 | + 0 | 0 | 0 | 0 | 0 | f | f + | f | f | {=r/postgres} + + + +On Apr 20, 2005, at 1:51 PM, Tom Lane wrote: + +> Richard Plotkin writes: +>> I'm having a pretty serious problem with postgresql's performance. +>> Currently, I have a cron task that is set to restart and vacuumdb -faz +>> every six hours. If that doesn't happen, the disk goes from 10% full +>> to 95% full within 2 days (and it's a 90GB disk...with the database +>> being a 2MB download after dump), and the CPU goes from running at +>> around a 2% load to a 99+% load right away (the stats look like a +>> square wave). +> +> Q: what have you got the FSM parameters set to? +> +> Q: what exactly is bloating? Without knowing which tables or indexes +> are growing, it's hard to speculate about the exact causes. Use du and +> oid2name, or look at pg_class.relpages after a plain VACUUM. +> +> It's likely that the real answer is "you need to vacuum more often +> than every six hours", but I'm trying not to jump to conclusions. +> +> regards, tom lane +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 3: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly +> + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 14:28:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D78653A89 + for ; + Fri, 22 Apr 2005 14:28:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04074-02 + for ; + Fri, 22 Apr 2005 17:28:35 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 92D0053A27 + for ; + Fri, 22 Apr 2005 14:28:32 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3MHSWE2003034; + Fri, 22 Apr 2005 13:28:32 -0400 (EDT) +To: "David Roussel" +Cc: "Bill Chandler" , + "pgsql-perform" +Subject: Re: Index bloat problem? +In-reply-to: <1114186596.23462.232500712@webmail.messagingengine.com> +References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> + <27013.1114149431@sss.pgh.pa.us> + <869771629a1d24a91b8df779f7cddfe9@diroussel.xsmail.com> + <329.1114178793@sss.pgh.pa.us> + <1114186596.23462.232500712@webmail.messagingengine.com> +Comments: In-reply-to "David Roussel" + message dated "Fri, 22 Apr 2005 17:16:36 +0100" +Date: Fri, 22 Apr 2005 13:28:32 -0400 +Message-ID: <3033.1114190912@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/617 +X-Sequence-Number: 12014 + +"David Roussel" writes: +> Note there is no reference to iso_pjm_data_update_events_event_id_key +> which is the index that went wacky on us. Does that seem weird to you? + +What that says is that that index doesn't belong to that table. You +sure it wasn't a chance coincidence of names that made you think it did? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 22 14:51:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 08D4353ACB + for ; + Fri, 22 Apr 2005 14:51:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09944-02 + for ; + Fri, 22 Apr 2005 17:51:09 +0000 (GMT) +Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 45CF253A15 + for ; + Fri, 22 Apr 2005 14:51:08 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IFD00G8T09782B4@vms042.mailsrvcs.net> for + pgsql-performance@postgresql.org; Fri, 22 Apr 2005 12:51:08 -0500 (CDT) +Date: Fri, 22 Apr 2005 13:51:08 -0400 +From: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <4268C833.8080302@pse-consulting.de> +To: "'Andreas Pflug'" , + "'Dave Page'" +Cc: , , + "Joshua D. Drake" , , + "'Steve Hatt'" +Message-id: <000401c54763$dd684620$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/618 +X-Sequence-Number: 12015 + +I just finished testing Postgres, MYSQL, and MSSQL on my machine (2 gigs +internal XP). + +I have adjusted the postgres config to what I think is an ok place and = +have +mysql default and mssql default. + +Using Aqua studio a program that hooks to all three I have found: + + Initial exec Second exec Returning 331,640 records on all 3 = +database +MSSQL 468ms 16ms 2 mins 3 secs +MYSQL 14531ms 6625ms 2 mins 42 secs=20 +Postgr 52120ms 11702ms 2 mins 15 secs + +Not sure if this proves your point on PGadmin versus MYSQL query tool = +versus +MSSQL Query tool, but it certainly seems encouraging. + +I am going to visit Josh's tests he wanted me to run on the LINUX = +server. +=20 +Joel Fradkin +=20 + + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 15:04:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E22A53AE6 + for ; + Fri, 22 Apr 2005 15:04:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14031-02 + for ; + Fri, 22 Apr 2005 18:03:58 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 1935553ACB + for ; + Fri, 22 Apr 2005 15:03:57 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3MI3sJ11508; + Fri, 22 Apr 2005 14:03:54 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504221803.j3MI3sJ11508@candle.pha.pa.us> +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-Reply-To: <000401c54763$dd684620$797ba8c0@jfradkin> +To: Joel Fradkin +Date: Fri, 22 Apr 2005 14:03:54 -0400 (EDT) +Cc: "'Andreas Pflug'" , + "'Dave Page'" , + pgsql-performance@postgresql.org, ac@wazagua.com, + "Joshua D. Drake" , wheyliger@wazagua.com, + "'Steve Hatt'" +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/619 +X-Sequence-Number: 12016 + + +Are you using 8.0.2? I hope so because there were some Win32 +performance changes related to fsync() in that release. + +--------------------------------------------------------------------------- + +Joel Fradkin wrote: +> I just finished testing Postgres, MYSQL, and MSSQL on my machine (2 gigs +> internal XP). +> +> I have adjusted the postgres config to what I think is an ok place and have +> mysql default and mssql default. +> +> Using Aqua studio a program that hooks to all three I have found: +> +> Initial exec Second exec Returning 331,640 records on all 3 database +> MSSQL 468ms 16ms 2 mins 3 secs +> MYSQL 14531ms 6625ms 2 mins 42 secs +> Postgr 52120ms 11702ms 2 mins 15 secs +> +> Not sure if this proves your point on PGadmin versus MYSQL query tool versus +> MSSQL Query tool, but it certainly seems encouraging. +> +> I am going to visit Josh's tests he wanted me to run on the LINUX server. +> +> Joel Fradkin +> +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings +> + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Fri Apr 22 15:31:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 950B053233 + for ; + Fri, 22 Apr 2005 15:31:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22399-03 + for ; + Fri, 22 Apr 2005 18:30:57 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id C44A25323A + for ; + Fri, 22 Apr 2005 15:30:55 -0300 (ADT) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j3MIUsi3006849; + Fri, 22 Apr 2005 14:30:54 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id 1D70C530AC; Fri, 22 Apr 2005 14:30:54 -0400 (CLT) +Date: Fri, 22 Apr 2005 14:30:54 -0400 +From: Alvaro Herrera +To: Joel Fradkin +Cc: "'Andreas Pflug'" , + "'Dave Page'" , + pgsql-performance@postgresql.org, ac@wazagua.com, + "Joshua D. Drake" , wheyliger@wazagua.com, + "'Steve Hatt'" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Message-ID: <20050422183054.GB14419@dcc.uchile.cl> +References: <4268C833.8080302@pse-consulting.de> + <000401c54763$dd684620$797ba8c0@jfradkin> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <000401c54763$dd684620$797ba8c0@jfradkin> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.341 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/620 +X-Sequence-Number: 12017 + +On Fri, Apr 22, 2005 at 01:51:08PM -0400, Joel Fradkin wrote: +> I just finished testing Postgres, MYSQL, and MSSQL on my machine (2 gigs +> internal XP). +> +> I have adjusted the postgres config to what I think is an ok place and have +> mysql default and mssql default. +> +> Using Aqua studio a program that hooks to all three I have found: +> +> Initial exec Second exec Returning 331,640 records on all 3 database +> MSSQL 468ms 16ms 2 mins 3 secs +> MYSQL 14531ms 6625ms 2 mins 42 secs +> Postgr 52120ms 11702ms 2 mins 15 secs + +One further question is: is this really a meaningful test? I mean, in +production are you going to query 300000 rows regularly? And is the +system always going to be used by only one user? I guess the question +is if this big select is representative of the load you expect in +production. + +What happens if you execute the query more times? Do the times stay the +same as the second run? + +-- +Alvaro Herrera () +"Use it up, wear it out, make it do, or do without" + +From pgsql-performance-owner@postgresql.org Fri Apr 22 15:39:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 61AEF5337F + for ; + Fri, 22 Apr 2005 15:39:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24524-02 + for ; + Fri, 22 Apr 2005 18:39:21 +0000 (GMT) +Received: from fep31-app.kolumbus.fi (fep31-0.kolumbus.fi [193.229.0.35]) + by svr1.postgresql.org (Postfix) with ESMTP id 1DB4853367 + for ; + Fri, 22 Apr 2005 15:39:18 -0300 (ADT) +Received: from [192.168.1.103] (really [84.231.185.8]) + by fep31-app.kolumbus.fi with ESMTP + id <20050422183918.XJHJ7490.fep31-app.kolumbus.fi@[192.168.1.103]> + for ; + Fri, 22 Apr 2005 21:39:18 +0300 +Message-ID: <426944D0.6040706@kolumbus.fi> +Date: Fri, 22 Apr 2005 21:39:12 +0300 +From: Marko Ristola +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.6) Gecko/20050324 Debian/1.7.6-1 +X-Accept-Language: en +MIME-Version: 1.0 +To: pgsql-perform +Subject: Re: Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <25382.1113943489@sss.pgh.pa.us> + <200504191433.58960.josh@agliodbs.com> + <200504201059.02033.josh@agliodbs.com> +In-Reply-To: <200504201059.02033.josh@agliodbs.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.34 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/621 +X-Sequence-Number: 12018 + + +Hi. + +Sometimes, if the random number generator, that PostgreSQL uses, +isn't good enough, the randomly selected pages for the statistics +might not be random enough. + +Solaris is unknown to me. Maybe the used random number generator there +isn't good enough? + +Good statistics depend on good random numbers. + +So, for example, if you have one million pages, but the upper bound for +the random +numbers is one hundred thousand pages, the statistics might get tuned. + +Or some random number generator has for example only 32000 different values. + +Regards, +Marko Ristola + +Josh Berkus wrote: + +>Tom, +> +>Any thoughts? This is really messing up query execution all across the +>database ... +> +>--Josh +> +> +> +>>Here is the stats = 100 version. Notice that n_distinct has gone down. +>> +>> schemaname | tablename | attname | null_frac | avg_width | +>>n_distinct | most_common_vals +>> +>>| most_common_freqs +>>| histogram_bounds | +>> +>>correlation +>> +>> +> +> +> +>>-------------------+------------- public | web_site_activity_fa | +>>session_id | 0 | 8 | 96107 | +>>{4393922,6049228,6026260,4394034,60341,4393810,2562999,2573850,3006299,4705 +>>488,2561499,4705258,3007378,4705490,60327,60352,2560950,2567640,2569852,3006 +>>604,4394329,2570739,2406633,2407292,3006356,4393603,4394121,6449083,2565815, +>>4387881,2406770,2407081,2564340,3007328,2406578,2407295,2562813,2567603,4387 +>>835,71014,2566253,2566900,6103079,2289424,2407597,2567627,2568333,3457448,23 +>>450,23670,60743,70739,2406818,2406852,2407511,2562816,3007446,6306095,60506, +>>71902,591543,1169136,1447077,2285047,2406830,2573964,6222758,61393,70955,709 +>>86,71207,71530,262368,2289213,2406899,2567361,2775952,3006824,4387864,623982 +>>5,6244853,6422152,1739,58600,179293,278473,488407,1896390,2286976,2407020,25 +>>46720,2677019,2984333,3006133,3007497,3310286,3631413,3801909,4366116,438802 +>>5} +>> +>>{0.00166667,0.00146667,0.0013,0.0011,0.000933333,0.0009,0.0008,0.0008,0.000 +>>733333,0.000733333,0.0007,0.000633333,0.0006,0.0006,0.000566667,0.000566667, +>>0.000566667,0.000566667,0.000566667,0.000566667,0.000566667,0.000533333,0.00 +>>05,0.0005,0.0005,0.0005,0.0005,0.0005,0.000466667,0.000466667,0.000433333,0. +>>000433333,0.000433333,0.000433333,0.0004,0.0004,0.0004,0.0004,0.0004,0.00036 +>>6667,0.000366667,0.000366667,0.000366667,0.000333333,0.000333333,0.000333333 +>>,0.000333333,0.000333333,0.0003,0.0003,0.0003,0.0003,0.0003,0.0003,0.0003,0. +>>0003,0.0003,0.0003,0.000266667,0.000266667,0.000266667,0.000266667,0.0002666 +>>67,0.000266667,0.000266667,0.000266667,0.000266667,0.000233333,0.000233333,0 +>>.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000 +>>233333,0.000233333,0.000233333,0.000233333,0.000233333,0.000233333,0.0002333 +>>33,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0 +>>002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002,0.0002} +>> +>>{230,58907,88648,156764,216759,240405,264601,289047,312630,339947,364452,38 +>>6486,409427,434075,455140,475759,500086,521530,544703,680376,981066,1313419, +>>1712592,1860151,1882452,1905328,1927504,1948159,1970054,1990408,2014501,2038 +>>573,2062786,2087163,2110129,2132196,2155657,2181058,2204976,2228575,2256229, +>>2283897,2352453,2407153,2457716,2542081,2572119,2624133,2699592,2771254,2832 +>>224,2908151,2951500,3005088,3032889,3137244,3158685,3179395,3203681,3261587, +>>3304359,3325577,3566688,3621357,3645094,3718667,3740821,3762386,3783169,3804 +>>593,3826503,3904589,3931012,3957675,4141934,4265118,4288568,4316898,4365625, +>>4473965,4535752,4559700,4691802,4749478,5977208,6000272,6021416,6045939,6078 +>>912,6111900,6145155,6176422,6206627,6238291,6271270,6303067,6334117,6365200, +>>6395250,6424719,6888329} +>> +>>| 0.41744 +>> +>> +> +> +> + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 15:48:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9138E53399 + for ; + Fri, 22 Apr 2005 15:47:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26100-08 + for ; + Fri, 22 Apr 2005 18:47:50 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 3242A53367 + for ; + Fri, 22 Apr 2005 15:47:42 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7269830; Fri, 22 Apr 2005 11:49:40 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Marko Ristola +Subject: Re: Bad n_distinct estimation; hacks suggested? +Date: Fri, 22 Apr 2005 11:52:51 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-perform +References: <200504191209.05181.josh@agliodbs.com> + <200504201059.02033.josh@agliodbs.com> + <426944D0.6040706@kolumbus.fi> +In-Reply-To: <426944D0.6040706@kolumbus.fi> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504221152.51736.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/622 +X-Sequence-Number: 12019 + +Marko, + +> Sometimes, if the random number generator, that PostgreSQL uses, +> isn't good enough, the randomly selected pages for the statistics +> might not be random enough. +> +> Solaris is unknown to me. Maybe the used random number generator there +> isn't good enough? + +Hmmm. Good point. Will have to test on Linux. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Apr 22 17:31:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E7F47535AF + for ; + Fri, 22 Apr 2005 17:31:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57401-10 + for ; + Fri, 22 Apr 2005 20:30:59 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E74C5320A + for ; + Fri, 22 Apr 2005 17:30:58 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7270293; Fri, 22 Apr 2005 13:32:57 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Marko Ristola +Subject: Re: Bad n_distinct estimation; hacks suggested? +Date: Fri, 22 Apr 2005 13:36:08 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-perform +References: <200504191209.05181.josh@agliodbs.com> + <426944D0.6040706@kolumbus.fi> + <200504221152.51736.josh@agliodbs.com> +In-Reply-To: <200504221152.51736.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504221336.08325.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/623 +X-Sequence-Number: 12020 + + +> > Solaris is unknown to me. Maybe the used random number generator there +> > isn't good enough? +> +> Hmmm. Good point. Will have to test on Linux. + +Nope: + +Linux 2.4.20: + +test=# select tablename, attname, n_distinct from pg_stats where tablename = +'web_site_activity_fa'; + tablename | attname | n_distinct +----------------------+---------------------+------------ + web_site_activity_fa | session_id | 626127 + +test=# select count(distinct session_id) from web_site_activity_fa; + count +--------- + 3174813 +(1 row) + +... I think the problem is in our heuristic sampling code. I'm not the first +person to have this kind of a problem. Will be following up with tests ... + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Apr 22 17:54:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 37DE2535D7 + for ; + Fri, 22 Apr 2005 17:54:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64641-07 + for ; + Fri, 22 Apr 2005 20:53:51 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 8F51C5323A + for ; + Fri, 22 Apr 2005 17:53:49 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050422205350.GVXB24451.priv-edtnes56.telusplanet.net@localhost>; + Fri, 22 Apr 2005 14:53:50 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Fri, 22 Apr 2005 13:53:50 -0700 +Message-ID: <1114203230.4269645e44160@webmail.telus.net> +Date: Fri, 22 Apr 2005 13:53:50 -0700 +From: Mischa Sandberg +To: Alvaro Herrera +Cc: Joel Fradkin , + 'Andreas Pflug' , + 'Dave Page' , + pgsql-performance@postgresql.org, ac@wazagua.com, + "Joshua D. Drake" , wheyliger@wazagua.com, + 'Steve Hatt' +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +References: <4268C833.8080302@pse-consulting.de> + <000401c54763$dd684620$797ba8c0@jfradkin> + <20050422183054.GB14419@dcc.uchile.cl> +In-Reply-To: <20050422183054.GB14419@dcc.uchile.cl> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/624 +X-Sequence-Number: 12021 + +Quoting Alvaro Herrera : + +> One further question is: is this really a meaningful test? I mean, in +> production are you going to query 300000 rows regularly? And is the +> system always going to be used by only one user? I guess the question +> is if this big select is representative of the load you expect in +> production. + +While there may be some far-out queries that nobody would try, +you might be surprised what becomes the norm for queries, +as soon as the engine feasibly supports them. SQL is used for +warehouse and olap apps, as a data queue, and as the co-ordinator +or bridge for (non-SQL) replication apps. In all of these, +you see large updates, large result sets and volatile tables +("large" to me means over 20% of a table and over 1M rows). + +To answer your specific question: yes, every 30 mins, +in a data redistribution app that makes a 1M-row query, +and writes ~1000 individual update files, of overlapping sets of rows. +It's the kind of operation SQL doesn't do well, +so you have to rely on one big query to get the data out. + +My 2c +-- +"Dreams come true, not free." -- S.Sondheim, ITW + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 18:04:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AA05A53605 + for ; + Fri, 22 Apr 2005 18:04:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67677-07 + for ; + Fri, 22 Apr 2005 21:04:18 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 88E875334A + for ; + Fri, 22 Apr 2005 18:04:17 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IFD00GPM976K3Q4@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Fri, 22 Apr 2005 16:04:19 -0500 (CDT) +Date: Fri, 22 Apr 2005 17:04:19 -0400 +From: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <20050422183054.GB14419@dcc.uchile.cl> +To: "'Alvaro Herrera'" +Cc: "'Andreas Pflug'" , + "'Dave Page'" , + , , + "'Joshua D. Drake'" , , + "'Steve Hatt'" +Message-id: <000001c5477e$da38e3e0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/625 +X-Sequence-Number: 12022 + +One further question is: is this really a meaningful test? I mean, in +production are you going to query 300000 rows regularly?=20 + +It is a query snippet if you will as the view I posted for audit and = +case +where tables are joined are more likely to be ran. + +Josh and I worked over this until we got explain analyze on the linux = +box to +1 sec. I was just using this as a test as I don't have my views set up = +on +MYSQL. + +So many of my reports pull huge data sets (comprised of normalized = +joins). +I am thinking I probably have to modify to using an non normalized = +table, +and Josh is sending me information on using cursors instead of selects. + +And is the system always going to be used by only one user? =20 +No we have 400+ concurrent users + +I guess the question is if this big select is representative of the load = +you +expect in production. +Yes we see many time on the two processor box running MSSQL large return +sets using 100%cpu for 5-30 seconds. + +What happens if you execute the query more times? Do the times stay the +same as the second run? +I will definitely have to pressure testing prior to going live in +production. I have not done concurrent tests as honestly single user = +tests +are failing, so multiple user testing is not something I need yet. + +Joel + +--=20 +Alvaro Herrera () +"Use it up, wear it out, make it do, or do without" + + +From pgsql-performance-owner@postgresql.org Fri Apr 22 18:50:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C1A75353A + for ; + Fri, 22 Apr 2005 18:50:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80123-07 + for ; + Fri, 22 Apr 2005 21:50:29 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id 5BCDD53538 + for ; + Fri, 22 Apr 2005 18:50:27 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C54785.4CCAF72C" +Subject: Updating table, precautions? +Date: Fri, 22 Apr 2005 17:50:29 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098984@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Updating table, precautions? +Thread-Index: AcVHhUy/L7+q6EooSnyb8rf1ywfZeA== +From: "Anjan Dave" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.094 tagged_above=0 required=5 tests=AWL, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200504/626 +X-Sequence-Number: 12023 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C54785.4CCAF72C +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +Hi there, +=20 +We need to update a table of about 1.2GB (and about 900k rows) size. I +was wondering if I should let the regular cron job take care of clean up +(vacuum db Mon-Sat, vacuum full on Sun, followed by Reindex script), or +manually do this on the table followed by the update. +=20 +This is what I used to find the table size, which probably doesn't +include the index size. Is there a way to find out size of indexes? +=20 +select relpages * 8192 as size_in_bytes from pg_class where relnamespace +=3D (select oid from pg_namespace where nspname =3D 'public') and = +relname =3D +'r_itemcategory'; +=20 +=20 +Thanks, + +Anjan +=20 +=20 +************************************************************************ +****************** +This e-mail and any files transmitted with it are intended for the use +of the=20 +addressee(s) only and may be confidential and covered by the +attorney/client=20 +and other privileges. If you received this e-mail in error, please +notify the=20 +sender; do not disclose, copy, distribute, or take any action in +reliance on=20 +the contents of this information; and delete it from your system. Any +other=20 +use of this e-mail is prohibited. +************************************************************************ +****************** + +=20 + + +------_=_NextPart_001_01C54785.4CCAF72C +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + + +
Hi there,
 
We need to update a table =
+of about 1.2GB (and about 900k rows) size. I was wondering if I should =
+let the regular cron job take care of clean up (vacuum db Mon-Sat, =
+vacuum full on Sun, followed by Reindex script), or manually do this on =
+the table followed by the =
+update.
 
This is what I used to find =
+the table size, which probably doesn’t include the index size. Is =
+there a way to find out size of =
+indexes?
 
select relpages * 8192 as =
+size_in_bytes from pg_class where relnamespace =3D (select oid from =
+pg_namespace where nspname =3D 'public') and relname =3D =
+'r_itemcategory';
 
 
Thanks,
+Anjan
 
 
****************************=
+**************************************************************=
+
This e-mail and any files =
+transmitted with it are intended for the use of the =
+
addressee(s) only and may =
+be confidential and covered by the attorney/client =
+
and other privileges.  =
+If you received this e-mail in error, please notify the =
+
sender; do not disclose, =
+copy, distribute, or take any action in reliance on =
+
the contents of this =
+information; and delete it from your =
+system. Any other 
use of this e-mail is =
+prohibited.
****************************=
+**************************************************************=
+
+ +

 

+ +
+ + + + + +------_=_NextPart_001_01C54785.4CCAF72C-- + +From pgsql-performance-owner@postgresql.org Fri Apr 22 19:28:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F1CA53418 + for ; + Fri, 22 Apr 2005 19:28:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90257-09 + for ; + Fri, 22 Apr 2005 22:28:17 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 7FDAB5341F + for ; + Fri, 22 Apr 2005 19:28:16 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7271109; Fri, 22 Apr 2005 15:30:15 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Anjan Dave" +Subject: Re: Updating table, precautions? +Date: Fri, 22 Apr 2005 15:33:26 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098984@vt-pe2550-001.vantage.vantage.com> +In-Reply-To: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098984@vt-pe2550-001.vantage.vantage.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504221533.26763.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/627 +X-Sequence-Number: 12024 + +Anjan, + +> This is what I used to find the table size, which probably doesn't +> include the index size. Is there a way to find out size of indexes? +> +> select relpages * 8192 as size_in_bytes from pg_class where relnamespace +> = (select oid from pg_namespace where nspname = 'public') and relname = +> 'r_itemcategory'; + +See the code in CVS in the "newsysviews" project in pgFoundry. Andrew coded +up a nice pg_user_table_storage view which gives table, index and TOAST size. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Apr 22 22:54:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A6A253488 + for ; + Fri, 22 Apr 2005 22:54:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45702-02 + for ; + Sat, 23 Apr 2005 01:54:02 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 162595359C + for ; + Fri, 22 Apr 2005 22:54:01 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 69A271547C; Fri, 22 Apr 2005 20:54:04 -0500 (CDT) +Date: Fri, 22 Apr 2005 20:54:04 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Dave Held , + pgsql-performance@postgresql.org +Subject: Re: Sort and index +Message-ID: <20050423015404.GV58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050420004234.GX58835@decibel.org> + <19631.1113966086@sss.pgh.pa.us> + <20050420034041.GC58835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050420034041.GC58835@decibel.org> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/628 +X-Sequence-Number: 12025 + +I've run some performance tests. The actual test case is at +http://stats.distributed.net/~decibel/timing.sql, and the results are at +http://stats.distributed.net/~decibel/timing.log. In a nutshell, doing +an index scan appears to be about 2x faster than a sequential scan and a +sort. + +Something else of interest is that going from 50M of sort memory to 3G +sped the sort up by 900 seconds. If someone wants to record data about +the effect of sort_mem on on-disk sorts somewhere (maybe in the docs?) I +can run some more tests for that case. + +In any case, it's clear that the planner is making the wrong choice +here. BTW, changing random_page_cost to 3 or 4 doesn't change the plan. + +On Tue, Apr 19, 2005 at 10:40:41PM -0500, Jim C. Nasby wrote: +> On Tue, Apr 19, 2005 at 11:01:26PM -0400, Tom Lane wrote: +> > "Jim C. Nasby" writes: +> > > Actually, the planner (at least in 7.4) isn't smart enough to consider +> > > if the sort would fit in memory or not. +> > +> > Really? Have you read cost_sort()? +> > +> > It's certainly possible that the calculation is all wet, but to claim +> > that the issue is not considered is just wrong. +> +> To be fair, no, I haven't looked at the code. This is based strictly on +> anecdotal evidence on a 120M row table. I'm currently running a test to +> see how an index scan compares to a seqscan. I also got the same results +> when I added a where clause that would restrict it to about 7% of the +> table. +> +> Actually, after running some tests (below), the plan cost does change +> when I change sort_mem (it was originally 50000). +> +> stats=# \d email_contrib +> Table "public.email_contrib" +> Column | Type | Modifiers +> ------------+---------+----------- +> project_id | integer | not null +> id | integer | not null +> date | date | not null +> team_id | integer | +> work_units | bigint | not null +> Indexes: +> "email_contrib_pkey" primary key, btree (project_id, id, date) +> "email_contrib__pk24" btree (id, date) WHERE (project_id = 24) +> "email_contrib__pk25" btree (id, date) WHERE (project_id = 25) +> "email_contrib__pk8" btree (id, date) WHERE (project_id = 8) +> "email_contrib__project_date" btree (project_id, date) +> Foreign-key constraints: +> "fk_email_contrib__id" FOREIGN KEY (id) REFERENCES stats_participant(id) ON UPDATE CASCADE +> "fk_email_contrib__team_id" FOREIGN KEY (team_id) REFERENCES stats_team(team) ON UPDATE CASCADE +> +> stats=# explain select * from email_contrib where project_id=8 order by project_id, id, date; +> QUERY PLAN +> -------------------------------------------------------------------------------- +> Sort (cost=3613476.05..3635631.71 rows=8862263 width=24) +> Sort Key: project_id, id, date +> -> Seq Scan on email_contrib (cost=0.00..2471377.50 rows=8862263 width=24) +> Filter: (project_id = 8) +> (4 rows) +> +> stats=# explain select * from email_contrib order by project_id, id, date; +> QUERY PLAN +> ---------------------------------------------------------------------------------- +> Sort (cost=25046060.83..25373484.33 rows=130969400 width=24) +> Sort Key: project_id, id, date +> -> Seq Scan on email_contrib (cost=0.00..2143954.00 rows=130969400 width=24) +> (3 rows) +> +> stats=# select 8862263::float/130969400; +> ?column? +> -------------------- +> 0.0676666687027657 +> (1 row) +> +> stats=# explain select * from email_contrib where project_id=8 order by project_id, id, date; +> QUERY PLAN +> ----------------------------------------------------------------------------------------------------- +> Index Scan using email_contrib_pkey on email_contrib (cost=0.00..6832005.57 rows=8862263 width=24) +> Index Cond: (project_id = 8) +> (2 rows) +> +> stats=# explain select * from email_contrib order by project_id, id, date; +> QUERY PLAN +> --------------------------------------------------------------------------------------------------------- +> Index Scan using email_contrib_pkey on email_contrib (cost=0.00..100055905.62 rows=130969400 width=24) +> (1 row) +> +> stats=# set enable_seqscan=on; +> SET +> stats=# set sort_mem=1000; +> SET +> stats=# explain select * from email_contrib order by project_id, id, date; +> QUERY PLAN +> ---------------------------------------------------------------------------------- +> Sort (cost=28542316.63..28869740.13 rows=130969400 width=24) +> Sort Key: project_id, id, date +> -> Seq Scan on email_contrib (cost=0.00..2143954.00 rows=130969400 width=24) +> (3 rows) +> +> stats=# +> +> -- +> Jim C. Nasby, Database Consultant decibel@decibel.org +> Give your computer some brain candy! www.distributed.net Team #1828 +> +> Windows: "Where do you want to go today?" +> Linux: "Where do you want to go tomorrow?" +> FreeBSD: "Are you guys coming, or what?" +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Fri Apr 22 23:01:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9513653FD7 + for ; + Fri, 22 Apr 2005 23:01:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48585-04 + for ; + Sat, 23 Apr 2005 02:01:48 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id D90E753FD3 + for ; + Fri, 22 Apr 2005 23:01:47 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id BE04D15520; Fri, 22 Apr 2005 21:01:51 -0500 (CDT) +Date: Fri, 22 Apr 2005 21:01:51 -0500 +From: "Jim C. Nasby" +To: Joel Fradkin +Cc: 'John A Meinel' , + 'Postgresql Performance' +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Message-ID: <20050423020151.GW58835@decibel.org> +References: <4266F7B3.7050004@arbash-meinel.com> + <000f01c54679$8d2f1f70$797ba8c0@jfradkin> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <000f01c54679$8d2f1f70$797ba8c0@jfradkin> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/629 +X-Sequence-Number: 12026 + +Hrm... I was about to suggest that for timing just the query (and not +output/data transfer time) using explain analyze, but then I remembered +that explain analyze can incur some non-trivial overhead with the timing +calls. Is there a way to run the query but have psql ignore the output? +If so, you could use \timing. + +In any case, it's not valid to use pgadmin to time things. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Fri Apr 22 23:08:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C3A655405F + for ; + Fri, 22 Apr 2005 23:08:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50709-03 + for ; + Sat, 23 Apr 2005 02:08:47 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 185FB54053 + for ; + Fri, 22 Apr 2005 23:08:44 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3N286Zv004270; + Fri, 22 Apr 2005 22:08:06 -0400 (EDT) +To: "Jim C. Nasby" +Cc: Dave Held , + pgsql-performance@postgresql.org +Subject: Re: Sort and index +In-reply-to: <20050423015404.GV58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050420004234.GX58835@decibel.org> + <19631.1113966086@sss.pgh.pa.us> + <20050420034041.GC58835@decibel.org> + <20050423015404.GV58835@decibel.org> +Comments: In-reply-to "Jim C. Nasby" + message dated "Fri, 22 Apr 2005 20:54:04 -0500" +Date: Fri, 22 Apr 2005 22:08:06 -0400 +Message-ID: <4269.1114222086@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/630 +X-Sequence-Number: 12027 + +"Jim C. Nasby" writes: +> I've run some performance tests. The actual test case is at +> http://stats.distributed.net/~decibel/timing.sql, and the results are at +> http://stats.distributed.net/~decibel/timing.log. In a nutshell, doing +> an index scan appears to be about 2x faster than a sequential scan and a +> sort. + +... for one test case, on one platform, with a pretty strong bias to the +fully-cached state since you ran the test multiple times consecutively. + +Past experience has generally been that an explicit sort is quicker, +so you'll have to pardon me for suspecting that this case may be +atypical. Is the table nearly in order by pkey, by any chance? + +> In any case, it's clear that the planner is making the wrong choice +> here. BTW, changing random_page_cost to 3 or 4 doesn't change the plan. + +Feel free to propose better cost equations. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Apr 22 23:11:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3803C53488 + for ; + Fri, 22 Apr 2005 23:11:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50460-09 + for ; + Sat, 23 Apr 2005 02:11:04 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id AC25B53458 + for ; + Fri, 22 Apr 2005 23:11:03 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 453F615520; Fri, 22 Apr 2005 21:11:07 -0500 (CDT) +Date: Fri, 22 Apr 2005 21:11:07 -0500 +From: "Jim C. Nasby" +To: Joel Fradkin +Cc: 'Alvaro Herrera' , + 'Andreas Pflug' , + 'Dave Page' , + pgsql-performance@postgresql.org, ac@wazagua.com, + "'Joshua D. Drake'" , wheyliger@wazagua.com, + 'Steve Hatt' +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Message-ID: <20050423021107.GX58835@decibel.org> +References: <20050422183054.GB14419@dcc.uchile.cl> + <000001c5477e$da38e3e0$797ba8c0@jfradkin> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <000001c5477e$da38e3e0$797ba8c0@jfradkin> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/631 +X-Sequence-Number: 12028 + +On Fri, Apr 22, 2005 at 05:04:19PM -0400, Joel Fradkin wrote: +> And is the system always going to be used by only one user? +> No we have 400+ concurrent users +> +> I guess the question is if this big select is representative of the load you +> expect in production. +> Yes we see many time on the two processor box running MSSQL large return +> sets using 100%cpu for 5-30 seconds. +> +> What happens if you execute the query more times? Do the times stay the +> same as the second run? +> I will definitely have to pressure testing prior to going live in +> production. I have not done concurrent tests as honestly single user tests +> are failing, so multiple user testing is not something I need yet. + +I would very, very strongly encourage you to run multi-user tests before +deciding on mysql. Mysql is nowhere near as capable when it comes to +concurrent operations as PostgreSQL is. From what others have said, it +doesn't take many concurrent operations for it to just fall over. I +can't speak from experience because I avoid mysql like the plague, +though. :) + +Likewise, MSSQL will probably look better single-user than it will +multi-user. Unless you're going to only access the database single-user, +it's just not a valid test case (and by the way, this is true no matter +what database you're looking at. Multiuser access is where you uncover +your real bottlenecks.) +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sat Apr 23 00:00:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D804D53235 + for ; + Sat, 23 Apr 2005 00:00:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61747-07 + for ; + Sat, 23 Apr 2005 03:00:06 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id BED3353233 + for ; + Sat, 23 Apr 2005 00:00:05 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id EE32B15520; Fri, 22 Apr 2005 22:00:02 -0500 (CDT) +Date: Fri, 22 Apr 2005 22:00:02 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Dave Held , + pgsql-performance@postgresql.org +Subject: Re: Sort and index +Message-ID: <20050423030002.GY58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050420004234.GX58835@decibel.org> + <19631.1113966086@sss.pgh.pa.us> + <20050420034041.GC58835@decibel.org> + <20050423015404.GV58835@decibel.org> + <4269.1114222086@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <4269.1114222086@sss.pgh.pa.us> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/632 +X-Sequence-Number: 12029 + +On Fri, Apr 22, 2005 at 10:08:06PM -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> > I've run some performance tests. The actual test case is at +> > http://stats.distributed.net/~decibel/timing.sql, and the results are at +> > http://stats.distributed.net/~decibel/timing.log. In a nutshell, doing +> > an index scan appears to be about 2x faster than a sequential scan and a +> > sort. +> +> ... for one test case, on one platform, with a pretty strong bias to the +> fully-cached state since you ran the test multiple times consecutively. + +The table is 6.5G and the box only has 4G, so I suspect it's not cached. + +> Past experience has generally been that an explicit sort is quicker, +> so you'll have to pardon me for suspecting that this case may be +> atypical. Is the table nearly in order by pkey, by any chance? + +It might be, but there's no way I can check with a multi-key index, +right? + +I'll re-run the tests with a single column index on a column with a +correlation of 16% + +> > In any case, it's clear that the planner is making the wrong choice +> > here. BTW, changing random_page_cost to 3 or 4 doesn't change the plan. +> +> Feel free to propose better cost equations. + +Where would I look in code to see what's used now? +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sat Apr 23 00:09:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A9FAF5388E + for ; + Sat, 23 Apr 2005 00:09:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70755-04 + for ; + Sat, 23 Apr 2005 03:09:26 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B29653622 + for ; + Sat, 23 Apr 2005 00:09:22 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 8EE8215534; Fri, 22 Apr 2005 22:09:20 -0500 (CDT) +Date: Fri, 22 Apr 2005 22:09:20 -0500 +From: "Jim C. Nasby" +To: pgsql-performance@postgresql.org +Subject: Interesting numbers on a CREATE INDEX +Message-ID: <20050423030920.GZ58835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/633 +X-Sequence-Number: 12030 + +Building a single-column index on a dual opteron with 4G of memory, data +on a 4 SATA RAID10; OS, logs and tempsace on a SATA mirror, with +sort_mem set to 2.5G, create index is actually CPU bound for large +portions of time. The postgresql process and system time are accounting +for an entire CPU, and systat (this is a FreeBSD5.2 box) is generally +showing 80% utilization on the RAID10 and 40% on the mirror. + +Not a performance problem, but I thought some people might be +interested. The RAID10 is doing about 28-32MB/s, I would think this +wouldn't be enough to swamp the CPU but I guess I would be thinking +wrong. + +BTW, the column I'm indexing is a bigint with a low correlation. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sat Apr 23 00:12:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BDEC54067 + for ; + Sat, 23 Apr 2005 00:12:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74143-03 + for ; + Sat, 23 Apr 2005 03:12:47 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id D14F854068 + for ; + Sat, 23 Apr 2005 00:12:39 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id B4B5C15547; Fri, 22 Apr 2005 22:12:38 -0500 (CDT) +Date: Fri, 22 Apr 2005 22:12:38 -0500 +From: "Jim C. Nasby" +To: Dave Chapeskie , + pgsql-perform +Subject: Re: Index bloat problem? +Message-ID: <20050423031238.GA58835@decibel.org> +References: <20050421173855.76286.qmail@web51410.mail.yahoo.com> + <200504211044.48794.josh@agliodbs.com> + <4267EFF9.2000908@rentec.com> + <200504211128.43937.josh@agliodbs.com> + <20050421193305.GA84813@ddm.wox.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050421193305.GA84813@ddm.wox.org> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/634 +X-Sequence-Number: 12031 + +You would be interested in +http://archives.postgresql.org/pgsql-hackers/2005-04/msg00565.php + +On Thu, Apr 21, 2005 at 03:33:05PM -0400, Dave Chapeskie wrote: +> On Thu, Apr 21, 2005 at 11:28:43AM -0700, Josh Berkus wrote: +> > Michael, +> > +> > > ....Every five minutes, DBCC INDEXDEFRAG will report to the user an +> > > estimated percentage completed. DBCC INDEXDEFRAG can be terminated at +> > > any point in the process, and *any completed work is retained.*" +> > +> > Keen. Sounds like something for our TODO list. +> > +> > -- +> > Josh Berkus +> > Aglio Database Solutions +> > San Francisco +> +> See http://archives.postgresql.org/pgsql-general/2005-03/msg01465.php +> for my thoughts on a non-blocking alternative to REINDEX. I got no +> replies to that message. :-( +> +> +> I've almost got a working solution integrated in the backend that does +> correct WAL logging and everything. (Writing the code to write and +> replay WAL logs for complicated operations can be very annoying!) +> +> For now I've gone with a syntax of: +> +> REINDEX INDEX btree_index_name INCREMENTAL; +> +> (For now it's not a proper index AM (accessor method), instead the +> generic index code knows this is only supported for btrees and directly +> calls the btree_compress function.) +> +> It's not actually a REINDEX per-se in that it doesn't rebuild the whole +> index. It holds brief exclusive locks on the index while it shuffles +> items around to pack the leaf pages fuller. There were issues with the +> code I attached to the above message that have been resolved with the +> new code. With respect to the numbers provided in that e-mail the new +> code also recycles more pages than before. +> +> Once I've finished it up I'll prepare and post a patch. +> +> -- +> Dave Chapeskie +> OpenPGP Key ID: 0x3D2B6B34 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sat Apr 23 02:04:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B292653776 + for ; + Sat, 23 Apr 2005 02:00:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13056-06 + for ; + Sat, 23 Apr 2005 05:00:44 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F71F53784 + for ; + Sat, 23 Apr 2005 02:00:42 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3N50efF006537; + Sat, 23 Apr 2005 01:00:40 -0400 (EDT) +To: "Jim C. Nasby" +Cc: Dave Held , + pgsql-performance@postgresql.org +Subject: Re: Sort and index +In-reply-to: <20050423030002.GY58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050420004234.GX58835@decibel.org> + <19631.1113966086@sss.pgh.pa.us> + <20050420034041.GC58835@decibel.org> + <20050423015404.GV58835@decibel.org> + <4269.1114222086@sss.pgh.pa.us> + <20050423030002.GY58835@decibel.org> +Comments: In-reply-to "Jim C. Nasby" + message dated "Fri, 22 Apr 2005 22:00:02 -0500" +Date: Sat, 23 Apr 2005 01:00:40 -0400 +Message-ID: <6536.1114232440@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/640 +X-Sequence-Number: 12037 + +"Jim C. Nasby" writes: +>> Feel free to propose better cost equations. + +> Where would I look in code to see what's used now? + +All the gold is hidden in src/backend/optimizer/path/costsize.c. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Apr 23 03:30:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 780C7537F6 + for ; + Sat, 23 Apr 2005 03:30:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36142-03 + for ; + Sat, 23 Apr 2005 06:30:48 +0000 (GMT) +Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) + by svr1.postgresql.org (Postfix) with ESMTP id B908C540C3 + for ; + Sat, 23 Apr 2005 03:30:47 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (sccrmhc13) with ESMTP + id <2005042306304601600a987re>; Sat, 23 Apr 2005 06:30:47 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Fri, 22 Apr 2005 23:30:45 -0700 + id 000B6A45.4269EB95.000067F3 +Date: Fri, 22 Apr 2005 23:30:45 -0700 +From: Kevin Brown +To: 'Postgresql Performance' +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Message-ID: <20050423063044.GI19518@filer> +Mail-Followup-To: Kevin Brown , + 'Postgresql Performance' +References: <4266F7B3.7050004@arbash-meinel.com> + <000f01c54679$8d2f1f70$797ba8c0@jfradkin> + <20050423020151.GW58835@decibel.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <20050423020151.GW58835@decibel.org> +Organization: Frobozzco International +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/641 +X-Sequence-Number: 12038 + +Jim C. Nasby wrote: +> Hrm... I was about to suggest that for timing just the query (and not +> output/data transfer time) using explain analyze, but then I remembered +> that explain analyze can incur some non-trivial overhead with the timing +> calls. Is there a way to run the query but have psql ignore the output? +> If so, you could use \timing. + +Would timing "SELECT COUNT(*) FROM (query)" work? + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-performance-owner@postgresql.org Sat Apr 23 05:02:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F7475420B + for ; + Sat, 23 Apr 2005 05:02:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56964-08 + for ; + Sat, 23 Apr 2005 08:02:25 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 4633B53C74 + for ; + Sat, 23 Apr 2005 05:02:24 -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 1DPFaX-0007JU-00; Sat, 23 Apr 2005 04:02:05 -0400 +To: josh@agliodbs.com +Cc: Marko Ristola , + pgsql-perform +Subject: Re: Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <426944D0.6040706@kolumbus.fi> <200504221152.51736.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> +In-Reply-To: <200504221336.08325.josh@agliodbs.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 23 Apr 2005 04:02:05 -0400 +Message-ID: <8764ydapky.fsf@stark.xeocode.com> +Lines: 36 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/642 +X-Sequence-Number: 12039 + + +Josh Berkus writes: + +> ... I think the problem is in our heuristic sampling code. I'm not the first +> person to have this kind of a problem. Will be following up with tests ... + +I looked into this a while back when we were talking about changing the +sampling method. The conclusions were discouraging. Fundamentally, using +constant sized samples of data for n_distinct is bogus. Constant sized samples +only work for things like the histograms that can be analyzed through standard +statistics population sampling which depends on the law of large numbers. + +n_distinct requires you to estimate how frequently very rare things occur. You +can't apply the law of large numbers because even a single instance of a value +out of a large pool alters the results disproportionately. + +To get a valid estimate for n_distinct you would need to sample a fixed +percentage of the table. Not a fixed size sample. That just isn't practical. +Moreover, I think the percentage would have to be quite large. Even if you +sampled half the table I think the confidence interval would be quite wide. + +The situation is worsened because it's unclear how to interpolate values for +subsets of the table. If the histogram says you have a million records and +you're adding a clause that has a selectivity of 50% then half a million is a +good guess. But if what you care about is n_distinct and you start with a +million records with 1,000 distinct values and then apply a clause that +filters 50% of them, how do you estimate the resulting n_distinct? 500 is +clearly wrong, but 1,000 is wrong too. You could end up with anywhere from 0 +to 1,000 and you have no good way to figure out where the truth lies. + +So I fear this is fundamentally a hopeless situation. It's going to be +difficult to consistently get good plans for any queries that depend on good +estimates for n_distinct. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 11:11:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 865A35362B + for ; + Sat, 23 Apr 2005 11:11:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42873-10 + for ; + Sat, 23 Apr 2005 14:11:24 +0000 (GMT) +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by svr1.postgresql.org (Postfix) with ESMTP id CFA4854247 + for ; + Sat, 23 Apr 2005 11:11:23 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IFE00GMOKR2K176@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Sat, 23 Apr 2005 09:11:27 -0500 (CDT) +Date: Sat, 23 Apr 2005 10:11:28 -0400 +From: "Joel Fradkin" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: <20050423021107.GX58835@decibel.org> +To: "'Jim C. Nasby'" +Cc: "'Alvaro Herrera'" , + "'Andreas Pflug'" , + "'Dave Page'" , + , , + "'Joshua D. Drake'" , , + "'Steve Hatt'" +Message-id: <001701c5480e$57e7fad0$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/643 +X-Sequence-Number: 12040 + +I would very, very strongly encourage you to run multi-user tests before +deciding on mysql. Mysql is nowhere near as capable when it comes to +concurrent operations as PostgreSQL is. From what others have said, it +doesn't take many concurrent operations for it to just fall over. I +can't speak from experience because I avoid mysql like the plague, +though. :) + +I am just testing the water so to speak, if it cant handle single user = +tests +then multiple user tests are kind of a waste of time. + +I am trying to de-normalize my view into a table to see if I can get my = +app +to work. It is a good idea anyway but raises a ton of questions about +dealing with the data post a case being closed etc; also on multiple = +child +relationships like merchandise and payments etc. + +I did do a test of all three (MSSQL, MYSQL,and postgres) in aqua studio = +, +all on the same machine running the servers and found postgres beat out +MYSQL, but like any other test it may have been an issue with aqua = +studio +and mysql in any case I have not made a decision to use mysql I am still +researching fixes for postgres. + +I am waiting to here back from Josh on using cursors and trying to = +flatten +long running views.=20 + +I am a little disappointed I have not understood enough to get my = +analyzer +to use the proper plan, we had to set seqscan off to get the select from +response_line to work fast and I had to turn off merge joins to get = +assoc +list to work fast. Once I am up I can try to learn more about it, I am = +so +glad there are so many folks here willing to take time to educate us = +newb's. + + + +From pgsql-odbc-owner@postgresql.org Sat Apr 23 11:18:38 2005 +X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B15D5533DE + for ; + Sat, 23 Apr 2005 11:18:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44164-09 + for ; + Sat, 23 Apr 2005 14:18:28 +0000 (GMT) +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by svr1.postgresql.org (Postfix) with ESMTP id AC74054249 + for ; Sat, 23 Apr 2005 11:18:26 -0300 (ADT) +Received: from jfradkin ([63.162.100.127]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IFE00A7LL2U5ME6@vms048.mailsrvcs.net> for + pgsql-odbc@postgresql.org; Sat, 23 Apr 2005 09:18:31 -0500 (CDT) +Date: Sat, 23 Apr 2005 10:18:31 -0400 +From: "Joel Fradkin" +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +In-reply-to: + +To: "'Mohan, Ross'" , +Message-id: <001801c5480f$54573d80$797ba8c0@jfradkin> +MIME-version: 1.0 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Content-type: text/plain; charset=us-ascii +Content-transfer-encoding: quoted-printable +Importance: Normal +X-Priority: 3 (Normal) +X-MSMail-priority: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/63 +X-Sequence-Number: 5222 + +Hate to be dumb, but unfortunately I am. + +Could you give me an idea what I should be using, or is there a good +resource for me to check out. +I have been spending so much time with config and moving data, = +converting +etc, I never looked at the odbc settings (didn't even think about it = +until +Josh brought it up). I did ask him for his advice, but would love a = +second +opinion. + +Our data is a bit of a mixture, some records have text items most are +varchars and integers with a bit of Booleans mixed in. + +I am running 8.0.2 so not sure if the protocol is ODBC or Postgres? + +Thanks for responding I appreciate any help=20 + +Joel Fradkin +=20 +-----Original Message----- +From: pgsql-odbc-owner@postgresql.org +[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mohan, Ross +Sent: Thursday, April 21, 2005 10:01 AM +To: pgsql-odbc@postgresql.org +Subject: Re: [ODBC] [PERFORM] Joel's Performance Issues WAS : Opteron vs +Xeon + +Joel, thanks. A couple of things jump out there for +me, not a problem for a routine ODBC connection, but +perhaps in the "lotsa stuff" context of your current +explorations, it might be relevant? + +I am completely shooting from the hip, here, but...if +it were my goose to cook, I'd be investigating + +Session("StringConn") =3D +"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D; +PWD=3D;ReadOnly=3D0;Protocol=3D6.4; + +|| Protocol? Is this related to version? is the driver waaaay old? + + +FakeOidIndex=3D0;ShowOidColumn=3D0;RowVersioning=3D0; +ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100; + +|| Fetch great for OLTP, lousy for batch? + + +Socket=3D4096;UnknownSizes=3D0;MaxVarcharSize=3D254;MaxLongVarcharSize=3D= +8190; + +|| what ARE the datatypes and sizes in your particular case?=20 + +Debug=3D0; + +|| a run with debug=3D1 probably would spit up something = +interesting.... + +CommLog=3D0;Optimizer=3D1; + +|| Optimizer? that's a new one on me.... + +Ksqo=3D1;UseDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar=3D= +0;BoolsAs +Char=3D1;Parse=3D0;CancelAsFreeStmt=3D;ExtraSysTablePrefixes=3Ddd_;LFConv= +ersion=3D1;Up +datableCursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsL= +ongVarBinar +y=3D0;UseServerSidePrepare=3D0" + + +|| that's about all I can see, prima facie. I'll be very curious to = +know +if ODBC is + any part of your performance equation.=20 + + +HTH,=20 + +Ross + +-----Original Message----- +From: Joel Fradkin [mailto:jfradkin@wazagua.com]=20 +Sent: Thursday, April 21, 2005 10:54 AM +To: Mohan, Ross +Cc: pgsql-odbc@postgresql.org; PostgreSQL Perform +Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + + +Here is the connect string I am using. +It could be horrid as I cut it from ODBC program. + +Session("StringConn") =3D +"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D; +PWD=3D;ReadOnly=3D0;Protocol=3D6.4;FakeOidIndex=3D0;ShowOidColumn=3D0;Row= +Versioning=3D0; +ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100;Socket=3D4096;UnknownSiz= +es=3D0;MaxVar +charSize=3D254;MaxLongVarcharSize=3D8190;Debug=3D0;CommLog=3D0;Optimizer=3D= +1;Ksqo=3D1;Us +eDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar=3D0;BoolsAs= +Char=3D1;Pa +rse=3D0;CancelAsFreeStmt=3D0;ExtraSysTablePrefixes=3Ddd_;LFConversion=3D1= +;UpdatableC +ursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongVarBi= +nary=3D0;UseS +erverSidePrepare=3D0" + +Joel Fradkin +=20 + +-----Original Message----- +From: Mohan, Ross [mailto:RMohan@arbinet.com]=20 +Sent: Thursday, April 21, 2005 9:42 AM +To: jfradkin@wazagua.com +Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon + +FWIW, ODBC has variables to tweak, as well. fetch/buffer sizes, and the +like.=20 + +Maybe one of the ODBC cognoscenti here can chime in more concretely.... + + + + + + +---------------------------(end of broadcast)--------------------------- +TIP 7: don't forget to increase your free space map settings + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 12:36:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DFB5533F9 + for ; + Sat, 23 Apr 2005 12:36:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64766-09 + for ; + Sat, 23 Apr 2005 15:36:18 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AC205336E + for ; + Sat, 23 Apr 2005 12:36:03 -0300 (ADT) +Received: from [192.168.1.105] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3NFUEma015316; Sat, 23 Apr 2005 08:30:14 -0700 +Message-ID: <426A6B58.5070506@commandprompt.com> +Date: Sat, 23 Apr 2005 08:35:52 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: "'Jim C. Nasby'" , + "'Alvaro Herrera'" , + "'Andreas Pflug'" , + "'Dave Page'" , + pgsql-performance@postgresql.org, ac@wazagua.com, + wheyliger@wazagua.com, "'Steve Hatt'" +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +References: <001701c5480e$57e7fad0$797ba8c0@jfradkin> +In-Reply-To: <001701c5480e$57e7fad0$797ba8c0@jfradkin> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/644 +X-Sequence-Number: 12041 + +Joel Fradkin wrote: +> I would very, very strongly encourage you to run multi-user tests before +> deciding on mysql. Mysql is nowhere near as capable when it comes to +> concurrent operations as PostgreSQL is. From what others have said, it +> doesn't take many concurrent operations for it to just fall over. I +> can't speak from experience because I avoid mysql like the plague, +> though. :) +> +> I am just testing the water so to speak, if it cant handle single user tests +> then multiple user tests are kind of a waste of time. + +Joel I think you are missing the point on the above comment. The above +comment as I read is, o.k. you are having problems with PostgreSQL BUT +MySQL isn't going to help you and you will see that in multi-user tests. + +MySQL is known to work very well on small databases without a lot of +concurrent sessions. I don't think anybody here would argue that. + +Where MySQL runs into trouble is larger databases with lots of +concurrent connections. + +> I am a little disappointed I have not understood enough to get my analyzer +> to use the proper plan, we had to set seqscan off to get the select from +> response_line to work fast and I had to turn off merge joins to get assoc +> list to work fast. Once I am up I can try to learn more about it, I am so +> glad there are so many folks here willing to take time to educate us newb's. + +Sincerely, + +Joshua D. Drake +Command Prompt, Inc. + + +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 13:03:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2EBBE535EF + for ; + Sat, 23 Apr 2005 13:03:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75078-02 + for ; + Sat, 23 Apr 2005 16:03:37 +0000 (GMT) +Received: from themode.com (themode.com [161.58.169.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FD3A535BB + for ; + Sat, 23 Apr 2005 13:03:36 -0300 (ADT) +Received: from localhost (bde@localhost) + by themode.com (8.12.11/8.12.11) with ESMTP id j3NG3XcO064472 + for ; + Sat, 23 Apr 2005 12:03:33 -0400 (EDT) +Date: Sat, 23 Apr 2005 12:03:33 -0400 (EDT) +From: brew@theMode.com +X-X-Sender: mode@themode.com +To: pgsql-performance@postgresql.org +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +In-Reply-To: <426A6B58.5070506@commandprompt.com> +Message-ID: +References: <001701c5480e$57e7fad0$797ba8c0@jfradkin> + <426A6B58.5070506@commandprompt.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/645 +X-Sequence-Number: 12042 + + + +> I am just testing the water so to speak, if it cant handle single user +> tests then multiple user tests are kind of a waste of time. + +At the risk of being even more pedantic, let me point out that if you are +going to be running your application with multiple users the reverse is +even more true, 'If it can't handle multiple user tests then single user +tests are kind of a waste of time'. + +brew + + ========================================================================== + Strange Brew (brew@theMode.com) + Check out my Stock Option Covered Call website http://www.callpix.com + and my Musician's Online Database Exchange http://www.TheMode.com + ========================================================================== + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 13:57:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0065B53401 + for ; + Sat, 23 Apr 2005 13:57:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39584-04 + for ; + Sat, 23 Apr 2005 16:57:36 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id 35A4E533A7 + for ; + Sat, 23 Apr 2005 13:57:33 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3NGvQe02379; + Sat, 23 Apr 2005 11:57:26 -0500 +In-Reply-To: <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> +Content-Transfer-Encoding: 7bit +Cc: Tom Lane , pgsql-performance@postgresql.org +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Sat, 23 Apr 2005 09:57:20 -0700 +To: Richard Plotkin +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/646 +X-Sequence-Number: 12043 + +If anybody has additional advice on this problem, I would really, +really appreciate it... + +I updated postgres to 8.0.2, am running vacuumdb -faz every 3 hours, +and 50 minutes after a vacuum the CPU usage still skyrocketed, and the +disk started filling. This time, there is only a single file that is +spanning multiple GB, but running oid2name again returns no result on +the oid or filenode. + +With the increased vacuuming, fixed temp tables, etc., I really am at a +loss for what's happening, and could really use some additional help. + +Thank you, +Richard + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 13:59:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D11B534EE + for ; + Sat, 23 Apr 2005 13:59:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40908-04 + for ; + Sat, 23 Apr 2005 16:59:50 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id 81EE4533A7 + for ; + Sat, 23 Apr 2005 13:59:49 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3NGxhe02813; + Sat, 23 Apr 2005 11:59:43 -0500 +In-Reply-To: <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> + <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <9f04a86af210170832829941347e492b@richardplotkin.com> +Content-Transfer-Encoding: 7bit +Cc: Tom Lane , pgsql-performance@postgresql.org +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Sat, 23 Apr 2005 09:59:36 -0700 +To: Richard Plotkin +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/647 +X-Sequence-Number: 12044 + +I also forgot to mention, vacuumdb fails on the command line now with +the following error: +vacuumdb: could not connect to database smt: FATAL: sorry, too many +clients already + +On Apr 23, 2005, at 9:57 AM, Richard Plotkin wrote: + +> If anybody has additional advice on this problem, I would really, +> really appreciate it... +> +> I updated postgres to 8.0.2, am running vacuumdb -faz every 3 hours, +> and 50 minutes after a vacuum the CPU usage still skyrocketed, and the +> disk started filling. This time, there is only a single file that is +> spanning multiple GB, but running oid2name again returns no result on +> the oid or filenode. +> +> With the increased vacuuming, fixed temp tables, etc., I really am at +> a loss for what's happening, and could really use some additional +> help. +> +> Thank you, +> Richard +> + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 15:06:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4342F535BC + for ; + Sat, 23 Apr 2005 15:06:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54531-04 + for ; + Sat, 23 Apr 2005 18:06:30 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 24CD8536A0 + for ; + Sat, 23 Apr 2005 15:06:25 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3NI6P0Y012017; + Sat, 23 Apr 2005 14:06:25 -0400 (EDT) +To: Richard Plotkin +Cc: pgsql-performance@postgresql.org +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +In-reply-to: <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> + <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> +Comments: In-reply-to Richard Plotkin + message dated "Sat, 23 Apr 2005 09:57:20 -0700" +Date: Sat, 23 Apr 2005 14:06:25 -0400 +Message-ID: <12016.1114279585@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/648 +X-Sequence-Number: 12045 + +Richard Plotkin writes: +> I updated postgres to 8.0.2, am running vacuumdb -faz every 3 hours, +> and 50 minutes after a vacuum the CPU usage still skyrocketed, and the +> disk started filling. This time, there is only a single file that is +> spanning multiple GB, but running oid2name again returns no result on +> the oid or filenode. + +What is the filename exactly (full path)? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Apr 23 15:12:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D56E5423F + for ; + Sat, 23 Apr 2005 15:11:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54213-09 + for ; + Sat, 23 Apr 2005 18:11:50 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id 5444F54225 + for ; + Sat, 23 Apr 2005 15:11:44 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3NIBjO18832; + Sat, 23 Apr 2005 13:11:45 -0500 +In-Reply-To: <12016.1114279585@sss.pgh.pa.us> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> + <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> + <12016.1114279585@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Sat, 23 Apr 2005 11:11:38 -0700 +To: Tom Lane +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/649 +X-Sequence-Number: 12046 + +/usr/local/pgsql/data/base/17234/42791 +/usr/local/pgsql/data/base/17234/42791.1 +/usr/local/pgsql/data/base/17234/42791.2 +/usr/local/pgsql/data/base/17234/42791.3 +/usr/local/pgsql/data/base/17234/42791.4 +/usr/local/pgsql/data/base/17234/42791.5 +/usr/local/pgsql/data/base/17234/42791.6 +/usr/local/pgsql/data/base/17234/42791.7 +/usr/local/pgsql/data/base/17234/42791.8 +/usr/local/pgsql/data/base/17234/42791.9 +/usr/local/pgsql/data/base/17234/42791.10 +/usr/local/pgsql/data/base/17234/42791.11 + +On Apr 23, 2005, at 11:06 AM, Tom Lane wrote: + +> Richard Plotkin writes: +>> I updated postgres to 8.0.2, am running vacuumdb -faz every 3 hours, +>> and 50 minutes after a vacuum the CPU usage still skyrocketed, and the +>> disk started filling. This time, there is only a single file that is +>> spanning multiple GB, but running oid2name again returns no result on +>> the oid or filenode. +> +> What is the filename exactly (full path)? +> +> regards, tom lane +> + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 15:17:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AE19A54224 + for ; + Sat, 23 Apr 2005 15:17:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56126-04 + for ; + Sat, 23 Apr 2005 18:17:06 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A487654240 + for ; + Sat, 23 Apr 2005 15:17:04 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3NIH5Qi012136; + Sat, 23 Apr 2005 14:17:05 -0400 (EDT) +To: Richard Plotkin +Cc: pgsql-performance@postgresql.org +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +In-reply-to: +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> + <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> + <12016.1114279585@sss.pgh.pa.us> + +Comments: In-reply-to Richard Plotkin + message dated "Sat, 23 Apr 2005 11:11:38 -0700" +Date: Sat, 23 Apr 2005 14:17:05 -0400 +Message-ID: <12135.1114280225@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/650 +X-Sequence-Number: 12047 + +Richard Plotkin writes: +> /usr/local/pgsql/data/base/17234/42791 +> /usr/local/pgsql/data/base/17234/42791.1 +> /usr/local/pgsql/data/base/17234/42791.2 +> /usr/local/pgsql/data/base/17234/42791.3 +> ... + +Well, that is certainly a table or index of some kind. + +Go into database 17234 --- if you are not certain which one that is, see + select datname from pg_database where oid = 17234 +and do + select relname from pg_class where relfilenode = 42791 + +The only way I could see for this to not find the table is if the table +creation has not been committed yet. Do you have any apps that create +and fill a table in a single transaction? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Apr 23 15:33:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0313A542D7 + for ; + Sat, 23 Apr 2005 15:32:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57971-10 + for ; + Sat, 23 Apr 2005 18:32:51 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E28B542CD + for ; + Sat, 23 Apr 2005 15:32:49 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 1FC6E30E8B; Sat, 23 Apr 2005 20:31:32 +0200 (MET DST) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Sat, 23 Apr 2005 14:27:12 -0400 +Organization: cbbrowne Computing Inc +Lines: 29 +Message-ID: +References: <20050423021107.GX58835@decibel.org> + <001701c5480e$57e7fad0$797ba8c0@jfradkin> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:TzciKb9rv6zK1tANo1A8n6iSgHU= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.387 tagged_above=0 required=5 tests=AWL, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200504/652 +X-Sequence-Number: 12049 + +Centuries ago, Nostradamus foresaw when jfradkin@wazagua.com ("Joel Fradkin") would write: +> I am just testing the water so to speak, if it cant handle single +> user tests then multiple user tests are kind of a waste of time. + +I would suggest that if multi-user functionality is needed, then +starting with single user tests is a similar waste of time. + +There's good reason to look at it this way... + +It is all too common for people to try to start building things with +primitive functionality, and then try to "evolve" the system into what +they need. It is possible for that to work, if the "base" covers +enough of the necessary functionality. + +In practice, we have watched Windows evolve in such a fashion with +respect to multiuser support, and, in effect, it has never really +gotten it. Microsoft started by hacking something on top of MS-DOS, +and by the time enough applications had enough dependancies on the way +that worked, it has essentially become impossible for them to migrate +properly to a multiuser model since applications are normally designed +with the myopic "this is MY computer!" model of the world. + +You may not need _total_ functionality in the beginning, but, +particularly for multiuser support, which has deep implications for +applications, it needs to be there In The Beginning. +-- +output = reverse("moc.liamg" "@" "enworbbc") +http://linuxdatabases.info/info/lisp.html +A CONS is an object which cares. -- Bernie Greenberg. + +From pgsql-performance-owner@postgresql.org Sat Apr 23 15:28:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 55D7D54240 + for ; + Sat, 23 Apr 2005 15:28:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56821-07 + for ; + Sat, 23 Apr 2005 18:28:17 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E9CB5423F + for ; + Sat, 23 Apr 2005 15:28:14 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7275079; Sat, 23 Apr 2005 11:30:13 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Kevin Brown +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Sat, 23 Apr 2005 11:27:42 -0700 +User-Agent: KMail/1.6.2 +Cc: 'Postgresql Performance' +References: <4266F7B3.7050004@arbash-meinel.com> + <20050423020151.GW58835@decibel.org> <20050423063044.GI19518@filer> +In-Reply-To: <20050423063044.GI19518@filer> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504231127.42389.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/651 +X-Sequence-Number: 12048 + +Jim, Kevin, + +> > Hrm... I was about to suggest that for timing just the query (and not +> > output/data transfer time) using explain analyze, but then I remembered +> > that explain analyze can incur some non-trivial overhead with the timing +> > calls. Is there a way to run the query but have psql ignore the output? +> > If so, you could use \timing. +> +> Would timing "SELECT COUNT(*) FROM (query)" work? + +Just \timing would work fine; PostgreSQL doesn't return anything until it has +the whole result set. That's why MSSQL vs. PostgreSQL timing comparisons are +deceptive unless you're careful: MSSQL returns the results on block at a +time, and reports execution time as the time required to return the *first* +block, as opposed to Postgres which reports the time required to return the +whole dataset. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Apr 23 15:37:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 039FB5422E + for ; + Sat, 23 Apr 2005 15:37:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60073-03 + for ; + Sat, 23 Apr 2005 18:37:39 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id 52EBE5421A + for ; + Sat, 23 Apr 2005 15:37:35 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3NIbaO24059; + Sat, 23 Apr 2005 13:37:36 -0500 +In-Reply-To: <12135.1114280225@sss.pgh.pa.us> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> + <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> + <12016.1114279585@sss.pgh.pa.us> + + <12135.1114280225@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <31935aa56e9539c5648cb09e78152c03@richardplotkin.com> +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Sat, 23 Apr 2005 11:37:30 -0700 +To: Tom Lane +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/653 +X-Sequence-Number: 12050 + +Hi Tom, + +Thanks for your responses this morning. I did the select relname, and +it returned 0 rows. I do have one function that creates a temp table +and fills it within the same transaction. I'm pasting it below. +Perhaps the "ON COMMIT DROP" is causing problems, and I need to drop +the table at the end of the function instead of using ON COMMIT DROP? + +-- +-- Name: crumbs(integer, text, boolean); Type: FUNCTION; Schema: public +-- + +CREATE FUNCTION crumbs(integer, text, boolean) RETURNS text + AS $_$DECLARE + + starting_page ALIAS FOR $1; + + current_page integer; + + delimiter text DEFAULT ': '; + + withLinkTags BOOLEAN DEFAULT FALSE; + + page_id_temp INTEGER; + + page_name_temp TEXT; + + current_nOrder INTEGER := 1; + + page_results record; + + path TEXT DEFAULT ''; + +BEGIN + + IF starting_page IS NULL + THEN + RETURN NULL; + END IF; + + current_page := starting_page; + + IF $2 IS NOT NULL + THEN + delimiter := $2; + END IF; + + IF $3 IS NOT NULL + THEN + withLinkTags := $3; + END IF; + + --Create a table consisting of three columns: nOrder, page_id, name + + CREATE TEMPORARY TABLE results + (nOrder integer, + page_id integer, + name text) + ON COMMIT DROP; + + --Select the current page into the results table + + SELECT INTO + page_id_temp, + page_name_temp + + p.page_id, + CASE WHEN p.title_abbr IS NOT NULL + THEN p.title_abbr + ELSE p.title + END as name + + FROM page p + + WHERE p.page_id = starting_page; + + IF FOUND + THEN + EXECUTE 'INSERT INTO results (nOrder, page_id, name) + VALUES (' || current_nOrder || ',' + || page_id_temp || ',' + || quote_literal(page_name_temp) + || ')'; + + current_nOrder := current_nOrder + 1; + END IF; + + --Loop through results for page parents + + LOOP + + SELECT INTO + page_id_temp, + page_name_temp + + parent.page_id as parent_id, + CASE WHEN parent.title_abbr IS NOT NULL + THEN parent.title_abbr + ELSE parent.title + END as name + + FROM page AS child + + INNER JOIN page AS parent + ON child.subcat_id = parent.page_id + + WHERE child.page_id = current_page; + + IF FOUND + THEN + + EXECUTE 'INSERT INTO results (nOrder, page_id, name) + VALUES (' || current_nOrder || ',' + || page_id_temp || ',' + || quote_literal(page_name_temp) + || ')'; + + current_page = page_id_temp; + + current_nOrder := current_nOrder + 1; + + ELSE + + EXIT; + + END IF; + + END LOOP; + + + SELECT INTO + page_id_temp, + page_name_temp + + c.default_page as parent_id, + c.name + + FROM page p + + INNER JOIN category c + ON c.cat_id = p.cat_id + + WHERE page_id = starting_page; + + IF FOUND + THEN + + EXECUTE 'INSERT INTO results (nOrder, page_id, name) + VALUES (' || current_nOrder || ',' + || page_id_temp || ',' + || quote_literal(page_name_temp) + || ')'; + + END IF; + + FOR page_results IN EXECUTE 'SELECT * FROM results ORDER BY nOrder +DESC' LOOP + + IF path = '' + THEN + IF withLinkTags IS TRUE + THEN + path := ''; + path := path || page_results.name; + path := path || ''; + ELSE + path := page_results.name; + END IF; + ELSE + IF withLinkTags IS TRUE + THEN + path := path || delimiter; + path := path || ''; + path := path || page_results.name; + path := path || ''; + ELSE + path := path || delimiter || page_results.name; + END IF; + END IF; + + END LOOP; + + RETURN path; + +END;$_$ + LANGUAGE plpgsql; +On Apr 23, 2005, at 11:17 AM, Tom Lane wrote: + +> Richard Plotkin writes: +>> /usr/local/pgsql/data/base/17234/42791 +>> /usr/local/pgsql/data/base/17234/42791.1 +>> /usr/local/pgsql/data/base/17234/42791.2 +>> /usr/local/pgsql/data/base/17234/42791.3 +>> ... +> +> Well, that is certainly a table or index of some kind. +> +> Go into database 17234 --- if you are not certain which one that is, +> see +> select datname from pg_database where oid = 17234 +> and do +> select relname from pg_class where relfilenode = 42791 +> +> The only way I could see for this to not find the table is if the table +> creation has not been committed yet. Do you have any apps that create +> and fill a table in a single transaction? +> +> regards, tom lane +> + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 16:51:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 669CF536E5 + for ; + Sat, 23 Apr 2005 16:51:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72785-04 + for ; + Sat, 23 Apr 2005 19:50:56 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D475536E1 + for ; + Sat, 23 Apr 2005 16:50:55 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3NJouUT014611; + Sat, 23 Apr 2005 15:50:56 -0400 (EDT) +To: Richard Plotkin +Cc: pgsql-performance@postgresql.org +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +In-reply-to: <31935aa56e9539c5648cb09e78152c03@richardplotkin.com> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> + <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> + <12016.1114279585@sss.pgh.pa.us> + + <12135.1114280225@sss.pgh.pa.us> + <31935aa56e9539c5648cb09e78152c03@richardplotkin.com> +Comments: In-reply-to Richard Plotkin + message dated "Sat, 23 Apr 2005 11:37:30 -0700" +Date: Sat, 23 Apr 2005 15:50:56 -0400 +Message-ID: <14610.1114285856@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/654 +X-Sequence-Number: 12051 + +Richard Plotkin writes: +> Thanks for your responses this morning. I did the select relname, and +> it returned 0 rows. I do have one function that creates a temp table +> and fills it within the same transaction. I'm pasting it below. +> Perhaps the "ON COMMIT DROP" is causing problems, and I need to drop +> the table at the end of the function instead of using ON COMMIT DROP? + +Well, I think we can conclude that the function is pushing way more +data into the temp table than you expect. I am wondering if that loop +in the middle of the function is turning into an infinite loop --- could +it be finding some sort of cycle in your page data? You might want to +add some RAISE NOTICE commands to the loop so you can track what it's +doing. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Apr 23 17:18:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A8475380F + for ; + Sat, 23 Apr 2005 17:18:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78463-04 + for ; + Sat, 23 Apr 2005 20:18:37 +0000 (GMT) +Received: from mta10.nationwireless.net (mta10.nationwireless.net + [63.163.128.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 1654A537F2 + for ; + Sat, 23 Apr 2005 17:18:33 -0300 (ADT) +Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with + ESMTP + (SMTPD32-8.15) id AD9A259D0148; Sat, 23 Apr 2005 16:18:34 -0400 +From: "Joel Fradkin" +To: "PostgreSQL Perform" +Subject: flattening the file might work for me here is the analyze. +Date: Sat, 23 Apr 2005 16:18:36 -0400 +Message-ID: <000001c54841$a1567880$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0001_01C54820.1A44D880" +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.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200504/655 +X-Sequence-Number: 12052 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0001_01C54820.1A44D880 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit + +"Index Scan using ix_tblviwauditcube_clientnum on tblviwauditcube +(cost=0.00..35895.75 rows=303982 width=708) (actual time=0.145..1320.432 +rows=316490 loops=1)" + +" Index Cond: ((clientnum)::text = 'MSI'::text)" + +"Total runtime: 1501.028 ms" + + + +Joel Fradkin + + + +Wazagua, Inc. +2520 Trailmate Dr +Sarasota, Florida 34243 +Tel. 941-753-7111 ext 305 + + + +jfradkin@wazagua.com +www.wazagua.com +Powered by Wazagua +Providing you with the latest Web-based technology & advanced tools. +C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc + This email message is for the use of the intended recipient(s) and may +contain confidential and privileged information. Any unauthorized review, +use, disclosure or distribution is prohibited. If you are not the intended +recipient, please contact the sender by reply email and delete and destroy +all copies of the original message, including attachments. + + + + + + + + + +------=_NextPart_000_0001_01C54820.1A44D880 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + + + +
+ +

"Index Scan using ix_tblviwauditcube_clientnum = +on tblviwauditcube  +(cost=3D0.00..35895.75 rows=3D303982 width=3D708) (actual = +time=3D0.145..1320.432 +rows=3D316490 loops=3D1)"

+ +

"  Index Cond: ((clientnum)::text =3D = +'MSI'::text)"

+ +

"Total runtime: 1501.028 = +ms"

+ +

 

+ +

Joel Fradkin

+ +
+ +

 

+ +
+ +

Wazagua, Inc.
+
2520 Trailmate Dr
+
Sarasota, Florida = +34243
+Tel.  941-753-7111 ext 305

+ +
+ +

 

+ +
+ +

jfradkin@wazagua.com
+www.wazagua.com
+Powered by Wazagua
+Providing you with the latest Web-based technology & advanced = +tools.
+© 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
+ This email message is for the use of the intended recipient(s) and = +may +contain confidential and privileged information.  Any unauthorized = +review, +use, disclosure or distribution is prohibited.  If you are not the +intended recipient, please contact the sender by reply email and delete = +and +destroy all copies of the original message, including = +attachments.

+ +
+ +

 

+ +
+ +


+
 

+ +

 

+ +
+ + + + + +------=_NextPart_000_0001_01C54820.1A44D880-- + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 20:34:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DB2A453373; + Sat, 23 Apr 2005 20:34:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17910-09; Sat, 23 Apr 2005 23:34:05 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 23E4353789; + Sat, 23 Apr 2005 20:34:01 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7275984; Sat, 23 Apr 2005 16:36:01 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Greg Stark +Subject: Re: Bad n_distinct estimation; hacks suggested? +Date: Sat, 23 Apr 2005 16:39:11 -0700 +User-Agent: KMail/1.7.1 +Cc: Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> +In-Reply-To: <8764ydapky.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504231639.11897.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/656 +X-Sequence-Number: 12053 + +Greg, + +> I looked into this a while back when we were talking about changing the +> sampling method. The conclusions were discouraging. Fundamentally, using +> constant sized samples of data for n_distinct is bogus. Constant sized +> samples only work for things like the histograms that can be analyzed +> through standard statistics population sampling which depends on the law of +> large numbers. + +Well, unusual distributions are certainly tough. But I think the problem +exists even for relatively well-distributed populations. Part of it is, I +believe, the formula we are using: + +n*d / (n - f1 + f1*n/N) + +This is an estimation formula from Haas and Stokes in IBM Research Report RJ +10025, and is called the DUJ1 formula. +(http://www.almaden.ibm.com/cs/people/peterh/jasa3rj.pdf) It appears to +suck. For example, take my table: + +rows: 26million (N) +distinct values: 3.4million + +I took a random sample of 1000 rows (n) from that table. It contained: +968 values that occurred only once (f1) +981 distinct values (d) + +Any human being looking at that sample would assume a large number of distinct +values; after all, 96.8% of the values occurred only once. But the formula +gives us: + +1000*981 / ( 1000 - 968 + ( 968 * 1000/26000000 ) ) = 30620 + +This is obviously dramatically wrong, by a factor of 100. The math gets worse +as the sample size goes down: + +Sample 250, 248 distinct values, 246 unique values: + +250*248 / ( 250 - 246 + ( 246 * 250 / 26000000 ) ) = 15490 + +Even in a case with an ovewhelming majority of unique values, the formula gets +it wrong: + +999 unque values in sample +998 appearing only once: + +1000*999 / ( 1000 - 998 + ( 998 * 1000 / 26000000 ) ) = 490093 + +This means that, with a sample size of 1000 a table of 26million rows cannot +ever have with this formula more than half a million distinct values, unless +the column is a unique column. + +Overall, our formula is inherently conservative of n_distinct. That is, I +believe that it is actually computing the *smallest* number of distinct +values which would reasonably produce the given sample, rather than the +*median* one. This is contrary to the notes in analyze.c, which seem to +think that we're *overestimating* n_distinct. + +This formula appears broken everywhere: + +Table: 969000 rows +Distinct values: 374000 +Sample Size: 1000 +Unique values in sample: 938 +Values appearing only once: 918 + +1000*938 / ( 1000 - 918 + ( 918 * 1000 / 969000 ) ) = 11308 + +Again, too small by a factor of 20x. + +This is so broken, in fact, that I'm wondering if we've read the paper right? +I've perused the paper on almaden, and the DUJ1 formula appears considerably +more complex than the formula we're using. + +Can someone whose math is more recent than calculus in 1989 take a look at +that paper, and look at the formula toward the bottom of page 10, and see if +we are correctly interpreting it? I'm particularly confused as to what "q" +and "d-sub-n" represent. Thanks! + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Apr 23 21:59:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 893FE537EA; + Sat, 23 Apr 2005 21:33:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34686-07; Sun, 24 Apr 2005 00:33:13 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A1B5537E2; + Sat, 23 Apr 2005 21:33:12 -0300 (ADT) +Received: from dunslane.net (localhost.localdomain [127.0.0.1]) + (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j3NNiSM19099; + Sat, 23 Apr 2005 18:44:28 -0500 +Received: from 24.211.165.134 + (SquirrelMail authenticated user andrew@dunslane.net) + by www.dunslane.net with HTTP; Sat, 23 Apr 2005 18:44:28 -0500 (CDT) +Message-ID: <1963.24.211.165.134.1114299868.squirrel@www.dunslane.net> +Date: Sat, 23 Apr 2005 18:44:28 -0500 (CDT) +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +From: "Andrew Dunstan" +To: +In-Reply-To: <200504231639.11897.josh@agliodbs.com> +References: <200504231639.11897.josh@agliodbs.com> +X-Priority: 3 +Importance: Normal +X-MSMail-Priority: Normal +Cc: , , + , +X-Mailer: SquirrelMail (version 1.2.5) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/659 +X-Sequence-Number: 12056 + +Josh Berkus said: +> +> +> Well, unusual distributions are certainly tough. But I think the +> problem exists even for relatively well-distributed populations. +> Part of it is, I believe, the formula we are using: +> +> n*d / (n - f1 + f1*n/N) +> +[snip] +> +> This is so broken, in fact, that I'm wondering if we've read the paper +> right? I've perused the paper on almaden, and the DUJ1 formula +> appears considerably more complex than the formula we're using. +> +> Can someone whose math is more recent than calculus in 1989 take a look +> at that paper, and look at the formula toward the bottom of page 10, +> and see if we are correctly interpreting it? I'm particularly +> confused as to what "q" and "d-sub-n" represent. Thanks! +> + +Math not too recent ... + +I quickly read the paper and independently came up with the same formula you +say above we are applying. The formula is on the page that is numbered 6, +although it's the tenth page in the PDF. + +q = n/N = ratio of sample size to population size +d_sub_n = d = number of distinct classes in sample + +cheers + +andrew + + + + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 20:48:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D3B0953716; + Sat, 23 Apr 2005 20:48:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22009-06; Sat, 23 Apr 2005 23:48:06 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 863E15379A; + Sat, 23 Apr 2005 20:48:04 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7276032; Sat, 23 Apr 2005 16:50:06 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: Bad n_distinct estimation; hacks suggested? +Date: Sat, 23 Apr 2005 16:53:16 -0700 +User-Agent: KMail/1.7.1 +References: <200504191209.05181.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> +In-Reply-To: <200504231639.11897.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200504231653.16317.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/657 +X-Sequence-Number: 12054 + +People, + +> Can someone whose math is more recent than calculus in 1989 take a look at +> that paper, and look at the formula toward the bottom of page 10, and see +> if we are correctly interpreting it? =A0 =A0I'm particularly confused as = +to +> what "q" and "d-sub-n" represent. =A0Thanks! + +Actually, I managed to solve for these and it appears we are using the form= +ula=20 +correctly. It's just a bad formula. + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Apr 23 21:10:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DB2F537BC + for ; + Sat, 23 Apr 2005 21:10:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31251-04 + for ; + Sun, 24 Apr 2005 00:10:04 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B9AAB537B0 + for ; + Sat, 23 Apr 2005 21:10:03 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3O0A5ff024113; + Sat, 23 Apr 2005 20:10:05 -0400 (EDT) +To: John A Meinel +Cc: "Shoaib Burq (VPAC)" , + Russell Smith , Jeff , + pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +In-reply-to: <4267C34D.9010705@arbash-meinel.com> +References: + <4267C34D.9010705@arbash-meinel.com> +Comments: In-reply-to John A Meinel + message dated "Thu, 21 Apr 2005 10:14:21 -0500" +Date: Sat, 23 Apr 2005 20:10:05 -0400 +Message-ID: <24112.1114301405@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/658 +X-Sequence-Number: 12055 + +John A Meinel writes: +> Actually, you probably don't want enable_seqscan=off, you should try: +> SET enable_nestloop TO off. +> The problem is that it is estimating there will only be 44 rows, but in +> reality there are 13M rows. It almost definitely should be doing a +> seqscan with a sort and merge join. + +Not nestloops anyway. + +> I don't understand how postgres could get the number of rows that wrong. + +No stats, or out-of-date stats is the most likely bet. + +> I can't figure out exactly what is where from the formatting, but the query that seems misestimated is: +> -> Index Scan using "IX_ClimateId" on "ClimateChangeModel40" (cost=0.00..1063711.75 rows=265528 width=20) (actual time=28.311..17212.703 rows=13276368 loops=1) +> Index Cond: ("outer"."ClimateId" = "ClimateChangeModel40"."ClimateId") + +Yeah, that's what jumped out at me too. It's not the full explanation +for the join number being so far off, but this one at least you have a +chance to fix by updating the stats on ClimateChangeModel40. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Apr 23 23:31:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C522536D1 + for ; + Sat, 23 Apr 2005 23:31:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55114-02 + for ; + Sun, 24 Apr 2005 02:31:15 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id AF3855323A + for ; + Sat, 23 Apr 2005 23:31:10 -0300 (ADT) +Received: (qmail 7454 invoked from network); 24 Apr 2005 02:31:14 -0000 +Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) + (209.149.56.238) by 0 with SMTP; 24 Apr 2005 02:31:14 -0000 +In-Reply-To: <6865.1113600214@sss.pgh.pa.us> +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> + <6865.1113600214@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=WINDOWS-1252; format=flowed +Message-Id: +Content-Transfer-Encoding: quoted-printable +Cc: PgSQL - Performance +From: Thomas F.O'Connell +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +Date: Sat, 23 Apr 2005 21:31:13 -0500 +To: Tom Lane +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/660 +X-Sequence-Number: 12057 + +Okay. I updated my benchmark page with new numbers, which are the=20 +result of extensive pgbench usage over this past week. In fact, I=20 +modified pgbench (for both of the latest version of postgres) to be=20 +able to accept multiple iterations as an argument and report the=20 +results of each iteration as well as a summary of mean tps at the end.=20= + +The modifications of the source are included on the new page, and I'd=20 +be happy to submit them as patches if this seems like useful=20 +functionality to the developers and the community. I find it nicer to=20 +have pgbench be the authoritative source of iterative results rather=20 +than a wrapper script, but it'd be nice to have an extra set of eyes=20 +guarantee that I've included in the loop everything that ought to be=20 +there. + +A couple of notes: + +* There was some interesting oscillation behavior in both version of=20 +postgres that occurred with 25 clients and 1000 transactions at a=20 +scaling factor of 100. This was repeatable with the distribution=20 +version of pgbench run iteratively from the command line. I'm not sure=20= + +how to explain this. + +* I'm not really sure why the single client run at 1000 transactions=20 +seemed so much slower than all successive iterations, including single=20= + +client with 10000 transactions at a scaling factor of 100. It's=20 +possible that I should be concerned about how throughput was so much=20 +higher for 10000 transactions. + +Anyway, the code changes, the configuration details, and the results=20 +are all posted here: + +http://www.sitening.com/pgbench.html + +Once again, I'd be curious to get feedback from developers and the=20 +community about the results, and I'm happy to answer any questions. + +-tfo + +-- +Thomas F. O'Connell +Co-Founder, Information Architect +Sitening, LLC + +Strategic Open Source: Open Your i=99 + +http://www.sitening.com/ +110 30th Avenue North, Suite 6 +Nashville, TN 37203-6320 +615-260-0005 + +On Apr 15, 2005, at 4:23 PM, Tom Lane wrote: + +> "Thomas F.O'Connell" writes: +>> http://www.sitening.com/pgbench.html +> +> You need to run *many* more transactions than that to get pgbench +> numbers that aren't mostly noise. In my experience 1000 transactions +> per client is a rock-bottom minimum to get repeatable numbers; 10000=20= + +> per +> is better. +> +> Also, in any run where #clients >=3D scaling factor, what you're=20 +> measuring +> is primarily contention to update the "branches" rows. Which is not +> necessarily a bad thing to check, but it's generally not the most +> interesting performance domain (if your app is like that you need to +> redesign the app...) +> +>> To me, it looks like basic transactional performance is modestly +>> improved at 8.0 across a variety of metrics. +> +> That's what I would expect --- we usually do some performance work in +> every release cycle, but there was not a huge amount of it for 8.0. +> +> However, these numbers don't prove much either way. +> +> regards, tom lane + + +From pgsql-performance-owner@postgresql.org Sat Apr 23 23:33:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4AFA653689 + for ; + Sat, 23 Apr 2005 23:33:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55114-06 + for ; + Sun, 24 Apr 2005 02:32:57 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id 696C8536C3 + for ; + Sat, 23 Apr 2005 23:32:56 -0300 (ADT) +Received: (qmail 8047 invoked from network); 24 Apr 2005 02:33:00 -0000 +Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) + (209.149.56.238) by 0 with SMTP; 24 Apr 2005 02:33:01 -0000 +In-Reply-To: <42603127.5070108@sfnet.cc> +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> + <42603127.5070108@sfnet.cc> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=WINDOWS-1252; format=flowed +Message-Id: +Content-Transfer-Encoding: quoted-printable +Cc: PgSQL - Performance +From: Thomas F.O'Connell +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +Date: Sat, 23 Apr 2005 21:33:00 -0500 +To: Steve Poe +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/661 +X-Sequence-Number: 12058 + +Steve, + +Per your and Tom's recommendations, I significantly increased the=20 +number of transactions used for testing. See my last post. + +The database will have pretty heavy mixed use, i.e., both reads and=20 +writes. + +I performed 32 iterations per scenario this go-round. + +I'll look into OSDB for further benchmarking. Thanks for the tip. + +Since pgbench is part of the postgres distribution and I had it at hand=20= + +and it seems to be somewhat widely referenced, I figured I go ahead and=20= + +post preliminary results from it. + +-tfo + +-- +Thomas F. O'Connell +Co-Founder, Information Architect +Sitening, LLC + +Strategic Open Source: Open Your i=99 + +http://www.sitening.com/ +110 30th Avenue North, Suite 6 +Nashville, TN 37203-6320 +615-260-0005 + +On Apr 15, 2005, at 4:24 PM, Steve Poe wrote: + +> Tom, +> +> People's opinions on pgbench may vary, so take what I say with a grain=20= + +> of salt. Here are my thoughts: +> +> 1) Test with no less than 200 transactions per client. I've heard with=20= + +> less than this, your results will vary too much with the direction of=20= + +> the wind blowing. A high enough value will help rule out some "noise"=20= + +> factor. If I am wrong, please let me know. +> +> +> 2) How is the database going to be used? What percentage will be=20 +> read/write if you had to guess? Pgbench is like a TPC-B with will help=20= + +> guage the potential throughput of your tps. However, it may not stress=20= + +> the server enough to help you make key performance changes. However,=20= + +> benchmarks are like statistics...full of lies . +> +> 3) Run not just a couple pgbench runs, but *many* (I do between 20-40=20= + +> runs) so you can rule out noise and guage improvement on median=20 +> results. +> +> 4) Find something that you test OLTP-type transactions. I used OSDB=20 +> since it is simple to implement and use. Although OSDL's OLTP testing=20= + +> will closer to reality. +> +> Steve Poe + + +From pgsql-performance-owner@postgresql.org Sun Apr 24 01:49:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B7DBB536CC; + Sun, 24 Apr 2005 01:49:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76635-06; Sun, 24 Apr 2005 04:49:13 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 57F1553596; + Sun, 24 Apr 2005 01:49:12 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3O4mxGl025383; + Sun, 24 Apr 2005 00:48:59 -0400 (EDT) +To: josh@agliodbs.com +Cc: Greg Stark , Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +In-reply-to: <200504231639.11897.josh@agliodbs.com> +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Sat, 23 Apr 2005 16:39:11 -0700" +Date: Sun, 24 Apr 2005 00:48:59 -0400 +Message-ID: <25382.1114318139@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/662 +X-Sequence-Number: 12059 + +Josh Berkus writes: +> Overall, our formula is inherently conservative of n_distinct. That is, I +> believe that it is actually computing the *smallest* number of distinct +> values which would reasonably produce the given sample, rather than the +> *median* one. This is contrary to the notes in analyze.c, which seem to +> think that we're *overestimating* n_distinct. + +Well, the notes are there because the early tests I ran on that formula +did show it overestimating n_distinct more often than not. Greg is +correct that this is inherently a hard problem :-( + +I have nothing against adopting a different formula, if you can find +something with a comparable amount of math behind it ... but I fear +it'd only shift the failure cases around. + + regards, tom lane + +From pgsql-odbc-owner@postgresql.org Sun Apr 24 04:15:16 2005 +X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BEAD55B8B; + Sun, 24 Apr 2005 04:15:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99138-03; Sun, 24 Apr 2005 07:15:09 +0000 (GMT) +Received: from fep01-app.kolumbus.fi (fep01-0.kolumbus.fi [193.229.0.41]) + by svr1.postgresql.org (Postfix) with ESMTP id C096555BED; + Sun, 24 Apr 2005 04:15:07 -0300 (ADT) +Received: from [192.168.1.103] (really [84.231.185.8]) + by fep01-app.kolumbus.fi with ESMTP + id <20050424071507.ZRPR20133.fep01-app.kolumbus.fi@[192.168.1.103]>; + Sun, 24 Apr 2005 10:15:07 +0300 +Message-ID: <426B4777.9050501@kolumbus.fi> +Date: Sun, 24 Apr 2005 10:15:03 +0300 +From: Marko Ristola +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.6) Gecko/20050324 Debian/1.7.6-1 +X-Accept-Language: en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: "'Mohan, Ross'" , pgsql-odbc@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +References: <001801c5480f$54573d80$797ba8c0@jfradkin> +In-Reply-To: <001801c5480f$54573d80$797ba8c0@jfradkin> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.336 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/66 +X-Sequence-Number: 5225 + + +Here is, how you can receive all one billion rows with +pieces of 2048 rows. This changes PostgreSQL and ODBC behaviour: + +Change ODBC data source configuration in the following way: + +Fetch = 2048 +UseDeclareFetch = 1 + +It does not create core dumps with 32 bit computers with billions of rows! +This is a bit slower than fetching all rows at once. Scalability means +sometimes +a bit less speed :( + +With UseDeclareFetch=1 you might get even 150 thousands rows per second. +With UseDeclareFetch=0 the backend might be able to send about 200 +thousands rows per +second. + +So, these high numbers come, if all the results are already in memory, +and no disc +accesses are needed. These are about the peak speeds with VARCHAR, +without Unicode, +with Athlon64 home computer. + +With sequential disc scan, more typical fetching +speed is about 50-100 thousands rows per second. + +PostgreSQL ODBC row fetching speed is very good. +Perhaps with better discs, with RAID10, the current upper limit about +200 thousands +rows per second could be achieved?? + +So the in memory examples show, that the hard disc is normally +the bottleneck. It is on the server side. +My experiments are done in Linux. In Windows, the speed might be a bit +different +by a constant factor (algorithmically). + +These speeds depend on very many factos even on sequential scan. +ODBC speed is affected by the number of columns fetched and the types of +the columns. +Integers are processed faster than textual or date columns. + +The network latency is decreased with UseDeclareFetc=1 by increasing the +Fetch=2048 +parameter: With Fetch=1 you get a bad performance with lots of rows, but +if you fetch +more data from the server once per 2048 rows, the network latency +affects only once for +the 2048 row block. + +Regards, +Marko Ristola + +Joel Fradkin wrote: + +>Hate to be dumb, but unfortunately I am. +> +>Could you give me an idea what I should be using, or is there a good +>resource for me to check out. +>I have been spending so much time with config and moving data, converting +>etc, I never looked at the odbc settings (didn't even think about it until +>Josh brought it up). I did ask him for his advice, but would love a second +>opinion. +> +>Our data is a bit of a mixture, some records have text items most are +>varchars and integers with a bit of Booleans mixed in. +> +>I am running 8.0.2 so not sure if the protocol is ODBC or Postgres? +> +>Thanks for responding I appreciate any help +> +>Joel Fradkin +> +>-----Original Message----- +>From: pgsql-odbc-owner@postgresql.org +>[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mohan, Ross +>Sent: Thursday, April 21, 2005 10:01 AM +>To: pgsql-odbc@postgresql.org +>Subject: Re: [ODBC] [PERFORM] Joel's Performance Issues WAS : Opteron vs +>Xeon +> +>Joel, thanks. A couple of things jump out there for +>me, not a problem for a routine ODBC connection, but +>perhaps in the "lotsa stuff" context of your current +>explorations, it might be relevant? +> +>I am completely shooting from the hip, here, but...if +>it were my goose to cook, I'd be investigating +> +>Session("StringConn") = +>"DRIVER={PostgreSQL};DATABASE=wazagua;SERVER=192.168.123.252;PORT=5432;UID=; +>PWD=;ReadOnly=0;Protocol=6.4; +> +>|| Protocol? Is this related to version? is the driver waaaay old? +> +> +>FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0; +>ShowSystemTables=0;ConnSettings=;Fetch=100; +> +>|| Fetch great for OLTP, lousy for batch? +> +> +>Socket=4096;UnknownSizes=0;MaxVarcharSize=254;MaxLongVarcharSize=8190; +> +>|| what ARE the datatypes and sizes in your particular case? +> +>Debug=0; +> +>|| a run with debug=1 probably would spit up something interesting.... +> +>CommLog=0;Optimizer=1; +> +>|| Optimizer? that's a new one on me.... +> +>Ksqo=1;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAs +>Char=1;Parse=0;CancelAsFreeStmt=;ExtraSysTablePrefixes=dd_;LFConversion=1;Up +>datableCursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinar +>y=0;UseServerSidePrepare=0" +> +> +>|| that's about all I can see, prima facie. I'll be very curious to know +>if ODBC is +> any part of your performance equation. +> +> +>HTH, +> +>Ross +> +>-----Original Message----- +>From: Joel Fradkin [mailto:jfradkin@wazagua.com] +>Sent: Thursday, April 21, 2005 10:54 AM +>To: Mohan, Ross +>Cc: pgsql-odbc@postgresql.org; PostgreSQL Perform +>Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +> +> +>Here is the connect string I am using. +>It could be horrid as I cut it from ODBC program. +> +>Session("StringConn") = +>"DRIVER={PostgreSQL};DATABASE=wazagua;SERVER=192.168.123.252;PORT=5432;UID=; +>PWD=;ReadOnly=0;Protocol=6.4;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0; +>ShowSystemTables=0;ConnSettings=;Fetch=100;Socket=4096;UnknownSizes=0;MaxVar +>charSize=254;MaxLongVarcharSize=8190;Debug=0;CommLog=0;Optimizer=1;Ksqo=1;Us +>eDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Pa +>rse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;LFConversion=1;UpdatableC +>ursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=0;UseS +>erverSidePrepare=0" +> +>Joel Fradkin +> +> +>-----Original Message----- +>From: Mohan, Ross [mailto:RMohan@arbinet.com] +>Sent: Thursday, April 21, 2005 9:42 AM +>To: jfradkin@wazagua.com +>Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +> +>FWIW, ODBC has variables to tweak, as well. fetch/buffer sizes, and the +>like. +> +>Maybe one of the ODBC cognoscenti here can chime in more concretely.... +> +> +> +> +> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 7: don't forget to increase your free space map settings +> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 4: Don't 'kill -9' the postmaster +> +> + + +From pgsql-performance-owner@postgresql.org Sun Apr 24 14:09:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8578C540C1; + Sun, 24 Apr 2005 14:09:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14117-04; Sun, 24 Apr 2005 17:09:19 +0000 (GMT) +Received: from fep31-app.kolumbus.fi (fep31-0.kolumbus.fi [193.229.0.35]) + by svr1.postgresql.org (Postfix) with ESMTP id A8C04541F6; + Sun, 24 Apr 2005 14:09:17 -0300 (ADT) +Received: from [192.168.1.3] (really [84.231.185.8]) + by fep31-app.kolumbus.fi with ESMTP + id <20050424170916.KHKK7490.fep31-app.kolumbus.fi@[192.168.1.3]>; + Sun, 24 Apr 2005 20:09:16 +0300 +Message-ID: <426BD2BB.70903@kolumbus.fi> +Date: Sun, 24 Apr 2005 20:09:15 +0300 +From: Marko Ristola +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.6) Gecko/20050324 Debian/1.7.6-1 +X-Accept-Language: en +MIME-Version: 1.0 +To: Tom Lane +Cc: josh@agliodbs.com, Greg Stark , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> + <25382.1114318139@sss.pgh.pa.us> +In-Reply-To: <25382.1114318139@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.329 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/664 +X-Sequence-Number: 12061 + + +Here is my opinion. +I hope this helps. + +Maybe there is no one good formula: + +On boolean type, there are at most 3 distinct values. +There is an upper bound for fornames in one country. +There is an upper bound for last names in one country. +There is a fixed number of states and postal codes in one country. + +On the other hand, with timestamp, every value could be distinct. +A primary key with only one column has only distinct values. +If the integer column refers with a foreign key into another table's +only primary key, we could take advantage of that knolege. +A column with a unique index has only distinct values. + +First ones are for classifying and the second ones measure continuous +or discrete time or something like the time. + +The upper bound for classifying might be 3 (boolean), or it might be +one million. The properties of the distribution might be hard to guess. + +Here is one way: + +1. Find out the number of distinct values for 500 rows. +2. Try to guess, how many distinct values are for 1000 rows. + Find out the real number of distinct values for 1000 rows. +3. If the guess and the reality are 50% wrong, do the iteration for +2x1000 rows. +Iterate using a power of two to increase the samples, until you trust the +estimate enough. + +So, in the phase two, you could try to guess with two distinct formulas: +One for the classifying target (boolean columns hit there). +Another one for the timestamp and numerical values. + +If there are one million classifications on one column, how you +can find it out, by other means than checking at least two million +rows? + +This means, that the user should have a possibility to tell the lower +bound for the number of rows for sampling. + + +Regards, +Marko Ristola + +Tom Lane wrote: + +>Josh Berkus writes: +> +> +>>Overall, our formula is inherently conservative of n_distinct. That is, I +>>believe that it is actually computing the *smallest* number of distinct +>>values which would reasonably produce the given sample, rather than the +>>*median* one. This is contrary to the notes in analyze.c, which seem to +>>think that we're *overestimating* n_distinct. +>> +>> +> +>Well, the notes are there because the early tests I ran on that formula +>did show it overestimating n_distinct more often than not. Greg is +>correct that this is inherently a hard problem :-( +> +>I have nothing against adopting a different formula, if you can find +>something with a comparable amount of math behind it ... but I fear +>it'd only shift the failure cases around. +> +> regards, tom lane +> +>---------------------------(end of broadcast)--------------------------- +>TIP 9: the planner will ignore your desire to choose an index scan if your +> joining column's datatypes do not match +> +> + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 20:08:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 50136540DD; + Sun, 24 Apr 2005 14:58:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26878-06; Sun, 24 Apr 2005 17:58:34 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id D22A054304; + Sun, 24 Apr 2005 14:58:32 -0300 (ADT) +Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com + [24.211.165.134]) (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j3OH9gG12483; + Sun, 24 Apr 2005 12:09:43 -0500 +Message-ID: <426BDE32.4070004@dunslane.net> +Date: Sun, 24 Apr 2005 13:58:10 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.7) Gecko/20050417 Fedora/1.7.7-1.3.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: josh@agliodbs.com, Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> + <25382.1114318139@sss.pgh.pa.us> +In-Reply-To: <25382.1114318139@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/712 +X-Sequence-Number: 12109 + + + +Tom Lane wrote: + +>Josh Berkus writes: +> +> +>>Overall, our formula is inherently conservative of n_distinct. That is, I +>>believe that it is actually computing the *smallest* number of distinct +>>values which would reasonably produce the given sample, rather than the +>>*median* one. This is contrary to the notes in analyze.c, which seem to +>>think that we're *overestimating* n_distinct. +>> +>> +> +>Well, the notes are there because the early tests I ran on that formula +>did show it overestimating n_distinct more often than not. Greg is +>correct that this is inherently a hard problem :-( +> +>I have nothing against adopting a different formula, if you can find +>something with a comparable amount of math behind it ... but I fear +>it'd only shift the failure cases around. +> +> +> +> + +The math in the paper does not seem to look at very low levels of q (= +sample to pop ratio). + +The formula has a range of [d,N]. It appears intuitively (i.e. I have +not done any analysis) that at very low levels of q, as f1 moves down +from n, the formula moves down from N towards d very rapidly. I did a +test based on the l_comments field in a TPC lineitems table. The test +set has N = 6001215, D = 2921877. In my random sample of 1000 I got d = +976 and f1 = 961, for a DUJ1 figure of 24923, which is too low by 2 +orders of magnitude. + +I wonder if this paper has anything that might help: +http://www.stat.washington.edu/www/research/reports/1999/tr355.ps - if I +were more of a statistician I might be able to answer :-) + +cheers + +andrew + + + +From pgsql-performance-owner@postgresql.org Sun Apr 24 15:31:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B9D3C53BA1; + Sun, 24 Apr 2005 15:31:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42529-01; Sun, 24 Apr 2005 18:31:34 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id AA18353B16; + Sun, 24 Apr 2005 15:31:30 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7278925; Sun, 24 Apr 2005 11:33:28 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Andrew Dunstan +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Sun, 24 Apr 2005 11:30:50 -0700 +User-Agent: KMail/1.6.2 +Cc: gsql-perform , + pgsql-hackers@postgresql.org +References: <200504191209.05181.josh@agliodbs.com> + <25382.1114318139@sss.pgh.pa.us> <426BDE32.4070004@dunslane.net> +In-Reply-To: <426BDE32.4070004@dunslane.net> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504241130.50218.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/665 +X-Sequence-Number: 12062 + +Andrew, + +> The math in the paper does not seem to look at very low levels of q (= +> sample to pop ratio). + +Yes, I think that's the failing. Mind you, I did more testing and found out +that for D/N ratios of 0.1 to 0.3, the formula only works within 5x accuracy +(which I would consider acceptable) with a sample size of 25% or more (which +is infeasable in any large table). The formula does work for populations +where D/N is much lower, say 0.01. So overall it seems to only work for 1/4 +of cases; those where n/N is large and D/N is low. And, annoyingly, that's +probably the population where accurate estimation is least crucial, as it +consists mostly of small tables. + +I've just developed (not original, probably, but original to *me*) a formula +that works on populations where n/N is very small and D/N is moderate (i.e. +0.1 to 0.4): + +N * (d/n)^(sqrt(N/n)) + +However, I've tested it only on (n/N < 0.005 and D/N > 0.1 and D/N < 0.4) +populations, and only 3 of them to boot. I'd appreciate other people trying +it on their own data populations, particularly very different ones, like D/N +> 0.7 or D/N < 0.01. + +Further, as Andrew points out we presumably do page sampling rather than +purely random sampling so I should probably read the paper he referenced. +Working on it now .... + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sun Apr 24 16:09:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CF365372F; + Sun, 24 Apr 2005 16:09:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55256-03; Sun, 24 Apr 2005 19:08:58 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id D5D2B53ED8; + Sun, 24 Apr 2005 16:08:53 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7279084; Sun, 24 Apr 2005 12:10:52 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Andrew Dunstan +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Sun, 24 Apr 2005 12:08:15 -0700 +User-Agent: KMail/1.6.2 +Cc: Tom Lane , Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +References: <200504191209.05181.josh@agliodbs.com> + <25382.1114318139@sss.pgh.pa.us> <426BDE32.4070004@dunslane.net> +In-Reply-To: <426BDE32.4070004@dunslane.net> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200504241208.15437.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/666 +X-Sequence-Number: 12063 + +Folks, + +> I wonder if this paper has anything that might help: +> http://www.stat.washington.edu/www/research/reports/1999/tr355.ps - if I +> were more of a statistician I might be able to answer :-) + +Actually, that paper looks *really* promising. Does anyone here have enough +math to solve for D(sub)Md on page 6? I'd like to test it on samples of < +0.01%. + +Tom, how does our heuristic sampling work? Is it pure random sampling, or +page sampling? + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sun Apr 24 19:01:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 49F1F53789 + for ; + Sun, 24 Apr 2005 19:01:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00867-02 + for ; + Sun, 24 Apr 2005 22:01:47 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 1997853D7B + for ; + Sun, 24 Apr 2005 19:01:45 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id D7D6F1555E; Sun, 24 Apr 2005 17:01:46 -0500 (CDT) +Date: Sun, 24 Apr 2005 17:01:46 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Dave Held , + pgsql-performance@postgresql.org +Subject: Re: Sort and index +Message-ID: <20050424220146.GN58835@decibel.org> +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184B6@asg002.asg.local> + <20050420004234.GX58835@decibel.org> + <19631.1113966086@sss.pgh.pa.us> + <20050420034041.GC58835@decibel.org> + <20050423015404.GV58835@decibel.org> + <4269.1114222086@sss.pgh.pa.us> + <20050423030002.GY58835@decibel.org> + <6536.1114232440@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <6536.1114232440@sss.pgh.pa.us> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/667 +X-Sequence-Number: 12064 + +On Sat, Apr 23, 2005 at 01:00:40AM -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> >> Feel free to propose better cost equations. +> +> > Where would I look in code to see what's used now? +> +> All the gold is hidden in src/backend/optimizer/path/costsize.c. +> +> regards, tom lane + +After setting up a second test that orders the table by a highly +non-correlated column, I think I've found part of the problem. The +estimated index scan cost for (project_id, id, date) is +0.00..100117429.34 while the estimate for work_units is +0.00..103168408.62; almost no difference, even though project_id +correlation is .657 while work_units correlation is .116. This is with +random_page_cost set to 1.1; if I set it much higher I can't force the +index scan (BTW, would it make more sense to set the cost of a disable +seqscan to either pages or tuples * disable_cost?), but even with only a +10% overhead on random page fetches it seems logical that the two +estimates should be much farther apart. If you look at the results of +the initial run (http://stats.distributed.net/~decibel/timing.log), +you'll see that the cost of the index scan is way overestimated. Looking +at the code, the runcost is calculated as + + run_cost += max_IO_cost + csquared * (min_IO_cost - max_IO_cost); + +where csquared is indexCorrelation^2. Why is indexCorrelation squared? +The comments say a linear interpolation between min_IO and max_IO is +used, but ISTM that if it was linear then instead of csquared, +indexCorrelation would just be used. + +By the way, I'm running a test for ordering by work_units right now, and +I included code to allocate and zero 3.3G of memory (out of 4G) between +steps to clear the kernel buffers. This brought the seqscan times up to +~6800 seconds, so it seems there was in fact buffering going on in the +first test. The second test has been running an index scan for over 14 +hours now, so clearly a seqscan+sort is the way to go for a highly +uncorrelated index (at least one that won't fit in +effective_cache_size). +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Mon Apr 25 00:14:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C5DBB53A13 + for ; + Mon, 25 Apr 2005 00:14:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70918-03 + for ; + Mon, 25 Apr 2005 03:14:36 +0000 (GMT) +Received: from orthus.host4u.net (orthus.host4u.net [209.150.128.160]) + by svr1.postgresql.org (Postfix) with ESMTP id D7B5F539BE + for ; + Mon, 25 Apr 2005 00:14:24 -0300 (ADT) +Received: from [192.168.1.100] (69-175-234-81.vnnyca.adelphia.net + [69.175.234.81]) + by orthus.host4u.net (8.11.6/8.11.6) with ESMTP id j3P3E3g28609; + Sun, 24 Apr 2005 22:14:08 -0500 +In-Reply-To: <14610.1114285856@sss.pgh.pa.us> +References: <6f4567d4e64297b356e2d71ec392cdae@richardplotkin.com> + <4574.1114030270@sss.pgh.pa.us> + <9c5b2bf6a0f5a0bc0abeb6b6c5cf7973@richardplotkin.com> + <2a9467bc6e6dab5d997427c4ef6158e3@richardplotkin.com> + <12016.1114279585@sss.pgh.pa.us> + + <12135.1114280225@sss.pgh.pa.us> + <31935aa56e9539c5648cb09e78152c03@richardplotkin.com> + <14610.1114285856@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <2dc4db3fb0cb69c0dec1440acd5c1ceb@richardplotkin.com> +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Richard Plotkin +Subject: Re: Disk filling, CPU filling, renegade inserts and deletes? +Date: Sun, 24 Apr 2005 20:13:47 -0700 +To: Tom Lane +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/668 +X-Sequence-Number: 12065 + +Hi Tom, + +Thanks! That's exactly what it was. There was a discrepancy in the +data that turned this into an endless loop. Everything has been +running smoothly since I made a change. + +Thanks so much, +Richard + +On Apr 23, 2005, at 12:50 PM, Tom Lane wrote: + +> Richard Plotkin writes: +>> Thanks for your responses this morning. I did the select relname, and +>> it returned 0 rows. I do have one function that creates a temp table +>> and fills it within the same transaction. I'm pasting it below. +>> Perhaps the "ON COMMIT DROP" is causing problems, and I need to drop +>> the table at the end of the function instead of using ON COMMIT DROP? +> +> Well, I think we can conclude that the function is pushing way more +> data into the temp table than you expect. I am wondering if that loop +> in the middle of the function is turning into an infinite loop --- +> could +> it be finding some sort of cycle in your page data? You might want to +> add some RAISE NOTICE commands to the loop so you can track what it's +> doing. +> +> regards, tom lane +> + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 01:59:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 362D85362D + for ; + Mon, 25 Apr 2005 01:59:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90212-10 + for ; + Mon, 25 Apr 2005 04:59:38 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 04CA0539EB + for ; + Mon, 25 Apr 2005 01:59:37 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3P4xRVO010258; + Mon, 25 Apr 2005 00:59:28 -0400 (EDT) +To: Josh Berkus +Cc: Manfred Koizar , + Andrew Dunstan , Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +In-reply-to: <200504241208.15437.josh@agliodbs.com> +References: <200504191209.05181.josh@agliodbs.com> + <25382.1114318139@sss.pgh.pa.us> <426BDE32.4070004@dunslane.net> + <200504241208.15437.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Sun, 24 Apr 2005 12:08:15 -0700" +Date: Mon, 25 Apr 2005 00:59:27 -0400 +Message-ID: <10257.1114405167@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/669 +X-Sequence-Number: 12066 + +Josh Berkus writes: +> Tom, how does our heuristic sampling work? Is it pure random sampling, or +> page sampling? + +Manfred probably remembers better than I do, but I think the idea is +to approximate pure random sampling as best we can without actually +examining every page of the table. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 25 04:01:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 912E0545B5 + for ; + Mon, 25 Apr 2005 04:01:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16631-04 + for ; + Mon, 25 Apr 2005 07:01:04 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C4BF54553 + for ; + Mon, 25 Apr 2005 04:00:43 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Mon, 25 Apr 2005 00:03:47 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Mon, 25 Apr 2005 00:03:45 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005042500034527372 + for ; + Mon, 25 Apr 2005 00:03:45 -0700 +X-ASG-Debug-ID: 1114412440-5962-0-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail2 (mail2.hq.corp [192.168.160.6]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 45575202C5C5 + for ; + Mon, 25 Apr 2005 00:00:40 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Mon, 25 Apr 2005 00:01:40 -0700 +Message-ID: <426C9508.8030902@sfnet.cc> +Date: Sun, 24 Apr 2005 23:58:16 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Thomas F.O'Connell" +Cc: PgSQL - Performance +X-ASG-Orig-Subj: Re: [PERFORM] pgbench Comparison of 7.4.7 to 8.0.2 +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> + <6865.1113600214@sss.pgh.pa.us> + +In-Reply-To: +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 25 Apr 2005 07:01:40.0765 (UTC) + FILETIME=[A1A85CD0:01C54964] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.536 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5000] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.182 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/670 +X-Sequence-Number: 12067 + + >There was some interesting oscillation behavior in both version of +postgres that occurred with 25 >clients and 1000 transactions at a +scaling factor of 100. This was repeatable with the distribution + >version of pgbench run iteratively from the command line. I'm not sure +how to explain this. + +Tom, + +When you see these oscillations, do they occur after so many generated +results? Some oscillation is normal, in my opinion, from 10-15% of the +performance is noise-related. + +The key is to tune the server that you either 1) minimize the +oscillation and/or 2)increase your overall performance above the 10-15% +baseline, and 3) find out what the mean and standard deviation between +all your results. + +If your results are within that range, this maybe "normal". I follow-up +with you later on what I do. + +Steve Poe + + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 06:01:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0566D54EE4; + Mon, 25 Apr 2005 06:01:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34229-10; Mon, 25 Apr 2005 09:01:18 +0000 (GMT) +Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) + by svr1.postgresql.org (Postfix) with ESMTP id A457B54CF5; + Mon, 25 Apr 2005 06:01:08 -0300 (ADT) +Received: from modem-3531.lynx.dialup.pol.co.uk ([217.135.205.203] + helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DPzSa-0004tn-79; Mon, 25 Apr 2005 10:00:56 +0100 +Subject: Re: Bad n_distinct estimation; hacks suggested? +From: Simon Riggs +To: josh@agliodbs.com +Cc: Greg Stark , Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +In-Reply-To: <200504231639.11897.josh@agliodbs.com> +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 25 Apr 2005 09:57:47 +0100 +Message-Id: <1114419467.21529.210.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/671 +X-Sequence-Number: 12068 + +On Sat, 2005-04-23 at 16:39 -0700, Josh Berkus wrote: +Greg Stark wrote +> > I looked into this a while back when we were talking about changing the +> > sampling method. The conclusions were discouraging. Fundamentally, using +> > constant sized samples of data for n_distinct is bogus. Constant sized +> > samples only work for things like the histograms that can be analyzed +> > through standard statistics population sampling which depends on the law of +> > large numbers. + +ISTM Greg's comments are correct. There is no way to calculate this with +consistent accuracy when using a constant sized sample. (If it were, +then people wouldnt bother to hold large databases...) + +> Overall, our formula is inherently conservative of n_distinct. That is, I +> believe that it is actually computing the *smallest* number of distinct +> values which would reasonably produce the given sample, rather than the +> *median* one. This is contrary to the notes in analyze.c, which seem to +> think that we're *overestimating* n_distinct. + +The only information you can determine from a sample is the smallest +number of distinct values that would reasonably produce the given +sample. There is no meaningful concept of a median one... (You do have +an upper bound: the number of rows in the table, but I cannot see any +meaning from taking (Nrows+estimatedN_distinct)/2 ). + +Even if you use Zipf's Law to predict the frequency of occurrence, you'd +still need to estimate the parameters for the distribution. + +Most other RDBMS make optimizer statistics collection an unsampled +scan. Some offer this as one of their options, as well as the ability to +define the sample size in terms of fixed number of rows or fixed +proportion of the table. + +My suggested hack for PostgreSQL is to have an option to *not* sample, +just to scan the whole table and find n_distinct accurately. Then +anybody who doesn't like the estimated statistics has a clear path to +take. + +The problem of poorly derived base statistics is a difficult one. When +considering join estimates we already go to the trouble of including MFV +comparisons to ensure an upper bound of join selectivity is known. If +the statistics derived are themselves inaccurate the error propagation +touches every other calculation in the optimizer. GIGO. + +What price a single scan of a table, however large, when incorrect +statistics could force scans and sorts to occur when they aren't +actually needed ? + +Best Regards, Simon Riggs + + +From pgsql-odbc-owner@postgresql.org Mon Apr 25 10:10:03 2005 +X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E7E1536A9; + Mon, 25 Apr 2005 10:10:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78309-02; Mon, 25 Apr 2005 13:09:50 +0000 (GMT) +Received: from mta10.nationwireless.net (mta10.nationwireless.net + [63.163.128.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 12234536AD; + Mon, 25 Apr 2005 10:09:08 -0300 (ADT) +Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with + ESMTP + (SMTPD32-8.15) id ABDE26B30038; Mon, 25 Apr 2005 09:08:46 -0400 +From: "Joel Fradkin" +To: "'Marko Ristola'" +Cc: "'Mohan, Ross'" , + , , + "Steve Hatt" , +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +Date: Mon, 25 Apr 2005 09:08:52 -0400 +Message-ID: <000a01c54997$ed9f5a20$797ba8c0@jfradkin> +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 +In-Reply-To: <426B4777.9050501@kolumbus.fi> +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/69 +X-Sequence-Number: 5228 + +Thanks we will try that, we are working on a test suit for the way our = +app +gets data (ODBC). +we plan to include updates, inserts, and selects and all three at once = +with +a log of the results. +Then we should use a stress test tool to see how it works with multiple +instances (I used Microsoft's tool last time I did stress testing). + +Joel Fradkin +=20 +Wazagua, Inc. +2520 Trailmate Dr +Sarasota, Florida 34243 +Tel. 941-753-7111 ext 305 +=20 +jfradkin@wazagua.com +www.wazagua.com +Powered by Wazagua +Providing you with the latest Web-based technology & advanced tools. +C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc + This email message is for the use of the intended recipient(s) and may +contain confidential and privileged information. Any unauthorized = +review, +use, disclosure or distribution is prohibited. If you are not the = +intended +recipient, please contact the sender by reply email and delete and = +destroy +all copies of the original message, including attachments. +=20 + +=20 + +-----Original Message----- +From: Marko Ristola [mailto:marko.ristola@kolumbus.fi]=20 +Sent: Sunday, April 24, 2005 2:15 AM +To: Joel Fradkin +Cc: 'Mohan, Ross'; pgsql-odbc@postgresql.org; +pgsql-performance@postgresql.org +Subject: Re: [ODBC] [PERFORM] Joel's Performance Issues WAS : Opteron vs +Xeon + + +Here is, how you can receive all one billion rows with +pieces of 2048 rows. This changes PostgreSQL and ODBC behaviour: + +Change ODBC data source configuration in the following way: + +Fetch =3D 2048 +UseDeclareFetch =3D 1 + +It does not create core dumps with 32 bit computers with billions of = +rows! +This is a bit slower than fetching all rows at once. Scalability means=20 +sometimes +a bit less speed :( + +With UseDeclareFetch=3D1 you might get even 150 thousands rows per = +second. +With UseDeclareFetch=3D0 the backend might be able to send about 200=20 +thousands rows per +second. + +So, these high numbers come, if all the results are already in memory,=20 +and no disc +accesses are needed. These are about the peak speeds with VARCHAR,=20 +without Unicode, +with Athlon64 home computer. + +With sequential disc scan, more typical fetching +speed is about 50-100 thousands rows per second. + +PostgreSQL ODBC row fetching speed is very good. +Perhaps with better discs, with RAID10, the current upper limit about=20 +200 thousands +rows per second could be achieved?? + +So the in memory examples show, that the hard disc is normally +the bottleneck. It is on the server side. +My experiments are done in Linux. In Windows, the speed might be a bit=20 +different +by a constant factor (algorithmically). + +These speeds depend on very many factos even on sequential scan. +ODBC speed is affected by the number of columns fetched and the types of = + +the columns. +Integers are processed faster than textual or date columns. + +The network latency is decreased with UseDeclareFetc=3D1 by increasing = +the=20 +Fetch=3D2048 +parameter: With Fetch=3D1 you get a bad performance with lots of rows, = +but=20 +if you fetch +more data from the server once per 2048 rows, the network latency=20 +affects only once for +the 2048 row block. + +Regards, +Marko Ristola + +Joel Fradkin wrote: + +>Hate to be dumb, but unfortunately I am. +> +>Could you give me an idea what I should be using, or is there a good +>resource for me to check out. +>I have been spending so much time with config and moving data, = +converting +>etc, I never looked at the odbc settings (didn't even think about it = +until +>Josh brought it up). I did ask him for his advice, but would love a = +second +>opinion. +> +>Our data is a bit of a mixture, some records have text items most are +>varchars and integers with a bit of Booleans mixed in. +> +>I am running 8.0.2 so not sure if the protocol is ODBC or Postgres? +> +>Thanks for responding I appreciate any help=20 +> +>Joel Fradkin +>=20 +>-----Original Message----- +>From: pgsql-odbc-owner@postgresql.org +>[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mohan, Ross +>Sent: Thursday, April 21, 2005 10:01 AM +>To: pgsql-odbc@postgresql.org +>Subject: Re: [ODBC] [PERFORM] Joel's Performance Issues WAS : Opteron = +vs +>Xeon +> +>Joel, thanks. A couple of things jump out there for +>me, not a problem for a routine ODBC connection, but +>perhaps in the "lotsa stuff" context of your current +>explorations, it might be relevant? +> +>I am completely shooting from the hip, here, but...if +>it were my goose to cook, I'd be investigating +> +>Session("StringConn") =3D +>"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D +; +>PWD=3D;ReadOnly=3D0;Protocol=3D6.4; +> +>|| Protocol? Is this related to version? is the driver waaaay old? +> +> +>FakeOidIndex=3D0;ShowOidColumn=3D0;RowVersioning=3D0; +>ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100; +> +>|| Fetch great for OLTP, lousy for batch? +> +> +>Socket=3D4096;UnknownSizes=3D0;MaxVarcharSize=3D254;MaxLongVarcharSize=3D= +8190; +> +>|| what ARE the datatypes and sizes in your particular case?=20 +> +>Debug=3D0; +> +>|| a run with debug=3D1 probably would spit up something = +interesting.... +> +>CommLog=3D0;Optimizer=3D1; +> +>|| Optimizer? that's a new one on me.... +> +>Ksqo=3D1;UseDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar= +=3D0;BoolsA +s +>Char=3D1;Parse=3D0;CancelAsFreeStmt=3D;ExtraSysTablePrefixes=3Ddd_;LFCon= +version=3D1;U +p +>datableCursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAs= +LongVarBina +r +>y=3D0;UseServerSidePrepare=3D0" +> +> +>|| that's about all I can see, prima facie. I'll be very curious to = +know +>if ODBC is +> any part of your performance equation.=20 +> +> +>HTH,=20 +> +>Ross +> +>-----Original Message----- +>From: Joel Fradkin [mailto:jfradkin@wazagua.com]=20 +>Sent: Thursday, April 21, 2005 10:54 AM +>To: Mohan, Ross +>Cc: pgsql-odbc@postgresql.org; PostgreSQL Perform +>Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +> +> +>Here is the connect string I am using. +>It could be horrid as I cut it from ODBC program. +> +>Session("StringConn") =3D +>"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D +; +>PWD=3D;ReadOnly=3D0;Protocol=3D6.4;FakeOidIndex=3D0;ShowOidColumn=3D0;Ro= +wVersioning=3D0 +; +>ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100;Socket=3D4096;UnknownSi= +zes=3D0;MaxVa +r +>charSize=3D254;MaxLongVarcharSize=3D8190;Debug=3D0;CommLog=3D0;Optimizer= +=3D1;Ksqo=3D1;U +s +>eDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar=3D0;BoolsA= +sChar=3D1;P +a +>rse=3D0;CancelAsFreeStmt=3D0;ExtraSysTablePrefixes=3Ddd_;LFConversion=3D= +1;Updatable +C +>ursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongVarB= +inary=3D0;Use +S +>erverSidePrepare=3D0" +> +>Joel Fradkin +>=20 +> +>-----Original Message----- +>From: Mohan, Ross [mailto:RMohan@arbinet.com]=20 +>Sent: Thursday, April 21, 2005 9:42 AM +>To: jfradkin@wazagua.com +>Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +> +>FWIW, ODBC has variables to tweak, as well. fetch/buffer sizes, and the +>like.=20 +> +>Maybe one of the ODBC cognoscenti here can chime in more concretely.... +> +> +> +> +> +> +>---------------------------(end of = +broadcast)--------------------------- +>TIP 7: don't forget to increase your free space map settings +> +> +>---------------------------(end of = +broadcast)--------------------------- +>TIP 4: Don't 'kill -9' the postmaster +> =20 +> + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 10:52:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B99E05392D + for ; + Mon, 25 Apr 2005 10:52:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87313-02 + for ; + Mon, 25 Apr 2005 13:52:54 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B7425368E + for ; + Mon, 25 Apr 2005 10:52:52 -0300 (ADT) +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.7226.0 +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Mon, 25 Apr 2005 09:52:16 -0400 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C266F@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +thread-index: AcVIMzVGLH1G5ha+S1O6apch12yqrABafIhA +From: "Merlin Moncure" +To: "Christopher Browne" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/673 +X-Sequence-Number: 12070 + +> In practice, we have watched Windows evolve in such a fashion with +> respect to multiuser support, and, in effect, it has never really +> gotten it. Microsoft started by hacking something on top of MS-DOS, +> and by the time enough applications had enough dependancies on the way +> that worked, it has essentially become impossible for them to migrate +> properly to a multiuser model since applications are normally designed +> with the myopic "this is MY computer!" model of the world. + +Completely false. NT was a complete rewrite (1993ish) and was +inherently multi-user with even the GDI running as a user level process +(no longer however). The NT kernel was scalable and portable, running +on the Alpha, MIPS, etc. + +However, you do have a point with applications...many win32 developers +have a very bad habit about expecting their apps to install and run as +root. However, this is generally not a problem with Microsoft stuff. +In short, the problem is really people, not the technology. + +Merlin + +From pgsql-odbc-owner@postgresql.org Mon Apr 25 11:07:55 2005 +X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B86053A52; + Mon, 25 Apr 2005 11:07:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89634-05; Mon, 25 Apr 2005 14:07:48 +0000 (GMT) +Received: from mta10.nationwireless.net (mta10.nationwireless.net + [63.163.128.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 92B4D53985; + Mon, 25 Apr 2005 11:07:45 -0300 (ADT) +Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with + ESMTP + (SMTPD32-8.15) id A9A512480034; Mon, 25 Apr 2005 10:07:33 -0400 +From: "Joel Fradkin" +To: "'Marko Ristola'" +Cc: "'Mohan, Ross'" , + , +Subject: Re: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +Date: Mon, 25 Apr 2005 10:07:39 -0400 +Message-ID: <001701c549a0$23ef2f80$797ba8c0@jfradkin> +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 +In-Reply-To: <426B4777.9050501@kolumbus.fi> +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/70 +X-Sequence-Number: 5229 + +Tried changing the settings and saw no change in a test using asp. +The test does several selects on views and tables. +It actually seemed to take a bit longer. + +Joel Fradkin +=20 +Wazagua, Inc. +2520 Trailmate Dr +Sarasota, Florida 34243 +Tel. 941-753-7111 ext 305 +=20 +jfradkin@wazagua.com +www.wazagua.com +Powered by Wazagua +Providing you with the latest Web-based technology & advanced tools. +C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc + This email message is for the use of the intended recipient(s) and may +contain confidential and privileged information. Any unauthorized = +review, +use, disclosure or distribution is prohibited. If you are not the = +intended +recipient, please contact the sender by reply email and delete and = +destroy +all copies of the original message, including attachments. +=20 + +=20 + +-----Original Message----- +From: Marko Ristola [mailto:marko.ristola@kolumbus.fi]=20 +Sent: Sunday, April 24, 2005 2:15 AM +To: Joel Fradkin +Cc: 'Mohan, Ross'; pgsql-odbc@postgresql.org; +pgsql-performance@postgresql.org +Subject: Re: [ODBC] [PERFORM] Joel's Performance Issues WAS : Opteron vs +Xeon + + +Here is, how you can receive all one billion rows with +pieces of 2048 rows. This changes PostgreSQL and ODBC behaviour: + +Change ODBC data source configuration in the following way: + +Fetch =3D 2048 +UseDeclareFetch =3D 1 + +It does not create core dumps with 32 bit computers with billions of = +rows! +This is a bit slower than fetching all rows at once. Scalability means=20 +sometimes +a bit less speed :( + +With UseDeclareFetch=3D1 you might get even 150 thousands rows per = +second. +With UseDeclareFetch=3D0 the backend might be able to send about 200=20 +thousands rows per +second. + +So, these high numbers come, if all the results are already in memory,=20 +and no disc +accesses are needed. These are about the peak speeds with VARCHAR,=20 +without Unicode, +with Athlon64 home computer. + +With sequential disc scan, more typical fetching +speed is about 50-100 thousands rows per second. + +PostgreSQL ODBC row fetching speed is very good. +Perhaps with better discs, with RAID10, the current upper limit about=20 +200 thousands +rows per second could be achieved?? + +So the in memory examples show, that the hard disc is normally +the bottleneck. It is on the server side. +My experiments are done in Linux. In Windows, the speed might be a bit=20 +different +by a constant factor (algorithmically). + +These speeds depend on very many factos even on sequential scan. +ODBC speed is affected by the number of columns fetched and the types of = + +the columns. +Integers are processed faster than textual or date columns. + +The network latency is decreased with UseDeclareFetc=3D1 by increasing = +the=20 +Fetch=3D2048 +parameter: With Fetch=3D1 you get a bad performance with lots of rows, = +but=20 +if you fetch +more data from the server once per 2048 rows, the network latency=20 +affects only once for +the 2048 row block. + +Regards, +Marko Ristola + +Joel Fradkin wrote: + +>Hate to be dumb, but unfortunately I am. +> +>Could you give me an idea what I should be using, or is there a good +>resource for me to check out. +>I have been spending so much time with config and moving data, = +converting +>etc, I never looked at the odbc settings (didn't even think about it = +until +>Josh brought it up). I did ask him for his advice, but would love a = +second +>opinion. +> +>Our data is a bit of a mixture, some records have text items most are +>varchars and integers with a bit of Booleans mixed in. +> +>I am running 8.0.2 so not sure if the protocol is ODBC or Postgres? +> +>Thanks for responding I appreciate any help=20 +> +>Joel Fradkin +>=20 +>-----Original Message----- +>From: pgsql-odbc-owner@postgresql.org +>[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mohan, Ross +>Sent: Thursday, April 21, 2005 10:01 AM +>To: pgsql-odbc@postgresql.org +>Subject: Re: [ODBC] [PERFORM] Joel's Performance Issues WAS : Opteron = +vs +>Xeon +> +>Joel, thanks. A couple of things jump out there for +>me, not a problem for a routine ODBC connection, but +>perhaps in the "lotsa stuff" context of your current +>explorations, it might be relevant? +> +>I am completely shooting from the hip, here, but...if +>it were my goose to cook, I'd be investigating +> +>Session("StringConn") =3D +>"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D +; +>PWD=3D;ReadOnly=3D0;Protocol=3D6.4; +> +>|| Protocol? Is this related to version? is the driver waaaay old? +> +> +>FakeOidIndex=3D0;ShowOidColumn=3D0;RowVersioning=3D0; +>ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100; +> +>|| Fetch great for OLTP, lousy for batch? +> +> +>Socket=3D4096;UnknownSizes=3D0;MaxVarcharSize=3D254;MaxLongVarcharSize=3D= +8190; +> +>|| what ARE the datatypes and sizes in your particular case?=20 +> +>Debug=3D0; +> +>|| a run with debug=3D1 probably would spit up something = +interesting.... +> +>CommLog=3D0;Optimizer=3D1; +> +>|| Optimizer? that's a new one on me.... +> +>Ksqo=3D1;UseDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar= +=3D0;BoolsA +s +>Char=3D1;Parse=3D0;CancelAsFreeStmt=3D;ExtraSysTablePrefixes=3Ddd_;LFCon= +version=3D1;U +p +>datableCursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAs= +LongVarBina +r +>y=3D0;UseServerSidePrepare=3D0" +> +> +>|| that's about all I can see, prima facie. I'll be very curious to = +know +>if ODBC is +> any part of your performance equation.=20 +> +> +>HTH,=20 +> +>Ross +> +>-----Original Message----- +>From: Joel Fradkin [mailto:jfradkin@wazagua.com]=20 +>Sent: Thursday, April 21, 2005 10:54 AM +>To: Mohan, Ross +>Cc: pgsql-odbc@postgresql.org; PostgreSQL Perform +>Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +> +> +>Here is the connect string I am using. +>It could be horrid as I cut it from ODBC program. +> +>Session("StringConn") =3D +>"DRIVER=3D{PostgreSQL};DATABASE=3Dwazagua;SERVER=3D192.168.123.252;PORT=3D= +5432;UID=3D +; +>PWD=3D;ReadOnly=3D0;Protocol=3D6.4;FakeOidIndex=3D0;ShowOidColumn=3D0;Ro= +wVersioning=3D0 +; +>ShowSystemTables=3D0;ConnSettings=3D;Fetch=3D100;Socket=3D4096;UnknownSi= +zes=3D0;MaxVa +r +>charSize=3D254;MaxLongVarcharSize=3D8190;Debug=3D0;CommLog=3D0;Optimizer= +=3D1;Ksqo=3D1;U +s +>eDeclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar=3D0;BoolsA= +sChar=3D1;P +a +>rse=3D0;CancelAsFreeStmt=3D0;ExtraSysTablePrefixes=3Ddd_;LFConversion=3D= +1;Updatable +C +>ursors=3D1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongVarB= +inary=3D0;Use +S +>erverSidePrepare=3D0" +> +>Joel Fradkin +>=20 +> +>-----Original Message----- +>From: Mohan, Ross [mailto:RMohan@arbinet.com]=20 +>Sent: Thursday, April 21, 2005 9:42 AM +>To: jfradkin@wazagua.com +>Subject: RE: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +> +>FWIW, ODBC has variables to tweak, as well. fetch/buffer sizes, and the +>like.=20 +> +>Maybe one of the ODBC cognoscenti here can chime in more concretely.... +> +> +> +> +> +> +>---------------------------(end of = +broadcast)--------------------------- +>TIP 7: don't forget to increase your free space map settings +> +> +>---------------------------(end of = +broadcast)--------------------------- +>TIP 4: Don't 'kill -9' the postmaster +> =20 +> + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 11:15:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E813A53964 + for ; + Mon, 25 Apr 2005 11:15:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92369-04 + for ; + Mon, 25 Apr 2005 14:15:06 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id DB0455394F + for ; + Mon, 25 Apr 2005 11:14:53 -0300 (ADT) +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.7226.0 +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Mon, 25 Apr 2005 10:13:34 -0400 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2676@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Joel's Performance Issues WAS : Opteron vs Xeon +thread-index: AcVID6o+hnyAJe9ITYCQ7WW4K6jEjABjnI9g +From: "Merlin Moncure" +To: "Joel Fradkin" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/675 +X-Sequence-Number: 12072 + +> I am waiting to here back from Josh on using cursors and trying to +flatten +> long running views. +>=20 +> I am a little disappointed I have not understood enough to get my +analyzer +> to use the proper plan, we had to set seqscan off to get the select +from +> response_line to work fast and I had to turn off merge joins to get +assoc +> list to work fast. Once I am up I can try to learn more about it, I am +so +> glad there are so many folks here willing to take time to educate us +> newb's. + +I am not a big fan of tweaking the optimizer because you are robbing +Peter to pay Paul, so to speak. pg 8.1 may come out with new optimizer +tweaks and you'll have to do it all over again. If the optimizer is not +'getting' your view, there are a few different approaches to fixing the +problem. + +I am also not a big fan of de-normalizing your database. Essentially +you are lighting a fuse that may blow up later. Here are some general +approaches to planner optimization that can help out in tricky +situations. + +1. Split up views. Often overlooked but can provide good enhancements. +If your view is based on 3 or more tables, has left/right joins, +consider breaking it up into two or more views. Views can be based on +views and it is easier to force the planner to pick good plans this way. +If you can find other uses for component views in other queries, so much +the better. + +2. Materialize your view. Use lazy materialization, i.e. you query the +view into a table at scheduled times. Now we are trading disk spaces +and coherence for performance...this may not fit your requirements but +the nice thing about it is that it will help give us the 'ideal plan' +running time which we are shooting for. + +3. pl/pgsql. Using combinations of loops, refcursors, and queries, you +can cut code that should give you comparable performance to the ideal +plan. If you can do the actual work here as well (no data returned to +client), you get a tremendous win. Also pl/pgsql works really well for +recursive sets and other things that are difficult to run in the context +of a single query. Just be aware of the disadvantages: +a. not portable +b. maintenance overhead +c. require relatively high developer skill set + +I will go out on a limb and say that mastering the above approaches can +provide the solution to virtually any performance problem within the +limits of your hardware and the problem complexity. + +Based on your questions, it sounds to me like your #1 problem is your +developer skillset relative to your requirements. However, this is +easily solvable...just keep attacking the problem and don't be afraid to +bring in outside help (which you've already done, that's a start!). + +Merlin + +From pgsql-performance-owner@postgresql.org Mon Apr 25 12:23:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E35A53AA1; + Mon, 25 Apr 2005 12:23:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12025-08; Mon, 25 Apr 2005 15:23:39 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6A49E537F4; + Mon, 25 Apr 2005 12:23:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3PFN1kR019277; + Mon, 25 Apr 2005 11:23:01 -0400 (EDT) +To: Simon Riggs +Cc: josh@agliodbs.com, Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +In-reply-to: <1114419467.21529.210.camel@localhost.localdomain> +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> + <1114419467.21529.210.camel@localhost.localdomain> +Comments: In-reply-to Simon Riggs + message dated "Mon, 25 Apr 2005 09:57:47 +0100" +Date: Mon, 25 Apr 2005 11:23:00 -0400 +Message-ID: <19276.1114442580@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/676 +X-Sequence-Number: 12073 + +Simon Riggs writes: +> My suggested hack for PostgreSQL is to have an option to *not* sample, +> just to scan the whole table and find n_distinct accurately. +> ... +> What price a single scan of a table, however large, when incorrect +> statistics could force scans and sorts to occur when they aren't +> actually needed ? + +It's not just the scan --- you also have to sort, or something like +that, if you want to count distinct values. I doubt anyone is really +going to consider this a feasible answer for large tables. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 25 12:47:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A663E5636B + for ; + Mon, 25 Apr 2005 12:45:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21771-04 + for ; + Mon, 25 Apr 2005 15:45:15 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id D22EA539F6 + for ; + Mon, 25 Apr 2005 12:44:37 -0300 (ADT) +Received: (qmail 21028 invoked from network); 25 Apr 2005 15:44:27 -0000 +Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) + (209.149.56.238) by 0 with SMTP; 25 Apr 2005 15:44:27 -0000 +In-Reply-To: <426C9508.8030902@sfnet.cc> +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> + <6865.1113600214@sss.pgh.pa.us> + + <426C9508.8030902@sfnet.cc> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=WINDOWS-1252; format=flowed +Message-Id: <02c5560a910870da3637b6ff791e3a80@sitening.com> +Content-Transfer-Encoding: quoted-printable +Cc: PgSQL - Performance +From: Thomas F.O'Connell +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +Date: Mon, 25 Apr 2005 10:44:24 -0500 +To: Steve Poe +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/677 +X-Sequence-Number: 12074 + +Interesting. I should've included standard deviation in my pgbench=20 +iteration patch. Maybe I'll go back and do that. + +I was seeing oscillation across the majority of iterations in the 25=20 +clients/1000 transaction runs on both database versions. + +I've got my box specs and configuration files posted. If you see=20 +anything obvious about the tuning parameters that should be tweaked,=20 +please let me know. + +Thanks for the feedback! + +-tfo + +-- +Thomas F. O'Connell +Co-Founder, Information Architect +Sitening, LLC + +Strategic Open Source: Open Your i=99 + +http://www.sitening.com/ +110 30th Avenue North, Suite 6 +Nashville, TN 37203-6320 +615-260-0005 + +On Apr 25, 2005, at 1:58 AM, Steve Poe wrote: + +> >There was some interesting oscillation behavior in both version of=20 +> postgres that occurred with 25 >clients and 1000 transactions at a=20 +> scaling factor of 100. This was repeatable with the distribution=20 +> >version of pgbench run iteratively from the command line. I'm not=20 +> sure how to explain this. +> +> Tom, +> +> When you see these oscillations, do they occur after so many generated=20= + +> results? Some oscillation is normal, in my opinion, from 10-15% of the=20= + +> performance is noise-related. +> +> The key is to tune the server that you either 1) minimize the=20 +> oscillation and/or 2)increase your overall performance above the=20 +> 10-15% baseline, and 3) find out what the mean and standard deviation=20= + +> between all your results. +> +> If your results are within that range, this maybe "normal". I=20 +> follow-up with you later on what I do. +> +> Steve Poe + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 14:18:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C775A537CC + for ; + Mon, 25 Apr 2005 14:18:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48301-03 + for ; + Mon, 25 Apr 2005 17:18:43 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 6091653757 + for ; + Mon, 25 Apr 2005 14:18:42 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Mon, 25 Apr 2005 10:21:47 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Mon, 25 Apr 2005 10:21:41 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005042510214128267 + for ; + Mon, 25 Apr 2005 10:21:41 -0700 +X-ASG-Debug-ID: 1114449515-8064-15-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail1 (mail1.hq.corp [192.168.160.5]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id E080120106BC + for ; + Mon, 25 Apr 2005 10:18:35 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.1830); Mon, 25 Apr 2005 10:21:35 -0700 +Message-ID: <426D265F.9080902@sfnet.cc> +Date: Mon, 25 Apr 2005 10:18:23 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Thomas F.O'Connell" +Cc: PgSQL - Performance +X-ASG-Orig-Subj: Re: [PERFORM] pgbench Comparison of 7.4.7 to 8.0.2 +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> + <6865.1113600214@sss.pgh.pa.us> + + <426C9508.8030902@sfnet.cc> + <02c5560a910870da3637b6ff791e3a80@sitening.com> +In-Reply-To: <02c5560a910870da3637b6ff791e3a80@sitening.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +X-OriginalArrivalTime: 25 Apr 2005 17:21:35.0292 (UTC) + FILETIME=[3B52C7C0:01C549BB] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.546 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5000] +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.726 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, NO_DNS_FOR_FROM +X-Spam-Level: +X-Archive-Number: 200504/678 +X-Sequence-Number: 12075 + +Tom, + +Just a quick thought: after each run/sample of pgbench, I drop the=20 +database and recreate it. When I don't my results become more skewed. + +Steve Poe + + +Thomas F.O'Connell wrote: + +> Interesting. I should've included standard deviation in my pgbench=20 +> iteration patch. Maybe I'll go back and do that. +> +> I was seeing oscillation across the majority of iterations in the 25=20 +> clients/1000 transaction runs on both database versions. +> +> I've got my box specs and configuration files posted. If you see=20 +> anything obvious about the tuning parameters that should be tweaked,=20 +> please let me know. +> +> Thanks for the feedback! +> +> -tfo +> +> --=20 +> Thomas F. O'Connell +> Co-Founder, Information Architect +> Sitening, LLC +> +> Strategic Open Source: Open Your i=E2=84=A2 +> +> http://www.sitening.com/ +> 110 30th Avenue North, Suite 6 +> Nashville, TN 37203-6320 +> 615-260-0005 +> +> On Apr 25, 2005, at 1:58 AM, Steve Poe wrote: +> +>> >There was some interesting oscillation behavior in both version of=20 +>> postgres that occurred with 25 >clients and 1000 transactions at a=20 +>> scaling factor of 100. This was repeatable with the distribution=20 +>> >version of pgbench run iteratively from the command line. I'm not=20 +>> sure how to explain this. +>> +>> Tom, +>> +>> When you see these oscillations, do they occur after so many=20 +>> generated results? Some oscillation is normal, in my opinion, from=20 +>> 10-15% of the performance is noise-related. +>> +>> The key is to tune the server that you either 1) minimize the=20 +>> oscillation and/or 2)increase your overall performance above the=20 +>> 10-15% baseline, and 3) find out what the mean and standard deviation=20 +>> between all your results. +>> +>> If your results are within that range, this maybe "normal". I=20 +>> follow-up with you later on what I do. +>> +>> Steve Poe +> +> +> + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 15:53:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BCB1D54665; + Mon, 25 Apr 2005 15:53:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73345-07; Mon, 25 Apr 2005 18:52:18 +0000 (GMT) +Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) + by svr1.postgresql.org (Postfix) with ESMTP id 873B053AA4; + Mon, 25 Apr 2005 15:52:17 -0300 (ADT) +Received: from modem-1679.tiger.dialup.pol.co.uk ([62.136.214.143] + helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DQ8gm-0001Ai-00; Mon, 25 Apr 2005 19:52:12 +0100 +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +From: Simon Riggs +To: Tom Lane +Cc: josh@agliodbs.com, Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +In-Reply-To: <19276.1114442580@sss.pgh.pa.us> +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> + <1114419467.21529.210.camel@localhost.localdomain> + <19276.1114442580@sss.pgh.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 25 Apr 2005 19:49:01 +0100 +Message-Id: <1114454941.21529.245.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/679 +X-Sequence-Number: 12076 + +On Mon, 2005-04-25 at 11:23 -0400, Tom Lane wrote: +> Simon Riggs writes: +> > My suggested hack for PostgreSQL is to have an option to *not* sample, +> > just to scan the whole table and find n_distinct accurately. +> > ... +> > What price a single scan of a table, however large, when incorrect +> > statistics could force scans and sorts to occur when they aren't +> > actually needed ? +> +> It's not just the scan --- you also have to sort, or something like +> that, if you want to count distinct values. I doubt anyone is really +> going to consider this a feasible answer for large tables. + +Assuming you don't use the HashAgg plan, which seems very appropriate +for the task? (...but I understand the plan otherwise). + +If that was the issue, then why not keep scanning until you've used up +maintenance_work_mem with hash buckets, then stop and report the result. + +The problem is if you don't do the sort once for statistics collection +you might accidentally choose plans that force sorts on that table. I'd +rather do it once... + +The other alternative is to allow an ALTER TABLE command to set +statistics manually, but I think I can guess what you'll say to that! + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 16:08:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8F34A53650; + Mon, 25 Apr 2005 16:08:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78752-04; Mon, 25 Apr 2005 19:08:08 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 636ED549E2; + Mon, 25 Apr 2005 16:08:07 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7283141; Mon, 25 Apr 2005 12:10:06 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Mon, 25 Apr 2005 12:13:18 -0700 +User-Agent: KMail/1.7.1 +References: <200504191209.05181.josh@agliodbs.com> + <19276.1114442580@sss.pgh.pa.us> + <1114454941.21529.245.camel@localhost.localdomain> +In-Reply-To: <1114454941.21529.245.camel@localhost.localdomain> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504251213.18565.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/680 +X-Sequence-Number: 12077 + +Simon, Tom: + +While it's not possible to get accurate estimates from a fixed size sample, I +think it would be possible from a small but scalable sample: say, 0.1% of all +data pages on large tables, up to the limit of maintenance_work_mem. + +Setting up these samples as a % of data pages, rather than a pure random sort, +makes this more feasable; for example, a 70GB table would only need to sample +about 9000 data pages (or 70MB). Of course, larger samples would lead to +better accuracy, and this could be set through a revised GUC (i.e., +maximum_sample_size, minimum_sample_size). + +I just need a little help doing the math ... please? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Apr 25 16:13:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CCAD05396C; + Mon, 25 Apr 2005 16:13:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79195-07; Mon, 25 Apr 2005 19:13:16 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id F16B553650; + Mon, 25 Apr 2005 16:13:15 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7283173; Mon, 25 Apr 2005 12:15:14 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-perform +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Mon, 25 Apr 2005 12:18:26 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-hackers@postgresql.org +References: <200504191209.05181.josh@agliodbs.com> + <1114454941.21529.245.camel@localhost.localdomain> + <200504251213.18565.josh@agliodbs.com> +In-Reply-To: <200504251213.18565.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504251218.27072.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/681 +X-Sequence-Number: 12078 + +Guys, + +> While it's not possible to get accurate estimates from a fixed size sample, +> I think it would be possible from a small but scalable sample: say, 0.1% of +> all data pages on large tables, up to the limit of maintenance_work_mem. + +BTW, when I say "accurate estimates" here, I'm talking about "accurate enough +for planner purposes" which in my experience is a range between 0.2x to 5x. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Apr 25 17:10:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CC666539AE + for ; + Mon, 25 Apr 2005 17:10:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96133-10 + for ; + Mon, 25 Apr 2005 20:10:23 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id A9C4853985 + for ; + Mon, 25 Apr 2005 17:10:22 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id C605230E89; Mon, 25 Apr 2005 22:08:58 +0200 (MET DST) +From: Ron Mayer +X-Newsgroups: pgsql.performance +Subject: half the query time in an unnecessary(?) sort? +Date: Mon, 25 Apr 2005 13:14:25 -0700 +Organization: Hub.Org Networking Services +Lines: 50 +Message-ID: <426D4FA1.1050000@cheapcomplexdevices.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +Cc: Ron Mayer +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/682 +X-Sequence-Number: 12079 + +If I have a freshly CLUSTERed table and queries that want to do a +merge join, it seems to me that quite a bit of time is spent +unnecessarily sorting the already-sorted table. An example such +query I found in my log files is shown below. If I read the +EXPLAIN ANALYZE output correctly, it's saying that roughly half +the time (570-269 = 300 out of 670 ms) was spent sorting the +already sorted data. + +===================== + \d entity_facids; + Table "public.entity_facids" + Column | Type | Modifiers + -----------+-----------+----------- + entity_id | integer | + fac_ids | integer[] | + Indexes: + "entity_facids__entity_id" btree (entity_id) + fli=# cluster entity_facids__entity_id on entity_facids; + CLUSTER + fli=# + fli=# explain analyze select * from userfeatures.point_features join entity_facids using (entity_id) where featureid=118; + QUERY PLAN + ------------------------------------------------------------------------------------------------------------------------------------------------------------- + Merge Join (cost=9299.37..9738.34 rows=1078 width=117) (actual time=536.989..667.648 rows=2204 loops=1) + Merge Cond: ("outer".entity_id = "inner".entity_id) + -> Sort (cost=37.27..38.45 rows=471 width=85) (actual time=14.289..16.303 rows=2204 loops=1) + Sort Key: point_features.entity_id + -> Index Scan using point_features__featureid on point_features (cost=0.00..16.36 rows=471 width=85) (actual time=0.030..9.360 rows=2204 loops=1) + Index Cond: (featureid = 118) + -> Sort (cost=9262.10..9475.02 rows=85168 width=36) (actual time=518.471..570.038 rows=59112 loops=1) + Sort Key: entity_facids.entity_id + -> Seq Scan on entity_facids (cost=0.00..2287.68 rows=85168 width=36) (actual time=0.093..268.679 rows=85168 loops=1) + Total runtime: 693.161 ms + (10 rows) + fli=# + +==================== + +I understand that the optimizer can not in general know that +a CLUSTERed table stays CLUSTERed when inserts or updates happen; +but I was wondering if anyone has any clever ideas on how I can +avoid this sort step. + + +Perhaps in the future, could the table set a bit to remember it +is freshly clustered, and clear that bit the first time any +changes are even attempted in the table? Or, if not, would +that be possible if Hannu Krosing's read-only-table idea + http://archives.postgresql.org/pgsql-hackers/2005-04/msg00660.php +happened? + +From pgsql-performance-owner@postgresql.org Tue Apr 26 20:08:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EE1FE54423; + Mon, 25 Apr 2005 17:43:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14577-02; Mon, 25 Apr 2005 20:43:20 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id 315045406E; + Mon, 25 Apr 2005 17:43:13 -0300 (ADT) +Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com + [24.211.165.134]) (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j3PJsdG27856; + Mon, 25 Apr 2005 14:54:39 -0500 +Message-ID: <426D565E.8040400@dunslane.net> +Date: Mon, 25 Apr 2005 16:43:10 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.7) Gecko/20050417 Fedora/1.7.7-1.3.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: josh@agliodbs.com +Cc: pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <19276.1114442580@sss.pgh.pa.us> + <1114454941.21529.245.camel@localhost.localdomain> + <200504251213.18565.josh@agliodbs.com> +In-Reply-To: <200504251213.18565.josh@agliodbs.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/713 +X-Sequence-Number: 12110 + + + +Josh Berkus wrote: + +>Simon, Tom: +> +>While it's not possible to get accurate estimates from a fixed size sample, I +>think it would be possible from a small but scalable sample: say, 0.1% of all +>data pages on large tables, up to the limit of maintenance_work_mem. +> +>Setting up these samples as a % of data pages, rather than a pure random sort, +>makes this more feasable; for example, a 70GB table would only need to sample +>about 9000 data pages (or 70MB). Of course, larger samples would lead to +>better accuracy, and this could be set through a revised GUC (i.e., +>maximum_sample_size, minimum_sample_size). +> +>I just need a little help doing the math ... please? +> +> + + +After some more experimentation, I'm wondering about some sort of +adaptive algorithm, a bit along the lines suggested by Marko Ristola, +but limited to 2 rounds. + +The idea would be that we take a sample (either of fixed size, or some +small proportion of the table) , see how well it fits a larger sample +(say a few times the size of the first sample), and then adjust the +formula accordingly to project from the larger sample the estimate for +the full population. Math not worked out yet - I think we want to ensure +that the result remains bounded by [d,N]. + +cheers + +andrew + + + +From pgsql-performance-owner@postgresql.org Mon Apr 25 18:00:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3324C5350F; + Mon, 25 Apr 2005 18:00:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19969-06; Mon, 25 Apr 2005 21:00:20 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id B2CC553388; + Mon, 25 Apr 2005 18:00:18 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Mon, 25 Apr 2005 16:00:18 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184D8@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks suggested? +Thread-Index: AcVJAVeIxZTsOLaYTjq5X1hA4YxQXQA0obqQ +From: "Dave Held" +To: "pgsql-perform" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.06 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/683 +X-Sequence-Number: 12080 + +> -----Original Message----- +> From: Josh Berkus [mailto:josh@agliodbs.com] +> Sent: Sunday, April 24, 2005 2:08 PM +> To: Andrew Dunstan +> Cc: Tom Lane; Greg Stark; Marko Ristola; pgsql-perform; +> pgsql-hackers@postgresql.org +> Subject: Re: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks +> suggested? +>=20 +> [...] +> Actually, that paper looks *really* promising. Does anyone here have +> enough math to solve for D(sub)Md on page 6? I'd like to test it on +> samples of < 0.01%. =20 +> [...] + +D_Md =3D [1 - sqrt(f_1 / s)] D_b + sqrt(f_1 / s) D_B + +s =3D block size + +f~_1 =3D median frequency within blocks for distinct values occurring in + only one block + +D_b =3D d + f_1^(b+1) + +d =3D distinct classes in the sample + +f_1^(b+1) =3D number of distinct values occurring in a single block in + a sample of b+1 blocks + +D_B =3D d + [B / (b + 1)] f_1^(b+1) + +b =3D sample size (in blocks) + +B =3D total table size (in blocks) + +f_k and f~_k are the only tricky functions here, but they are easy to=20 +understand: + +Suppose our column contains values from the set {a, b, c, ..., z}. +Suppose we have a sample of b =3D 10 blocks. +Suppose that the value 'c' occurs in exactly 3 blocks (we don't care +how often it occurs *within* those blocks). +Suppose that the value 'f' also occurs in exactly 3 blocks. +Suppose that the values 'h', 'p', and 'r' occur in exactly 3 blocks. +Suppose that no other value occurs in exactly 3 blocks. + +f_3^b =3D 5 + +This is because there are 5 distinct values that occur in exactly +3 blocks. f_1^b is the number of distinct values that occur in +exactly 1 block, regardless of how often it occurs within that block. + +Note that when you select a sample size of b blocks, you actually +need to sample b+1 blocks to compute f_1^(b+1). This is actually +pedantry since all occurrences of b in the formula are really b+1. + +f~ is slightly trickier. First, we pick the distinct values that +occur in only one block. Then, we count how often each value +occurs within its block. To wit: + +Suppose we have a set {d, q, y, z} of values that occur in only +one block. +Suppose that d occurs 3x, q occurs 1x, y occurs 8x, and z occurs 6x. + +The function f- would take the mean of these counts to determine +the "cluster frequency". So f- here would be 4.5. This allows +one to compute D_MF. + +The function f~ takes the median of this sample, which is 3 or 6 +(or I suppose you could even take the mean of the two medians if +you wanted). + +No tricky math involved. That should be enough to tell you how to +write the estimator. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Mon Apr 25 18:11:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 46D2F558AC; + Mon, 25 Apr 2005 18:11:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25743-10; Mon, 25 Apr 2005 21:11:10 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DE1FE55278; + Mon, 25 Apr 2005 18:11:09 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3PLAtc0024356; + Mon, 25 Apr 2005 17:10:55 -0400 (EDT) +To: Simon Riggs +Cc: josh@agliodbs.com, Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +In-reply-to: <1114454941.21529.245.camel@localhost.localdomain> +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> + <1114419467.21529.210.camel@localhost.localdomain> + <19276.1114442580@sss.pgh.pa.us> + <1114454941.21529.245.camel@localhost.localdomain> +Comments: In-reply-to Simon Riggs + message dated "Mon, 25 Apr 2005 19:49:01 +0100" +Date: Mon, 25 Apr 2005 17:10:55 -0400 +Message-ID: <24355.1114463455@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/684 +X-Sequence-Number: 12081 + +Simon Riggs writes: +> On Mon, 2005-04-25 at 11:23 -0400, Tom Lane wrote: +>> It's not just the scan --- you also have to sort, or something like +>> that, if you want to count distinct values. I doubt anyone is really +>> going to consider this a feasible answer for large tables. + +> Assuming you don't use the HashAgg plan, which seems very appropriate +> for the task? (...but I understand the plan otherwise). + +The context here is a case with a very large number of distinct +values... keep in mind also that we have to do this for *all* the +columns of the table. A full-table scan for each column seems +right out to me. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Apr 25 19:50:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7DEA4535F2 + for ; + Mon, 25 Apr 2005 19:50:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65675-06 + for ; + Mon, 25 Apr 2005 22:50:20 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 22F5C535E0 + for ; + Mon, 25 Apr 2005 19:50:19 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 3406830E89; Tue, 26 Apr 2005 00:48:57 +0200 (MET DST) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Date: Mon, 25 Apr 2005 18:03:52 -0400 +Organization: cbbrowne Computing Inc +Lines: 46 +Message-ID: +References: <6EE64EF3AB31D5448D0007DD34EEB3415C266F@Herge.rcsinc.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:4JCBfd0EHALGj8vq/Sd6gukHqGw= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.392 tagged_above=0 required=5 tests=AWL, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200504/687 +X-Sequence-Number: 12084 + +Martha Stewart called it a Good Thing when merlin.moncure@rcsonline.com ("Merlin Moncure") wrote: +>> In practice, we have watched Windows evolve in such a fashion with +>> respect to multiuser support, and, in effect, it has never really +>> gotten it. Microsoft started by hacking something on top of MS-DOS, +>> and by the time enough applications had enough dependancies on the way +>> that worked, it has essentially become impossible for them to migrate +>> properly to a multiuser model since applications are normally designed +>> with the myopic "this is MY computer!" model of the world. +> +> Completely false. NT was a complete rewrite (1993ish) and was +> inherently multi-user with even the GDI running as a user level +> process (no longer however). The NT kernel was scalable and +> portable, running on the Alpha, MIPS, etc. + +Completely irrelevant. When Win32 was deployed, the notion that more +than a tiny fraction of the users would be running Win32 apps on +multiuser platforms was absolutely laughable. It continued to be +laughable until well into this century, when Microsoft ceased to sell +systems based on MS-DOS. + +> However, you do have a point with applications...many win32 developers +> have a very bad habit about expecting their apps to install and run as +> root. However, this is generally not a problem with Microsoft stuff. +> In short, the problem is really people, not the technology. + +Reality is that it is all about the applications. + +Microsoft spent _years_ pushing people from MS-DOS to Windows 3.1 to +WfW to Windows 95, and had to do a lot of hard pushing. + +The result of that was that a lot of vendors built Win32 applications +for Windows 95. + +None of those systems supported multiple users, so the usage and +experience with Win32 pointed everyone to the construction of single +user applications. + +At that point, whether Windows NT did or didn't support multiple users +became irrelevant. Usage patterns had to be oriented towards single +user operation because that's all Win32 could be used to support for +the vast majority that _weren't_ running Windows NT. +-- +let name="cbbrowne" and tld="gmail.com" in String.concat "@" [name;tld];; +http://linuxfinances.info/info/x.html +But what can you do with it? -- ubiquitous cry from Linux-user +partner. -- Andy Pearce, + +From pgsql-performance-owner@postgresql.org Mon Apr 25 19:06:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E03D853583 + for ; + Mon, 25 Apr 2005 19:06:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54288-06 + for ; + Mon, 25 Apr 2005 22:06:31 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D67C535A6 + for ; + Mon, 25 Apr 2005 19:06:29 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7283943; Mon, 25 Apr 2005 15:08:28 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Ron Mayer +Subject: Re: half the query time in an unnecessary(?) sort? +Date: Mon, 25 Apr 2005 15:11:41 -0700 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <426D4FA1.1050000@cheapcomplexdevices.com> +In-Reply-To: <426D4FA1.1050000@cheapcomplexdevices.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504251511.41949.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/685 +X-Sequence-Number: 12082 + +Ron, + +> If I have a freshly CLUSTERed table and queries that want to do a +> merge join, it seems to me that quite a bit of time is spent +> unnecessarily sorting the already-sorted table. An example such +> query I found in my log files is shown below. If I read the +> EXPLAIN ANALYZE output correctly, it's saying that roughly half +> the time (570-269 = 300 out of 670 ms) was spent sorting the +> already sorted data. + +It still has to sort because the clustering isn't guarenteed to be 100%. +However, such sorts should be very quick as they have little work to do. + +Looking at your analyze, though, I think it's not the sort that's taking the +time as it is that the full sorted entity_id column won't fit in work_mem. +Try increasing it? + + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Apr 25 19:41:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 98014534BA; + Mon, 25 Apr 2005 19:41:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63966-02; Mon, 25 Apr 2005 22:41:45 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F5855380B; + Mon, 25 Apr 2005 19:41:42 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Mon, 25 Apr 2005 17:41:41 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184D9@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks suggested? +Thread-Index: AcVJ2hsKc0AOyYKWSWGgREyJxbrd+gACyuTg +From: "Dave Held" +To: "pgsql-perform" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.06 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/686 +X-Sequence-Number: 12083 + +> -----Original Message----- +> From: Andrew Dunstan [mailto:andrew@dunslane.net] +> Sent: Monday, April 25, 2005 3:43 PM +> To: josh@agliodbs.com +> Cc: pgsql-perform; pgsql-hackers@postgresql.org +> Subject: Re: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks +> suggested? +>=20 +> Josh Berkus wrote: +>=20 +> >Simon, Tom: +> > +> >While it's not possible to get accurate estimates from a=20 +> >fixed size sample, I think it would be possible from a +> >small but scalable sample: say, 0.1% of all data pages on +> >large tables, up to the limit of maintenance_work_mem. =20 + +Note that the results obtained in the cited paper were obtained +from samples of 5 and 10%. It should also warrant caution +that the authors don't offer any proofs of confidence bounds,=20 +even for the "average" case. + +> [...] +> After some more experimentation, I'm wondering about some +> sort of adaptive algorithm, a bit along the lines suggested +> by Marko Ristola, but limited to 2 rounds. + +One path might be to use the published algorithm and simply +recompute the statistics after every K blocks are sampled, +where K is a reasonably small number. If it looks like the +statistics are converging on a value, then take a few more +samples, check against the trend value and quit. Otherwise=20 +continue until some artificial limit is reached. + +> The idea would be that we take a sample (either of fixed=20 +> size, or some small proportion of the table), see how well +> it fits a larger sample (say a few times the size of the +> first sample), and then adjust the formula accordingly to +> project from the larger sample the estimate for the full +> population. Math not worked out yet - I think we want to +> ensure that the result remains bounded by [d,N]. + +The crudest algorithm could be something like the Newton- +Ralphson method for finding roots. Just adjust the predicted +value up or down until it comes within an error tolerance of +the observed value for the current sample. No need to choose +powers of 2, and I would argue that simply checking every so +often on the way to a large sample that can be terminated +early is more efficient than sampling and resampling. Of +course, the crude algorithm would almost certainly be I/O +bound, so if a more sophisticated algorithm would give a +better prediction by spending a few more CPU cycles on each +sample block gathered, then that seems like a worthwhile +avenue to pursue. + +As far as configuration goes, the user is most likely to +care about how long it takes to gather the statistics or +how accurate they are. So it would probably be best to +terminate the sampling process on a user-defined percentage +of the table size and the minimum error tolerance of the +algorithmic prediction value vs. the computed sample value. + +If someone wants a fast and dirty statistic, they set the +row percent low and the error tolerance high, which will +effectively make the blocks read the limiting factor. If +they want an accurate statistic, they set the row percent +as high as they feel they can afford, and the error=20 +tolerance as low as they need to in order to get the query=20 +plans they want. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Tue Apr 26 02:42:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 191D4539F6 + for ; + Tue, 26 Apr 2005 02:42:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79386-01 + for ; + Tue, 26 Apr 2005 05:41:55 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B084538C0 + for ; + Tue, 26 Apr 2005 02:41:53 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 0923C30E89; Tue, 26 Apr 2005 07:40:27 +0200 (MET DST) +From: Ron Mayer +X-Newsgroups: pgsql.performance +Subject: Re: half the query time in an unnecessary(?) sort? +Date: Mon, 25 Apr 2005 22:45:57 -0700 +Organization: Hub.Org Networking Services +Lines: 24 +Message-ID: <426DD595.1040608@cheapcomplexdevices.com> +References: <426D4FA1.1050000@cheapcomplexdevices.com> + <200504251511.41949.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +To: Josh Berkus +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +In-Reply-To: <200504251511.41949.josh@agliodbs.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200504/688 +X-Sequence-Number: 12085 + + +Josh Berkus wrote: [quoted out of order] +>Ron, +> +> Looking at your analyze, though, I think it's not the sort that's taking the +> time as it is that the full sorted entity_id column won't fit in work_mem. +> Try increasing it? + +Yup, that indeed fixed this particular query since neither table was +particularly large. + + +> It still has to sort because the clustering isn't guarenteed to be 100%. + +I guess I was contemplating whether or not there are some conditions +where it could be 100% (perhaps combined with Hannu's read only +table speculation). + +> However, such sorts should be very quick as they have little work to do. + +True, so long as the table can fit in work-mem. For much larger tables +IMHO it'd be nice to be able to simply do a seq-scan on them if there were +some way of knowing that they were sorted. + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 03:27:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DCB953A4B + for ; + Tue, 26 Apr 2005 03:26:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87339-07 + for ; + Tue, 26 Apr 2005 06:26:50 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id 68F6F537D7 + for ; + Tue, 26 Apr 2005 03:26:48 -0300 (ADT) +Received: (qmail 4675 invoked from network); 26 Apr 2005 06:26:48 -0000 +Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) + (209.149.56.238) by 0 with SMTP; 26 Apr 2005 06:26:48 -0000 +In-Reply-To: <426D265F.9080902@sfnet.cc> +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> + <6865.1113600214@sss.pgh.pa.us> + + <426C9508.8030902@sfnet.cc> + <02c5560a910870da3637b6ff791e3a80@sitening.com> + <426D265F.9080902@sfnet.cc> +Mime-Version: 1.0 (Apple Message framework v622) +Content-Type: text/plain; charset=WINDOWS-1252; format=flowed +Message-Id: +Content-Transfer-Encoding: quoted-printable +Cc: PgSQL - Performance +From: Thomas F.O'Connell +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +Date: Tue, 26 Apr 2005 01:26:46 -0500 +To: Steve Poe +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/689 +X-Sequence-Number: 12086 + +Considering the default vacuuming behavior, why would this be? + +-tfo + +-- +Thomas F. O'Connell +Co-Founder, Information Architect +Sitening, LLC + +Strategic Open Source: Open Your i=99 + +http://www.sitening.com/ +110 30th Avenue North, Suite 6 +Nashville, TN 37203-6320 +615-260-0005 + +On Apr 25, 2005, at 12:18 PM, Steve Poe wrote: + +> Tom, +> +> Just a quick thought: after each run/sample of pgbench, I drop the=20 +> database and recreate it. When I don't my results become more skewed. +> +> Steve Poe= + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 05:09:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C3DA545C2 + for ; + Tue, 26 Apr 2005 05:09:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13704-04 + for ; + Tue, 26 Apr 2005 08:08:55 +0000 (GMT) +Received: from smtp107.mail.sc5.yahoo.com (smtp107.mail.sc5.yahoo.com + [66.163.169.227]) + by svr1.postgresql.org (Postfix) with SMTP id 37A5554576 + for ; + Tue, 26 Apr 2005 05:08:54 -0300 (ADT) +Received: from unknown (HELO ?192.168.2.161?) (apoc9009@84.56.236.162 with + plain) + by smtp107.mail.sc5.yahoo.com with SMTP; 26 Apr 2005 08:08:54 -0000 +Message-ID: <426DF6C5.1090509@yahoo.de> +Date: Tue, 26 Apr 2005 10:07:33 +0200 +From: "apoc9009@yahoo.de" +Reply-To: apoc9009@yahoo.de +Organization: apoc9009@yahoo.de +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Table Partitioning: Will it be supported in Future? (splitting large + Tables) +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.89 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/690 +X-Sequence-Number: 12087 + +Hi all, + +Ia a Guy from Germany an a strong Postgres believer! +It is the best OpenSource Database i have ever have bee tasted and i +try to using +it in any Database Environments. + +It is exiting to see thadt Verison 8.0 has Tablespaces like ORACLE and DB/2, +but i need Partitioning on a few very large Tables. + +The Tabeles are not verry complex, but it is extremely Large (1 GByte +and above) +and i think Table Partitioning is the right Way to spiltt them off on +some physical +Harddrives. Iam not sure thadt a common Harddrive RAID or SAN Storage +System will do it for me. The ORACLE Table Partitioning Features are verry +usefull but my favorite Datebase is PSQL. + +Is there any Plans thadt Postgres will support Partitioning in the near +Future? + +Thanks + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 05:22:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 27A49535E3 + for ; + Tue, 26 Apr 2005 05:22:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17992-03 + for ; + Tue, 26 Apr 2005 08:22:32 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id CA33A545A1 + for ; + Tue, 26 Apr 2005 05:22:28 -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 7AAB540DFD0; Tue, 26 Apr 2005 09:22:23 +0100 (BST) +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 7F13915931; Tue, 26 Apr 2005 09:22:27 +0100 (BST) +Message-ID: <426DFA43.5080801@archonet.com> +Date: Tue, 26 Apr 2005 09:22:27 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: apoc9009@yahoo.de +Cc: pgsql-performance@postgresql.org +Subject: Re: Table Partitioning: Will it be supported in Future? +References: <426DF6C5.1090509@yahoo.de> +In-Reply-To: <426DF6C5.1090509@yahoo.de> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/691 +X-Sequence-Number: 12088 + +apoc9009@yahoo.de wrote: +> Hi all, +> +> Ia a Guy from Germany an a strong Postgres believer! +> It is the best OpenSource Database i have ever have bee tasted and i +> try to using +> it in any Database Environments. +> +> It is exiting to see thadt Verison 8.0 has Tablespaces like ORACLE and +> DB/2, +> but i need Partitioning on a few very large Tables. + +I believe these are being worked on at the moment. You might want to +search the archives of the hackers mailing list to see if the plans will +suit your needs. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Tue Apr 26 05:23:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CAC9C54576 + for ; + Tue, 26 Apr 2005 05:23:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18539-01 + for ; + Tue, 26 Apr 2005 08:23:51 +0000 (GMT) +Received: from smtp106.mail.sc5.yahoo.com (smtp106.mail.sc5.yahoo.com + [66.163.169.226]) + by svr1.postgresql.org (Postfix) with SMTP id 5E76954512 + for ; + Tue, 26 Apr 2005 05:23:50 -0300 (ADT) +Received: from unknown (HELO ?192.168.2.161?) (apoc9009@84.56.236.162 with + plain) + by smtp106.mail.sc5.yahoo.com with SMTP; 26 Apr 2005 08:23:51 -0000 +Message-ID: <426DFA46.8090402@yahoo.de> +Date: Tue, 26 Apr 2005 10:22:30 +0200 +From: "apoc9009@yahoo.de" +Reply-To: apoc9009@yahoo.de +Organization: apoc9009@yahoo.de +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: BLOB's bypassing the OS Filesystem for better Image loading speed? +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Improper folded header field made up entirely of + whitespace in message header 'Subject': +X-Spam-Status: No, hits=0.796 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/692 +X-Sequence-Number: 12089 + +Hi all again, + +My next queststion is dedicated to blobs in my Webapplication (using +Tomcat 5 and JDBC +integrated a the J2EE Appserver JBoss). + +Filesystems with many Filesystem Objects can slow down the Performance +at opening +and reading Data. + +My Question: +Can i speedup my Webapplication if i store my JPEG Images with small +sizes inside my PostgreSQL Database (on verry large Databasis over 1 GByte +and above without Images at this time!) + +I hope some Peoples can give me a Tip or Hint where in can +some usefull Information about it! + +Thanks +Josh + + + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 06:10:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 534445466B + for ; + Tue, 26 Apr 2005 06:10:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30505-04 + for ; + Tue, 26 Apr 2005 09:10:30 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id BBA4154633 + for ; + Tue, 26 Apr 2005 06:09:51 -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 9E58544A46B; Tue, 26 Apr 2005 10:05:28 +0100 (BST) +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 364CA15931; Tue, 26 Apr 2005 10:05:33 +0100 (BST) +Message-ID: <426E045C.7010601@archonet.com> +Date: Tue, 26 Apr 2005 10:05:32 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: apoc9009@yahoo.de +Cc: pgsql-performance@postgresql.org +Subject: Re: BLOB's bypassing the OS Filesystem for better Image +References: <426DFA46.8090402@yahoo.de> +In-Reply-To: <426DFA46.8090402@yahoo.de> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/693 +X-Sequence-Number: 12090 + +apoc9009@yahoo.de wrote: +> Hi all again, +> +> My next queststion is dedicated to blobs in my Webapplication (using +> Tomcat 5 and JDBC +> integrated a the J2EE Appserver JBoss). +> +> Filesystems with many Filesystem Objects can slow down the Performance +> at opening +> and reading Data. + +Which filesystems? I know ext2 used to have issues with many-thousands +of files in one directory, but that was a directory scanning issue +rather than file reading. + +> My Question: +> Can i speedup my Webapplication if i store my JPEG Images with small +> sizes inside my PostgreSQL Database (on verry large Databasis over 1 GByte +> and above without Images at this time!) + +No. Otherwise the filesystem people would build their filesystems on top +of PostgreSQL not the other way around. Of course, if you want image +updates to be part of a database transaction, then it might be worth +storing them in the database. + +> I hope some Peoples can give me a Tip or Hint where in can +> some usefull Information about it! + +Look into having a separate server (process or actual hardware) to +handle requests for static text and images. Keep the Java server for +actually processing data. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Tue Apr 26 06:36:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E6CAD53507 + for ; + Tue, 26 Apr 2005 06:36:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37606-04 + for ; + Tue, 26 Apr 2005 09:36:07 +0000 (GMT) +Received: from smtp109.mail.sc5.yahoo.com (smtp109.mail.sc5.yahoo.com + [66.163.170.7]) + by svr1.postgresql.org (Postfix) with SMTP id A33DD53DE0 + for ; + Tue, 26 Apr 2005 06:36:05 -0300 (ADT) +Received: from unknown (HELO ?192.168.2.161?) (apoc9009@84.56.236.162 with + plain) + by smtp109.mail.sc5.yahoo.com with SMTP; 26 Apr 2005 09:36:07 -0000 +Message-ID: <426E0B35.9080509@yahoo.de> +Date: Tue, 26 Apr 2005 11:34:45 +0200 +From: "apoc9009@yahoo.de" +Reply-To: apoc9009@yahoo.de +Organization: apoc9009@yahoo.de +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: BLOB's bypassing the OS Filesystem for better Image +References: <426DFA46.8090402@yahoo.de> <426E045C.7010601@archonet.com> +In-Reply-To: <426E045C.7010601@archonet.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.894 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/694 +X-Sequence-Number: 12091 + + +> Which filesystems? I know ext2 used to have issues with many-thousands +> of files in one directory, but that was a directory scanning issue +> rather than file reading. + + From my Point of view i think it is better to let one Process do the +operation to an Postgres Cluster Filestructure as +if i bypass it with a second process. + +For example: +A User loads up some JPEG Images over HTTP. + +a) (Filesystem) +On Filesystem it would be written in a File with a random generated +Filename (timestamp or what ever) +(the Directory Expands and over a Million Fileobjects with will be +archived, written, replaced, e.t.c) + +b) (Database) +The JPEG Image Information will be stored into a BLOB as Part of a +special Table, where is linked +wit the custid of the primary Usertable. + + From my Point of view is any outside Process (must be created, forked, +Memory allocated, e.t.c) +a bad choice. I think it is generall better to Support the Postmaster in +all Ways and do some +Hardware RAID Configurations. + +>> My Question: +>> Can i speedup my Webapplication if i store my JPEG Images with small +>> sizes inside my PostgreSQL Database (on verry large Databasis over 1 +>> GByte +>> and above without Images at this time!) +> +> +> No. Otherwise the filesystem people would build their filesystems on +> top of PostgreSQL not the other way around. Of course, if you want +> image updates to be part of a database transaction, then it might be +> worth storing them in the database. + +Hmm, ORACLE is going the other Way. All File Objects can be stored into +the Database if the DB +has the IFS Option (Database Filesystem and Fileserver insinde the +Database). + + +> +>> I hope some Peoples can give me a Tip or Hint where in can +>> some usefull Information about it! +> +> Look into having a separate server (process or actual hardware) to +> handle requests for static text and images. Keep the Java server for +> actually processing + + +Thanks + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 06:59:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 24F4253DE5 + for ; + Tue, 26 Apr 2005 06:59:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42018-05 + for ; + Tue, 26 Apr 2005 09:59:26 +0000 (GMT) +Received: from smtp104.mail.sc5.yahoo.com (smtp104.mail.sc5.yahoo.com + [66.163.169.223]) + by svr1.postgresql.org (Postfix) with SMTP id 9FC9753DE0 + for ; + Tue, 26 Apr 2005 06:59:03 -0300 (ADT) +Received: from unknown (HELO ?192.168.2.161?) (apoc9009@84.56.236.162 with + plain) + by smtp104.mail.sc5.yahoo.com with SMTP; 26 Apr 2005 09:58:54 -0000 +Message-ID: <426E108D.7000503@yahoo.de> +Date: Tue, 26 Apr 2005 11:57:33 +0200 +From: "apoc9009@yahoo.de" +Reply-To: apoc9009@yahoo.de +Organization: apoc9009@yahoo.de +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Table Partitioning: Will it be supported in Future? +References: <426DF6C5.1090509@yahoo.de> <426DFA43.5080801@archonet.com> +In-Reply-To: <426DFA43.5080801@archonet.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.864 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: +X-Archive-Number: 200504/695 +X-Sequence-Number: 12092 + +Hmm, + +I have asked some Peoples on the List an some one has posted this links + +http://archives.postgresql.org/pgsql-performance/2004-12/msg00101.php + +It is quite usefull to read but iam not sure thadt theese Trick is verry +helpfull. + +I want to splitt my 1GByte Table into some little Partitions but how +should i do thadt? +With the ORACLE Partitioning Option, i can Configurering my Table withe +Enterprise +Manager or SQL Plus but in this case it looks like Trap. + +Should i really decrease my Tabledata size and spread them to other +Tables with the +same Structure by limiting Records??? + +The next Problem i see, how should i do a Insert/Update/Delete on 4 +Tables of the +same Structure at one Query??? + +No missunderstanding. We talking not about normalization or +restructuring the Colums +of a table. We talking about Partitioning and in this case at Postgres +(emultation +of Partitioning wir UNIONS for Performance tuning).. + + +Josh + + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 11:31:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9404053C73 + for ; + Tue, 26 Apr 2005 11:31:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10256-01 + for ; + Tue, 26 Apr 2005 14:31:18 +0000 (GMT) +Received: from hp.vpac.org (vpac.org [131.170.184.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 0074253B8B + for ; + Tue, 26 Apr 2005 11:31:16 -0300 (ADT) +Received: by hp.vpac.org (Postfix, from userid 557) + id EE648A140DE; Wed, 27 Apr 2005 00:31:18 +1000 (EST) +Received: from localhost (localhost [127.0.0.1]) + by hp.vpac.org (Postfix) with ESMTP id EB7E668103; + Wed, 27 Apr 2005 00:31:18 +1000 (EST) +Date: Wed, 27 Apr 2005 00:31:18 +1000 (EST) +From: "Shoaib Burq (VPAC)" +To: Tom Lane +Cc: John A Meinel , + Russell Smith , Jeff , + +Subject: Re: two queries and dual cpu (perplexed) +In-Reply-To: <24112.1114301405@sss.pgh.pa.us> +Message-ID: +MIME-Version: 1.0 +Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-29508308-1114525878=:22330" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/696 +X-Sequence-Number: 12093 + + This message is in MIME format. The first part should be readable text, + while the remaining parts are likely unreadable without MIME-aware tools. + Send mail to mime@docserver.cac.washington.edu for more info. + +--8323328-29508308-1114525878=:22330 +Content-Type: TEXT/PLAIN; charset=US-ASCII + +OK ... so just to clearify... (and pardon my ignorance): + +I need to increase the value of 'default_statistics_target' variable and +then run VACUUM ANALYZE, right? If so what should I choose for the +'default_statistics_target'? + +BTW I only don't do any sub-selection on the View. + +I have attached the view in question and the output of: +SELECT oid , relname, relpages, reltuples + FROM pg_class ORDER BY relpages DESC; + +reg +shoaib + +On Sat, 23 Apr 2005, Tom Lane wrote: + +> John A Meinel writes: +> > Actually, you probably don't want enable_seqscan=off, you should try: +> > SET enable_nestloop TO off. +> > The problem is that it is estimating there will only be 44 rows, but in +> > reality there are 13M rows. It almost definitely should be doing a +> > seqscan with a sort and merge join. +> +> Not nestloops anyway. +> +> > I don't understand how postgres could get the number of rows that wrong. +> +> No stats, or out-of-date stats is the most likely bet. +> +> > I can't figure out exactly what is where from the formatting, but the query that seems misestimated is: +> > -> Index Scan using "IX_ClimateId" on "ClimateChangeModel40" (cost=0.00..1063711.75 rows=265528 width=20) (actual time=28.311..17212.703 rows=13276368 loops=1) +> > Index Cond: ("outer"."ClimateId" = "ClimateChangeModel40"."ClimateId") +> +> Yeah, that's what jumped out at me too. It's not the full explanation +> for the join number being so far off, but this one at least you have a +> chance to fix by updating the stats on ClimateChangeModel40. +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + +-- +Shoaib Burq +-- +VPAC - Geospatial Applications Developer +Building 91, 110 Victoria Street, +Carlton South, Vic 3053, Australia +_______________________________________________________________ +w: www.vpac.org | e: sab_AT_vpac_DOT_org | mob: +61.431-850039 + + + +--8323328-29508308-1114525878=:22330 +Content-Type: TEXT/plain; name="table_sizes.txt" +Content-Transfer-Encoding: BASE64 +Content-ID: +Content-Description: +Content-Disposition: attachment; filename="table_sizes.txt" + +ICAgIG9pZCAgICB8ICAgICAgICAgICAgIHJlbG5hbWUgICAgICAgICAgICAg +fCByZWxwYWdlcyB8ICByZWx0dXBsZXMgIA0KLS0tLS0tLS0tLS0rLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0rLS0tLS0t +LS0tLS0tLQ0KICAgICAxNjk5NiB8IEN1cnJlbnRBdXNDbGltYXRlICAgICAg +ICAgICAgICAgfCAgIDQ3NDU1MSB8IDguMDY3MzZlKzA3DQogICAgIDE2OTgz +IHwgQ2xpbWF0ZUNoYW5nZU1vZGVsNDAgICAgICAgICAgICB8ICAgMzM4MjUy +IHwgNS4zMTA1NWUrMDcNCiAxNTc4MjE4MTYgfCBQS19DdXJyZW50QXVzQ2xp +bWF0ZSAgICAgICAgICAgIHwgICAyNjU2MjggfCA4LjA2NzM2ZSswNw0KIDE1 +NzgzNTk5NSB8IGlkeF9jbGltYXRlaWQgICAgICAgICAgICAgICAgICAgfCAg +IDE3NjY0NSB8IDguMDY3MzZlKzA3DQogMTU3ODM1OTk2IHwgaWR4X2F1c3Bv +c251bSAgICAgICAgICAgICAgICAgICB8ICAgMTc2NjQ1IHwgOC4wNjczNmUr +MDcNCiAxNTc4MzU5OTcgfCBpZHhfY2xpbWF0ZXZhbHVlICAgICAgICAgICAg +ICAgIHwgICAxNzY2NDUgfCA4LjA2NzM2ZSswNw0KIDE1NzgyMTgwOCB8IFBL +X0NsaW1hdGVNb2RlbENoYW5nZV80MCAgICAgICAgfCAgIDE3NDg1OCB8IDUu +MzEwNTVlKzA3DQogMTU3ODIxNzg4IHwgSVhfaU1vbnRoMDAxICAgICAgICAg +ICAgICAgICAgICB8ICAgMTE2MjgwIHwgNS4zMTA1NWUrMDcNCiAxNTc4MjE3 +ODcgfCBJWF9DbGltYXRlSWQgICAgICAgICAgICAgICAgICAgIHwgICAxMTYy +ODAgfCA1LjMxMDU1ZSswNw0KIDE1NzgyMTc4NiB8IElYX0F1c1Bvc051bWJl +ciAgICAgICAgICAgICAgICAgfCAgIDExNjI4MCB8IDUuMzEwNTVlKzA3DQog +ICAgIDE3MDM0IHwgTmVpZ2hib3VyaG9vZFRhYmxlICAgICAgICAgICAgICB8 +ICAgIDU0MzEyIHwgMS4wMDQ3NmUrMDcNCiAxNTc4MjE4NTQgfCBQS19OZWln +aGJvdXJob29kVGFibGUgICAgICAgICAgIHwgICAgMjc1NTIgfCAxLjAwNDc2 +ZSswNw0KIDE1NzgyMTgwMSB8IElYX05laWdoYm91cmhvb2RJZCAgICAgICAg +ICAgICAgfCAgICAyMjAwMiB8IDEuMDA0NzZlKzA3DQogMTU3ODIxODAwIHwg +SVhfTkF1c1Bvc051bWJlciAgICAgICAgICAgICAgICB8ICAgIDIyMDAyIHwg +MS4wMDQ3NmUrMDcNCiAxNTc4MjE3OTkgfCBJWF9BdXNQb3NOdW1iZXIwMDYg +ICAgICAgICAgICAgIHwgICAgMjIwMDIgfCAxLjAwNDc2ZSswNw0KICAgICAx +NzAxMiB8IEZ1dHVyZUV2YXBNb250aCAgICAgICAgICAgICAgICAgfCAgICAx +MjAyNiB8IDEuMTA2MzZlKzA2DQogICAgIDE3MDE0IHwgRnV0dXJlTWF4VE1v +bnRoICAgICAgICAgICAgICAgICB8ICAgIDEyMDI2IHwgMS4xMDYzNmUrMDYN +CiAgICAgMTcwMTYgfCBGdXR1cmVNaW5UTW9udGggICAgICAgICAgICAgICAg +IHwgICAgMTIwMjYgfCAxLjEwNjM2ZSswNg0KICAgICAxNzAxOCB8IEZ1dHVy +ZVJhaW5Nb250aCAgICAgICAgICAgICAgICAgfCAgICAxMjAyNiB8IDEuMTA2 +MzZlKzA2DQogICAgIDE3MDAwIHwgQ3VycmVudEV2YXBNb250aCAgICAgICAg +ICAgICAgICB8ICAgICA4MjM5IHwgMS4xMjA0N2UrMDYNCiAgICAgMTcwMDIg +fCBDdXJyZW50TWF4VE1vbnRoICAgICAgICAgICAgICAgIHwgICAgIDgyMzkg +fCAxLjEyMDQ3ZSswNg0KICAgICAxNzAwNCB8IEN1cnJlbnRNaW5UTW9udGgg +ICAgICAgICAgICAgICAgfCAgICAgODIzOSB8IDEuMTIwNDdlKzA2DQogICAg +IDE3MDA2IHwgQ3VycmVudFJfUk1vbnRoICAgICAgICAgICAgICAgICB8ICAg +ICA4MjM5IHwgMS4xMjA0N2UrMDYNCiAgICAgMTcwMDggfCBDdXJyZW50UmFk +TW9udGggICAgICAgICAgICAgICAgIHwgICAgIDgyMzkgfCAxLjEyMDQ3ZSsw +Ng0KICAgICAxNzAxMCB8IEN1cnJlbnRSYWluTW9udGggICAgICAgICAgICAg +ICAgfCAgICAgODIzOSB8IDEuMTIwNDdlKzA2DQogICAgIDE2OTc3IHwgQXVz +NDBfREVNICAgICAgICAgICAgICAgICAgICAgICB8ICAgICA2NTkxIHwgMS4x +MjA0N2UrMDYNCiAgICAgMTY5NzkgfCBBdXM0MERlbVJhbmRvbSAgICAgICAg +ICAgICAgICAgIHwgICAgIDYwNTcgfCAxLjEyMDQ3ZSswNg0KICAgICAxNjk4 +MSB8IENsaW1hdGVDaGFuZ2UgICAgICAgICAgICAgICAgICAgfCAgICAgMzc1 +MiB8ICAgICAgNTQzOTg0DQogMTU3ODIxNzgwIHwgSVhfUmFuZG9tICAgICAg +ICAgICAgICAgICAgICAgICB8ICAgICAzMDc1IHwgMS4xMjA0N2UrMDYNCiAx +NTc4MjE4MzIgfCBQS19GdXR1cmVFdmFwTW9udGggICAgICAgICAgICAgIHwg +ICAgIDMwMzYgfCAxLjEwNjM2ZSswNg0KIDE1NzgyMTgzNCB8IFBLX0Z1dHVy +ZU1heFRNb250aCAgICAgICAgICAgICAgfCAgICAgMzAzNiB8IDEuMTA2MzZl +KzA2DQogMTU3ODIxODM2IHwgUEtfRnV0dXJlTWluVE1vbnRoICAgICAgICAg +ICAgICB8ICAgICAzMDM2IHwgMS4xMDYzNmUrMDYNCiAxNTc4MjE4MzggfCBQ +S19GdXR1cmVSYWluTW9udGggICAgICAgICAgICAgIHwgICAgIDMwMzYgfCAx +LjEwNjM2ZSswNg0KIDE1NzgyMTgwNCB8IFBLX0F1czQwRGVtUmFuZG9tICAg +ICAgICAgICAgICAgfCAgICAgMjQ1NiB8IDEuMTIwNDdlKzA2DQogMTU3ODIx +ODAyIHwgUEtfQXVzNDBfREVNICAgICAgICAgICAgICAgICAgICB8ICAgICAy +NDU2IHwgMS4xMjA0N2UrMDYNCiAxNTc4MjE4MjAgfCBQS19DdXJyZW50RXZh +cE1vbnRoICAgICAgICAgICAgIHwgICAgIDI0NTYgfCAxLjEyMDQ3ZSswNg0K +IDE1NzgyMTgyMiB8IFBLX0N1cnJlbnRNYXhUTW9udGggICAgICAgICAgICAg +fCAgICAgMjQ1NiB8IDEuMTIwNDdlKzA2DQogMTU3ODIxODI0IHwgUEtfQ3Vy +cmVudE1pblRNb250aCAgICAgICAgICAgICB8ICAgICAyNDU2IHwgMS4xMjA0 +N2UrMDYNCiAxNTc4MjE4MjYgfCBQS19DdXJyZW50Ul9STW9udGggICAgICAg +ICAgICAgIHwgICAgIDI0NTYgfCAxLjEyMDQ3ZSswNg0KIDE1NzgyMTgyOCB8 +IFBLX0N1cnJlbnRSYWRNb250aCAgICAgICAgICAgICAgfCAgICAgMjQ1NiB8 +IDEuMTIwNDdlKzA2DQogMTU3ODIxODMwIHwgUEtfQ3VycmVudFJhaW5Nb250 +aCAgICAgICAgICAgICB8ICAgICAyNDU2IHwgMS4xMjA0N2UrMDYNCiAxNTc4 +MjE3OTAgfCBJWF9DbGltYXRlTW9kZWxJZDAwMSAgICAgICAgICAgIHwgICAg +IDI0MjUgfCAxLjEwNjM2ZSswNg0KIDE1NzgyMTc4OSB8IElYX0F1c1Bvc051 +bWJlcjAwMSAgICAgICAgICAgICAgfCAgICAgMjQyNSB8IDEuMTA2MzZlKzA2 +DQogMTU3ODIxNzkyIHwgSVhfQ2xpbWF0ZU1vZGVsSWQwMDIgICAgICAgICAg +ICB8ICAgICAyNDI1IHwgMS4xMDYzNmUrMDYNCiAxNTc4MjE3OTEgfCBJWF9B +dXNQb3NOdW1iZXIwMDIgICAgICAgICAgICAgIHwgICAgIDI0MjUgfCAxLjEw +NjM2ZSswNg0KIDE1NzgyMTc5NCB8IElYX0NsaW1hdGVNb2RlbElkMDAzICAg +ICAgICAgICAgfCAgICAgMjQyNSB8IDEuMTA2MzZlKzA2DQogMTU3ODIxNzkz +IHwgSVhfQXVzUG9zTnVtYmVyMDAzICAgICAgICAgICAgICB8ICAgICAyNDI1 +IHwgMS4xMDYzNmUrMDYNCiAxNTc4MjE3OTYgfCBJWF9DbGltYXRlTW9kZWxJ +ZDAwNCAgICAgICAgICAgIHwgICAgIDI0MjUgfCAxLjEwNjM2ZSswNg0KIDE1 +NzgyMTc5NSB8IElYX0F1c1Bvc051bWJlcjAwNCAgICAgICAgICAgICAgfCAg +ICAgMjQyNSB8IDEuMTA2MzZlKzA2DQogMTU3ODIxODA2IHwgUEtfQ2xpbWF0 +ZUNoYW5nZSAgICAgICAgICAgICAgICB8ICAgICAyMzkyIHwgICAgICA1NDM5 +ODQNCiAxNTc4MjE3ODUgfCBJWF9Mb25naXR1ZGUgICAgICAgICAgICAgICAg +ICAgIHwgICAgIDExOTQgfCAgICAgIDU0Mzk4NA0KIDE1NzgyMTc4NCB8IElY +X0xhdGl0dWRlICAgICAgICAgICAgICAgICAgICAgfCAgICAgMTE5NCB8ICAg +ICAgNTQzOTg0DQogMTU3ODIxNzgzIHwgSVhfaU1vbnRoICAgICAgICAgICAg +ICAgICAgICAgICB8ICAgICAxMTk0IHwgICAgICA1NDM5ODQNCiAxNTc4MjE3 +ODIgfCBJWF9DbGltYXRlTW9kZWxJZCAgICAgICAgICAgICAgIHwgICAgIDEx +OTQgfCAgICAgIDU0Mzk4NA0KIDE1NzgyMTc4MSB8IElYX0NsaW1hdGVDSWQg +ICAgICAgICAgICAgICAgICAgfCAgICAgMTE5NCB8ICAgICAgNTQzOTg0DQog +ICAgIDE3MDI2IHwgSW5wdXREYXRhUG9pbnRzICAgICAgICAgICAgICAgICB8 +ICAgICAgMzU0IHwgICAgICAgNDAwMDANCiAgICAgMTY2NDAgfCBwZ19wcm9j +X3Byb25hbWVfYXJnc19uc3BfaW5kZXggIHwgICAgICAxMjUgfCAgICAgICAg +MTQ5Mg0KIDE1NzgyMTg0NiB8IFBLX0lucHV0RGF0YVBvaW50cyAgICAgICAg +ICAgICAgfCAgICAgIDExMiB8ICAgICAgIDQwMDAwDQogMTU3ODIxNzk4IHwg +SVhfQ2xpbWF0ZUlkMDAxICAgICAgICAgICAgICAgICB8ICAgICAgIDkwIHwg +ICAgICAgNDAwMDANCiAxNTc4MjE3OTcgfCBJWF9BdXNQb3NOdW1iZXIwMDUg +ICAgICAgICAgICAgIHwgICAgICAgOTAgfCAgICAgICA0MDAwMA0KICAgICAg +MTI1NSB8IHBnX3Byb2MgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAg +ICA1OCB8ICAgICAgICAxNDkyDQogICAgIDE2NjA4IHwgcGdfYXR0cmlidXRl +X3JlbGlkX2F0dG5hbV9pbmRleCB8ICAgICAgIDQ3IHwgICAgICAgIDE3MzIN +CiAgICAgIDEyNDkgfCBwZ19hdHRyaWJ1dGUgICAgICAgICAgICAgICAgICAg +IHwgICAgICAgMzEgfCAgICAgICAgMTczMg0KICAgICAxNjU5OCB8IHBnX2Rl +cGVuZCAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAyNiB8ICAgICAg +ICAzNDg1DQogICAgIDE2NjIzIHwgcGdfZGVwZW5kX3JlZmVyZW5jZV9pbmRl +eCAgICAgICB8ICAgICAgIDIxIHwgICAgICAgIDM0ODUNCiAgICAgMTcwNDAg +fCBTcHJlbmdlbGlhTGlzdCAgICAgICAgICAgICAgICAgIHwgICAgICAgMTgg +fCAgICAgICAgMzIxNw0KICAgICAxNjYyMiB8IHBnX2RlcGVuZF9kZXBlbmRl +cl9pbmRleCAgICAgICAgfCAgICAgICAxNyB8ICAgICAgICAzNDg1DQogICAg +IDE2NjEzIHwgcGdfY2xhc3NfcmVsbmFtZV9uc3BfaW5kZXggICAgICB8ICAg +ICAgIDE0IHwgICAgICAgICAyMzINCiAgICAgIDEyNTkgfCBwZ19jbGFzcyAg +ICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgMTMgfCAgICAgICAgIDIz +Mg0KICAgICAxNjM5MiB8IHBnX29wZXJhdG9yICAgICAgICAgICAgICAgICAg +ICAgfCAgICAgICAxMyB8ICAgICAgICAgNjQzDQogICAgIDE2NDE2IHwgcGdf +ZGVzY3JpcHRpb24gICAgICAgICAgICAgICAgICB8ICAgICAgIDEyIHwgICAg +ICAgIDEzOTANCiAgICAgMTY2MDkgfCBwZ19hdHRyaWJ1dGVfcmVsaWRfYXR0 +bnVtX2luZGV4IHwgICAgICAgMTIgfCAgICAgICAgMTczMg0KICAgICAxNjYz +OCB8IHBnX29wZXJhdG9yX29wcm5hbWVfbF9yX25faW5kZXggfCAgICAgICAx +MSB8ICAgICAgICAgNjQzDQogICAgIDE2NjM5IHwgcGdfcHJvY19vaWRfaW5k +ZXggICAgICAgICAgICAgICB8ICAgICAgIDExIHwgICAgICAgIDE0OTINCiAg +ICAgMTY2NzIgfCBwZ190b2FzdF8xNjQxMCAgICAgICAgICAgICAgICAgIHwg +ICAgICAgMTAgfCAgICAgICAgICA0NA0KIDE1NzgyMTg2MCB8IFBLX1NwcmVu +Z2VsaWFMaXN0ICAgICAgICAgICAgICAgfCAgICAgICAxMCB8ICAgICAgICAz +MjE3DQogICAgIDE3MDM2IHwgU2NlbmFyaW9FbWlzc2lvbkxldmVscyAgICAg +ICAgICB8ICAgICAgICA5IHwgICAgICAgIDEzMTENCiAgICAgMTY2MjQgfCBw +Z19kZXNjcmlwdGlvbl9vX2Nfb19pbmRleCAgICAgIHwgICAgICAgIDggfCAg +ICAgICAgMTM5MA0KICAgICAxNjY1MSB8IHBnX3R5cGVfdHlwbmFtZV9uc3Bf +aW5kZXggICAgICAgfCAgICAgICAgNyB8ICAgICAgICAgMjI2DQogICAgIDE2 +MzkwIHwgcGdfaW5kZXggICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAg +ICA3IHwgICAgICAgICAxMTUNCiAxNTc4MjE4NTYgfCBQS19TY2VuYXJpb0Vt +aXNzaW9uTGV2ZWxzICAgICAgIHwgICAgICAgIDcgfCAgICAgICAgMTMxMQ0K +ICAgICAxNjQxMCB8IHBnX3Jld3JpdGUgICAgICAgICAgICAgICAgICAgICAg +fCAgICAgICAgNiB8ICAgICAgICAgIDQ2DQogICAgICAxMjQ3IHwgcGdfdHlw +ZSAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICA1IHwgICAgICAg +ICAyMjYNCiAgICAgMTY0MDggfCBwZ19zdGF0aXN0aWMgICAgICAgICAgICAg +ICAgICAgIHwgICAgICAgIDUgfCAgICAgICAgIDE0Mw0KICAgICAxNjYxMiB8 +IHBnX2NsYXNzX29pZF9pbmRleCAgICAgICAgICAgICAgfCAgICAgICAgNCB8 +ICAgICAgICAgMjMyDQogICAgIDE2NjE4IHwgcGdfY29udmVyc2lvbl9uYW1l +X25zcF9pbmRleCAgICB8ICAgICAgICA0IHwgICAgICAgICAxMTQNCiAgICAg +MTY2MzcgfCBwZ19vcGVyYXRvcl9vaWRfaW5kZXggICAgICAgICAgIHwgICAg +ICAgIDQgfCAgICAgICAgIDY0Mw0KICAgICAxNjY0NSB8IHBnX3N0YXRpc3Rp +Y19yZWxpZF9hdHRfaW5kZXggICAgfCAgICAgICAgNCB8ICAgICAgICAgMTQz +DQogICAgIDE2NjAwIHwgcGdfYWdncmVnYXRlX2Zub2lkX2luZGV4ICAgICAg +ICB8ICAgICAgICAyIHwgICAgICAgICAgNjANCiAgICAgMTY2MDEgfCBwZ19h +bV9uYW1lX2luZGV4ICAgICAgICAgICAgICAgIHwgICAgICAgIDIgfCAgICAg +ICAgICAgNA0KICAgICAxNjYwMiB8IHBnX2FtX29pZF9pbmRleCAgICAgICAg +ICAgICAgICAgfCAgICAgICAgMiB8ICAgICAgICAgICA0DQogICAgIDE2NjAz +IHwgcGdfYW1vcF9vcGNfb3ByX2luZGV4ICAgICAgICAgICB8ICAgICAgICAy +IHwgICAgICAgICAxODANCiAgICAgMTY2MDQgfCBwZ19hbW9wX29wY19zdHJh +dGVneV9pbmRleCAgICAgIHwgICAgICAgIDIgfCAgICAgICAgIDE4MA0KICAg +ICAxNjYwNSB8IHBnX2FtcHJvY19vcGNfcHJvY251bV9pbmRleCAgICAgfCAg +ICAgICAgMiB8ICAgICAgICAgIDU3DQogICAgIDE2NjEwIHwgcGdfY2FzdF9v +aWRfaW5kZXggICAgICAgICAgICAgICB8ICAgICAgICAyIHwgICAgICAgICAx +NzQNCiAgICAgMTY2MTEgfCBwZ19jYXN0X3NvdXJjZV90YXJnZXRfaW5kZXgg +ICAgIHwgICAgICAgIDIgfCAgICAgICAgIDE3NA0KICAgICAxNjYxNCB8IHBn +X2NvbnN0cmFpbnRfY29ubmFtZV9uc3BfaW5kZXggfCAgICAgICAgMiB8ICAg +ICAgICAgIDMyDQogICAgIDE2NjE1IHwgcGdfY29uc3RyYWludF9jb25yZWxp +ZF9pbmRleCAgICB8ICAgICAgICAyIHwgICAgICAgICAgMzINCiAgICAgMTY2 +MTYgfCBwZ19jb25zdHJhaW50X29pZF9pbmRleCAgICAgICAgIHwgICAgICAg +IDIgfCAgICAgICAgICAzMg0KICAgICAxNjYxNyB8IHBnX2NvbnZlcnNpb25f +ZGVmYXVsdF9pbmRleCAgICAgfCAgICAgICAgMiB8ICAgICAgICAgMTE0DQog +ICAgIDE2NjE5IHwgcGdfY29udmVyc2lvbl9vaWRfaW5kZXggICAgICAgICB8 +ICAgICAgICAyIHwgICAgICAgICAxMTQNCiAgICAgMTY2MjAgfCBwZ19kYXRh +YmFzZV9kYXRuYW1lX2luZGV4ICAgICAgIHwgICAgICAgIDIgfCAgICAgICAg +ICAgNA0KICAgICAxNjYyMSB8IHBnX2RhdGFiYXNlX29pZF9pbmRleCAgICAg +ICAgICAgfCAgICAgICAgMiB8ICAgICAgICAgICA0DQogICAgIDE2NjI1IHwg +cGdfZ3JvdXBfbmFtZV9pbmRleCAgICAgICAgICAgICB8ICAgICAgICAyIHwg +ICAgICAgICAgIDENCiAgICAgMTY2MjYgfCBwZ19ncm91cF9zeXNpZF9pbmRl +eCAgICAgICAgICAgIHwgICAgICAgIDIgfCAgICAgICAgICAgMQ0KICAgICAx +NjYyNyB8IHBnX2luZGV4X2luZHJlbGlkX2luZGV4ICAgICAgICAgfCAgICAg +ICAgMiB8ICAgICAgICAgMTE1DQogICAgIDE2NjI4IHwgcGdfaW5kZXhfaW5k +ZXhyZWxpZF9pbmRleCAgICAgICB8ICAgICAgICAyIHwgICAgICAgICAxMTUN +CiAgICAgMTY2MzAgfCBwZ19sYW5ndWFnZV9uYW1lX2luZGV4ICAgICAgICAg +IHwgICAgICAgIDIgfCAgICAgICAgICAgMw0KICAgICAxNjYzMSB8IHBnX2xh +bmd1YWdlX29pZF9pbmRleCAgICAgICAgICAgfCAgICAgICAgMiB8ICAgICAg +ICAgICAzDQogICAgIDE2NjMzIHwgcGdfbmFtZXNwYWNlX25zcG5hbWVfaW5k +ZXggICAgICB8ICAgICAgICAyIHwgICAgICAgICAgIDQNCiAgICAgMTY2MzQg +fCBwZ19uYW1lc3BhY2Vfb2lkX2luZGV4ICAgICAgICAgIHwgICAgICAgIDIg +fCAgICAgICAgICAgNA0KICAgICAxNjYzNSB8IHBnX29wY2xhc3NfYW1fbmFt +ZV9uc3BfaW5kZXggICAgfCAgICAgICAgMiB8ICAgICAgICAgIDUxDQogICAg +IDE2NjM2IHwgcGdfb3BjbGFzc19vaWRfaW5kZXggICAgICAgICAgICB8ICAg +ICAgICAyIHwgICAgICAgICAgNTENCiAgICAgMTY2NDEgfCBwZ19yZXdyaXRl +X29pZF9pbmRleCAgICAgICAgICAgIHwgICAgICAgIDIgfCAgICAgICAgICA0 +Ng0KICAgICAxNjY0MiB8IHBnX3Jld3JpdGVfcmVsX3J1bGVuYW1lX2luZGV4 +ICAgfCAgICAgICAgMiB8ICAgICAgICAgIDQ2DQogICAgIDE2NjQzIHwgcGdf +c2hhZG93X3VzZW5hbWVfaW5kZXggICAgICAgICB8ICAgICAgICAyIHwgICAg +ICAgICAgIDMNCiAgICAgMTY2NDQgfCBwZ19zaGFkb3dfdXNlc3lzaWRfaW5k +ZXggICAgICAgIHwgICAgICAgIDIgfCAgICAgICAgICAgMw0KICAgICAxNjY0 +NiB8IHBnX3RyaWdnZXJfdGdjb25zdHJuYW1lX2luZGV4ICAgfCAgICAgICAg +MiB8ICAgICAgICAgICA1DQogICAgIDE2NjQ3IHwgcGdfdHJpZ2dlcl90Z2Nv +bnN0cnJlbGlkX2luZGV4ICB8ICAgICAgICAyIHwgICAgICAgICAgIDUNCiAg +ICAgMTY2NDggfCBwZ190cmlnZ2VyX3RncmVsaWRfdGduYW1lX2luZGV4IHwg +ICAgICAgIDIgfCAgICAgICAgICAgNQ0KICAgICAxNjY0OSB8IHBnX3RyaWdn +ZXJfb2lkX2luZGV4ICAgICAgICAgICAgfCAgICAgICAgMiB8ICAgICAgICAg +ICA1DQogICAgIDE2NjUwIHwgcGdfdHlwZV9vaWRfaW5kZXggICAgICAgICAg +ICAgICB8ICAgICAgICAyIHwgICAgICAgICAyMjYNCiAgICAgMTY2NzQgfCBw +Z190b2FzdF8xNjQxMF9pbmRleCAgICAgICAgICAgIHwgICAgICAgIDIgfCAg +ICAgICAgICA0NA0KICAgICAxNjQxOCB8IHBnX2Nhc3QgICAgICAgICAgICAg +ICAgICAgICAgICAgfCAgICAgICAgMiB8ICAgICAgICAgMTc0DQogICAgIDE2 +NTk2IHwgcGdfY29udmVyc2lvbiAgICAgICAgICAgICAgICAgICB8ICAgICAg +ICAyIHwgICAgICAgICAxMTQNCiAgICAgMTcwNDQgfCBUZW1wbGF0ZXMgICAg +ICAgICAgICAgICAgICAgICAgIHwgICAgICAgIDIgfCAgICAgICAgIDIzOA0K +IDE1NzgyMTgxMCB8IFBLX0NsaW1hdGVJbmRpY2F0b3JzICAgICAgICAgICAg +fCAgICAgICAgMiB8ICAgICAgICAgIDM1DQogMTU3ODIxODEyIHwgUEtfQ2xp +bWF0ZU1vZGVscyAgICAgICAgICAgICAgICB8ICAgICAgICAyIHwgICAgICAg +ICAgMTANCiAxNTc4MjE4MTQgfCBQS19DbGltYXRlVmFyaWFibGVzICAgICAg +ICAgICAgIHwgICAgICAgIDIgfCAgICAgICAgICAgNw0KIDE1NzgyMTg0MCB8 +IFBLX0dldEN1cnJlbnRDbGltYXRlUGFyYW1ldGVycyAgfCAgICAgICAgMiB8 +ICAgICAgICAgICAxDQogMTU3ODIxODQyIHwgUEtfR2V0RnV0dXJlQ2xpbWF0 +ZVBhcmFtZXRlcnMgICB8ICAgICAgICAyIHwgICAgICAgICAgIDENCiAxNTc4 +MjE4NDQgfCBQS19HZXRQb2ludHNMaXN0ICAgICAgICAgICAgICAgIHwgICAg +ICAgIDIgfCAgICAgICAgICAgMQ0KIDE1NzgyMTg0OCB8IFBLX0xldmVscyAg +ICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgMiB8ICAgICAgICAgICAz +DQogMTU3ODIxODUwIHwgUEtfTW9udGhzICAgICAgICAgICAgICAgICAgICAg +ICB8ICAgICAgICAyIHwgICAgICAgICAgMTINCiAxNTc4MjE4NTIgfCBQS19O +ZWlnaGJvdXJEZXNjcmlwdGlvbiAgICAgICAgIHwgICAgICAgIDIgfCAgICAg +ICAgICAgOQ0KIDE1NzgyMTg1OCB8IFBLX1NjZW5hcmlvTmFtZXMgICAgICAg +ICAgICAgICAgfCAgICAgICAgMiB8ICAgICAgICAgIDE4DQogMTU3ODIxODYy +IHwgUEtfWWVhcnMgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAy +IHwgICAgICAgICAgMjMNCiAgICAgIDEyNjEgfCBwZ19ncm91cCAgICAgICAg +ICAgICAgICAgICAgICAgIHwgICAgICAgIDEgfCAgICAgICAgICAgMQ0KICAg +ICAxNjYwNiB8IHBnX2F0dHJkZWZfYWRyZWxpZF9hZG51bV9pbmRleCAgfCAg +ICAgICAgMSB8ICAgICAgICAgICAwDQogICAgIDE2NjA3IHwgcGdfYXR0cmRl +Zl9vaWRfaW5kZXggICAgICAgICAgICB8ICAgICAgICAxIHwgICAgICAgICAg +IDANCiAgICAgMTY2MjkgfCBwZ19pbmhlcml0c19yZWxpZF9zZXFub19pbmRl +eCAgIHwgICAgICAgIDEgfCAgICAgICAgICAgMA0KICAgICAxNjYzMiB8IHBn +X2xhcmdlb2JqZWN0X2xvaWRfcG5faW5kZXggICAgfCAgICAgICAgMSB8ICAg +ICAgICAgICAwDQogICAgIDE2NjU2IHwgcGdfdG9hc3RfMTYzODRfaW5kZXgg +ICAgICAgICAgICB8ICAgICAgICAxIHwgICAgICAgICAgIDANCiAgICAgMTY2 +NTkgfCBwZ190b2FzdF8xNjM4Nl9pbmRleCAgICAgICAgICAgIHwgICAgICAg +IDEgfCAgICAgICAgICAgMA0KICAgICAxNjY2MiB8IHBnX3RvYXN0XzEyNjJf +aW5kZXggICAgICAgICAgICAgfCAgICAgICAgMSB8ICAgICAgICAgICAwDQog +ICAgIDE2Mzk0IHwgcGdfb3BjbGFzcyAgICAgICAgICAgICAgICAgICAgICB8 +ICAgICAgICAxIHwgICAgICAgICAgNTENCiAgICAgMTYzOTYgfCBwZ19hbSAg +ICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgIDEgfCAgICAgICAg +ICAgNA0KICAgICAxNjY2NSB8IHBnX3RvYXN0XzE2NDE2X2luZGV4ICAgICAg +ICAgICAgfCAgICAgICAgMSB8ICAgICAgICAgICAwDQogICAgIDE2NjY4IHwg +cGdfdG9hc3RfMTI2MV9pbmRleCAgICAgICAgICAgICB8ICAgICAgICAxIHwg +ICAgICAgICAgIDANCiAgICAgMTYzOTggfCBwZ19hbW9wICAgICAgICAgICAg +ICAgICAgICAgICAgIHwgICAgICAgIDEgfCAgICAgICAgIDE4MA0KICAgICAx +NjQwMCB8IHBnX2FtcHJvYyAgICAgICAgICAgICAgICAgICAgICAgfCAgICAg +ICAgMSB8ICAgICAgICAgIDU3DQogICAgIDE2NDAyIHwgcGdfbGFuZ3VhZ2Ug +ICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAxIHwgICAgICAgICAgIDMN +CiAgICAgMTY2NzEgfCBwZ190b2FzdF8xMjU1X2luZGV4ICAgICAgICAgICAg +IHwgICAgICAgIDEgfCAgICAgICAgICAgMA0KICAgICAxNjQwNiB8IHBnX2Fn +Z3JlZ2F0ZSAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgMSB8ICAgICAg +ICAgIDYwDQogICAgIDE2NDEyIHwgcGdfdHJpZ2dlciAgICAgICAgICAgICAg +ICAgICAgICB8ICAgICAgICAxIHwgICAgICAgICAgIDUNCiAgICAgMTY1OTQg +fCBwZ19uYW1lc3BhY2UgICAgICAgICAgICAgICAgICAgIHwgICAgICAgIDEg +fCAgICAgICAgICAgNA0KICAgICAxNjY3NyB8IHBnX3RvYXN0XzEyNjBfaW5k +ZXggICAgICAgICAgICAgfCAgICAgICAgMSB8ICAgICAgICAgICAwDQogICAg +ICAxMjYwIHwgcGdfc2hhZG93ICAgICAgICAgICAgICAgICAgICAgICB8ICAg +ICAgICAxIHwgICAgICAgICAgIDMNCiAgICAgMTY2ODAgfCBwZ190b2FzdF8x +NjQwOF9pbmRleCAgICAgICAgICAgIHwgICAgICAgIDEgfCAgICAgICAgICAg +MA0KICAgICAxNjM4NiB8IHBnX2NvbnN0cmFpbnQgICAgICAgICAgICAgICAg +ICAgfCAgICAgICAgMSB8ICAgICAgICAgIDMyDQogICAgICAxMjYyIHwgcGdf +ZGF0YWJhc2UgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAxIHwgICAg +ICAgICAgIDQNCiAgICAgMTcwNDIgfCBUZW1wbGF0ZURlc2NyaXB0aW9ucyAg +ICAgICAgICAgIHwgICAgICAgIDEgfCAgICAgICAgICAxMA0KICAgICAxNjk5 +NCB8IENyZWF0ZWRDbGltYXRlTW9kZWxzICAgICAgICAgICAgfCAgICAgICAg +MSB8ICAgICAgICAgICA5DQogICAgIDE2OTg1IHwgQ2xpbWF0ZUluZGljYXRv +cnMgICAgICAgICAgICAgICB8ICAgICAgICAxIHwgICAgICAgICAgMzUNCiAx +NTc4MzU4OTIgfCBwZ190b2FzdF8xNTc4MzU4ODhfaW5kZXggICAgICAgIHwg +ICAgICAgIDEgfCAgICAgICAgICAgMA0KICAgICAxNjk4NyB8IENsaW1hdGVN +b2RlbHMgICAgICAgICAgICAgICAgICAgfCAgICAgICAgMSB8ICAgICAgICAg +IDEwDQogICAgIDE2OTkyIHwgQ2xpbWF0ZVZhcmlhYmxlcyAgICAgICAgICAg +ICAgICB8ICAgICAgICAxIHwgICAgICAgICAgIDcNCiAxNTc4MjE4MTggfCBQ +S19DdXJyZW50Q2xpbWF0ZVh0YWIyICAgICAgICAgIHwgICAgICAgIDEgfCAg +ICAgICAgICAgMA0KICAgICAxNzAyMCB8IEdldEN1cnJlbnRDbGltYXRlUGFy +YW1ldGVycyAgICAgfCAgICAgICAgMSB8ICAgICAgICAgICAxDQogICAgIDE3 +MDIyIHwgR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRlcnMgICAgICB8ICAgICAg +ICAxIHwgICAgICAgICAgIDENCiAgICAgMTcwMjQgfCBHZXRQb2ludHNMaXN0 +ICAgICAgICAgICAgICAgICAgIHwgICAgICAgIDEgfCAgICAgICAgICAgMQ0K +ICAgICAxNzAyOCB8IExldmVscyAgICAgICAgICAgICAgICAgICAgICAgICAg +fCAgICAgICAgMSB8ICAgICAgICAgICAzDQogICAgIDE3MDMwIHwgTW9udGhz +ICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAxIHwgICAgICAg +ICAgMTINCiAgICAgMTcwMzIgfCBOZWlnaGJvdXJEZXNjcmlwdGlvbiAgICAg +ICAgICAgIHwgICAgICAgIDEgfCAgICAgICAgICAgOQ0KICAgICAxNzAzOCB8 +IFNjZW5hcmlvTmFtZXMgICAgICAgICAgICAgICAgICAgfCAgICAgICAgMSB8 +ICAgICAgICAgIDE4DQogICAgIDE3MDQ2IHwgWWVhcnMgICAgICAgICAgICAg +ICAgICAgICAgICAgICB8ICAgICAgICAxIHwgICAgICAgICAgMjMNCiAgICAg +MTY2ODEgfCBwZ191c2VyICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAg +ICAgIDAgfCAgICAgICAgICAgMA0KICAgICAxNjY4NCB8IHBnX3J1bGVzICAg +ICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAw +DQogICAgIDE2Njg4IHwgcGdfdmlld3MgICAgICAgICAgICAgICAgICAgICAg +ICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAgICAgICAzNzYgfCBwZ194 +YWN0bG9jayAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgIDAgfCAgICAg +ICAgICAgMA0KICAgICAxNjY5MSB8IHBnX3RhYmxlcyAgICAgICAgICAgICAg +ICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQogICAgIDE2Njk0 +IHwgcGdfaW5kZXhlcyAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAw +IHwgICAgICAgICAgIDANCiAgICAgMTY2OTggfCBwZ19zdGF0cyAgICAgICAg +ICAgICAgICAgICAgICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KICAg +ICAxNjcwMiB8IHBnX3N0YXRfYWxsX3RhYmxlcyAgICAgICAgICAgICAgfCAg +ICAgICAgMCB8ICAgICAgICAgICAwDQogICAgIDE2NzA2IHwgcGdfc3RhdF9z +eXNfdGFibGVzICAgICAgICAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAg +IDANCiAgICAgMTY3MDkgfCBwZ19zdGF0X3VzZXJfdGFibGVzICAgICAgICAg +ICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KICAgICAxNjcxMiB8IHBn +X3N0YXRpb19hbGxfdGFibGVzICAgICAgICAgICAgfCAgICAgICAgMCB8ICAg +ICAgICAgICAwDQogICAgIDE2NzE2IHwgcGdfc3RhdGlvX3N5c190YWJsZXMg +ICAgICAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAgICAgMTY3 +MTkgfCBwZ19zdGF0aW9fdXNlcl90YWJsZXMgICAgICAgICAgIHwgICAgICAg +IDAgfCAgICAgICAgICAgMA0KICAgICAxNjcyMiB8IHBnX3N0YXRfYWxsX2lu +ZGV4ZXMgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQog +ICAgIDE2NzI2IHwgcGdfc3RhdF9zeXNfaW5kZXhlcyAgICAgICAgICAgICB8 +ICAgICAgICAwIHwgICAgICAgICAgIDANCiAgICAgMTY3MjkgfCBwZ19zdGF0 +X3VzZXJfaW5kZXhlcyAgICAgICAgICAgIHwgICAgICAgIDAgfCAgICAgICAg +ICAgMA0KICAgICAxNjczMiB8IHBnX3N0YXRpb19hbGxfaW5kZXhlcyAgICAg +ICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQogICAgIDE2NzM2IHwg +cGdfc3RhdGlvX3N5c19pbmRleGVzICAgICAgICAgICB8ICAgICAgICAwIHwg +ICAgICAgICAgIDANCiAgICAgMTY3MzkgfCBwZ19zdGF0aW9fdXNlcl9pbmRl +eGVzICAgICAgICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KICAgICAx +Njc0MiB8IHBnX3N0YXRpb19hbGxfc2VxdWVuY2VzICAgICAgICAgfCAgICAg +ICAgMCB8ICAgICAgICAgICAwDQogICAgIDE2NzQ1IHwgcGdfc3RhdGlvX3N5 +c19zZXF1ZW5jZXMgICAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAgIDAN +CiAgICAgMTY3NDggfCBwZ19zdGF0aW9fdXNlcl9zZXF1ZW5jZXMgICAgICAg +IHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KICAgICAxNjc1MSB8IHBnX3N0 +YXRfYWN0aXZpdHkgICAgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAg +ICAgICAwDQogICAgIDE2NzU0IHwgcGdfc3RhdF9kYXRhYmFzZSAgICAgICAg +ICAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAgICAgMTY3NTcg +fCBwZ19sb2NrcyAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgIDAg +fCAgICAgICAgICAgMA0KICAgICAxNjY1NCB8IHBnX3RvYXN0XzE2Mzg0ICAg +ICAgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQogICAg +IDE2NzYwIHwgcGdfc2V0dGluZ3MgICAgICAgICAgICAgICAgICAgICB8ICAg +ICAgICAwIHwgICAgICAgICAgIDANCiAgICAgMTY2NTcgfCBwZ190b2FzdF8x +NjM4NiAgICAgICAgICAgICAgICAgIHwgICAgICAgIDAgfCAgICAgICAgICAg +MA0KICAgICAxNjM4OCB8IHBnX2luaGVyaXRzICAgICAgICAgICAgICAgICAg +ICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQogICAgIDE2NjYwIHwgcGdf +dG9hc3RfMTI2MiAgICAgICAgICAgICAgICAgICB8ICAgICAgICAwIHwgICAg +ICAgICAgIDANCiAgICAgMTY2NjMgfCBwZ190b2FzdF8xNjQxNiAgICAgICAg +ICAgICAgICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KICAgICAxNjY2 +NiB8IHBnX3RvYXN0XzEyNjEgICAgICAgICAgICAgICAgICAgfCAgICAgICAg +MCB8ICAgICAgICAgICAwDQogICAgIDE2NjY5IHwgcGdfdG9hc3RfMTI1NSAg +ICAgICAgICAgICAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAg +ICAgMTY0MDQgfCBwZ19sYXJnZW9iamVjdCAgICAgICAgICAgICAgICAgIHwg +ICAgICAgIDAgfCAgICAgICAgICAgMA0KICAgICAxNjQxNCB8IHBnX2xpc3Rl +bmVyICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAg +ICAwDQogICAgIDE2Njc1IHwgcGdfdG9hc3RfMTI2MCAgICAgICAgICAgICAg +ICAgICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAgICAgMTY2NzggfCBw +Z190b2FzdF8xNjQwOCAgICAgICAgICAgICAgICAgIHwgICAgICAgIDAgfCAg +ICAgICAgICAgMA0KICAgICAxNjM4NCB8IHBnX2F0dHJkZWYgICAgICAgICAg +ICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQogMTU3ODIx +ODY0IHwgYXVzNm1pbmRlbSAgICAgICAgICAgICAgICAgICAgICB8ICAgICAg +ICAwIHwgICAgICAgICAgIDANCiAxNTc4MjE5MTcgfCBjdXJyZW50bW9udGhy +ICAgICAgICAgICAgICAgICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0K +IDE1NzgyMTg4MSB8IGZpeGF1c2NsaW1hdGVjaGFuZ2UgICAgICAgICAgICAg +fCAgICAgICAgMCB8ICAgICAgICAgICAwDQogMTU3ODIxOTIxIHwgZnV0dXJl +bW9udGhyICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAwIHwgICAgICAg +ICAgIDANCiAxNTc4MjE5MDcgfCBnZXRjdXJyZW50ICAgICAgICAgICAgICAg +ICAgICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KIDE1NzgyMTg3MCB8 +IGdldGN1cnJlbnRjbGltYXRlICAgICAgICAgICAgICAgfCAgICAgICAgMCB8 +ICAgICAgICAgICAwDQogMTU3ODIxOTA0IHwgZ2V0Y3VycmVudGNsaW1hdGVm +b3JjbGluZSAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAxNTc4 +MjE4OTYgfCBnZXRjdXJyZW50Y2xpbWF0ZXJlc3RyaWN0ZWQgICAgIHwgICAg +ICAgIDAgfCAgICAgICAgICAgMA0KIDE1NzgyMTkxMCB8IGdldGZ1dHVyZSAg +ICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAw +DQogMTU3ODIxODg0IHwgZ2V0ZnV0dXJlYXVzY2xpbWF0ZSAgICAgICAgICAg +ICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAxNTc4MjE5MDAgfCBnZXRm +dXR1cmVjbGltYXRlZm9yY2xpbmUgICAgICAgIHwgICAgICAgIDAgfCAgICAg +ICAgICAgMA0KIDE1NzgyMTg5MiB8IGdldGZ1dHVyZWNsaW1hdGVyZXN0cmlj +dGVkICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQogMTU3ODIxOTEz +IHwgZ2V0ZnV0dXJlbW9udGggICAgICAgICAgICAgICAgICB8ICAgICAgICAw +IHwgICAgICAgICAgIDANCiAxNTc4MjE4NjcgfCBsaXN0cG9pbnRzICAgICAg +ICAgICAgICAgICAgICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KIDE1 +NzgyMTg3OCB8IG5vYXVzcG9zbnVtICAgICAgICAgICAgICAgICAgICAgfCAg +ICAgICAgMCB8ICAgICAgICAgICAwDQogMTU3ODIxODc1IHwgc2VsZWN0dW5p +cXVlY2xpbWF0ZXZhbHVlcyAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAg +IDANCiAxNTc4MjE4ODggfCBzZWxlY3R1bmlxdWVmdXR1cmV2YWx1ZXMgICAg +ICAgIHwgICAgICAgIDAgfCAgICAgICAgICAgMA0KIDE1NzgyMTkyOSB8IHNl +bGVjdHVuaXF1ZWhlaWdodHMgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAg +ICAgICAgICAwDQogMTU3ODIxOTI1IHwgc3ByZW5nZWxpYWRhdGEgICAgICAg +ICAgICAgICAgICB8ICAgICAgICAwIHwgICAgICAgICAgIDANCiAxNTc4MzU4 +OTAgfCBwZ190b2FzdF8xNTc4MzU4ODggICAgICAgICAgICAgIHwgICAgICAg +IDAgfCAgICAgICAgICAgMA0KICAgICAxNjk5OCB8IEN1cnJlbnRDbGltYXRl +WHRhYiAgICAgICAgICAgICAgfCAgICAgICAgMCB8ICAgICAgICAgICAwDQoo +MjM1IHJvd3MpDQoNCg== +--8323328-29508308-1114525878=:22330 +Content-Type: TEXT/plain; name="getfutureausclimate_query.txt" +Content-Transfer-Encoding: BASE64 +Content-ID: +Content-Description: +Content-Disposition: attachment; filename="getfutureausclimate_query.txt" + +XGQgImdldGZ1dHVyZWF1c2NsaW1hdGUiDQoNCiAgICAgIFZpZXcgInB1Ymxp +Yy5nZXRmdXR1cmVhdXNjbGltYXRlIg0KICAgIENvbHVtbiAgICB8ICAgICAg +IFR5cGUgICAgICAgfCBNb2RpZmllcnMgDQotLS0tLS0tLS0tLS0tLSstLS0t +LS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0tLS0NCiBDbGltYXRlSWQgICAgfCBz +bWFsbGludCAgICAgICAgIHwgDQogQXVzUG9zTnVtYmVyIHwgaW50ZWdlciAg +ICAgICAgICB8IA0KIGlNb250aCAgICAgICB8IGludGVnZXIgICAgICAgICAg +fCANCiBMb25naXR1ZGUgICAgfCBpbnRlZ2VyICAgICAgICAgIHwgDQogTGF0 +aXR1ZGUgICAgIHwgaW50ZWdlciAgICAgICAgICB8IA0KIEhlaWdodCAgICAg +ICB8IHJlYWwgICAgICAgICAgICAgfCANCiBDbGltYXRlVmFsdWUgfCBzbWFs +bGludCAgICAgICAgIHwgDQogU2NlbmFyaW9JZCAgIHwgaW50ZWdlciAgICAg +ICAgICB8IA0KIGlZZWFyICAgICAgICB8IHNtYWxsaW50ICAgICAgICAgfCAN +CiBMZXZlbElkICAgICAgfCBpbnRlZ2VyICAgICAgICAgIHwgDQogZnV0dXJl +dmFsdWUgIHwgZG91YmxlIHByZWNpc2lvbiB8IA0KDQogDQpDUkVBVEUgT1Ig +UkVQTEFDRSBWSUVXICJwdWJsaWMiLiJnZXRmdXR1cmVhdXNjbGltYXRlIiAo +DQogICAgIkNsaW1hdGVJZCIsDQogICAgIkF1c1Bvc051bWJlciIsDQogICAg +ImlNb250aCIsDQogICAgIkxvbmdpdHVkZSIsDQogICAgIkxhdGl0dWRlIiwN +CiAgICAiSGVpZ2h0IiwNCiAgICAiQ2xpbWF0ZVZhbHVlIiwNCiAgICAiU2Nl +bmFyaW9JZCIsDQogICAgImlZZWFyIiwNCiAgICAiTGV2ZWxJZCIsDQogICAg +ZnV0dXJldmFsdWUpDQpBUw0KU0VMRUNUICJDbGltYXRlVmFyaWFibGVzIi4i +Q2xpbWF0ZUlkIiwgIkF1czQwX0RFTSIuIkF1c1Bvc051bWJlciIsDQogICAg +IkN1cnJlbnRBdXNDbGltYXRlIi4iaU1vbnRoIiwgIkF1czQwX0RFTSIuIkxv +bmdpdHVkZSIsDQogICAgIkF1czQwX0RFTSIuIkxhdGl0dWRlIiwgIkF1czQw +X0RFTSIuIkhlaWdodCIsDQogICAgIkN1cnJlbnRBdXNDbGltYXRlIi4iQ2xp +bWF0ZVZhbHVlIiwNCiAgICAiR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRlcnMi +LiJTY2VuYXJpb0lkIiwNCiAgICAiR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRl +cnMiLiJpWWVhciIsDQogICAgIkdldEZ1dHVyZUNsaW1hdGVQYXJhbWV0ZXJz +Ii4iTGV2ZWxJZCIsDQogICAgKCgoIkN1cnJlbnRBdXNDbGltYXRlIi4iQ2xp +bWF0ZVZhbHVlIik6OmRvdWJsZSBwcmVjaXNpb24gLw0KICAgICJDbGltYXRl +VmFyaWFibGVzIi4iQ2xpbWF0ZURpdmlzb3IiKSArDQogICAgKCJTY2VuYXJp +b0VtaXNzaW9uTGV2ZWxzIi4iVGVtcENoYW5nZSIgKg0KICAgICJDbGltYXRl +Q2hhbmdlTW9kZWw0MCIuIkNoYW5nZVBlckRlZ3JlZSIpKSBBUyBmdXR1cmV2 +YWx1ZQ0KRlJPTSAoKCgiQ3VycmVudEF1c0NsaW1hdGUiIEpPSU4gIkNsaW1h +dGVDaGFuZ2VNb2RlbDQwIiBPTg0KICAgICgoKCgiQ3VycmVudEF1c0NsaW1h +dGUiLiJDbGltYXRlSWQiID0gIkNsaW1hdGVDaGFuZ2VNb2RlbDQwIi4iQ2xp +bWF0ZUlkIikNCiAgICBBTkQgKCJDdXJyZW50QXVzQ2xpbWF0ZSIuIkF1c1Bv +c051bSIgPQ0KICAgICJDbGltYXRlQ2hhbmdlTW9kZWw0MCIuIkF1c1Bvc051 +bWJlciIpKSBBTkQgKCJDdXJyZW50QXVzQ2xpbWF0ZSIuImlNb250aCINCj0N +CiAgICAiQ2xpbWF0ZUNoYW5nZU1vZGVsNDAiLiJpTW9udGgiKSkpKSBKT0lO +ICgiQ2xpbWF0ZVZhcmlhYmxlcyIgSk9JTg0KICAgICgiU2NlbmFyaW9FbWlz +c2lvbkxldmVscyIgSk9JTiAiR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRlcnMi +IE9ODQogICAgKCgoKCJTY2VuYXJpb0VtaXNzaW9uTGV2ZWxzIi4iaVllYXIi +ID0NCiAgICAiR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRlcnMiLiJpWWVhciIp +IEFORA0KICAgICgiU2NlbmFyaW9FbWlzc2lvbkxldmVscyIuIkxldmVsSWQi +ID0NCiAgICAiR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRlcnMiLiJMZXZlbElk +IikpIEFORA0KICAgICgiU2NlbmFyaW9FbWlzc2lvbkxldmVscyIuIlNjZW5h +cmlvSWQiID0NCiAgICAiR2V0RnV0dXJlQ2xpbWF0ZVBhcmFtZXRlcnMiLiJT +Y2VuYXJpb0lkIikpKSkgT04NCiAgICAoKCJDbGltYXRlVmFyaWFibGVzIi4i +Q2xpbWF0ZUlkIiA9DQogICAgIkdldEZ1dHVyZUNsaW1hdGVQYXJhbWV0ZXJz +Ii4iQ2xpbWF0ZUlkIikpKSBPTg0KICAgICgoIkN1cnJlbnRBdXNDbGltYXRl +Ii4iQ2xpbWF0ZUlkIiA9ICJDbGltYXRlVmFyaWFibGVzIi4iQ2xpbWF0ZUlk +IikpKSBKT0lODQogICAgIkF1czQwX0RFTSIgT04gKCgiQ2xpbWF0ZUNoYW5n +ZU1vZGVsNDAiLiJBdXNQb3NOdW1iZXIiID0NCiAgICAiQXVzNDBfREVNIi4i +QXVzUG9zTnVtYmVyIikpKQ0KT1JERVIgQlkgIkF1czQwX0RFTSIuIkF1c1Bv +c051bWJlciIsICJDdXJyZW50QXVzQ2xpbWF0ZSIuImlNb250aCI7DQoNCg== +--8323328-29508308-1114525878=:22330-- + +From pgsql-performance-owner@postgresql.org Tue Apr 26 11:58:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CC0A53A8E + for ; + Tue, 26 Apr 2005 11:58:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17707-09 + for ; + Tue, 26 Apr 2005 14:58:01 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id EC33353517 + for ; + Tue, 26 Apr 2005 11:57:59 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: two queries and dual cpu (perplexed) +Date: Tue, 26 Apr 2005 09:58:00 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184DB@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] two queries and dual cpu (perplexed) +Thread-Index: AcVKbnFwisYem3UmQli137slKdV2ugAAa19w +From: "Dave Held" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.06 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/697 +X-Sequence-Number: 12094 + +> -----Original Message----- +> From: Shoaib Burq (VPAC) [mailto:sab@vpac.org] +> Sent: Tuesday, April 26, 2005 9:31 AM +> To: Tom Lane +> Cc: John A Meinel; Russell Smith; Jeff;=20 +> pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] two queries and dual cpu (perplexed) +>=20 +>=20 +> OK ... so just to clearify... (and pardon my ignorance): +>=20 +> I need to increase the value of 'default_statistics_target'=20 +> variable and then run VACUUM ANALYZE, right? + +Not necessarily. You can set the statistics for a single +column with ALTER TABLE. + +> If so what should I choose for the 'default_statistics_target'? +> [...] + +Since you have a decently large table, go for the max setting +which is 1000. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Tue Apr 26 12:05:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A6B153AA2 + for ; + Tue, 26 Apr 2005 12:05:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20765-08 + for ; + Tue, 26 Apr 2005 15:05:54 +0000 (GMT) +Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu + [129.255.60.186]) + by svr1.postgresql.org (Postfix) with ESMTP id 548C853A12 + for ; + Tue, 26 Apr 2005 12:05:53 -0300 (ADT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) + by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j3QF5X311744; + Tue, 26 Apr 2005 10:05:33 -0500 +Message-ID: <426E58B6.2010607@arbash-meinel.com> +Date: Tue, 26 Apr 2005 10:05:26 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Shoaib Burq (VPAC)" , + pgsql-performance@postgresql.org +Subject: Re: two queries and dual cpu (perplexed) +References: +In-Reply-To: +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig822B4FC0BF096712A2D3800C" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/698 +X-Sequence-Number: 12095 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig822B4FC0BF096712A2D3800C +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Shoaib Burq (VPAC) wrote: +> OK ... so just to clearify... (and pardon my ignorance): +> +> I need to increase the value of 'default_statistics_target' variable and +> then run VACUUM ANALYZE, right? If so what should I choose for the +> 'default_statistics_target'? +> +> BTW I only don't do any sub-selection on the View. +> +> I have attached the view in question and the output of: +> SELECT oid , relname, relpages, reltuples +> FROM pg_class ORDER BY relpages DESC; +> +> reg +> shoaib + +Actually, you only need to alter the statistics for that particular +column, not for all columns in the db. + +What you want to do is: + +ALTER TABLE "ClimateChangeModel40" + ALTER COLUMN + SET STATISTICS 100; +VACUUM ANALYZE "ClimateChangeModel40"; + +The column is just the column that you have the "IX_ClimateId" index on, +I don't know which one that is. + +The statistics value ranges from 1 - 1000, the default being 10, and for +indexed columns you are likely to want somewhere between 100-200. + +If you set it to 100 and the planner is still mis-estimating the number +of rows, try 200, etc. + +The reason to keep the number low is because with a high number the +planner has to spend more time planning. But especially for queries like +this one, you'd rather the query planner spent a little bit more time +planning, and got the right plan. + +John +=:-> + + +--------------enig822B4FC0BF096712A2D3800C +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFCbli2JdeBCYSNAAMRAiXeAKCVM0Ztv+uS4M3QVpvOlAmLNDUG1gCgqXO4 +NDf1CoRgLcG6zRcfGonU844= +=q+fT +-----END PGP SIGNATURE----- + +--------------enig822B4FC0BF096712A2D3800C-- + +From pgsql-performance-owner@postgresql.org Tue Apr 26 12:54:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 76C8C535AE + for ; + Tue, 26 Apr 2005 12:54:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35544-03 + for ; + Tue, 26 Apr 2005 15:53:53 +0000 (GMT) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.186]) + by svr1.postgresql.org (Postfix) with ESMTP id 90DC95356D + for ; + Tue, 26 Apr 2005 12:53:49 -0300 (ADT) +Received: from p508193B2.dip0.t-ipconnect.de[80.129.147.178] + (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de with ESMTP (Nemesis), + id 0MKwtQ-1DQSNg1Xdw-0008JE; Tue, 26 Apr 2005 17:53:48 +0200 +Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) + id 1DQSNe-0008Ku-Vh; Tue, 26 Apr 2005 17:53:47 +0200 +Message-ID: <426E640A.9060409@pse-consulting.de> +Date: Tue, 26 Apr 2005 15:53:46 +0000 +From: Andreas Pflug +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: apoc9009@yahoo.de +Cc: pgsql-performance@postgresql.org +Subject: Re: Table Partitioning: Will it be supported in Future? +References: <426DF6C5.1090509@yahoo.de> <426DFA43.5080801@archonet.com> + <426E108D.7000503@yahoo.de> +In-Reply-To: <426E108D.7000503@yahoo.de> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/699 +X-Sequence-Number: 12096 + +apoc9009@yahoo.de wrote: +> Hmm, +> +> I have asked some Peoples on the List an some one has posted this links +> +> http://archives.postgresql.org/pgsql-performance/2004-12/msg00101.php +> +> It is quite usefull to read but iam not sure thadt theese Trick is verry +> helpfull. +> +> I want to splitt my 1GByte Table into some little Partitions but how +> should i do thadt? +> With the ORACLE Partitioning Option, i can Configurering my Table withe +> Enterprise +> Manager or SQL Plus but in this case it looks like Trap. +> +> Should i really decrease my Tabledata size and spread them to other +> Tables with the +> same Structure by limiting Records??? +> +> The next Problem i see, how should i do a Insert/Update/Delete on 4 +> Tables of the +> same Structure at one Query??? +> +> No missunderstanding. We talking not about normalization or +> restructuring the Colums +> of a table. We talking about Partitioning and in this case at Postgres +> (emultation +> of Partitioning wir UNIONS for Performance tuning).. + + From your description I don't see evidence that you should need to +partition your table at all. A 1GB table is very common for pgsql. Spend +some hard disks on your storage subsystem and you'll gain the +performance you want, without trouble on the SQL side. For specific +requirements, you might see improvements from partial indexes. + +Regards, +Andreas + +From pgsql-performance-owner@postgresql.org Tue Apr 26 13:59:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A24153809 + for ; + Tue, 26 Apr 2005 13:59:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54574-03 + for ; + Tue, 26 Apr 2005 16:59:08 +0000 (GMT) +Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 13C575380B + for ; + Tue, 26 Apr 2005 13:59:07 -0300 (ADT) +Received: from imail01.arbinet.com (localhost [127.0.0.1]) + by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j3QGBulO017730 + for ; Tue, 26 Apr 2005 16:11:56 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j3QGButH017726 + for ; Tue, 26 Apr 2005 16:11:56 GMT +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="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Table Partitioning: Will it be supported in Future? +Date: Tue, 26 Apr 2005 16:58:31 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Table Partitioning: Will it be supported in Future? +Thread-Index: AcVKgCOMLSjZhvTBSgKKaJG76dflogAAPmZQ +From: "Mohan, Ross" +To: +X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.124 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/701 +X-Sequence-Number: 12098 + +Maybe he needs to spend $7K on performance improvements?=20 + +;-) + + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Josh Berkus +Sent: Tuesday, April 26, 2005 8:00 PM +To: Richard Huxton +Cc: apoc9009@yahoo.de; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Table Partitioning: Will it be supported in = +Future? + + +Richard, + +> I believe these are being worked on at the moment. You might want to=20 +> search the archives of the hackers mailing list to see if the plans=20 +> will suit your needs. + +Actually, this is being discussed through the Bizgres project:=20 +www.bizgres.org. + +However, I agree that a 1GB table is not in need of partitioning. + +--=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +---------------------------(end of broadcast)--------------------------- +TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org + +From pgsql-performance-owner@postgresql.org Tue Apr 26 14:50:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 05F41538AC + for ; + Tue, 26 Apr 2005 14:50:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67373-04 + for ; + Tue, 26 Apr 2005 17:50:04 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E1A8536BC + for ; + Tue, 26 Apr 2005 14:50:03 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Tue, 26 Apr 2005 10:53:09 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Tue, 26 Apr 2005 10:53:05 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005042610530431116 + for ; + Tue, 26 Apr 2005 10:53:04 -0700 +X-ASG-Debug-ID: 1114537799-23911-23-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail2 (mail2.hq.corp [192.168.160.6]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 3C2912012BA1 + for ; + Tue, 26 Apr 2005 10:49:59 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.1830); Tue, 26 Apr 2005 10:53:02 -0700 +Message-ID: <426E7F3A.8000500@sfnet.cc> +Date: Tue, 26 Apr 2005 10:49:46 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Thomas F.O'Connell" +Cc: PgSQL - Performance +X-ASG-Orig-Subj: Re: [PERFORM] pgbench Comparison of 7.4.7 to 8.0.2 +Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2 +References: <2784476415a96bb0912ebca41edb3d84@sitening.com> + <6865.1113600214@sss.pgh.pa.us> + + <426C9508.8030902@sfnet.cc> + <02c5560a910870da3637b6ff791e3a80@sitening.com> + <426D265F.9080902@sfnet.cc> + +In-Reply-To: +Content-Type: text/plain; charset=windows-1252; format=flowed +X-OriginalArrivalTime: 26 Apr 2005 17:53:02.0788 (UTC) + FILETIME=[CAC59040:01C54A88] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.571 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5000] +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.182 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/702 +X-Sequence-Number: 12099 + +Tom, + +Honestly, you've got me. It was either comment from Tom Lane or Josh=20 +that the os is caching the results (I may not be using the right terms=20 +here), so I thought it the database is dropped and recreated, I would=20 +see less of a skew (or variation) in the results. Someone which to commen= +t? + +Steve Poe + + +Thomas F.O'Connell wrote: + +> Considering the default vacuuming behavior, why would this be? +> +> -tfo +> +> --=20 +> Thomas F. O'Connell +> Co-Founder, Information Architect +> Sitening, LLC +> +> Strategic Open Source: Open Your i=E2=84=A2 +> +> http://www.sitening.com/ +> 110 30th Avenue North, Suite 6 +> Nashville, TN 37203-6320 +> 615-260-0005 +> +> On Apr 25, 2005, at 12:18 PM, Steve Poe wrote: +> +>> Tom, +>> +>> Just a quick thought: after each run/sample of pgbench, I drop the=20 +>> database and recreate it. When I don't my results become more skewed. +>> +>> Steve Poe +> +> + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 20:08:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B9FE540AC + for ; + Tue, 26 Apr 2005 16:53:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97803-09 + for ; + Tue, 26 Apr 2005 19:53:03 +0000 (GMT) +Received: from sj1-exch-01.us.corp.kailea.com (mail.ragingnet.net + [209.249.149.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 13568539BF + for ; + Tue, 26 Apr 2005 16:52:52 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Subject: Re: What needs to be done for real Partitioning? +Date: Tue, 26 Apr 2005 12:52:53 -0700 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] What needs to be done for real Partitioning? +Thread-Index: AcUu1NBDPrsrJVggQy68b3wV4PM2cQbxCsYw +From: "Roger Hand" +To: "Hannu Krosing" , "Tom Lane" +Cc: "Alvaro Herrera" , + "PFC" , + "Josh Berkus" , +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/714 +X-Sequence-Number: 12111 + +On March 21, 2005 8:07 AM, Hannu Krosing wrote: +> On L, 2005-03-19 at 23:47 -0500, Tom Lane wrote: +> > Well, partitioning on the primary key would be Good Enough for 95% = +or +> > 99% of the real problems out there. I'm not excited about adding a +> > large chunk of complexity to cover another few percent. +>=20 +> Are you sure that partitioning on anything else than PK would be +> significantly harder ? +>=20 +> I have a case where I do manual partitioning over start_time +> (timestamp), but the PK is an id from a sequence. They are almost, but +> not exactly in the same order. And I don't think that moving the PK to +> be (start_time, id) just because of "partitioning on PK only" would be = +a +> good design in any way. +>=20 +> So please don't design the system to partition on PK only. + +I agree. I have used table partitioning to implement = +pseudo-partitioning, and I am very pleased with the results so far. Real = +partitioning would be even better, but I am partitioning by timestamp, = +and this is not the PK, and I don't wish to make it one. + +-Roger + +From pgsql-performance-owner@postgresql.org Tue Apr 26 17:17:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ECBC653829 + for ; + Tue, 26 Apr 2005 17:17:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02795-07 + for ; + Tue, 26 Apr 2005 20:16:59 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) + by svr1.postgresql.org (Postfix) with ESMTP id B0989537EA + for ; + Tue, 26 Apr 2005 17:16:57 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so65990wri + for ; + Tue, 26 Apr 2005 13:16:57 -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=HBvTo4hWSpKI3UzcqmxvmxM5WYcZhy1EDEY72if2VOfbpW1+N98vNoGihUWOaWWxut/7U3cJXCPRE77T5JTS3R0x8yUF+wZRJTxjXVXww+VW6Ix+W/WljAVmiICCyyuKl8hhobiBNCLUKB1nHjUa1J27f2RMxXeqdkpNP8if6xo= +Received: by 10.54.78.16 with SMTP id a16mr84201wrb; + Tue, 26 Apr 2005 13:16:57 -0700 (PDT) +Received: by 10.54.22.6 with HTTP; Tue, 26 Apr 2005 13:16:56 -0700 (PDT) +Message-ID: +Date: Tue, 26 Apr 2005 15:16:57 -0500 +From: Matthew Nuzum +Reply-To: newz@bearfruit.org +To: pgsql-performance@postgresql.org +Subject: speed up query with max() and odd estimates +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.336 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/703 +X-Sequence-Number: 12100 + +I have this query that takes a little over 8 min to run: +select client,max(atime) as atime from usage_access where atime >=3D +(select atime - '1 hour'::interval from usage_access order by atime +desc limit 1) group by client; + +I think it can go a lot faster. Any suggestions on improving this? DB +is 7.3.4 I think. (There is no index on client because it is very big +and this data is used infrequently.) + +explain ANALYZE select client,max(atime) as atime from usage_access +where atime >=3D (select atime - '1 hour'::interval from usage_access +order by atime desc limit 1) group by client; + =20 + QUERY PLAN +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +-------------- + Aggregate (cost=3D3525096.28..3620450.16 rows=3D1271385 width=3D20) +(actual time=3D482676.95..482693.69 rows=3D126 loops=3D1) + InitPlan + -> Limit (cost=3D0.00..0.59 rows=3D1 width=3D8) (actual +time=3D0.40..0.41 rows=3D1 loops=3D1) + -> Index Scan Backward using usage_access_atime on +usage_access (cost=3D0.00..22657796.18 rows=3D38141552 width=3D8) (actual +time=3D0.39..0.40 rows=3D2 loops=3D1) + -> Group (cost=3D3525096.28..3588665.53 rows=3D12713851 width=3D20) +(actual time=3D482676.81..482689.29 rows=3D3343 loops=3D1) + -> Sort (cost=3D3525096.28..3556880.90 rows=3D12713851 +width=3D20) (actual time=3D482676.79..482679.16 rows=3D3343 loops=3D1) + Sort Key: client + -> Seq Scan on usage_access (cost=3D0.00..1183396.40 +rows=3D12713851 width=3D20) (actual time=3D482641.57..482659.18 rows=3D3343 +loops=3D1) + Filter: (atime >=3D $0) + Total runtime: 482694.65 msec + + +I'm starting to understand this, which is quite frightening to me. I +thought that maybe if I shrink the number of rows down I could improve +things a bit, but my first attempt didn't work. I thought I'd replace +the "from usage_access" with this query instead: +select * from usage_access where atime >=3D (select atime - '1 +hour'::interval from usage_access order by atime desc limit 1); + =20 + QUERY PLAN +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +-------------- + Seq Scan on usage_access (cost=3D0.00..1183396.40 rows=3D12713851 +width=3D116) (actual time=3D481796.22..481839.43 rows=3D3343 loops=3D1) + Filter: (atime >=3D $0) + InitPlan + -> Limit (cost=3D0.00..0.59 rows=3D1 width=3D8) (actual +time=3D0.41..0.42 rows=3D1 loops=3D1) + -> Index Scan Backward using usage_access_atime on +usage_access (cost=3D0.00..22657796.18 rows=3D38141552 width=3D8) (actual +time=3D0.40..0.41 rows=3D2 loops=3D1) + Total runtime: 481842.47 msec + +It doesn't look like this will help at all. + +This table is primarily append, however I just recently deleted a few +million rows from the table, if that helps anyone. + +--=20 +Matthew Nuzum +www.bearfruit.org + +From pgsql-performance-owner@postgresql.org Tue Apr 26 17:35:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A9CD954B06; + Tue, 26 Apr 2005 17:35:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09034-10; Tue, 26 Apr 2005 20:35:00 +0000 (GMT) +Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) + by svr1.postgresql.org (Postfix) with ESMTP id 000AA540DC; + Tue, 26 Apr 2005 17:34:56 -0300 (ADT) +Received: from modem-695.lion.dialup.pol.co.uk ([217.135.162.183] + helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DQWlh-00068n-7r; Tue, 26 Apr 2005 21:34:53 +0100 +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +From: Simon Riggs +To: Tom Lane +Cc: josh@agliodbs.com, Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +In-Reply-To: <25382.1114318139@sss.pgh.pa.us> +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> <25382.1114318139@sss.pgh.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Tue, 26 Apr 2005 21:31:38 +0100 +Message-Id: <1114547498.21529.349.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/704 +X-Sequence-Number: 12101 + +On Sun, 2005-04-24 at 00:48 -0400, Tom Lane wrote: +> Josh Berkus writes: +> > Overall, our formula is inherently conservative of n_distinct. That is, I +> > believe that it is actually computing the *smallest* number of distinct +> > values which would reasonably produce the given sample, rather than the +> > *median* one. This is contrary to the notes in analyze.c, which seem to +> > think that we're *overestimating* n_distinct. +> +> Well, the notes are there because the early tests I ran on that formula +> did show it overestimating n_distinct more often than not. Greg is +> correct that this is inherently a hard problem :-( +> +> I have nothing against adopting a different formula, if you can find +> something with a comparable amount of math behind it ... but I fear +> it'd only shift the failure cases around. +> + +Perhaps the formula is not actually being applied? + +The code looks like this... + if (nmultiple == 0) + { + /* If we found no repeated values, assume it's a unique column */ + stats->stadistinct = -1.0; + } + else if (toowide_cnt == 0 && nmultiple == ndistinct) + { + /* + * Every value in the sample appeared more than once. Assume + * the column has just these values. + */ + stats->stadistinct = ndistinct; + } + else + { + /*---------- + * Estimate the number of distinct values using the estimator + * proposed by Haas and Stokes in IBM Research Report RJ 10025: + + +The middle chunk of code looks to me like if we find a distribution +where values all occur at least twice, then we won't bother to apply the +Haas and Stokes equation. That type of frequency distribution would be +very common in a set of values with very high ndistinct, especially when +sampled. + +The comment + * Every value in the sample appeared more than once. Assume + * the column has just these values. +doesn't seem to apply when using larger samples, as Josh is using. + +Looking at Josh's application it does seem likely that when taking a +sample, all site visitors clicked more than once during their session, +especially if they include home page, adverts, images etc for each page. + +Could it be that we have overlooked this simple explanation and that the +Haas and Stokes equation is actually quite good, but just not being +applied? + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 17:40:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 88C8653997; + Tue, 26 Apr 2005 17:40:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10765-10; Tue, 26 Apr 2005 20:40:42 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id BC84953956; + Tue, 26 Apr 2005 17:40:40 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [67.103.46.98] (account josh@agliodbs.com HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7288695; Tue, 26 Apr 2005 13:42:41 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Simon Riggs +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Tue, 26 Apr 2005 13:45:53 -0700 +User-Agent: KMail/1.7.1 +Cc: Tom Lane , Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +References: <200504191209.05181.josh@agliodbs.com> + <25382.1114318139@sss.pgh.pa.us> + <1114547498.21529.349.camel@localhost.localdomain> +In-Reply-To: <1114547498.21529.349.camel@localhost.localdomain> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504261345.54164.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/705 +X-Sequence-Number: 12102 + +Simon, + +> Could it be that we have overlooked this simple explanation and that the +> Haas and Stokes equation is actually quite good, but just not being +> applied? + +That's probably part of it, but I've tried Haas and Stokes on a pure random +sample and it's still bad, or more specifically overly conservative. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Apr 26 17:49:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6308654B0C + for ; + Tue, 26 Apr 2005 17:49:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13394-08 + for ; + Tue, 26 Apr 2005 20:49:01 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B7B0540C2 + for ; + Tue, 26 Apr 2005 17:48:58 -0300 (ADT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1DQWzJ-0008GM-BM + for pgsql-performance@postgresql.org; Tue, 26 Apr 2005 22:48:58 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1DQWzF-0007lA-00 + for ; Tue, 26 Apr 2005 22:48:53 +0200 +Date: Tue, 26 Apr 2005 22:48:53 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: speed up query with max() and odd estimates +Message-ID: <20050426204853.GA29424@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: +X-Operating-System: Linux 2.6.11-rc3 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.017 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/706 +X-Sequence-Number: 12103 + +On Tue, Apr 26, 2005 at 03:16:57PM -0500, Matthew Nuzum wrote: +> Seq Scan on usage_access (cost=0.00..1183396.40 rows=12713851 +> width=116) (actual time=481796.22..481839.43 rows=3343 loops=1) + +That's a gross misestimation -- four orders of magnitude off! + +Have you considering doing this in two steps, first getting out whatever +comes from the subquery and then doing the query? Have you ANALYZEd recently? +Do you have an index on atime? + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Tue Apr 26 18:02:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 724BA5391D + for ; + Tue, 26 Apr 2005 18:02:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16132-09 + for ; + Tue, 26 Apr 2005 21:02:11 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id 1BD985346C + for ; + Tue, 26 Apr 2005 18:02:10 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so80057wri + for ; + Tue, 26 Apr 2005 14:02:12 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=uVAfJHNiXSjosT7VE2vfbrHF8sc8k7PetpdJwGMwN0XuAId34LA1z1A75kzE2LVh3PobA1RshxaNLfTYsmHe7yigkDPR8gx1WH4vOM2YsqPHOvyENnA7VwL4P2sDBhx9yTFdIt6yUQsvxgodvkAm4BmJMo5pYSKlpJRMojp2C0g= +Received: by 10.54.79.8 with SMTP id c8mr109573wrb; + Tue, 26 Apr 2005 14:02:12 -0700 (PDT) +Received: by 10.54.22.6 with HTTP; Tue, 26 Apr 2005 14:02:12 -0700 (PDT) +Message-ID: +Date: Tue, 26 Apr 2005 16:02:12 -0500 +From: Matthew Nuzum +Reply-To: newz@bearfruit.org +To: pgsql-performance@postgresql.org +Subject: Re: speed up query with max() and odd estimates +In-Reply-To: <20050426204853.GA29424@uio.no> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <20050426204853.GA29424@uio.no> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.323 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/707 +X-Sequence-Number: 12104 + +On 4/26/05, Steinar H. Gunderson wrote: +> On Tue, Apr 26, 2005 at 03:16:57PM -0500, Matthew Nuzum wrote: +> > Seq Scan on usage_access (cost=3D0.00..1183396.40 rows=3D12713851 +> > width=3D116) (actual time=3D481796.22..481839.43 rows=3D3343 loops=3D1) +>=20 +> That's a gross misestimation -- four orders of magnitude off! +>=20 +> Have you considering doing this in two steps, first getting out whatever +> comes from the subquery and then doing the query? Have you ANALYZEd recen= +tly? +> Do you have an index on atime? +>=20 + +Yes, there is an index on atime. I'll re-analyze but I'm pretty +certain that runs nightly. + +Regarding two steps, are you suggesting: +begin; +select * into temp_table...; +select * from temp_table...; +drop temp_table; +rollback; + +I have not tried that but will. + +BTW, I created an index on clients just for the heck of it and there +was no improvement. (actually, a slight degradation) + +--=20 +Matthew Nuzum +www.bearfruit.org + +From pgsql-performance-owner@postgresql.org Tue Apr 26 18:06:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C0E735394B; + Tue, 26 Apr 2005 18:06:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18991-01; Tue, 26 Apr 2005 21:06:15 +0000 (GMT) +Received: from cmailm4.svr.pol.co.uk (cmailm4.svr.pol.co.uk [195.92.193.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 549A1534C4; + Tue, 26 Apr 2005 18:06:14 -0300 (ADT) +Received: from modem-581.leopard.dialup.pol.co.uk ([217.135.146.69] + helo=192.168.0.102) by cmailm4.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DQXFg-0002ht-Oq; Tue, 26 Apr 2005 22:05:53 +0100 +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +From: Simon Riggs +To: Tom Lane +Cc: josh@agliodbs.com, Greg Stark , + Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +In-Reply-To: <24355.1114463455@sss.pgh.pa.us> +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> + <1114419467.21529.210.camel@localhost.localdomain> + <19276.1114442580@sss.pgh.pa.us> + <1114454941.21529.245.camel@localhost.localdomain> + <24355.1114463455@sss.pgh.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Tue, 26 Apr 2005 22:02:31 +0100 +Message-Id: <1114549351.21529.363.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/708 +X-Sequence-Number: 12105 + +On Mon, 2005-04-25 at 17:10 -0400, Tom Lane wrote: +> Simon Riggs writes: +> > On Mon, 2005-04-25 at 11:23 -0400, Tom Lane wrote: +> >> It's not just the scan --- you also have to sort, or something like +> >> that, if you want to count distinct values. I doubt anyone is really +> >> going to consider this a feasible answer for large tables. +> +> > Assuming you don't use the HashAgg plan, which seems very appropriate +> > for the task? (...but I understand the plan otherwise). +> +> The context here is a case with a very large number of distinct +> values... + +Yes, but is there another way of doing this other than sampling a larger +proportion of the table? I don't like that answer either, for the +reasons you give. + +The manual doesn't actually say this, but you can already alter the +sample size by setting one of the statistics targets higher, but all of +those samples are fixed sample sizes, not a proportion of the table +itself. It seems reasonable to allow an option to scan a higher +proportion of the table. (It would be even better if you could say "keep +going until you run out of memory, then stop", to avoid needing to have +an external sort mode added to ANALYZE). + +Oracle and DB2 allow a proportion of the table to be specified as a +sample size during statistics collection. IBM seem to be ignoring their +own research note on estimating ndistinct... + +> keep in mind also that we have to do this for *all* the +> columns of the table. + +You can collect stats for individual columns. You need only use an +option to increase sample size when required. + +Also, if you have a large table and the performance of ANALYZE worries +you, set some fields to 0. Perhaps that should be the default setting +for very long text columns, since analyzing those doesn't help much +(usually) and takes ages. (I'm aware we already don't analyze var length +column values > 1024 bytes). + +> A full-table scan for each column seems +> right out to me. + +Some systems analyze multiple columns simultaneously. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 20:08:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C7B0553583; + Tue, 26 Apr 2005 18:42:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27059-01; Tue, 26 Apr 2005 21:41:50 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id 6CBC353218; + Tue, 26 Apr 2005 18:41:49 -0300 (ADT) +Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com + [24.211.165.134]) (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j3QKqkA23724; + Tue, 26 Apr 2005 15:52:46 -0500 +Message-ID: <426EB580.9040606@dunslane.net> +Date: Tue, 26 Apr 2005 17:41:20 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.7) Gecko/20050417 Fedora/1.7.7-1.3.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Simon Riggs +Cc: Tom Lane , josh@agliodbs.com, + Greg Stark , Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <200504221336.08325.josh@agliodbs.com> + <8764ydapky.fsf@stark.xeocode.com> + <200504231639.11897.josh@agliodbs.com> + <25382.1114318139@sss.pgh.pa.us> + <1114547498.21529.349.camel@localhost.localdomain> +In-Reply-To: <1114547498.21529.349.camel@localhost.localdomain> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/716 +X-Sequence-Number: 12113 + + + +Simon Riggs wrote: + +>The comment +> * Every value in the sample appeared more than once. Assume +> * the column has just these values. +>doesn't seem to apply when using larger samples, as Josh is using. +> +>Looking at Josh's application it does seem likely that when taking a +>sample, all site visitors clicked more than once during their session, +>especially if they include home page, adverts, images etc for each page. +> +>Could it be that we have overlooked this simple explanation and that the +>Haas and Stokes equation is actually quite good, but just not being +>applied? +> +> +> +> + +No, it is being aplied. If every value in the sample appears more than +once, then f1 in the formula is 0, and the result is then just d, the +number of distinct values in the sample. + +cheers + +andrew + +From pgsql-performance-owner@postgresql.org Tue Apr 26 19:05:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B34F5443F + for ; + Tue, 26 Apr 2005 19:05:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32160-07 + for ; + Tue, 26 Apr 2005 22:05:30 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 700205432F + for ; + Tue, 26 Apr 2005 19:04:54 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3QM4YFI015126; (envelope-from ) Tue, + 26 Apr 2005 17:04:44 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3QLpKgb025671 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Tue, + 26 Apr 2005 16:51:22 -0500 (CDT) +Message-ID: <426EB7CD.2020406@arbash-meinel.com> +Date: Tue, 26 Apr 2005 16:51:09 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: newz@bearfruit.org, pgsql-performance@postgresql.org +Subject: Re: speed up query with max() and odd estimates +References: +In-Reply-To: +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigB672E1323B3B3F39A71B5418" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/710 +X-Sequence-Number: 12107 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigB672E1323B3B3F39A71B5418 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Matthew Nuzum wrote: +> I have this query that takes a little over 8 min to run: +> select client,max(atime) as atime from usage_access where atime >= +> (select atime - '1 hour'::interval from usage_access order by atime +> desc limit 1) group by client; +> +> I think it can go a lot faster. Any suggestions on improving this? DB +> is 7.3.4 I think. (There is no index on client because it is very big +> and this data is used infrequently.) +Switch to Postgres 8.0.2 :) + +Actually, I think one problem that you are running into is that postgres +(at least used to) has problems with selectivity of date fields when +using a non-constant parameter. + +So it isn't switching over to using an index, even though you are +restricting the access time. + +I would guess that creating a multi-column index on (client, atime) +*might* get you the best performance. + +Try adding the index, and then doing this query: + +select atime from usage_access where client = + order by atime desc limit 1; + +If you can get that query to use an index, then you can put it in a +loop. Something like: + +CREATE FUNCTION last_client_access() RETURNS SETOF time AS ' +DECLARE + client_id INT; + client_time TIME; +BEGIN + FOR client_id IN SELECT id FROM LOOP + SELECT INTO client_time atime FROM usage_access + WHERE client = client_id + ORDER BY atime DESC LIMIT 1; + RETURN NEXT client_time; + END LOOP; +END; +' LANGUAGE plpgsql; + +If you really need high speed, you could create a partial index for each +client id, something like: +CREATE INDEX usage_access_atime_client1_idx ON usage_access(atime) + WHERE client = client1; + +But that is a lot of indexes to maintain. + +I'm hoping that the multi-column index would be enough. + +You might also try something like: + +SELECT client, max(atime) FROM usage_access + WHERE atime > now - '1 hour'::interval + GROUP BY client; + +now is more of a constant, so postgres might have a better time figuring +out the selectivity. I don't know your table, but I assume you are +constantly inserting new rows, and the largest atime value will be close +to now(). Remember, in this query (and in your original query) clients +with their last access time > then 1 hour since the max time (of all +clients) will not be shown. (Example, client 1 accessed yesterday, +client 2 accessed right now your original last atime would be today, +which would hide client 1). + +Also, if it is simply a problem of the planner mis-estimating the +selectivity of the row, you can alter the statistics for atime. + +ALTER TABLE usage_access ALTER COLUMN atime SET STATISTICS 1000; + +I'm not really sure what else to try, but you might start there. + +Also, I still recommend upgrading to postgres 8, as I think it handles a +lot of these things better. (7.3 is pretty old). + +John +=:-> + +> +> explain ANALYZE select client,max(atime) as atime from usage_access +> where atime >= (select atime - '1 hour'::interval from usage_access +> order by atime desc limit 1) group by client; +> +> QUERY PLAN +> -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +> Aggregate (cost=3525096.28..3620450.16 rows=1271385 width=20) +> (actual time=482676.95..482693.69 rows=126 loops=1) +> InitPlan +> -> Limit (cost=0.00..0.59 rows=1 width=8) (actual +> time=0.40..0.41 rows=1 loops=1) +> -> Index Scan Backward using usage_access_atime on +> usage_access (cost=0.00..22657796.18 rows=38141552 width=8) (actual +> time=0.39..0.40 rows=2 loops=1) +> -> Group (cost=3525096.28..3588665.53 rows=12713851 width=20) +> (actual time=482676.81..482689.29 rows=3343 loops=1) +> -> Sort (cost=3525096.28..3556880.90 rows=12713851 +> width=20) (actual time=482676.79..482679.16 rows=3343 loops=1) +> Sort Key: client +> -> Seq Scan on usage_access (cost=0.00..1183396.40 +> rows=12713851 width=20) (actual time=482641.57..482659.18 rows=3343 +> loops=1) +> Filter: (atime >= $0) +> Total runtime: 482694.65 msec +> +> +> I'm starting to understand this, which is quite frightening to me. I +> thought that maybe if I shrink the number of rows down I could improve +> things a bit, but my first attempt didn't work. I thought I'd replace +> the "from usage_access" with this query instead: +> select * from usage_access where atime >= (select atime - '1 +> hour'::interval from usage_access order by atime desc limit 1); +> +> QUERY PLAN +> -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +> Seq Scan on usage_access (cost=0.00..1183396.40 rows=12713851 +> width=116) (actual time=481796.22..481839.43 rows=3343 loops=1) +> Filter: (atime >= $0) +> InitPlan +> -> Limit (cost=0.00..0.59 rows=1 width=8) (actual +> time=0.41..0.42 rows=1 loops=1) +> -> Index Scan Backward using usage_access_atime on +> usage_access (cost=0.00..22657796.18 rows=38141552 width=8) (actual +> time=0.40..0.41 rows=2 loops=1) +> Total runtime: 481842.47 msec +> +> It doesn't look like this will help at all. +> +> This table is primarily append, however I just recently deleted a few +> million rows from the table, if that helps anyone. +> + + +--------------enigB672E1323B3B3F39A71B5418 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFCbrfNJdeBCYSNAAMRAvYgAJ9NbgWmv6CEpGdm1CDtnb9BLzAW/ACgmqWS +3cDzn2ySVo6yEU95LYUclI4= +=UTIh +-----END PGP SIGNATURE----- + +--------------enigB672E1323B3B3F39A71B5418-- + +From pgsql-performance-owner@postgresql.org Tue Apr 26 19:01:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BC015338C + for ; + Tue, 26 Apr 2005 19:01:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29945-10 + for ; + Tue, 26 Apr 2005 22:01:05 +0000 (GMT) +Received: from agp.stanford.edu (agp.Stanford.EDU [171.67.73.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 188DD53583 + for ; + Tue, 26 Apr 2005 19:01:01 -0300 (ADT) +Received: from xenon.stanford.edu ([171.64.66.201]) + by agp.stanford.edu with esmtps (TLSv1:DES-CBC3-SHA:168) (Exim 4.43) + id 1DQY6w-0005I6-JA; Tue, 26 Apr 2005 15:00:54 -0700 +Received: from manku (helo=localhost) + by xenon.Stanford.EDU with local-esmtp (Exim 4.50) + id 1DQY6q-0006qE-LN; Tue, 26 Apr 2005 15:00:48 -0700 +Date: Tue, 26 Apr 2005 15:00:48 -0700 (PDT) +From: Gurmeet Manku +To: Simon Riggs +Cc: Tom Lane , , + Greg Stark , Marko Ristola , + pgsql-perform , + , + Utkarsh Srivastava , +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +In-Reply-To: <1114549351.21529.363.camel@localhost.localdomain> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.403 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/709 +X-Sequence-Number: 12106 + + + Hi everybody! + + Perhaps the following papers are relevant to the discussion here + (their contact authors have been cc'd): + + + 1. The following proposes effective algorithms for using block-level + sampling for n_distinct estimation: + + "Effective use of block-level sampling in statistics estimation" + by Chaudhuri, Das and Srivastava, SIGMOD 2004. + + http://www-db.stanford.edu/~usriv/papers/block-sampling.pdf + + + 2. In a single scan, it is possible to estimate n_distinct by using + a very simple algorithm: + + "Distinct sampling for highly-accurate answers to distinct value + queries and event reports" by Gibbons, VLDB 2001. + + http://www.aladdin.cs.cmu.edu/papers/pdfs/y2001/dist_sampl.pdf + + + 3. In fact, Gibbon's basic idea has been extended to "sliding windows" + (this extension is useful in streaming systems like Aurora / Stream): + + "Distributed streams algorithms for sliding windows" + by Gibbons and Tirthapura, SPAA 2002. + + http://home.eng.iastate.edu/~snt/research/tocs.pdf + + + Thanks, + Gurmeet + + ---------------------------------------------------- + Gurmeet Singh Manku Google Inc. + http://www.cs.stanford.edu/~manku (650) 967 1890 + ---------------------------------------------------- + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 19:33:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AAA8853531 + for ; + Tue, 26 Apr 2005 19:33:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36197-10 + for ; + Tue, 26 Apr 2005 22:32:56 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 0789B5355E + for ; + Tue, 26 Apr 2005 19:32:54 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so106050wri + for ; + Tue, 26 Apr 2005 15:32:54 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=COx/EsxSqfuegzNrID7ekqipS0zrUIiYXYhT4tHhjE/r+nd1opcgO1FlpsXk0m13xRnO2fT9/7wxAibpkVGxG8j20WE6aH32z4FUC/j5OvMc1Y6bV8cJztgKj9AI5m5NlnkWda3fa6UY3ILV+KGsU+lVIGZPvOpqjdvEyrnG/ww= +Received: by 10.54.79.8 with SMTP id c8mr177778wrb; + Tue, 26 Apr 2005 15:32:54 -0700 (PDT) +Received: by 10.54.22.6 with HTTP; Tue, 26 Apr 2005 15:32:54 -0700 (PDT) +Message-ID: +Date: Tue, 26 Apr 2005 17:32:54 -0500 +From: Matthew Nuzum +Reply-To: newz@bearfruit.org +To: pgsql-performance@postgresql.org +Subject: Re: speed up query with max() and odd estimates +In-Reply-To: <20050426204853.GA29424@uio.no> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <20050426204853.GA29424@uio.no> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.318 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/711 +X-Sequence-Number: 12108 + +On 4/26/05, Steinar H. Gunderson wrote: +> On Tue, Apr 26, 2005 at 03:16:57PM -0500, Matthew Nuzum wrote: +> > Seq Scan on usage_access (cost=3D0.00..1183396.40 rows=3D12713851 +> > width=3D116) (actual time=3D481796.22..481839.43 rows=3D3343 loops=3D1) +>=20 +> That's a gross misestimation -- four orders of magnitude off! +>=20 +> Have you considering doing this in two steps, first getting out whatever +> comes from the subquery and then doing the query?=20 + +Well, I don't know if the estimates are correct now or not, but I +found that your suggestion of doing it in two steps helped a lot. + +For the archives, here's what made a drastic improvement: + +This batch program had an overhead of 25 min to build hash tables +using the sql queries. It is now down to about 47 seconds. + +The biggest improvements (bringing it down to 9 min) were to get rid +of all instances of `select max(field) from ...` and replacing them +with `select field from ... order by field desc limit 1` + +Then, to get it down to the final 47 seconds I changed this query: +SELECT client,max(atime) as atime from usage_access where atime >=3D +(select atime - '1 hour'::interval from usage_access order by atime +desc limit 1) group by client; + +To these three queries: +SELECT atime - '1 hour'::interval from usage_access order by atime desc lim= +it 1; +SELECT client, atime into temporary table recent_sessions from +usage_access where atime >=3D '%s'; +SELECT client, max(atime) as atime from recent_sessions group by client; + +Thanks for the help. +--=20 +Matthew Nuzum +www.bearfruit.org + +From pgsql-performance-owner@postgresql.org Tue Apr 26 20:08:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A63D535A6; + Tue, 26 Apr 2005 19:43:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37606-09; Tue, 26 Apr 2005 22:43:16 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 624E55296E; + Tue, 26 Apr 2005 19:43:15 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Tue, 26 Apr 2005 17:43:14 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184DE@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks suggested? +Thread-Index: AcVKrC582AH2K9hDT3Kfy4SJxwHiqwABCzNw +From: "Dave Held" +To: "pgsql-perform" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/715 +X-Sequence-Number: 12112 + +> -----Original Message----- +> From: Gurmeet Manku [mailto:manku@CS.Stanford.EDU] +> Sent: Tuesday, April 26, 2005 5:01 PM +> To: Simon Riggs +> Cc: Tom Lane; josh@agliodbs.com; Greg Stark; Marko Ristola; +> pgsql-perform; pgsql-hackers@postgresql.org; Utkarsh Srivastava; +> snt@iastate.edu +> Subject: Re: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks +> suggested? +>=20 +> [...] +> 2. In a single scan, it is possible to estimate n_distinct by using +> a very simple algorithm: +>=20 +> "Distinct sampling for highly-accurate answers to distinct value +> queries and event reports" by Gibbons, VLDB 2001. +>=20 +> http://www.aladdin.cs.cmu.edu/papers/pdfs/y2001/dist_sampl.pdf +>=20 +> [...] + +This paper looks the most promising, and isn't too different=20 +from what I suggested about collecting stats over the whole table +continuously. What Gibbons does is give a hard upper bound on +the sample size by using a logarithmic technique for storing +sample information. His technique appears to offer very good=20 +error bounds and confidence intervals as shown by tests on=20 +synthetic and real data. I think it deserves a hard look from=20 +people hacking the estimator. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-hackers-owner@postgresql.org Tue Apr 26 20:03:19 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 80F0753F95 + for ; + Tue, 26 Apr 2005 20:03:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42836-06 + for ; + Tue, 26 Apr 2005 23:03:15 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E4CA53F68 + for ; + Tue, 26 Apr 2005 20:03:14 -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 1DQZ59-0006Pd-00; Tue, 26 Apr 2005 19:03:07 -0400 +To: Gurmeet Manku +Cc: , +Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested? +References: +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 26 Apr 2005 19:03:07 -0400 +Message-ID: <87u0lt5efo.fsf@stark.xeocode.com> +Lines: 23 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/869 +X-Sequence-Number: 66738 + + +This one looks *really* good. + + http://www.aladdin.cs.cmu.edu/papers/pdfs/y2001/dist_sampl.pdf + +It does require a single full table scan but it works in O(n) time and +constant space and it guarantees the confidence intervals for the estimates it +provides like the histograms do for regular range scans. + +It can even keep enough data to provide estimates for n_distinct when +unrelated predicates are applied. I'm not sure Postgres would want to do this +though; this seems like it's part of the cross-column correlation story more +than the n_distinct story. It seems to require keeping an entire copy of the +sampled record in the stats tables which would be prohibitive quickly in wide +tables (it would be O(n^2) storage in the number of columns) . + +It also seems like a lot of work to implement. Nothing particular that would +be impossible, but it does require storing a moderately complex data +structure. Perhaps Postgres's new support for data structures will make this +easier. + +-- +greg + + +From pgsql-hackers-owner@postgresql.org Wed Apr 27 10:46:53 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 19E41539D5 + for ; + Tue, 26 Apr 2005 20:13:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47602-01 + for ; + Tue, 26 Apr 2005 23:13:06 +0000 (GMT) +Received: from server2.sitesell.com (server2.sitesell.com [216.95.221.3]) + by svr1.postgresql.org (Postfix) with SMTP id 465165377C + for ; + Tue, 26 Apr 2005 20:13:03 -0300 (ADT) +Received: (qmail 6217 invoked by uid 223); 26 Apr 2005 23:13:03 -0000 +Received: from 216.154.15.113 by server2.sitesell.com (envelope-from + , uid 101) with qmail-scanner-1.25 + (clamdscan: 0.81/685. spamassassin: 3.0.1. + Clear:RC:1(216.154.15.113):. + Processed in 0.027557 secs); 26 Apr 2005 23:13:03 -0000 +Received: from 216-154-15-113.dsl.look.ca (216-154-15-113.dsl.look.ca + [216.154.15.113]) by server2.sitesell.com ([216.95.221.3]) + with ESMTP via TCP; 26 Apr 2005 23:13:03 -0000 +Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested? +From: Rod Taylor +To: Greg Stark +Cc: Gurmeet Manku , + pgsql-hackers@postgresql.org +In-Reply-To: <87u0lt5efo.fsf@stark.xeocode.com> +References: + <87u0lt5efo.fsf@stark.xeocode.com> +Content-Type: text/plain +Date: Tue, 26 Apr 2005 19:10:11 -0400 +Message-Id: <1114557011.77587.107.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.2 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/894 +X-Sequence-Number: 66763 + +On Tue, 2005-04-26 at 19:03 -0400, Greg Stark wrote: +> This one looks *really* good. +> +> http://www.aladdin.cs.cmu.edu/papers/pdfs/y2001/dist_sampl.pdf +> +> It does require a single full table scan + +Ack.. Not by default please. + +I have a few large append-only tables (vacuum isn't necessary) which do +need stats rebuilt periodically. + +Lets just say that we've been working hard to upgrade to 8.0 primarily +because pg_dump was taking over 18 hours to make a backup. + +-- +Rod Taylor + + +From pgsql-hackers-owner@postgresql.org Tue Apr 26 20:28:49 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 75E32537E6 + for ; + Tue, 26 Apr 2005 20:28:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50065-07 + for ; + Tue, 26 Apr 2005 23:28:38 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 06A4653580 + for ; + Tue, 26 Apr 2005 20:28:32 -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 1DQZTZ-0006Wk-00; Tue, 26 Apr 2005 19:28:21 -0400 +To: Rod Taylor +Cc: Greg Stark , + Gurmeet Manku , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested? +References: + <87u0lt5efo.fsf@stark.xeocode.com> <1114557011.77587.107.camel@home> +In-Reply-To: <1114557011.77587.107.camel@home> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 26 Apr 2005 19:28:21 -0400 +Message-ID: <87oec15d9m.fsf@stark.xeocode.com> +Lines: 37 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/870 +X-Sequence-Number: 66739 + +Rod Taylor writes: + +> On Tue, 2005-04-26 at 19:03 -0400, Greg Stark wrote: +> > This one looks *really* good. +> > +> > http://www.aladdin.cs.cmu.edu/papers/pdfs/y2001/dist_sampl.pdf +> > +> > It does require a single full table scan +> +> Ack.. Not by default please. +> +> I have a few large append-only tables (vacuum isn't necessary) which do +> need stats rebuilt periodically. + +The algorithm can also naturally be implemented incrementally. Which would be +nice for your append-only tables. But that's not Postgres's current philosophy +with statistics. Perhaps some trigger function that you could install yourself +to update statistics for a newly inserted record would be useful. + + +The paper is pretty straightforward and easy to read, but here's an executive +summary: + +The goal is to gather a uniform sample of *distinct values* in the table as +opposed to a sample of records. + +Instead of using a fixed percentage sampling rate for each record, use a hash +of the value to determine whether to include it. At first include everything, +but if the sample space overflows throw out half the values based on their +hash value. Repeat until finished. + +In the end you'll have a sample of 1/2^n of your distinct values from your +entire data set where n is large enough for you sample to fit in your +predetermined constant sample space. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 13:48:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 19C24537B3 + for ; + Tue, 26 Apr 2005 13:48:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49803-09 + for ; + Tue, 26 Apr 2005 16:48:32 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 4482F535D3 + for ; + Tue, 26 Apr 2005 13:48:31 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7287600; Tue, 26 Apr 2005 09:50:30 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Richard Huxton +Subject: Re: Table Partitioning: Will it be supported in Future? +Date: Tue, 26 Apr 2005 17:00:13 -0700 +User-Agent: KMail/1.8 +Cc: apoc9009@yahoo.de, pgsql-performance@postgresql.org +References: <426DF6C5.1090509@yahoo.de> <426DFA43.5080801@archonet.com> +In-Reply-To: <426DFA43.5080801@archonet.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504261700.14108.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.611 tagged_above=0 required=5 tests=AWL, + DATE_IN_FUTURE_06_12 +X-Spam-Level: +X-Archive-Number: 200504/700 +X-Sequence-Number: 12097 + +Richard, + +> I believe these are being worked on at the moment. You might want to +> search the archives of the hackers mailing list to see if the plans will +> suit your needs. + +Actually, this is being discussed through the Bizgres project: +www.bizgres.org. + +However, I agree that a 1GB table is not in need of partitioning. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-hackers-owner@postgresql.org Tue Apr 26 21:19:34 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4383A545D0 + for ; + Tue, 26 Apr 2005 21:19:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61279-03 + for ; + Wed, 27 Apr 2005 00:19:23 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id A560C54589 + for ; + Tue, 26 Apr 2005 21:19:21 -0300 (ADT) +Received: from 216-154-15-113.dsl.look.ca (216-154-15-113.dsl.look.ca + [216.154.15.113]) by tht.net (Postfix) with ESMTP + id 1D0BE76A29; Tue, 26 Apr 2005 20:19:30 -0400 (EDT) +Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested? +From: Rod Taylor +To: Greg Stark +Cc: pgsql-hackers@postgresql.org, + Gurmeet Manku +In-Reply-To: <87oec15d9m.fsf@stark.xeocode.com> +References: + <87u0lt5efo.fsf@stark.xeocode.com> <1114557011.77587.107.camel@home> + <87oec15d9m.fsf@stark.xeocode.com> +Content-Type: text/plain +Date: Tue, 26 Apr 2005 20:16:32 -0400 +Message-Id: <1114560992.77587.112.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.2 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/873 +X-Sequence-Number: 66742 + +On Tue, 2005-04-26 at 19:28 -0400, Greg Stark wrote: +> Rod Taylor writes: +> +> > On Tue, 2005-04-26 at 19:03 -0400, Greg Stark wrote: +> > > This one looks *really* good. +> > > +> > > http://www.aladdin.cs.cmu.edu/papers/pdfs/y2001/dist_sampl.pdf +> > > +> > > It does require a single full table scan +> > +> > Ack.. Not by default please. +> > +> > I have a few large append-only tables (vacuum isn't necessary) which do +> > need stats rebuilt periodically. +> +> The algorithm can also naturally be implemented incrementally. Which would be +> nice for your append-only tables. But that's not Postgres's current philosophy +> with statistics. Perhaps some trigger function that you could install yourself +> to update statistics for a newly inserted record would be useful. + +If when we have partitions, that'll be good enough. If partitions aren't +available this would be quite painful to anyone with large tables -- +much as the days of old used to be painful for ANALYZE. + +-- + + +From pgsql-performance-owner@postgresql.org Tue Apr 26 21:42:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F4C954A07 + for ; + Tue, 26 Apr 2005 21:42:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66927-02 + for ; + Wed, 27 Apr 2005 00:42:09 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B20954A01 + for ; + Tue, 26 Apr 2005 21:42:06 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 68so147300wra + for ; + Tue, 26 Apr 2005 17:42:10 -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=g9+KH6lIjibMCNISWkuBzQjNJJQdZ1Ozqu7sW2Lxhb2kyJPDmMka+wg3CyZFn9s4d6zX6ufcOxO549NuBf0yh/6MC0u4n/8oa9iVlbnIRisgMMmO3Vkez2zIP89kw1EEsJsxqKEVl5SKAv3/7OM0PNHdZvW/VDvxi/uSzRHq12g= +Received: by 10.54.125.12 with SMTP id x12mr244561wrc; + Tue, 26 Apr 2005 17:42:10 -0700 (PDT) +Received: by 10.54.150.14 with HTTP; Tue, 26 Apr 2005 17:42:10 -0700 (PDT) +Message-ID: +Date: Wed, 27 Apr 2005 00:42:10 +0000 +From: Mike Rylander +Reply-To: Mike Rylander +To: "Mohan, Ross" +Subject: Re: Table Partitioning: Will it be supported in Future? +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.254 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200504/717 +X-Sequence-Number: 12114 + +On 4/26/05, Mohan, Ross wrote: +> Maybe he needs to spend $7K on performance improvements? +>=20 +> ;-) +>=20 + +AAAAAAAAAAARRRRRRRRRRRGGGGGGGGGGG!!!!!!!!! + +I will forever hate the number 7,000 from this day forth! + +Seriously, though, I've never seen a thread on any list wander on so +aimlessly for so long. + +Please, mommy, make it stop! + +--=20 +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Tue Apr 26 23:47:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E5D7E53730 + for ; + Tue, 26 Apr 2005 23:47:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93107-05 + for ; + Wed, 27 Apr 2005 02:47:15 +0000 (GMT) +Received: from rwcrmhc14.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) + by svr1.postgresql.org (Postfix) with ESMTP id 12ED5535A6 + for ; + Tue, 26 Apr 2005 23:47:13 -0300 (ADT) +Received: from sysexperts.com + (c-24-6-183-218.hsd1.ca.comcast.net[24.6.183.218]) + by comcast.net (rwcrmhc14) with ESMTP + id <200504270246590140074fofe>; Wed, 27 Apr 2005 02:46:59 +0000 +Received: from localhost (localhost [127.0.0.1]) (uid 1000) + by filer with local; Tue, 26 Apr 2005 19:46:52 -0700 + id 0008B6C9.426EFD1C.0000418C +Date: Tue, 26 Apr 2005 19:46:52 -0700 +From: Kevin Brown +To: 'Postgresql Performance' +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Message-ID: <20050427024652.GA6839@filer> +Mail-Followup-To: Kevin Brown , + 'Postgresql Performance' +References: <4266F7B3.7050004@arbash-meinel.com> + <20050423020151.GW58835@decibel.org> <20050423063044.GI19518@filer> + <200504231127.42389.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +In-Reply-To: <200504231127.42389.josh@agliodbs.com> +Organization: Frobozzco International +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/718 +X-Sequence-Number: 12115 + +Josh Berkus wrote: +> Jim, Kevin, +> +> > > Hrm... I was about to suggest that for timing just the query (and not +> > > output/data transfer time) using explain analyze, but then I remembered +> > > that explain analyze can incur some non-trivial overhead with the timing +> > > calls. Is there a way to run the query but have psql ignore the output? +> > > If so, you could use \timing. +> > +> > Would timing "SELECT COUNT(*) FROM (query)" work? +> +> Just \timing would work fine; PostgreSQL doesn't return anything until it has +> the whole result set. + +Hmm...does \timing show the amount of elapsed time between query start +and the first results handed to it by the database (even if the +database itself has prepared the entire result set for transmission by +that time), or between query start and the last result handed to it by +the database? + +Because if it's the latter, then things like server<->client network +bandwidth are going to affect the results that \timing shows, and it +won't necessarily give you a good indicator of how well the database +backend is performing. I would expect that timing SELECT COUNT(*) +FROM (query) would give you an idea of how the backend is performing, +because the amount of result set data that has to go over the wire is +trivial. + +Each is, of course, useful in its own right, and you want to be able +to measure both (so, for instance, you can get an idea of just how +much your network affects the overall performance of your queries). + + +> That's why MSSQL vs. PostgreSQL timing comparisons are +> deceptive unless you're careful: MSSQL returns the results on block at a +> time, and reports execution time as the time required to return the *first* +> block, as opposed to Postgres which reports the time required to return the +> whole dataset. + +Interesting. I had no idea MSSQL did that, but I can't exactly say +I'm surprised. :-) + + +-- +Kevin Brown kevin@sysexperts.com + +From pgsql-hackers-owner@postgresql.org Wed Apr 27 01:14:49 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E597534CC + for ; + Wed, 27 Apr 2005 01:14:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18484-03 + for ; + Wed, 27 Apr 2005 04:14:45 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DFCD353392 + for ; + Wed, 27 Apr 2005 01:14:44 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3R4EaKP017678; + Wed, 27 Apr 2005 00:14:36 -0400 (EDT) +To: Rod Taylor +Cc: Greg Stark , pgsql-hackers@postgresql.org, + Gurmeet Manku +Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested? +In-reply-to: <1114560992.77587.112.camel@home> +References: + <87u0lt5efo.fsf@stark.xeocode.com> + <1114557011.77587.107.camel@home> + <87oec15d9m.fsf@stark.xeocode.com> + <1114560992.77587.112.camel@home> +Comments: In-reply-to Rod Taylor + message dated "Tue, 26 Apr 2005 20:16:32 -0400" +Date: Wed, 27 Apr 2005 00:14:36 -0400 +Message-ID: <17677.1114575276@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/879 +X-Sequence-Number: 66748 + +Rod Taylor writes: +> If when we have partitions, that'll be good enough. If partitions aren't +> available this would be quite painful to anyone with large tables -- +> much as the days of old used to be painful for ANALYZE. + +Yeah ... I am very un-enthused about these suggestions to make ANALYZE +go back to doing a full scan ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Apr 27 02:38:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 68FC35355E; + Wed, 27 Apr 2005 02:38:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38485-08; Wed, 27 Apr 2005 05:38:06 +0000 (GMT) +Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id 287805355C; + Wed, 27 Apr 2005 02:38:05 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net + (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP + id <20050427053804.QYTC17241.priv-edtnes51.telusplanet.net@localhost>; + Tue, 26 Apr 2005 23:38:04 -0600 +Received: from 64.180.225.200 ( [64.180.225.200]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Tue, 26 Apr 2005 22:38:04 -0700 +Message-ID: <1114580284.426f253cc0087@webmail.telus.net> +Date: Tue, 26 Apr 2005 22:38:04 -0700 +From: Mischa Sandberg +To: Andrew Dunstan +Cc: josh@agliodbs.com, pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <19276.1114442580@sss.pgh.pa.us> + <1114454941.21529.245.camel@localhost.localdomain> + <200504251213.18565.josh@agliodbs.com> + <426D565E.8040400@dunslane.net> +In-Reply-To: <426D565E.8040400@dunslane.net> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 64.180.225.200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/719 +X-Sequence-Number: 12116 + +Quoting Andrew Dunstan : + +> After some more experimentation, I'm wondering about some sort of +> adaptive algorithm, a bit along the lines suggested by Marko +Ristola, but limited to 2 rounds. +> +> The idea would be that we take a sample (either of fixed size, or +> some small proportion of the table) , see how well it fits a larger +sample +> > (say a few times the size of the first sample), and then adjust +the > formula accordingly to project from the larger sample the +estimate for the full population. Math not worked out yet - I think we +want to ensure that the result remains bounded by [d,N]. + +Perhaps I can save you some time (yes, I have a degree in Math). If I +understand correctly, you're trying extrapolate from the correlation +between a tiny sample and a larger sample. Introducing the tiny sample +into any decision can only produce a less accurate result than just +taking the larger sample on its own; GIGO. Whether they are consistent +with one another has no relationship to whether the larger sample +correlates with the whole population. You can think of the tiny sample +like "anecdotal" evidence for wonderdrugs. +-- +"Dreams come true, not free." -- S.Sondheim, ITW + + +From pgsql-hackers-owner@postgresql.org Wed Apr 27 02:59:55 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E87565386D + for ; + Wed, 27 Apr 2005 02:59:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44511-07 + for ; + Wed, 27 Apr 2005 05:59:51 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id CE7F553809 + for ; + Wed, 27 Apr 2005 02:59:50 -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 1DQfa6-0007iQ-00; Wed, 27 Apr 2005 01:59:30 -0400 +To: Tom Lane +Cc: Rod Taylor , Greg Stark , + pgsql-hackers@postgresql.org, Gurmeet Manku +Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested? +References: + <87u0lt5efo.fsf@stark.xeocode.com> <1114557011.77587.107.camel@home> + <87oec15d9m.fsf@stark.xeocode.com> <1114560992.77587.112.camel@home> + <17677.1114575276@sss.pgh.pa.us> +In-Reply-To: <17677.1114575276@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 27 Apr 2005 01:59:30 -0400 +Message-ID: <87is2869q5.fsf@stark.xeocode.com> +Lines: 32 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/883 +X-Sequence-Number: 66752 + + +Tom Lane writes: + +> Rod Taylor writes: +> > If when we have partitions, that'll be good enough. If partitions aren't +> > available this would be quite painful to anyone with large tables -- +> > much as the days of old used to be painful for ANALYZE. +> +> Yeah ... I am very un-enthused about these suggestions to make ANALYZE +> go back to doing a full scan ... + +Well one option would be to sample only a small number of records, but add the +data found from those records to the existing statistics. This would make +sense for a steady-state situation, but make it hard to recover from a drastic +change in data distribution. I think in the case of n_distinct it would also +bias the results towards underestimating n_distinct but perhaps that could be +corrected for. + +But I'm unclear for what situation this is a concern. + +For most use cases users have to run vacuum occasionally. In those cases +"vacuum analyze" would be no worse than a straight normal vacuum. Note that +this algorithm doesn't require storing more data because of the large scan or +performing large sorts per column. It's purely O(n) time and O(1) space. + +On the other hand, if you have tables you aren't vacuuming that means you +perform zero updates or deletes. In which case some sort of incremental +statistics updating would be a good solution. A better solution even than +sampling. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 04:48:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 839DD53A62; + Wed, 27 Apr 2005 04:48:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69993-02; Wed, 27 Apr 2005 07:48:32 +0000 (GMT) +Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) + by svr1.postgresql.org (Postfix) with ESMTP id 793C853626; + Wed, 27 Apr 2005 04:48:31 -0300 (ADT) +Received: from modem-3262.lion.dialup.pol.co.uk ([217.135.172.190] + helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DQhHW-0000aW-Dx; Wed, 27 Apr 2005 08:48:26 +0100 +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +From: Simon Riggs +To: Gurmeet Manku +Cc: Tom Lane , josh@agliodbs.com, + Greg Stark , Marko Ristola , + pgsql-perform , + pgsql-hackers@postgresql.org, + Utkarsh Srivastava , snt@iastate.edu +In-Reply-To: +References: +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 27 Apr 2005 08:45:10 +0100 +Message-Id: <1114587910.21529.394.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/720 +X-Sequence-Number: 12117 + +On Tue, 2005-04-26 at 15:00 -0700, Gurmeet Manku wrote: + +> 2. In a single scan, it is possible to estimate n_distinct by using +> a very simple algorithm: +> +> "Distinct sampling for highly-accurate answers to distinct value +> queries and event reports" by Gibbons, VLDB 2001. +> +> http://www.aladdin.cs.cmu.edu/papers/pdfs/y2001/dist_sampl.pdf + +That looks like the one... + +...though it looks like some more complex changes to the current +algorithm to use it, and we want the other stats as well... + +> 3. In fact, Gibbon's basic idea has been extended to "sliding windows" +> (this extension is useful in streaming systems like Aurora / Stream): +> +> "Distributed streams algorithms for sliding windows" +> by Gibbons and Tirthapura, SPAA 2002. +> +> http://home.eng.iastate.edu/~snt/research/tocs.pdf +> + +...and this offers the possibility of calculating statistics at load +time, as part of the COPY command + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 10:31:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E0D9B5398C + for ; + Wed, 27 Apr 2005 10:31:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54007-06 + for ; + Wed, 27 Apr 2005 13:31:38 +0000 (GMT) +Received: from zoom.spline.inf.fu-berlin.de (zoom.spline.inf.fu-berlin.de + [160.45.117.148]) + by svr1.postgresql.org (Postfix) with ESMTP id 565895360E + for ; + Wed, 27 Apr 2005 10:31:37 -0300 (ADT) +Received: by zoom.spline.inf.fu-berlin.de (Postfix, from userid 2091) + id D38628C70F; Wed, 27 Apr 2005 15:31:39 +0200 (CEST) +Date: Wed, 27 Apr 2005 15:31:39 +0200 +From: Yann Michel +To: Tom Lane +Cc: Stacy White , Alvaro Herrera , + PFC , Josh Berkus , + pgsql-performance@postgresql.org +Subject: Re: What needs to be done for real Partitioning? +Message-ID: <20050427133139.GA3700@zoom.spline.inf.fu-berlin.de> +References: <200503191202.38089.josh@agliodbs.com> + <20050319225624.GA8467@dcc.uchile.cl> + <3404.1111277153@sss.pgh.pa.us> + <002a01c52d87$543d1010$0200a8c0@grownups> + <14172.1111359709@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <14172.1111359709@sss.pgh.pa.us> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/721 +X-Sequence-Number: 12118 + +Hi, + +On Sun, Mar 20, 2005 at 06:01:49PM -0500, Tom Lane wrote: +> Global indexes would seriously reduce the performance of both vacuum and +> cluster for a single partition, and if you want seq scans you don't need +> an index for that at all. So the above doesn't strike me as a strong +> argument for global indexes ... + +I'd like to describe a usecase where a global index is usefull. + +We have a datawarehouse with invoices for a rolling window of a few +years. Each invoice has several positions so a uk is +(invoice,position). Dur to the fact that most of the queries are only on +a few months or some quarters of a year, our pk starts with the +time-attribute (followed by the dimension ids) which is the partition +key (range). During the nightly update, we receive each updated invoice +so we have to update that special (global unique) row which is resolved +very fast by using the uk. + +So you can see, that there is a usefull case for providing a global +index while using partitining and local indexes as well. + +Regards, +Yann + +From pgsql-performance-owner@postgresql.org Fri Apr 29 00:03:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A694753F9C; + Wed, 27 Apr 2005 10:44:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59155-01; Wed, 27 Apr 2005 13:43:59 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id 025AE53F7A; + Wed, 27 Apr 2005 10:43:58 -0300 (ADT) +Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com + [24.211.165.134]) (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j3RCt7u26816; + Wed, 27 Apr 2005 07:55:07 -0500 +Message-ID: <426F9703.4010108@dunslane.net> +Date: Wed, 27 Apr 2005 09:43:31 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.7) Gecko/20050417 Fedora/1.7.7-1.3.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Mischa Sandberg +Cc: josh@agliodbs.com, pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <19276.1114442580@sss.pgh.pa.us> + <1114454941.21529.245.camel@localhost.localdomain> + <200504251213.18565.josh@agliodbs.com> + <426D565E.8040400@dunslane.net> + <1114580284.426f253cc0087@webmail.telus.net> +In-Reply-To: <1114580284.426f253cc0087@webmail.telus.net> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/764 +X-Sequence-Number: 12161 + + + +Mischa Sandberg wrote: + +> +>Perhaps I can save you some time (yes, I have a degree in Math). If I +>understand correctly, you're trying extrapolate from the correlation +>between a tiny sample and a larger sample. Introducing the tiny sample +>into any decision can only produce a less accurate result than just +>taking the larger sample on its own; GIGO. Whether they are consistent +>with one another has no relationship to whether the larger sample +>correlates with the whole population. You can think of the tiny sample +>like "anecdotal" evidence for wonderdrugs. +> +> +> + +Ok, good point. + +I'm with Tom though in being very wary of solutions that require even +one-off whole table scans. Maybe we need an additional per-table +statistics setting which could specify the sample size, either as an +absolute number or as a percentage of the table. It certainly seems that +where D/N ~ 0.3, the estimates on very large tables at least are way way +out. + +Or maybe we need to support more than one estimation method. + +Or both ;-) + +cheers + +andrew + + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 12:08:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B9C153EE7 + for ; + Wed, 27 Apr 2005 12:08:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84901-05 + for ; + Wed, 27 Apr 2005 15:08:27 +0000 (GMT) +Received: from amsal01exc01.americatelsal.com (amsal01exc01.americatel.com.sv + [200.13.161.8]) + by svr1.postgresql.org (Postfix) with ESMTP id 1216E53ECB + for ; + Wed, 27 Apr 2005 12:08:26 -0300 (ADT) +Received: by amsal01exc01.americatel.com.sv with Internet Mail Service + (5.5.2657.72) id <2LRJXDFH>; Wed, 27 Apr 2005 08:59:49 -0600 +Message-ID: + <76E0DAA32C39D711B6EC0002B364A6FA0440F82F@amsal01exc01.americatel.com.sv> +From: mmiranda@americatel.com.sv +To: pgsql-performance@postgresql.org +Subject: Re: Final decision +Date: Wed, 27 Apr 2005 08:59:41 -0600 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C54B39.BD8190B2" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.567 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, HTML_60_70, HTML_MESSAGE, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200504/723 +X-Sequence-Number: 12120 + +This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +------_=_NextPart_001_01C54B39.BD8190B2 +Content-Type: text/plain; + charset="iso-8859-1" + + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Joel Fradkin +Sent: Wednesday, April 27, 2005 9:02 AM +To: PostgreSQL Perform +Subject: [PERFORM] Final decision + + + +I spent a great deal of time over the past week looking seriously at +Postgres and MYSQL. + +Objectively I am not seeing that much of an improvement in speed with MYSQL, +and we have a huge investment in postgrs. + +So I am planning on sticking with postgres fro our production database +(going live this weekend). + + + +Many people have offered a great deal of help and I appreciate all that time +and energy. + +I did not find any resolutions to my issues with Commandprompt.com (we only +worked together 2.5 hours). + + + +Most of my application is working about the same speed as MSSQL server +(unfortunately its twice the speed box, but as many have pointed out it +could be an issue with the 4 proc dell). I spent considerable time with Dell +and could see my drives are delivering 40 meg per sec. + + + +Things I still have to make better are my settings in config, I have it set +to no merge joins and no seq scans. + +I am going to have to use flattened history files for reporting (I saw huge +difference here the view for audit cube took 10 minutes in explain analyze +and the flattened file took under one second). + + + +I understand both of these practices are not desirable, but I am at a place +where I have to get it live and these are items I could not resolve. + +I may try some more time with Commanpromt.com, or seek other professional +help. + + + +In stress testing I found Postgres was holding up very well (but my IIS +servers could not handle much of a load to really push the server). + +I have a few desktops acting as IIS servers at the moment and if I pushed +past 50 consecutive users it pretty much blew the server up. + +On inserts that number was like 7 consecutive users and updates was also +like 7 users. + + + +I believe that was totally IIS not postgres, but I am curious as to if using +postgres odbc will put more stress on the IIS side then MSSQL did. + +I did have a question if any folks are using two servers one for reporting +and one for data entry what system should be the beefier? + +I have a 2proc machine I will be using and I can either put Sears off by +themselves on this machine or split up functionality and have one for +reporting and one for inserts and updates; so not sure which machine would +be best for which spot (reminder the more robust is a 4proc with 8 gigs and +2 proc is 4 gigs, both dells). + + + +Thank you for any ideas in this arena. + + + +Joel Fradkin + + + + + + + + + + + + + +You didnt tell us what OS are you using, windows? + +If you want good performance you must install unix on that machine, + + + +--- + + + + + + +------_=_NextPart_001_01C54B39.BD8190B2 +Content-Type: text/html; + charset="iso-8859-1" + + + + + + + + + + +
 
+
+
-----Original Message-----
From: + pgsql-performance-owner@postgresql.org + [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Joel + Fradkin
Sent: Wednesday, April 27, 2005 9:02 AM
To: + PostgreSQL Perform
Subject: [PERFORM] Final + decision

+
+

I spent a great deal of time over + the past week looking seriously at Postgres and MYSQL.

+

Objectively I am not seeing that + much of an improvement in speed with MYSQL, and we have a huge investment in + postgrs.

+

So I am planning on sticking with + postgres fro our production database (going live this + weekend).

+

 

+

Many people have offered a great + deal of help and I appreciate all that time and energy.

+

I did not find any resolutions to + my issues with Commandprompt.com (we only worked together 2.5 + hours).

+

 

+

Most of my application is working + about the same speed as MSSQL server (unfortunately its twice the speed box, + but as many have pointed out it could be an issue with the 4 proc dell). I + spent considerable time with Dell and could see my drives are delivering 40 + meg per sec.

+

 

+

Things I still have to make better + are my settings in config, I have it set to no merge joins and no seq + scans.

+

I am going to have to use + flattened history files for reporting (I saw huge difference here the view for + audit cube took 10 minutes in explain analyze and the flattened file took + under one second).

+

 

+

I understand both of these + practices are not desirable, but I am at a place where I have to get it live + and these are items I could not resolve.

+

I may try some more time with + Commanpromt.com, or seek other professional help.

+

 

+

In stress testing I found Postgres + was holding up very well (but my IIS servers could not handle much of a load + to really push the server).

+

I have a few desktops acting as + IIS servers at the moment and if I pushed past 50 consecutive users it pretty + much blew the server up.

+

On inserts that number was like 7 + consecutive users and updates was also like 7 users.

+

 

+

I believe that was totally IIS not + postgres, but I am curious as to if using postgres odbc will put more stress + on the IIS side then MSSQL did.

+

I did have a question if any folks + are using two servers one for reporting and one for data entry what system + should be the beefier?

+

I have a 2proc machine I will be + using and I can either put Sears off by themselves on this machine or split up + functionality and have one for reporting and one for inserts and updates; so + not sure which machine would be best for which spot (reminder the more robust + is a 4proc with 8 gigs and 2 proc is 4 gigs, both dells).

+

 

+

Thank you for any ideas in this + arena.

+

 

+

Joel Fradkin

+
+

 

+

 

+

 

+

 

+

 

+

 

+

You didnt tell us what + OS are you using, windows?

+

If you want good + performance you must install unix on  that + machine,

+

 

+

---

+

 

+

 

+ +------_=_NextPart_001_01C54B39.BD8190B2-- + +From pgsql-performance-owner@postgresql.org Wed Apr 27 12:01:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 169A153ECB + for ; + Wed, 27 Apr 2005 12:01:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83548-01 + for ; + Wed, 27 Apr 2005 15:01:35 +0000 (GMT) +Received: from mta10.nationwireless.net (mta10.nationwireless.net + [63.163.128.10]) + by svr1.postgresql.org (Postfix) with ESMTP id BDE3F53A3C + for ; + Wed, 27 Apr 2005 12:01:33 -0300 (ADT) +Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with + ESMTP + (SMTPD32-8.15) id A94C359D011C; Wed, 27 Apr 2005 11:01:32 -0400 +From: "Joel Fradkin" +To: "PostgreSQL Perform" +Subject: Final decision +Date: Wed, 27 Apr 2005 11:01:41 -0400 +Message-ID: <000001c54b3a$054d3720$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0001_01C54B18.7E3B9720" +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.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL, HTML_60_70, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200504/722 +X-Sequence-Number: 12119 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0001_01C54B18.7E3B9720 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +I spent a great deal of time over the past week looking seriously at +Postgres and MYSQL. + +Objectively I am not seeing that much of an improvement in speed with = +MYSQL, +and we have a huge investment in postgrs. + +So I am planning on sticking with postgres fro our production database +(going live this weekend). + +=20 + +Many people have offered a great deal of help and I appreciate all that = +time +and energy. + +I did not find any resolutions to my issues with Commandprompt.com (we = +only +worked together 2.5 hours). + +=20 + +Most of my application is working about the same speed as MSSQL server +(unfortunately its twice the speed box, but as many have pointed out it +could be an issue with the 4 proc dell). I spent considerable time with = +Dell +and could see my drives are delivering 40 meg per sec. + +=20 + +Things I still have to make better are my settings in config, I have it = +set +to no merge joins and no seq scans. + +I am going to have to use flattened history files for reporting (I saw = +huge +difference here the view for audit cube took 10 minutes in explain = +analyze +and the flattened file took under one second). + +=20 + +I understand both of these practices are not desirable, but I am at a = +place +where I have to get it live and these are items I could not resolve. + +I may try some more time with Commanpromt.com, or seek other = +professional +help. + +=20 + +In stress testing I found Postgres was holding up very well (but my IIS +servers could not handle much of a load to really push the server). + +I have a few desktops acting as IIS servers at the moment and if I = +pushed +past 50 consecutive users it pretty much blew the server up. + +On inserts that number was like 7 consecutive users and updates was also +like 7 users. + +=20 + +I believe that was totally IIS not postgres, but I am curious as to if = +using +postgres odbc will put more stress on the IIS side then MSSQL did. + +I did have a question if any folks are using two servers one for = +reporting +and one for data entry what system should be the beefier? + +I have a 2proc machine I will be using and I can either put Sears off by +themselves on this machine or split up functionality and have one for +reporting and one for inserts and updates; so not sure which machine = +would +be best for which spot (reminder the more robust is a 4proc with 8 gigs = +and +2 proc is 4 gigs, both dells). + +=20 + +Thank you for any ideas in this arena. + +=20 + +Joel Fradkin + +=20 + +=20 + +=20 + + +------=_NextPart_000_0001_01C54B18.7E3B9720 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + + + +
+ +

I spent a great deal of time over the past week = +looking +seriously at Postgres and MYSQL.

+ +

Objectively I am not seeing that much of an = +improvement in +speed with MYSQL, and we have a huge investment in = +postgrs.

+ +

So I am planning on sticking with postgres fro our +production database (going live this weekend).

+ +

 

+ +

Many people have offered a great deal of help and I +appreciate all that time and energy.

+ +

I did not find any resolutions to my issues with +Commandprompt.com (we only worked together 2.5 hours).

+ +

 

+ +

Most of my application is working about the same = +speed as +MSSQL server (unfortunately its twice the speed box, but as many have = +pointed +out it could be an issue with the 4 proc dell). I spent considerable = +time with +Dell and could see my drives are delivering 40 meg per = +sec.

+ +

 

+ +

Things I still have to make better are my settings in = +config, +I have it set to no merge joins and no seq scans.

+ +

I am going to have to use flattened history files for +reporting (I saw huge difference here the view for audit cube took 10 = +minutes +in explain analyze and the flattened file took under one = +second).

+ +

 

+ +

I understand both of these practices are not = +desirable, but +I am at a place where I have to get it live and these are items I could = +not +resolve.

+ +

I may try some more time with Commanpromt.com, or = +seek other +professional help.

+ +

 

+ +

In stress testing I found Postgres was holding up = +very well +(but my IIS servers could not handle much of a load to really push the = +server).

+ +

I have a few desktops acting as IIS servers at the = +moment +and if I pushed past 50 consecutive users it pretty much blew the server = +up.

+ +

On inserts that number was like 7 consecutive users = +and +updates was also like 7 users.

+ +

 

+ +

I believe that was totally IIS not postgres, but I am +curious as to if using postgres odbc will put more stress on the IIS = +side then +MSSQL did.

+ +

I did have a question if any folks are using two = +servers one +for reporting and one for data entry what system should be the = +beefier?

+ +

I have a 2proc machine I will be using and I can = +either put +Sears off by themselves on this machine or split up functionality and = +have one +for reporting and one for inserts and updates; so not sure which machine = +would +be best for which spot (reminder the more robust is a 4proc with 8 gigs = +and 2 +proc is 4 gigs, both dells).

+ +

 

+ +

Thank you for any ideas in this = +arena.

+ +

 

+ +

Joel Fradkin

+ +
+ +

 

+ +
+ +

 

+ +

 

+ +
+ + + + + +------=_NextPart_000_0001_01C54B18.7E3B9720-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 12:17:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 14D48535E5 + for ; + Wed, 27 Apr 2005 12:17:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88094-04 + for ; + Wed, 27 Apr 2005 15:17:53 +0000 (GMT) +Received: from mta10.nationwireless.net (mta10.nationwireless.net + [63.163.128.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 649FB534AA + for ; + Wed, 27 Apr 2005 12:17:44 -0300 (ADT) +Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with + ESMTP + (SMTPD32-8.15) id ACF9319A0152; Wed, 27 Apr 2005 11:17:13 -0400 +From: "Joel Fradkin" +To: , +Subject: Re: Final decision +Date: Wed, 27 Apr 2005 11:17:23 -0400 +Message-ID: <002001c54b3c$3667a410$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0021_01C54B1A.AF560410" +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.2900.2180 +In-Reply-To: + <76E0DAA32C39D711B6EC0002B364A6FA0440F82F@amsal01exc01.americatel.com.sv> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.104 tagged_above=0 required=5 tests=AWL, + HTML_90_100, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200504/724 +X-Sequence-Number: 12121 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0021_01C54B1A.AF560410 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit + +Sorry I am using Redhat AS4 and postgres 8.0.2 + +Joel + + + +You didnt tell us what OS are you using, windows? + +If you want good performance you must install unix on that machine, + + + +--- + + + + + + +------=_NextPart_000_0021_01C54B1A.AF560410 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + + + + +
+ +

Sorry I am using Redhat AS4 and = +postgres +8.0.2

+ +

Joel

+ +
+ +

 

+ +

You didnt tell = +us what OS +are you using, windows?

+ +

If you want good +performance you must install unix on  that = +machine,

+ +

 

+ +

---= +

+ +

 

+ +

 

+ +
+ +
+ + + + + +------=_NextPart_000_0021_01C54B1A.AF560410-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 12:28:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 43E0A535D0 + for ; + Wed, 27 Apr 2005 12:26:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90410-05 + for ; + Wed, 27 Apr 2005 15:26:38 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 44289535D3 + for ; + Wed, 27 Apr 2005 12:26:35 -0300 (ADT) +Received: from 216-154-15-113.dsl.look.ca (216-154-15-113.dsl.look.ca + [216.154.15.113]) by tht.net (Postfix) with ESMTP + id 55C5C76A28; Wed, 27 Apr 2005 11:26:36 -0400 (EDT) +Subject: Re: Final decision +From: Rod Taylor +To: Joel Fradkin +Cc: PostgreSQL Perform +In-Reply-To: <000001c54b3a$054d3720$797ba8c0@jfradkin> +References: <000001c54b3a$054d3720$797ba8c0@jfradkin> +Content-Type: text/plain +Date: Wed, 27 Apr 2005 11:23:43 -0400 +Message-Id: <1114615423.77587.175.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.2 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/726 +X-Sequence-Number: 12123 + + +> +> I did have a question if any folks are using two servers one for +> reporting and one for data entry what system should be the beefier? + +Yeah. We started putting up slaves for reporting purposes and +application specific areas using Slony replicating partial data sets to +various locations -- some for reporting. + +If your reports have a long runtime and don't require transactional +safety for writes (daily summary written or results aren't recorded in +the DB at all) this is probably something to consider. + +I understand that PGAdmin makes Slony fairly painless to setup, but it +can be time consuming to get going and Slony can add new complications +depending on the data size and what you're doing with it -- but they're +working hard to reduce the impact of those complications. + +> I have a 2proc machine I will be using and I can either put Sears off +> by themselves on this machine or split up functionality and have one +> for reporting and one for inserts and updates; so not sure which +> machine would be best for which spot (reminder the more robust is a +> 4proc with 8 gigs and 2 proc is 4 gigs, both dells). +> +> +> +> Thank you for any ideas in this arena. +> +> +> +> Joel Fradkin +> +> +> +> +> +> +> +> +> +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 12:28:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 60995534CB; + Wed, 27 Apr 2005 12:25:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89496-08; Wed, 27 Apr 2005 15:25:27 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id DB8F6535E9; + Wed, 27 Apr 2005 12:25:25 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7292211; Wed, 27 Apr 2005 08:27:21 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Andrew Dunstan +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Wed, 27 Apr 2005 08:25:16 -0700 +User-Agent: KMail/1.8 +Cc: Mischa Sandberg , + pgsql-perform , + pgsql-hackers@postgresql.org +References: <200504191209.05181.josh@agliodbs.com> + <1114580284.426f253cc0087@webmail.telus.net> + <426F9703.4010108@dunslane.net> +In-Reply-To: <426F9703.4010108@dunslane.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504270825.17550.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/725 +X-Sequence-Number: 12122 + +Mischa, + +> >Perhaps I can save you some time (yes, I have a degree in Math). If I +> >understand correctly, you're trying extrapolate from the correlation +> >between a tiny sample and a larger sample. Introducing the tiny sample +> >into any decision can only produce a less accurate result than just +> >taking the larger sample on its own; GIGO. Whether they are consistent +> >with one another has no relationship to whether the larger sample +> >correlates with the whole population. You can think of the tiny sample +> >like "anecdotal" evidence for wonderdrugs. + +Actually, it's more to characterize how large of a sample we need. For +example, if we sample 0.005 of disk pages, and get an estimate, and then +sample another 0.005 of disk pages and get an estimate which is not even +close to the first estimate, then we have an idea that this is a table which +defies analysis based on small samples. Wheras if the two estimates are < +1.0 stdev apart, we can have good confidence that the table is easily +estimated. Note that this doesn't require progressively larger samples; any +two samples would work. + +> I'm with Tom though in being very wary of solutions that require even +> one-off whole table scans. Maybe we need an additional per-table +> statistics setting which could specify the sample size, either as an +> absolute number or as a percentage of the table. It certainly seems that +> where D/N ~ 0.3, the estimates on very large tables at least are way way +> out. + +Oh, I think there are several other cases where estimates are way out. +Basically the estimation method we have doesn't work for samples smaller than +0.10. + +> Or maybe we need to support more than one estimation method. + +Yes, actually. We need 3 different estimation methods: +1 for tables where we can sample a large % of pages (say, >= 0.1) +1 for tables where we sample a small % of pages but are "easily estimated" +1 for tables which are not easily estimated by we can't afford to sample a +large % of pages. + +If we're doing sampling-based estimation, I really don't want people to lose +sight of the fact that page-based random sampling is much less expensive than +row-based random sampling. We should really be focusing on methods which +are page-based. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 27 12:48:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D817535CE; + Wed, 27 Apr 2005 12:48:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96530-09; Wed, 27 Apr 2005 15:47:51 +0000 (GMT) +Received: from asg002.asg.local (smtp2.arrayservicesgrp.com [208.14.218.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F62A533F3; + Wed, 27 Apr 2005 12:47:50 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +Date: Wed, 27 Apr 2005 10:47:36 -0500 +Message-ID: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184E1@asg002.asg.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks suggested? +Thread-Index: AcVLPiQZDyKsA6GoTBWEiPyNU3BACgAAKoOg +From: "Dave Held" +To: "pgsql-perform" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/727 +X-Sequence-Number: 12124 + +> -----Original Message----- +> From: Josh Berkus [mailto:josh@agliodbs.com] +> Sent: Wednesday, April 27, 2005 10:25 AM +> To: Andrew Dunstan +> Cc: Mischa Sandberg; pgsql-perform; pgsql-hackers@postgresql.org +> Subject: Re: [HACKERS] [PERFORM] Bad n_distinct estimation; hacks +> suggested? +>=20 +> [...] +> Actually, it's more to characterize how large of a sample +> we need. For example, if we sample 0.005 of disk pages, and +> get an estimate, and then sample another 0.005 of disk pages +> and get an estimate which is not even close to the first +> estimate, then we have an idea that this is a table which=20 +> defies analysis based on small samples. =20 + +I buy that. + +> Wheras if the two estimates are < 1.0 stdev apart, we can +> have good confidence that the table is easily estimated.=20 + +I don't buy that. A negative indication is nothing more than +proof by contradiction. A positive indication is mathematical +induction over the set, which in this type of context is=20 +logically unsound. There is no reason to believe that two +small samples with a small difference imply that a table is +easily estimated rather than that you got unlucky in your +samples. + +> [...] +> Yes, actually. We need 3 different estimation methods: +> 1 for tables where we can sample a large % of pages +> (say, >=3D 0.1) +> 1 for tables where we sample a small % of pages but are=20 +> "easily estimated" +> 1 for tables which are not easily estimated by we can't=20 +> afford to sample a large % of pages. + +I don't buy that the first and second need to be different +estimation methods. I think you can use the same block +sample estimator for both, and simply stop sampling at +different points. If you set the default to be a fixed +number of blocks, you could get a large % of pages on +small tables and a small % of pages on large tables, which +is exactly how you define the first two cases. However, +I think such a default should also be overridable to a +% of the table or a desired accuracy. + +Of course, I would recommend the distinct sample technique +for the third case. + +> If we're doing sampling-based estimation, I really don't +> want people to lose sight of the fact that page-based random +> sampling is much less expensive than row-based random +> sampling. We should really be focusing on methods which=20 +> are page-based. + +Of course, that savings comes at the expense of having to +account for factors like clustering within blocks. So block +sampling is more efficient, but can also be less accurate. +Nonetheless, I agree that of the sampling estimators, block +sampling is the better technique. + +__ +David B. Held +Software Engineer/Array Services Group +200 14th Ave. East, Sartell, MN 56377 +320.534.3637 320.253.7800 800.752.8129 + +From pgsql-performance-owner@postgresql.org Wed Apr 27 13:07:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D583C53748 + for ; + Wed, 27 Apr 2005 13:07:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03469-03 + for ; + Wed, 27 Apr 2005 16:07:15 +0000 (GMT) +Received: from www.bowmansystems.com (ns1.bowmansystems.com [65.166.193.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 7226D53716 + for ; + Wed, 27 Apr 2005 13:07:14 -0300 (ADT) +Received: from ads2.ucomics.com (unknown [65.166.193.11]) + by www.bowmansystems.com (Postfix) with ESMTP id 8B956CB60; + Wed, 27 Apr 2005 11:06:07 -0500 (CDT) +Subject: Suggestions for a data-warehouse migration routine +From: Richard Rowell +To: pgsql-performance@postgresql.org +Cc: Mark Rinaudo +Content-Type: text/plain +Date: Wed, 27 Apr 2005 11:07:14 -0500 +Message-Id: <1114618034.7543.36.camel@richard> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.414 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/728 +X-Sequence-Number: 12125 + +I've ported enough of my companies database to Postgres to make +warehousing on PG a real possibility. I thought I would toss my data +migration architecture ideas out for the list to shoot apart.. + +1. Script on production server dumps the production database (MSSQL) to +a set of delimited text files. +2. Script on production server moves files via FTP to a Postgres +database server. +3. File Alteration Monitor trigger on PG server executes script when +last file is transferred. +4. Script on PG server drops the target database (by issuing a "dropdb" +command). +5. Script on PG server re-creates target database. (createdb command) +6. Script on PG server re-creates the tables. +7. Script on PG server issues COPY commands to import data. +8. Script on PG server indexes tables. +9. Script on PG server builds de-normalized reporting tables. +10. Script on PG server indexes the reporting tables. +11. Script on PG server creates needed reporting functions. +12. Vacuum analyze? + +My question revolves around the drop/create for the database. Is their +significant downside to this approach? I'm taking this approach because +it is simpler from a scripting point of view to simply start from +scratch on each warehouse update. If I do not drop the database I would +need to delete the contents of each table and drop all indexes prior to +the COPY/data import. My assumption is all the table deletes and index +drops would be more expensive then just droping/re-creating the entire +database. + +Also, is the Vacuum analyze step needed on a freshly minted database +where the indexes have all been newly created? + +Thanks in advance for all feedback. + + +-- + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 13:13:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 714BB5370B + for ; + Wed, 27 Apr 2005 13:13:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03844-10 + for ; + Wed, 27 Apr 2005 16:13:43 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 96E6453711 + for ; + Wed, 27 Apr 2005 13:13:41 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7292439; Wed, 27 Apr 2005 09:15:39 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: "Joel Fradkin" +Subject: Re: Final decision +Date: Wed, 27 Apr 2005 09:13:35 -0700 +User-Agent: KMail/1.8 +Cc: "PostgreSQL Perform" +References: <000001c54b3a$054d3720$797ba8c0@jfradkin> +In-Reply-To: <000001c54b3a$054d3720$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504270913.35952.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/729 +X-Sequence-Number: 12126 + +Joel, + +> So I am planning on sticking with postgres fro our production database +> (going live this weekend). + +Glad to have you. + +> I did not find any resolutions to my issues with Commandprompt.com (we only +> worked together 2.5 hours). + +BTW, your performance troubleshooting will continue to be hampered if you +can't share actual queries and data structure. I strongly suggest that you +make a confidentiality contract with a support provider so that you can give +them detailed (rather than general) problem reports. + +> Most of my application is working about the same speed as MSSQL server +> (unfortunately its twice the speed box, but as many have pointed out it +> could be an issue with the 4 proc dell). I spent considerable time with +> Dell and could see my drives are delivering 40 meg per sec. + +FWIW, on a v40z I get 180mb/s. So your disk array on the Dell is less than +ideal ... basically, what you have is a more expensive box, not a faster +one :-( + +> Things I still have to make better are my settings in config, I have it set +> to no merge joins and no seq scans. + +Yeah, I'm also finding that our estimator underestimates the real cost of +merge joins on some systems. Basically we need a sort-cost variable, +because I've found an up to 2x difference in sort cost depending on +architecture. + +> I am going to have to use flattened history files for reporting (I saw huge +> difference here the view for audit cube took 10 minutes in explain analyze +> and the flattened file took under one second). +> I understand both of these practices are not desirable, but I am at a place +> where I have to get it live and these are items I could not resolve. + +Flattening data for reporting is completely reasonable; I do it all the time. + +> I believe that was totally IIS not postgres, but I am curious as to if +> using postgres odbc will put more stress on the IIS side then MSSQL did. + +Actually, I think the problem may be ODBC. Our ODBC driver is not the best +and is currently being re-built from scratch. Is using npgsql, a much +higher-performance driver (for .NET) out of the question? According to one +company, npgsql performs better than drivers supplied by Microsoft. + +> I did have a question if any folks are using two servers one for reporting +> and one for data entry what system should be the beefier? + +Depends on the relative # of users. This is often a good approach, because +the requirements for DW reporting and OLTP are completely different. +Basically: +OLTP: Many slow processors, disk array set up for fast writes, moderate shared +mem, low work_mem. +DW: Few fast processors, disk array set up for fast reads, high shared mem and +work mem. + +If reporting is at least 1/4 of your workload, I'd suggest spinning that off +to the 2nd machine before putting one client on that machine. That way you +can also use the 2nd machine as a failover back-up. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 27 13:29:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A860F53770 + for ; + Wed, 27 Apr 2005 13:29:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09294-05 + for ; + Wed, 27 Apr 2005 16:29:12 +0000 (GMT) +Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net + [194.217.242.92]) + by svr1.postgresql.org (Postfix) with ESMTP id D9F0C5367C + for ; + Wed, 27 Apr 2005 13:29:11 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) + id 1DQpPS-000BAg-EF + for pgsql-performance@postgresql.org; Wed, 27 Apr 2005 16:29:10 +0000 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Final decision +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Wed, 27 Apr 2005 17:29:09 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Final decision +Thread-Index: AcVLRG02/m4pCYLwTVmqwEuy49CWnwAAZnfA +From: "Dave Page" +To: "Josh Berkus" , + "Joel Fradkin" +Cc: "PostgreSQL Perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/730 +X-Sequence-Number: 12127 + +=20 + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org=20 +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> Josh Berkus +> Sent: 27 April 2005 17:14 +> To: Joel Fradkin +> Cc: PostgreSQL Perform +> Subject: Re: [PERFORM] Final decision +>=20 +> Actually, I think the problem may be ODBC. Our ODBC driver=20 +> is not the best=20 +> and is currently being re-built from scratch. =20 + +It is? No-one told the developers... + +Regards, Dave + +[and yes, I know Joshua said Command Prompt are rewriting /their/ +driver] + +From pgsql-performance-owner@postgresql.org Wed Apr 27 13:36:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 98A7C53778 + for ; + Wed, 27 Apr 2005 13:36:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14419-03 + for ; + Wed, 27 Apr 2005 16:36:39 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 91C9E536B9 + for ; + Wed, 27 Apr 2005 13:36:39 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7292581; Wed, 27 Apr 2005 09:38:37 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: "Dave Page" +Subject: Re: Final decision +Date: Wed, 27 Apr 2005 09:36:34 -0700 +User-Agent: KMail/1.8 +Cc: "Joel Fradkin" , + "PostgreSQL Perform" +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: <200504270936.34797.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/731 +X-Sequence-Number: 12128 + +Dave, + +> > Actually, I think the problem may be ODBC. Our ODBC driver +> > is not the best +> > and is currently being re-built from scratch. +> +> It is? No-one told the developers... +> +> Regards, Dave +> +> [and yes, I know Joshua said Command Prompt are rewriting /their/ +> driver] + +OK. Well, let's put it this way: the v3 and v3.5 drivers will not be based +on the current driver, unless you suddenly have a bunch of free time. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Apr 27 13:46:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 88D0953802 + for ; + Wed, 27 Apr 2005 13:46:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15052-09 + for ; + Wed, 27 Apr 2005 16:46:27 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 987DE537FA + for ; + Wed, 27 Apr 2005 13:46:12 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3RGe2ma013800; Wed, 27 Apr 2005 09:40:02 -0700 +Message-ID: <426FC1CA.4070903@commandprompt.com> +Date: Wed, 27 Apr 2005 09:46:02 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dave Page +Cc: Josh Berkus , Joel Fradkin , + PostgreSQL Perform +Subject: Re: Final decision +References: + +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.022 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/732 +X-Sequence-Number: 12129 + +Dave Page wrote: +> +> +> +>>-----Original Message----- +>>From: pgsql-performance-owner@postgresql.org +>>[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of +>>Josh Berkus +>>Sent: 27 April 2005 17:14 +>>To: Joel Fradkin +>>Cc: PostgreSQL Perform +>>Subject: Re: [PERFORM] Final decision +>> +>>Actually, I think the problem may be ODBC. Our ODBC driver +>>is not the best +>>and is currently being re-built from scratch. +> +> +> It is? No-one told the developers... + +We have mentioned it on the list. + +http://www.linuxdevcenter.com/pub/a/linux/2002/07/16/drake.html + +> Regards, Dave +> +> [and yes, I know Joshua said Command Prompt are rewriting /their/ +> driver] + +:) No we are rewriting a complete OSS driver. + +Sincerely, + +Joshua D. Drake +Command Prompt, Inc. + + +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly + + +-- +Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +Managed Services, Shared and Dedication Hosting +Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Wed Apr 27 14:03:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D8C26537F4 + for ; + Wed, 27 Apr 2005 14:02:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22389-03 + for ; + Wed, 27 Apr 2005 17:02:47 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 11F3953809 + for ; + Wed, 27 Apr 2005 14:02:09 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3RGtuma016348; Wed, 27 Apr 2005 09:55:56 -0700 +Message-ID: <426FC583.7050304@commandprompt.com> +Date: Wed, 27 Apr 2005 10:01:55 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Joshua D. Drake" +Cc: Dave Page , + Josh Berkus , Joel Fradkin , + PostgreSQL Perform +Subject: Re: Final decision +References: + + <426FC1CA.4070903@commandprompt.com> +In-Reply-To: <426FC1CA.4070903@commandprompt.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.022 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/733 +X-Sequence-Number: 12130 + +>> +>> It is? No-one told the developers... +> +> +> We have mentioned it on the list. +> +> http://www.linuxdevcenter.com/pub/a/linux/2002/07/16/drake.html + +Ooops ;) + +http://archives.postgresql.org/pgsql-odbc/2005-03/msg00109.php + +Sincerely, + +Joshua D. Drake +Command Prompt, Inc. + + +-- +Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +Managed Services, Shared and Dedication Hosting +Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Wed Apr 27 14:21:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C45EB538AC; + Wed, 27 Apr 2005 14:17:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31589-06; Wed, 27 Apr 2005 17:17:09 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id EBFB653892; + Wed, 27 Apr 2005 14:17:07 -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 1DQq9Y-0001dt-00; Wed, 27 Apr 2005 13:16:48 -0400 +To: "Dave Held" +Cc: "pgsql-perform" , + +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184E1@asg002.asg.local> +In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184E1@asg002.asg.local> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 27 Apr 2005 13:16:48 -0400 +Message-ID: <87ekcw3zsv.fsf@stark.xeocode.com> +Lines: 24 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/734 +X-Sequence-Number: 12131 + + +"Dave Held" writes: + +> > Actually, it's more to characterize how large of a sample +> > we need. For example, if we sample 0.005 of disk pages, and +> > get an estimate, and then sample another 0.005 of disk pages +> > and get an estimate which is not even close to the first +> > estimate, then we have an idea that this is a table which +> > defies analysis based on small samples. +> +> I buy that. + +Better yet is to use the entire sample you've gathered of .01 and then perform +analysis on that sample to see what the confidence interval is. Which is +effectively the same as what you're proposing except looking at every possible +partition. + +Unfortunately the reality according to the papers that were sent earlier is +that you will always find the results disappointing. Until your sample is +nearly the entire table your estimates for n_distinct will be extremely +unreliable. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 14:40:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 106A8539F3 + for ; + Wed, 27 Apr 2005 14:38:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62599-03 + for ; + Wed, 27 Apr 2005 17:37:58 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 86FEA5392D + for ; + Wed, 27 Apr 2005 14:37:33 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3RHbHHH020240; (envelope-from ) Wed, + 27 Apr 2005 12:37:22 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3RHKdAW016208 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 27 Apr 2005 12:20:40 -0500 (CDT) +Message-ID: <426FC9E5.60905@arbash-meinel.com> +Date: Wed, 27 Apr 2005 12:20:37 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin +Cc: PostgreSQL Perform +Subject: Re: Final decision +References: <000001c54b3a$054d3720$797ba8c0@jfradkin> +In-Reply-To: <000001c54b3a$054d3720$797ba8c0@jfradkin> +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigDB2B678B1B3ED3D111C498CC" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/736 +X-Sequence-Number: 12133 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigDB2B678B1B3ED3D111C498CC +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Joel Fradkin wrote: +> I spent a great deal of time over the past week looking seriously at +> Postgres and MYSQL. +> +> Objectively I am not seeing that much of an improvement in speed with +> MYSQL, and we have a huge investment in postgrs. +> +> So I am planning on sticking with postgres fro our production database +> (going live this weekend). + +Glad to hear it. Good luck. +> +> +... +> +> Things I still have to make better are my settings in config, I have it +> set to no merge joins and no seq scans. + +Just realize, you probably *don't* want to set that in postgresql.conf. +You just want to issue an "SET enable_seqscan TO off" before issuing one +of the queries that are mis-planned. + +Because there are lots of times when merge join and seq scan is actually +faster than the alternatives. And since I don't think you tested every +query you are going to run, you probably want to let the planner handle +the ones it gets right. (Usually it doesn't quite a good job.) + +Also, I second the notion of getting a confidentiality contract. There +have been several times where someone had a pathological case, and by +sending the data to someone (Tom Lane), they were able to track down and +fix the problem. + +> +> I am going to have to use flattened history files for reporting (I saw +> huge difference here the view for audit cube took 10 minutes in explain +> analyze and the flattened file took under one second). +> +> +> +> I understand both of these practices are not desirable, but I am at a +> place where I have to get it live and these are items I could not resolve. + +Nothing wrong with a properly updated flattened table. You just need to +be careful to keep it consistent with the rest of the data. (Update +triggers/lazy materialization, etc) + +> +> I may try some more time with Commanpromt.com, or seek other +> professional help. +> +> +> +> In stress testing I found Postgres was holding up very well (but my IIS +> servers could not handle much of a load to really push the server). +> +> I have a few desktops acting as IIS servers at the moment and if I +> pushed past 50 consecutive users it pretty much blew the server up. +> +> On inserts that number was like 7 consecutive users and updates was also +> like 7 users. +> +> +> +> I believe that was totally IIS not postgres, but I am curious as to if +> using postgres odbc will put more stress on the IIS side then MSSQL did. +> + +What do you mean by "blew up"? I assume you have IIS on a different +machine than the database. Are you saying that the database slowed down +dramatically, or that the machine crashed, or just that the web +interface became unresponsive? + +> I did have a question if any folks are using two servers one for +> reporting and one for data entry what system should be the beefier? +> +> I have a 2proc machine I will be using and I can either put Sears off by +> themselves on this machine or split up functionality and have one for +> reporting and one for inserts and updates; so not sure which machine +> would be best for which spot (reminder the more robust is a 4proc with 8 +> gigs and 2 proc is 4 gigs, both dells). +> + +It probably depends on what queries are being done, and what kind of +times you need. Usually the update machine needs the stronger hardware, +so that it can do the writing. + +But it depends if you can wait longer to update data than to query data, +obviously the opposite is true. It all depends on load, and that is +pretty much application defined. + +> +> +> Thank you for any ideas in this arena. +> +> +> +> Joel Fradkin +> + +John +=:-> + +--------------enigDB2B678B1B3ED3D111C498CC +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFCb8nlJdeBCYSNAAMRAuz2AJ0SEH3gMOFa6g/YH3lrCNTIkUCzJQCfdAb6 +7QYoemisBhZ03tPF+s8fj2c= +=3+1L +-----END PGP SIGNATURE----- + +--------------enigDB2B678B1B3ED3D111C498CC-- + +From pgsql-performance-owner@postgresql.org Wed Apr 27 14:38:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E2D735398F + for ; + Wed, 27 Apr 2005 14:38:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59271-03 + for ; + Wed, 27 Apr 2005 17:37:58 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 86FE5538F7 + for ; + Wed, 27 Apr 2005 14:37:33 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3RHbHHJ020240; (envelope-from ) Wed, + 27 Apr 2005 12:37:23 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3RHNwFT017432 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 27 Apr 2005 12:23:59 -0500 (CDT) +Message-ID: <426FCAAC.4040000@arbash-meinel.com> +Date: Wed, 27 Apr 2005 12:23:56 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard Rowell +Cc: pgsql-performance@postgresql.org, + Mark Rinaudo +Subject: Re: Suggestions for a data-warehouse migration routine +References: <1114618034.7543.36.camel@richard> +In-Reply-To: <1114618034.7543.36.camel@richard> +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigE92AF43FF0FBA3A0130D3112" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/735 +X-Sequence-Number: 12132 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigE92AF43FF0FBA3A0130D3112 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Richard Rowell wrote: +> I've ported enough of my companies database to Postgres to make +> warehousing on PG a real possibility. I thought I would toss my data +> migration architecture ideas out for the list to shoot apart.. +> +> 1. Script on production server dumps the production database (MSSQL) to +> a set of delimited text files. +> 2. Script on production server moves files via FTP to a Postgres +> database server. +> 3. File Alteration Monitor trigger on PG server executes script when +> last file is transferred. +> 4. Script on PG server drops the target database (by issuing a "dropdb" +> command). +> 5. Script on PG server re-creates target database. (createdb command) +> 6. Script on PG server re-creates the tables. +> 7. Script on PG server issues COPY commands to import data. +> 8. Script on PG server indexes tables. +> 9. Script on PG server builds de-normalized reporting tables. +> 10. Script on PG server indexes the reporting tables. +> 11. Script on PG server creates needed reporting functions. +> 12. Vacuum analyze? +> +> My question revolves around the drop/create for the database. Is their +> significant downside to this approach? I'm taking this approach because +> it is simpler from a scripting point of view to simply start from +> scratch on each warehouse update. If I do not drop the database I would +> need to delete the contents of each table and drop all indexes prior to +> the COPY/data import. My assumption is all the table deletes and index +> drops would be more expensive then just droping/re-creating the entire +> database. + +I believe you are correct. If you are going to completely wipe the +database, just drop it and re-create. Deleting is much slower than +dropping. (One of the uses of partitioning is so that you can just drop +one of the tables, rather than deleting the entries). Dropping the whole +db skips any Foreign Key checks, etc. + +> +> Also, is the Vacuum analyze step needed on a freshly minted database +> where the indexes have all been newly created? +> +> Thanks in advance for all feedback. + +ANALYZE is needed, since you haven't updated any of your statistics yet. +So the planner doesn't really know how many rows there are. + +VACUUM probably isn't since everything should be pretty well aligned. + +John +=:-> + +--------------enigE92AF43FF0FBA3A0130D3112 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFCb8qsJdeBCYSNAAMRAgHkAJ9HegqkzKckhY1rcxCaeZDiKELMOACgn1K+ +rOyUTalvLHuoOo4XhAghey0= +=N9bL +-----END PGP SIGNATURE----- + +--------------enigE92AF43FF0FBA3A0130D3112-- + +From pgsql-performance-owner@postgresql.org Wed Apr 27 14:48:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B77253880 + for ; + Wed, 27 Apr 2005 14:48:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73341-08 + for ; + Wed, 27 Apr 2005 17:48:32 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id 48BEC53BE7 + for ; + Wed, 27 Apr 2005 14:48:17 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C54B51.4A26EB61" +Subject: Why is this system swapping? +Date: Wed, 27 Apr 2005 13:48:15 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Why is this system swapping? +Thread-Index: AcVLUUoCL/Op/MvGSfab7b15RqvcXg== +From: "Anjan Dave" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.086 tagged_above=0 required=5 tests=AWL, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200504/737 +X-Sequence-Number: 12134 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C54B51.4A26EB61 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +Hello, + +=20 + +I am trying to understand what I need to do for this system to stop +using swap. Maybe it's something simple, or obvious for the situation. +I'd appreciate some thoughts/suggestions. + +=20 + +Some background:=20 + +This is a quad XEON (yes, Dell) with 12GB of RAM, pg 7.4...pretty heavy +on concurrent usage. With peak traffic (db allows 1000 connections, in +line with the number of app servers and connection pools for each) +following is from 'top' (sorted by mem) Shared_buffers is 170MB, +sort_mem 2MB. Both WAL and pgdata are on separate LUNs on fibre channel +storage, RAID10. + +=20 + +972 processes: 971 sleeping, 1 running, 0 zombie, 0 stopped + +CPU states: cpu user nice system irq softirq iowait idle + + total 57.2% 0.0% 23.2% 0.0% 3.6% 82.8% 232.4% + + cpu00 22.0% 0.0% 9.1% 0.1% 0.9% 18.7% 48.8% + + cpu01 17.5% 0.0% 5.8% 0.0% 2.3% 19.7% 54.4% + + cpu02 7.8% 0.0% 3.7% 0.0% 0.0% 20.8% 67.5% + + cpu03 9.7% 0.0% 4.4% 0.0% 0.5% 23.6% 61.5% + +Mem: 12081744k av, 12055220k used, 26524k free, 0k shrd, +71828k buff + + 9020480k actv, 1741348k in_d, 237396k in_c + +Swap: 4096532k av, 472872k used, 3623660k free 9911176k +cached + +=20 + + PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU +COMMAND + +21397 postgres 22 0 181M 180M 175M D 25.9 1.5 85:17 0 +postmaster + +23820 postgres 15 0 178M 177M 175M S 0.0 1.5 1:53 3 +postmaster + +24428 postgres 15 0 178M 177M 175M S 0.0 1.5 1:35 3 +postmaster + +24392 postgres 15 0 178M 177M 175M S 2.7 1.5 2:07 2 +postmaster + +23610 postgres 15 0 178M 177M 175M S 0.0 1.5 0:29 2 +postmaster + +24395 postgres 15 0 178M 177M 175M S 0.0 1.5 1:12 1 +postmaster + +... + +... + +-bash-2.05b$ free + + total used free shared +buffers cached + +Mem: 12081744 12055536 26208 0 66704 +9943988 + +-/+ buffers/cache: 2044844 10036900 + +Swap: 4096532 512744 3583788 + +=20 + +As you can see the system starts utilizing swap at some point, with so +many processes. Some time ago we had decided to keep the connections +from the pool open for longer periods of time, possibly to avoid +connection maintenance overhead on the db. At that time the traffic was +not as high as it is today, which might be causing this, because for the +most part, non-idle postmaster processes are only a few, except when the +system becomes busy and suddenly you see a lot of selects piling up, and +load averages shooting upwards. I am thinking closing out connections +sooner might help the system release some memory to the kernel. Swapping +adds up to the IO, although OS is on separate channel than postgres. + +=20 + +I can add more memory, but I want to make sure I haven't missed out +something obvious. + +=20 + +Thanks! + +Anjan + +=20 + +=20 +************************************************************************ +****************** +This e-mail and any files transmitted with it are intended for the use +of the=20 +addressee(s) only and may be confidential and covered by the +attorney/client=20 +and other privileges. If you received this e-mail in error, please +notify the=20 +sender; do not disclose, copy, distribute, or take any action in +reliance on=20 +the contents of this information; and delete it from your system. Any +other=20 +use of this e-mail is prohibited. +************************************************************************ +****************** + +=20 + + +------_=_NextPart_001_01C54B51.4A26EB61 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + + +
+ +

Hello,

+ +

 

+ +

I am trying to understand what I need to do for this = +system +to stop using swap. Maybe it’s something simple, or obvious for = +the +situation. I’d appreciate some = +thoughts/suggestions.

+ +

 

+ +

Some background:

+ +

This is a quad XEON (yes, Dell) with 12GB of RAM, pg = +7.4…pretty +heavy on concurrent usage. With peak traffic (db allows 1000 = +connections, in +line with the number of app servers and connection pools for each) = +following is +from ‘top’ (sorted by mem) Shared_buffers is 170MB, sort_mem = +2MB. +Both WAL and pgdata are on separate LUNs on fibre channel storage, = +RAID10.

+ +

 

+ +

972 processes: 971 sleeping, 1 running, 0 zombie, 0 = +stopped

+ +

CPU states:  cpu    +user    nice  system    irq  +softirq  iowait    idle

+ +

         = +  +total   57.2%    0.0%   = +23.2%   +0.0%     3.6%   82.8%  = +232.4%

+ +

         = +  +cpu00   22.0%    0.0%    +9.1%   0.1%     0.9%   +18.7%   48.8%

+ +

         = +  +cpu01   17.5%    0.0%    +5.8%   0.0%     2.3%   +19.7%   54.4%

+ +

         = +  +cpu02    7.8%    0.0%    +3.7%   0.0%     0.0%   +20.8%   67.5%

+ +

         = +  +cpu03    9.7%    0.0%    +4.4%   0.0%     0.5%   +23.6%   61.5%

+ +

Mem:  12081744k av, 12055220k used,   = +26524k +free,       0k shrd,   71828k = +buff

+ +

         = +          +9020480k actv, 1741348k in_d,  237396k = +in_c

+ +

Swap: 4096532k av,  472872k used, 3623660k +free           &nb= +sp;     +9911176k cached

+ +

 

+ +

  PID USER     PRI  = +NI  +SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU = +COMMAND

+ +

21397 postgres  22   0  181M = +180M  +175M D    25.9  1.5  85:17   0 = +postmaster

+ +

23820 postgres  15   0  178M = +177M  +175M S     0.0  1.5   = +1:53   3 +postmaster

+ +

24428 postgres  15   0  178M = +177M  +175M S     0.0  1.5   = +1:35   3 +postmaster

+ +

24392 postgres  15   0  178M = +177M  +175M S     2.7  1.5   = +2:07   2 +postmaster

+ +

23610 postgres  15   0  178M = +177M  +175M S     0.0  1.5   = +0:29   2 +postmaster

+ +

24395 postgres  15   0  178M = +177M  +175M S     0.0  1.5   = +1:12   1 +postmaster

+ +

+ +

+ +

-bash-2.05b$ free

+ +

         = +   +      total     = +        used   &nb= +sp;   +free     shared    +buffers     cached

+ +

Mem:      = +12081744   +12055536      +26208          +0      66704    = +9943988

+ +

-/+ buffers/cache:    = +2044844   +10036900

+ +

Swap:      +4096532     512744    = +3583788

+ +

 

+ +

As you can see the system starts utilizing swap at = +some +point, with so many processes. Some time ago we had decided to keep the +connections from the pool open for longer periods of time, possibly to = +avoid +connection maintenance overhead on the db. At that time the traffic was = +not as +high as it is today, which might be causing this, because for the most = +part, +non-idle postmaster processes are only a few, except when the system = +becomes +busy and suddenly you see a lot of selects piling up, and load averages +shooting upwards. I am thinking closing out connections sooner might = +help the +system release some memory to the kernel. Swapping adds up to the IO, = +although +OS is on separate channel than postgres.

+ +

 

+ +

I can add more memory, but I want to make sure I = +haven’t +missed out something obvious.

+ +

 

+ +

Thanks!

+ +

Anjan

+ +

 

+ +
 
****************************=
+**************************************************************=
+
This e-mail and any files =
+transmitted with it are intended for the use of the =
+
addressee(s) only and may =
+be confidential and covered by the attorney/client =
+
and other privileges.  =
+If you received this e-mail in error, please notify the =
+
sender; do not disclose, =
+copy, distribute, or take any action in reliance on =
+
the contents of this =
+information; and delete it from your =
+system. Any other 
use of this e-mail is =
+prohibited.
****************************=
+**************************************************************=
+
+ +

 

+ +
+ + + + + +------_=_NextPart_001_01C54B51.4A26EB61-- + +From pgsql-performance-owner@postgresql.org Wed Apr 27 15:17:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AFF0533E9 + for ; + Wed, 27 Apr 2005 15:17:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14088-05 + for ; + Wed, 27 Apr 2005 18:17:19 +0000 (GMT) +Received: from mta10.nationwireless.net (mta10.nationwireless.net + [63.163.128.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 35C9653378 + for ; + Wed, 27 Apr 2005 15:17:17 -0300 (ADT) +Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with + ESMTP + (SMTPD32-8.15) id A72C8E6E00CC; Wed, 27 Apr 2005 14:17:16 -0400 +From: "Joel Fradkin" +To: "'Josh Berkus'" +Cc: "'PostgreSQL Perform'" +Subject: Re: Final decision +Date: Wed, 27 Apr 2005 14:17:25 -0400 +Message-ID: <000001c54b55$5d72b8b0$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Importance: Normal +In-Reply-To: <200504270913.35952.josh@agliodbs.com> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/738 +X-Sequence-Number: 12135 + +BTW, your performance troubleshooting will continue to be hampered if = +you=20 +can't share actual queries and data structure. I strongly suggest that = +you + +make a confidentiality contract with a support provider so that you can +give them detailed (rather than general) problem reports. + +I am glad to hear your perspective, maybe my rollout is not as off base = +as I +thought. + +FYI it is not that I can not share specifics (I have posted a few table +structures and views here and on pgsql, I just can not backup the entire +database and ship it off to a consultant. + +What I had suggested with Commandprompt was to use remote connectivity = +for +him to have access to our server directly. In this way I can learn by +watching what types of test he does and it allows him to do tests with = +our +data set. + +Once I am in production that will not be something I want tests done on, = +so +it may have to wait until we get a development box with a similar = +deployment +(at the moment development is on a XP machine and production will be on +Linux (The 4 proc is linux and will be our production). + +Thank you for letting me know what I can hope to see in the way of disk +access on the next hardware procurement, I may email you off list to get = +the +specific brands etc that you found that kind of through put with. + + + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 15:29:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CC9445323C + for ; + Wed, 27 Apr 2005 15:29:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45981-05 + for ; + Wed, 27 Apr 2005 18:29:22 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 4A3C9534A6 + for ; + Wed, 27 Apr 2005 15:29:20 -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 1DQrHc-0001sk-00; Wed, 27 Apr 2005 14:29:12 -0400 +To: "Anjan Dave" +Cc: +Subject: Re: Why is this system swapping? +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> +In-Reply-To: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 27 Apr 2005 14:29:12 -0400 +Message-ID: <8764y83wg7.fsf@stark.xeocode.com> +Lines: 57 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/739 +X-Sequence-Number: 12136 + +"Anjan Dave" writes: + +> Some background: +> +> This is a quad XEON (yes, Dell) with 12GB of RAM, pg 7.4...pretty heavy +> on concurrent usage. With peak traffic (db allows 1000 connections, in +> line with the number of app servers and connection pools for each) +> following is from 'top' (sorted by mem) Shared_buffers is 170MB, +> sort_mem 2MB. Both WAL and pgdata are on separate LUNs on fibre channel +> storage, RAID10. +> +> 972 processes: 971 sleeping, 1 running, 0 zombie, 0 stopped +> +> CPU states: cpu user nice system irq softirq iowait idle +> total 57.2% 0.0% 23.2% 0.0% 3.6% 82.8% 232.4% + +This looks to me like most of your server processes are sitting around idle +most of the time. + +> 21397 postgres 22 0 181M 180M 175M D 25.9 1.5 85:17 0 +> postmaster +> +> 23820 postgres 15 0 178M 177M 175M S 0.0 1.5 1:53 3 +> postmaster + +So each process is taking up 8-11M of ram beyond the shared memory. 1,000 x +10M is 10G. Add in some memory for page tables and kernel data structures, as +well as the kernel's need to keep some memory set aside for filesystem buffers +(what you really want all that memory being used for anyways) and you've used +up all your 12G. + +I would seriously look at tuning those connection pools down. A lot. If your +server processes are sitting idle over half the time I would at least cut it +by a factor of 2. + +Working the other direction: you have four processors (I guess you have +hyperthreading turned off?) so ideally what you want is four runnable +processes at all times and as few others as possible. If your load typically +spends about half the time waiting on i/o (which is what that top output says) +then you want a total of 8 connections. + +Realistically you might not be able to predict which app server will be +providing the load at any given time, so you might want 8 connections per app +server. + +And you might have some load that's more i/o intensive than the 50% i/o load +shown here. Say you think some loads will be 80% i/o, you might want 20 +connections for those loads. If you had 10 app servers with 20 connections +each for a total of 200 connections I suspect that would be closer to right +than having 1,000 connections. + +200 connections would consume 2G of ram leaving you with 10G of filesystem +cache. Which might in turn decrease the percentage of time waiting on i/o, +which would decrease the number of processes you need even further... + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 15:29:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2497653479 + for ; + Wed, 27 Apr 2005 15:29:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62466-02 + for ; + Wed, 27 Apr 2005 18:29:42 +0000 (GMT) +Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) + by svr1.postgresql.org (Postfix) with ESMTP id 26C225345F + for ; + Wed, 27 Apr 2005 15:29:41 -0300 (ADT) +Received: from jefftrout.com ([24.61.201.181]) + by comcast.net (sccrmhc12) with SMTP + id <2005042718294101200dkio5e>; Wed, 27 Apr 2005 18:29:41 +0000 +Received: (qmail 27083 invoked from network); 27 Apr 2005 18:30:19 -0000 +Received: from waltham-nat.ma.lycos.com (HELO ?10.124.7.194?) (209.202.205.1) + by 192.168.0.109 with SMTP; 27 Apr 2005 18:30:19 -0000 +In-Reply-To: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <7a617f4f4c47b0235c56d4a0ec624e51@torgo.978.org> +Content-Transfer-Encoding: 7bit +Cc: +From: Jeff +Subject: Re: Why is this system swapping? +Date: Wed, 27 Apr 2005 14:29:42 -0400 +To: "Anjan Dave" +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.187 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, + RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200504/740 +X-Sequence-Number: 12137 + + +On Apr 27, 2005, at 1:48 PM, Anjan Dave wrote: + +> As you can see the system starts utilizing swap at some point, with so +> many processes. Some time ago we had decided to keep the connections +> from the pool open for longer + +You've shown the system has used swap but not that it is swapping. +Having swap in use is fine - there is likely plenty of code and whatnot +that is not being used so it dumped it out to swap. However if you are +actively moving data to/from swap that is bad. Very bad. Especially on +linux. + +To tell if you are swapping you need to watch the output of say, vmstat +1 and look at the si and so columns. + +Linux is very swap happy and likes to swap things for fun and profit. + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 15:47:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 05876534AC + for ; + Wed, 27 Apr 2005 15:47:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80420-03 + for ; + Wed, 27 Apr 2005 18:47:43 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id F28DE52A50 + for ; + Wed, 27 Apr 2005 15:47:42 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Why is this system swapping? +Date: Wed, 27 Apr 2005 14:44:27 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785026FF72A@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Why is this system swapping? +Thread-Index: AcVLVxUw5XPqSTfqROaA3Wf/s7c40wAAcILA +From: "Anjan Dave" +To: "Jeff" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.078 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/741 +X-Sequence-Number: 12138 + +Sorry, I didn't attach vmstat, the system does actively swap pages. Not +to the point where it crawls, but for some brief periods the console +becomes a bit unresponsive. I am taking this as a sign to prevent future +problems. + +anjan + +-----Original Message----- +From: Jeff [mailto:threshar@torgo.978.org]=20 +Sent: Wednesday, April 27, 2005 2:30 PM +To: Anjan Dave +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Why is this system swapping? + + +On Apr 27, 2005, at 1:48 PM, Anjan Dave wrote: + +> As you can see the system starts utilizing swap at some point, with so + +> many processes. Some time ago we had decided to keep the connections=20 +> from the pool open for longer + +You've shown the system has used swap but not that it is swapping. =20 +Having swap in use is fine - there is likely plenty of code and whatnot=20 +that is not being used so it dumped it out to swap. However if you are=20 +actively moving data to/from swap that is bad. Very bad. Especially on=20 +linux. + +To tell if you are swapping you need to watch the output of say, vmstat=20 +1 and look at the si and so columns. + +Linux is very swap happy and likes to swap things for fun and profit. + +-- + +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 15:47:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ED4AC53479 + for ; + Wed, 27 Apr 2005 15:47:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79497-09 + for ; + Wed, 27 Apr 2005 18:47:42 +0000 (GMT) +Received: from mta10.nationwireless.net (mta10.nationwireless.net + [63.163.128.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 648F752967 + for ; + Wed, 27 Apr 2005 15:47:41 -0300 (ADT) +Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with + ESMTP + (SMTPD32-8.15) id AE4D45D700E6; Wed, 27 Apr 2005 14:47:41 -0400 +From: "Joel Fradkin" +To: "'John A Meinel'" +Cc: "'PostgreSQL Perform'" +Subject: Re: Final decision +Date: Wed, 27 Apr 2005 14:47:50 -0400 +Message-ID: <000401c54b59$9d916050$797ba8c0@jfradkin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook, Build 10.0.6626 +Importance: Normal +In-Reply-To: <426FC9E5.60905@arbash-meinel.com> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/742 +X-Sequence-Number: 12139 + +Just realize, you probably *don't* want to set that in postgresql.conf. +You just want to issue an "SET enable_seqscan TO off" before issuing one +of the queries that are mis-planned. + +I believe all the tested queries (90 some odd views) saw an improvement. +I will however take the time to verify this and take your suggestion as = +I +can certainly put the appropriate settings in each as opposed to using = +the +config option, Thanks for the good advice (I believe Josh from +Commandprompt.com also suggested this approach and I in my lazy self = +some +how blurred the concept.) + + +Also, I second the notion of getting a confidentiality contract. There +have been several times where someone had a pathological case, and by +sending the data to someone (Tom Lane), they were able to track down and +fix the problem. + +Excellent point, Our data is confidential, but I should write something = +to +allow me to ship concept without confidential, so in the future I can = +just +send a backup and not have it break our agreements, but allow minds = +greater +then my own to see, and feel my issues. + + +What do you mean by "blew up"?=20 +IIS testing was being done with an old 2300 and a optiplex both machines +reached 100%CPU utilization and the test suite (ASP code written in = +house by +one of programmers) was not returning memory correctly, so it ran out of +memory and died. Prior to death I did see cpu utilization on the 4proc = +linux +box running postgres fluctuate and at times hit the 100% level, but the +server seemed very stable. I did fix the memory usage of the suite and = +was +able to see 50 concurrent users with fairly high RPS especially on = +select +testing, the insert and update seemed to fall apart (many 404 errors = +etc) + + +I assume you have IIS on a different +machine than the database. Are you saying that the database slowed down +dramatically, or that the machine crashed, or just that the web +interface became unresponsive? Just the web interface. + +It probably depends on what queries are being done, and what kind of +times you need. Usually the update machine needs the stronger hardware, +so that it can do the writing. + +But it depends if you can wait longer to update data than to query data, +obviously the opposite is true. It all depends on load, and that is +pretty much application defined. + +I am guessing our app is like 75% data entry and 25% reporting, but the +reporting is taking the toll SQL wise. + +This was from my insert test with 15 users. +Test type: Dynamic=20 + Simultaneous browser connections: 15=20 + Warm up time (secs): 0=20 + Test duration: 00:00:03:13=20 + Test iterations: 200=20 + Detailed test results generated: Yes +Response Codes=20 + =20 + Response Code: 403 - The server understood the request, but is refusing = +to +fulfill it.=20 + Count: 15=20 + Percent (%): 0.29=20 +=20 +=20 + Response Code: 302 - The requested resource resides temporarily under a +different URI (Uniform Resource Identifier).=20 + Count: 200=20 + Percent (%): 3.85=20 +=20 +=20 + Response Code: 200 - The request completed successfully.=20 + Count: 4,980=20 + Percent (%): 95.86=20 +=20 +My select test with 25 users had this +Properties=20 + =20 + Test type: Dynamic=20 + Simultaneous browser connections: 25=20 + Warm up time (secs): 0=20 + Test duration: 00:00:06:05=20 + Test iterations: 200=20 + Detailed test results generated: Yes=20 + =20 +Summary=20 + =20 + Total number of requests: 187=20 + Total number of connections: 200=20 + =20 + Average requests per second: 0.51=20 + Average time to first byte (msecs): 30,707.42=20 + Average time to last byte (msecs): 30,707.42=20 + Average time to last byte per iteration (msecs): 28,711.44=20 + =20 + Number of unique requests made in test: 1=20 + Number of unique response codes: 1=20 + =20 +Errors Counts=20 + =20 + HTTP: 0=20 + DNS: 0=20 + Socket: 26=20 + =20 +Additional Network Statistics=20 + =20 + Average bandwidth (bytes/sec): 392.08=20 + =20 + Number of bytes sent (bytes): 64,328=20 + Number of bytes received (bytes): 78,780=20 + =20 + Average rate of sent bytes (bytes/sec): 176.24=20 + Average rate of received bytes (bytes/sec): 215.84=20 + =20 + Number of connection errors: 0=20 + Number of send errors: 13=20 + Number of receive errors: 13=20 + Number of timeout errors: 0=20 + =20 +Response Codes=20 + =20 + Response Code: 200 - The request completed successfully.=20 + Count: 187=20 + Percent (%): 100.00=20 +=20 + + + +Joel + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 16:16:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B1490535A7 + for ; + Wed, 27 Apr 2005 16:16:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95836-04 + for ; + Wed, 27 Apr 2005 19:16:00 +0000 (GMT) +Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net + [66.238.115.135]) + by svr1.postgresql.org (Postfix) with ESMTP id 50624535A3 + for ; + Wed, 27 Apr 2005 16:15:58 -0300 (ADT) +Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; + Wed, 27 Apr 2005 12:19:05 -0700 +Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.0); Wed, 27 Apr 2005 12:19:02 -0700 +Received: from barracuda.tecarta.com ([192.168.160.200]) + by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id + M2005042712190102628 + for ; + Wed, 27 Apr 2005 12:19:01 -0700 +X-ASG-Debug-ID: 1114629355-15263-7-0 +X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi +Received: from mail2 (mail2.hq.corp [192.168.160.6]) + by barracuda.tecarta.com (Spam Firewall) with SMTP id 8BFA2202D4C5 + for ; + Wed, 27 Apr 2005 12:15:55 -0700 (PDT) +Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 27 Apr 2005 12:18:57 -0700 +Message-ID: <426FE4DA.8020309@sfnet.cc> +Date: Wed, 27 Apr 2005 12:15:38 -0700 +From: Steve Poe +User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: jd@commandprompt.com +Cc: PostgreSQL Perform +X-ASG-Orig-Subj: Re: [PERFORM] Final decision +Subject: Re: Final decision +References: + + <426FC1CA.4070903@commandprompt.com> +In-Reply-To: <426FC1CA.4070903@commandprompt.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 27 Apr 2005 19:18:57.0421 (UTC) + FILETIME=[F595E3D0:01C54B5D] +X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 + QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 +X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.596 + Rule breakdown below pts rule name description + ---- ---------------------- + -------------------------------------------------- + 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% + [score: 0.5000] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.177 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/743 +X-Sequence-Number: 12140 + +Joshua, + +This article was in July 2002, so is there update to this information? +When will a new ODBC driver be available for testing? Is there a release +of the ODBC driver with better performance than 7.0.3.0200 for a 7.4.x +database? + + +Steve Poe + +> +> We have mentioned it on the list. +> +> http://www.linuxdevcenter.com/pub/a/linux/2002/07/16/drake.html +> +>> Regards, Dave +>> +>> [and yes, I know Joshua said Command Prompt are rewriting /their/ +>> driver] +> +> +> :) No we are rewriting a complete OSS driver. +> +> Sincerely, +> +> Joshua D. Drake +> Command Prompt, Inc. +> +> +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 3: if posting/reading through Usenet, please send an appropriate +>> subscribe-nomail command to majordomo@postgresql.org so that your +>> message can get through to the mailing list cleanly +> +> +> + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 16:29:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B44EB535B4 + for ; + Wed, 27 Apr 2005 16:29:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97696-10 + for ; + Wed, 27 Apr 2005 19:29:01 +0000 (GMT) +Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) + by svr1.postgresql.org (Postfix) with ESMTP id B3C5A535D0 + for ; + Wed, 27 Apr 2005 16:28:56 -0300 (ADT) +Received: from jefftrout.com ([24.61.201.181]) + by comcast.net (rwcrmhc12) with SMTP + id <2005042719285601400ksnebe>; Wed, 27 Apr 2005 19:28:57 +0000 +Received: (qmail 27792 invoked from network); 27 Apr 2005 19:29:34 -0000 +Received: from waltham-nat.ma.lycos.com (HELO ?10.124.7.194?) (209.202.205.1) + by 192.168.0.109 with SMTP; 27 Apr 2005 19:29:34 -0000 +In-Reply-To: <8764y83wg7.fsf@stark.xeocode.com> +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> + <8764y83wg7.fsf@stark.xeocode.com> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: "Anjan Dave" , + +From: Jeff +Subject: Re: Why is this system swapping? +Date: Wed, 27 Apr 2005 15:28:56 -0400 +To: Greg Stark +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.185 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, + RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200504/744 +X-Sequence-Number: 12141 + + +On Apr 27, 2005, at 2:29 PM, Greg Stark wrote: + +> "AI would seriously look at tuning those connection pools down. A lot. +> If your +> server processes are sitting idle over half the time I would at least +> cut it +> by a factor of 2. +> + +Are you (Anjan) using real or fake connection pooling - ie pgpool +versus php's persistent connections ? I'd strongly recommend looking +at pgpool. it does connection pooling correctly (A set of X connections +shared among the entire box rather than 1 per web server) + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 16:44:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D1755535D3 + for ; + Wed, 27 Apr 2005 16:44:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39947-08 + for ; + Wed, 27 Apr 2005 19:43:54 +0000 (GMT) +Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu + [128.255.17.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B5055364A + for ; + Wed, 27 Apr 2005 16:43:51 -0300 (ADT) +Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu + [128.255.17.51]) + by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id + j3RJhpqm026826; (envelope-from ) Wed, + 27 Apr 2005 14:43:51 -0500 (CDT) +Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com + [12.215.118.172]) (authenticated user=jfmeinel) + by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id + j3RJhohQ011315 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); + (envelope-from ) Wed, + 27 Apr 2005 14:43:51 -0500 (CDT) +Message-ID: <426FEB74.9010201@arbash-meinel.com> +Date: Wed, 27 Apr 2005 14:43:48 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Joel Fradkin , + pgsql-performance@postgresql.org +Subject: Re: Final decision +References: <000401c54b59$9d916050$797ba8c0@jfradkin> +In-Reply-To: <000401c54b59$9d916050$797ba8c0@jfradkin> +X-Enigmail-Version: 0.89.6.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig6F39DA62ED606683D0930E7E" +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Scanned: ClamAV version 0.83, + clamav-milter version 0.83 on clamav.icaen.uiowa.edu +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/745 +X-Sequence-Number: 12142 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig6F39DA62ED606683D0930E7E +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Joel Fradkin wrote: + +... + +> +> I am guessing our app is like 75% data entry and 25% reporting, but the +> reporting is taking the toll SQL wise. +> +> This was from my insert test with 15 users. +> Test type: Dynamic +> Simultaneous browser connections: 15 +> Warm up time (secs): 0 +> Test duration: 00:00:03:13 +> Test iterations: 200 +> Detailed test results generated: Yes +> Response Codes +> +> Response Code: 403 - The server understood the request, but is refusing to +> fulfill it. +> Count: 15 +> Percent (%): 0.29 +> +> +> Response Code: 302 - The requested resource resides temporarily under a +> different URI (Uniform Resource Identifier). +> Count: 200 +> Percent (%): 3.85 +> +> +> Response Code: 200 - The request completed successfully. +> Count: 4,980 +> Percent (%): 95.86 +> +> My select test with 25 users had this +> Properties +> +> Test type: Dynamic +> Simultaneous browser connections: 25 +> Warm up time (secs): 0 +> Test duration: 00:00:06:05 +> Test iterations: 200 +> Detailed test results generated: Yes +> +> Summary +> +> Total number of requests: 187 +> Total number of connections: 200 +> +> Average requests per second: 0.51 +> Average time to first byte (msecs): 30,707.42 +> Average time to last byte (msecs): 30,707.42 +> Average time to last byte per iteration (msecs): 28,711.44 +> +> Number of unique requests made in test: 1 +> Number of unique response codes: 1 + +Well, having a bandwidth of 392Bps seems *really* low. I mean that is a +very old modem speed (3200 baud). + +I'm wondering if you are doing a lot of aggregating in the web server, +and if you couldn't move some of that into the database by using plpgsql +functions. + +That would take some of the load off of your IIS servers, and possibly +improve your overall bandwidth. + +But I do agree, it looks like the select side is where you are hurting. +If I understand the numbers correctly, you can do 5k inserts in 3min, +but are struggling to do 200 selects in 6min. + +John +=:-> + +> +> Errors Counts +> +> HTTP: 0 +> DNS: 0 +> Socket: 26 +> +> Additional Network Statistics +> +> Average bandwidth (bytes/sec): 392.08 +> +> Number of bytes sent (bytes): 64,328 +> Number of bytes received (bytes): 78,780 +> +> Average rate of sent bytes (bytes/sec): 176.24 +> Average rate of received bytes (bytes/sec): 215.84 +> +> Number of connection errors: 0 +> Number of send errors: 13 +> Number of receive errors: 13 +> Number of timeout errors: 0 +> +> Response Codes +> +> Response Code: 200 - The request completed successfully. +> Count: 187 +> Percent (%): 100.00 +> +> +> +> +> Joel +> + + +--------------enig6F39DA62ED606683D0930E7E +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFCb+t0JdeBCYSNAAMRArfoAKDJr1dnPcNbHutb29DV3NUCkfHM8ACgm6+k +5XHEeEbP4XdB0AmTGIPvfpY= +=DTO9 +-----END PGP SIGNATURE----- + +--------------enig6F39DA62ED606683D0930E7E-- + +From pgsql-performance-owner@postgresql.org Wed Apr 27 16:47:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7487353683 + for ; + Wed, 27 Apr 2005 16:47:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41468-08 + for ; + Wed, 27 Apr 2005 19:47:19 +0000 (GMT) +Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net + [194.217.242.89]) + by svr1.postgresql.org (Postfix) with ESMTP id 58A7B5364B + for ; + Wed, 27 Apr 2005 16:47:18 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) + id 1DQsSM-0002nK-4W + for pgsql-performance@postgresql.org; Wed, 27 Apr 2005 19:44:22 +0000 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Final decision +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Wed, 27 Apr 2005 20:47:17 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Final decision +Thread-Index: AcVLSKRGv2kF/q/0RiWWAWvalWOCiQAGSX4w +From: "Dave Page" +To: "Joshua D. Drake" +Cc: "Josh Berkus" , "Joel Fradkin" , + "PostgreSQL Perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/746 +X-Sequence-Number: 12143 + +=20 + +> -----Original Message----- +> From: Joshua D. Drake [mailto:jd@commandprompt.com]=20 +> Sent: 27 April 2005 17:46 +> To: Dave Page +> Cc: Josh Berkus; Joel Fradkin; PostgreSQL Perform +> Subject: Re: [PERFORM] Final decision +>=20 +> > It is? No-one told the developers... +>=20 +> We have mentioned it on the list. + +Err, yes. But that's not quite the same as core telling us the current +driver is being replaced. + +Regards, Dave. + +From pgsql-performance-owner@postgresql.org Wed Apr 27 17:54:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DE39453592 + for ; + Wed, 27 Apr 2005 17:54:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64469-05 + for ; + Wed, 27 Apr 2005 20:54:03 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id 6569C53855 + for ; + Wed, 27 Apr 2005 17:53:46 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Why is this system swapping? +Date: Wed, 27 Apr 2005 16:53:36 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF7850989A0@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Why is this system swapping? +Thread-Index: AcVLVw4MwubhRkIsQIuptx8p9j3S9gAA7Erg +From: "Anjan Dave" +To: "Greg Stark" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.071 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/747 +X-Sequence-Number: 12144 + +Yes, HT is turned off (I haven't seen any recommendations to keep it +on). + +This is when we were seeing 30 to 50% less traffic (users) than today - +we didn't want the idle connections in the pool to expire too soon +(default 30 secs, after which it goes back to pool) and reopen it +quickly, or not have sufficient available (default 20 conns, we raised +it to 50), so we figured a number per app server (50) and set that to +expire after a very long time, so as to avoid any overhead, and always +have the connection available whenever needed, without opening a new +one.=20 + +But now, for *some* reason, in some part of the day, we use up almost +all connections in each app's pool. After that since they are set to +expire after a long time, they remain there, taking up DB resources. + +I will be trimming down the idle-timeout to a few minutes first, see if +that helps. + +Thanks, +Anjan + +-----Original Message----- +From: Greg Stark [mailto:gsstark@mit.edu]=20 +Sent: Wednesday, April 27, 2005 2:29 PM +To: Anjan Dave +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Why is this system swapping? + +"Anjan Dave" writes: + +> Some background:=20 +>=20 +> This is a quad XEON (yes, Dell) with 12GB of RAM, pg 7.4...pretty +heavy +> on concurrent usage. With peak traffic (db allows 1000 connections, in +> line with the number of app servers and connection pools for each) +> following is from 'top' (sorted by mem) Shared_buffers is 170MB, +> sort_mem 2MB. Both WAL and pgdata are on separate LUNs on fibre +channel +> storage, RAID10. +>=20 +> 972 processes: 971 sleeping, 1 running, 0 zombie, 0 stopped +>=20 +> CPU states: cpu user nice system irq softirq iowait +idle +> total 57.2% 0.0% 23.2% 0.0% 3.6% 82.8% +232.4% + +This looks to me like most of your server processes are sitting around +idle +most of the time. + +> 21397 postgres 22 0 181M 180M 175M D 25.9 1.5 85:17 0 +> postmaster +>=20 +> 23820 postgres 15 0 178M 177M 175M S 0.0 1.5 1:53 3 +> postmaster + +So each process is taking up 8-11M of ram beyond the shared memory. +1,000 x +10M is 10G. Add in some memory for page tables and kernel data +structures, as +well as the kernel's need to keep some memory set aside for filesystem +buffers +(what you really want all that memory being used for anyways) and you've +used +up all your 12G. + +I would seriously look at tuning those connection pools down. A lot. If +your +server processes are sitting idle over half the time I would at least +cut it +by a factor of 2. + +Working the other direction: you have four processors (I guess you have +hyperthreading turned off?) so ideally what you want is four runnable +processes at all times and as few others as possible. If your load +typically +spends about half the time waiting on i/o (which is what that top output +says) +then you want a total of 8 connections. + +Realistically you might not be able to predict which app server will be +providing the load at any given time, so you might want 8 connections +per app +server.=20 + +And you might have some load that's more i/o intensive than the 50% i/o +load +shown here. Say you think some loads will be 80% i/o, you might want 20 +connections for those loads. If you had 10 app servers with 20 +connections +each for a total of 200 connections I suspect that would be closer to +right +than having 1,000 connections. + +200 connections would consume 2G of ram leaving you with 10G of +filesystem +cache. Which might in turn decrease the percentage of time waiting on +i/o, +which would decrease the number of processes you need even further... + +--=20 + +greg + + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 17:59:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7F74E54091 + for ; + Wed, 27 Apr 2005 17:59:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66568-01 + for ; + Wed, 27 Apr 2005 20:58:57 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (vt-pe2550-001.vantage.com + [64.80.203.244]) + by svr1.postgresql.org (Postfix) with ESMTP id 92F2C538E6 + for ; + Wed, 27 Apr 2005 17:58:56 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Why is this system swapping? +Date: Wed, 27 Apr 2005 16:55:32 -0400 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF785026FF734@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Why is this system swapping? +Thread-Index: AcVLX1ulcj6kXhtDSXemNG78ExC7LAAC9/FA +From: "Anjan Dave" +To: "Jeff" , "Greg Stark" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/748 +X-Sequence-Number: 12145 + +Using Resin's connection pooling. We are looking into pgpool alongside +slony to separate some reporting functionality. + +-anjan + +-----Original Message----- +From: Jeff [mailto:threshar@torgo.978.org]=20 +Sent: Wednesday, April 27, 2005 3:29 PM +To: Greg Stark +Cc: Anjan Dave; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Why is this system swapping? + + +On Apr 27, 2005, at 2:29 PM, Greg Stark wrote: + +> "AI would seriously look at tuning those connection pools down. A lot. + +> If your +> server processes are sitting idle over half the time I would at least=20 +> cut it +> by a factor of 2. +> + +Are you (Anjan) using real or fake connection pooling - ie pgpool=20 +versus php's persistent connections ? I'd strongly recommend looking=20 +at pgpool. it does connection pooling correctly (A set of X connections=20 +shared among the entire box rather than 1 per web server) + +-- + +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 18:01:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D8A5754075 + for ; + Wed, 27 Apr 2005 18:01:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66540-05 + for ; + Wed, 27 Apr 2005 21:01:50 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id C3C4853893 + for ; + Wed, 27 Apr 2005 18:01:49 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id AB34215553; Wed, 27 Apr 2005 16:01:50 -0500 (CDT) +Date: Wed, 27 Apr 2005 16:01:50 -0500 +From: "Jim C. Nasby" +To: Kevin Brown , + 'Postgresql Performance' +Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon +Message-ID: <20050427210150.GB58835@decibel.org> +References: <4266F7B3.7050004@arbash-meinel.com> + <20050423020151.GW58835@decibel.org> <20050423063044.GI19518@filer> + <200504231127.42389.josh@agliodbs.com> + <20050427024652.GA6839@filer> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050427024652.GA6839@filer> +X-Operating-System: FreeBSD 4.11-RELEASE i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/749 +X-Sequence-Number: 12146 + +BTW, http://stats.distributed.net/~decibel/base.log is a test I ran; +select count(*) was ~6x faster than explain analyze select *. + +On Tue, Apr 26, 2005 at 07:46:52PM -0700, Kevin Brown wrote: +> Josh Berkus wrote: +> > Jim, Kevin, +> > +> > > > Hrm... I was about to suggest that for timing just the query (and not +> > > > output/data transfer time) using explain analyze, but then I remembered +> > > > that explain analyze can incur some non-trivial overhead with the timing +> > > > calls. Is there a way to run the query but have psql ignore the output? +> > > > If so, you could use \timing. +> > > +> > > Would timing "SELECT COUNT(*) FROM (query)" work? +> > +> > Just \timing would work fine; PostgreSQL doesn't return anything until it has +> > the whole result set. +> +> Hmm...does \timing show the amount of elapsed time between query start +> and the first results handed to it by the database (even if the +> database itself has prepared the entire result set for transmission by +> that time), or between query start and the last result handed to it by +> the database? +> +> Because if it's the latter, then things like server<->client network +> bandwidth are going to affect the results that \timing shows, and it +> won't necessarily give you a good indicator of how well the database +> backend is performing. I would expect that timing SELECT COUNT(*) +> FROM (query) would give you an idea of how the backend is performing, +> because the amount of result set data that has to go over the wire is +> trivial. +> +> Each is, of course, useful in its own right, and you want to be able +> to measure both (so, for instance, you can get an idea of just how +> much your network affects the overall performance of your queries). +> +> +> > That's why MSSQL vs. PostgreSQL timing comparisons are +> > deceptive unless you're careful: MSSQL returns the results on block at a +> > time, and reports execution time as the time required to return the *first* +> > block, as opposed to Postgres which reports the time required to return the +> > whole dataset. +> +> Interesting. I had no idea MSSQL did that, but I can't exactly say +> I'm surprised. :-) +> +> +> -- +> Kevin Brown kevin@sysexperts.com +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Wed Apr 27 20:46:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A16AB54630 + for ; + Wed, 27 Apr 2005 20:46:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03543-10 + for ; + Wed, 27 Apr 2005 23:46:20 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 65B2E5464B + for ; + Wed, 27 Apr 2005 20:46:17 -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 1DQwEM-0003Lw-00; Wed, 27 Apr 2005 19:46:10 -0400 +To: Jeff +Cc: Greg Stark , "Anjan Dave" , + +Subject: Re: Why is this system swapping? +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> + <8764y83wg7.fsf@stark.xeocode.com> + +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 27 Apr 2005 19:46:10 -0400 +Message-ID: <87r7gv3hrx.fsf@stark.xeocode.com> +Lines: 30 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/750 +X-Sequence-Number: 12147 + +Jeff writes: + +> Are you (Anjan) using real or fake connection pooling - ie pgpool versus php's +> persistent connections ? I'd strongly recommend looking at pgpool. it does +> connection pooling correctly (A set of X connections shared among the entire +> box rather than 1 per web server) + +Having one connection per web process isn't "fake connection pooling", it's a +completely different arrangement. And there's nothing "incorrect" about it. + +In fact I think it's generally superior to having a layer like pgpool having +to hand off all your database communication. Having to do an extra context +switch to handle every database communication is crazy. + +For typical web sites where the database is the only slow component there's +not much point in having more web server processes than connections anyways, +All your doing is transferring the wait time from waiting for a web server +process to waiting for a database process. + +Most applications that find they need connection pooling are using it to work +around a poorly architected system that is mixing static requests (like +images) and database driven requests in the same web server. + +However, your application sounds like it's more involved than a typical web +server. If it's handling many slow resources, such as connections to multiple +databases, SOAP services, mail, or other network services then you may well +need that many processes. In which case you'll need something like pgpool. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Apr 27 20:57:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E5905380D + for ; + Wed, 27 Apr 2005 20:57:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07377-05 + for ; + Wed, 27 Apr 2005 23:57:36 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E7455364B + for ; + Wed, 27 Apr 2005 20:57:35 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [67.103.46.98] (account josh@agliodbs.com HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7294630; Wed, 27 Apr 2005 16:59:36 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Greg Stark +Subject: Re: Why is this system swapping? +Date: Wed, 27 Apr 2005 17:02:49 -0700 +User-Agent: KMail/1.7.1 +Cc: Jeff , "Anjan Dave" , + pgsql-performance@postgresql.org +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> + + <87r7gv3hrx.fsf@stark.xeocode.com> +In-Reply-To: <87r7gv3hrx.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504271702.49992.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/751 +X-Sequence-Number: 12148 + +Greg, + +> In fact I think it's generally superior to having a layer like pgpool +> having to hand off all your database communication. Having to do an extra +> context switch to handle every database communication is crazy. + +Although, one of their issues is that their database connection pooling is +per-server. Which means that a safety margin of pre-allocated connections +(something they need since they get bursts of 1000 new users in a few +seconds) has to be maintained per server, increasing the total number of +connections. + +So a pooling system that allowed them to hold 100 free connections centrally +rather than 10 per server might be a win. + +Better would be getting some of this stuff offloaded onto database replication +slaves. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 28 00:09:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 47BAB53554 + for ; + Thu, 28 Apr 2005 00:09:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56008-10 + for ; + Thu, 28 Apr 2005 03:09:35 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BE0F53A7B + for ; + Thu, 28 Apr 2005 00:09:34 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7295214; Wed, 27 Apr 2005 20:11:30 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: "Dave Page" +Subject: Re: Final decision +Date: Wed, 27 Apr 2005 20:09:27 -0700 +User-Agent: KMail/1.8 +Cc: "Joshua D. Drake" , + "Joel Fradkin" , + "PostgreSQL Perform" +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: <200504272009.27952.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/752 +X-Sequence-Number: 12149 + +Dave, folks, + +> Err, yes. But that's not quite the same as core telling us the current +> driver is being replaced. + +Sorry, I spoke off the cuff. I also was unaware that work on the current +driver had renewed. Us Core people are not omnicient, believe it or don't. + +Mind you, having 2 different teams working on two different ODBC drivers is a +problem for another list ... + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Apr 28 00:37:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DE73154096 + for ; + Thu, 28 Apr 2005 00:37:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62847-03 + for ; + Thu, 28 Apr 2005 03:36:46 +0000 (GMT) +Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E17C53554 + for ; + Thu, 28 Apr 2005 00:36:45 -0300 (ADT) +Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) + by sunsite.dcc.uchile.cl (8.13.4/8.13.4) with ESMTP id j3S3abxv015952; + Wed, 27 Apr 2005 23:36:37 -0400 (CLT) +Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) + id 6D9BC53316; Wed, 27 Apr 2005 23:36:37 -0400 (CLT) +Date: Wed, 27 Apr 2005 23:36:37 -0400 +From: Alvaro Herrera +To: Josh Berkus +Cc: Dave Page , + "Joshua D. Drake" , + PostgreSQL Perform +Subject: ODBC driver overpopulation (was Re: Final decision) +Message-ID: <20050428033637.GB26819@dcc.uchile.cl> +References: + + <200504272009.27952.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200504272009.27952.josh@agliodbs.com> +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.34 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200504/753 +X-Sequence-Number: 12150 + +On Wed, Apr 27, 2005 at 08:09:27PM -0700, Josh Berkus wrote: + +> Mind you, having 2 different teams working on two different ODBC drivers is a +> problem for another list ... + +Only two? I thought another commercial entity was also working on their +own ODBC driver, so there may be three of them. + +-- +Alvaro Herrera () +"Always assume the user will do much worse than the stupidest thing +you can imagine." (Julien PUYDT) + +From pgsql-performance-owner@postgresql.org Thu Apr 28 00:38:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E521654092 + for ; + Thu, 28 Apr 2005 00:38:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63301-03 + for ; + Thu, 28 Apr 2005 03:38:44 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AF7853839 + for ; + Thu, 28 Apr 2005 00:38:43 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3S3WWa3011224; Wed, 27 Apr 2005 20:32:32 -0700 +Message-ID: <42705ABA.6050609@commandprompt.com> +Date: Wed, 27 Apr 2005 20:38:34 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alvaro Herrera +Cc: Josh Berkus , Dave Page , + PostgreSQL Perform +Subject: Re: ODBC driver overpopulation (was Re: Final decision) +References: + + <200504272009.27952.josh@agliodbs.com> + <20050428033637.GB26819@dcc.uchile.cl> +In-Reply-To: <20050428033637.GB26819@dcc.uchile.cl> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/754 +X-Sequence-Number: 12151 + +>>Mind you, having 2 different teams working on two different ODBC drivers is a +>>problem for another list ... +> +> +> Only two? I thought another commercial entity was also working on their +> own ODBC driver, so there may be three of them. + +Well I only know of one company actually working on ODBC actively and +that is Command Prompt, If there are others I would like to hear about +it because I would rather work with someone than against them. + +Sincerely, + +Joshua D. Drake + + + +> + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Thu Apr 28 00:44:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 93E935406E + for ; + Thu, 28 Apr 2005 00:43:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63069-09 + for ; + Thu, 28 Apr 2005 03:43:55 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 05324535C6 + for ; + Thu, 28 Apr 2005 00:43:54 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j3S3boa3011948; Wed, 27 Apr 2005 20:37:51 -0700 +Message-ID: <42705BF9.7070707@commandprompt.com> +Date: Wed, 27 Apr 2005 20:43:53 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dave Page +Cc: Josh Berkus , Joel Fradkin , + PostgreSQL Perform +Subject: Re: Final decision +References: + +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/755 +X-Sequence-Number: 12152 + +Dave Page wrote: +> +> +> +>>-----Original Message----- +>>From: Joshua D. Drake [mailto:jd@commandprompt.com] +>>Sent: 27 April 2005 17:46 +>>To: Dave Page +>>Cc: Josh Berkus; Joel Fradkin; PostgreSQL Perform +>>Subject: Re: [PERFORM] Final decision +>> +>> +>>>It is? No-one told the developers... +>> +>>We have mentioned it on the list. +> +> +> Err, yes. But that's not quite the same as core telling us the current +> driver is being replaced. + +Well I don't think anyone knew that the current driver is still being +maintained? + +Sincerely, + +Joshua D. Drake + + +> +> Regards, Dave. + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-odbc-owner@postgresql.org Thu Apr 28 00:44:16 2005 +X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 957AF5430B; + Thu, 28 Apr 2005 00:44:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63394-08; Thu, 28 Apr 2005 03:44:11 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E8A7542DD; + Thu, 28 Apr 2005 00:44:09 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3S3i5s25117; + Wed, 27 Apr 2005 23:44:05 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504280344.j3S3i5s25117@candle.pha.pa.us> +Subject: Re: ODBC driver overpopulation (was Re: [PERFORM] Final decision) +In-Reply-To: <42705ABA.6050609@commandprompt.com> +To: "Joshua D. Drake" +Date: Wed, 27 Apr 2005 23:44:05 -0400 (EDT) +Cc: Alvaro Herrera , Josh Berkus , + Dave Page , + PostgreSQL Perform , + PostgreSQL odbc list +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/86 +X-Sequence-Number: 5245 + +Joshua D. Drake wrote: +> >>Mind you, having 2 different teams working on two different ODBC drivers is a +> >>problem for another list ... +> > +> > +> > Only two? I thought another commercial entity was also working on their +> > own ODBC driver, so there may be three of them. +> +> Well I only know of one company actually working on ODBC actively and +> that is Command Prompt, If there are others I would like to hear about +> it because I would rather work with someone than against them. + +Well, you should talk to Pervasive because they have a team working on +improving the existing driver. I am sure they would want to work +together too. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Thu Apr 28 00:47:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CB57354079 + for ; + Thu, 28 Apr 2005 00:47:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63394-10 + for ; + Thu, 28 Apr 2005 03:47:31 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D886535C6 + for ; + Thu, 28 Apr 2005 00:47:30 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j3S3lSU25649; + Wed, 27 Apr 2005 23:47:28 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200504280347.j3S3lSU25649@candle.pha.pa.us> +Subject: Re: Final decision +In-Reply-To: <42705BF9.7070707@commandprompt.com> +To: "Joshua D. Drake" +Date: Wed, 27 Apr 2005 23:47:28 -0400 (EDT) +Cc: Dave Page , + Josh Berkus , Joel Fradkin , + PostgreSQL Perform +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/757 +X-Sequence-Number: 12154 + +Joshua D. Drake wrote: +> Dave Page wrote: +> > +> > +> > +> >>-----Original Message----- +> >>From: Joshua D. Drake [mailto:jd@commandprompt.com] +> >>Sent: 27 April 2005 17:46 +> >>To: Dave Page +> >>Cc: Josh Berkus; Joel Fradkin; PostgreSQL Perform +> >>Subject: Re: [PERFORM] Final decision +> >> +> >> +> >>>It is? No-one told the developers... +> >> +> >>We have mentioned it on the list. +> > +> > +> > Err, yes. But that's not quite the same as core telling us the current +> > driver is being replaced. +> +> Well I don't think anyone knew that the current driver is still being +> maintained? + +We have been looking for someone to take over ODBC and Pervasive agreed +to do it, but there wasn't a big announcement about it. I have +discussed this with them. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Thu Apr 28 04:39:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1261854A50 + for ; + Thu, 28 Apr 2005 04:39:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22870-02 + for ; + Thu, 28 Apr 2005 07:39:48 +0000 (GMT) +Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net + [194.217.242.85]) + by svr1.postgresql.org (Postfix) with ESMTP id B2B2E533BE + for ; + Thu, 28 Apr 2005 04:39:40 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) + id 1DR3Zg-0002Dp-GF + for pgsql-performance@postgresql.org; Thu, 28 Apr 2005 07:36:40 +0000 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Final decision +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Thu, 28 Apr 2005 08:39:39 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Final decision +Thread-Index: AcVLn7YXCLP7OqNES3+U/paT5+HiFQAJYMuQ +From: "Dave Page" +To: "Josh Berkus" +Cc: "Joshua D. Drake" , + "Joel Fradkin" , + "PostgreSQL Perform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/758 +X-Sequence-Number: 12155 + +=20 + +> -----Original Message----- +> From: Josh Berkus [mailto:josh@agliodbs.com]=20 +> Sent: 28 April 2005 04:09 +> To: Dave Page +> Cc: Joshua D. Drake; Joel Fradkin; PostgreSQL Perform +> Subject: Re: [PERFORM] Final decision +>=20 +> Dave, folks, +>=20 +> > Err, yes. But that's not quite the same as core telling us=20 +> the current +> > driver is being replaced. +>=20 +> Sorry, I spoke off the cuff. I also was unaware that work=20 +> on the current=20 +> driver had renewed. Us Core people are not omnicient,=20 +> believe it or don't. + +I was under the impression that you and Bruce negiotiated the developer +time! Certainly you and I chatted about it on IRC once... Ahh, well. +Never mind. + +> Mind you, having 2 different teams working on two different=20 +> ODBC drivers is a=20 +> problem for another list ... + +Absolutely. + +Regards, Dave. + +From pgsql-performance-owner@postgresql.org Thu Apr 28 09:13:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1AEDE5406E + for ; + Thu, 28 Apr 2005 09:13:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89936-04 + for ; + Thu, 28 Apr 2005 12:13:41 +0000 (GMT) +Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) + by svr1.postgresql.org (Postfix) with ESMTP id 1CC3C53FE3 + for ; + Thu, 28 Apr 2005 09:13:37 -0300 (ADT) +Received: from jefftrout.com ([24.61.201.181]) + by comcast.net (sccrmhc12) with SMTP + id <2005042812134101200dbedse>; Thu, 28 Apr 2005 12:13:41 +0000 +Received: (qmail 36155 invoked from network); 28 Apr 2005 12:14:20 -0000 +Received: from waltham-nat.ma.lycos.com (HELO ?10.124.7.194?) (209.202.205.1) + by 192.168.0.109 with SMTP; 28 Apr 2005 12:14:20 -0000 +In-Reply-To: <87r7gv3hrx.fsf@stark.xeocode.com> +References: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509899C@vt-pe2550-001.vantage.vantage.com> + <8764y83wg7.fsf@stark.xeocode.com> + + <87r7gv3hrx.fsf@stark.xeocode.com> +Mime-Version: 1.0 (Apple Message framework v619.2) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <2425e7a6ce717809d308bcc9591f6693@torgo.978.org> +Content-Transfer-Encoding: 7bit +Cc: "Anjan Dave" , + +From: Jeff +Subject: Re: Why is this system swapping? +Date: Thu, 28 Apr 2005 08:13:43 -0400 +To: Greg Stark +X-Mailer: Apple Mail (2.619.2) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.182 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, + RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200504/759 +X-Sequence-Number: 12156 + + +On Apr 27, 2005, at 7:46 PM, Greg Stark wrote: + +> In fact I think it's generally superior to having a layer like pgpool +> having +> to hand off all your database communication. Having to do an extra +> context +> switch to handle every database communication is crazy. +> + +I suppose this depends on how many machines / how much traffic you have. + +In one setup I run here I get away with 32 * 4 db connections instead +of 500 * 4. Pretty simple to see the savings on the db machine. (Yes, +it is a "bad design" as you said where static & dynamic content are +served from the same box. However it also saves money since I don't +need machines sitting around serving up pixel.gif vs +myBigApplication.cgi) + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-performance-owner@postgresql.org Thu Apr 28 12:01:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DA4153E6D + for ; + Thu, 28 Apr 2005 12:01:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51473-08 + for ; + Thu, 28 Apr 2005 15:01:17 +0000 (GMT) +Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net + [199.185.220.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 9496553BB3 + for ; + Thu, 28 Apr 2005 12:00:59 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net + (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP + id <20050428150053.GSEX4406.priv-edtnes56.telusplanet.net@localhost>; + Thu, 28 Apr 2005 09:00:53 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 28 Apr 2005 08:00:53 -0700 +Message-ID: <1114700453.4270faa5894b1@webmail.telus.net> +Date: Thu, 28 Apr 2005 08:00:53 -0700 +From: Mischa Sandberg +To: Richard Rowell +Cc: pgsql-performance@postgresql.org, + Mark Rinaudo +Subject: Re: Suggestions for a data-warehouse migration routine +References: <1114618034.7543.36.camel@richard> +In-Reply-To: <1114618034.7543.36.camel@richard> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/760 +X-Sequence-Number: 12157 + +Quoting Richard Rowell : + +> I've ported enough of my companies database to Postgres to make +> warehousing on PG a real possibility. I thought I would toss my +> data +> migration architecture ideas out for the list to shoot apart.. +> +[...] +Not much feedback required. + +Yes, dropping the entire database is faster and simpler. +If your database is small enough that you can rebuild it from scratch +every time, go for it. + +Yes, vacuum analyze required; creating indexes alone does not create +statistics. + + From a I'd dump an extract of pg_stat[io_]user_(tables|indexes) +to see how index usage and table load changes over time. +-- +"Dreams come true, not free." -- S.Sondheim, ITW + + +From pgsql-performance-owner@postgresql.org Thu Apr 28 12:21:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8038953554; + Thu, 28 Apr 2005 12:21:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58578-06; Thu, 28 Apr 2005 15:21:44 +0000 (GMT) +Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id B539C529DF; + Thu, 28 Apr 2005 12:21:40 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net + (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP + id <20050428152137.IFCN14099.priv-edtnes51.telusplanet.net@localhost>; + Thu, 28 Apr 2005 09:21:37 -0600 +Received: from 209.17.183.249 ( [209.17.183.249]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 28 Apr 2005 08:21:36 -0700 +Message-ID: <1114701696.4270ff80d577c@webmail.telus.net> +Date: Thu, 28 Apr 2005 08:21:36 -0700 +From: Mischa Sandberg +To: Josh Berkus +Cc: Andrew Dunstan , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <200504191209.05181.josh@agliodbs.com> + <1114580284.426f253cc0087@webmail.telus.net> + <426F9703.4010108@dunslane.net> + <200504270825.17550.josh@agliodbs.com> +In-Reply-To: <200504270825.17550.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 209.17.183.249 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST, FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200504/761 +X-Sequence-Number: 12158 + +Quoting Josh Berkus : + +> > >Perhaps I can save you some time (yes, I have a degree in Math). If I +> > >understand correctly, you're trying extrapolate from the correlation +> > >between a tiny sample and a larger sample. Introducing the tiny sample +> > >into any decision can only produce a less accurate result than just +> > >taking the larger sample on its own; GIGO. Whether they are consistent +> > >with one another has no relationship to whether the larger sample +> > >correlates with the whole population. You can think of the tiny sample +> > >like "anecdotal" evidence for wonderdrugs. +> +> Actually, it's more to characterize how large of a sample we need. For +> example, if we sample 0.005 of disk pages, and get an estimate, and then +> sample another 0.005 of disk pages and get an estimate which is not even +> close to the first estimate, then we have an idea that this is a table +which +> defies analysis based on small samples. Wheras if the two estimates +are < +> 1.0 stdev apart, we can have good confidence that the table is easily +> estimated. Note that this doesn't require progressively larger +samples; any +> two samples would work. + +We're sort of wandering away from the area where words are a good way +to describe the problem. Lacking a common scratchpad to work with, +could I suggest you talk to someone you consider has a background in +stats, and have them draw for you why this doesn't work? + +About all you can get out of it is, if the two samples are +disjunct by a stddev, yes, you've demonstrated that the union +of the two populations has a larger stddev than either of them; +but your two stddevs are less info than the stddev of the whole. +Breaking your sample into two (or three, or four, ...) arbitrary pieces +and looking at their stddevs just doesn't tell you any more than what +you start with. + +-- +"Dreams come true, not free." -- S.Sondheim, ITW + + +From pgsql-performance-owner@postgresql.org Thu Apr 28 14:45:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 135E656391; + Thu, 28 Apr 2005 14:45:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09087-01; Thu, 28 Apr 2005 17:44:42 +0000 (GMT) +Received: from fep31-app.kolumbus.fi (fep31-0.kolumbus.fi [193.229.0.35]) + by svr1.postgresql.org (Postfix) with ESMTP id AB6D85638D; + Thu, 28 Apr 2005 14:44:39 -0300 (ADT) +Received: from [192.168.1.103] (really [80.186.74.116]) + by fep31-app.kolumbus.fi with ESMTP + id <20050428174438.NHYK15588.fep31-app.kolumbus.fi@[192.168.1.103]>; + Thu, 28 Apr 2005 20:44:38 +0300 +Message-ID: <42712105.6030709@kolumbus.fi> +Date: Thu, 28 Apr 2005 20:44:37 +0300 +From: Marko Ristola +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.6) Gecko/20050324 Debian/1.7.6-1 +X-Accept-Language: en +MIME-Version: 1.0 +To: Greg Stark +Cc: Dave Held , + pgsql-perform , + pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? +References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184E1@asg002.asg.local> + <87ekcw3zsv.fsf@stark.xeocode.com> +In-Reply-To: <87ekcw3zsv.fsf@stark.xeocode.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200504/762 +X-Sequence-Number: 12159 + + +First I will comment my original idea. +Second I will give another improved suggestion (an idea). +I hope, that they will be useful for you. + +(I don't know, wether the first one was useful at all because it showed, +that I and some others of us are not very good with statistics :( ) + +I haven't looked about the PostgreSQL code, so I don't know, that what +is possible +now, and what is not. I do know, that the full table scan and after that +incremental +statistics changes are a very big change, without looking at the code. + + + +I meant the following idea: +- compare two equal sized samples. Then redo the same thing with double +sized samples. So do lots of unnecessary work. +Check out the correlation of the two samples to try to guess the +distribution. + +So I tried to give you an idea, not to give you a full answer into the +whole problem. + + +I did read some parts of the attached PDFs. They did convince me, +that it seems, that the heuristics for the hard cases would actually read +almost the whole table in many cases. + +I did cover the "too little sample" problem by stating that the +user should be able to give the minimum size of samples. This way you would +avoid the too small sampling problem. My purpose was not to achieve at +most 5% wrong estimates, but to decrease the 2000% wrong estimates, that +are +seen now sometimes. + +Conclusions: +- No heuristics or similar thing of small samples will grant excellent +results. +- If you need excellent estimates, you need to process the whole table! +- Some special cases, like primary keys and the unique indexes and special +case column types do give easy ways to make estimates: +For example, wether a boolean column has zero, one or two distinct +values, it does not matter +so much ??? Hashing seems the right choise for all of them. + +If I have understund correctly, the full table scans are out of +questions for large tables at this time. + +The percentage idea of taking 10% samples seems good. + + +So here is another suggestion: +1. Do a full percentage scan, starting at an arbitrary position. If the +user's data is not +homogenous, this hurts it, but this way it is faster. +During that scan, try to figure out all those columns, that have at most +100 distinct values. + +Of course, with it you can't go into 100% accuracy, but if the full +table scan is out of question now, +it is better, if the accuracy is for example at most ten times wrong. + +You could also improve accuracy by instead of doing a 10% partial table +scan, you could +do 20 pieces of 0,5 percent partial table scans: This would improve +accuracy a bit, but keep +the speed almost the same as the partial table scan. + +Here are questions for the statisticians for distinct values calculation: + +If we want at most 1000% tolerance, how big percentage of table's one +column must be processed? + +If we want at most 500% tolerance, how big percentage of table's one +column must be processed? + +If we want at most 250% tolerance, how big percentage of table's one +column must be processed? + +Better to assume, that there are at most 100 distinct values on a table, +if it helps calculations. + +If we try to get as much with one discontinuous partial table scan +(0,1-10% sample), here is the information, we can gather: + +1. We could gather a histogram for max(100) distinct values for each +column for every column. +2. We could measure variance and average, and the number of rows for +these 100 distinct values. +3. We could count the number of rows, that didn't match with these 100 +distinct values: +they were left out from the histogram. +4. We could get a minimum and a maximum value for each column. + +=> We could get exact information about the sample with one 0,1-10% pass +for many columns. + +What you statisticans can gather about these values? +My idea is programmatical combined with statistics: ++ Performance: scan for example 100 blocks each of size 100Mb, because +disc I/O +is much faster this way. ++ Enables larger table percentage. I hope it helps with the statistics +formula. + Required because of more robust statistics: take those blocks at random + (not over each other) places to decrease the effect from hitting +into statistically + bad parts on the table. ++ Less table scan passes: scan all columns with limited hashing in the +first pass. ++ All easy columns are found here with one pass. ++- Harder columns need an own pass each, but we have some preliminary + knoledge of them on the given sample after all (minimum and maximum +values + and the histogram of the 100 distinct values). + +Marko Ristola + +Greg Stark wrote: + +>"Dave Held" writes: +> +> +> +>>>Actually, it's more to characterize how large of a sample +>>>we need. For example, if we sample 0.005 of disk pages, and +>>>get an estimate, and then sample another 0.005 of disk pages +>>>and get an estimate which is not even close to the first +>>>estimate, then we have an idea that this is a table which +>>>defies analysis based on small samples. +>>> +>>> +>>I buy that. +>> +>> +> +>Better yet is to use the entire sample you've gathered of .01 and then perform +>analysis on that sample to see what the confidence interval is. Which is +>effectively the same as what you're proposing except looking at every possible +>partition. +> +>Unfortunately the reality according to the papers that were sent earlier is +>that you will always find the results disappointing. Until your sample is +>nearly the entire table your estimates for n_distinct will be extremely +>unreliable. +> +> +> + + +From pgsql-performance-owner@postgresql.org Thu Apr 28 23:35:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A51D5354D + for ; + Thu, 28 Apr 2005 23:35:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98633-01 + for ; + Fri, 29 Apr 2005 02:35:11 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id A68015347E + for ; + Thu, 28 Apr 2005 23:35:09 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j3T2ZDOl025774 + for pgsql-performance@postgresql.org; Fri, 29 Apr 2005 04:35:13 +0200 +Date: Fri, 29 Apr 2005 04:35:13 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: index on different types +Message-ID: <20050429023512.GB26200@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200504/763 +X-Sequence-Number: 12160 + + +Hi folks, + + +there's often some talk about indices cannot be used if datatypes +dont match. + +On a larger (and long time growed) application I tend to use OID +for references on new tables while old stuff is using integer. +Is the planner smart enough to see both as compatible datatype +or is manual casting required ? + + +thx +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Apr 29 00:28:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E87F653607 + for ; + Fri, 29 Apr 2005 00:28:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08703-10 + for ; + Fri, 29 Apr 2005 03:28:42 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 118B953381 + for ; + Fri, 29 Apr 2005 00:28:37 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3T3SYlI001532 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) + for ; + Thu, 28 Apr 2005 21:28:36 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3T3SYvK068579 + for ; + Thu, 28 Apr 2005 21:28:34 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3T3SYbS068578 + for pgsql-performance@postgresql.org; + Thu, 28 Apr 2005 21:28:34 -0600 (MDT) (envelope-from mfuhr) +Date: Thu, 28 Apr 2005 21:28:34 -0600 +From: Michael Fuhr +To: postgresql performance list +Subject: Re: index on different types +Message-ID: <20050429032834.GA68494@winnie.fuhr.org> +References: <20050429023512.GB26200@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050429023512.GB26200@nibiru.borg.metux.de> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/765 +X-Sequence-Number: 12162 + +On Fri, Apr 29, 2005 at 04:35:13AM +0200, Enrico Weigelt wrote: +> +> there's often some talk about indices cannot be used if datatypes +> dont match. + +PostgreSQL 8.0 is smarter than previous versions in this respect. +It'll use an index if possible even when the types don't match. + +> On a larger (and long time growed) application I tend to use OID +> for references on new tables while old stuff is using integer. + +If you're using OIDs as primary keys then you might wish to reconsider. +See the caveats in the documentation and in the FAQ: + +http://www.postgresql.org/docs/8.0/interactive/datatype-oid.html +http://www.postgresql.org/docs/faqs.FAQ.html#4.12 + +> Is the planner smart enough to see both as compatible datatype +> or is manual casting required ? + +You can use EXPLAIN to see what the planner will do, but be aware +that the planner won't always use an index even if it could: if it +thinks a sequential scan would be faster then it won't use an index. +To see if using an index is possible, you could set enable_seqscan +to off before executing EXPLAIN. In any case, a foreign key column +probably ought to have the same type as the column it references -- +is there a reason for making them different? + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Fri Apr 29 02:18:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 509AC5340F; + Fri, 29 Apr 2005 02:10:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27596-03; Fri, 29 Apr 2005 05:10:20 +0000 (GMT) +Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net + [199.185.220.223]) + by svr1.postgresql.org (Postfix) with ESMTP id 64FB55294C; + Fri, 29 Apr 2005 02:10:18 -0300 (ADT) +Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net + (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP + id <20050429051018.XYME14099.priv-edtnes51.telusplanet.net@localhost>; + Thu, 28 Apr 2005 23:10:18 -0600 +Received: from 64.180.225.200 ( [64.180.225.200]) + as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; + Thu, 28 Apr 2005 22:10:18 -0700 +Message-ID: <1114751418.4271c1ba12544@webmail.telus.net> +Date: Thu, 28 Apr 2005 22:10:18 -0700 +From: a3a18850@telus.net +To: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +Cc: Mischa@telus.net, Sandberg@telus.net +Subject: Re: Distinct-Sampling (Gibbons paper) for Postgres +References: <200504191209.05181.josh@agliodbs.com> + <19276.1114442580@sss.pgh.pa.us> + <1114454941.21529.245.camel@localhost.localdomain> + <200504251213.18565.josh@agliodbs.com> + <426D565E.8040400@dunslane.net> + <1114580284.426f253cc0087@webmail.telus.net> + <426F9703.4010108@dunslane.net> +In-Reply-To: <426F9703.4010108@dunslane.net> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.1-cvs +X-Originating-IP: 64.180.225.200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.418 tagged_above=0 required=5 + tests=DNS_FROM_RFC_POST, FORGED_RCVD_HELO, FROM_ENDS_IN_NUMS, + FROM_HAS_MIXED_NUMS, NO_REAL_NAME +X-Spam-Level: ** +X-Archive-Number: 200504/766 +X-Sequence-Number: 12163 + +Well, this guy has it nailed. He cites Flajolet and Martin, which was (I +thought) as good as you could get with only a reasonable amount of memory per +statistic. Unfortunately, their hash table is a one-shot deal; there's no way +to maintain it once the table changes. His incremental update doesn't degrade +as the table changes. If there isn't the same wrangle of patent as with the +ARC algorithm, and if the existing stats collector process can stand the extra +traffic, then this one is a winner. + +Many thanks to the person who posted this reference in the first place; so +sorry I canned your posting and can't recall your name. + +Now, if we can come up with something better than the ARC algorithm ... + + +From pgsql-performance-owner@postgresql.org Fri Apr 29 02:23:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BA4DA534EB; + Fri, 29 Apr 2005 02:23:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29963-03; Fri, 29 Apr 2005 05:22:58 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id AC9FD53412; + Fri, 29 Apr 2005 02:22:56 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7300313; Thu, 28 Apr 2005 22:24:56 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: a3a18850@telus.net +Subject: Re: Distinct-Sampling (Gibbons paper) for Postgres +Date: Thu, 28 Apr 2005 22:22:51 -0700 +User-Agent: KMail/1.8 +Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +References: <200504191209.05181.josh@agliodbs.com> + <426F9703.4010108@dunslane.net> + <1114751418.4271c1ba12544@webmail.telus.net> +In-Reply-To: <1114751418.4271c1ba12544@webmail.telus.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200504282222.52192.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200504/767 +X-Sequence-Number: 12164 + + +> Now, if we can come up with something better than the ARC algorithm ... + +Tom already did. His clock-sweep patch is already in the 8.1 source. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco +