From pgsql-performance-owner@postgresql.org Wed Nov 30 23:58:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6335B9DD5EB for ; Wed, 30 Nov 2005 23:31:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38756-04-10 for ; Wed, 30 Nov 2005 23:30:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by postgresql.org (Postfix) with ESMTP id 47BE19DD551 for ; Wed, 30 Nov 2005 21:14:09 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=KqiwkcA5JbOu0HqvgMobbRV4j3yL7ye4IKiaLXFlbG5xGosNxS+8t8FkdyGi6hc/; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1Ehd1W-0008Ng-RV; Wed, 30 Nov 2005 20:14:11 -0500 Message-Id: <6.2.5.6.0.20051130190827.01d9c958@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Wed, 30 Nov 2005 20:14:05 -0500 To: "Merlin Moncure" , , "Franklin Haut" From: Ron Subject: Re: RES: pg_dump slow In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD9CC@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD9CC@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcaef3a98c0be186251b44eb86e2905ee0350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/564 X-Sequence-Number: 15821 At 05:13 PM 11/30/2005, Merlin Moncure wrote: > > By default W2K systems often had a default TCP/IP packet size of 576B > > and a tiny RWIN. Optimal for analog modems talking over noisy POTS > > lines, but horrible for everything else > >wrong. default MTU for windows 2000 server is 1500, as was NT4. >http://support.microsoft.com/?id=140375 > LOL. Good to see it is now. I got bit by the problem when it wasn't. >However tweaking rwin is certainly something to look at. > > > >If you're happy that doesn't affect you then I'd look at the disk > > >system - perhaps XP has newer drivers than Win2k. > > I'll reiterate: Do _not_ run a production DB server on W2K. M$ has > > obsoleted the platform and that it is not supported _nor_ any of > > reliable, secure, etc. etc. > >wrong again. WIN2k gets free security hotfixes and paid support until >2010. >http://www.microsoft.com/windows2000/support/lifecycle/ > I've _lived_ what I'm talking about. I've built some of the largest M$ installations in existence at the time of their deployment. Type of Support Availability Mainstream * Paid-per-incident support * Free hotfix support June 30, 2005 Extended * Hourly support * Paid hotfix support June 30, 2010 Security hotfixes Free to all customers through March 31, 2010 From your own source. And good luck getting M$ to give you free support for anything except what _They_ consider to be Their Fault without paying them a boatload of $$$$. The standard M$ party line at this point is "Upgrade, Upgrade, Upgrade. ...Or pay us so much $$$$ to do it that we feel it makes economic sense for M$ to Play Ball". > > A W2K based DB server, particularly one with a connection to the > > Internet, is a ticking time bomb at this point. > > Get off W2K as a production platform ASAP. Take to your > > CEO/Dean/whatever you call your Fearless Leader if you have to. > >wrong again!! There is every reason to believe win2k is *more* secure >than win2003 sever because it is a more stable platform. This of course >depends on what other services are running, firewall issues, etc etc. You evidently do not have a very serious background in network or systems security or professional experience would tell you that your above sentence is dangerously misguided. Reality is that platforms stay marginally secure _only_ by constant patching of newly discovered exploits and never ceasing vigilance looking for new exploits to patch. Regardless of platform. Obsoleted platforms are at greater risk because the White Hats are no longer paying as much attention to them and the Black Hats are basically opportunistic parasites. They play with anything and everything they can get their hands on in the hopes of finding exploitable security flaws. > >> Economically and probably performance wise, it's best to use an Open > > Source OS like Linux or *BSD. However, if you must use M$, at least > > use OS's that M$ is actively supporting. > >I encourage use of open source software. However encouraging other >people to spontaneously switch hardware/software platforms (especially >when they just stated when win2k is a requirement) is just or at least >not helpful. > > > Despite M$ marketing propaganda and a post in this thread to the > > contrary, you =CAN= often run a production DB server under WinXP and > > not pay M$ their usurious licensing fees for W2003 Server or any of > > their other products with "server" in the title. How much RAM and > >you are on a roll here. You must not be aware of 10 connection limit >for win2k pro and winxp pro. > >http://winhlp.com/WxConnectionLimit.htm I'm excruciatingly aware of the 10 connection limit AND how stupid it is. It's one of the reasons, along with what M$ thought they could get away with charging to increase it, M$ got thrown out of my server rooms. Also, we are talking about a _DB_ server. Not a web server or some other function that deals with relatively light load per connection. Just how many open active DB connections do want active concurrently? Not Many. Once all the HW is being utilized to full capacity, DBs get best performance by being asked to do as little as possible concurrently beyond that. Long before you will want more than 10 active open DB connections banging on modest HW you are going to want a queuing system in front of the DB in order to smooth behavior. By the time you _really_ need to support lots of open active DB connections, you will in a position to spend more money (and probably will have to on both better HW and better SW). >There are hackerish ways of getting around this which are illegal. >Cheating to get around this by pooling connections via tcp proxy for >example is also against EULA (and, in my opinion, unethical). I'm sorry you evidently feel your income stream is threatened, but there is no way that is either immoral or illegal for anyone to use the industry standard layered architecture of having a DB connection layer separate from a Queuing system. M$MQ is provided _specifically_ for that use. Certainly "twiddling the bits" inside a M$ OS violates the EULA, and I'm not advocating anything of the kind. OTOH, that Draconian EULA is yet _another_ reason to get rid of M$ OS's in one's organization. When I buy something, it is _mine_. You can tell me you won't support it if I modify it, but it's the height of Hubris to tell me that I'm not allowed to modify SW I paid for and own. Tell your managers/employers at M$ that Customer Service and Respecting Customers =keeps= customers. The reverse loses them. Period. > > how many CPUs you want in your DB server is the main issue. For a > > 1P, <= 4GB RAM vanilla box, WinXp will work just fine. > >Now, who is guilty of propaganda here? There is no propaganda here. The statement is accurate in terms of the information given. The biggest differentiations among M$ licenses is the CPU and RAM limit. >Also, your comments regarding hard disks while correct in the >general sense are not helpful. This is clearly not a disk bandwidth problem. As Evidenced By? His IO numbers are p*ss poor for any reasonable RAID setup, and 375KBps is bad even for a single HD. He's claiming this is local IO, not network, so that possibility is out. If you feel this is "clearly not a disk bandwidth problem", I fail to see your evidence or your alternative hypothesis. > > >What do the MS performance-charts show is happening? Specifically, > > >CPU and disk I/O. > > His original post said ~3% CPU under W2K and ~70% CPU under WinXP > >Slow performance in extraction of bytea column strongly suggests tcp/ip. >issue. I bet if you blanked out bytea column pg_dump will be fast. > >Franlin: are you making pg_dump from local or remote box and is this a >clean install? Try fresh patched win2k install and see what happens. He claimed this was local, not network. It is certainly an intriguing possibility that W2K and WinXP handle bytea differently. I'm not competent to comment on that however. Ron From pgsql-performance-owner@postgresql.org Wed Nov 30 23:55:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 143619DD58E for ; Wed, 30 Nov 2005 23:35:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43457-01-4 for ; Wed, 30 Nov 2005 23:35:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nz.telogis.com (unknown [203.98.10.169]) by postgresql.org (Postfix) with ESMTP id AADFA9DD5E2 for ; Wed, 30 Nov 2005 21:17:08 -0400 (AST) Received: from [192.168.3.1] ([192.168.3.1]) by nz.telogis.com with esmtp; Thu, 01 Dec 2005 14:17:06 +1300 id 00007DD1.438E4F12.00000989 Message-ID: <438E4F12.7060205@telogis.com> Date: Thu, 01 Dec 2005 14:17:06 +1300 From: Ralph Mason User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Query is 800 times slower when running in function! 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/563 X-Sequence-Number: 15820 Hi, I have a simple query that is running inside a plpgsql function. SELECT INTO _point_id id FROM ot2.point WHERE unit_id = _unit_id AND time > _last_status ORDER BY time LIMIT 1; Both _unit_id and _last_status variables in the function. the table has an index on unit_id,point When this runs inside a function it is taking about 800ms. When I run it stand alone it takes about .8 ms, which is a big difference. I can find no reason for this. I have checked that time and _last_status time are both timestamps and unit_id and _unit_id are both oids. The explain looks perfect explain select id from point where unit_id = 95656 and time > '2005-11-30 23:11:00' order by time limit 1; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- Limit (cost=9.94..9.95 rows=1 width=12) -> Sort (cost=9.94..9.95 rows=2 width=12) Sort Key: "time" -> Index Scan using unit_point on point (cost=0.00..9.93 rows=2 width=12) Index Cond: ((unit_id = 95656::oid) AND ("time" > '2005-11-30 23:11:00'::timestamp without time zone)) (5 rows) Time: 0.731 ms A query inside the same function that runs right before this one runs at the expected speed (about 1 ms) SELECT INTO _last_status time FROM ot2.point WHERE unit_id = _unit_id AND flags & 64 = 64 ORDER BY unit_id desc, time DESC LIMIT 1; It uses the same table and indexes. To time individual queries inside the function I am using: tt := (timeofday()::timestamp)-startt; RAISE INFO 'Location A %' , tt; startt := timeofday()::timestamp; tt is an interval and startt is a timestamp. I am out of things to try. Can anyone help? Thanks Ralph From pgsql-performance-owner@postgresql.org Thu Dec 1 00:58:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D01419DD55A for ; Thu, 1 Dec 2005 00:58:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73402-10 for ; Thu, 1 Dec 2005 00:58:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id B5DE19DCD5E for ; Thu, 1 Dec 2005 00:58:00 -0400 (AST) 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 jB14w0e7006649; Wed, 30 Nov 2005 23:58:00 -0500 (EST) To: Ralph Mason cc: pgsql-performance@postgresql.org Subject: Re: Query is 800 times slower when running in function! In-reply-to: <438E4F12.7060205@telogis.com> References: <438E4F12.7060205@telogis.com> Comments: In-reply-to Ralph Mason message dated "Thu, 01 Dec 2005 14:17:06 +1300" Date: Wed, 30 Nov 2005 23:58:00 -0500 Message-ID: <6648.1133413080@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/1 X-Sequence-Number: 15822 Ralph Mason writes: > I have a simple query that is running inside a plpgsql function. > SELECT INTO _point_id id FROM ot2.point WHERE unit_id = _unit_id AND > time > _last_status ORDER BY time LIMIT 1; It would probably help significantly to make that be "ORDER BY unit_id, time". This'd eliminate the need for the separate sort step and encourage the planner to use the index, even when it does not know whether the "time > x" condition is selective or not. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 01:58:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9C8529DCAB5 for ; Thu, 1 Dec 2005 01:58:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07117-06 for ; Thu, 1 Dec 2005 01:58:25 -0400 (AST) X-Greylist: delayed 00:11:46.492656 by SQLgrey- Received: from nrisvf24.index.or.jp (nrigw01.index.or.jp [133.250.250.1]) by postgresql.org (Postfix) with ESMTP id 0F6AF9DCD86 for ; Thu, 1 Dec 2005 01:58:01 -0400 (AST) Received: from nrinaf24.index.or.jp by nrisvf24.index.or.jp (8.11.6p2-20030924/3.7W) id jB15kA817585; Thu, 1 Dec 2005 14:46:10 +0900 (JST) Received: from nrims00b.nri.co.jp [192.50.135.12] by nrinaf24.index.or.jp id sp14576; Thu Dec 1 14:46:09 2005 +0900 (JST) Received: from nrims00b.nri.co.jp (localhost.localdomain [127.0.0.1]) by nrims00b.nri.co.jp (Switch-3.1.4/Switch-3.1.0) with ESMTP id jB15k9br018213; Thu, 1 Dec 2005 14:46:09 +0900 Received: (from mailnull@localhost) by nrims00b.nri.co.jp (Switch-3.1.4/Switch-3.1.0/Submit) id jB15k99w018211; Thu, 1 Dec 2005 14:46:09 +0900 Received: from milan.nri.co.jp (milan.nri.co.jp [192.169.128.50]) by nrims00b.nri.co.jp (Switch-3.1.4/Switch-3.1.0) with ESMTP id jB15k9IL018207 for ; Thu, 1 Dec 2005 14:46:09 +0900 Received: from julia ([192.173.215.60]) by milan.nri.co.jp (8.9.1/3.7W99070910) with SMTP id OAA12817 for ; Thu, 1 Dec 2005 14:43:13 +0900 Message-ID: <00d101c5f63b$33348330$3cd7adc0@julia> From: "Tatsumi Abe" To: Subject: About the relation between fragmentation of file and VACUUM Date: Thu, 1 Dec 2005 14:50:56 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.812 required=5 tests=[RCVD_IN_WHOIS_BOGONS=1.811, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 1.812 X-Spam-Level: * X-Archive-Number: 200512/2 X-Sequence-Number: 15823 Question is about the relation between fragmentation of file and VACUUM performance. OS$B!'(BRedHat Enterprise Linux AS Release 3(Taroon Update 6) Kernel 2.4.21-37.ELsmp on an i686 Filesystem Type ext3 Filesystem features: has_journal filetype needs_recovery sparse_super large_file CPU$B!'(BIntel(R) Xeon(TM) CPU 2.80GHz stepping 01 Memory$B!'(B2.0GB HDD$B!'(B80GB$B!J(BS-ATA$B!K(B SATA max UDMA/133 PostgreSQL$B!'(B7.3.8 1. Approx. there are 3500 tables in the DB 2. Index is attached to table. 3. Every two minutes interval approx. 10,000 records are inserted into 1000tables. So total 7,200,000 records are inserted in 1000 tables per days 4. Tables data are saved for 7 days.Older than 7 days data are deleted. So maximum total records 50,400,000 can be exist in DB. 5. VACCUME is executed against DB as below Six times a day i.e. every 4 hours the VACCUME ANALYZE is started once. And out of the six times once VACCUME FULL ANALYZE is processed. At the beginning, volume of data increases linearly because the records are added for seven days. After seven days older than seven days data are deleted. So volume of data will not increase after seventh days. When the performance of inserting data was measured in the above- mentioned environment, it takes six minutes to write 10000 lines after 4/5 days the measurement had begun. While searching the reason of bottleneck by executing iostat command it is understood that DISK I/O was problem for the neck as %iowait was almost 100% at that time. On the very first day processing time of VACUUM is not a problem but when the day progress its process time is increasing.Then I examined the fragmentation of database area(pgsql/data/base) by using the following tools. Disk Allocation Viewer http://sourceforge.net/projects/davtools/ Fragmentation rate is 28% before defrag. The processing time of VACUUM became 20 minutes, and also inserting data took short time, when data base area (pgsql/data/base) was copied, deleted, copied again, and the fragmentation was canceled (defrag). Moreover, After the fragmentation cancelled the processing time for VACCUM was 20 minutes, but after 7 days it took 40 minutes for processing.When again checked the fragmentation rate with the tool it was 11%.Therefore, it is understood that the fragmentation progresses again. However, In my current environment I can't stop PostgreSQL and cancel fragmentation. Could anyone advise some solutions for this fragmentation problem without stopping PostgreSQL ? For example, using the followings or anything else.. -Tuning of postgresql.conf -PostgreSQL(8.1.0) of latest version and VACUUM Thanks in advance. Abe From pgsql-performance-owner@postgresql.org Thu Dec 1 06:05:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 088839DD60E for ; Thu, 1 Dec 2005 06:05:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20750-02 for ; Thu, 1 Dec 2005 06:05:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id E9AF09DD602 for ; Thu, 1 Dec 2005 06:05:37 -0400 (AST) 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 54E99441754; Thu, 1 Dec 2005 09:59:49 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 981F5FF1A; Thu, 1 Dec 2005 09:59:54 +0000 (GMT) Message-ID: <438EC99A.7000506@archonet.com> Date: Thu, 01 Dec 2005 09:59:54 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Tatsumi Abe Cc: pgsql-performance@postgresql.org Subject: Re: About the relation between fragmentation of file and References: <00d101c5f63b$33348330$3cd7adc0@julia> In-Reply-To: <00d101c5f63b$33348330$3cd7adc0@julia> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/3 X-Sequence-Number: 15824 Tatsumi Abe wrote: > Question is about the relation between fragmentation of file and VACUUM > performance. > > > OS$B!'(BRedHat Enterprise Linux AS Release 3(Taroon Update 6) > Kernel 2.4.21-37.ELsmp on an i686 > Filesystem Type ext3 > Filesystem features: has_journal filetype needs_recovery sparse_super large_file > CPU$B!'(BIntel(R) Xeon(TM) CPU 2.80GHz stepping 01 > Memory$B!'(B2.0GB > HDD$B!'(B80GB$B!J(BS-ATA$B!K(B > SATA max UDMA/133 > PostgreSQL$B!'(B7.3.8 > > > 1. Approx. there are 3500 tables in the DB > When the performance of inserting data was measured in the above- > mentioned environment, it takes six minutes to write 10000 lines > after 4/5 days the measurement had begun. While searching the reason > of bottleneck by executing iostat command it is understood that DISK I/O > was problem for the neck as %iowait was almost 100% at that time. > > On the very first day processing time of VACUUM is not a problem but > when the day progress its process time is increasing.Then I examined the > fragmentation of database area(pgsql/data/base) by using the following tools. > > Disk Allocation Viewer > http://sourceforge.net/projects/davtools/ > > Fragmentation rate is 28% before defrag. I'd guess the root of your problem is the number of tables (3500), which if each has one index represents at least 7000 files. That means a lot of your I/O time will probably be spent moving the disk heads between the different files. You say you can't stop the server, so there's no point in thinking about a quick hardware upgrade to help you. Also a version-upgrade is not do-able for you. I can only think of two other options: 1. Change the database schema to reduce the number of tables involved. I'm assuming that of the 3500 tables most hold the same data but for different clients (or something similar). This might not be practical either. 2. Re-order how you access the database. ANALYSE the updated tables regularly, but only VACUUM them after deletions. Group your inserts so that all the inserts for table1 go together, then all the inserts for table2 go together and so on. This should help with the fragmentation by making sure the files get extended in larger chunks. Are you sure it's not possible to spend 15 mins offline to solve this? -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Dec 1 08:00:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8C3CF9DD602 for ; Thu, 1 Dec 2005 08:00:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27395-02 for ; Thu, 1 Dec 2005 08:00:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id D91159DD626 for ; Thu, 1 Dec 2005 08:00:25 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.123.101]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQT008E4IORBA96@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 01 Dec 2005 06:00:28 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 292F66D4879 for ; Thu, 01 Dec 2005 07:00:29 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 24091-03 for ; Thu, 01 Dec 2005 07:00:29 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 023686D4878; Thu, 01 Dec 2005 07:00:28 -0500 (EST) Date: Thu, 01 Dec 2005 07:00:28 -0500 From: Michael Stone Subject: Re: About the relation between fragmentation of file and In-reply-to: <00d101c5f63b$33348330$3cd7adc0@julia> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051201120028.GA7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <00d101c5f63b$33348330$3cd7adc0@julia> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/5 X-Sequence-Number: 15826 On Thu, Dec 01, 2005 at 02:50:56PM +0900, Tatsumi Abe wrote: >Could anyone advise some solutions for this fragmentation problem >without stopping PostgreSQL ? Stop doing VACUUM FULL so often. If your table size is constant anyway you're just wasting time by compacting the table and shrinking it, and encouraging fragmentation as each table file grows then shrinks a little bit each day. Mike Stone From pgsql-performance-owner@postgresql.org Thu Dec 1 11:29:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0D5E99DD65C for ; Thu, 1 Dec 2005 11:29:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40143-06 for ; Thu, 1 Dec 2005 11:29:49 -0400 (AST) X-Greylist: delayed 03:07:30.210225 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 2BC8F9DD67B for ; Thu, 1 Dec 2005 11:27:09 -0400 (AST) Received: from mail.invendra.net (unknown [66.139.76.16]) by svr2.postgresql.org (Postfix) with ESMTP id DD1C9F0B2A for ; Thu, 1 Dec 2005 12:16:59 +0000 (GMT) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 761881AC3EA; Thu, 1 Dec 2005 04:11:52 -0800 (PST) Date: Thu, 1 Dec 2005 04:11:09 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Richard Huxton Cc: Tatsumi Abe , pgsql-performance@postgresql.org Subject: Re: About the relation between fragmentation of file and In-Reply-To: <438EC99A.7000506@archonet.com> Message-ID: References: <00d101c5f63b$33348330$3cd7adc0@julia> <438EC99A.7000506@archonet.com> MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: Content-Type: TEXT/PLAIN; charset=iso-2022-jp; format=flowed Content-Transfer-Encoding: 8BIT X-Archive-Number: 200512/14 X-Sequence-Number: 15835 On Thu, 1 Dec 2005, Richard Huxton wrote: > Tatsumi Abe wrote: >> Question is about the relation between fragmentation of file and VACUUM >> performance. >> >> >> OS��RedHat Enterprise Linux AS Release 3(Taroon Update 6) >> Kernel 2.4.21-37.ELsmp on an i686 >> Filesystem Type ext3 >> Filesystem features: has_journal filetype needs_recovery sparse_super large_file try different filesystems, ext2/3 do a very poor job when you have lots of files in a directory (and 7000+ files is a lot). you can also try mounting the filesystem with noatime, nodiratime to reduce the seeks when reading, and try mounting it with oldalloc (which changes how the files are arranged on disk when writing and extending them), I've seen drastic speed differences between ext2 and ext3 based on this option (ext2 defaults to oldalloc, ext3 defaults to orlov, which is faster in many cases) >> CPU��Intel(R) Xeon(TM) CPU 2.80GHz stepping 01 >> Memory��2.0GB >> HDD��80GB��S-ATA�� >> SATA max UDMA/133 >> PostgreSQL��7.3.8 >> >> >> 1. Approx. there are 3500 tables in the DB > >> When the performance of inserting data was measured in the above- >> mentioned environment, it takes six minutes to write 10000 lines >> after 4/5 days the measurement had begun. While searching the reason >> of bottleneck by executing iostat command it is understood that DISK I/O >> was problem for the neck as %iowait was almost 100% at that time. >> >> On the very first day processing time of VACUUM is not a problem but >> when the day progress its process time is increasing.Then I examined the >> fragmentation of database area(pgsql/data/base) by using the following tools. >> >> Disk Allocation Viewer >> http://sourceforge.net/projects/davtools/ >> >> Fragmentation rate is 28% before defrag. > > I'd guess the root of your problem is the number of tables (3500), which > if each has one index represents at least 7000 files. That means a lot > of your I/O time will probably be spent moving the disk heads between > the different files. depending on the size of the tables it can actually be a lot worse then this (remember Postgres splits the tables into fixed size chunks) when postgres adds data it will eventually spill over into additional files, when you do a vaccum does it re-write the tables into a smaller number of files or just rewrite the individual files (makeing each of them smaller, but keeping the same number of files) speaking of this, the selection of the size of these chunks is a comprimize between the time needed to seek in an individual file and the number of files that are created, is there an easy way to tinker with this (I am sure the default is not correct for all filesystems, the filesystem handling of large and/or many files differ drasticly) > You say you can't stop the server, so there's no point in thinking about > a quick hardware upgrade to help you. Also a version-upgrade is not > do-able for you. there's a difference between stopping the server once for an upgrade (hardware or software) and having to stop it every few days to defrag things forever after. David Lang > I can only think of two other options: > 1. Change the database schema to reduce the number of tables involved. > I'm assuming that of the 3500 tables most hold the same data but for > different clients (or something similar). This might not be practical > either. > > 2. Re-order how you access the database. ANALYSE the updated tables > regularly, but only VACUUM them after deletions. Group your inserts so > that all the inserts for table1 go together, then all the inserts for > table2 go together and so on. This should help with the fragmentation by > making sure the files get extended in larger chunks. > > Are you sure it's not possible to spend 15 mins offline to solve this? > -- > Richard Huxton > Archonet Ltd > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > >From pgsql-performance-owner@postgresql.org Thu Dec 1 11:42:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8D5629DD693 for ; Thu, 1 Dec 2005 11:42:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47445-02 for ; Thu, 1 Dec 2005 11:42:33 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by postgresql.org (Postfix) with ESMTP id 33AAC9DD684 for ; Thu, 1 Dec 2005 11:42:35 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i23so251782wra for ; Thu, 01 Dec 2005 07:42:41 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=E4tCkbGCIfoLMxAWvaMP+9C0TYVeKZ+/7VvYQHsgMWOPJ2NOGn0g076GCQQc5Ze4OD+x1V+8JkkLLB+NcPcD+da+77XwoGaSPgZfo5V0rnsu0nL+5PbEpl628bG8Vvhu8jGGoc7qLq4+4NAdxnZ1kd6+9Jm+BVGX5iUBIVZsFCs= Received: by 10.65.38.14 with SMTP id q14mr871367qbj; Thu, 01 Dec 2005 07:42:39 -0800 (PST) Received: by 10.65.180.14 with HTTP; Thu, 1 Dec 2005 07:42:39 -0800 (PST) Message-ID: Date: Thu, 1 Dec 2005 10:42:39 -0500 From: Jaime Casanova To: Michael Riess Subject: Re: 15,000 tables 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/15 X-Sequence-Number: 15836 On 12/1/05, Michael Riess wrote: > Hi, > > we are currently running a postgres server (upgraded to 8.1) which has > one large database with approx. 15,000 tables. Unfortunately performance > suffers from that, because the internal tables (especially that which > holds the attribute info) get too large. > > (We NEED that many tables, please don't recommend to reduce them) > Have you ANALYZEd your database? VACUUMing? BTW, are you using some kind of weird ERP? I have one that treat informix as a fool and don't let me get all of informix potential... maybe the same is in your case... -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Thu Dec 1 07:32:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BD7A39DD5F5 for ; Thu, 1 Dec 2005 07:32:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85216-05 for ; Thu, 1 Dec 2005 07:32:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by postgresql.org (Postfix) with ESMTP id 757E49DD43B for ; Thu, 1 Dec 2005 07:32:12 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 71so8313wri for ; Thu, 01 Dec 2005 03:32:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:x-mimeole:in-reply-to:importance; b=hNTomoHCaN9n9w6Z7vXewmcXet8YZp5iGNNXLOihFncVCGZHXxsBUCwEqgpSsJX2kWzQvFdWymbFDwD1XWoZpp8OarsMDdhqG+yDN/EpE2W1AIWpX7YU6kADwsDwhzzdMuZW6GSuwZ5+W8+cw3qHpeOds7EaM6dzhoNyDI09z2E= Received: by 10.54.60.40 with SMTP id i40mr872608wra; Thu, 01 Dec 2005 03:32:14 -0800 (PST) Received: from FRANKLIN ( [200.180.51.99]) by mx.gmail.com with ESMTP id 26sm2055423wrl.2005.12.01.03.32.13; Thu, 01 Dec 2005 03:32:14 -0800 (PST) From: "Franklin Haut" To: "'Ron'" , Subject: pg_dump slow Date: Thu, 1 Dec 2005 09:29:35 -0300 Message-ID: <000301c5f672$e5473180$8500a8c0@FRANKLIN> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 In-Reply-To: <6.2.5.6.0.20051130190827.01d9c958@earthlink.net> Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/4 X-Sequence-Number: 15825 I Maked a new install on machine this night, and the same results, on console localhost Windows 2000 Server Version 5.00.2195 PG Version 8.1 Franklin >Franlin: are you making pg_dump from local or remote box and is this a >clean install? Try fresh patched win2k install and see what happens. He claimed this was local, not network. It is certainly an intriguing possibility that W2K and WinXP handle bytea differently. I'm not competent to comment on that however. From pgsql-performance-owner@postgresql.org Thu Dec 1 09:34:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5CD819DD44A for ; Thu, 1 Dec 2005 09:34:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87473-02 for ; Thu, 1 Dec 2005 09:34:35 -0400 (AST) X-Greylist: delayed 01:00:00.46202 by SQLgrey- Received: from nt-home.ipworldcom.ch (unknown [212.74.134.180]) by postgresql.org (Postfix) with ESMTP id 661BE9DCAB5 for ; Thu, 1 Dec 2005 09:34:37 -0400 (AST) Received: from [212.74.168.29] (account wgehner@infonoia.ch HELO [10.0.1.112]) by nt-home.ipworldcom.ch (CommuniGate Pro SMTP 4.3.6) with ESMTPA id 17561328; Thu, 01 Dec 2005 13:34:38 +0100 Message-ID: <438EED91.9080302@infonoia.com> Date: Thu, 01 Dec 2005 13:33:21 +0100 From: Wolfgang Gehner User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: slow insert into very large table Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/7 X-Sequence-Number: 15828 Hi there, I need a simple but large table with several million records. I do batch inserts with JDBC. After the first million or so records, the inserts degrade to become VERY slow (like 8 minutes vs initially 20 secondes). The table has no indices except PK while I do the inserts. This is with PostgreSQL 8.0 final for WindowsXP on a Pentium 1.86 GHz, 1GB Memory. HD is fast IDE. I already have shared buffers already set to 25000. I wonder what else I can do. Any ideas? Kindest regards, Wolfgang Gehner -- Infonoia SA 7 rue de Berne 1211 Geneva 1 Tel: +41 22 9000 009 Fax: +41 22 9000 018 http://www.infonoia.com From pgsql-performance-owner@postgresql.org Thu Dec 1 08:44:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 56E659DD64B for ; Thu, 1 Dec 2005 08:44:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64168-04 for ; Thu, 1 Dec 2005 08:44:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from bfccomputing.com (bfccomputing.com [217.160.248.65]) by postgresql.org (Postfix) with ESMTP id 53B359DD5F5 for ; Thu, 1 Dec 2005 08:44:27 -0400 (AST) Received: from [10.0.0.42] (68-169-200-61.sbtnvt.adelphia.net [68.169.200.61]) by bfccomputing.com (Postfix) with ESMTP id 6E902E8117; Thu, 1 Dec 2005 07:44:23 -0500 (EST) In-Reply-To: <00d101c5f63b$33348330$3cd7adc0@julia> References: <00d101c5f63b$33348330$3cd7adc0@julia> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: From: Bill McGonigle Subject: Re: About the relation between fragmentation of file and VACUUM Date: Thu, 1 Dec 2005 07:44:22 -0500 To: "Tatsumi Abe" X-Mailer: Apple Mail (2.623) X-bfccomputing-MailScanner-Information: Please contact the ISP for more information X-bfccomputing-MailScanner: Found to be clean X-bfccomputing-MailScanner-SpamCheck: X-MailScanner-From: bill@bfccomputing.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/6 X-Sequence-Number: 15827 On Dec 1, 2005, at 00:50, Tatsumi Abe wrote: > However, In my current environment I can't stop PostgreSQL and cancel > fragmentation. > > Could anyone advise some solutions for this fragmentation problem > without stopping PostgreSQL ? This is somewhat of an aside and intended just as a helpful suggestion since I've been in this spot before: if you have this kind of uptime requirement the first project to work on is getting the environment to the point where you can take out at least one database server at a time for maintenance. You're going to be forced to do this sooner or later - whether by disk failure, software error (Pg or OS), user error (restore from backup) or security issues (must patch fixes). So disk fragmentation is a great thing to worry about at some point, but IMHO you've got your neck under the guillotine and worrying about your cuticles. I've heard the arguments before, usually around budget, and if the company can't spend any money but needs blood-from-stone performance tweaks, somebody isn't doing the math right (I'm assuming this isn't running on a satellite). Plus, your blood pressure will go down when things are more resilient. I've tried the superhero thing before and it's just not worth it. -Bill ----- Bill McGonigle, Owner Work: 603.448.4440 BFC Computing, LLC Home: 603.448.1668 bill@bfccomputing.com Mobile: 603.252.2606 http://www.bfccomputing.com/ Pager: 603.442.1833 Jabber: flowerpt@gmail.com Text: bill+text@bfccomputing.com Blog: http://blog.bfccomputing.com/ From pgsql-performance-owner@postgresql.org Thu Dec 1 09:42:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9119C9DD648 for ; Thu, 1 Dec 2005 09:42:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86457-07 for ; Thu, 1 Dec 2005 09:42:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id D613A9DD64B for ; Thu, 1 Dec 2005 09:42:14 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 1229B3368B; Thu, 1 Dec 2005 14:42:18 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: 15,000 tables Date: Thu, 01 Dec 2005 14:42:14 +0100 Organization: Hub.Org Networking Services Lines: 23 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/8 X-Sequence-Number: 15829 Hi, we are currently running a postgres server (upgraded to 8.1) which has one large database with approx. 15,000 tables. Unfortunately performance suffers from that, because the internal tables (especially that which holds the attribute info) get too large. (We NEED that many tables, please don't recommend to reduce them) Logically these tables could be grouped into 500 databases. My question is: Would performance be better if I had 500 databases (on one postgres server instance) which each contain 30 tables, or is it better to have one large database with 15,000 tables? In the old days of postgres 6.5 we tried that, but performance was horrible with many databases ... BTW: I searched the mailing list, but found nothing on the subject - and there also isn't any information in the documentation about the effects of the number of databases, tables or attributes on the performance. Now, what do you say? Thanks in advance for any comment! Mike From pgsql-performance-owner@postgresql.org Thu Dec 1 10:00:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E76A09DCD35 for ; Thu, 1 Dec 2005 10:00:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88183-10 for ; Thu, 1 Dec 2005 10:00:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by postgresql.org (Postfix) with ESMTP id B7FD19DCAB5 for ; Thu, 1 Dec 2005 10:00:05 -0400 (AST) Received: from [84.143.28.162] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis), id 0ML29c-1Ehoyn0F7B-0002rH; Thu, 01 Dec 2005 15:00:09 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1Ehoym-0003Ho-LF; Thu, 01 Dec 2005 15:00:08 +0100 Message-ID: <438F01E7.9000300@pse-consulting.de> Date: Thu, 01 Dec 2005 14:00:07 +0000 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Wolfgang Gehner CC: pgsql-performance@postgresql.org Subject: Re: slow insert into very large table References: <438EED91.9080302@infonoia.com> In-Reply-To: <438EED91.9080302@infonoia.com> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/9 X-Sequence-Number: 15830 Wolfgang Gehner wrote: > Hi there, > > I need a simple but large table with several million records. I do batch > inserts with JDBC. After the first million or so records, > the inserts degrade to become VERY slow (like 8 minutes vs initially 20 > secondes). > > The table has no indices except PK while I do the inserts. > > This is with PostgreSQL 8.0 final for WindowsXP on a Pentium 1.86 GHz, > 1GB Memory. HD is fast IDE. > > I already have shared buffers already set to 25000. > > I wonder what else I can do. Any ideas? Run VACUUM ANALYZE to have statistics reflect the growth of the table. The planner probably still assumes your table to be small, and thus takes wrong plans to check PK indexes or so. Regards, Andreas From pgsql-performance-owner@postgresql.org Thu Dec 1 10:20:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9854D9DD62D for ; Thu, 1 Dec 2005 10:20:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06208-04-2 for ; Thu, 1 Dec 2005 10:20:39 -0400 (AST) X-Greylist: delayed 02:05:07.514917 by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 897C29DD679 for ; Thu, 1 Dec 2005 10:17:55 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 2F8031AC3EA; Thu, 1 Dec 2005 06:16:56 -0800 (PST) Date: Thu, 1 Dec 2005 06:16:17 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Michael Riess Cc: pgsql-performance@postgresql.org Subject: Re: 15,000 tables 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/10 X-Sequence-Number: 15831 On Thu, 1 Dec 2005, Michael Riess wrote: > Hi, > > we are currently running a postgres server (upgraded to 8.1) which has one > large database with approx. 15,000 tables. Unfortunately performance suffers > from that, because the internal tables (especially that which holds the > attribute info) get too large. is it becouse the internal tables get large, or is it a problem with disk I/O? with 15,000 tables you are talking about a LOT of files to hold these (30,000 files with one index each and each database being small enough to not need more then one file to hold it), on linux ext2/3 this many files in one directory will slow you down horribly. try different filesystems (from my testing and from other posts it looks like XFS is a leading contender), and also play around with the tablespaces feature in 8.1 to move things out of the main data directory into multiple directories. if you do a ls -l on the parent directory you will see that the size of the directory is large if it's ever had lots of files in it, the only way to shrink it is to mv the old directory to a new name, create a new directory and move the files from the old directory to the new one. David Lang From pgsql-performance-owner@postgresql.org Thu Dec 1 11:15:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9FB489DD66B for ; Thu, 1 Dec 2005 11:15:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19652-09 for ; Thu, 1 Dec 2005 11:15:38 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id A1DD09DD592 for ; Thu, 1 Dec 2005 11:15:40 -0400 (AST) 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 jB1FFb3O035639 for ; Thu, 1 Dec 2005 15:15:37 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id jB1EpUFv024487 for pgsql-performance@postgresql.org; Thu, 1 Dec 2005 14:51:30 GMT (envelope-from news) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables Date: Thu, 01 Dec 2005 15:51:37 +0100 Organization: Hub.Org Networking Services Lines: 12 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-1.44 required=5 tests=[ALL_TRUSTED=-1.44] X-Spam-Score: -1.44 X-Spam-Level: X-Archive-Number: 200512/13 X-Sequence-Number: 15834 Hi David, > > with 15,000 tables you are talking about a LOT of files to hold these > (30,000 files with one index each and each database being small enough > to not need more then one file to hold it), on linux ext2/3 this many > files in one directory will slow you down horribly. We use ReiserFS, and I don't think that this is causing the problem ... although it would probably help to split the directory up using tablespaces. But thanks for the suggestion! From pgsql-performance-owner@postgresql.org Thu Dec 1 11:15:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9F4929DD65C for ; Thu, 1 Dec 2005 11:15:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31891-06 for ; Thu, 1 Dec 2005 11:15:38 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id 80A5C9DCBEC for ; Thu, 1 Dec 2005 11:15:40 -0400 (AST) 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 jB1FFb3M035639 for ; Thu, 1 Dec 2005 15:15:37 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id jB1Etvqe026531 for pgsql-performance@postgresql.org; Thu, 1 Dec 2005 14:55:57 GMT (envelope-from news) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables Date: Thu, 01 Dec 2005 15:56:02 +0100 Organization: Hub.Org Networking Services Lines: 8 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-1.44 required=5 tests=[ALL_TRUSTED=-1.44] X-Spam-Score: -1.44 X-Spam-Level: X-Archive-Number: 200512/12 X-Sequence-Number: 15833 Hi David, incidentally: The directory which holds our datbase currently contains 73883 files ... do I get a prize or something? ;-) Regards, Mike From pgsql-performance-owner@postgresql.org Thu Dec 1 11:13:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 540DF9DD592 for ; Thu, 1 Dec 2005 11:13:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20954-09 for ; Thu, 1 Dec 2005 11:13:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 0EDEA9DCBEC for ; Thu, 1 Dec 2005 11:10:38 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 0BA911AC3EA for ; Thu, 1 Dec 2005 07:09:41 -0800 (PST) Date: Thu, 1 Dec 2005 07:09:02 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: pgsql-performance@postgresql.org Subject: filesystem performance with lots of files 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/11 X-Sequence-Number: 15832 this subject has come up a couple times just today (and it looks like one that keeps popping up). under linux ext2/3 have two known weaknesses (or rather one weakness with two manifestations). searching through large objects on disk is slow, this applies to both directories (creating, opening, deleting files if there are (or have been) lots of files in a directory), and files (seeking to the right place in a file). the rule of thumb that I have used for years is that if files get over a few tens of megs or directories get over a couple thousand entries you will start slowing down. common places you can see this (outside of postgres) 1. directories, mail or news storage. if you let your /var/spool/mqueue directory get large (for example a server that can't send mail for a while or mail gets misconfigured on). there may only be a few files in there after it gets fixed, but if the directory was once large just doing a ls on the directory will be slow. news servers that store each message as a seperate file suffer from this as well, they work around it by useing multiple layers of nested directories so that no directory has too many files in it (navigating the layers of directories costs as well, it's all about the tradeoffs). Mail servers that use maildir (and Cyrus which uses a similar scheme) have the same problem. to fix this you have to create a new directory and move the files to that directory (and then rename the new to the old) ext3 has an option to make searching directories faster (htree), but enabling it kills performance when you create files. And this doesn't help with large files. 2. files, mbox formatted mail files and log files as these files get large, the process of appending to them takes more time. syslog makes this very easy to test. On a box that does syncronous syslog writing (default for most systems useing standard syslog, on linux make sure there is not a - in front of the logfile name) time how long it takes to write a bunch of syslog messages, then make the log file large and time it again. a few weeks ago I did a series of tests to compare different filesystems. the test was for a different purpose so the particulars are not what I woud do for testing aimed at postgres, but I think the data is relavent) and I saw major differences between different filesystems, I'll see aobut re-running the tests to get a complete set of benchmarks in the next few days. My tests had their times vary from 4 min to 80 min depending on the filesystem in use (ext3 with hash_dir posted the worst case). what testing have other people done with different filesystems? David Lang From pgsql-es-ayuda-owner@postgresql.org Thu Dec 1 11:45:25 2005 X-Original-To: pgsql-es-ayuda-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 05F0F9DD67F for ; Thu, 1 Dec 2005 11:45:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41907-07 for ; Thu, 1 Dec 2005 11:45:18 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by postgresql.org (Postfix) with ESMTP id A05AA9DD67A for ; Thu, 1 Dec 2005 11:45:20 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i3so382661wra for ; Thu, 01 Dec 2005 07:45:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Fp1ad+hwplSHcUcMAMpL4f7vjRpqLBRtAxrmfhSHzNeiEAOX/QERVcwmA3qkxA9JNtqmQCXiOzmO8ax2oPI81NH8oOEN0AJ6pEs/UO9tdKh4TqgFcASovAm0smgejNYb/FDEE7fFr+9QjzNAqqyVC2pL4ATKUPMDI3J1qwjg2Do= Received: by 10.65.133.19 with SMTP id k19mr909677qbn; Thu, 01 Dec 2005 07:45:25 -0800 (PST) Received: by 10.65.244.8 with HTTP; Thu, 1 Dec 2005 07:45:25 -0800 (PST) Message-ID: <84d933650512010745j5bb6cd0cn@mail.gmail.com> Date: Thu, 1 Dec 2005 11:45:25 -0400 From: "Ing. Jhon Carrillo // Caracas, Venezuela" To: Michael Riess , Postgresql Subject: Re: [PERFORM] 15,000 tables 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/9 X-Sequence-Number: 12824 2005/12/1, Michael Riess : > Hi, > > we are currently running a postgres server (upgraded to 8.1) which has > one large database with approx. 15,000 tables. Unfortunately performance > suffers from that, because the internal tables (especially that which > holds the attribute info) get too large. > > (We NEED that many tables, please don't recommend to reduce them) it's amazing!!!!! 15000 tables!!!! WOW what kind of information you managment in your db? Imagine some querys :( only for curiosity!!!!! Jhon Carrillo DBA / Software Engineer Caracas-Venezuela > > Logically these tables could be grouped into 500 databases. My question i= s: > > Would performance be better if I had 500 databases (on one postgres > server instance) which each contain 30 tables, or is it better to have > one large database with 15,000 tables? In the old days of postgres 6.5 > we tried that, but performance was horrible with many databases ... > > BTW: I searched the mailing list, but found nothing on the subject - and > there also isn't any information in the documentation about the effects > of the number of databases, tables or attributes on the performance. > > Now, what do you say? Thanks in advance for any comment! > > Mike > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > -- From pgsql-performance-owner@postgresql.org Thu Dec 1 11:49:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4D16B9DD67A for ; Thu, 1 Dec 2005 11:49:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44936-05 for ; Thu, 1 Dec 2005 11:49:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 4A1C79DD592 for ; Thu, 1 Dec 2005 11:49:19 -0400 (AST) Received: from smtpgw.computec.de (unknown [212.123.108.8]) by svr2.postgresql.org (Postfix) with ESMTP id 84953F0C19 for ; Thu, 1 Dec 2005 15:49:22 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id EA115559C4 for ; Thu, 1 Dec 2005 16:49:16 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15659-01-48 for ; Thu, 1 Dec 2005 16:49:15 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id C1701559C9 for ; Thu, 1 Dec 2005 16:49:15 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Thu, 1 Dec 2005 16:49:14 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F6264A626A@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Thread-Index: AcX2jsfXE/UysVCLRoefDJ7OfTLamw== From: "Markus Wollny" To: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200512/16 X-Sequence-Number: 15837 Hi! I've got an urgent problem with an application which is evaluating a monthly survey; it's running quite a lot of queries like this: select SOURCE.NAME as TYPE, count(PARTICIPANT.SESSION_ID) as TOTAL from ( select PARTICIPANT.SESSION_ID from survey.PARTICIPANT, survey.ANSWER where PARTICIPANT.STATUS =3D 1 and date_trunc('month', PARTICIPANT.CREATED) =3D = date_trunc('month', now()-'1 month'::interval) and PARTICIPANT.SESSION_ID =3D ANSWER.SESSION_ID and ANSWER.QUESTION_ID =3D 6 and ANSWER.VALUE =3D 1 ) as PARTICIPANT, survey.ANSWER, survey.HANDY_JAVA SOURCE where PARTICIPANT.SESSION_ID =3D ANSWER.SESSION_ID and ANSWER.QUESTION_ID =3D 16 and ANSWER.VALUE =3D SOURCE.ID group by SOURCE.NAME, SOURCE.POSITION order by SOURCE.POSITION asc; My current PostgreSQL-version is "PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2". Up to 8.0, a query like this took a couple of seconds, maybe even up to a minute. In 8.1 a query like this will run from 30 minutes up to two hours to complete, depending on ist complexity. I've got autovaccum enabled and run a nightly vacuum analyze over all of my databases. Here's some information about the relevant tables: Table answer has got ~ 8.9M rows (estimated 8,872,130, counted 8,876,648), participant has got ~178K rows (estimated 178,165, counted 178,248), HANDY_JAVA has got three rows. This is the explain-analyze-output for the above: "Sort (cost=3D11383.09..11383.10 rows=3D3 width=3D16) (actual time=3D1952676.858..1952676.863 rows=3D3 loops=3D1)" " Sort Key: source."position"" " -> HashAggregate (cost=3D11383.03..11383.07 rows=3D3 width=3D16) = (actual time=3D1952676.626..1952676.635 rows=3D3 loops=3D1)" " -> Nested Loop (cost=3D189.32..11383.00 rows=3D5 width=3D16) (actual time=3D6975.812..1952371.782 rows=3D9806 loops=3D1)" " -> Nested Loop (cost=3D3.48..3517.47 rows=3D42 = width=3D20) (actual time=3D6819.716..15419.930 rows=3D9806 loops=3D1)" " -> Nested Loop (cost=3D3.48..1042.38 rows=3D738 width=3D16) (actual time=3D258.434..6233.039 rows=3D162723 loops=3D1)" " -> Seq Scan on handy_java source (cost=3D0.00..1.03 rows=3D3 width=3D14) (actual time=3D0.093..0.118 = rows=3D3 loops=3D1)" " -> Bitmap Heap Scan on answer (cost=3D3.48..344.04 rows=3D246 width=3D8) (actual = time=3D172.381..1820.499 rows=3D54241 loops=3D3)" " Recheck Cond: ((answer.question_id =3D 16) AND (answer.value =3D "outer".id))" " -> Bitmap Index Scan on idx02_performance (cost=3D0.00..3.48 rows=3D246 width=3D0) (actual time=3D98.321..98.321 rows=3D54245 loops=3D3)" " Index Cond: ((answer.question_id =3D 16) AND (answer.value =3D "outer".id))" " -> Index Scan using idx01_perf_0006 on participant (cost=3D0.00..3.34 rows=3D1 width=3D4) (actual time=3D0.049..0.050 = rows=3D0 loops=3D162723)" " Index Cond: (participant.session_id =3D "outer".session_id)" " Filter: ((status =3D 1) AND (date_trunc('month'::text, created) =3D date_trunc('month'::text, (now() = - '1 mon'::interval))))" " -> Bitmap Heap Scan on answer (cost=3D185.85..187.26 rows=3D1 width=3D4) (actual time=3D197.490..197.494 rows=3D1 = loops=3D9806)" " Recheck Cond: (("outer".session_id =3D answer.session_id) AND (answer.question_id =3D 6) AND (answer.value =3D = 1))" " -> BitmapAnd (cost=3D185.85..185.85 rows=3D1 = width=3D0) (actual time=3D197.421..197.421 rows=3D0 loops=3D9806)" " -> Bitmap Index Scan on idx_answer_session_id (cost=3D0.00..2.83 rows=3D236 width=3D0) (actual time=3D0.109..0.109 rows=3D49 loops=3D9806)" " Index Cond: ("outer".session_id =3D answer.session_id)" " -> Bitmap Index Scan on idx02_performance (cost=3D0.00..182.77 rows=3D20629 width=3D0) (actual = time=3D195.742..195.742 rows=3D165697 loops=3D9806)" " Index Cond: ((question_id =3D 6) AND (value =3D 1))" "Total runtime: 1952678.393 ms" I am really sorry, but currently I haven't got any 8.0-installation left, so I cannot provide the explain (analyze) output for 8.0.=20 I fiddled a little with the statement and managed to speed things up quite a lot: =20 select SOURCE.NAME as TYPE, count(ANSWER.SESSION_ID) as TOTAL from survey.ANSWER, survey.HANDY_JAVA SOURCE where ANSWER.QUESTION_ID =3D 16 and ANSWER.VALUE =3D SOURCE.ID and ANSWER.SESSION_ID in ( select PARTICIPANT.SESSION_ID from survey.PARTICIPANT, survey.ANSWER where PARTICIPANT.STATUS =3D 1 and date_trunc('month', PARTICIPANT.CREATED) =3D = date_trunc('month', now()-'1 month'::interval) and PARTICIPANT.SESSION_ID =3D ANSWER.SESSION_ID and ANSWER.QUESTION_ID =3D 6 and ANSWER.VALUE =3D 1 ) group by SOURCE.NAME, SOURCE.POSITION order by SOURCE.POSITION asc; Here's the explain analyze output: "Sort (cost=3D27835.39..27835.39 rows=3D3 width=3D16) (actual time=3D9609.207..9609.212 rows=3D3 loops=3D1)" " Sort Key: source."position"" " -> HashAggregate (cost=3D27835.33..27835.36 rows=3D3 width=3D16) = (actual time=3D9609.058..9609.067 rows=3D3 loops=3D1)" " -> Hash IN Join (cost=3D26645.78..27835.29 rows=3D5 = width=3D16) (actual time=3D6374.436..9548.945 rows=3D9806 loops=3D1)" " Hash Cond: ("outer".session_id =3D "inner".session_id)" " -> Nested Loop (cost=3D3.48..1042.38 rows=3D738 = width=3D16) (actual time=3D190.419..4817.977 rows=3D162704 loops=3D1)" " -> Seq Scan on handy_java source = (cost=3D0.00..1.03 rows=3D3 width=3D14) (actual time=3D0.036..0.058 rows=3D3 loops=3D1)" " -> Bitmap Heap Scan on answer = (cost=3D3.48..344.04 rows=3D246 width=3D8) (actual time=3D116.719..1390.931 rows=3D54235 = loops=3D3)" " Recheck Cond: ((answer.question_id =3D 16) = AND (answer.value =3D "outer".id))" " -> Bitmap Index Scan on idx02_performance (cost=3D0.00..3.48 rows=3D246 width=3D0) (actual time=3D63.195..63.195 rows=3D54235 loops=3D3)" " Index Cond: ((answer.question_id =3D = 16) AND (answer.value =3D "outer".id))" " -> Hash (cost=3D26639.37..26639.37 rows=3D1174 = width=3D8) (actual time=3D3906.831..3906.831 rows=3D9806 loops=3D1)" " -> Hash Join (cost=3D4829.24..26639.37 = rows=3D1174 width=3D8) (actual time=3D464.011..3877.539 rows=3D9806 loops=3D1)" " Hash Cond: ("outer".session_id =3D "inner".session_id)" " -> Bitmap Heap Scan on answer (cost=3D182.76..21413.93 rows=3D20626 width=3D4) (actual time=3D273.839..2860.984 rows=3D165655 loops=3D1)" " Recheck Cond: ((question_id =3D 6) AND (value =3D 1))" " -> Bitmap Index Scan on idx02_performance (cost=3D0.00..182.76 rows=3D20626 width=3D0) (actual time=3D171.933..171.933 rows=3D165659 loops=3D1)" " Index Cond: ((question_id =3D 6) AND (value =3D 1))" " -> Hash (cost=3D4621.13..4621.13 = rows=3D10141 width=3D4) (actual time=3D123.351..123.351 rows=3D11134 loops=3D1)" " -> Index Scan using idx01_perf_0005 on participant (cost=3D0.01..4621.13 rows=3D10141 width=3D4) (actual time=3D0.545..93.200 rows=3D11134 loops=3D1)" " Index Cond: (date_trunc('month'::text, created) =3D date_trunc('month'::text, (now() = - '1 mon'::interval)))" " Filter: (status =3D 1)" "Total runtime: 9612.249 ms" Regarding the total runtime, this is roughly in the same dimension as for the original query in 8.0, as far as I remember. I haven't written these queries myself in the first place, but they were done in the dark ages when IN was a no-no and haven't been touched ever since - there hadn't been any need to do so. My current problem is that rewriting hundreds of queries, some of them quite a bit more complex than this one, but all of them using the same general scheme, would take quite a lot of time - and I'm expected to hand over the survey results ASAP. So I will obviously have to do a rewrite if there's just no other way, but I wondered if there might be some other option that would allow me to point the planner in the right direction so it would behave the same as in the previous versions, namely 8.0? Any suggestions? Kind regards Markus From pgsql-performance-owner@postgresql.org Thu Dec 1 11:50:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 910569DD6A4 for ; Thu, 1 Dec 2005 11:50:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48553-02 for ; Thu, 1 Dec 2005 11:50:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id ECC8A9DD694 for ; Thu, 1 Dec 2005 11:50:11 -0400 (AST) 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 jB1FoEdm011196; Thu, 1 Dec 2005 10:50:14 -0500 (EST) To: Wolfgang Gehner cc: pgsql-performance@postgresql.org Subject: Re: slow insert into very large table In-reply-to: <438EED91.9080302@infonoia.com> References: <438EED91.9080302@infonoia.com> Comments: In-reply-to Wolfgang Gehner message dated "Thu, 01 Dec 2005 13:33:21 +0100" Date: Thu, 01 Dec 2005 10:50:14 -0500 Message-ID: <11195.1133452214@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/17 X-Sequence-Number: 15838 Wolfgang Gehner writes: > This is with PostgreSQL 8.0 final for WindowsXP on a Pentium 1.86 GHz, > 1GB Memory. HD is fast IDE. Try something more recent, like 8.0.3 or 8.0.4. IIRC we had some performance issues in 8.0.0 with tables that grew from zero to large size during a single session. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 12:03:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 88A609DCD35 for ; Thu, 1 Dec 2005 12:03:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50072-10 for ; Thu, 1 Dec 2005 12:03:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 1A5889DCBEC for ; Thu, 1 Dec 2005 12:03:49 -0400 (AST) 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 jB1G3g2k011361; Thu, 1 Dec 2005 11:03:42 -0500 (EST) To: Michael Riess cc: pgsql-performance@postgresql.org Subject: Re: 15,000 tables In-reply-to: References: Comments: In-reply-to Michael Riess message dated "Thu, 01 Dec 2005 14:42:14 +0100" Date: Thu, 01 Dec 2005 11:03:42 -0500 Message-ID: <11360.1133453022@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/18 X-Sequence-Number: 15839 Michael Riess writes: > (We NEED that many tables, please don't recommend to reduce them) No, you don't. Add an additional key column to fold together different tables of the same structure. This will be much more efficient than managing that key at the filesystem level, which is what you're effectively doing now. (If you really have 15000 distinct rowtypes, I'd like to know what your database design is...) regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 12:15:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C0E5A9DD694 for ; Thu, 1 Dec 2005 12:15:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56821-05 for ; Thu, 1 Dec 2005 12:15:46 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id 4A3FE9DD684 for ; Thu, 1 Dec 2005 12:15:46 -0400 (AST) 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 jB1GFkiv064330 for ; Thu, 1 Dec 2005 16:15:46 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id jB1G46Am057605 for pgsql-performance@postgresql.org; Thu, 1 Dec 2005 16:04:06 GMT (envelope-from news) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables Date: Thu, 01 Dec 2005 17:04:06 +0100 Organization: Hub.Org Networking Services Lines: 33 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-1.44 required=5 tests=[ALL_TRUSTED=-1.44] X-Spam-Score: -1.44 X-Spam-Level: X-Archive-Number: 200512/21 X-Sequence-Number: 15842 Hi, > On 12/1/05, Michael Riess wrote: >> Hi, >> >> we are currently running a postgres server (upgraded to 8.1) which has >> one large database with approx. 15,000 tables. Unfortunately performance >> suffers from that, because the internal tables (especially that which >> holds the attribute info) get too large. >> >> (We NEED that many tables, please don't recommend to reduce them) >> > > Have you ANALYZEd your database? VACUUMing? Of course ... before 8.1 we routinely did a vacuum full analyze each night. As of 8.1 we use autovacuum. > > BTW, are you using some kind of weird ERP? I have one that treat > informix as a fool and don't let me get all of informix potential... > maybe the same is in your case... No. Our database contains tables for we content management systems. The server hosts approx. 500 cms applications, and each of them has approx. 30 tables. That's why I'm asking if it was better to have 500 databases with 30 tables each. In previous Postgres versions this led to even worse performance ... Mike From pgsql-performance-owner@postgresql.org Thu Dec 1 12:15:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 765529DCB97 for ; Thu, 1 Dec 2005 12:15:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61049-03 for ; Thu, 1 Dec 2005 12:15:03 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.195]) by postgresql.org (Postfix) with ESMTP id E07AC9DCAB5 for ; Thu, 1 Dec 2005 12:15:02 -0400 (AST) Received: by zproxy.gmail.com with SMTP id i11so275114nzh for ; Thu, 01 Dec 2005 08:15:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cmSoRwVWUQp+F0kVq5VzukkJMyucHDCMBTrIJOaXkZFfFiWCf9BhROS/qt+2ffTX8tocba0nDYi+1PM2C/ysOBP5hINoOb2XO5V2SlHMUSnBad0EbN1BXQJ+d+0FvBWKTxy+eEu7axNEq8rqp8n4Tdlpp6qFlVhrOPqMDlQUwBQ= Received: by 10.64.183.2 with SMTP id g2mr922086qbf; Thu, 01 Dec 2005 08:15:00 -0800 (PST) Received: by 10.65.180.14 with HTTP; Thu, 1 Dec 2005 08:15:00 -0800 (PST) Message-ID: Date: Thu, 1 Dec 2005 11:15:00 -0500 From: Jaime Casanova To: Tom Lane Subject: Re: 15,000 tables Cc: Michael Riess , pgsql-performance@postgresql.org In-Reply-To: <11360.1133453022@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: <11360.1133453022@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.046 required=5 tests=[AWL=0.046] X-Spam-Score: 0.046 X-Spam-Level: X-Archive-Number: 200512/19 X-Sequence-Number: 15840 On 12/1/05, Tom Lane wrote: > Michael Riess writes: > > (We NEED that many tables, please don't recommend to reduce them) > > No, you don't. Add an additional key column to fold together different > tables of the same structure. This will be much more efficient than > managing that key at the filesystem level, which is what you're > effectively doing now. > > (If you really have 15000 distinct rowtypes, I'd like to know what > your database design is...) > > regards, tom lane > Maybe he is using some kind of weird ERP... take the case of BaaN (sadly i use it in my work): BaaN creates about 1200 tables per company and i have no control of it... we have about 12000 tables right now... -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Thu Dec 1 12:15:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6D7729DCC33 for ; Thu, 1 Dec 2005 12:15:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53318-04 for ; Thu, 1 Dec 2005 12:15:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id A73DE9DCBEC for ; Thu, 1 Dec 2005 12:15:07 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: pg_dump slow Date: Thu, 1 Dec 2005 11:15:05 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD9D4@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] pg_dump slow Thread-Index: AcX2avN5RBDgmbLPQFiGbYCpY4pb8wAJyzWA From: "Merlin Moncure" To: "Franklin Haut" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/20 X-Sequence-Number: 15841 > >Franlin: are you making pg_dump from local or remote box and is this a > >clean install? Try fresh patched win2k install and see what happens. > He claimed this was local, not network. It is certainly an > intriguing possibility that W2K and WinXP handle bytea > differently. I'm not competent to comment on that however. can you make small extraction of this file (~ 100 rows), zip to file and send to me off list? I'll test it vs. a 2000 and xp server and try to reproduce your results. Merlin From pgsql-performance-owner@postgresql.org Thu Dec 1 12:26:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E8FB49DD686 for ; Thu, 1 Dec 2005 12:26:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53036-10 for ; Thu, 1 Dec 2005 12:26:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 72A169DD683 for ; Thu, 1 Dec 2005 12:26:06 -0400 (AST) 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 jB1GQ4VB011569; Thu, 1 Dec 2005 11:26:04 -0500 (EST) To: "Markus Wollny" cc: pgsql-performance@postgresql.org Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 In-reply-to: <28011CD60FB1724DBA4442E38277F6264A626A@hermes.computec.de> References: <28011CD60FB1724DBA4442E38277F6264A626A@hermes.computec.de> Comments: In-reply-to "Markus Wollny" message dated "Thu, 01 Dec 2005 16:49:14 +0100" Date: Thu, 01 Dec 2005 11:26:04 -0500 Message-ID: <11568.1133454364@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/22 X-Sequence-Number: 15843 "Markus Wollny" writes: > My current problem is that rewriting hundreds of queries, some of them > quite a bit more complex than this one, but all of them using the same > general scheme, would take quite a lot of time - and I'm expected to > hand over the survey results ASAP. So I will obviously have to do a > rewrite if there's just no other way, but I wondered if there might be > some other option that would allow me to point the planner in the right > direction so it would behave the same as in the previous versions, > namely 8.0? It looks like "set enable_nestloop = 0" might be a workable hack for the immediate need. Once you're not under deadline, I'd like to investigate more closely to find out why 8.1 does worse than 8.0 here. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 12:45:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 84B8E9DCAB5 for ; Thu, 1 Dec 2005 12:45:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71577-10 for ; Thu, 1 Dec 2005 12:45:46 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id C39899DCAB4 for ; Thu, 1 Dec 2005 12:45:46 -0400 (AST) 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 jB1Gjknm078154 for ; Thu, 1 Dec 2005 16:45:46 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id jB1GSj5g070820 for pgsql-performance@postgresql.org; Thu, 1 Dec 2005 16:28:45 GMT (envelope-from news) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables Date: Thu, 01 Dec 2005 17:28:44 +0100 Organization: Hub.Org Networking Services Lines: 31 Message-ID: References: <11360.1133453022@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <11360.1133453022@sss.pgh.pa.us> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-1.44 required=5 tests=[ALL_TRUSTED=-1.44] X-Spam-Score: -1.44 X-Spam-Level: X-Archive-Number: 200512/26 X-Sequence-Number: 15847 Hi Tom, > Michael Riess writes: >> (We NEED that many tables, please don't recommend to reduce them) > > No, you don't. Add an additional key column to fold together different > tables of the same structure. This will be much more efficient than > managing that key at the filesystem level, which is what you're > effectively doing now. Been there, done that. (see below) > > (If you really have 15000 distinct rowtypes, I'd like to know what > your database design is...) Sorry, I should have included that info in the initial post. You're right in that most of these tables have a similar structure. But they are independent and can be customized by the users. Think of it this way: On the server there are 500 applications, and each has 30 tables. One of these might be a table which contains the products of a webshop, another contains news items which are displayed on the website etc. etc.. The problem is that the customers can freely change the tables ... add columns, remove columns, change column types etc.. So I cannot use system wide tables with a key column. Mike From pgsql-performance-owner@postgresql.org Thu Dec 1 12:30:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 505F39DD6A4 for ; Thu, 1 Dec 2005 12:30:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70420-02 for ; Thu, 1 Dec 2005 12:30:46 -0400 (AST) X-Greylist: delayed 00:41:32.138832 by SQLgrey- Received: from smtpgw.computec.de (smtpgw.computec.de [212.123.108.8]) by postgresql.org (Postfix) with ESMTP id D09219DCB97 for ; Thu, 1 Dec 2005 12:30:44 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id 3FA4D559C9; Thu, 1 Dec 2005 17:30:44 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 16873-01-57; Thu, 1 Dec 2005 17:30:43 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id 85FCA559BE; Thu, 1 Dec 2005 17:30:43 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Thu, 1 Dec 2005 17:30:42 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F6264A62C1@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Thread-Index: AcX2k7l2OJhayaaZTCq12MkgkeC3IwAAI0qw From: "Markus Wollny" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.439 required=5 tests=[AWL=-0.480, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.439 X-Spam-Level: * X-Archive-Number: 200512/23 X-Sequence-Number: 15844 > -----Urspr=FCngliche Nachricht----- > Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 > Gesendet: Donnerstag, 1. Dezember 2005 17:26 > An: Markus Wollny > Cc: pgsql-performance@postgresql.org > Betreff: Re: [PERFORM] Queries taking ages in PG 8.1, have=20 > been much faster in PG<=3D8.0=20 =20 > It looks like "set enable_nestloop =3D 0" might be a workable=20 > hack for the immediate need. =20 Whow - that works miracles :) "Sort (cost=3D81813.13..81813.14 rows=3D3 width=3D16) (actual = time=3D7526.745..7526.751 rows=3D3 loops=3D1)" " Sort Key: source."position"" " -> HashAggregate (cost=3D81813.07..81813.11 rows=3D3 width=3D16) = (actual time=3D7526.590..7526.601 rows=3D3 loops=3D1)" " -> Merge Join (cost=3D81811.40..81813.03 rows=3D5 width=3D16) = (actual time=3D7423.289..7479.175 rows=3D9806 loops=3D1)" " Merge Cond: ("outer".id =3D "inner".value)" " -> Sort (cost=3D1.05..1.06 rows=3D3 width=3D14) (actual = time=3D0.085..0.091 rows=3D3 loops=3D1)" " Sort Key: source.id" " -> Seq Scan on handy_java source = (cost=3D0.00..1.03 rows=3D3 width=3D14) (actual time=3D0.039..0.049 = rows=3D3 loops=3D1)" " -> Sort (cost=3D81810.35..81811.81 rows=3D583 = width=3D8) (actual time=3D7423.179..7440.062 rows=3D9806 loops=3D1)" " Sort Key: mafo.answer.value" " -> Hash Join (cost=3D27164.31..81783.57 = rows=3D583 width=3D8) (actual time=3D6757.521..7360.822 rows=3D9806 = loops=3D1)" " Hash Cond: ("outer".session_id =3D = "inner".session_id)" " -> Bitmap Heap Scan on answer = (cost=3D506.17..54677.92 rows=3D88334 width=3D8) (actual = time=3D379.245..2660.344 rows=3D162809 loops=3D1)" " Recheck Cond: (question_id =3D 16)" " -> Bitmap Index Scan on = idx_answer_question_id (cost=3D0.00..506.17 rows=3D88334 width=3D0) = (actual time=3D274.632..274.632 rows=3D162814 loops=3D1)" " Index Cond: (question_id =3D 16)" " -> Hash (cost=3D26655.21..26655.21 = rows=3D1175 width=3D8) (actual time=3D3831.362..3831.362 rows=3D9806 = loops=3D1)" " -> Hash Join = (cost=3D4829.33..26655.21 rows=3D1175 width=3D8) (actual = time=3D542.227..3800.985 rows=3D9806 loops=3D1)" " Hash Cond: ("outer".session_id = =3D "inner".session_id)" " -> Bitmap Heap Scan on answer = (cost=3D182.84..21429.34 rows=3D20641 width=3D4) (actual = time=3D292.067..2750.376 rows=3D165762 loops=3D1)" " Recheck Cond: ((question_id = =3D 6) AND (value =3D 1))" " -> Bitmap Index Scan on = idx02_performance (cost=3D0.00..182.84 rows=3D20641 width=3D0) (actual = time=3D167.306..167.306 rows=3D165769 loops=3D1)" " Index Cond: = ((question_id =3D 6) AND (value =3D 1))" " -> Hash = (cost=3D4621.13..4621.13 rows=3D10141 width=3D4) (actual = time=3D182.842..182.842 rows=3D11134 loops=3D1)" " -> Index Scan using = idx01_perf_0005 on participant (cost=3D0.01..4621.13 rows=3D10141 = width=3D4) (actual time=3D0.632..136.126 rows=3D11134 loops=3D1)" " Index Cond: = (date_trunc('month'::text, created) =3D date_trunc('month'::text, (now() = - '1 mon'::interval)))" " Filter: (status =3D = 1)" "Total runtime: 7535.398 ms" > Once you're not under deadline,=20 > I'd like to investigate more closely to find out why 8.1 does=20 > worse than 8.0 here. Please tell me what I can do to help in clearing up this issue, I'd be = very happy to help! Heck, I am happy anyway that there's such a quick = fix, even if it's not a beautiful one :) Kind regards Markus From pgsql-performance-owner@postgresql.org Thu Dec 1 12:31:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E46CE9DD683 for ; Thu, 1 Dec 2005 12:30:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69309-05 for ; Thu, 1 Dec 2005 12:30:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.pharmaline.de (mail.pharmaline.de [62.153.135.34]) by postgresql.org (Postfix) with ESMTP id 1B5B29DD686 for ; Thu, 1 Dec 2005 12:30:50 -0400 (AST) Received: from [192.168.2.121] (62.153.135.40) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.6) for ; Thu, 1 Dec 2005 17:30:48 +0100 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: References: Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-67-528626553; protocol="application/pkcs7-signature" Message-Id: <7F8F91D4-9A18-4741-A485-9B5208FB3180@pharmaline.de> From: Guido Neitzer Subject: Re: 15,000 tables Date: Thu, 1 Dec 2005 17:30:48 +0100 To: postgres performance list X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/24 X-Sequence-Number: 15845 --Apple-Mail-67-528626553 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 01.12.2005, at 17:04 Uhr, Michael Riess wrote: > No. Our database contains tables for we content management systems. > The server hosts approx. 500 cms applications, and each of them has > approx. 30 tables. Just for my curiosity: Are the "about 30 tables" with similar schemas or do they differ much? We have a small CMS system running here, where I have all information for all clients in tables with relationships to a client table. But I assume you are running a pre-build CMS which is not designed for "multi-client ability", right? cug -- PharmaLine, Essen, GERMANY Software and Database Development --Apple-Mail-67-528626553 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGUzCCAwww ggJ1oAMCAQICAw4DazANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwMjExMDkwNzMwWhcNMDYwMjExMDkwNzMwWjBpMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSowKAYJKoZIhvcNAQkBFhtndWlkby5uZWl0emVyQHBo YXJtYWxpbmUuZGUxGjAYBgkqhkiG9w0BCQEWC2N1Z0BtYWMuY29tMIIBIjANBgkqhkiG9w0BAQEF AAOCAQ8AMIIBCgKCAQEA5/WRLVRqtqJ+f/HOn9G513YNybt/lglgrEjo281eSXV0O1boJcCA7FuA B+Wc7BiltSkLc4nvJSegJh0RydSOKt3MywBg+N8BkgxcSWf9jYJ/JUx4uTBWAdd4Hk1+XPGHpYzQ Ric2AofRqhW8IQX/unprQ/BnAMiiuukaaGB8dqtoXDBI0RYlwHYuOTyrviEdU7jt4kgrBYu4TK01 qqKsxkr2Q7WhNT9p9w7Fu8rZF+VuJPwbZPIsfWuPZbN/7HRKoaKLG04UG1CmiqiN9JQl4tR81G4k 8WkSTPy0JruJHfOm584a1JposZwtwmcOo1l5iDJtnzSB4PvdFnFYVkJ9IQIDAQABo0UwQzAzBgNV HREELDAqgRtndWlkby5uZWl0emVyQHBoYXJtYWxpbmUuZGWBC2N1Z0BtYWMuY29tMAwGA1UdEwEB /wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAgg9T+k6d3YQITWeSYwDSPTAGN0z/BMVhrOlzF7cP4srd jU4L0RLiqFMz9D2tCMFV5P0z1FIxjSqXBpt7xkzSE8sYplMUMLBRMIV4sJbPAbdqGiB+MGLSzh7V N95dP7LwrRjFqury6j0RQ3OG6oqStCpfcMmWuAHT7gRNwjeAaQYwggM/MIICqKADAgECAgENMA0G CSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYD VQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0 aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29uYWwgRnJl ZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5jb20wHhcN MDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftOucqZWh5o wHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9xVsuvPAsH 5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAeZBlyYLf7 AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8v Y3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8EBAMCAQYw KQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3DQEBBQUA A4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9reFhYsPZ Ohl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAaWzVNd+NW IXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMc VGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZy ZWVtYWlsIElzc3VpbmcgQ0ECAw4DazAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMxCwYJKoZI hvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNTEyMDExNjMwNDlaMCMGCSqGSIb3DQEJBDEWBBRQfICg ZapgcB/GwcfWzZmznLv4mTB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQK ExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwg RnJlZW1haWwgSXNzdWluZyBDQQIDDgNrMHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw4DazANBgkqhkiG9w0BAQEFAASCAQA/N0+G GFARXznWPIwR/hK1JdGRd4qEQPTNW6zxTUXMRjCqqAG11/VjzQLtDjDcOg84YxBHLDXgpUH+5sfu YIy7Ld4gqk7ncWA4+milz+cgGkIH1DVOL+wRhrMECmBlMZ142y+6oHkepiGrI+vApDVNLZimp4UG 9rqOmSsCaefk7i5c0zY+5IQDvkoyT9Bjm1xKqbz+i0AU7YCoDzRj/iCKHAjgRbNx3fgXqT2kSGw4 ojz17WWXu/ysQ0xObulMWbRlCkB1g0I/x0Co6kB4QfzvGjzD3dEtZMyBcH+9k+3Xi5YuAsSwezno FqivzGTleuhqooZ0l25XqMEoe4tcAwFCAAAAAAAA --Apple-Mail-67-528626553-- From pgsql-performance-owner@postgresql.org Thu Dec 1 12:34:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1566F9DD694 for ; Thu, 1 Dec 2005 12:34:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72498-01 for ; Thu, 1 Dec 2005 12:34:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id CE62A9DD69E for ; Thu, 1 Dec 2005 12:34:47 -0400 (AST) 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 jB1GYkoh011680; Thu, 1 Dec 2005 11:34:46 -0500 (EST) To: "Markus Wollny" cc: pgsql-performance@postgresql.org Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 In-reply-to: <28011CD60FB1724DBA4442E38277F6264A62C1@hermes.computec.de> References: <28011CD60FB1724DBA4442E38277F6264A62C1@hermes.computec.de> Comments: In-reply-to "Markus Wollny" message dated "Thu, 01 Dec 2005 17:30:42 +0100" Date: Thu, 01 Dec 2005 11:34:46 -0500 Message-ID: <11679.1133454886@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/25 X-Sequence-Number: 15846 "Markus Wollny" writes: >> Once you're not under deadline, >> I'd like to investigate more closely to find out why 8.1 does >> worse than 8.0 here. > Please tell me what I can do to help in clearing up this issue, I'd be > very happy to help! The first thing to do is get 8.0's EXPLAIN ANALYZE for the same query. After we see how that differs from 8.1, we'll know what the next question should be ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 13:07:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CCA9A9DCD5D for ; Thu, 1 Dec 2005 13:07:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80880-05 for ; Thu, 1 Dec 2005 13:07:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.refusion.com (mail.refusion.com [213.144.155.20]) by postgresql.org (Postfix) with ESMTP id 643EB9DCB7B for ; Thu, 1 Dec 2005 13:07:52 -0400 (AST) Received: from iwing by mail.refusion.com (MDaemon.PRO.v8.1.0.R) with ESMTP id md50000409864.msg for ; Thu, 01 Dec 2005 18:07:51 +0100 Message-ID: <06f401c5f699$bbae2af0$0201a8c0@iwing> From: To: "Michael Riess" , References: Subject: Re: 15,000 tables Date: Thu, 1 Dec 2005 18:07:37 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.1830 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830 X-Authenticated-Sender: info@alternize.com X-Spam-Processed: mail.refusion.com, Thu, 01 Dec 2005 18:07:51 +0100 (not processed: message from trusted or authenticated source) X-MDRemoteIP: 80.238.204.232 X-Return-Path: me@alternize.com X-MDaemon-Deliver-To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=3.423 required=5 tests=[DNS_FROM_RFC_DSN=2.872, NO_REAL_NAME=0.55, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 3.423 X-Spam-Level: *** X-Archive-Number: 200512/27 X-Sequence-Number: 15848 hi michael >> Have you ANALYZEd your database? VACUUMing? > > Of course ... before 8.1 we routinely did a vacuum full analyze each > night. As of 8.1 we use autovacuum. what i noticed is autovacuum not working properly as it should. i had 8.1 running with autovacuum for just 2 days or so and got warnings in pgadmin that my tables would need an vacuum. i've posted this behaviour some weeks ago to the novice list requesting more infos on how to "tweak" autovacuum properly - unfortunately without any respones. thats when i switched the nightly analyze job back on - everything runs smooth since then. maybe it helps in your case as well? cheers, thomas From pgsql-performance-owner@postgresql.org Thu Dec 1 14:04:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 624359DD689 for ; Thu, 1 Dec 2005 14:04:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03558-09-2 for ; Thu, 1 Dec 2005 14:04:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id BCD1A9DD6A3 for ; Thu, 1 Dec 2005 14:04:04 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 303203368C; Thu, 1 Dec 2005 19:04:05 +0100 (MET) From: Chris Browne X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables Date: Thu, 01 Dec 2005 12:09:41 -0500 Organization: cbbrowne Computing Inc Lines: 52 Message-ID: <60psogzqui.fsf@dba2.int.libertyrms.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) Cancel-Lock: sha1:GJaGTbfGLmDeInqOXAdeaDOrCMg= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/30 X-Sequence-Number: 15851 Michael Riess writes: >> On 12/1/05, Michael Riess wrote: >>> we are currently running a postgres server (upgraded to 8.1) which >>> has one large database with approx. 15,000 tables. Unfortunately >>> performance suffers from that, because the internal tables >>> (especially that which holds the attribute info) get too large. >>> >>> (We NEED that many tables, please don't recommend to reduce them) >>> >> Have you ANALYZEd your database? VACUUMing? > > Of course ... before 8.1 we routinely did a vacuum full analyze each > night. As of 8.1 we use autovacuum. VACUUM FULL was probably always overkill, unless "always" includes versions prior to 7.3... >> BTW, are you using some kind of weird ERP? I have one that treat >> informix as a fool and don't let me get all of informix potential... >> maybe the same is in your case... > > No. Our database contains tables for we content management > systems. The server hosts approx. 500 cms applications, and each of > them has approx. 30 tables. > > That's why I'm asking if it was better to have 500 databases with 30 > tables each. In previous Postgres versions this led to even worse > performance ... This has the feeling of fitting with Alan Perlis' dictum below... Supposing you have 500 databases, each with 30 tables, each with 4 indices, then you'll find you have, on disk... # of files = 500 x 30 x 5 = 75000 files If each is regularly being accessed, that's bits of 75000 files getting shoved through OS and shared memory caches. Oh, yes, and you'll also have regular participation of some of the pg_catalog files, with ~500 instances of THOSE, multiplied some number of ways... An application with 15000 frequently accessed tables doesn't strike me as being something that can possibly turn out well. You have, in effect, more tables than (arguably) bloated ERP systems like SAP R/3; it only has a few thousand tables, and since many are module-specific, and nobody ever implements *all* the modules, it is likely only a few hundred that are "hot spots." No 15000 there... -- (format nil "~S@~S" "cbbrowne" "cbbrowne.com") http://www3.sympatico.ca/cbbrowne/languages.html It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures. -- Alan J. Perlis From pgsql-performance-owner@postgresql.org Thu Dec 1 13:31:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 942E89DCB7B for ; Thu, 1 Dec 2005 13:31:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95175-07 for ; Thu, 1 Dec 2005 13:31:35 -0400 (AST) Received: from hub.org (hub.org [200.46.204.220]) by postgresql.org (Postfix) with ESMTP id 5E3F09DCAB4 for ; Thu, 1 Dec 2005 13:31:35 -0400 (AST) Received: from localhost (av.hub.org [200.46.204.144]) by hub.org (Postfix) with ESMTP id 25BCB26F754 for ; Thu, 1 Dec 2005 13:31:34 -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 95645-06 for ; Thu, 1 Dec 2005 13:31:31 -0400 (AST) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 8AE7F26EBCC for ; Thu, 1 Dec 2005 13:31:31 -0400 (AST) Received: by ganymede.hub.org (Postfix, from userid 1000) id CD874452E1; Thu, 1 Dec 2005 13:31:31 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id CCD2E3F147 for ; Thu, 1 Dec 2005 13:31:31 -0400 (AST) Date: Thu, 1 Dec 2005 13:31:31 -0400 (AST) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: pgsql-performance@postgresql.org Subject: pg_stat* values ... Message-ID: <20051201132845.Y1077@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, score=0.414 required=5 tests=[AWL=0.414] X-Spam-Score: 0.414 X-Spam-Level: X-Archive-Number: 200512/28 X-Sequence-Number: 15849 Not having found anything so far, does anyone know of, and can point me to, either tools, or articles, that talk about doing tuning based on the information that this sort of information can help with? ---- 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 Thu Dec 1 15:04:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2AD359DD694 for ; Thu, 1 Dec 2005 15:04:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30723-08 for ; Thu, 1 Dec 2005 15:03:57 -0400 (AST) X-Greylist: delayed 01:04:07.245073 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 0B6A09DD6CB for ; Thu, 1 Dec 2005 15:03:55 -0400 (AST) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by svr2.postgresql.org (Postfix) with ESMTP id 0779CF0B8D for ; Thu, 1 Dec 2005 17:59:49 +0000 (GMT) Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id ECAF2D1C1B8 for ; Thu, 1 Dec 2005 12:49:10 -0500 (EST) Received: from web3.messagingengine.com ([10.202.2.212]) by frontend1.internal (MEProxy); Thu, 01 Dec 2005 12:49:10 -0500 Received: by web3.messagingengine.com (Postfix, from userid 99) id A8E15C00A; Thu, 1 Dec 2005 12:49:11 -0500 (EST) Message-Id: <1133459351.23834.248779098@webmail.messagingengine.com> X-Sasl-Enc: +QsyDoPzdijo/9USc79496QqdeaN6usv3JYHih7EC6II 1133459351 From: "Jeremy Haile" 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.15; A1.64; B3.05; Q3.03) Subject: Insert performance slows down in large batch Date: Thu, 01 Dec 2005 12:49:11 -0500 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200512/37 X-Sequence-Number: 15858 I am importing roughly 15 million rows in one batch transaction. I am currently doing this through batch inserts of around 500 at a time, although I am looking at ways to do this via multiple (one-per-table) copy commands for performance reasons. I am currently running: PostgreSQL 8.0.4, Redhat Enterprise Linux 4, ext3, all-on-one partition. I am aware of methods of improving performance by changing ext3 mounting options, splitting WAL, data, and indexes to separate physical disks, etc. I have also adjusted my shared_buffers, work_mem, maintenance_work_mem, and checkpoint_segments and can post their values if anyone thinks it is relevant to my question (See questions at the bottom) What confuses me is that at the beginning of the import, I am inserting roughly 25,000 rows every 7 seconds..and by the time I get towards the end of the import, it is taking 145 seconds for the same number of rows. The inserts are spread across 4 tables and I have dropped all indexes and constraints on these tables, including foreign keys, unique keys, and even primary keys (even though I think primary key doesn't improve performance) The entire bulk import is done in a single transaction. The result is a table with 4.8 million rows, two tables with 4.8*2 million rows, and another table with several thousand rows. So, my questions are: 1) Why does the performance degrade as the table sizes grow? Shouldn't the insert performance remain fairly constant if there are no indexes or constraints? 2) Is there anything I can do to figure out where the time is being spent? Will postgres log any statistics or information to help me diagnose the problem? I have pasted a fairly representative sample of vmstat below my e-mail in case it helps, although I'm not quite how to interpret it in this case. 3) Any other advice, other than the things I listed above (I am aware of using copy, ext3 tuning, multiple disks, tuning postgresql.conf settings)? Thanks in advance, Jeremy Haile #vmstat 2 20 procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 0 9368 4416 2536 1778784 0 0 124 51 3 2 2 0 96 2 1 0 9368 4416 2536 1778784 0 0 0 0 1005 53 25 0 75 0 1 1 9368 3904 2544 1779320 0 0 12164 6 1103 262 24 1 59 16 1 0 9368 3704 2552 1779380 0 0 16256 24 1140 344 23 1 53 23 1 1 9368 2936 2560 1780120 0 0 16832 6 1143 359 23 1 52 24 1 1 9368 3328 2560 1779712 0 0 13120 0 1111 285 24 1 58 18 1 0 9368 4544 2560 1778556 0 0 5184 0 1046 141 25 0 67 8 1 1 9368 3776 2568 1779296 0 0 7296 6 1064 195 24 0 67 9 1 0 9368 4480 2568 1778548 0 0 4096 0 1036 133 24 0 69 6 1 0 9368 4480 2576 1778608 0 0 7504 0 1070 213 23 0 67 10 1 0 9368 3136 2576 1779900 0 0 9536 0 1084 235 23 0 66 10 1 1 9368 3072 2584 1779960 0 0 13632 6 1118 313 24 1 60 16 1 0 9368 4480 2592 1778592 0 0 8576 24 1075 204 24 0 63 12 1 0 9368 4480 2592 1778592 0 0 0 6 1004 52 25 0 75 0 1 0 9368 4544 2600 1778652 0 0 0 6 1005 55 25 0 75 0 1 1 9368 3840 2600 1779332 0 0 11264 4 1098 260 24 0 63 13 1 1 9368 3072 2592 1780156 0 0 17088 14 1145 346 24 1 51 24 1 1 9368 4096 2600 1779128 0 0 16768 6 1140 360 23 1 54 21 1 1 9368 3840 2600 1779332 0 0 16960 0 1142 343 24 1 54 22 1 0 9368 3436 2596 1779676 0 0 16960 0 1142 352 24 1 53 23 From pgsql-performance-owner@postgresql.org Thu Dec 1 14:08:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 716B39DD695 for ; Thu, 1 Dec 2005 14:08:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09223-08-3 for ; Thu, 1 Dec 2005 14:08:36 -0400 (AST) X-Greylist: delayed 00:10:04.383687 by SQLgrey- Received: from rwcrmhc12.comcast.net (unknown [216.148.227.153]) by postgresql.org (Postfix) with ESMTP id 8F7029DD689 for ; Thu, 1 Dec 2005 14:08:36 -0400 (AST) Received: from dell8200 (pcp09613107pcs.rte20201.de.comcast.net[68.82.197.68]) by comcast.net (rwcrmhc13) with SMTP id <2005120117581601500ion9he>; Thu, 1 Dec 2005 17:58:25 +0000 From: "Rick Schumeyer" To: Subject: COPY into table too slow with index Date: Thu, 1 Dec 2005 12:58:12 -0500 Message-ID: <00b101c5f6a0$d0ffea40$0200a8c0@dell8200> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00B2_01C5F676.E829E240" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/32 X-Sequence-Number: 15853 This is a multi-part message in MIME format. ------=_NextPart_000_00B2_01C5F676.E829E240 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit I'm running postgresql 8.1.0 with postgis 1.0.4 on a FC3 system, 3Ghz, 1 GB memory. I am using COPY to fill a table that contains one postgis geometry column. With no geometry index, it takes about 45 seconds to COPY one file. If I add a geometry index, this time degrades. It keeps getting worse as more records are added to the table. It was up to over three minutes per file on my most recent test. The problem is that each file contains about 5 - 10 minutes of data. Eventually, I want to add the data to the table in "real time". So the COPY needs to take less time than actually generating the data. Here is the relevant section of my postgresql.conf. # - Memory - shared_buffers = 5000 # min 16 or max_connections*2, 8KB each #temp_buffers = 1000 # min 100, 8KB each #max_prepared_transactions = 5 # can be 0 or more # note: increasing max_prepared_transactions costs ~600 bytes of shared memory # per transaction slot, plus lock space (see max_locks_per_transaction). work_mem = 20000 # min 64, size in KB maintenance_work_mem = 20000 # min 1024, size in KB #max_stack_depth = 2048 # min 100, size in KB Any suggestions for improvement? ------=_NextPart_000_00B2_01C5F676.E829E240 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

I’m running postgresql 8.1.0 with postgis 1.0.4 = on a FC3 system, 3Ghz, 1 GB memory.

 

I am using COPY to fill a table that contains one = postgis geometry column.

 

With no geometry index, it takes about 45 seconds to = COPY one file.

 

If I add a geometry index, this time degrades.  = It keeps getting worse as more records are

added to the table.  It was up to over three = minutes per file on my most recent test.

 

The problem is that each file contains about 5 = – 10 minutes of data.  Eventually, I want to

add the data to the table in “real = time”.  So the COPY needs to take less time than

actually generating the data.

 

Here is the relevant section of my = postgresql.conf.

 

# - Memory = -

 

shared_buffers =3D = 5000           &nb= sp;   # min 16 or max_connections*2, 8KB each

#temp_buffers =3D = 1000           &nb= sp;    # min 100, 8KB each

#max_prepared_transactions =3D 5            # = can be 0 or more

# note: increasing = max_prepared_transactions costs ~600 bytes of shared memory

# per transaction = slot, plus lock space (see max_locks_per_transaction).

work_mem =3D = 20000           &n= bsp;  # min 64, size in KB

maintenance_work_mem =3D = 20000        # min 1024, size in KB

#max_stack_depth = =3D = 2048           &nb= sp; # min 100, size in KB

 

Any suggestions for improvement?

------=_NextPart_000_00B2_01C5F676.E829E240-- From pgsql-performance-owner@postgresql.org Thu Dec 1 14:03:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F0CF69DD670 for ; Thu, 1 Dec 2005 14:03:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10221-03 for ; Thu, 1 Dec 2005 14:03:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id A9E0C9DCAB5 for ; Thu, 1 Dec 2005 14:03:20 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id F175C3368C; Thu, 1 Dec 2005 19:03:20 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: filesystem performance with lots of files Date: Thu, 1 Dec 2005 13:03:20 -0500 Organization: Hub.Org Networking Services Lines: 19 Message-ID: References: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/29 X-Sequence-Number: 15850 "David Lang" wrote > > a few weeks ago I did a series of tests to compare different filesystems. > the test was for a different purpose so the particulars are not what I > woud do for testing aimed at postgres, but I think the data is relavent) > and I saw major differences between different filesystems, I'll see aobut > re-running the tests to get a complete set of benchmarks in the next few > days. My tests had their times vary from 4 min to 80 min depending on the > filesystem in use (ext3 with hash_dir posted the worst case). what testing > have other people done with different filesystems? > That's good ... what benchmarks did you used? Regards, Qingqing From pgsql-performance-owner@postgresql.org Thu Dec 1 14:07:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 674959DCD5D for ; Thu, 1 Dec 2005 14:07:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08262-08 for ; Thu, 1 Dec 2005 14:07:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tetra.ehpg.net (tetra2.ehpg.net [65.19.161.8]) by postgresql.org (Postfix) with ESMTP id BE6C39DCB90 for ; Thu, 1 Dec 2005 14:07:46 -0400 (AST) Received: from dsl081-087-203.lax1.dsl.speakeasy.net ([64.81.87.203]) by tetra.ehpg.net with esmtpa (Exim 4.54) id 1EhsqP-0004Bi-CE; Thu, 01 Dec 2005 10:07:46 -0800 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: "Gavin M. Roy" Subject: Re: 15,000 tables Date: Thu, 1 Dec 2005 10:07:44 -0800 To: Michael Riess X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/31 X-Sequence-Number: 15852 Hi Michael, I'm a fan of ReiserFS, and I can be wrong, but I believe using a journaling filesystem for the PgSQL database could be slowing things down. Gavin On Dec 1, 2005, at 6:51 AM, Michael Riess wrote: > Hi David, > >> with 15,000 tables you are talking about a LOT of files to hold >> these (30,000 files with one index each and each database being >> small enough to not need more then one file to hold it), on linux >> ext2/3 this many files in one directory will slow you down horribly. > > We use ReiserFS, and I don't think that this is causing the > problem ... although it would probably help to split the directory > up using tablespaces. > > But thanks for the suggestion! > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings Gavin M. Roy 800 Pound Gorilla gmr@ehpg.net From pgsql-performance-owner@postgresql.org Thu Dec 1 14:40:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A7349DCD76 for ; Thu, 1 Dec 2005 14:40:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26800-02 for ; Thu, 1 Dec 2005 14:40:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id 9A6159DCB7B for ; Thu, 1 Dec 2005 14:40:13 -0400 (AST) Received: from [192.168.178.99] (p548B3046.dip0.t-ipconnect.de [84.139.48.70]) by service-web.de (Postfix) with ESMTP id D96BC20002A; Thu, 1 Dec 2005 19:40:09 +0100 (CET) Subject: Re: 15,000 tables From: Tino Wildenhain To: "Gavin M. Roy" Cc: Michael Riess , pgsql-performance@postgresql.org In-Reply-To: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> References: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> Content-Type: text/plain Date: Thu, 01 Dec 2005 19:40:07 +0100 Message-Id: <1133462407.5734.43.camel@Andrea.peacock.de> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/33 X-Sequence-Number: 15854 Am Donnerstag, den 01.12.2005, 10:07 -0800 schrieb Gavin M. Roy: > Hi Michael, > > I'm a fan of ReiserFS, and I can be wrong, but I believe using a > journaling filesystem for the PgSQL database could be slowing things > down. Have a 200G+ database, someone pulling the power plug or a regular reboot after a year or so. Wait for the fsck to finish. Now think again :-) ++Tino From pgsql-performance-owner@postgresql.org Thu Dec 1 14:48:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2644E9DD699 for ; Thu, 1 Dec 2005 14:48:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26616-05 for ; Thu, 1 Dec 2005 14:48:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth02.mail.atl.earthlink.net (smtpauth02.mail.atl.earthlink.net [209.86.89.62]) by postgresql.org (Postfix) with ESMTP id 3E3069DD695 for ; Thu, 1 Dec 2005 14:48:20 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=pxT3mWKxwxnHeyDJa+WwYioXdg+F0RoKHc0p2+O5d7RWPqW9IEO9LPUq03ErpPoU; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth02.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EhtTc-0002v7-2v; Thu, 01 Dec 2005 13:48:16 -0500 Message-Id: <6.2.5.6.0.20051201134344.035fed60@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Thu, 01 Dec 2005 13:48:11 -0500 To: Tino Wildenhain ,pgsql-performance@postgresql.org From: Ron Subject: Re: 15,000 tables In-Reply-To: <1133462407.5734.43.camel@Andrea.peacock.de> References: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> <1133462407.5734.43.camel@Andrea.peacock.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcd113ec9ee20bae284c4783242b06a722350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.239 required=5 tests=[AWL=-0.239, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.239 X-Spam-Level: X-Archive-Number: 200512/34 X-Sequence-Number: 15855 Agreed. Also the odds of fs corruption or data loss are higher in a non journaling fs. Best practice seems to be to use a journaling fs but to put the fs log on dedicated spindles separate from the actual fs or pg_xlog. Ron At 01:40 PM 12/1/2005, Tino Wildenhain wrote: >Am Donnerstag, den 01.12.2005, 10:07 -0800 schrieb Gavin M. Roy: > > Hi Michael, > > > > I'm a fan of ReiserFS, and I can be wrong, but I believe using a > > journaling filesystem for the PgSQL database could be slowing things > > down. > >Have a 200G+ database, someone pulling the power plug >or a regular reboot after a year or so. > >Wait for the fsck to finish. > >Now think again :-) > >++Tino > > >---------------------------(end of broadcast)--------------------------- >TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Thu Dec 1 14:49:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0F9299DCB7B for ; Thu, 1 Dec 2005 14:49:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23659-09 for ; Thu, 1 Dec 2005 14:49:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tetra.ehpg.net (tetra2.ehpg.net [65.19.161.8]) by postgresql.org (Postfix) with ESMTP id 453389DCAB5 for ; Thu, 1 Dec 2005 14:49:45 -0400 (AST) Received: from dsl081-087-203.lax1.dsl.speakeasy.net ([64.81.87.203]) by tetra.ehpg.net with esmtpa (Exim 4.54) id 1EhtV3-0005cU-0X; Thu, 01 Dec 2005 10:49:46 -0800 In-Reply-To: <1133462407.5734.43.camel@Andrea.peacock.de> References: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> <1133462407.5734.43.camel@Andrea.peacock.de> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <81A7970E-20C0-441A-9F21-4FC6D8759BF2@ehpg.net> Cc: Michael Riess , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: "Gavin M. Roy" Subject: Re: 15,000 tables Date: Thu, 1 Dec 2005 10:49:43 -0800 To: Tino Wildenhain X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/35 X-Sequence-Number: 15856 Here's a fairly recent post on reiserfs (and performance): http://archives.postgresql.org/pgsql-novice/2005-09/msg00007.php I'm still digging on performance of ext2 vrs journaled filesystems, as I know I've seen it before. Gavin My point was not in doing an fsck, but rather in On Dec 1, 2005, at 10:40 AM, Tino Wildenhain wrote: > Am Donnerstag, den 01.12.2005, 10:07 -0800 schrieb Gavin M. Roy: >> Hi Michael, >> >> I'm a fan of ReiserFS, and I can be wrong, but I believe using a >> journaling filesystem for the PgSQL database could be slowing things >> down. > > Have a 200G+ database, someone pulling the power plug > or a regular reboot after a year or so. > > Wait for the fsck to finish. > > Now think again :-) > > ++Tino > Gavin M. Roy 800 Pound Gorilla gmr@ehpg.net From pgsql-performance-owner@postgresql.org Thu Dec 1 14:57:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C31ED9DD6A1 for ; Thu, 1 Dec 2005 14:57:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31975-01-2 for ; Thu, 1 Dec 2005 14:57:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7BAC39DD699 for ; Thu, 1 Dec 2005 14:57:34 -0400 (AST) 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 jB1IvXNr015740; Thu, 1 Dec 2005 13:57:33 -0500 (EST) To: Ron cc: Tino Wildenhain , pgsql-performance@postgresql.org Subject: Re: 15,000 tables In-reply-to: <6.2.5.6.0.20051201134344.035fed60@earthlink.net> References: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> <1133462407.5734.43.camel@Andrea.peacock.de> <6.2.5.6.0.20051201134344.035fed60@earthlink.net> Comments: In-reply-to Ron message dated "Thu, 01 Dec 2005 13:48:11 -0500" Date: Thu, 01 Dec 2005 13:57:33 -0500 Message-ID: <15739.1133463453@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/36 X-Sequence-Number: 15857 Ron writes: > Agreed. Also the odds of fs corruption or data loss are higher in a > non journaling fs. Best practice seems to be to use a journaling fs > but to put the fs log on dedicated spindles separate from the actual > fs or pg_xlog. I think we've determined that best practice is to journal metadata only (not file contents) on PG data filesystems. PG does expect the filesystem to remember where the files are, so you need metadata protection, but journalling file content updates is redundant with PG's own WAL logging. On a filesystem dedicated to WAL, you probably do not need any filesystem journalling at all --- we manage the WAL files in a way that avoids changing metadata for a WAL file that's in active use. A conservative approach would be to journal metadata here too, though. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 15:09:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0F0059DD551 for ; Thu, 1 Dec 2005 15:09:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27064-10 for ; Thu, 1 Dec 2005 15:09:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tetra.ehpg.net (tetra2.ehpg.net [65.19.161.8]) by postgresql.org (Postfix) with ESMTP id CAEE89DD43B for ; Thu, 1 Dec 2005 15:09:01 -0400 (AST) Received: from dsl081-087-203.lax1.dsl.speakeasy.net ([64.81.87.203]) by tetra.ehpg.net with esmtpa (Exim 4.54) id 1Ehtng-0001y4-B3; Thu, 01 Dec 2005 11:09:01 -0800 In-Reply-To: <81A7970E-20C0-441A-9F21-4FC6D8759BF2@ehpg.net> References: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> <1133462407.5734.43.camel@Andrea.peacock.de> <81A7970E-20C0-441A-9F21-4FC6D8759BF2@ehpg.net> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <09C886D5-E700-4B27-8266-BDDC1853C0B3@ehpg.net> Cc: Tino Wildenhain , Michael Riess , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: "Gavin M. Roy" Subject: Re: 15,000 tables Date: Thu, 1 Dec 2005 11:08:59 -0800 To: "Gavin M. Roy" X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/38 X-Sequence-Number: 15859 Heh looks like I left a trailing thought... My post wasn't saying don't use journaled filesystems, but rather that it can be slower than non-journaled filesystems, and I don't consider recovery time from a crash to be a factor in determining the speed of reads and writes on the data. That being said, I think Tom's reply on what to journal and not to journal should really put an end to this side of the conversation. Gavin On Dec 1, 2005, at 10:49 AM, Gavin M. Roy wrote: > Here's a fairly recent post on reiserfs (and performance): > > http://archives.postgresql.org/pgsql-novice/2005-09/msg00007.php > > I'm still digging on performance of ext2 vrs journaled filesystems, > as I know I've seen it before. > > Gavin > > > My point was not in doing an fsck, but rather in > On Dec 1, 2005, at 10:40 AM, Tino Wildenhain wrote: > >> Am Donnerstag, den 01.12.2005, 10:07 -0800 schrieb Gavin M. Roy: >>> Hi Michael, >>> >>> I'm a fan of ReiserFS, and I can be wrong, but I believe using a >>> journaling filesystem for the PgSQL database could be slowing things >>> down. >> >> Have a 200G+ database, someone pulling the power plug >> or a regular reboot after a year or so. >> >> Wait for the fsck to finish. >> >> Now think again :-) >> >> ++Tino >> > > Gavin M. Roy > 800 Pound Gorilla > gmr@ehpg.net > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings Gavin M. Roy 800 Pound Gorilla gmr@ehpg.net From pgsql-performance-owner@postgresql.org Thu Dec 1 15:19:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4461A9DCD76 for ; Thu, 1 Dec 2005 15:19:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36925-06 for ; Thu, 1 Dec 2005 15:19:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 283809DCB7B for ; Thu, 1 Dec 2005 15:19:33 -0400 (AST) 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 jB1JJEHq015961; Thu, 1 Dec 2005 14:19:14 -0500 (EST) To: "Jeremy Haile" cc: pgsql-performance@postgresql.org Subject: Re: Insert performance slows down in large batch In-reply-to: <1133459351.23834.248779098@webmail.messagingengine.com> References: <1133459351.23834.248779098@webmail.messagingengine.com> Comments: In-reply-to "Jeremy Haile" message dated "Thu, 01 Dec 2005 12:49:11 -0500" Date: Thu, 01 Dec 2005 14:19:14 -0500 Message-ID: <15960.1133464754@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/39 X-Sequence-Number: 15860 "Jeremy Haile" writes: > 1) Why does the performance degrade as the table sizes grow? Shouldn't > the insert performance remain fairly constant if there are no indexes or > constraints? Yeah, insert really should be a constant-time operation if there's no add-on operations like index updates or FK checks. Can you get more information about where the time is going with gprof or oprofile? (I'm not sure if oprofile is available for RHEL4, but it is in Fedora 4 so maybe RHEL4 has it too.) If you're not comfortable with performance measurement tools, perhaps you could crank up a test case program that just generates dummy data and inserts it in the same way as your real application does. If you can confirm a slowdown in a test case that other people can look at, we'd be happy to look into the reason for it. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 15:34:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 374419DD551 for ; Thu, 1 Dec 2005 15:34:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48140-05 for ; Thu, 1 Dec 2005 15:34:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 2613F9DCCC6 for ; Thu, 1 Dec 2005 15:34:44 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0142933691; Thu, 1 Dec 2005 20:34:45 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables Date: Thu, 01 Dec 2005 20:34:43 +0100 Organization: Hub.Org Networking Services Lines: 61 Message-ID: References: <60psogzqui.fsf@dba2.int.libertyrms.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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <60psogzqui.fsf@dba2.int.libertyrms.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/40 X-Sequence-Number: 15861 > Michael Riess writes: >>> On 12/1/05, Michael Riess wrote: >>>> we are currently running a postgres server (upgraded to 8.1) which >>>> has one large database with approx. 15,000 tables. Unfortunately >>>> performance suffers from that, because the internal tables >>>> (especially that which holds the attribute info) get too large. >>>> >>>> (We NEED that many tables, please don't recommend to reduce them) >>>> >>> Have you ANALYZEd your database? VACUUMing? >> Of course ... before 8.1 we routinely did a vacuum full analyze each >> night. As of 8.1 we use autovacuum. > > VACUUM FULL was probably always overkill, unless "always" includes > versions prior to 7.3... Well, we tried switching to daily VACUUM ANALYZE and weekly VACUUM FULL, but the database got considerably slower near the end of the week. > >>> BTW, are you using some kind of weird ERP? I have one that treat >>> informix as a fool and don't let me get all of informix potential... >>> maybe the same is in your case... >> No. Our database contains tables for we content management >> systems. The server hosts approx. 500 cms applications, and each of >> them has approx. 30 tables. >> >> That's why I'm asking if it was better to have 500 databases with 30 >> tables each. In previous Postgres versions this led to even worse >> performance ... > > This has the feeling of fitting with Alan Perlis' dictum below... > > Supposing you have 500 databases, each with 30 tables, each with 4 > indices, then you'll find you have, on disk... > > # of files = 500 x 30 x 5 = 75000 files > > If each is regularly being accessed, that's bits of 75000 files > getting shoved through OS and shared memory caches. Oh, yes, and > you'll also have regular participation of some of the pg_catalog > files, with ~500 instances of THOSE, multiplied some number of ways... > Not all of the tables are frequently accessed. In fact I would estimate that only 20% are actually used ... but there is no way to determine if or when a table will be used. I thought about a way to "swap out" tables which have not been used for a couple of days ... maybe I'll do just that. But it would be cumbersome ... I had hoped that an unused table does not hurt performance. But of course the internal tables which contain the meta info get too large. > An application with 15000 frequently accessed tables doesn't strike me > as being something that can possibly turn out well. You have, in > effect, more tables than (arguably) bloated ERP systems like SAP R/3; > it only has a few thousand tables, and since many are module-specific, > and nobody ever implements *all* the modules, it is likely only a few > hundred that are "hot spots." No 15000 there.. I think that my systems confirms with the 80/20 rule ... . From pgsql-performance-owner@postgresql.org Thu Dec 1 15:41:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 538F59DCCC6 for ; Thu, 1 Dec 2005 15:41:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48296-06 for ; Thu, 1 Dec 2005 15:40:58 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.204]) by postgresql.org (Postfix) with ESMTP id 244019DCAD1 for ; Thu, 1 Dec 2005 15:40:59 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s12so371236wxc for ; Thu, 01 Dec 2005 11:41:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=caMTdHzZuMZhDwU4qIPiYwRMiFMiY6PaC9L3cH9DYHb1JqZAt6HObxjOJb5lq3P4EY+A0gj4fuQA/kNYYRvbB/tv74eXOibq8V5cjM6YL/5KdsbEY/Nvj3gOoE13n9137bWzCRCh+EhauoUKl/XPQXIx/mncYdIYnFo/fqwia6s= Received: by 10.64.150.8 with SMTP id x8mr1087174qbd; Thu, 01 Dec 2005 11:40:59 -0800 (PST) Received: by 10.65.180.14 with HTTP; Thu, 1 Dec 2005 11:40:59 -0800 (PST) Message-ID: Date: Thu, 1 Dec 2005 14:40:59 -0500 From: Jaime Casanova To: Michael Riess Subject: Re: 15,000 tables 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: <60psogzqui.fsf@dba2.int.libertyrms.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/41 X-Sequence-Number: 15862 On 12/1/05, Michael Riess wrote: > > Michael Riess writes: > >>> On 12/1/05, Michael Riess wrote: > >>>> we are currently running a postgres server (upgraded to 8.1) which > >>>> has one large database with approx. 15,000 tables. Unfortunately > >>>> performance suffers from that, because the internal tables > >>>> (especially that which holds the attribute info) get too large. > >>>> > >>>> (We NEED that many tables, please don't recommend to reduce them) > >>>> > >>> Have you ANALYZEd your database? VACUUMing? > >> Of course ... before 8.1 we routinely did a vacuum full analyze each > >> night. As of 8.1 we use autovacuum. > > > > VACUUM FULL was probably always overkill, unless "always" includes > > versions prior to 7.3... > > Well, we tried switching to daily VACUUM ANALYZE and weekly VACUUM FULL, > but the database got considerably slower near the end of the week. > > > > >>> BTW, are you using some kind of weird ERP? I have one that treat > >>> informix as a fool and don't let me get all of informix potential... > >>> maybe the same is in your case... > >> No. Our database contains tables for we content management > >> systems. The server hosts approx. 500 cms applications, and each of > >> them has approx. 30 tables. > >> > >> That's why I'm asking if it was better to have 500 databases with 30 > >> tables each. In previous Postgres versions this led to even worse > >> performance ... > > > > This has the feeling of fitting with Alan Perlis' dictum below... > > > > Supposing you have 500 databases, each with 30 tables, each with 4 > > indices, then you'll find you have, on disk... > > > > # of files =3D 500 x 30 x 5 =3D 75000 files > > > > If each is regularly being accessed, that's bits of 75000 files > > getting shoved through OS and shared memory caches. Oh, yes, and > > you'll also have regular participation of some of the pg_catalog > > files, with ~500 instances of THOSE, multiplied some number of ways... > > > > Not all of the tables are frequently accessed. In fact I would estimate > that only 20% are actually used ... but there is no way to determine if > or when a table will be used. I thought about a way to "swap out" tables > which have not been used for a couple of days ... maybe I'll do just > that. But it would be cumbersome ... I had hoped that an unused table > does not hurt performance. But of course the internal tables which > contain the meta info get too large. > > > An application with 15000 frequently accessed tables doesn't strike me > > as being something that can possibly turn out well. You have, in > > effect, more tables than (arguably) bloated ERP systems like SAP R/3; > > it only has a few thousand tables, and since many are module-specific, > > and nobody ever implements *all* the modules, it is likely only a few > > hundred that are "hot spots." No 15000 there.. > > I think that my systems confirms with the 80/20 rule ... > . > How many disks do you have i imagine you can put tables forming one logical database in a tablespace and have tables spread on various disks... -- Atentamente, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Thu Dec 1 16:29:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6CDFB9DD6C1 for ; Thu, 1 Dec 2005 16:29:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72392-02 for ; Thu, 1 Dec 2005 16:29:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 250499DD6BA for ; Thu, 1 Dec 2005 16:29:01 -0400 (AST) Content-class: urn:content-classes:message Subject: Re: 15,000 tables Date: Thu, 1 Dec 2005 15:28:58 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD9DE@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] 15,000 tables X-MimeOLE: Produced By Microsoft Exchange V6.5 thread-index: AcX2fR2l9lv6YKNXTHyDeitPJYW1iAANgudg From: "Merlin Moncure" To: "Michael Riess" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/42 X-Sequence-Number: 15863 > we are currently running a postgres server (upgraded to 8.1) which has > one large database with approx. 15,000 tables. Unfortunately performance > suffers from that, because the internal tables (especially that which > holds the attribute info) get too large. >=20 > (We NEED that many tables, please don't recommend to reduce them) >=20 > Logically these tables could be grouped into 500 databases. My question > is: >=20 > Would performance be better if I had 500 databases (on one postgres > server instance) which each contain 30 tables, or is it better to have > one large database with 15,000 tables? In the old days of postgres 6.5 > we tried that, but performance was horrible with many databases ... >=20 > BTW: I searched the mailing list, but found nothing on the subject - and > there also isn't any information in the documentation about the effects > of the number of databases, tables or attributes on the performance. >=20 > Now, what do you say? Thanks in advance for any comment! I've never run near that many databases on one box so I can't comment on the performance. But let's assume for the moment pg runs fine with 500 databases. The most important advantage of multi-schema approach is cross schema querying. I think as you are defining your problem this is a better way to do things. Merlin From pgsql-performance-owner@postgresql.org Thu Dec 1 17:16:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8A27E9DD6B6 for ; Thu, 1 Dec 2005 17:16:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88540-06 for ; Thu, 1 Dec 2005 17:15:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 6A7B29DD626 for ; Thu, 1 Dec 2005 17:15:57 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 01 Dec 2005 15:15:59 -0600 Subject: Re: 15,000 tables From: Scott Marlowe To: Michael Riess Cc: pgsql-performance@postgresql.org In-Reply-To: References: <60psogzqui.fsf@dba2.int.libertyrms.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1133471756.16010.63.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 01 Dec 2005 15:15:59 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/43 X-Sequence-Number: 15864 On Thu, 2005-12-01 at 13:34, Michael Riess wrote: > > Michael Riess writes: > >>> On 12/1/05, Michael Riess wrote: > >>>> we are currently running a postgres server (upgraded to 8.1) which > >>>> has one large database with approx. 15,000 tables. Unfortunately > >>>> performance suffers from that, because the internal tables > >>>> (especially that which holds the attribute info) get too large. > >>>> > >>>> (We NEED that many tables, please don't recommend to reduce them) > >>>> > >>> Have you ANALYZEd your database? VACUUMing? > >> Of course ... before 8.1 we routinely did a vacuum full analyze each > >> night. As of 8.1 we use autovacuum. > > > > VACUUM FULL was probably always overkill, unless "always" includes > > versions prior to 7.3... > > Well, we tried switching to daily VACUUM ANALYZE and weekly VACUUM FULL, > but the database got considerably slower near the end of the week. Generally, this means either your vacuums are too infrequent, or your fsm settings are too small. Note that vacuum and analyze aren't "married" any more, like in the old days. You can issue either separately, depending on your usage conditions. Note that with the newest versions of PostgreSQL you can change the settings for vacuum priority so that while it takes longer to vacuum, it doesn't stomp on the other processes toes so much anymore, so more frequent plain vacuums may be the answer. From pgsql-performance-owner@postgresql.org Thu Dec 1 17:17:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AD6639DD6B6 for ; Thu, 1 Dec 2005 17:17:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86645-07 for ; Thu, 1 Dec 2005 17:17:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by postgresql.org (Postfix) with ESMTP id B3D389DD626 for ; Thu, 1 Dec 2005 17:17:41 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 01 Dec 2005 18:14:54 -0300 X-IronPort-AV: i="3.99,202,1131332400"; d="scan'208"; a="1356226:sNHT5346314052" Received: from alvh.no-ip.org (201.220.122.225) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 438E66E80001E801; Thu, 1 Dec 2005 18:15:29 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id DADDBC26462; Thu, 1 Dec 2005 18:16:04 -0300 (CLST) Date: Thu, 1 Dec 2005 18:16:04 -0300 From: Alvaro Herrera To: me@alternize.com Cc: Michael Riess , pgsql-performance@postgresql.org Subject: Re: 15,000 tables Message-ID: <20051201211604.GA6375@surnet.cl> Mail-Followup-To: me@alternize.com, Michael Riess , pgsql-performance@postgresql.org References: <06f401c5f699$bbae2af0$0201a8c0@iwing> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06f401c5f699$bbae2af0$0201a8c0@iwing> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.66 required=5 tests=[AWL=-0.259, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.66 X-Spam-Level: * X-Archive-Number: 200512/44 X-Sequence-Number: 15865 me@alternize.com wrote: > what i noticed is autovacuum not working properly as it should. i had 8.1 > running with autovacuum for just 2 days or so and got warnings in pgadmin > that my tables would need an vacuum. Hum, so how is autovacuum's documentation lacking? Please read it critically and let us know so we can improve it. http://www.postgresql.org/docs/8.1/static/maintenance.html#AUTOVACUUM Maybe what you need is to lower the "vacuum base threshold" for tables that are small. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support From pgsql-performance-owner@postgresql.org Thu Dec 1 18:23:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1DBA69DD6C4 for ; Thu, 1 Dec 2005 18:23:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16379-07 for ; Thu, 1 Dec 2005 18:23:43 -0400 (AST) X-Greylist: delayed 00:05:01.683534 by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.154]) by postgresql.org (Postfix) with ESMTP id D56B79DD6B5 for ; Thu, 1 Dec 2005 18:23:44 -0400 (AST) Received: from dell8200 (pcp09613107pcs.rte20201.de.comcast.net[68.82.197.68]) by comcast.net (rwcrmhc14) with SMTP id <2005120122184301400qh8uae>; Thu, 1 Dec 2005 22:18:43 +0000 From: "Rick Schumeyer" To: "'Rick Schumeyer'" , Subject: Re: COPY into table too slow with index: now an I/O question Date: Thu, 1 Dec 2005 17:18:38 -0500 Message-ID: <00df01c5f6c5$2e84c310$0200a8c0@dell8200> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00E0_01C5F69B.45AEBB10" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: <00b101c5f6a0$d0ffea40$0200a8c0@dell8200> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/45 X-Sequence-Number: 15866 This is a multi-part message in MIME format. ------=_NextPart_000_00E0_01C5F69B.45AEBB10 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable As a follow up to my own question: =20 I reran the COPY both ways (with the index and without) while running iostat. The following values are averages: %user %nice %sys %iowait %idle no index 39 0 2.8 11 47 index 16 1.5 2.1 34 46 =20 I'm no performance guru, so please indulge a couple of silly questions: =20 1) Why is there so much idle time? I would think the CPU would = either be busy or waiting for IO. 2) It seems that I need to improve my disk situation. Would it = help to add another drive to my PC and keep the input data on a separate drive from my pg tables? If so, some pointers on the best way to set that up would be appreciated. =20 Please let me know if anyone has additional ideas. =20 -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Rick = Schumeyer Sent: Thursday, December 01, 2005 12:58 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] COPY into table too slow with index =20 I'm running postgresql 8.1.0 with postgis 1.0.4 on a FC3 system, 3Ghz, 1 = GB memory. =20 I am using COPY to fill a table that contains one postgis geometry = column. =20 With no geometry index, it takes about 45 seconds to COPY one file. =20 If I add a geometry index, this time degrades. It keeps getting worse = as more records are added to the table. It was up to over three minutes per file on my most recent test. =20 The problem is that each file contains about 5 - 10 minutes of data. Eventually, I want to add the data to the table in "real time". So the COPY needs to take = less time than=20 actually generating the data. =20 Here is the relevant section of my postgresql.conf. =20 # - Memory - =20 shared_buffers =3D 5000 # min 16 or max_connections*2, 8KB = each #temp_buffers =3D 1000 # min 100, 8KB each #max_prepared_transactions =3D 5 # can be 0 or more # note: increasing max_prepared_transactions costs ~600 bytes of shared memory # per transaction slot, plus lock space (see max_locks_per_transaction). work_mem =3D 20000 # min 64, size in KB maintenance_work_mem =3D 20000 # min 1024, size in KB #max_stack_depth =3D 2048 # min 100, size in KB =20 Any suggestions for improvement? ------=_NextPart_000_00E0_01C5F69B.45AEBB10 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

As a follow up to my own = question:

 

I reran the COPY both ways (with = the index and without) while running iostat.  The following = values

are averages:

         &n= bsp;   %user  %nice  %sys  %iowait %idle

no = index      39      0     2.8    11      = 47

index         16      1.5   2.1    34      46

 

I’m no performance guru, so = please indulge a couple of silly questions:

 

1)       Why is there so = much idle time?  I would think the CPU would either be busy or waiting for = IO.

2)       It seems that I = need to improve my disk situation.  Would it help to add another drive to = my PC and

keep the input data on a separate = drive from my pg tables?  If so, some pointers on the best way to set = that up

would be = appreciated.

 

Please let me know if anyone has additional ideas.

 

-----Original Message-----
From: pgsql-performance-owner@postgresql.org = [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Rick = Schumeyer
Sent:
Thursday, December 01, 2005 12:58 = PM
To: pgsql-performance@postgresql.org
Subject: [PERFORM] COPY = into table too slow with index

 

I’m running postgresql 8.1.0 with postgis 1.0.4 = on a FC3 system, 3Ghz, 1 GB memory.

 

I am using COPY to fill a table that contains one = postgis geometry column.

 

With no geometry index, it takes about 45 seconds to = COPY one file.

 

If I add a geometry index, this time degrades.  = It keeps getting worse as more records are

added to the table.  It was up to over three = minutes per file on my most recent test.

 

The problem is that each file contains about 5 = – 10 minutes of data.  Eventually, I want to

add the data to the table in “real = time”.  So the COPY needs to take less time than

actually generating the data.

 

Here is the relevant section of my = postgresql.conf.

 

# - Memory = -

 

shared_buffers =3D 5000           &nb= sp;   # min 16 or max_connections*2, 8KB each

#temp_buffers =3D 1000           &nb= sp;    # min 100, 8KB each

#max_prepared_transactions =3D 5            # = can be 0 or more

# note: increasing max_prepared_transactions costs ~600 bytes of shared = memory

# per transaction = slot, plus lock space (see max_locks_per_transaction).

work_mem =3D 20000           &n= bsp;  # min 64, size in KB

maintenance_work_mem =3D 20000        # min 1024, size in = KB

#max_stack_depth = =3D 2048           &nb= sp; # min 100, size in KB

 

Any suggestions for improvement?

------=_NextPart_000_00E0_01C5F69B.45AEBB10-- From pgsql-performance-owner@postgresql.org Thu Dec 1 23:01:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B6B899DD708 for ; Thu, 1 Dec 2005 23:01:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30317-08 for ; Thu, 1 Dec 2005 23:01:03 -0400 (AST) X-Greylist: delayed 02:33:58.893498 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 5DC9C9DD6F7 for ; Thu, 1 Dec 2005 23:01:03 -0400 (AST) Received: from mail04.stbernard.com (mail02.stbernard.com [64.154.93.166]) by svr2.postgresql.org (Postfix) with ESMTP id 0D594F0B41 for ; Fri, 2 Dec 2005 00:27:07 +0000 (GMT) Received: from mail01.stbernard.com (mail01.stbernard.com [192.168.32.92]) by mail04.stbernard.com (8.12.11/8.12.11) with ESMTP id jB20R68n050694 for ; Thu, 1 Dec 2005 16:27:06 -0800 (PST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5F6D7.1FDFD914" Subject: Database restore speed Date: Thu, 1 Dec 2005 16:27:06 -0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Database restore speed Thread-Index: AcX21x/b4+l1kRh8QeW6UuXk9MHxPA== From: "Steve Oualline" To: X-Scanned-By: ePrism email filtering appliance on 192.168.32.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.035 required=5 tests=[DNS_FROM_RFC_BOGUSMX=2.034, HTML_MESSAGE=0.001] X-Spam-Score: 2.035 X-Spam-Level: ** X-Archive-Number: 200512/47 X-Sequence-Number: 15868 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5F6D7.1FDFD914 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Our application tries to insert data into the database as fast as it = can. Currently the work is being split into a number of 1MB copy operations. When we restore the postmaster process tries to use 100% of the CPU. The questions we have are: 1) What is postmaster doing that it needs so much CPU? 2) How can we get our system to go faster? Note: We've tried adjusting the checkpoint_segements parameter to no = effect. Any suggestions welcome. ------_=_NextPart_001_01C5F6D7.1FDFD914 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Database restore speed

Our application tries to insert data = into the database as fast as it can.
Currently the work is being split into = a number of 1MB copy operations.

When we restore the postmaster process = tries to use 100% of the CPU.

The questions we have are:

1) What is postmaster doing that it = needs so much CPU?

2) How can we get our system to go = faster?


Note: We've tried adjusting the = checkpoint_segements parameter to no effect.
Any suggestions welcome.

------_=_NextPart_001_01C5F6D7.1FDFD914-- From pgsql-performance-owner@postgresql.org Thu Dec 1 22:27:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9EE2A9DD6EA for ; Thu, 1 Dec 2005 22:27:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21524-06 for ; Thu, 1 Dec 2005 22:26:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id A9F419DD6EF for ; Thu, 1 Dec 2005 22:26:55 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Thu, 01 Dec 2005 21:26:51 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 1 Dec 2005 21:26:43 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 2 Dec 2005 02:26:43 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 01 Dec 2005 18:26:42 -0800 Subject: Re: COPY into table too slow with index: now an I/O From: "Luke Lonergan" To: "Rick Schumeyer" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] COPY into table too slow with index: now an I/O question Thread-Index: AcX2xgRQYOdxLI0BQiKG1sSBUd6zLAAIdCbq In-Reply-To: <00df01c5f6c5$2e84c310$0200a8c0@dell8200> MIME-Version: 1.0 X-OriginalArrivalTime: 02 Dec 2005 02:26:43.0950 (UTC) FILETIME=[D614E8E0:01C5F6E7] X-WSS-ID: 6F916F614J84424997-03-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/46 X-Sequence-Number: 15867 Rick, On 12/1/05 2:18 PM, "Rick Schumeyer" wrote: > As a follow up to my own question: > =20 > I reran the COPY both ways (with the index and without) while running ios= tat. > The following values > are averages: > %user %nice %sys %iowait %idle > no index 39 0 2.8 11 47 > index 16 1.5 2.1 34 46 > =20 > I=B9m no performance guru, so please indulge a couple of silly questions: > =20 > 1) Why is there so much idle time? I would think the CPU would eith= er be > busy or waiting for IO. The 100% represents 2 CPUs. When one CPU is fully busy you should see 50% idle time. > 2) It seems that I need to improve my disk situation. Would it help= to > add another drive to my PC and > keep the input data on a separate drive from my pg tables? If so, some > pointers on the best way to set that up > would be appreciated. Putting the index and the table on separate disks will fix this IMO. I think you can do that using the "TABLESPACE" concept for each. The problem I see is nicely shown by the increase in IOWAIT between the two patterns (with and without index). It seems likely that the pattern is: A - insert a tuple into the table B - insert an entry into the index C - fsync the WAL - repeat This can be as bad as having a disk seek to access the table data every tim= e the 8KB page boundary is crossed, then again for the index, then again for the WAL, and random disk seeks happen only as fast as about 10ms, so you ca= n only do those at a rate of 100/s. > Please let me know if anyone has additional ideas. This is a fairly common problem, some people drop the index, load the data, then recreate the index to get around it. - Luke From pgsql-performance-owner@postgresql.org Thu Dec 1 23:10:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D3A99DD6F5 for ; Thu, 1 Dec 2005 23:10:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46352-02 for ; Thu, 1 Dec 2005 23:10:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 83F299DD702 for ; Thu, 1 Dec 2005 23:10:05 -0400 (AST) 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 jB23A6TM021103; Thu, 1 Dec 2005 22:10:06 -0500 (EST) To: "Luke Lonergan" cc: "Rick Schumeyer" , pgsql-performance@postgresql.org Subject: Re: COPY into table too slow with index: now an I/O In-reply-to: References: Comments: In-reply-to "Luke Lonergan" message dated "Thu, 01 Dec 2005 18:26:42 -0800" Date: Thu, 01 Dec 2005 22:10:06 -0500 Message-ID: <21102.1133493006@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/48 X-Sequence-Number: 15869 "Luke Lonergan" writes: > The problem I see is nicely shown by the increase in IOWAIT between the two > patterns (with and without index). It seems likely that the pattern is: > A - insert a tuple into the table > B - insert an entry into the index > C - fsync the WAL > - repeat > This can be as bad as having a disk seek to access the table data every time > the 8KB page boundary is crossed, then again for the index, then again for > the WAL, and random disk seeks happen only as fast as about 10ms, so you can > only do those at a rate of 100/s. That analysis is far too simplistic, because only the WAL write has to happen before the transaction can commit. The table and index writes will normally happen at some later point in the bgwriter, and with any luck there will only need to be one write per page, not per tuple. It is true that having WAL and data on the same spindle is bad news, because the disk head has to divide its time between synchronous WAL writes and asynchronous writes of the rest of the files. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 1 23:27:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E5B79DCAB4 for ; Thu, 1 Dec 2005 23:27:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52593-02 for ; Thu, 1 Dec 2005 23:27:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) by postgresql.org (Postfix) with ESMTP id E2C049DD6ED for ; Thu, 1 Dec 2005 23:27:03 -0400 (AST) Received: from dell8200 (pcp09613107pcs.rte20201.de.comcast.net[68.82.197.68]) by comcast.net (rwcrmhc14) with SMTP id <2005120203270001400qb7vee>; Fri, 2 Dec 2005 03:27:01 +0000 From: "Rick Schumeyer" To: "'Luke Lonergan'" , Subject: Re: COPY into table too slow with index: now an I/O question Date: Thu, 1 Dec 2005 22:26:56 -0500 Message-ID: <00ee01c5f6f0$3faec750$0200a8c0@dell8200> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/49 X-Sequence-Number: 15870 I only have one CPU. Is my copy of iostat confused, or does this have something to do with hyperthreading or dual core? (AFAIK, I don't have = a dual core!) The problem (for me) with dropping the index during a copy is that it = takes tens of minutes (or more) to recreate the geometry index once the table = has, say, 50 million rows. > -----Original Message----- > From: Luke Lonergan [mailto:llonergan@greenplum.com] > Sent: Thursday, December 01, 2005 9:27 PM > To: Rick Schumeyer; pgsql-performance@postgresql.org > Subject: Re: [PERFORM] COPY into table too slow with index: now an I/O > question >=20 > Rick, >=20 > On 12/1/05 2:18 PM, "Rick Schumeyer" wrote: >=20 > > As a follow up to my own question: > > > > I reran the COPY both ways (with the index and without) while = running > iostat. > > The following values > > are averages: > > %user %nice %sys %iowait %idle > > no index 39 0 2.8 11 47 > > index 16 1.5 2.1 34 46 > > > > I=B9m no performance guru, so please indulge a couple of silly = questions: > > > > 1) Why is there so much idle time? I would think the CPU would > either be > > busy or waiting for IO. >=20 > The 100% represents 2 CPUs. When one CPU is fully busy you should see = 50% > idle time. >=20 > > 2) It seems that I need to improve my disk situation. Would it > help to > > add another drive to my PC and > > keep the input data on a separate drive from my pg tables? If so, = some > > pointers on the best way to set that up > > would be appreciated. >=20 > Putting the index and the table on separate disks will fix this IMO. = I > think you can do that using the "TABLESPACE" concept for each. >=20 > The problem I see is nicely shown by the increase in IOWAIT between = the > two > patterns (with and without index). It seems likely that the pattern = is: > A - insert a tuple into the table > B - insert an entry into the index > C - fsync the WAL > - repeat >=20 > This can be as bad as having a disk seek to access the table data = every > time > the 8KB page boundary is crossed, then again for the index, then again = for > the WAL, and random disk seeks happen only as fast as about 10ms, so = you > can > only do those at a rate of 100/s. >=20 > > Please let me know if anyone has additional ideas. >=20 > This is a fairly common problem, some people drop the index, load the > data, > then recreate the index to get around it. >=20 > - Luke From pgsql-performance-owner@postgresql.org Thu Dec 1 23:50:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 389B19DCD6F for ; Thu, 1 Dec 2005 23:50:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60044-05 for ; Thu, 1 Dec 2005 23:50:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id A8B3A9DCB9B for ; Thu, 1 Dec 2005 23:50:26 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jB240hHD032236 for ; Thu, 1 Dec 2005 20:00:43 -0800 Message-ID: <438FC3D2.8090202@modgraph-usa.com> Date: Thu, 01 Dec 2005 19:47:30 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: 15,000 tables References: <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> <20051118034631.GA70159@winnie.fuhr.org> <437F66CF.7080402@modgraph-usa.com> <20051119190304.GJ7330@mathom.us> <4380EEA2.4010002@modgraph-usa.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/50 X-Sequence-Number: 15871 So say I need 10,000 tables, but I can create tablespaces. Wouldn't that solve the performance problem caused by Linux's (or ext2/3's) problems with large directories? For example, if each user creates (say) 10 tables, and I have 1000 users, I could create 100 tablespaces, and assign groups of 10 users to each tablespace. This would limit each tablespace to 100 tables, and keep the ext2/3 file-system directories manageable. Would this work? Would there be other problems? Thanks, Craig From pgsql-performance-owner@postgresql.org Fri Dec 2 01:17:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2E2B9DD773 for ; Fri, 2 Dec 2005 01:16:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03018-01-11 for ; Fri, 2 Dec 2005 01:16:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id 1C4E89DD6B6 for ; Fri, 2 Dec 2005 01:16:13 -0400 (AST) Received: from 172.16.1.24 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 02 Dec 2005 00:16:04 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 00:16:04 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: COPY into table too slow with index: now an I/O Date: Fri, 2 Dec 2005 00:15:57 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01C48EFB@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] COPY into table too slow with index: now an I/O Thread-Index: AcX27enx+cz29kZjQpecjT1KD26wDwAESGew From: "Luke Lonergan" To: "Tom Lane" cc: "Rick Schumeyer" , pgsql-performance@postgresql.org X-OriginalArrivalTime: 02 Dec 2005 05:16:04.0737 (UTC) FILETIME=[7E61F710:01C5F6FF] X-WSS-ID: 6F91071E4083356104-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/51 X-Sequence-Number: 15872 Tom,=20 > That analysis is far too simplistic, because only the WAL=20 > write has to happen before the transaction can commit. The=20 > table and index writes will normally happen at some later=20 > point in the bgwriter, and with any luck there will only need=20 > to be one write per page, not per tuple. That's good to know - makes sense. I suppose we might still thrash over a 1GB range in seeks if the BG writer starts running at full rate in the background, right? Or is there some write combining in the BG writer? > It is true that having WAL and data on the same spindle is=20 > bad news, because the disk head has to divide its time=20 > between synchronous WAL writes and asynchronous writes of the=20 > rest of the files. That sounds right - could be tested by him turning fsync off, or by moving the WAL to a different spindle (note I'm not advocating running in production with fsync off). - Luke From pgsql-performance-owner@postgresql.org Fri Dec 2 02:23:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D8D4E9DD6B6 for ; Fri, 2 Dec 2005 02:23:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50912-04 for ; Fri, 2 Dec 2005 02:23:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by postgresql.org (Postfix) with ESMTP id 4C3AF9DCD47 for ; Fri, 2 Dec 2005 02:23:13 -0400 (AST) Received: from 172.16.1.26 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Fri, 02 Dec 2005 01:23:04 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 01:12:02 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Database restore speed Date: Fri, 2 Dec 2005 01:11:53 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01C48EFF@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX21x/b4+l1kRh8QeW6UuXk9MHxPAAL4M+Q From: "Luke Lonergan" To: "Steve Oualline" , pgsql-performance@postgresql.org X-OriginalArrivalTime: 02 Dec 2005 06:12:02.0225 (UTC) FILETIME=[4F99FA10:01C5F707] X-WSS-ID: 6F9137C219O8216476-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/52 X-Sequence-Number: 15873 Steve,=20 > When we restore the postmaster process tries to use 100% of the CPU.=20 >=20 > The questions we have are:=20 >=20 > 1) What is postmaster doing that it needs so much CPU?=20 Parsing mostly, and attribute conversion from text to DBMS native formats. =20 > 2) How can we get our system to go faster?=20 Use Postgres 8.1 or Bizgres. Get a faster CPU.=20 These two points are based on our work to improve COPY speed, which led to a near doubling in Bizgres, and in the 8.1 version it's about 60-70% faster than in Postgres 8.0. There are currently two main bottlenecks in COPY, one is parsing + attribute conversion (if the postgres CPU is nailed at 100% that's what your limit is) and the other is the write speed through the WAL. You can roughly divide the write speed of your disk by 3 to get that limit, e.g. if your disk can write 8k blocks at 100MB/s, then your COPY speed might be limited to 33MB/s. You can tell which of these limits you've hit using "vmstat 1" on Linux or iostat on Solaris and watch the blocks input/output on your disk while you watch your CPU. > Note: We've tried adjusting the checkpoint_segements=20 > parameter to no effect.=20 No surprise. - Luke From pgsql-performance-owner@postgresql.org Fri Dec 2 03:14:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 443DB9DD7AD for ; Fri, 2 Dec 2005 03:14:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66929-08-7 for ; Fri, 2 Dec 2005 03:13:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id E32809DD91C for ; Fri, 2 Dec 2005 03:09:39 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 9457B1AC3EB; Thu, 1 Dec 2005 23:08:36 -0800 (PST) Date: Thu, 1 Dec 2005 23:07:56 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Qingqing Zhou Cc: pgsql-performance@postgresql.org Subject: Re: filesystem performance with lots of files 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/53 X-Sequence-Number: 15874 On Thu, 1 Dec 2005, Qingqing Zhou wrote: > "David Lang" wrote >> >> a few weeks ago I did a series of tests to compare different filesystems. >> the test was for a different purpose so the particulars are not what I >> woud do for testing aimed at postgres, but I think the data is relavent) >> and I saw major differences between different filesystems, I'll see aobut >> re-running the tests to get a complete set of benchmarks in the next few >> days. My tests had their times vary from 4 min to 80 min depending on the >> filesystem in use (ext3 with hash_dir posted the worst case). what testing >> have other people done with different filesystems? >> > > That's good ... what benchmarks did you used? I was doing testing in the context of a requirement to sync over a million small files from one machine to another (rsync would take >10 hours to do this over a 100Mb network so I started with the question 'how long would it take to do a tar-ftp-untar cycle with no smarts) so I created 1m x 1K files in a three deep directory tree (10d/10d/10d/1000files) and was doing simple 'time to copy tree', 'time to create tar', 'time to extract from tar', 'time to copy tarfile (1.6G file). I flushed the memory between each test with cat largefile >/dev/null (I know now that I should have unmounted and remounted between each test), source and destination on different IDE controllers I don't have all the numbers readily available (and I didn't do all the tests on every filesystem), but I found that even with only 1000 files/directory ext3 had some problems, and if you enabled dir_hash some functions would speed up, but writing lots of files would just collapse (that was the 80 min run) I'll have to script it and re-do the tests (and when I do this I'll also set it to do a test with far fewer, far larger files as well) David Lang From pgsql-performance-owner@postgresql.org Fri Dec 2 03:39:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 421459DCB66 for ; Fri, 2 Dec 2005 03:39:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72507-07 for ; Fri, 2 Dec 2005 03:39:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 197B49DCB0D for ; Fri, 2 Dec 2005 03:36:58 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 8446A1AC3EB for ; Thu, 1 Dec 2005 23:35:58 -0800 (PST) Date: Thu, 1 Dec 2005 23:35:17 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: pgsql-performance@postgresql.org Subject: Re: Open request for benchmarking input (fwd) 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/54 X-Sequence-Number: 15875 here are the suggestions from the MySQL folks, what additional tests should I do. I'd like to see some tests submitted that map out when not to use a particular database engine, so if you have a test that you know a particular database chokes on let me know (bonus credibility if you include tests that your own database has trouble with :) David Lang ---------- Forwarded message ---------- Date: Thu, 01 Dec 2005 16:14:25 David, The choice of benchmark depends on what kind of application would you like to see performance for. Than someone speaks about one or other database to be faster than other in general, it makes me smile. That would be the same as tell one car would be able to win all competitions starting from Formula-1 and ending with off-road racing. There are certain well known cases when MySQL will be faster - for example in memory storage engine is hard to beat in point selects, or bulk inserts in MyISAM (no transactional overhead). There are certain known cases when MySQL would not perform well - it is easy to build the query using subqueries which would be horribly slow on MySQL but decent on postgresql... but well writing application for MySQL you would not write such query. I think most database agnostic way would be to select the "workload" from user point of view and have it implemented the most efficient way for database in question - for example you may find TPC-C implementations by different vendors are a lot different. > > For my own interests, I would like to at least cover the following bases: > 32 bit vs 64 bit vs 64 bit kernel + 32 bit user-space; data warehouse type > tests (data >> memory); and web prefs test (active data RAM) You may grab Dell DVD store: http://linux.dell.com/dvdstore/ for Web benchmark. It does not have PostgreSQL build in but there some implementations available in the Internet DBT2 by OSDL is other good candidate - it does support postgreSQL and MySQL natively. If you want some raw performance number such as number selects/sec you may use SysBench - http://sysbench.sourceforge.net For DataWarehouse workloads you could grab TPC-H or DBT3 implementation by OSDL - We run this successfully with MySQL You also could take a look at http://benchw.sourceforge.net/ From pgsql-performance-owner@postgresql.org Fri Dec 2 03:51:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 24AC59DCABF for ; Fri, 2 Dec 2005 03:51:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83274-02 for ; Fri, 2 Dec 2005 03:51:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 168AE9DCAA6 for ; Fri, 2 Dec 2005 03:48:35 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 9F6EF1AC3EB; Thu, 1 Dec 2005 23:47:35 -0800 (PST) Date: Thu, 1 Dec 2005 23:46:55 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: 15,000 tables In-Reply-To: <438FC3D2.8090202@modgraph-usa.com> Message-ID: References: <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> <20051118034631.GA70159@winnie.fuhr.org> <437F66CF.7080402@modgraph-usa.com> <20051119190304.GJ7330@mathom.us> <4380EEA2.4010002@modgraph-usa.com> <438FC3D2.8090202@modgraph-usa.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/56 X-Sequence-Number: 15877 On Thu, 1 Dec 2005, Craig A. James wrote: > So say I need 10,000 tables, but I can create tablespaces. Wouldn't that > solve the performance problem caused by Linux's (or ext2/3's) problems with > large directories? > > For example, if each user creates (say) 10 tables, and I have 1000 users, I > could create 100 tablespaces, and assign groups of 10 users to each > tablespace. This would limit each tablespace to 100 tables, and keep the > ext2/3 file-system directories manageable. > > Would this work? Would there be other problems? This would definantly help, however there's still the question of how large the tables get, and how many total files are needed to hold the 100 tables. you still have the problem of having to seek around to deal with all these different files (and tablespaces just spread them further apart), you can't solve this, but a large write-back journal (as opposed to metadata-only) would mask the problem. it would be a trade-off, you would end up writing all your data twice, so the throughput would be lower, but since the data is safe as soon as it hits the journal the latency for any one request would be lower, which would allow the system to use the CPU more and overlap it with your seeking. David Lang From pgsql-performance-owner@postgresql.org Fri Dec 2 03:54:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 167BC9DD6B6 for ; Fri, 2 Dec 2005 03:54:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82926-01 for ; Fri, 2 Dec 2005 03:53:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id DC1EB9DCABF for ; Fri, 2 Dec 2005 03:51:28 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 675C41AC3EC; Thu, 1 Dec 2005 23:50:28 -0800 (PST) Date: Thu, 1 Dec 2005 23:49:48 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: Steve Oualline , pgsql-performance@postgresql.org Subject: Re: Database restore speed In-Reply-To: <3E37B936B592014B978C4415F90D662D01C48EFF@MI8NYCMAIL06.Mi8.com> Message-ID: References: <3E37B936B592014B978C4415F90D662D01C48EFF@MI8NYCMAIL06.Mi8.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/57 X-Sequence-Number: 15878 On Fri, 2 Dec 2005, Luke Lonergan wrote: > Steve, > >> When we restore the postmaster process tries to use 100% of the CPU. >> >> The questions we have are: >> >> 1) What is postmaster doing that it needs so much CPU? > > Parsing mostly, and attribute conversion from text to DBMS native > formats. > >> 2) How can we get our system to go faster? > > Use Postgres 8.1 or Bizgres. Get a faster CPU. > > These two points are based on our work to improve COPY speed, which led > to a near doubling in Bizgres, and in the 8.1 version it's about 60-70% > faster than in Postgres 8.0. > > There are currently two main bottlenecks in COPY, one is parsing + > attribute conversion (if the postgres CPU is nailed at 100% that's what > your limit is) and the other is the write speed through the WAL. You > can roughly divide the write speed of your disk by 3 to get that limit, > e.g. if your disk can write 8k blocks at 100MB/s, then your COPY speed > might be limited to 33MB/s. You can tell which of these limits you've > hit using "vmstat 1" on Linux or iostat on Solaris and watch the blocks > input/output on your disk while you watch your CPU. Luke, would it help to have one machine read the file and have it connect to postgres on a different machine when doing the copy? (I'm thinking that the first machine may be able to do a lot of the parseing and conversion, leaving the second machine to just worry about doing the writes) David Lang From pgsql-performance-owner@postgresql.org Fri Dec 2 03:49:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A67919DD647 for ; Fri, 2 Dec 2005 03:49:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81495-01 for ; Fri, 2 Dec 2005 03:49:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cliff.cs.toronto.edu (cliff.cs.toronto.edu [128.100.3.120]) by postgresql.org (Postfix) with ESMTP id DE8859DD61B for ; Fri, 2 Dec 2005 03:49:53 -0400 (AST) Received: from eon.cs (eon.cs.toronto.edu [128.100.3.15]) by cliff.cs.toronto.edu (Postfix) with ESMTP id B4BD45FD08; Fri, 2 Dec 2005 02:49:52 -0500 (EST) Received: by eon.cs (Postfix, from userid 1300) id 2C074805; Fri, 2 Dec 2005 02:49:53 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by eon.cs (Postfix) with ESMTP id 22933583; Fri, 2 Dec 2005 02:49:53 -0500 (EST) Date: Fri, 2 Dec 2005 02:49:53 -0500 (EST) From: Qingqing Zhou X-X-Sender: zhouqq@eon.cs To: David Lang Cc: pgsql-performance@postgresql.org Subject: Re: filesystem performance with lots of files 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, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200512/55 X-Sequence-Number: 15876 On Fri, 2 Dec 2005, David Lang wrote: > > I don't have all the numbers readily available (and I didn't do all the > tests on every filesystem), but I found that even with only 1000 > files/directory ext3 had some problems, and if you enabled dir_hash some > functions would speed up, but writing lots of files would just collapse > (that was the 80 min run) > Interesting. I would suggest test small number but bigger file would be better if the target is for database performance comparison. By small number, I mean 10^2 - 10^3; By bigger, I mean file size from 8k to 1G (PostgreSQL data file is at most this size under normal installation). Let's take TPCC as an example, if we get a TPCC database of 500 files, each one is at most 1G (PostgreSQL has this feature/limit in ordinary installation), then this will give us a 500G database, which is big enough for your current configuration. Regards, Qingqing From pgsql-performance-owner@postgresql.org Fri Dec 2 04:06:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 986B49DCAA6 for ; Fri, 2 Dec 2005 04:06:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88776-06 for ; Fri, 2 Dec 2005 04:06:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 1F32D9DCABF for ; Fri, 2 Dec 2005 04:06:16 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 6F1D01AC3EB; Fri, 2 Dec 2005 00:05:16 -0800 (PST) Date: Fri, 2 Dec 2005 00:04:36 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Qingqing Zhou Cc: pgsql-performance@postgresql.org Subject: Re: filesystem performance with lots of files 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/58 X-Sequence-Number: 15879 On Fri, 2 Dec 2005, Qingqing Zhou wrote: >> >> I don't have all the numbers readily available (and I didn't do all the >> tests on every filesystem), but I found that even with only 1000 >> files/directory ext3 had some problems, and if you enabled dir_hash some >> functions would speed up, but writing lots of files would just collapse >> (that was the 80 min run) >> > > Interesting. I would suggest test small number but bigger file would be > better if the target is for database performance comparison. By small > number, I mean 10^2 - 10^3; By bigger, I mean file size from 8k to 1G > (PostgreSQL data file is at most this size under normal installation). I agree, that round of tests was done on my system at home, and was in response to a friend who had rsync over a local lan take > 10 hours for <10G of data. but even so it generated some interesting info. I need to make a more controlled run at it though. > Let's take TPCC as an example, if we get a TPCC database of 500 files, > each one is at most 1G (PostgreSQL has this feature/limit in ordinary > installation), then this will give us a 500G database, which is big enough > for your current configuration. > > Regards, > Qingqing > From pgsql-performance-owner@postgresql.org Fri Dec 2 04:07:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2BED9DD701 for ; Fri, 2 Dec 2005 04:07:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88062-02 for ; Fri, 2 Dec 2005 04:07:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id AB6C99DCB0D for ; Fri, 2 Dec 2005 04:06:57 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 02 Dec 2005 03:06:51 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 03:06:51 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Database restore speed Date: Fri, 2 Dec 2005 03:06:43 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01C48F01@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX3FQqRoL4+BrY0S7uEzRXy33ytPwAAW5og From: "Luke Lonergan" To: "David Lang" cc: "Steve Oualline" , pgsql-performance@postgresql.org X-OriginalArrivalTime: 02 Dec 2005 08:06:51.0782 (UTC) FILETIME=[5A18F260:01C5F717] X-WSS-ID: 6F8EDF114J84613220-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/59 X-Sequence-Number: 15880 David,=20 > Luke, would it help to have one machine read the file and=20 > have it connect to postgres on a different machine when doing=20 > the copy? (I'm thinking that the first machine may be able to=20 > do a lot of the parseing and conversion, leaving the second=20 > machine to just worry about doing the writes) Unfortunately not - the parsing / conversion core is in the backend, where it should be IMO because of the need to do the attribute conversion there in the machine-native representation of the attributes (int4, float, etc) in addition to having the backend convert from client encoding (like LATIN1) to the backend encoding (like UNICODE aka UTF8). There are a few areas of discussion about continued performance increases in the codebase for COPY FROM, here are my picks: - More micro-optimization of the parsing and att conversion core - maybe 100% speedup in the parse/convert stage is possible - A user selectable option to bypass transaction logging, similar to Oracle's - A well-defined binary input format, like Oracle's SQL*Loader - this would bypass most parsing / att conversion - A direct-to-table storage loader facility - this would probably be the fastest possible load rate - Luke From pgsql-performance-owner@postgresql.org Fri Dec 2 04:15:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E23E9DD715 for ; Fri, 2 Dec 2005 04:15:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91259-01 for ; Fri, 2 Dec 2005 04:15:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth08.mail.atl.earthlink.net (smtpauth08.mail.atl.earthlink.net [209.86.89.68]) by postgresql.org (Postfix) with ESMTP id D3AB09DD709 for ; Fri, 2 Dec 2005 04:15:13 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=qHUI9s1kNq+Qp7Ki1z1q6Uazs7vx33JsBIZ5NNo8A0GfwF/IeOC/SYxYsex38Yo7; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth08.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1Ei64U-0004cH-8j; Fri, 02 Dec 2005 03:15:10 -0500 Message-Id: <6.2.5.6.0.20051202030859.0360c1a8@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Fri, 02 Dec 2005 03:15:00 -0500 To: Tom Lane ,pgsql-performance@postgresql.org From: Ron Subject: Re: 15,000 tables In-Reply-To: <15739.1133463453@sss.pgh.pa.us> References: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> <1133462407.5734.43.camel@Andrea.peacock.de> <6.2.5.6.0.20051201134344.035fed60@earthlink.net> <15739.1133463453@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bce8deaa8ee841ac832be24e65178d8a57350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/60 X-Sequence-Number: 15881 Agreed, and I apologize for the imprecision of my post below. I should have written: "Best practice seems to be to use a journaling fs and log metadata only and put it on separate dedicated spindles." I've seen enough HD failures that I tend to be paranoid and log the metadata of fs dedicated to WAL as well, but that may very well be overkill. Ron At 01:57 PM 12/1/2005, Tom Lane wrote: >Ron writes: > > Agreed. Also the odds of fs corruption or data loss are higher in a > > non journaling fs. Best practice seems to be to use a journaling fs > > but to put the fs log on dedicated spindles separate from the actual > > fs or pg_xlog. > >I think we've determined that best practice is to journal metadata only >(not file contents) on PG data filesystems. PG does expect the filesystem >to remember where the files are, so you need metadata protection, but >journalling file content updates is redundant with PG's own WAL logging. > >On a filesystem dedicated to WAL, you probably do not need any >filesystem journalling at all --- we manage the WAL files in a way >that avoids changing metadata for a WAL file that's in active use. >A conservative approach would be to journal metadata here too, though. > > regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 2 09:02:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E3BE59DCAAE for ; Fri, 2 Dec 2005 09:02:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90820-02 for ; Fri, 2 Dec 2005 09:02:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by postgresql.org (Postfix) with ESMTP id 9D7BB9DCAA6 for ; Fri, 2 Dec 2005 09:02:23 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.54.76]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQV0035UG7TBON4@vms048.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 02 Dec 2005 07:02:25 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id B4D90600349; Fri, 02 Dec 2005 08:02:16 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23264-02; Fri, 02 Dec 2005 08:02:16 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 902826001C6; Fri, 02 Dec 2005 08:02:16 -0500 (EST) Date: Fri, 02 Dec 2005 08:02:16 -0500 From: Michael Stone Subject: Re: 15,000 tables In-reply-to: <6.2.5.6.0.20051202030859.0360c1a8@earthlink.net> To: Ron Cc: Tom Lane , pgsql-performance@postgresql.org Mail-followup-to: Ron , Tom Lane , pgsql-performance@postgresql.org Message-id: <20051202130216.GE7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <9A858930-1CA6-4238-92D4-D1E945683653@ehpg.net> <1133462407.5734.43.camel@Andrea.peacock.de> <6.2.5.6.0.20051201134344.035fed60@earthlink.net> <15739.1133463453@sss.pgh.pa.us> <6.2.5.6.0.20051202030859.0360c1a8@earthlink.net> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/61 X-Sequence-Number: 15882 On Fri, Dec 02, 2005 at 03:15:00AM -0500, Ron wrote: >I've seen enough HD failures that I tend to be paranoid and log the >metadata of fs dedicated to WAL as well, but that may very well be overkill. Especially since it wouldn't gain anything. Journalling doesn't give you any advantage whatsoever in the face of a HD failure. Mike Stone From pgsql-performance-owner@postgresql.org Fri Dec 2 09:04:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DF98B9DD449 for ; Fri, 2 Dec 2005 09:04:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92911-01 for ; Fri, 2 Dec 2005 09:04:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by postgresql.org (Postfix) with ESMTP id 42FFF9DCAA6 for ; Fri, 2 Dec 2005 09:04:14 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.54.76]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQV00M9MGB5QN1F@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 02 Dec 2005 07:04:17 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 324C6600349 for ; Fri, 02 Dec 2005 08:04:19 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23264-02-3 for ; Fri, 02 Dec 2005 08:04:19 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 198D860027B; Fri, 02 Dec 2005 08:04:19 -0500 (EST) Date: Fri, 02 Dec 2005 08:04:19 -0500 From: Michael Stone Subject: Re: COPY into table too slow with index: now an I/O In-reply-to: <3E37B936B592014B978C4415F90D662D01C48EFB@MI8NYCMAIL06.Mi8.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051202130419.GF7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <3E37B936B592014B978C4415F90D662D01C48EFB@MI8NYCMAIL06.Mi8.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/62 X-Sequence-Number: 15883 On Fri, Dec 02, 2005 at 12:15:57AM -0500, Luke Lonergan wrote: >That's good to know - makes sense. I suppose we might still thrash over >a 1GB range in seeks if the BG writer starts running at full rate in the >background, right? Or is there some write combining in the BG writer? That part your OS should be able to handle. Those writes aren't synced, so the OS has plenty of opportunity to buffer & aggregate them. Mike Stone From pgsql-performance-owner@postgresql.org Fri Dec 2 12:10:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3794A9DCAA6 for ; Fri, 2 Dec 2005 12:10:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85128-07 for ; Fri, 2 Dec 2005 12:10:34 -0400 (AST) X-Greylist: delayed 03:05:01.199044 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id DD22F9DD6CA for ; Fri, 2 Dec 2005 12:10:33 -0400 (AST) Received: from ganimedes.sync-intertainment.com (ganimedes.sync-intertainment.com [65.75.131.50]) by svr2.postgresql.org (Postfix) with ESMTP id 0A150F0B77 for ; Fri, 2 Dec 2005 13:05:37 +0000 (GMT) Received: from [212.31.63.6] (helo=[10.2.2.42]) by ganimedes.sync-intertainment.com with esmtpa (Exim 4.52) id 1EiAeA-0007nS-7M for pgsql-performance@postgresql.org; Fri, 02 Dec 2005 14:08:18 +0100 Message-ID: <43904696.1060002@teracat.com> Date: Fri, 02 Dec 2005 14:05:26 +0100 From: Teracat User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: ca MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Network permormance under windows Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ganimedes.sync-intertainment.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - teracat.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/66 X-Sequence-Number: 15887 Hello, We used Postgresql 7.1 under Linux and recently we have changed it to Postgresql 8.1 under Windows XP. Our application uses ODBC and when we try to get some information from the server throw a TCP connection, it's very slow. We have also tried it using psql and pgAdmin III, and we get the same results. If we try it locally, it runs much faster. We have been searching the mailing lists, we have found many people with the same problem, but we haven't found any final solution. How can we solve this? Any help will be appreciated. Thanks in advance. Jordi. From pgsql-performance-owner@postgresql.org Fri Dec 2 10:16:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A2C2D9DCAA6 for ; Fri, 2 Dec 2005 10:16:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19238-02 for ; Fri, 2 Dec 2005 10:16:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 4A1519DCD5F for ; Fri, 2 Dec 2005 10:16:26 -0400 (AST) Received: from smtp-out5.blueyonder.co.uk (smtp-out5.blueyonder.co.uk [195.188.213.8]) by svr2.postgresql.org (Postfix) with ESMTP id 41FB3F0B00 for ; Fri, 2 Dec 2005 14:16:29 +0000 (GMT) Received: from [192.168.1.10] ([82.40.182.219]) by smtp-out5.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.6713); Fri, 2 Dec 2005 14:17:20 +0000 In-Reply-To: <11360.1133453022@sss.pgh.pa.us> References: <11360.1133453022@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <57292C7A-8300-4CD4-BF1E-62190D36A549@advfn.com> Cc: Michael Riess , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: 15,000 tables Date: Fri, 2 Dec 2005 14:16:24 +0000 To: Tom Lane X-Mailer: Apple Mail (2.746.2) X-OriginalArrivalTime: 02 Dec 2005 14:17:20.0312 (UTC) FILETIME=[1B557380:01C5F74B] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/63 X-Sequence-Number: 15884 On 1 Dec 2005, at 16:03, Tom Lane wrote: > Michael Riess writes: >> (We NEED that many tables, please don't recommend to reduce them) > > No, you don't. Add an additional key column to fold together > different > tables of the same structure. This will be much more efficient than > managing that key at the filesystem level, which is what you're > effectively doing now. > > (If you really have 15000 distinct rowtypes, I'd like to know what > your database design is...) > Won't you end up with awful seek times if you just want data which previously been stored in a single table? E.g. whilst before you wanted 1000 contiguous rows from the table, now you want 1000 rows which now have 1000 rows you don't care about in between each one you do want. From pgsql-performance-owner@postgresql.org Fri Dec 2 10:20:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DE9D29DCD38 for ; Fri, 2 Dec 2005 10:20:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18302-03 for ; Fri, 2 Dec 2005 10:20:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 3DBEE9DCC9C for ; Fri, 2 Dec 2005 10:20:42 -0400 (AST) Received: from smtp-out5.blueyonder.co.uk (smtp-out5.blueyonder.co.uk [195.188.213.8]) by svr2.postgresql.org (Postfix) with ESMTP id 30E02F0B0A for ; Fri, 2 Dec 2005 14:20:45 +0000 (GMT) Received: from [192.168.1.10] ([82.40.182.219]) by smtp-out5.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.6713); Fri, 2 Dec 2005 14:21:37 +0000 In-Reply-To: <57292C7A-8300-4CD4-BF1E-62190D36A549@advfn.com> References: <11360.1133453022@sss.pgh.pa.us> <57292C7A-8300-4CD4-BF1E-62190D36A549@advfn.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Tom Lane , Michael Riess , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: 15,000 tables Date: Fri, 2 Dec 2005 14:20:41 +0000 To: Alex Stapleton X-Mailer: Apple Mail (2.746.2) X-OriginalArrivalTime: 02 Dec 2005 14:21:37.0812 (UTC) FILETIME=[B4D0D540:01C5F74B] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/64 X-Sequence-Number: 15885 On 2 Dec 2005, at 14:16, Alex Stapleton wrote: > > On 1 Dec 2005, at 16:03, Tom Lane wrote: > >> Michael Riess writes: >>> (We NEED that many tables, please don't recommend to reduce them) >> >> No, you don't. Add an additional key column to fold together >> different >> tables of the same structure. This will be much more efficient than >> managing that key at the filesystem level, which is what you're >> effectively doing now. >> >> (If you really have 15000 distinct rowtypes, I'd like to know what >> your database design is...) >> > > Won't you end up with awful seek times if you just want data which > previously been stored in a single table? E.g. whilst before you > wanted 1000 contiguous rows from the table, now you want 1000 rows > which now have 1000 rows you don't care about in between each one > you do want. > I must of had a total and utter failure of intellect for a moment there. Please ignore that :P From pgsql-performance-owner@postgresql.org Fri Dec 2 11:16:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C06CB9DD725 for ; Fri, 2 Dec 2005 11:16:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53021-05 for ; Fri, 2 Dec 2005 11:16:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp107.mail.sc5.yahoo.com (smtp107.mail.sc5.yahoo.com [66.163.169.227]) by postgresql.org (Postfix) with SMTP id 5A9009DCAB2 for ; Fri, 2 Dec 2005 11:16:32 -0400 (AST) Received: (qmail 95400 invoked from network); 2 Dec 2005 15:16:37 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=Yahoo.com; h=Received:Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=xouP/JROa9vAJdgBDQRT2/n6K3VYS7v8bhyl+psLnxCL6jS1FytrDcPjh9WsVsb+XHPSu3QDJ8w7TAdR1+jQ7rQUOaYdlg13yo9CGaNyoD+tiL7VuCChxYwUWi4G790U1vv7+nSqEcXVkxx4qtFqu42vMsuiEfj2eEpK3J/Vyr4= ; Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp107.mail.sc5.yahoo.com with SMTP; 2 Dec 2005 15:16:36 -0000 Received: from [172.21.8.23] (ismtp.afilias.com [216.217.55.254]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id jB2FGY1o096742; Fri, 2 Dec 2005 10:16:35 -0500 (EST) (envelope-from JanWieck@Yahoo.com) Message-ID: <4390654C.90805@Yahoo.com> Date: Fri, 02 Dec 2005 10:16:28 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Riess CC: pgsql-performance@postgresql.org Subject: Re: 15,000 tables References: <60psogzqui.fsf@dba2.int.libertyrms.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=4.18 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, RCVD_IN_NJABL_DUL=1.713, RCVD_IN_SORBS_DUL=1.988] X-Spam-Score: 4.18 X-Spam-Level: **** X-Archive-Number: 200512/65 X-Sequence-Number: 15886 On 12/1/2005 2:34 PM, Michael Riess wrote: >> VACUUM FULL was probably always overkill, unless "always" includes >> versions prior to 7.3... > > Well, we tried switching to daily VACUUM ANALYZE and weekly VACUUM FULL, > but the database got considerably slower near the end of the week. This indicates that you have FSM settings that are inadequate for that many tables and eventually the overall size of your database. Try setting those to max_fsm_relations = 80000 max_fsm_pages = (select sum(relpages) / 2 from pg_class) Another thing you might be suffering from (depending on the rest of your architecture) is file descriptor limits. Especially if you use some sort of connection pooling or persistent connections like PHP, you will have all the backends serving multiple of your logical applications (sets of 30 tables). If on average one backend is called for 50 different apps, then we are talking 50*30*4=6000 files accessed by that backend. 80/20 rule leaves 1200 files in access per backend, thus 100 active backends lead to 120,000 open (virtual) file descriptors. Now add to that any files that a backend would have to open in order to evict an arbitrary dirty block. With a large shared buffer pool and little more aggressive background writer settings, you can avoid mostly that regular backends would have to evict dirty blocks. If the kernel settings allow Postgres to keep that many file descriptors open, you avoid directory lookups. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Fri Dec 2 12:13:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 981209DD74A for ; Fri, 2 Dec 2005 12:13:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85397-06 for ; Fri, 2 Dec 2005 12:13:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id D2B7E9DD725 for ; Fri, 2 Dec 2005 12:13:52 -0400 (AST) Content-class: urn:content-classes:message Subject: Re: Network permormance under windows MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 2 Dec 2005 11:13:33 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD9EA@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Network permormance under windows thread-index: AcX3Wv/Gz70Oi9/STXW/M5dXGElj1gAADSlQ From: "Merlin Moncure" To: "Teracat" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/67 X-Sequence-Number: 15888 > We used Postgresql 7.1 under Linux and recently we have changed it to > Postgresql 8.1 under Windows XP. Our application uses ODBC and when we > try to get some information from the server throw a TCP connection, it's > very slow. We have also tried it using psql and pgAdmin III, and we get > the same results. If we try it locally, it runs much faster. >=20 > We have been searching the mailing lists, we have found many people with > the same problem, but we haven't found any final solution. >=20 > How can we solve this? Any help will be appreciated. >=20 > Thanks in advance. >=20 by any chance are you working with large tuples/columns (long text, bytea, etc)? Also please define slow. Merlin From pgsql-performance-owner@postgresql.org Fri Dec 2 12:28:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 279559DCC9C for ; Fri, 2 Dec 2005 12:28:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99611-03 for ; Fri, 2 Dec 2005 12:28:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 478B99DCAA6 for ; Fri, 2 Dec 2005 12:28:51 -0400 (AST) Content-class: urn:content-classes:message Subject: Re: pg_dump slow MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Fri, 2 Dec 2005 11:28:50 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD9EC@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] pg_dump slow thread-index: AcX3LIhfeHq22zH6TEKnrPpzgtfOhQAMKhRg From: "Merlin Moncure" To: "Franklin Haut" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/68 X-Sequence-Number: 15889 >=20 > That was the command used to restore a database >=20 > pg_restore.exe -i -h localhost -p 5432 -U postgres -d temp2 -v > "D:\d\temp.bkp" >=20 > The database was created before using LATIN1 charset >=20 > With 100 rows you can=B4t feel the test, then I decided send the whole > table. >=20 > Very Thanks >=20 > Franklin Haut How are you dumping out your archive? I confirmed unreasonably slow = dump with pg_dump -Z temp2 > temp2.bkp on windows 2000 server. I = normally use bzip to compress my dumps. Can you measure time to dump uncompressed and also with bzip and = compare? Merlin From pgsql-performance-owner@postgresql.org Fri Dec 2 12:33:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 66D149DD751 for ; Fri, 2 Dec 2005 12:33:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94403-06 for ; Fri, 2 Dec 2005 12:33:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id C06C89DD74B for ; Fri, 2 Dec 2005 12:33:19 -0400 (AST) Content-class: urn:content-classes:message Subject: Re: pg_dump slow MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 2 Dec 2005 11:33:18 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD9ED@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] pg_dump slow thread-index: AcX3LIhfeHq22zH6TEKnrPpzgtfOhQAMKhRgAAArBUA= From: "Merlin Moncure" To: "Franklin Haut" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/69 X-Sequence-Number: 15890 > How are you dumping out your archive? I confirmed unreasonably slow dump > with pg_dump -Z temp2 > temp2.bkp on windows 2000 server. I normally use > bzip to compress my dumps. >=20 > Can you measure time to dump uncompressed and also with bzip and compare? >=20 > Merlin oops...cancel that. I was dumping the wrong database. Dumping your table from localhost on a dual Opteron win2k server took a few seconds with Z=3D0 and Z=3D9. Merlin From pgsql-performance-owner@postgresql.org Fri Dec 2 13:18:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 724A79DCD5C for ; Fri, 2 Dec 2005 13:18:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17963-08 for ; Fri, 2 Dec 2005 13:18:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id A50979DCC9C for ; Fri, 2 Dec 2005 13:18:33 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 7684133692; Fri, 2 Dec 2005 18:18:33 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: Open request for benchmarking input (fwd) Date: Fri, 2 Dec 2005 12:19:25 -0500 Organization: Hub.Org Networking Services Lines: 12 Message-ID: References: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/70 X-Sequence-Number: 15891 "David Lang" wrote > here are the suggestions from the MySQL folks, what additional tests > should I do. > I think the tests you list are enough in this stage, Regards, Qingqing From pgsql-performance-owner@postgresql.org Fri Dec 2 15:31:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EB4FC9DD899 for ; Fri, 2 Dec 2005 15:31:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90029-03-4 for ; Fri, 2 Dec 2005 15:30:57 -0400 (AST) X-Greylist: delayed 02:06:02.991581 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id C3A329DD77C for ; Fri, 2 Dec 2005 15:30:41 -0400 (AST) Received: from alatxa.lapeixera.org (unknown [212.31.60.122]) by svr2.postgresql.org (Postfix) with ESMTP id 32756F0B83 for ; Fri, 2 Dec 2005 17:24:36 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by alatxa.lapeixera.org (Postfix) with ESMTP id 8F7A873CD5; Fri, 2 Dec 2005 18:22:41 +0100 (CET) Received: from alatxa.lapeixera.org ([127.0.0.1]) by localhost (alatxa [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02909-02; Fri, 2 Dec 2005 18:22:31 +0100 (CET) Received: from [10.2.2.28] (unknown [10.2.2.28]) by alatxa.lapeixera.org (Postfix) with ESMTP id 911FB73CD2; Fri, 2 Dec 2005 18:22:31 +0100 (CET) Message-ID: <43908337.5060605@endepro.com> Date: Fri, 02 Dec 2005 18:24:07 +0100 From: Josep Maria Pinyol Fontseca Organization: Endepro User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: ca MIME-Version: 1.0 Cc: pgsql-performance@postgresql.org, info@teracat.com Subject: Re: Network permormance under windows References: <6EE64EF3AB31D5448D0007DD34EEB3417DD9EA@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD9EA@Herge.rcsinc.local> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at lapeixera.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.189 required=5 tests=[MISSING_HEADERS=0.189] X-Spam-Score: 0.189 X-Spam-Level: X-Archive-Number: 200512/72 X-Sequence-Number: 15893 Dear Merlin, For instance, we have this table (with 22900 tuples): CREATE TABLE tbl_empresa ( id_empresa int4 NOT NULL DEFAULT nextval(('seq_empresa'::text)::regclass), ref_poblacio int4 NOT NULL, nom varchar(50) NOT NULL, nif varchar(12), carrer varchar(50), telefon varchar(13), fax varchar(13), email varchar(50), lab_materials int2 DEFAULT 0, web varchar(50), ref_empresa int4, ref_classificacio_empresa int4, ref_sector_empresa int4, control int2, origen_volcat int2, data_modificacio date, plantilla int4, tamany int2, autoritzacio_email int2, ref_estat_empresa int2, CONSTRAINT tbl_clients_pkey PRIMARY KEY (id_empresa), CONSTRAINT fk_tbl_empresa_ref_classificacio_emp FOREIGN KEY (ref_classificacio_empresa) REFERENCES tbl_classificacio_empresa (id_classificacio_empresa) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT fk_tbl_empresa_ref_empresa FOREIGN KEY (ref_empresa) REFERENCES tbl_empresa (id_empresa) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT fk_tbl_empresa_ref_estat_emp FOREIGN KEY (ref_estat_empresa) REFERENCES tbl_estat_empresa (id_estat_empresa) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT fk_tbl_empresa_ref_poblacio FOREIGN KEY (ref_poblacio) REFERENCES tbl_poblacions (id_poblacio) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT fk_tbl_empresa_ref_sector_emp FOREIGN KEY (ref_sector_empresa) REFERENCES tbl_sector_empresa (id_sector_empresa) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT ) WITH OIDS; When we select all data in local machine, we obtain results in 2-3 seconds aprox. In remote connections: Postgresql 7.1 usign pgAdminII: Network traffic generated with remote applications is about 77-80% in a 10Mb connection. 6 seconds aprox. Postgresql 8.1 usign pgAdminIII: Network traffic generated with remote applications is about 2-4% in a 10Mb connection. 12 seconds or more... I feel that is a problem with TCP_NODELAY of socket options... but I don't know. Josep Maria En/na Merlin Moncure ha escrit: >>We used Postgresql 7.1 under Linux and recently we have changed it to >>Postgresql 8.1 under Windows XP. Our application uses ODBC and when we >>try to get some information from the server throw a TCP connection, >> >> >it's > > >>very slow. We have also tried it using psql and pgAdmin III, and we >> >> >get > > >>the same results. If we try it locally, it runs much faster. >> >>We have been searching the mailing lists, we have found many people >> >> >with > > >>the same problem, but we haven't found any final solution. >> >>How can we solve this? Any help will be appreciated. >> >>Thanks in advance. >> >> >> >by any chance are you working with large tuples/columns (long text, >bytea, etc)? > >Also please define slow. > >Merlin > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster > > -- Josep Maria Pinyol i Fontseca Responsable �rea de programaci� ENDEPRO - Enginyeria de programari Passeig Anselm Clav�, 19 Bx. 08263 Call�s (Barcelona) Tel. +34 936930018 - Mob. +34 600310755 - Fax. +34 938361994 jmpinyol@endepro.com - http://www.endepro.com Aquest missatge i els documents en el seu cas adjunts, es dirigeixen exclusivament al seu destinatari i poden contenir informaci� reservada i/o CONFIDENCIAL, us del qual no est� autoritzat ni la divulgaci� del mateix, prohibit per la legislaci� vigent (Llei 32/2002 SSI-CE). Si ha rebut aquest missatge per error, li demanem que ens ho comuniqui immediatament per la mateixa via o b� per tel�fon (+34936930018) i procedeixi a la seva destrucci�. Aquest e-mail no podr� considerar-se SPAM. Este mensaje, y los documentos en su caso anexos, se dirigen exclusivamente a su destinatario y pueden contener informaci�n reservada y/o CONFIDENCIAL cuyo uso no autorizado o divulgaci�n est� prohibida por la legislaci�n vigente (Ley 32/2002 SSI-CE). Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma v�a o por tel�fono (+34936930018) y proceda a su destrucci�n. Este e-mail no podr� considerarse SPAM. This message and the enclosed documents are directed exclusively to its receiver and can contain reserved and/or confidential information, from which use isn�t allowed its divulgation, forbidden by the current legislation (Law 32/2002 SSI-CE). If you have received this message by mistake, we kindly ask you to communicate it to us right away by the same way or by phone (+34936930018) and destruct it. This e-mail can�t be considered as SPAM. From pgsql-performance-owner@postgresql.org Fri Dec 2 15:00:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6ABFB9DD767 for ; Fri, 2 Dec 2005 15:00:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78144-08 for ; Fri, 2 Dec 2005 15:00:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (unknown [216.148.227.153]) by postgresql.org (Postfix) with ESMTP id 576B09DD764 for ; Fri, 2 Dec 2005 15:00:03 -0400 (AST) Received: from dell8200 (pcp09613107pcs.rte20201.de.comcast.net[68.82.197.68]) by comcast.net (rwcrmhc13) with SMTP id <2005120218581801500ih0eme>; Fri, 2 Dec 2005 18:58:18 +0000 From: "Rick Schumeyer" To: Subject: two disks - best way to use them? Date: Fri, 2 Dec 2005 13:58:13 -0500 Message-ID: <00fb01c5f772$59471410$0200a8c0@dell8200> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00FC_01C5F748.70710C10" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/71 X-Sequence-Number: 15892 This is a multi-part message in MIME format. ------=_NextPart_000_00FC_01C5F748.70710C10 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit I installed another drive in my linux pc in an attempt to improve performance on a large COPY to a table with a geometry index. Based on previous discussion, it seems there are three things competing for the hard drive: 1) the input data file 2) the pg table 3) the WAL What is the best way to distribute these among two drives? From Tom's comments I would think that the pg table and the WAL should be separate. Does it matter where the input data is? ------=_NextPart_000_00FC_01C5F748.70710C10 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

I installed another drive in my linux pc in an = attempt to improve performance

on a large COPY to a table with a geometry = index.

 

Based on previous discussion, it seems there are = three things competing for the hard

drive:

 

1)       the input data file

2)       the pg table

3)       the WAL

 

What is the best way to distribute these among two drives?  From Tom’s comments

I would think that the pg table and the WAL should be separate.  Does it matter where

the input data is?

------=_NextPart_000_00FC_01C5F748.70710C10-- From pgsql-performance-owner@postgresql.org Fri Dec 2 16:05:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 440A29DD765 for ; Fri, 2 Dec 2005 16:05:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95894-09 for ; Fri, 2 Dec 2005 16:05:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth04.mail.atl.earthlink.net (smtpauth04.mail.atl.earthlink.net [209.86.89.64]) by postgresql.org (Postfix) with ESMTP id DEC5C9DD77F for ; Fri, 2 Dec 2005 16:05:37 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=WDLSTU7dSkOICGgkdtOTfSHzTtBvypThREbdEzqZCY9uGyJ6PdcOBZ12A9RHuyW+; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth04.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EiH9z-0001Pk-VR; Fri, 02 Dec 2005 15:05:36 -0500 Message-Id: <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Fri, 02 Dec 2005 15:05:30 -0500 To: "Rick Schumeyer" , From: Ron Subject: Re: two disks - best way to use them? In-Reply-To: <00fb01c5f772$59471410$0200a8c0@dell8200> References: <00fb01c5f772$59471410$0200a8c0@dell8200> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcee13dc2d195dd178d1eb730f29fbc904350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.279 required=5 tests=[AWL=-0.200, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.279 X-Spam-Level: X-Archive-Number: 200512/73 X-Sequence-Number: 15894 At 01:58 PM 12/2/2005, Rick Schumeyer wrote: >I installed another drive in my linux pc in an attempt to improve performance >on a large COPY to a table with a geometry index. > >Based on previous discussion, it seems there are three things >competing for the hard drive: > >1) the input data file >2) the pg table >3) the WAL > >What is the best way to distribute these among two drives? From >Tom's comments >I would think that the pg table and the WAL should be >separate. Does it matter where the input data is? Best is to have 3 HD or HD sets, one for each of the above. With only 2, and assuming the input file is too large to fit completely into RAM at once, I'd test to see whether: a= input on one + pg table & WAL on the other, or b= WAL on one + pg table & input file on the other is best. If the input file can be made 100% RAM resident, then use c= pg table on one + WAL and input file on the other. The big goal here is to minimize HD head seeks. Ron From pgsql-performance-owner@postgresql.org Fri Dec 2 16:18:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 590B59DD767 for ; Fri, 2 Dec 2005 16:18:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07367-09 for ; Fri, 2 Dec 2005 16:18:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id AC6379DD765 for ; Fri, 2 Dec 2005 16:18:06 -0400 (AST) Received: from ns.snowman.net (ns.snowman.net [66.92.160.21]) by svr2.postgresql.org (Postfix) with ESMTP id 05BDCF0B1C for ; Fri, 2 Dec 2005 20:18:07 +0000 (GMT) Received: by ns.snowman.net (Postfix, from userid 1000) id A3F5117ADF; Fri, 2 Dec 2005 15:18:47 -0500 (EST) Date: Fri, 2 Dec 2005 15:18:47 -0500 From: Stephen Frost To: Luke Lonergan Cc: David Lang , Steve Oualline , pgsql-performance@postgresql.org Subject: Re: Database restore speed Message-ID: <20051202201847.GE6026@ns.snowman.net> Mail-Followup-To: Luke Lonergan , David Lang , Steve Oualline , pgsql-performance@postgresql.org References: <3E37B936B592014B978C4415F90D662D01C48F01@MI8NYCMAIL06.Mi8.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IWoBo/ZLzY7SPqkS" Content-Disposition: inline In-Reply-To: <3E37B936B592014B978C4415F90D662D01C48F01@MI8NYCMAIL06.Mi8.com> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/2.4.24ns.3.0 (i686) X-Uptime: 15:16:23 up 174 days, 12:28, 8 users, load average: 0.05, 0.16, 0.12 User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/74 X-Sequence-Number: 15895 --IWoBo/ZLzY7SPqkS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Luke Lonergan (LLonergan@greenplum.com) wrote: > > Luke, would it help to have one machine read the file and=20 > > have it connect to postgres on a different machine when doing=20 > > the copy? (I'm thinking that the first machine may be able to=20 > > do a lot of the parseing and conversion, leaving the second=20 > > machine to just worry about doing the writes) >=20 > Unfortunately not - the parsing / conversion core is in the backend, > where it should be IMO because of the need to do the attribute > conversion there in the machine-native representation of the attributes > (int4, float, etc) in addition to having the backend convert from client > encoding (like LATIN1) to the backend encoding (like UNICODE aka UTF8). Just a thought, but couldn't psql be made to use the binary mode of libpq and do at least some of the conversion on the client side? Or does binary mode not work with copy (that wouldn't suprise me, but perhaps copy could be made to support it)? The other thought, of course, is that you could use PITR for your backups instead of pgdump... Thanks, Stephen --IWoBo/ZLzY7SPqkS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFDkKwnrzgMPqB3kigRAl/AAJ41ewZ4NAWfthI0h/4XvxJc9Sc5ngCfZCyV qvIuwO7f4QS/pR09NHdIyMs= =xGeK -----END PGP SIGNATURE----- --IWoBo/ZLzY7SPqkS-- From pgsql-performance-owner@postgresql.org Fri Dec 2 16:27:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7CB559DD77D for ; Fri, 2 Dec 2005 16:27:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04579-10 for ; Fri, 2 Dec 2005 16:27:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.refusion.com (mail.refusion.com [213.144.155.20]) by postgresql.org (Postfix) with ESMTP id 6FE969DD765 for ; Fri, 2 Dec 2005 16:27:08 -0400 (AST) Received: from iwing by mail.refusion.com (MDaemon.PRO.v8.1.0.R) with ESMTP id md50000412313.msg for ; Fri, 02 Dec 2005 21:27:08 +0100 Message-ID: <0b0b01c5f77e$b9d6f6e0$0201a8c0@iwing> From: To: "Josep Maria Pinyol Fontseca" Cc: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD9EA@Herge.rcsinc.local> <43908337.5060605@endepro.com> Subject: Re: Network permormance under windows Date: Fri, 2 Dec 2005 21:26:49 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=response Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.1830 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830 X-Authenticated-Sender: info@alternize.com X-Spam-Processed: mail.refusion.com, Fri, 02 Dec 2005 21:27:08 +0100 (not processed: message from trusted or authenticated source) X-MDRemoteIP: 80.238.204.232 X-Return-Path: me@alternize.com X-MDaemon-Deliver-To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.98 required=5 tests=[AWL=-0.443, DNS_FROM_RFC_DSN=2.872, NO_REAL_NAME=0.55, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 2.98 X-Spam-Level: ** X-Archive-Number: 200512/75 X-Sequence-Number: 15896 we experienced the same. had 2 win2003 servers - www and db connected to the same router through 100mbit. the performance was quite bad. now we run the db on the same machine as the web and everything runs smooth. cheers, thomas ----- Original Message ----- From: "Josep Maria Pinyol Fontseca" Cc: ; Sent: Friday, December 02, 2005 6:24 PM Subject: Re: [PERFORM] Network permormance under windows > > Dear Merlin, > > For instance, we have this table (with 22900 tuples): > > CREATE TABLE tbl_empresa > ( > id_empresa int4 NOT NULL DEFAULT nextval(('seq_empresa'::text)::regclass), > ref_poblacio int4 NOT NULL, > nom varchar(50) NOT NULL, > nif varchar(12), > carrer varchar(50), > telefon varchar(13), > fax varchar(13), > email varchar(50), > lab_materials int2 DEFAULT 0, > web varchar(50), > ref_empresa int4, > ref_classificacio_empresa int4, > ref_sector_empresa int4, > control int2, > origen_volcat int2, > data_modificacio date, > plantilla int4, > tamany int2, > autoritzacio_email int2, > ref_estat_empresa int2, > CONSTRAINT tbl_clients_pkey PRIMARY KEY (id_empresa), > CONSTRAINT fk_tbl_empresa_ref_classificacio_emp FOREIGN KEY > (ref_classificacio_empresa) > REFERENCES tbl_classificacio_empresa (id_classificacio_empresa) MATCH > SIMPLE > ON UPDATE RESTRICT ON DELETE RESTRICT, > CONSTRAINT fk_tbl_empresa_ref_empresa FOREIGN KEY (ref_empresa) > REFERENCES tbl_empresa (id_empresa) MATCH SIMPLE > ON UPDATE RESTRICT ON DELETE RESTRICT, > CONSTRAINT fk_tbl_empresa_ref_estat_emp FOREIGN KEY (ref_estat_empresa) > REFERENCES tbl_estat_empresa (id_estat_empresa) MATCH SIMPLE > ON UPDATE RESTRICT ON DELETE RESTRICT, > CONSTRAINT fk_tbl_empresa_ref_poblacio FOREIGN KEY (ref_poblacio) > REFERENCES tbl_poblacions (id_poblacio) MATCH SIMPLE > ON UPDATE RESTRICT ON DELETE RESTRICT, > CONSTRAINT fk_tbl_empresa_ref_sector_emp FOREIGN KEY (ref_sector_empresa) > REFERENCES tbl_sector_empresa (id_sector_empresa) MATCH SIMPLE > ON UPDATE RESTRICT ON DELETE RESTRICT > ) > WITH OIDS; > > When we select all data in local machine, we obtain results in 2-3 seconds > aprox. In remote connections: > > Postgresql 7.1 usign pgAdminII: > Network traffic generated with remote applications is about 77-80% in a > 10Mb connection. > 6 seconds aprox. > > Postgresql 8.1 usign pgAdminIII: > Network traffic generated with remote applications is about 2-4% in a 10Mb > connection. > 12 seconds or more... > > I feel that is a problem with TCP_NODELAY of socket options... but I don't > know. > > Josep Maria > > > En/na Merlin Moncure ha escrit: > >>>We used Postgresql 7.1 under Linux and recently we have changed it to >>>Postgresql 8.1 under Windows XP. Our application uses ODBC and when we >>>try to get some information from the server throw a TCP connection, >>> >>it's >> >>>very slow. We have also tried it using psql and pgAdmin III, and we >>> >>get >> >>>the same results. If we try it locally, it runs much faster. >>> >>>We have been searching the mailing lists, we have found many people >>> >>with >> >>>the same problem, but we haven't found any final solution. >>> >>>How can we solve this? Any help will be appreciated. >>> >>>Thanks in advance. >>> >>> >>by any chance are you working with large tuples/columns (long text, >>bytea, etc)? >> >>Also please define slow. >> >>Merlin >> >>---------------------------(end of broadcast)--------------------------- >>TIP 2: Don't 'kill -9' the postmaster >> > > > -- > > Josep Maria Pinyol i Fontseca > Responsable �rea de programaci� > > ENDEPRO - Enginyeria de programari > Passeig Anselm Clav�, 19 Bx. 08263 Call�s (Barcelona) > Tel. +34 936930018 - Mob. +34 600310755 - Fax. +34 938361994 > jmpinyol@endepro.com - http://www.endepro.com > > > Aquest missatge i els documents en el seu cas adjunts, es dirigeixen > exclusivament al seu destinatari i poden contenir informaci� reservada i/o > CONFIDENCIAL, us del qual no est� autoritzat ni la divulgaci� del mateix, > prohibit per la legislaci� vigent (Llei 32/2002 SSI-CE). Si ha rebut > aquest missatge per error, li demanem que ens ho comuniqui immediatament > per la mateixa via o b� per tel�fon (+34936930018) i procedeixi a la seva > destrucci�. Aquest e-mail no podr� considerar-se SPAM. > > Este mensaje, y los documentos en su caso anexos, se dirigen > exclusivamente a su destinatario y pueden contener informaci�n reservada > y/o CONFIDENCIAL cuyo uso no autorizado o divulgaci�n est� prohibida por > la legislaci�n vigente (Ley 32/2002 SSI-CE). Si ha recibido este mensaje > por error, le rogamos que nos lo comunique inmediatamente por esta misma > v�a o por tel�fono (+34936930018) y proceda a su destrucci�n. Este e-mail > no podr� considerarse SPAM. > > This message and the enclosed documents are directed exclusively to its > receiver and can contain reserved and/or confidential information, from > which use isn�t allowed its divulgation, forbidden by the current > legislation (Law 32/2002 SSI-CE). If you have received this message by > mistake, we kindly ask you to communicate it to us right away by the same > way or by phone (+34936930018) and destruct it. This e-mail can�t be > considered as SPAM. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Fri Dec 2 16:43:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 678A79DD56C for ; Fri, 2 Dec 2005 16:43:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18033-04 for ; Fri, 2 Dec 2005 16:42:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 1E91F9DCD42 for ; Fri, 2 Dec 2005 16:43:00 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6946B33691; Fri, 2 Dec 2005 21:43:01 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: Network permormance under windows Date: Fri, 2 Dec 2005 15:43:34 -0500 Organization: Hub.Org Networking Services Lines: 24 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD9EA@Herge.rcsinc.local> <43908337.5060605@endepro.com> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/76 X-Sequence-Number: 15897 "Josep Maria Pinyol Fontseca" wrote > > When we select all data in local machine, we obtain results in 2-3 seconds > aprox. In remote connections: > > Postgresql 7.1 usign pgAdminII: > Network traffic generated with remote applications is about 77-80% in a > 10Mb connection. > 6 seconds aprox. > > Postgresql 8.1 usign pgAdminIII: > Network traffic generated with remote applications is about 2-4% in a 10Mb > connection. > 12 seconds or more... > Have you tried to use psql? And how you "select all data" - by "select count(*)" or "select *"? Regards, Qingqing From pgsql-performance-owner@postgresql.org Fri Dec 2 16:48:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F224A9DD785 for ; Fri, 2 Dec 2005 16:48:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20717-02 for ; Fri, 2 Dec 2005 16:48:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id 918AC9DD787 for ; Fri, 2 Dec 2005 16:48:28 -0400 (AST) Received: from 172.16.1.24 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 02 Dec 2005 15:48:18 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 15:48:11 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 2 Dec 2005 20:48:10 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 02 Dec 2005 12:48:08 -0800 Subject: Re: Database restore speed From: "Luke Lonergan" To: "Stephen Frost" cc: "David Lang" , "Steve Oualline" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX3fY1vB7inoWv+QBO0SMp+aneqZQABCXP+ In-Reply-To: <20051202201847.GE6026@ns.snowman.net> MIME-Version: 1.0 X-OriginalArrivalTime: 02 Dec 2005 20:48:11.0012 (UTC) FILETIME=[B50A4C40:01C5F781] X-WSS-ID: 6F8E6C8F4PK229376-05-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/77 X-Sequence-Number: 15898 Stephen, On 12/2/05 12:18 PM, "Stephen Frost" wrote: > Just a thought, but couldn't psql be made to use the binary mode of > libpq and do at least some of the conversion on the client side? Or > does binary mode not work with copy (that wouldn't suprise me, but > perhaps copy could be made to support it)? Yes - I think this idea is implicit in what David suggested, and my response as well. The problem is that the way the client does conversions can potentially differ from the way the backend does. Some of the types in Postgres are machine intrinsic and the encoding conversions use on-machine libraries, each of which preclude the use of client conversion methods (without a lot of restructuring). We'd tackled this problem in the past and concluded that the parse / convert stage really belongs in the backend. > The other thought, of course, is that you could use PITR for your > backups instead of pgdump... Totally - great idea, if this is actually a backup / restore then PITR plus filesystem copy (tarball) is hugely faster than dump / restore. - Luke From pgsql-performance-owner@postgresql.org Fri Dec 2 17:08:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 230689DCC8F for ; Fri, 2 Dec 2005 17:08:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23866-08 for ; Fri, 2 Dec 2005 17:07:58 -0400 (AST) X-Greylist: delayed 03:43:23.230408 by SQLgrey- Received: from alatxa.lapeixera.org (unknown [212.31.60.122]) by postgresql.org (Postfix) with ESMTP id DB28F9DCAE2 for ; Fri, 2 Dec 2005 17:07:58 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by alatxa.lapeixera.org (Postfix) with ESMTP id 3935973CD5; Fri, 2 Dec 2005 22:06:16 +0100 (CET) Received: from alatxa.lapeixera.org ([127.0.0.1]) by localhost (alatxa [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04403-03; Fri, 2 Dec 2005 22:06:06 +0100 (CET) Received: from [192.168.1.12] (188.Red-81-35-125.dynamicIP.rima-tde.net [81.35.125.188]) by alatxa.lapeixera.org (Postfix) with ESMTP id AEA3773CD2; Fri, 2 Dec 2005 22:06:05 +0100 (CET) Message-ID: <4390B7CB.2030402@endepro.com> Date: Fri, 02 Dec 2005 22:08:27 +0100 From: Josep Maria Pinyol Fontseca Organization: ENDEPRO User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Qingqing Zhou Cc: pgsql-performance@postgresql.org Subject: Re: Network permormance under windows References: <6EE64EF3AB31D5448D0007DD34EEB3417DD9EA@Herge.rcsinc.local> <43908337.5060605@endepro.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at lapeixera.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/78 X-Sequence-Number: 15899 Yes, with psql, pgAdminIII and our application with ODBC I experiment the same situation... the sentences that I execute are like "select * ..." or similar like this. Qingqing Zhou wrote: >"Josep Maria Pinyol Fontseca" wrote > > >>When we select all data in local machine, we obtain results in 2-3 seconds >>aprox. In remote connections: >> >>Postgresql 7.1 usign pgAdminII: >>Network traffic generated with remote applications is about 77-80% in a >>10Mb connection. >>6 seconds aprox. >> >>Postgresql 8.1 usign pgAdminIII: >>Network traffic generated with remote applications is about 2-4% in a 10Mb >>connection. >>12 seconds or more... >> >> >> > >Have you tried to use psql? And how you "select all data" - by "select >count(*)" or "select *"? > >Regards, >Qingqing > > > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster > > -- Josep Maria Pinyol i Fontseca Responsable �rea de programaci� ENDEPRO - Enginyeria de programari Passeig Anselm Clav�, 19 Bx. 08263 Call�s (Barcelona) Tel. +34 936930018 - Mob. +34 600310755 - Fax. +34 938361994 jmpinyol@endepro.com - http://www.endepro.com Aquest missatge i els documents en el seu cas adjunts, es dirigeixen exclusivament al seu destinatari i poden contenir informaci� reservada i/o CONFIDENCIAL, us del qual no est� autoritzat ni la divulgaci� del mateix, prohibit per la legislaci� vigent (Llei 32/2002 SSI-CE). Si ha rebut aquest missatge per error, li demanem que ens ho comuniqui immediatament per la mateixa via o b� per tel�fon (+34936930018) i procedeixi a la seva destrucci�. Aquest e-mail no podr� considerar-se SPAM. Este mensaje, y los documentos en su caso anexos, se dirigen exclusivamente a su destinatario y pueden contener informaci�n reservada y/o CONFIDENCIAL cuyo uso no autorizado o divulgaci�n est� prohibida por la legislaci�n vigente (Ley 32/2002 SSI-CE). Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma v�a o por tel�fono (+34936930018) y proceda a su destrucci�n. Este e-mail no podr� considerarse SPAM. This message and the enclosed documents are directed exclusively to its receiver and can contain reserved and/or confidential information, from which use isn�t allowed its divulgation, forbidden by the current legislation (Law 32/2002 SSI-CE). If you have received this message by mistake, we kindly ask you to communicate it to us right away by the same way or by phone (+34936930018) and destruct it. This e-mail can�t be considered as SPAM. From pgsql-performance-owner@postgresql.org Fri Dec 2 17:09:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7759C9DD56C for ; Fri, 2 Dec 2005 17:09:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25366-06 for ; Fri, 2 Dec 2005 17:08:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp100.rog.mail.re2.yahoo.com (smtp100.rog.mail.re2.yahoo.com [206.190.36.78]) by postgresql.org (Postfix) with SMTP id 93FF69DCF92 for ; Fri, 2 Dec 2005 17:08:59 -0400 (AST) Received: (qmail 89309 invoked from network); 2 Dec 2005 21:08:57 -0000 Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@209.222.54.227 with login) by smtp100.rog.mail.re2.yahoo.com with SMTP; 2 Dec 2005 21:08:57 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 3A77340B6; Fri, 2 Dec 2005 16:08:56 -0500 (EST) Date: Fri, 2 Dec 2005 16:08:56 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: 15,000 tables Message-ID: <20051202210856.GA7135@phlogiston.dyndns.org> References: <60psogzqui.fsf@dba2.int.libertyrms.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/79 X-Sequence-Number: 15900 On Thu, Dec 01, 2005 at 08:34:43PM +0100, Michael Riess wrote: > Well, we tried switching to daily VACUUM ANALYZE and weekly VACUUM FULL, > but the database got considerably slower near the end of the week. If you have your FSM configured correctly and you are vacuuming tables often enough for your turnover, than in regular operation you should _never_ need VACUUM FULL. So it sounds like your first problem is that. With the 15000 tables you were talking about, though, that doesn't surprise me. Are you sure more back ends wouldn't be a better answer, if you're really wedded to this design? (I have a feeling that something along the lines of what Tom Lane said would be a better answer -- I think you need to be more clever, because I don't think this will ever work well, on any system.) A -- Andrew Sullivan | ajs@crankycanuck.ca This work was visionary and imaginative, and goes to show that visionary and imaginative work need not end up well. --Dennis Ritchie From pgsql-performance-owner@postgresql.org Fri Dec 2 17:18:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D37DD9DD787 for ; Fri, 2 Dec 2005 17:18:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24007-10 for ; Fri, 2 Dec 2005 17:18:40 -0400 (AST) X-Greylist: delayed 01:00:36.598813 by SQLgrey- Received: from ns.snowman.net (ns.snowman.net [66.92.160.21]) by postgresql.org (Postfix) with ESMTP id 5EC079DD784 for ; Fri, 2 Dec 2005 17:18:41 -0400 (AST) Received: by ns.snowman.net (Postfix, from userid 1000) id 8978717AD3; Fri, 2 Dec 2005 16:19:25 -0500 (EST) Date: Fri, 2 Dec 2005 16:19:25 -0500 From: Stephen Frost To: Luke Lonergan Cc: David Lang , Steve Oualline , pgsql-performance@postgresql.org Subject: Re: Database restore speed Message-ID: <20051202211925.GF6026@ns.snowman.net> Mail-Followup-To: Luke Lonergan , David Lang , Steve Oualline , pgsql-performance@postgresql.org References: <20051202201847.GE6026@ns.snowman.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/UZYnPkX7MOZI66P" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/2.4.24ns.3.0 (i686) X-Uptime: 16:13:59 up 174 days, 13:26, 8 users, load average: 0.19, 0.15, 0.10 User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/80 X-Sequence-Number: 15901 --/UZYnPkX7MOZI66P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Luke Lonergan (llonergan@greenplum.com) wrote: > On 12/2/05 12:18 PM, "Stephen Frost" wrote: > > Just a thought, but couldn't psql be made to use the binary mode of > > libpq and do at least some of the conversion on the client side? Or > > does binary mode not work with copy (that wouldn't suprise me, but > > perhaps copy could be made to support it)? >=20 > Yes - I think this idea is implicit in what David suggested, and my respo= nse > as well. The problem is that the way the client does conversions can > potentially differ from the way the backend does. Some of the types in > Postgres are machine intrinsic and the encoding conversions use on-machine > libraries, each of which preclude the use of client conversion methods > (without a lot of restructuring). We'd tackled this problem in the past = and > concluded that the parse / convert stage really belongs in the backend. I've used the binary mode stuff before, sure, Postgres may have to convert some things but I have a hard time believing it'd be more expensive to do a network_encoding -> host_encoding (or toasting, or whatever) than to do the ascii -> binary change. Thanks, Stephen --/UZYnPkX7MOZI66P Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFDkLpdrzgMPqB3kigRAhQNAKCPzO2l/MJNlrzXtlsW+vYU6Y7ZGACePIuF 50XkDsbVloZ+JQgFHOrIbLI= =Hf7Z -----END PGP SIGNATURE----- --/UZYnPkX7MOZI66P-- From pgsql-performance-owner@postgresql.org Fri Dec 2 17:25:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 40B189DCCA8 for ; Fri, 2 Dec 2005 17:25:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29583-08 for ; Fri, 2 Dec 2005 17:25:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id 96EF19DCC8F for ; Fri, 2 Dec 2005 17:25:30 -0400 (AST) Received: from 172.16.1.25 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 02 Dec 2005 16:25:28 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 16:24:33 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 2 Dec 2005 21:24:32 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 02 Dec 2005 13:24:31 -0800 Subject: Re: Database restore speed From: "Luke Lonergan" To: "Stephen Frost" cc: "David Lang" , "Steve Oualline" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX3hgX4DADgfrd4RAWuo4H4HBe4FgAAMJyI In-Reply-To: <20051202211925.GF6026@ns.snowman.net> MIME-Version: 1.0 X-OriginalArrivalTime: 02 Dec 2005 21:24:33.0671 (UTC) FILETIME=[CA01A170:01C5F786] X-WSS-ID: 6F8E644D4J85194454-05-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=-0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/81 X-Sequence-Number: 15902 Stephen, On 12/2/05 1:19 PM, "Stephen Frost" wrote: > I've used the binary mode stuff before, sure, Postgres may have to > convert some things but I have a hard time believing it'd be more > expensive to do a network_encoding -> host_encoding (or toasting, or > whatever) than to do the ascii -> binary change. From a performance standpoint no argument, although you're betting that you can do parsing / conversion faster than the COPY core in the backend can (I know *we* can :-). It's a matter of safety and generality - in general you can't be sure that client machines / OS'es will render the same conversions that the backend does in all cases IMO. - Luke From pgsql-performance-owner@postgresql.org Fri Dec 2 17:30:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 06C3C9DD77F for ; Fri, 2 Dec 2005 17:30:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39570-02 for ; Fri, 2 Dec 2005 17:30:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by postgresql.org (Postfix) with ESMTP id 393B09DD765 for ; Fri, 2 Dec 2005 17:30:14 -0400 (AST) Received: from 172.16.1.148 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Fri, 02 Dec 2005 16:30:08 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 16:29:50 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 2 Dec 2005 21:29:49 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 02 Dec 2005 13:29:47 -0800 Subject: Re: Database restore speed From: "Luke Lonergan" To: "Stephen Frost" cc: "David Lang" , "Steve Oualline" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX3hgX4DADgfrd4RAWuo4H4HBe4FgAAMJyIAAAvFrE= In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 02 Dec 2005 21:29:50.0042 (UTC) FILETIME=[869403A0:01C5F787] X-WSS-ID: 6F8E636A19O8760733-07-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=-0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/82 X-Sequence-Number: 15903 Stephen, On 12/2/05 1:19 PM, "Stephen Frost" wrote: > >> I've used the binary mode stuff before, sure, Postgres may have to >> convert some things but I have a hard time believing it'd be more >> expensive to do a network_encoding -> host_encoding (or toasting, or >> whatever) than to do the ascii -> binary change. > > From a performance standpoint no argument, although you're betting that you > can do parsing / conversion faster than the COPY core in the backend can (I > know *we* can :-). It's a matter of safety and generality - in general you > can't be sure that client machines / OS'es will render the same conversions > that the backend does in all cases IMO. One more thing - this is really about the lack of a cross-platform binary input standard for Postgres IMO. If there were such a thing, it *would* be safe to do this. The current Binary spec is not cross-platform AFAICS, it embeds native representations of the DATUMs, and does not specify a universal binary representation of same. For instance - when representing a float, is it an IEEE 32-bit floating point number in little endian byte ordering? Or is it IEEE 64-bit? With libpq, we could do something like an XDR implementation, but the machinery isn't there AFAICS. - Luke From pgsql-performance-owner@postgresql.org Fri Dec 2 17:46:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1B70C9DCC8F for ; Fri, 2 Dec 2005 17:46:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38382-04 for ; Fri, 2 Dec 2005 17:46:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by postgresql.org (Postfix) with ESMTP id B67499DCAE2 for ; Fri, 2 Dec 2005 17:46:07 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.54.76]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQW00AXS4GO6IR0@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 02 Dec 2005 15:46:02 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 5C264600280 for ; Fri, 02 Dec 2005 16:46:02 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29144-05 for ; Fri, 02 Dec 2005 16:46:02 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 3857F60027B; Fri, 02 Dec 2005 16:46:02 -0500 (EST) Date: Fri, 02 Dec 2005 16:46:02 -0500 From: Michael Stone Subject: Re: Database restore speed In-reply-to: To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051202214602.GH7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20051202211925.GF6026@ns.snowman.net> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/83 X-Sequence-Number: 15904 On Fri, Dec 02, 2005 at 01:24:31PM -0800, Luke Lonergan wrote: >From a performance standpoint no argument, although you're betting that you >can do parsing / conversion faster than the COPY core in the backend can Not necessarily; you may be betting that it's more *efficient* to do the parsing on a bunch of lightly loaded clients than your server. Even if you're using the same code this may be a big win. Mike Stone From pgsql-performance-owner@postgresql.org Fri Dec 2 18:59:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F16B79DD768 for ; Fri, 2 Dec 2005 18:59:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71882-05 for ; Fri, 2 Dec 2005 18:59:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id A82989DD718 for ; Fri, 2 Dec 2005 18:59:19 -0400 (AST) Received: from zoraida.natserv.net (p65-147.acedsl.com [66.114.65.147]) by svr2.postgresql.org (Postfix) with ESMTP id 5A2ECF0A1A for ; Fri, 2 Dec 2005 22:59:22 +0000 (GMT) Received: from 35st-server.simplicato.com (static-71-249-233-130.nycmny.east.verizon.net [71.249.233.130]) by zoraida.natserv.net (Postfix) with ESMTP id BD22E7DAB; Fri, 2 Dec 2005 17:59:17 -0500 (EST) References: <11360.1133453022@sss.pgh.pa.us> Message-ID: X-Mailer: http://www.courier-mta.org/cone/ From: Francisco Reyes To: Michael Riess Cc: pgsql-performance@postgresql.org Subject: Re: 15,000 tables Date: Fri, 02 Dec 2005 18:00:53 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="US-ASCII" Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/84 X-Sequence-Number: 15905 Michael Riess writes: > Sorry, I should have included that info in the initial post. You're > right in that most of these tables have a similar structure. But they > are independent and can be customized by the users. > How about creating 50 databases and give each it's own tablespace? It's not only whether PostgreSQL can be optimized, but also how well your filesystem is handling the directory with large number of files. by splitting the directories you will likely help the OS and will be able to perhaps better determine if the OS or the DB is at fault for the slowness. From pgsql-performance-owner@postgresql.org Fri Dec 2 19:01:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5F5189DD768 for ; Fri, 2 Dec 2005 19:01:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71319-07 for ; Fri, 2 Dec 2005 19:01:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 278FA9DD718 for ; Fri, 2 Dec 2005 19:01:18 -0400 (AST) 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 jB2N0xxH008550; Fri, 2 Dec 2005 18:00:59 -0500 (EST) To: "Luke Lonergan" cc: "Stephen Frost" , "David Lang" , "Steve Oualline" , pgsql-performance@postgresql.org Subject: Re: Database restore speed In-reply-to: References: Comments: In-reply-to "Luke Lonergan" message dated "Fri, 02 Dec 2005 13:29:47 -0800" Date: Fri, 02 Dec 2005 18:00:59 -0500 Message-ID: <8549.1133564459@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/85 X-Sequence-Number: 15906 "Luke Lonergan" writes: > One more thing - this is really about the lack of a cross-platform binary > input standard for Postgres IMO. If there were such a thing, it *would* be > safe to do this. The current Binary spec is not cross-platform AFAICS, it > embeds native representations of the DATUMs, and does not specify a > universal binary representation of same. Sure it does ... at least as long as you are willing to assume everybody uses IEEE floats, and if they don't you have semantic problems translating float datums anyhow. What we lack is documentation, more than functionality. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 2 19:02:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0666A9DD78F for ; Fri, 2 Dec 2005 19:02:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71262-09 for ; Fri, 2 Dec 2005 19:01:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 0D3B59DD781 for ; Fri, 2 Dec 2005 19:01:57 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 130E333691; Sat, 3 Dec 2005 00:01:58 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: 15,000 tables - next step Date: Sat, 03 Dec 2005 00:01:55 +0100 Organization: Hub.Org Networking Services Lines: 37 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/86 X-Sequence-Number: 15907 Hi, thanks for your comments so far - I appreciate it. I'd like to narrow down my problem a bit: As I said in the other thread, I estimate that only 20% of the 15,000 tables are accessed regularly. So I don't think that vacuuming or the number of file handles is a problem. Have a look at this: content2=# select relpages, relname from pg_class order by relpages desc limit 20; relpages | relname ----------+--------------------------------- 11867 | pg_attribute 10893 | pg_attribute_relid_attnam_index 3719 | pg_class_relname_nsp_index 3310 | wsobjects_types 3103 | pg_class 2933 | wsobjects_types_fields 2903 | wsod_133143 2719 | pg_attribute_relid_attnum_index 2712 | wsod_109727 2666 | pg_toast_98845 2601 | pg_toast_9139566 1876 | wsod_32168 1837 | pg_toast_138780 1678 | pg_toast_101427 1409 | wsobjects_types_fields_idx 1088 | wso_log 943 | pg_depend 797 | pg_depend_depender_index 737 | wsod_3100 716 | wp_hp_zen I don't think that postgres was designed for a situation like this, where a system table that should be fairly small (pg_attribute) is this large. From pgsql-performance-owner@postgresql.org Fri Dec 2 19:03:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A70729DD78D for ; Fri, 2 Dec 2005 19:02:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71882-08 for ; Fri, 2 Dec 2005 19:02:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id 8CDB99DD781 for ; Fri, 2 Dec 2005 19:02:53 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 02 Dec 2005 18:02:47 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 18:02:12 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 2 Dec 2005 23:02:11 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 02 Dec 2005 15:02:11 -0800 Subject: Re: Database restore speed From: "Luke Lonergan" To: "Michael Stone" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX3ifHBl7L5/1gZTGGQ4QudMIDVkgACnt+q In-Reply-To: <20051202214602.GH7330@mathom.us> MIME-Version: 1.0 X-OriginalArrivalTime: 02 Dec 2005 23:02:12.0536 (UTC) FILETIME=[6E297B80:01C5F794] X-WSS-ID: 6F8E0D1D4084147175-07-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=-0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/87 X-Sequence-Number: 15908 Micahel, On 12/2/05 1:46 PM, "Michael Stone" wrote: > Not necessarily; you may be betting that it's more *efficient* to do the > parsing on a bunch of lightly loaded clients than your server. Even if > you're using the same code this may be a big win. If it were possible in light of the issues on client parse / convert, then we should analyze whether it's a performance win. In the restore case, where we've got a dedicated server with a dedicated client machine, I don't see why there would be a speed benefit from running the same parse / convert code on the client versus running it on the server. Imagine a pipeline where there is a bottleneck, moving the bottleneck to a different machine doesn't make it less of a bottleneck. - Luke From pgsql-performance-owner@postgresql.org Fri Dec 2 19:26:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 919EA9DD768 for ; Fri, 2 Dec 2005 19:26:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85284-02 for ; Fri, 2 Dec 2005 19:26:29 -0400 (AST) X-Greylist: delayed 00:27:13.561398 by SQLgrey- Received: from zoraida.natserv.net (p65-147.acedsl.com [66.114.65.147]) by postgresql.org (Postfix) with ESMTP id 599839DCF92 for ; Fri, 2 Dec 2005 19:26:31 -0400 (AST) Received: from 35st-server.simplicato.com (static-71-249-233-130.nycmny.east.verizon.net [71.249.233.130]) by zoraida.natserv.net (Postfix) with ESMTP id 255507D9C for ; Fri, 2 Dec 2005 18:26:34 -0500 (EST) Message-ID: X-Mailer: http://www.courier-mta.org/cone/ From: Francisco Reyes To: PostgreSQL performance Subject: Small table or partial index? Date: Fri, 02 Dec 2005 18:28:09 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="US-ASCII" Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/88 X-Sequence-Number: 15909 I am in the process of designing a new system. There will be a long list of words such as -word table word_id integer word varchar special boolean Some "special" words are used to determine if some work is to be done and will be what we care the most for one type of operation. Will it be more effective to have a partial index 'where is special' or to copy those special emails to their own table? The projected number of non special words is in the millions while the special ones will be in the thousands at most (under 10K for sure). My personal view is that performance should be pretty much equal, but one of my co-worker's believes that the smaller table would likely get cached by the OS since it would be used so frequently and would perform better. In both instances we would be hitting an index of exactly the same size. The searches will be 'where word = and is special' From pgsql-performance-owner@postgresql.org Fri Dec 2 23:26:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 431579DD70A for ; Fri, 2 Dec 2005 23:26:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70623-07 for ; Fri, 2 Dec 2005 23:25:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail2.egcrc.net (63-193-204-9.egcrc.org [63.193.204.9]) by postgresql.org (Postfix) with ESMTP id C08889DCAD7 for ; Fri, 2 Dec 2005 23:25:58 -0400 (AST) Received: from egcrc-ex01.egcrc.org ([172.16.1.4]) by mail2.egcrc.net with Microsoft SMTPSVC(6.0.3790.211); Fri, 2 Dec 2005 19:26:02 -0800 Received: from 172.16.0.166 ([172.16.0.166]) by egcrc-ex01.egcrc.org ([172.16.1.4]) with Microsoft Exchange Server HTTP-DAV ; Sat, 3 Dec 2005 03:26:02 +0000 Received: from enzian by egcrc-ex01.egcrc.org; 02 Dec 2005 19:26:06 -0800 Subject: Re: Database restore speed From: Mitch Skinner To: Luke Lonergan Cc: Stephen Frost , David Lang , Steve Oualline , pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 02 Dec 2005 19:26:06 -0800 Message-Id: <1133580366.3367.123.camel@enzian> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) X-OriginalArrivalTime: 03 Dec 2005 03:26:02.0677 (UTC) FILETIME=[49A94E50:01C5F7B9] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/89 X-Sequence-Number: 15910 On Fri, 2005-12-02 at 13:24 -0800, Luke Lonergan wrote: > It's a matter of safety and generality - in general you > can't be sure that client machines / OS'es will render the same conversions > that the backend does in all cases IMO. Can't binary values can safely be sent cross-platform in DataRow messages? At least from my ignorant, cursory look at printtup.c, there's a binary format code path. float4send in utils/adt/float.c uses pq_sendfloat4. I obviously haven't followed the entire rabbit trail, but it seems like it happens. IOW, why isn't there a cross-platform issue when sending binary data from the backend to the client in query results? And if there isn't a problem there, why can't binary data be sent from the client to the backend? Mitch From pgsql-performance-owner@postgresql.org Sat Dec 3 00:04:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7C2DD9DCAD7 for ; Sat, 3 Dec 2005 00:04:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83602-06 for ; Sat, 3 Dec 2005 00:04:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id E6D4C9DCAD3 for ; Sat, 3 Dec 2005 00:04:41 -0400 (AST) Received: from 172.16.1.148 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 02 Dec 2005 23:04:33 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Dec 2005 23:03:59 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Database restore speed Date: Fri, 2 Dec 2005 23:03:57 -0500 Message-ID: <3E37B936B592014B978C4415F90D662DE11F1B@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX3uVIU5AB4juXaScW/nlDb3zOIbgABUOBu From: "Luke Lonergan" To: mitch@egcrc.net cc: sfrost@snowman.net, dlang@invendra.net, soualline@stbernard.com, pgsql-performance@postgresql.org X-OriginalArrivalTime: 03 Dec 2005 04:03:59.0023 (UTC) FILETIME=[967823F0:01C5F7BE] X-WSS-ID: 6F8FC6DB4J85396109-01-01 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/90 X-Sequence-Number: 15911 QW5kIGhvdyBkbyB3ZSBjb21wb3NlIHRoZSBiaW5hcnkgZGF0YSBvbiB0aGUgY2xpZW50PyAgRG8g d2UgdHJ1c3QgdGhhdCB0aGUgY2xpZW50IGVuY29kaW5nIGNvbnZlcnNpb24gbG9naWMgaXMgaWRl bnRpY2FsIHRvIHRoZSBiYWNrZW5kJ3M/ICBJZiB0aGVyZSBpcyBhIGRpZmZlcmVuY2UsIHdoYXQg aGFwcGVucyBpZiB0aGUgc2FtZSBmaWxlIGxvYWRlZCBmcm9tIGRpZmZlcmVudCBjbGllbnQgbWFj aGluZXMgaGFzIGRpZmZlcmVudCByZXN1bHRzPyAgS2V5IGNvbmZsaWN0cyB3aGVuIGxvYWRpbmcg YSByZXN0b3JlIGZyb20gb25lIG1hY2hpbmUgYW5kIG5vdCBmcm9tIGFub3RoZXI/DQotIEx1a2UN Ci0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQpTZW50IGZyb20gbXkgQmxhY2tCZXJyeSBXaXJl bGVzcyBEZXZpY2UNCg0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KRnJvbTogTWl0Y2gg U2tpbm5lciA8bWl0Y2hAZWdjcmMubmV0Pg0KVG86IEx1a2UgTG9uZXJnYW4gPExMb25lcmdhbkBn cmVlbnBsdW0uY29tPg0KQ0M6IFN0ZXBoZW4gRnJvc3QgPHNmcm9zdEBzbm93bWFuLm5ldD47IERh dmlkIExhbmcgPGRsYW5nQGludmVuZHJhLm5ldD47IFN0ZXZlIE91YWxsaW5lIDxzb3VhbGxpbmVA c3RiZXJuYXJkLmNvbT47IHBnc3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnIDxwZ3NxbC1w ZXJmb3JtYW5jZUBwb3N0Z3Jlc3FsLm9yZz4NClNlbnQ6IEZyaSBEZWMgMDIgMjI6MjY6MDYgMjAw NQ0KU3ViamVjdDogUmU6IFtQRVJGT1JNXSBEYXRhYmFzZSByZXN0b3JlIHNwZWVkDQoNCk9uIEZy aSwgMjAwNS0xMi0wMiBhdCAxMzoyNCAtMDgwMCwgTHVrZSBMb25lcmdhbiB3cm90ZToNCj4gSXQn cyBhIG1hdHRlciBvZiBzYWZldHkgYW5kIGdlbmVyYWxpdHkgLSBpbiBnZW5lcmFsIHlvdQ0KPiBj YW4ndCBiZSBzdXJlIHRoYXQgY2xpZW50IG1hY2hpbmVzIC8gT1MnZXMgd2lsbCByZW5kZXIgdGhl IHNhbWUgY29udmVyc2lvbnMNCj4gdGhhdCB0aGUgYmFja2VuZCBkb2VzIGluIGFsbCBjYXNlcyBJ TU8uDQoNCkNhbid0IGJpbmFyeSB2YWx1ZXMgY2FuIHNhZmVseSBiZSBzZW50IGNyb3NzLXBsYXRm b3JtIGluIERhdGFSb3cNCm1lc3NhZ2VzPyAgQXQgbGVhc3QgZnJvbSBteSBpZ25vcmFudCwgY3Vy c29yeSBsb29rIGF0IHByaW50dHVwLmMsDQp0aGVyZSdzIGEgYmluYXJ5IGZvcm1hdCBjb2RlIHBh dGguICBmbG9hdDRzZW5kIGluIHV0aWxzL2FkdC9mbG9hdC5jIHVzZXMNCnBxX3NlbmRmbG9hdDQu ICBJIG9idmlvdXNseSBoYXZlbid0IGZvbGxvd2VkIHRoZSBlbnRpcmUgcmFiYml0IHRyYWlsLA0K YnV0IGl0IHNlZW1zIGxpa2UgaXQgaGFwcGVucy4NCg0KSU9XLCB3aHkgaXNuJ3QgdGhlcmUgYSBj cm9zcy1wbGF0Zm9ybSBpc3N1ZSB3aGVuIHNlbmRpbmcgYmluYXJ5IGRhdGENCmZyb20gdGhlIGJh Y2tlbmQgdG8gdGhlIGNsaWVudCBpbiBxdWVyeSByZXN1bHRzPyAgQW5kIGlmIHRoZXJlIGlzbid0 IGENCnByb2JsZW0gdGhlcmUsIHdoeSBjYW4ndCBiaW5hcnkgZGF0YSBiZSBzZW50IGZyb20gdGhl IGNsaWVudCB0byB0aGUNCmJhY2tlbmQ/DQoNCk1pdGNoDQoNCg== From pgsql-performance-owner@postgresql.org Sat Dec 3 05:07:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2C2A29DCAA5 for ; Sat, 3 Dec 2005 05:07:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23927-01 for ; Sat, 3 Dec 2005 05:07:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 7073F9DCABE for ; Sat, 3 Dec 2005 05:07:36 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id B2E1C1AC3E9; Sat, 3 Dec 2005 01:07:57 -0800 (PST) Date: Sat, 3 Dec 2005 01:07:15 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: Stephen Frost , Steve Oualline , pgsql-performance@postgresql.org Subject: Re: Database restore speed 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/91 X-Sequence-Number: 15912 On Fri, 2 Dec 2005, Luke Lonergan wrote: > Stephen, > > On 12/2/05 12:18 PM, "Stephen Frost" wrote: > >> Just a thought, but couldn't psql be made to use the binary mode of >> libpq and do at least some of the conversion on the client side? Or >> does binary mode not work with copy (that wouldn't suprise me, but >> perhaps copy could be made to support it)? > > Yes - I think this idea is implicit in what David suggested, and my response > as well. The problem is that the way the client does conversions can > potentially differ from the way the backend does. Some of the types in > Postgres are machine intrinsic and the encoding conversions use on-machine > libraries, each of which preclude the use of client conversion methods > (without a lot of restructuring). We'd tackled this problem in the past and > concluded that the parse / convert stage really belongs in the backend. I'll bet this parsing cost varys greatly with the data types used, I'm also willing to bet that for the data types that hae different encoding on different systems there could be a intermediate encoding that is far faster to parse then ASCII text is. for example, (and I know nothing about the data storage itself so this is just an example), if the issue was storing numeric values on big endian and little endian systems (and 32 bit vs 64 bit systems to end up with 4 ways of holding the data) you have a substantial cost in parseing the ASCII and converting it to a binary value, but the client can't (and shouldn't) know which endian type and word size the server is. but it could create a big endian multi-precision encoding that would then be very cheap for the server to split and flip as nessasary. yes this means more work is done overall, but it's split between different machines, and the binary representation of the data will reduce probably your network traffic as a side effect. and for things like date which get parsed in multiple ways until one is found that seems sane, there's a significant amount of work that the server could avoid. David Lang >> The other thought, of course, is that you could use PITR for your >> backups instead of pgdump... > > Totally - great idea, if this is actually a backup / restore then PITR plus > filesystem copy (tarball) is hugely faster than dump / restore. > > - Luke > > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Sat Dec 3 05:12:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 19CF39DCD51 for ; Sat, 3 Dec 2005 05:12:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25857-01 for ; Sat, 3 Dec 2005 05:12:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id A7C229DCD39 for ; Sat, 3 Dec 2005 05:12:27 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 6554D1AC3E9; Sat, 3 Dec 2005 01:12:49 -0800 (PST) Date: Sat, 3 Dec 2005 01:12:07 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Michael Stone Cc: pgsql-performance@postgresql.org Subject: Re: Database restore speed In-Reply-To: <20051202214602.GH7330@mathom.us> Message-ID: References: <20051202211925.GF6026@ns.snowman.net> <20051202214602.GH7330@mathom.us> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/92 X-Sequence-Number: 15913 On Fri, 2 Dec 2005, Michael Stone wrote: > On Fri, Dec 02, 2005 at 01:24:31PM -0800, Luke Lonergan wrote: >> From a performance standpoint no argument, although you're betting that you >> can do parsing / conversion faster than the COPY core in the backend can > > Not necessarily; you may be betting that it's more *efficient* to do the > parsing on a bunch of lightly loaded clients than your server. Even if > you're using the same code this may be a big win. it's a lot easier to throw hardware at the problem by spliting your incomeing data between multiple machines and have them all working in parallel throwing the data at one database then it is to throw more hardware at the database server to speed it up (and yes, assuming that MPP splits the parseing costs as well, it can be an answer for some types of systems) David Lang From pgsql-performance-owner@postgresql.org Sat Dec 3 05:22:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 11F0A9DD8B0 for ; Sat, 3 Dec 2005 05:22:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24346-07 for ; Sat, 3 Dec 2005 05:22:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id DB9909DD8A7 for ; Sat, 3 Dec 2005 05:22:24 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 7F4A11AC3E9; Sat, 3 Dec 2005 01:22:46 -0800 (PST) Date: Sat, 3 Dec 2005 01:22:04 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: Stephen Frost , Steve Oualline , pgsql-performance@postgresql.org Subject: Re: Database restore speed 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/93 X-Sequence-Number: 15914 On Fri, 2 Dec 2005, Luke Lonergan wrote: > Stephen, > > On 12/2/05 1:19 PM, "Stephen Frost" wrote: >> >>> I've used the binary mode stuff before, sure, Postgres may have to >>> convert some things but I have a hard time believing it'd be more >>> expensive to do a network_encoding -> host_encoding (or toasting, or >>> whatever) than to do the ascii -> binary change. >> >> From a performance standpoint no argument, although you're betting that you >> can do parsing / conversion faster than the COPY core in the backend can (I >> know *we* can :-). It's a matter of safety and generality - in general you >> can't be sure that client machines / OS'es will render the same conversions >> that the backend does in all cases IMO. > > One more thing - this is really about the lack of a cross-platform binary > input standard for Postgres IMO. If there were such a thing, it *would* be > safe to do this. The current Binary spec is not cross-platform AFAICS, it > embeds native representations of the DATUMs, and does not specify a > universal binary representation of same. > > For instance - when representing a float, is it an IEEE 32-bit floating > point number in little endian byte ordering? Or is it IEEE 64-bit? With > libpq, we could do something like an XDR implementation, but the machinery > isn't there AFAICS. This makes sense, however it then raises the question of how much effort it would take to define such a standard and implement the shim layer needed to accept the connections vs how much of a speed up it would result in (the gain could probaly be approximated with just a little hacking to use the existing binary format between two machines of the same type) as for the standards, standard network byte order is big endian, so that should be the standard used (in spite of the quantity of x86 machines out there). for the size of the data elements, useing the largest size of each will probably still be a win in size compared to ASCII. converting between binary formats is useally a matter of a few and and shift opcodes (and with the core so much faster then it's memory you can afford to do quite a few of these on each chunk of data without it being measurable in your overall time) an alturnative would be to add a 1-byte data type before each data element to specify it's type, but then the server side code would have to be smarter to deal with the additional possibilities. David Lang From pgsql-performance-owner@postgresql.org Sat Dec 3 05:33:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9CD369DCABE for ; Sat, 3 Dec 2005 05:33:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30537-02 for ; Sat, 3 Dec 2005 05:33:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 28C1C9DCAA5 for ; Sat, 3 Dec 2005 05:33:07 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id CC9461AC3E9; Sat, 3 Dec 2005 01:33:28 -0800 (PST) Date: Sat, 3 Dec 2005 01:32:47 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: Michael Stone , pgsql-performance@postgresql.org Subject: Re: Database restore speed 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/94 X-Sequence-Number: 15915 On Fri, 2 Dec 2005, Luke Lonergan wrote: > Micahel, > > On 12/2/05 1:46 PM, "Michael Stone" wrote: > >> Not necessarily; you may be betting that it's more *efficient* to do the >> parsing on a bunch of lightly loaded clients than your server. Even if >> you're using the same code this may be a big win. > > If it were possible in light of the issues on client parse / convert, then > we should analyze whether it's a performance win. > > In the restore case, where we've got a dedicated server with a dedicated > client machine, I don't see why there would be a speed benefit from running > the same parse / convert code on the client versus running it on the server. > Imagine a pipeline where there is a bottleneck, moving the bottleneck to a > different machine doesn't make it less of a bottleneck. your database server needs to use it's CPU for other things besides the parseing. you could buy a bigger machine, but it's useally far cheaper to buy two dual-proc machines then it is one quad proc machine (and if you load is such that you already have a 8-proc machine as the database, swallow hard when you ask for the price of a 16 proc machine), and in addition there is a substantial efficiancy loss in multi-proc machines (some software, some hardware) that may give you more available work cycles on the multiple small machines. if you can remove almost all the parsing load (CPU cycles, memory footprint, and cache thrashing effects) then that box can do the rest of it's stuff more efficiantly. meanwhile the client can use what would otherwise be idle CPU to do the parseing. if you only have a 1-1 relationship it's a good question as to if it's a win (it depends on how much other stuff each box is having to do to support this), but if you allow for multiple clients it easily becomes a win. David Lang From pgsql-performance-owner@postgresql.org Sat Dec 3 05:39:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 753499DCABE for ; Sat, 3 Dec 2005 05:39:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33640-01 for ; Sat, 3 Dec 2005 05:39:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 139849DCAA5 for ; Sat, 3 Dec 2005 05:39:12 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id D6FCD1AC3EA; Sat, 3 Dec 2005 01:39:33 -0800 (PST) Date: Sat, 3 Dec 2005 01:38:52 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: mitch@egcrc.net, sfrost@snowman.net, soualline@stbernard.com, pgsql-performance@postgresql.org Subject: Re: Database restore speed In-Reply-To: <3E37B936B592014B978C4415F90D662DE11F1B@MI8NYCMAIL06.Mi8.com> Message-ID: References: <3E37B936B592014B978C4415F90D662DE11F1B@MI8NYCMAIL06.Mi8.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/95 X-Sequence-Number: 15916 On Fri, 2 Dec 2005, Luke Lonergan wrote: > And how do we compose the binary data on the client? Do we trust that > the client encoding conversion logic is identical to the backend's? If > there is a difference, what happens if the same file loaded from > different client machines has different results? Key conflicts when > loading a restore from one machine and not from another? - Luke the same way you deal with text data that could be in different encodings, you tag your message with the format version you are useing and throw an error if you get a format you don't understand how to deal with. if a client claims to be useing one format, but is instead doing something different you will be in deep trouble anyway. remember, we aren't talking about random application code here, we are talking about postgres client code and libraries, if the library is incorrect then it's a bug, parsing bugs could happen in the server as welll. (in fact, the server could parse things to the intermediate format and then convert them, this sounds expensive, but given the high clock multipliers in use, it may not end up being measurable) David Lang From pgsql-performance-owner@postgresql.org Sat Dec 3 08:38:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 678179DCB11 for ; Sat, 3 Dec 2005 08:38:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82452-07 for ; Sat, 3 Dec 2005 08:38:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 2E1C09DCABE for ; Sat, 3 Dec 2005 08:38:45 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.156.169]) by smtp.nildram.co.uk (Postfix) with ESMTP id A2EDD252E84; Sat, 3 Dec 2005 12:38:46 +0000 (GMT) Subject: Re: Database restore speed From: Simon Riggs To: Stephen Frost Cc: Luke Lonergan , David Lang , Steve Oualline , pgsql-performance@postgresql.org In-Reply-To: <20051202201847.GE6026@ns.snowman.net> References: <3E37B936B592014B978C4415F90D662D01C48F01@MI8NYCMAIL06.Mi8.com> <20051202201847.GE6026@ns.snowman.net> Content-Type: text/plain Date: Sat, 03 Dec 2005 12:38:48 +0000 Message-Id: <1133613528.2906.731.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/96 X-Sequence-Number: 15917 On Fri, 2005-12-02 at 15:18 -0500, Stephen Frost wrote: > The other thought, of course, is that you could use PITR for your > backups instead of pgdump... Yes, it is much faster that way. Over on -hackers a few optimizations of COPY have been discussed; one of those is to optimize COPY when it is loading into a table created within the same transaction as the COPY. This would allow pg_dumps to be restored much faster, since no WAL need be written in this case. I hope to work on this fairly soon. Dumping/restoring data with pg_dump has wider uses than data protecting backup. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sat Dec 3 11:51:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0C3279DCB96 for ; Sat, 3 Dec 2005 11:51:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53516-06 for ; Sat, 3 Dec 2005 11:51:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp104.mail.sc5.yahoo.com (smtp104.mail.sc5.yahoo.com [66.163.169.223]) by postgresql.org (Postfix) with SMTP id 58A139DCBA6 for ; Sat, 3 Dec 2005 11:51:50 -0400 (AST) Received: (qmail 36271 invoked from network); 3 Dec 2005 15:51:48 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=Yahoo.com; h=Received:Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=nNPnJJspszS1CYM5uDXzhM5ENDdumtZn2mYHM21rYoRAo9Z1CNaKu4UsYuCnB0jvsyWhm7o+4sFw/4GRJ6w1+dSrHmE6M3IBTy1d5DxK0LthQ76jFSsizlQ1H3OrpmIRE11TMY5epc4uzOg23S//hFBRSYzWb+TCz1MphczoYMY= ; Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp104.mail.sc5.yahoo.com with SMTP; 3 Dec 2005 15:51:48 -0000 Received: from [172.21.8.23] (mars.black-lion.info [192.168.192.101]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id jB3Fpk1o004370; Sat, 3 Dec 2005 10:51:47 -0500 (EST) (envelope-from JanWieck@Yahoo.com) Message-ID: <4391BF0F.9000208@Yahoo.com> Date: Sat, 03 Dec 2005 10:51:43 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Riess CC: pgsql-performance@postgresql.org Subject: Re: 15,000 tables - next step References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.346 required=5 tests=[AWL=-0.133, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.346 X-Spam-Level: X-Archive-Number: 200512/97 X-Sequence-Number: 15918 On 12/2/2005 6:01 PM, Michael Riess wrote: > Hi, > > thanks for your comments so far - I appreciate it. I'd like to narrow > down my problem a bit: > > As I said in the other thread, I estimate that only 20% of the 15,000 > tables are accessed regularly. So I don't think that vacuuming or the > number of file handles is a problem. Have a look at this: What makes you think that? Have you at least tried to adjust your shared buffers, freespace map settings and background writer options to values that match your DB? How does increasing the kernel file desctriptor limit (try the current limit times 5 or 10) affect your performance? Jan > > content2=# select relpages, relname from pg_class order by relpages desc > limit 20; > relpages | relname > ----------+--------------------------------- > 11867 | pg_attribute > 10893 | pg_attribute_relid_attnam_index > 3719 | pg_class_relname_nsp_index > 3310 | wsobjects_types > 3103 | pg_class > 2933 | wsobjects_types_fields > 2903 | wsod_133143 > 2719 | pg_attribute_relid_attnum_index > 2712 | wsod_109727 > 2666 | pg_toast_98845 > 2601 | pg_toast_9139566 > 1876 | wsod_32168 > 1837 | pg_toast_138780 > 1678 | pg_toast_101427 > 1409 | wsobjects_types_fields_idx > 1088 | wso_log > 943 | pg_depend > 797 | pg_depend_depender_index > 737 | wsod_3100 > 716 | wp_hp_zen > > I don't think that postgres was designed for a situation like this, > where a system table that should be fairly small (pg_attribute) is this > large. > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Sat Dec 3 12:20:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ACF049DCBC0 for ; Sat, 3 Dec 2005 12:20:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63311-08 for ; Sat, 3 Dec 2005 12:20:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id C9DC49DCA94 for ; Sat, 3 Dec 2005 12:20:32 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A0CA03093A; Sat, 3 Dec 2005 17:20:31 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables - next step Date: Sat, 03 Dec 2005 17:20:21 +0100 Organization: Hub.Org Networking Services Lines: 38 Message-ID: References: <4391BF0F.9000208@Yahoo.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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <4391BF0F.9000208@Yahoo.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/98 X-Sequence-Number: 15919 Jan Wieck schrieb: > On 12/2/2005 6:01 PM, Michael Riess wrote: > >> Hi, >> >> thanks for your comments so far - I appreciate it. I'd like to narrow >> down my problem a bit: >> >> As I said in the other thread, I estimate that only 20% of the 15,000 >> tables are accessed regularly. So I don't think that vacuuming or the >> number of file handles is a problem. Have a look at this: > > What makes you think that? Have you at least tried to adjust your shared > buffers, freespace map settings and background writer options to values > that match your DB? How does increasing the kernel file desctriptor > limit (try the current limit times 5 or 10) affect your performance? > > Of course I tried to tune these settings. You should take into account that the majority of the tables are rarely ever modified, therefore I don't think that I need a gigantic freespace map. And the background writer never complained. Shared memory ... I currently use 1500 buffers for 50 connections, and performance really suffered when I used 3000 buffers. The problem is that it is a 1GB machine, and Apache + Tomcat need about 400MB. But thanks for your suggestions! I guess that I'll have to find a way to reduce the number of tables. Unfortunately my application needs them, so I'll have to find a way to delete rarely used tables and create them on the fly when they're accessed again. But this will really make my application much more complex and error-prone, and I had hoped that the database system could take care of that. I still think that a database system's performance should not suffer from the mere presence of unused tables. Mike From pgsql-performance-owner@postgresql.org Sat Dec 3 12:26:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 341EB9DCAA5 for ; Sat, 3 Dec 2005 12:26:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63769-08 for ; Sat, 3 Dec 2005 12:26:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by postgresql.org (Postfix) with ESMTP id 3B7989DCA94 for ; Sat, 3 Dec 2005 12:26:01 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 03 Dec 2005 13:25:55 -0300 X-IronPort-AV: i="3.99,209,1131332400"; d="scan'208"; a="3107353:sNHT279113356" Received: from alvh.no-ip.org (201.220.122.225) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 438E66E800052B19; Sat, 3 Dec 2005 13:26:00 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id E5291C3A055; Sat, 3 Dec 2005 13:26:42 -0300 (CLST) Date: Sat, 3 Dec 2005 13:26:42 -0300 From: Alvaro Herrera To: Michael Riess Cc: pgsql-performance@postgresql.org Subject: Re: 15,000 tables - next step Message-ID: <20051203162642.GA29022@surnet.cl> Mail-Followup-To: Michael Riess , pgsql-performance@postgresql.org References: <4391BF0F.9000208@Yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.481 required=5 tests=[AWL=-0.438, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.481 X-Spam-Level: * X-Archive-Number: 200512/99 X-Sequence-Number: 15920 Michael Riess wrote: > Shared memory ... I currently use 1500 buffers for 50 connections, and > performance really suffered when I used 3000 buffers. The problem is > that it is a 1GB machine, and Apache + Tomcat need about 400MB. Well, I'd think that's were your problem is. Not only you have a (relatively speaking) small server -- you also share it with other very-memory-hungry services! That's not a situation I'd like to be in. Try putting Apache and Tomcat elsewhere, and leave the bulk of the 1GB to Postgres. With 1500 shared buffers you are not really going anywhere -- you should have ten times that at the very least. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support From pgsql-performance-owner@postgresql.org Sat Dec 3 12:41:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EA3399DCB96 for ; Sat, 3 Dec 2005 12:41:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76857-03 for ; Sat, 3 Dec 2005 12:41:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 62B729DCB83 for ; Sat, 3 Dec 2005 12:41:42 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id E168A3093A; Sat, 3 Dec 2005 17:41:41 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables - next step Date: Sat, 03 Dec 2005 17:41:42 +0100 Organization: Hub.Org Networking Services Lines: 24 Message-ID: References: <4391BF0F.9000208@Yahoo.com> <20051203162642.GA29022@surnet.cl> 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <20051203162642.GA29022@surnet.cl> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/100 X-Sequence-Number: 15921 Alvaro Herrera schrieb: > Michael Riess wrote: > >> Shared memory ... I currently use 1500 buffers for 50 connections, and >> performance really suffered when I used 3000 buffers. The problem is >> that it is a 1GB machine, and Apache + Tomcat need about 400MB. > > Well, I'd think that's were your problem is. Not only you have a > (relatively speaking) small server -- you also share it with other > very-memory-hungry services! That's not a situation I'd like to be in. > Try putting Apache and Tomcat elsewhere, and leave the bulk of the 1GB > to Postgres. No can do. I can try to switch to a 2GB machine, but I will not use several machines. Not for a 5GB database. ;-) > With 1500 shared buffers you are not really going > anywhere -- you should have ten times that at the very least. > Like I said - I tried to double the buffers and the performance did not improve in the least. And I also tried this on a 2GB machine, and swapping was not a problem. If I used 10x more buffers, I would in essence remove the OS buffers. From pgsql-performance-owner@postgresql.org Sat Dec 3 14:45:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 971979DCB96 for ; Sat, 3 Dec 2005 14:45:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20021-03 for ; Sat, 3 Dec 2005 14:45:05 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by postgresql.org (Postfix) with ESMTP id 4BC709DCB11 for ; Sat, 3 Dec 2005 14:45:06 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 58so1011722wri for ; Sat, 03 Dec 2005 10:45:06 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=W4v5pdFly2M2AJF39tR2aLbvAhTh8Vw2Lm61b7A/2YuRs7cDXSGqmBJ4jdx6ra3//cb3KBYjlD2Hr3nUg1Wx3uXcAg3VFD+mEsp7txpw2vtvh9l2Sefffim6d5K70whPJlwNHdjTP9xZIFbD4IJVP6zosaaGS401T3jochg2Ei4= Received: by 10.64.204.17 with SMTP id b17mr2085588qbg; Sat, 03 Dec 2005 10:45:06 -0800 (PST) Received: by 10.65.180.14 with HTTP; Sat, 3 Dec 2005 10:45:06 -0800 (PST) Message-ID: Date: Sat, 3 Dec 2005 13:45:06 -0500 From: Jaime Casanova To: Michael Riess Subject: Re: 15,000 tables - next step 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: <4391BF0F.9000208@Yahoo.com> <20051203162642.GA29022@surnet.cl> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.071 required=5 tests=[AWL=0.071] X-Spam-Score: 0.071 X-Spam-Level: X-Archive-Number: 200512/101 X-Sequence-Number: 15922 On 12/3/05, Michael Riess wrote: > Alvaro Herrera schrieb: > > Michael Riess wrote: > > > >> Shared memory ... I currently use 1500 buffers for 50 connections, and > >> performance really suffered when I used 3000 buffers. The problem is > >> that it is a 1GB machine, and Apache + Tomcat need about 400MB. > > > > Well, I'd think that's were your problem is. Not only you have a > > (relatively speaking) small server -- you also share it with other > > very-memory-hungry services! That's not a situation I'd like to be in. > > Try putting Apache and Tomcat elsewhere, and leave the bulk of the 1GB > > to Postgres. > > No can do. I can try to switch to a 2GB machine, but I will not use > several machines. Not for a 5GB database. ;-) > No for a 5GB database but because of the other services you have running > > With 1500 shared buffers you are not really going > > anywhere -- you should have ten times that at the very least. > > > > Like I said - I tried to double the buffers and the performance did not > improve in the least. And I also tried this on a 2GB machine, and > swapping was not a problem. If I used 10x more buffers, I would in > essence remove the OS buffers. > How many disks do you have? (i wonder if you say 1) - in most cases is good idea to have the WAL file in another disk... What type of disks (ide, scsi, etc)? How many processors? What other services (or applications) do you have in that machine? -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Sat Dec 3 15:32:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9A29A9DCAA5 for ; Sat, 3 Dec 2005 15:32:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41271-02 for ; Sat, 3 Dec 2005 15:32:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp105.mail.sc5.yahoo.com (smtp105.mail.sc5.yahoo.com [66.163.169.225]) by postgresql.org (Postfix) with SMTP id 66E3E9DCA94 for ; Sat, 3 Dec 2005 15:32:36 -0400 (AST) Received: (qmail 78681 invoked from network); 3 Dec 2005 19:32:33 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=Yahoo.com; h=Received:Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=YOWNi8L4iPNpQn8yWhYNHEd0u+X2pBK9zLb09AgkZKnUPEubg97aTqOjtmIwui60xLQuTbeJDb7+NwCcVwIJFDBbSEN9WPvyaTPQ5XOW1Hsy6nXmTO5fS6Q5tyyg5CIOfhqaatxaT7PWhLdlGeUe7tlQ++UFPUk7LHVn+vgiULw= ; Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp105.mail.sc5.yahoo.com with SMTP; 3 Dec 2005 19:32:33 -0000 Received: from [172.21.8.23] (mars.black-lion.info [192.168.192.101]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id jB3JWV1o004966; Sat, 3 Dec 2005 14:32:32 -0500 (EST) (envelope-from JanWieck@Yahoo.com) Message-ID: <4391F2C5.9040009@Yahoo.com> Date: Sat, 03 Dec 2005 14:32:21 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Riess CC: pgsql-performance@postgresql.org Subject: Re: 15,000 tables - next step References: <4391BF0F.9000208@Yahoo.com> <20051203162642.GA29022@surnet.cl> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.348 required=5 tests=[AWL=-0.131, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.348 X-Spam-Level: X-Archive-Number: 200512/102 X-Sequence-Number: 15923 On 12/3/2005 11:41 AM, Michael Riess wrote: > Alvaro Herrera schrieb: >> Michael Riess wrote: >> >>> Shared memory ... I currently use 1500 buffers for 50 connections, and >>> performance really suffered when I used 3000 buffers. The problem is >>> that it is a 1GB machine, and Apache + Tomcat need about 400MB. >> >> Well, I'd think that's were your problem is. Not only you have a >> (relatively speaking) small server -- you also share it with other >> very-memory-hungry services! That's not a situation I'd like to be in. >> Try putting Apache and Tomcat elsewhere, and leave the bulk of the 1GB >> to Postgres. > > No can do. I can try to switch to a 2GB machine, but I will not use > several machines. Not for a 5GB database. ;-) What version of PostgreSQL are we talking about? If it is anything older than 8.0, you should upgrade at least to that. With 8.0 or better try 20000 shared buffers or more. It is well possible that going from 1500 to 3000 buffers made things worse. Your buffer cache can't even hold the system catalog in shared memory. If those 50 backends serve all those 500 apps at the same time, they suffer from constant catalog cache misses and don't find the entries in the shared buffers either. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Sat Dec 3 15:42:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 12ABF9DCAA5 for ; Sat, 3 Dec 2005 15:42:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40699-06 for ; Sat, 3 Dec 2005 15:42:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id 9B0ED9DCA94 for ; Sat, 3 Dec 2005 15:42:39 -0400 (AST) Received: from 172.16.1.24 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Sat, 03 Dec 2005 14:42:37 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 3 Dec 2005 14:42:04 -0500 Received: from 138.9.25.91 ([138.9.25.91]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Sat, 3 Dec 2005 19:42:03 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sat, 03 Dec 2005 11:42:02 -0800 Subject: Re: Database restore speed From: "Luke Lonergan" To: "Tom Lane" cc: "Stephen Frost" , "David Lang" , "Steve Oualline" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX3lFUed8lUKdKITBSk01X39MKJ9wArUycQ In-Reply-To: <8549.1133564459@sss.pgh.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 03 Dec 2005 19:42:04.0657 (UTC) FILETIME=[A3524E10:01C5F841] X-WSS-ID: 6F8F2AA74084867716-02-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/103 X-Sequence-Number: 15924 Tom, On 12/2/05 3:00 PM, "Tom Lane" wrote: > > Sure it does ... at least as long as you are willing to assume everybody > uses IEEE floats, and if they don't you have semantic problems > translating float datums anyhow. > > What we lack is documentation, more than functionality. Cool - sounds like the transport part might be there - the thing we desire is a file format that allows for efficient representation of portable binary datums. Last I looked at the Postgres binary dump format, it was not portable or efficient enough to suit the need. The efficiency problem with it was that there was descriptive information attached to each individual data item, as compared to the approach where that information is specified once for the data group as a template for input. Oracle's format allows for the expression of fixed width fields within the input file, and specifies the data type of the fields in the metadata. We could choose to support exactly the specification of the SQL*Loader format, which would certainly be general enough, and would have the advantage of providing a compatibility option with Oracle SQL*Loader input. Note that Oracle does not provide a similar functionality for the expression of *output* files, those that can be dumped from an Oracle database. Their mechanism for database dump is the exp/imp utility pair, and it is a proprietary "shifting sands" specification AFAIK. This limits the benefit of implementing the Oracle SQL*Loader compatibility to those customers who have designed utilities to emit that format, which may still be valuable. The alternative is to design a Postgres portable binary input file format. I'd like to see a record oriented format like that of FORTRAN unformatted, which uses bookends around each record to identify the length of each record. This allows for fast record oriented positioning within the file, and provides some self-description for integrity checking, etc. - Luke From pgsql-performance-owner@postgresql.org Sat Dec 3 16:32:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 934499DCAD6 for ; Sat, 3 Dec 2005 16:32:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61756-03 for ; Sat, 3 Dec 2005 16:32:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D9EAF9DCBE9 for ; Sat, 3 Dec 2005 16:32:41 -0400 (AST) 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 jB3KWLIK002405; Sat, 3 Dec 2005 15:32:21 -0500 (EST) To: "Luke Lonergan" cc: "Stephen Frost" , "David Lang" , "Steve Oualline" , pgsql-performance@postgresql.org Subject: Re: Database restore speed In-reply-to: References: Comments: In-reply-to "Luke Lonergan" message dated "Sat, 03 Dec 2005 11:42:02 -0800" Date: Sat, 03 Dec 2005 15:32:20 -0500 Message-ID: <2404.1133641940@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/104 X-Sequence-Number: 15925 "Luke Lonergan" writes: > Last I looked at the Postgres binary dump format, it was not portable or > efficient enough to suit the need. The efficiency problem with it was that > there was descriptive information attached to each individual data item, as > compared to the approach where that information is specified once for the > data group as a template for input. Are you complaining about the length words? Get real... regards, tom lane From pgsql-performance-owner@postgresql.org Sat Dec 3 17:29:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6D69F9DCBD7 for ; Sat, 3 Dec 2005 17:29:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78686-07 for ; Sat, 3 Dec 2005 17:29:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id A30D49DCBAF for ; Sat, 3 Dec 2005 17:29:22 -0400 (AST) Received: from 172.16.1.26 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Sat, 03 Dec 2005 16:29:11 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 3 Dec 2005 16:29:02 -0500 Received: from 138.9.25.91 ([138.9.25.91]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Sat, 3 Dec 2005 21:29:01 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sat, 03 Dec 2005 13:29:01 -0800 Subject: Re: Database restore speed From: "Luke Lonergan" To: "Tom Lane" cc: "Stephen Frost" , "David Lang" , "Steve Oualline" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Database restore speed Thread-Index: AcX4SLi6X8mqbN8iT72BA9fyqJfGrgAB9sLS In-Reply-To: <2404.1133641940@sss.pgh.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 03 Dec 2005 21:29:02.0819 (UTC) FILETIME=[94D81B30:01C5F850] X-WSS-ID: 6F8CD1944PK899018-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/105 X-Sequence-Number: 15926 Tom, On 12/3/05 12:32 PM, "Tom Lane" wrote: > "Luke Lonergan" writes: >> Last I looked at the Postgres binary dump format, it was not portable or >> efficient enough to suit the need. The efficiency problem with it was that >> there was descriptive information attached to each individual data item, as >> compared to the approach where that information is specified once for the >> data group as a template for input. > > Are you complaining about the length words? Get real... Hmm - "" repeat, efficiency is 1/2 of "" repeat. I think that's worth complaining about. - Luke From pgsql-performance-owner@postgresql.org Sat Dec 3 19:00:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A53B29DCBD7 for ; Sat, 3 Dec 2005 19:00:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07481-08 for ; Sat, 3 Dec 2005 19:00:18 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.197]) by postgresql.org (Postfix) with ESMTP id 7C82E9DCBA2 for ; Sat, 3 Dec 2005 19:00:19 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 4so866377nzn for ; Sat, 03 Dec 2005 15:00:22 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=JL6g6cLT6xsN16T3XN/qeQaDAIaJEaCrN/J0x4BCXkccNIjanaGIpz7SX2/uLREKnEIXBtF2L3lWOcoz8TgVLt+hAkpgJgO70tCEBSGyjyaQv8yIx15pRjdMtUfD4vNIcgLaa10w3apWxM1pEAW/SemUF6V0KT2DqOShMXcrH68= Received: by 10.65.158.10 with SMTP id k10mr2137762qbo; Sat, 03 Dec 2005 15:00:21 -0800 (PST) Received: by 10.65.177.1 with HTTP; Sat, 3 Dec 2005 15:00:21 -0800 (PST) Message-ID: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> Date: Sat, 3 Dec 2005 23:00:21 +0000 From: Rodrigo Madera To: pgsql-performance@postgresql.org Subject: Faster db architecture for a twisted table. 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/106 X-Sequence-Number: 15927 Imagine a table named Person with "first_name" and "age". Now let's make it fancy and put a "mother" and "father" field that is a reference to the own table (Person). And to get even fuzzier, let's drop in some siblings: CREATE TABLE person( id bigint PRIMARY KEY, first_name TEXT, age INT, mother bigint REFERENCES person, father biging REFERENCES person, siblings array of bigints (don't remember the syntax, but you get the p= oint) ); Well, this is ok, but imagine a search for "brothers of person id 34". We would have to search inside the record's 'siblings' array. Is this a bad design? is this going to be slow? What would be a better design to have these kind of relationships? (where you need several references to rows inside the table we are). Thanks for any help, Rodrigo From pgsql-performance-owner@postgresql.org Sat Dec 3 19:29:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C6FAE9DCBF8 for ; Sat, 3 Dec 2005 19:29:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29566-04 for ; Sat, 3 Dec 2005 19:29:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail2.egcrc.net (63-193-204-9.egcrc.org [63.193.204.9]) by postgresql.org (Postfix) with ESMTP id 6B8D79DCB8F for ; Sat, 3 Dec 2005 19:29:14 -0400 (AST) Received: from egcrc-ex01.egcrc.org ([172.16.1.4]) by mail2.egcrc.net with Microsoft SMTPSVC(6.0.3790.211); Sat, 3 Dec 2005 15:29:16 -0800 Received: from 66.245.216.181 ([66.245.216.181]) by egcrc-ex01.egcrc.org ([172.16.1.4]) via Exchange Front-End Server mail.egcrc.net ([172.16.1.9]) with Microsoft Exchange Server HTTP-DAV ; Sat, 3 Dec 2005 23:29:16 +0000 Received: from firebolt by mail.egcrc.net; 03 Dec 2005 15:29:16 -0800 Subject: Re: Database restore speed From: Mitch Skinner To: Luke Lonergan Cc: sfrost@snowman.net, dlang@invendra.net, soualline@stbernard.com, pgsql-performance@postgresql.org In-Reply-To: <3E37B936B592014B978C4415F90D662DE11F1B@MI8NYCMAIL06.Mi8.com> References: <3E37B936B592014B978C4415F90D662DE11F1B@MI8NYCMAIL06.Mi8.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 03 Dec 2005 15:29:15 -0800 Message-Id: <1133652555.4333.41.camel@firebolt> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) X-OriginalArrivalTime: 03 Dec 2005 23:29:16.0667 (UTC) FILETIME=[60A1F4B0:01C5F861] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[RCVD_NUMERIC_HELO=1.253, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200512/107 X-Sequence-Number: 15928 On Fri, 2005-12-02 at 23:03 -0500, Luke Lonergan wrote: > And how do we compose the binary data on the client? Do we trust that the client encoding conversion logic is identical to the backend's? Well, my newbieness is undoubtedly showing already, so I might as well continue with my line of dumb questions. I did a little mail archive searching, but had a hard time coming up with unique query terms. This is a slight digression, but my question about binary format query results wasn't rhetorical. Do I have to worry about different platforms when I'm getting binary RowData(s) back from the server? Or when I'm sending binary bind messages? Regarding whether or not the client has identical encoding/conversion logic, how about a fast path that starts out by checking for compatibility? In addition to a BOM, you could add a "float format mark" that was an array of things like +0.0, -0.0, min, max, +Inf, -Inf, NaN, etc. It looks like XDR specifies byte order for floats and otherwise punts to IEEE. I have no experience with SQL*Loader, but a quick read of the docs appears to divide data types into "portable" and "nonportable" groups, where loading nonportable data types requires extra care. This may be overkill, but have you looked at HDF5? Only one hit came up in the mail archives. http://hdf.ncsa.uiuc.edu/HDF5/doc/H5.format.html For (e.g.) floats, the format includes metadata that specifies byte order, padding, normalization, the location of the sign, exponent, and mantissa, and the size of the exponent and mantissa. The format appears not to require length information on a per-datum basis. A cursory look at the data format page gives me the impression that there's a useful streamable subset. The license of the implementation is BSD-style (no advertising clause), and it appears to support a large variety of platforms. Currently, the format spec only mentions ASCII, but since the library doesn't do any actual string manipulation (just storage and retrieval, AFAICS) it may be UTF-8 clean. Mitch From pgsql-performance-owner@postgresql.org Sat Dec 3 20:00:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E1E8A9DCC27 for ; Sat, 3 Dec 2005 20:00:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46677-05 for ; Sat, 3 Dec 2005 20:00:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by postgresql.org (Postfix) with ESMTP id 888B69DCC16 for ; Sat, 3 Dec 2005 20:00:23 -0400 (AST) Received: from [84.143.50.85] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis), id 0MKwh2-1EihIl1aK7-00044P; Sun, 04 Dec 2005 01:00:23 +0100 Received: from p548f3255.dip0.t-ipconnect.de ([84.143.50.85] helo=[192.168.0.101]) by pse.dyndns.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.44) id 1EihIk-0004O0-11; Sun, 04 Dec 2005 01:00:22 +0100 Message-ID: <439230D3.9070006@pse-consulting.de> Date: Sun, 04 Dec 2005 00:57:07 +0100 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rodrigo Madera CC: pgsql-performance@postgresql.org Subject: Re: Faster db architecture for a twisted table. References: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> In-Reply-To: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/108 X-Sequence-Number: 15929 Rodrigo Madera wrote: >Imagine a table named Person with "first_name" and "age". > >Now let's make it fancy and put a "mother" and "father" field that is >a reference to the own table (Person). And to get even fuzzier, let's >drop in some siblings: > >CREATE TABLE person( > id bigint PRIMARY KEY, > first_name TEXT, > age INT, > mother bigint REFERENCES person, > father biging REFERENCES person, > siblings array of bigints (don't remember the syntax, but you get the point) >); > >Well, this is ok, but imagine a search for "brothers of person id >34". We would have to search inside the record's 'siblings' array. Is >this a bad design? is this going to be slow? > >What would be a better design to have these kind of relationships? >(where you need several references to rows inside the table we are). > > Create a table "sibling" with parent_id, sibling_id and appropriate FKs, allowing the model to reflect the relation. At the same time, you can drop "mother" and "father", because this relation is covered too. Regards, Andreas From pgsql-performance-owner@postgresql.org Tue Dec 6 23:56:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 74DC49DCACB for ; Sat, 3 Dec 2005 20:09:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53692-02 for ; Sat, 3 Dec 2005 20:09:40 -0400 (AST) X-Greylist: delayed 00:06:43.524201 by SQLgrey- Received: from mail5.dslextreme.com (mail5.dslextreme.com [66.51.199.81]) by postgresql.org (Postfix) with SMTP id AF2CD9DCA94 for ; Sat, 3 Dec 2005 20:09:40 -0400 (AST) Received: (qmail 6955 invoked from network); 4 Dec 2005 00:02:30 -0000 Received: from unknown (HELO [10.1.1.1]) (66.245.216.181) by mail5.dslextreme.com with SMTP; Sat, 03 Dec 2005 16:02:30 -0800 Subject: Re: Faster db architecture for a twisted table. From: Mitchell Skinner To: pgsql-performance@postgresql.org In-Reply-To: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> References: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> Content-Type: text/plain Date: Sat, 03 Dec 2005 16:02:58 -0800 Message-Id: <1133654578.15792.8.camel@firebolt> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/212 X-Sequence-Number: 16033 On Sat, 2005-12-03 at 23:00 +0000, Rodrigo Madera wrote: > CREATE TABLE person( > id bigint PRIMARY KEY, > first_name TEXT, > age INT, > mother bigint REFERENCES person, > father biging REFERENCES person, > siblings array of bigints (don't remember the syntax, but you get the point) > ); > > Well, this is ok, but imagine a search for "brothers of person id > 34". We would have to search inside the record's 'siblings' array. Is > this a bad design? is this going to be slow? Well, I don't know how close this example is to your actual problem, but the siblings array is redundant, AFAICS. If you got rid of it, you could query for full sibling brothers with something like (not tested): select bro.* from person p inner join person bro on (p.mother = bro.mother) AND (p.father = bro.father) where bro.sex='M' and p.id=34 ...assuming you added a "sex" field, which you would need in any case to query for brothers. You could query for half-siblings by changing the AND into an OR, I think. Mitch From pgsql-performance-owner@postgresql.org Sat Dec 3 21:21:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 39E509DCA94 for ; Sat, 3 Dec 2005 21:21:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67898-08 for ; Sat, 3 Dec 2005 21:21:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 336989DCAB7 for ; Sat, 3 Dec 2005 21:18:47 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 2660E1AC3E9; Sat, 3 Dec 2005 17:17:50 -0800 (PST) Date: Sat, 3 Dec 2005 17:17:03 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: Tom Lane , Stephen Frost , Steve Oualline , pgsql-performance@postgresql.org Subject: Re: Database restore speed 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/109 X-Sequence-Number: 15930 On Sat, 3 Dec 2005, Luke Lonergan wrote: > Tom, > > On 12/3/05 12:32 PM, "Tom Lane" wrote: > >> "Luke Lonergan" writes: >>> Last I looked at the Postgres binary dump format, it was not portable or >>> efficient enough to suit the need. The efficiency problem with it was that >>> there was descriptive information attached to each individual data item, as >>> compared to the approach where that information is specified once for the >>> data group as a template for input. >> >> Are you complaining about the length words? Get real... > > Hmm - "" repeat, efficiency is 1/2 of "" repeat. I > think that's worth complaining about. but how does it compare to the ASCII representation of that int? (remember to include your seperator characters as well) yes it seems less efficiant, and it may be better to do something like send a record description header that gives the sizes of each item and then send the records following that without the size items, but either way should still be an advantage over the existing ASCII messages. also, how large is the in the message? there are other optimizations that can be done as well, but if there's still a question about if it's worth it to do the parseing on the client then a first implmentation should be done without makeing to many changes to test things. also some of the optimizations need to have measurements done to see if they are worth it (even something that seems as obvious as seperating the sizeof from the data itself as you suggest above has a penalty, namely it spreads the data that needs to be accessed to process a line between different cache lines, so in some cases it won't be worth it) David Lang From pgsql-performance-owner@postgresql.org Sat Dec 3 21:33:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1E6AA9DCAAD for ; Sat, 3 Dec 2005 21:33:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87191-09 for ; Sat, 3 Dec 2005 21:33:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sapo.pt (relay6.ptmail.sapo.pt [212.55.154.26]) by postgresql.org (Postfix) with SMTP id 496C79DCA94 for ; Sat, 3 Dec 2005 21:33:13 -0400 (AST) Received: (qmail 19915 invoked by uid 0); 4 Dec 2005 01:33:13 -0000 Received: from unknown (HELO sapo.pt) (10.134.35.155) by relay6 with SMTP; 4 Dec 2005 01:33:13 -0000 Received: (qmail 9907 invoked from network); 4 Dec 2005 01:33:13 -0000 X-AntiVirus: PTMail-AV 0.3.87.1 X-Virus-Status: Clean (0.00427 seconds) Received: from unknown (HELO hmv02) (hmv@[82.155.147.30]) (envelope-sender ) by mta5 (qmail-ldap-1.03) with SMTP for ; 4 Dec 2005 01:33:13 -0000 Message-ID: <005501c5f872$b1ce1380$580bfea9@hmv02> From: =?iso-8859-1?Q?H=E9lder_M._Vieira?= To: References: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> <439230D3.9070006@pse-consulting.de> Subject: Re: Faster db architecture for a twisted table. Date: Sun, 4 Dec 2005 01:33:13 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200512/110 X-Sequence-Number: 15931 ----- Original Message ----- From: "Andreas Pflug" > Create a table "sibling" with parent_id, sibling_id and appropriate FKs, > allowing the model to reflect the relation. At the same time, you can drop > "mother" and "father", because this relation is covered too Something like a table describing relationships and a table reflecting relationships from both sides, I guess: create table relationship_type ( relationship_type_id serial, relationship_type_description varchar(20) ) populated with values such as: 1 Child_of 2 Father_of 3 Brother_of 4 Sister_of ... And then create table person_relationships ( source_person_id int4, relationship_type_id int4, target_person_id int4 ) populated with values such as: 1 1 2 (person 1 is child of person 2) 2 2 1 (person 2 is father of person 1) ... It requires a careful maintenance, as almost all (I'd stick with ALL) relationships will require a person to appear twice (as source and as target), but flexible and easy to query. Helder M. Vieira From pgsql-performance-owner@postgresql.org Sun Dec 4 02:40:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5AA8F9DCAB7 for ; Sun, 4 Dec 2005 02:40:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07126-03 for ; Sun, 4 Dec 2005 02:40:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from chilco.textdrive.com (chilco.textdrive.com [207.7.108.242]) by postgresql.org (Postfix) with ESMTP id 7052B9DCAA9 for ; Sun, 4 Dec 2005 02:40:03 -0400 (AST) Received: from [192.168.15.103] (pcp0012204803pcs.blairblvd.tn.nash.comcast.net [69.245.49.69]) by chilco.textdrive.com (Postfix) with ESMTP id D07C4DB76F; Sun, 4 Dec 2005 06:40:03 +0000 (UTC) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <91002EEA-58BC-46F0-9F27-AEC11A50A02C@sitening.com> Cc: PgSQL - Performance Content-Transfer-Encoding: 7bit From: "Thomas F. O'Connell" Subject: Re: Very slow queries - please help Date: Sun, 4 Dec 2005 00:40:01 -0600 To: Bealach-na Bo X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/111 X-Sequence-Number: 15932 On Nov 24, 2005, at 12:14 PM, Bealach-na Bo wrote: > The consensus seems to be that I need more indexes and I also need to > look into the NOT IN statement as a possible bottleneck. I've > introduced the indexes which has led to a DRAMATIC change in response > time. Now I have to experiment with INNER JOIN -> OUTER JOIN > variations, SET ENABLE_SEQSCAN=OFF. > > Forgive me for not mentioning each person individually and by name. > You have all contributed to confirming what I had suspected (and > hoped): that *I* have a lot to learn! > > I'm attaching table descriptions, the first few lines of top output > while the queries were running, index lists, sample queries and > EXPLAIN ANALYSE output BEFORE and AFTER the introduction of the > indexes. As I said, DRAMATIC :) I notice that the CPU usage does not > vary very much, it's nearly 100% anyway, but the memory usage drops > markedly, which is another very nice result of the index introduction. > > Any more comments and tips would be very welcome. You might find the following resources from techdocs instructive: http://techdocs.postgresql.org/redir.php?link=/techdocs/ pgsqladventuresep2.php http://techdocs.postgresql.org/redir.php?link=/techdocs/ pgsqladventuresep3.php These documents provide some guidance into the process of index selection. It seems like you could still stand to benefit from more indexes based on your queries, table definitions, and current indexes. -- Thomas F. O'Connell Database Architecture and Programming Co-Founder Sitening, LLC http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37203-6320 615-260-0005 (cell) 615-469-5150 (office) 615-469-5151 (fax) From pgsql-performance-owner@postgresql.org Sun Dec 4 05:22:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5D5F39DCD24 for ; Sun, 4 Dec 2005 05:21:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61973-03 for ; Sun, 4 Dec 2005 05:21:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 6A3D59DCD4D for ; Sun, 4 Dec 2005 05:21:49 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 5BCC231F51; Sun, 4 Dec 2005 10:21:50 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables - next step Date: Sun, 04 Dec 2005 01:21:42 -0800 Organization: Hub.Org Networking Services Lines: 46 Message-ID: References: <4391BF0F.9000208@Yahoo.com> <20051203162642.GA29022@surnet.cl> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/112 X-Sequence-Number: 15933 Michael Riess wrote: >> Well, I'd think that's were your problem is. Not only you have a >> (relatively speaking) small server -- you also share it with other >> very-memory-hungry services! That's not a situation I'd like to be in. >> Try putting Apache and Tomcat elsewhere, and leave the bulk of the 1GB >> to Postgres. > > > No can do. I can try to switch to a 2GB machine, but I will not use > several machines. Not for a 5GB database. ;-) > >> With 1500 shared buffers you are not really going >> anywhere -- you should have ten times that at the very least. >> > > Like I said - I tried to double the buffers and the performance did not > improve in the least. And I also tried this on a 2GB machine, and > swapping was not a problem. If I used 10x more buffers, I would in > essence remove the OS buffers. Increasing buffers do improve performance -- if you have enough memory. You just don't have enough memory to play with. My servers run w/ 10K buffers (128MB on 64-bit FC4) and it definitely runs better w/ it at 10K versus 1500. With that many tables, your system catalogs are probably huge. To keep your system catalog from continually cycling in-out of buffers/OS cache/disk, you need a lot more memory. Ordinarily, I'd say the 500MB you have available for Postgres to cache 5GB is a workable ratio. My servers all have similar ratios of ~1:10 and they perform pretty good -- *except* when the system catalogs bloated due to lack of vacuuming on system tables. My app regularly creates & drops thousands of temporary tables leaving a lot of dead rows in the system catalogs. (Nearly the same situation as you -- instead of 15K live tables, I had 200 live tables and tens of thousands of dead table records.) Even with almost 8GB of RAM dedicated to postgres, performance on every single query -- not matter how small the table was -- took forever because the query planner had to spend a significant period of time scanning through my huge system catalogs to build the execution plan. While my situtation was fixable by scheduling a nightly vacuum/analyze on the system catalogs to get rid of the bazillion dead table/index info, you have no choice but to get more memory so you can stuff your entire system catalog into buffers/os cache. Personally, w/ 1GB of ECC RAM at ~$85, it's a no brainer. Get as much memory as your server can support. From pgsql-performance-owner@postgresql.org Sun Dec 4 05:33:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 95EEA9DCC42 for ; Sun, 4 Dec 2005 05:33:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62897-03 for ; Sun, 4 Dec 2005 05:33:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id DB6E29DCAD0 for ; Sun, 4 Dec 2005 05:33:47 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4F37831F51; Sun, 4 Dec 2005 10:33:49 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: 15,000 tables - next step Date: Sun, 04 Dec 2005 10:33:47 +0100 Organization: Hub.Org Networking Services Lines: 57 Message-ID: References: <4391BF0F.9000208@Yahoo.com> <20051203162642.GA29022@surnet.cl> 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/113 X-Sequence-Number: 15934 William Yu schrieb: > Michael Riess wrote: >>> Well, I'd think that's were your problem is. Not only you have a >>> (relatively speaking) small server -- you also share it with other >>> very-memory-hungry services! That's not a situation I'd like to be in. >>> Try putting Apache and Tomcat elsewhere, and leave the bulk of the 1GB >>> to Postgres. >> >> >> No can do. I can try to switch to a 2GB machine, but I will not use several machines. Not for a 5GB database. ;-) >> >>> With 1500 shared buffers you are not really going >>> anywhere -- you should have ten times that at the very least. >>> >> >> Like I said - I tried to double the buffers and the performance did not improve in the least. And I also tried this on a 2GB machine, and swapping was not a problem. If I used 10x more buffers, I would in essence remove the OS buffers. > > Increasing buffers do improve performance -- if you have enough memory. You just don't have enough memory to play with. My servers run w/ 10K buffers (128MB on 64-bit FC4) and it definitely runs better w/ it at 10K versus 1500. > > With that many tables, your system catalogs are probably huge. content2=# select sum(relpages) from pg_class where relname like 'pg_%'; sum ------- 64088 (1 row) :-) > While my situtation was fixable by scheduling a nightly vacuum/analyze on the system catalogs to get rid of the bazillion dead table/index info, you have no choice but to get more memory so you can stuff your entire system catalog into buffers/os cache. Personally, w/ 1GB of ECC RAM at ~$85, it's a no brainer. Get as much memory as your server can support. The problem is that we use pre-built hardware which isn't configurable. We can only switch to a bigger server with 2GB, but that's tops. I will do the following: - switch to 10k buffers on a 1GB machine, 20k buffers on a 2GB machine - try to optimize my connection polls to remember which apps (groups of 30 tables) were accessed, so that there is a better chance of using caches - "swap out" tables which are rarely used: export the content, drop the table, and re-create it on the fly upon access. Thanks for your comments! From pgsql-performance-owner@postgresql.org Sun Dec 4 07:56:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 596159DD56C for ; Sun, 4 Dec 2005 07:56:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18629-02 for ; Sun, 4 Dec 2005 07:56:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by postgresql.org (Postfix) with ESMTP id A70C39DCAD0 for ; Sun, 4 Dec 2005 07:56:54 -0400 (AST) Received: from [84.143.20.193] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), id 0MKxQS-1EisUC0Upp-00039O; Sun, 04 Dec 2005 12:56:56 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1EisUA-0004We-4L; Sun, 04 Dec 2005 12:56:54 +0100 Message-ID: <4392D985.7060902@pse-consulting.de> Date: Sun, 04 Dec 2005 11:56:53 +0000 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?=22H=E9lder_M=2E_Vieira=22?= CC: pgsql-performance@postgresql.org, rodrigo.madera@gmail.com Subject: Re: Faster db architecture for a twisted table. References: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> <439230D3.9070006@pse-consulting.de> <005501c5f872$b1ce1380$580bfea9@hmv02> In-Reply-To: <005501c5f872$b1ce1380$580bfea9@hmv02> 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: 8bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:0ce7ee5c3478b8d72edd8e05ccd40b70 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/114 X-Sequence-Number: 15935 H�lder M. Vieira wrote: > > ----- Original Message ----- From: "Andreas Pflug" > > >> Create a table "sibling" with parent_id, sibling_id and appropriate >> FKs, allowing the model to reflect the relation. At the same time, you >> can drop "mother" and "father", because this relation is covered too > > > > Something like a table describing relationships and a table reflecting > relationships from both sides, I guess: > > > create table relationship_type > ( > relationship_type_id serial, > relationship_type_description varchar(20) > ) > > populated with values such as: > 1 Child_of > 2 Father_of > 3 Brother_of > 4 Sister_of > ... > > > And then > > > create table person_relationships > ( > source_person_id int4, > relationship_type_id int4, > target_person_id int4 > ) > > populated with values such as: > 1 1 2 (person 1 is child of person 2) > 2 2 1 (person 2 is father of person 1) > This is an extended version, that could describe general person relations, not only family relations. Still, your your relationship_types are not precise. Since a two way relation is described, only the two Child_of and Brother/Sister are needed; the gender should be taken from the person themselves (to avoid data inconsistencies as "Mary is a brother of Lucy"). But this isn't pgsql-performances stuff any more. Regards, Andreas From pgsql-performance-owner@postgresql.org Sun Dec 4 09:25:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6DFC09DCBCE for ; Sun, 4 Dec 2005 09:25:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47393-02 for ; Sun, 4 Dec 2005 09:25:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id EF9DD9DCB8C for ; Sun, 4 Dec 2005 09:25:17 -0400 (AST) Received: from smtpgw.computec.de (unknown [212.123.108.8]) by svr2.postgresql.org (Postfix) with ESMTP id 1A0AAF0BA4 for ; Sun, 4 Dec 2005 13:25:20 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id 46D81559AD; Sun, 4 Dec 2005 14:25:17 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17106-02-35; Sun, 4 Dec 2005 14:25:16 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id 7CED6559A7; Sun, 4 Dec 2005 14:25:16 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5F8D6.12F298F4" Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Sun, 4 Dec 2005 14:24:37 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F626114E3A@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Thread-Index: AcX2k7l2OJhayaaZTCq12MkgkeC3IwAAI0qwAJA1mcI= References: <18959924631B864DB8D5268D81D746A90CCE2DD9@hermes.computec.de> From: "Markus Wollny" To: "Markus Wollny" , "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.146 required=5 tests=[AWL=-0.187, HTML_MESSAGE=0.001, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.146 X-Spam-Level: * X-Archive-Number: 200512/115 X-Sequence-Number: 15936 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5F8D6.12F298F4 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi! > -----Urspr=FCngliche Nachricht----- > Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 > Gesendet: Donnerstag, 1. Dezember 2005 17:26 > An: Markus Wollny > Cc: pgsql-performance@postgresql.org > Betreff: Re: [PERFORM] Queries taking ages in PG 8.1, have=20 > been much faster in PG<=3D8.0=20 =20 > It looks like "set enable_nestloop =3D 0" might be a workable=20 > hack for the immediate need. =20 > > Once you're not under deadline,=20 > I'd like to investigate more closely to find out why 8.1 does=20 > worse than 8.0 here. I've just set up a PostgreSQL 8.0.3 installation ... select version(); version -------------------------------------------------------------------------= ------------------- PostgreSQL 8.0.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5 = (Debian 1:3.3.5-13) (1 row) ...and restored a dump there; here's the explain analyze of the query = for 8.0.3: = QUERY PLAN -------------------------------------------------------------------------= -------------------------------------------------------------------------= ----------------- Sort (cost=3D5193.63..5193.63 rows=3D3 width=3D16) (actual = time=3D7365.107..7365.110 rows=3D3 loops=3D1) Sort Key: source."position" -> HashAggregate (cost=3D5193.59..5193.60 rows=3D3 width=3D16) = (actual time=3D7365.034..7365.041 rows=3D3 loops=3D1) -> Nested Loop (cost=3D0.00..5193.57 rows=3D3 width=3D16) = (actual time=3D3190.642..7300.820 rows=3D11086 loops=3D1) -> Nested Loop (cost=3D0.00..3602.44 rows=3D4 = width=3D20) (actual time=3D3169.968..5875.153 rows=3D11087 loops=3D1) -> Nested Loop (cost=3D0.00..1077.95 rows=3D750 = width=3D16) (actual time=3D36.599..2778.129 rows=3D158288 loops=3D1) -> Seq Scan on handy_java source = (cost=3D0.00..1.03 rows=3D3 width=3D14) (actual time=3D6.503..6.514 = rows=3D3 loops=3D1) -> Index Scan using idx02_performance on = answer (cost=3D0.00..355.85 rows=3D250 width=3D8) (actual = time=3D10.071..732.746 rows=3D52763 loops=3D3) Index Cond: ((answer.question_id =3D = 16) AND (answer.value =3D "outer".id)) -> Index Scan using pk_participant on participant = (cost=3D0.00..3.35 rows=3D1 width=3D4) (actual time=3D0.016..0.016 = rows=3D0 loops=3D158288) Index Cond: (participant.session_id =3D = "outer".session_id) Filter: ((status =3D 1) AND = (date_trunc('month'::text, created) =3D date_trunc('month'::text, (now() = - '2 mons'::interval)))) -> Index Scan using idx_answer_session_id on answer = (cost=3D0.00..397.77 rows=3D1 width=3D4) (actual time=3D0.080..0.122 = rows=3D1 loops=3D11087) Index Cond: ("outer".session_id =3D = answer.session_id) Filter: ((question_id =3D 6) AND (value =3D 1)) Total runtime: 7365.461 ms (16 rows) Does this tell you anything useful? It's not on the same machine, mind = you, but configuration for PostgreSQL is absolutely identical (apart = from the autovacuum-lines which 8.0.3 doesn't like). Kind regards Markus ------_=_NextPart_001_01C5F8D6.12F298F4 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] Queries taking ages in PG 8.1, have been much = faster in PG<=3D8.0

Hi!

> -----Urspr=FCngliche Nachricht-----
> Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Gesendet: Donnerstag, 1. Dezember 2005 17:26
> An: Markus Wollny
> Cc: pgsql-performance@postgresql.org
> Betreff: Re: [PERFORM] Queries taking ages in PG 8.1, have
> been much faster in PG<=3D8.0

> It looks like "set enable_nestloop =3D 0" might be a = workable
> hack for the immediate need. 
>
> Once you're not under deadline,
> I'd like to investigate more closely to find out why 8.1 does
> worse than 8.0 here.


I've just set up a PostgreSQL 8.0.3 installation ...

select version();
            &= nbsp;           &n= bsp;           &nb= sp;     version
-------------------------------------------------------------------------= -------------------
 PostgreSQL 8.0.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) = 3.3.5 (Debian 1:3.3.5-13)
(1 row)

...and restored a dump there; here's the explain analyze of the query = for 8.0.3:

            &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =    QUERY PLAN
-------------------------------------------------------------------------= -------------------------------------------------------------------------= -----------------
 Sort  (cost=3D5193.63..5193.63 rows=3D3 width=3D16) (actual = time=3D7365.107..7365.110 rows=3D3 loops=3D1)
   Sort Key: source."position"
   ->  HashAggregate  (cost=3D5193.59..5193.60 = rows=3D3 width=3D16) (actual time=3D7365.034..7365.041 rows=3D3 = loops=3D1)
         ->  Nested = Loop  (cost=3D0.00..5193.57 rows=3D3 width=3D16) (actual = time=3D3190.642..7300.820 rows=3D11086 loops=3D1)
            &= nbsp;  ->  Nested Loop  (cost=3D0.00..3602.44 rows=3D4 = width=3D20) (actual time=3D3169.968..5875.153 rows=3D11087 = loops=3D1)
            &= nbsp;        ->  Nested = Loop  (cost=3D0.00..1077.95 rows=3D750 width=3D16) (actual = time=3D36.599..2778.129 rows=3D158288 loops=3D1)
            &= nbsp;           &n= bsp;  ->  Seq Scan on handy_java source  = (cost=3D0.00..1.03 rows=3D3 width=3D14) (actual time=3D6.503..6.514 = rows=3D3 loops=3D1)
            &= nbsp;           &n= bsp;  ->  Index Scan using idx02_performance on = answer  (cost=3D0.00..355.85 rows=3D250 width=3D8) (actual = time=3D10.071..732.746 rows=3D52763 loops=3D3)
            &= nbsp;           &n= bsp;        Index Cond: = ((answer.question_id =3D 16) AND (answer.value =3D = "outer".id))
            &= nbsp;        ->  Index Scan = using pk_participant on participant  (cost=3D0.00..3.35 rows=3D1 = width=3D4) (actual time=3D0.016..0.016 rows=3D0 loops=3D158288)
            &= nbsp;           &n= bsp;  Index Cond: (participant.session_id =3D = "outer".session_id)
            &= nbsp;           &n= bsp;  Filter: ((status =3D 1) AND (date_trunc('month'::text, = created) =3D date_trunc('month'::text, (now() - '2 = mons'::interval))))
            &= nbsp;  ->  Index Scan using idx_answer_session_id on = answer  (cost=3D0.00..397.77 rows=3D1 width=3D4) (actual = time=3D0.080..0.122 rows=3D1 loops=3D11087)
            &= nbsp;        Index Cond: = ("outer".session_id =3D answer.session_id)
            &= nbsp;        Filter: ((question_id = =3D 6) AND (value =3D 1))
 Total runtime: 7365.461 ms
(16 rows)

Does this tell you anything useful? It's not on the same machine, mind = you, but configuration for PostgreSQL is absolutely identical (apart = from the autovacuum-lines which 8.0.3 doesn't like).

Kind regards

   Markus

------_=_NextPart_001_01C5F8D6.12F298F4-- From pgsql-performance-owner@postgresql.org Sun Dec 4 14:31:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 77AD49DCAA9 for ; Sun, 4 Dec 2005 14:31:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49995-05 for ; Sun, 4 Dec 2005 14:31:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 19CEE9DCA9F for ; Sun, 4 Dec 2005 14:31:34 -0400 (AST) 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 jB4IVXuV008927; Sun, 4 Dec 2005 13:31:33 -0500 (EST) To: "Markus Wollny" cc: pgsql-performance@postgresql.org Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 In-reply-to: <28011CD60FB1724DBA4442E38277F626114E3A@hermes.computec.de> References: <18959924631B864DB8D5268D81D746A90CCE2DD9@hermes.computec.de> <28011CD60FB1724DBA4442E38277F626114E3A@hermes.computec.de> Comments: In-reply-to "Markus Wollny" message dated "Sun, 04 Dec 2005 14:24:37 +0100" Date: Sun, 04 Dec 2005 13:31:33 -0500 Message-ID: <8926.1133721093@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/116 X-Sequence-Number: 15937 "Markus Wollny" writes: >> Once you're not under deadline, >> I'd like to investigate more closely to find out why 8.1 does >> worse than 8.0 here. > Does this tell you anything useful? It's not on the same machine, mind > you, but configuration for PostgreSQL is absolutely identical (apart > from the autovacuum-lines which 8.0.3 doesn't like). The data is not quite the same, right? I notice different numbers of rows being returned. But anyway, it seems the problem is with the upper scan on "answers", which 8.0 does like this: -> Index Scan using idx_answer_session_id on answer (cost=0.00..397.77 rows=1 width=4) (actual time=0.080..0.122 rows=1 loops=11087) Index Cond: ("outer".session_id = answer.session_id) Filter: ((question_id = 6) AND (value = 1)) and 8.1 does like this: -> Bitmap Heap Scan on answer (cost=185.85..187.26 rows=1 width=4) (actual time=197.490..197.494 rows=1 loops=9806) Recheck Cond: (("outer".session_id = answer.session_id) AND (answer.question_id = 6) AND (answer.value = 1)) -> BitmapAnd (cost=185.85..185.85 rows=1 width=0) (actual time=197.421..197.421 rows=0 loops=9806) -> Bitmap Index Scan on idx_answer_session_id (cost=0.00..2.83 rows=236 width=0) (actual time=0.109..0.109 rows=49 loops=9806) Index Cond: ("outer".session_id = answer.session_id) -> Bitmap Index Scan on idx02_performance (cost=0.00..182.77 rows=20629 width=0) (actual time=195.742..195.742 rows=165697 loops=9806) Index Cond: ((question_id = 6) AND (value = 1)) It seems that checking question_id/value via the index, rather than directly on the fetched tuple, is a net loss here. It looks like 8.1 would have made the right plan choice if it had made a better estimate of the combined selectivity of the question_id and value conditions, so ultimately this is another manifestation of the lack of cross-column statistics. What I find interesting though is that the plain index scan in 8.0 is so enormously cheaper than it's estimated to be. Perhaps the answer table in your 8.0 installation is almost perfectly ordered by session_id? Are you using default values for the planner cost parameters? It looks like reducing random_page_cost would help bring the planner estimates into line with reality on your machines. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Dec 4 18:19:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F00D39DCAA9 for ; Sun, 4 Dec 2005 18:19:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30134-07 for ; Sun, 4 Dec 2005 18:19:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id A0A2F9DCA9F for ; Sun, 4 Dec 2005 18:19:03 -0400 (AST) Received: from mailhub2.une.edu.au (mailhub.une.edu.au [129.180.1.142]) by svr2.postgresql.org (Postfix) with ESMTP id BA2D8F0B5E for ; Sun, 4 Dec 2005 22:19:05 +0000 (GMT) Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) by mailhub2.une.edu.au (Postfix) with ESMTP id D89FD7F50; Mon, 5 Dec 2005 09:18:55 +1100 (EST) Received: from kgb (unknown [129.180.47.225]) by icarus.une.edu.au (Postfix) with SMTP id 9C4AC3544EE; Mon, 5 Dec 2005 09:18:55 +1100 (EST) Date: Mon, 05 Dec 2005 09:24:51 +1100 From: Klint Gore To: Rodrigo Madera Cc: pgsql-performance@postgresql.org Subject: Re: Faster db architecture for a twisted table. In-Reply-To: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> References: <3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com> Message-Id: <43936CB3FB.5E5FKG@129.180.47.120> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver 1.25.06 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200512/117 X-Sequence-Number: 15938 On Sat, 3 Dec 2005 23:00:21 +0000, Rodrigo Madera wrote: > Imagine a table named Person with "first_name" and "age". > > Now let's make it fancy and put a "mother" and "father" field that is > a reference to the own table (Person). And to get even fuzzier, let's > drop in some siblings: > > CREATE TABLE person( > id bigint PRIMARY KEY, > first_name TEXT, > age INT, > mother bigint REFERENCES person, > father biging REFERENCES person, > siblings array of bigints (don't remember the syntax, but you get the point) > ); > > Well, this is ok, but imagine a search for "brothers of person id > 34". We would have to search inside the record's 'siblings' array. Is > this a bad design? is this going to be slow? Do you need the array at all? alter table person add column gender; select id >from person where gender = 'male' and (mother = (select mother from person where id = 34) OR father = (select father from person where id = 34)) You can change the OR depending if you want half brothers or not > What would be a better design to have these kind of relationships? > (where you need several references to rows inside the table we are). We use that structure (without the sibiling array) for our systems. Siblings are calculated from parents (in our case, livestock, there can be hundreds). You have to be prepared to use recursive functions and make sure that a person doesnt appear anywhere higher in their family tree. klint. +---------------------------------------+-----------------+ : Klint Gore : "Non rhyming : : EMail : kg@kgb.une.edu.au : slang - the : : Snail : A.B.R.I. : possibilities : : Mail University of New England : are useless" : : Armidale NSW 2351 Australia : L.J.J. : : Fax : +61 2 6772 5376 : : +---------------------------------------+-----------------+ From pgsql-performance-owner@postgresql.org Sun Dec 4 23:20:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 37ADA9DD97B for ; Sun, 4 Dec 2005 23:19:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73963-01-3 for ; Sun, 4 Dec 2005 23:19:58 -0400 (AST) X-Greylist: delayed 03:30:33.183601 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 1C0299DD981 for ; Sun, 4 Dec 2005 23:19:51 -0400 (AST) Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by svr2.postgresql.org (Postfix) with ESMTP id D61ECF5964 for ; Sun, 4 Dec 2005 23:49:20 +0000 (GMT) Received: from rory by localhost.localdomain with local (Exim 4.54) id 1Ej3bq-0003Oc-Lu; Sun, 04 Dec 2005 23:49:34 +0000 Date: Sun, 4 Dec 2005 23:49:34 +0000 From: Rory Campbell-Lange To: pgsql-performance@postgresql.org Subject: Dividing up a single 250GB RAID10 server for postgres Message-ID: <20051204234934.GA12887@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200512/118 X-Sequence-Number: 15939 Hi. We have a server provided for a test of a web application with the following specifications: 1 Dual core 1.8GHz Opteron chip 6 GB RAM approx 250GB of RAID10 storage (LSI card + BBU, 4 x 15000 RPM,16MB Cache SCSI disks) The database itself is very unlikely to use up more than 50GB of storage -- however we are going to be storing pictures and movies etc etc on the server. I understand that it is better to run pg_xlog on a separate spindle but we don't have that option available at present. Normally I use ext3. I wondered if I should make my normal partitions and then make a +/- 200GB LVM VG and then slice that initially into a 100GB ext3 data directory and a 50GB xfs postgres data area, giving 100GB to use between these as they grow. I haven't used LVM with xfs before, however. Advice gratefully received. Rory From pgsql-performance-owner@postgresql.org Tue Dec 6 23:56:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 132C59DCCF1 for ; Mon, 5 Dec 2005 03:56:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08786-06 for ; Mon, 5 Dec 2005 03:56:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx.lewisgroup.co.za (mx.lewisgroup.co.za [196.23.48.205]) by postgresql.org (Postfix) with ESMTP id 366199DCC1B for ; Mon, 5 Dec 2005 03:53:02 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5F96F.7A430C72" X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Query Fails with error calloc - Cannot alocate memory Date: Mon, 5 Dec 2005 09:42:43 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Query Fails with error calloc - Cannot alocate memory Thread-Index: AcMsNMkuix5U5pgmEden8AACpVEtXACM70dQ From: "Howard Oblowitz" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/213 X-Sequence-Number: 16034 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5F96F.7A430C72 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi ... I am trying to run a query that selects 26 million rows from a table with 68 byte rows. When run on the Server via psql the following error occurs: calloc : Cannot allocate memory When run via ODBC from Cognos Framework Manager only works if we limit the retrieval to 3 million rows. I notice that the memory used by the query when run on the Server increases to about 2.4 GB before the query fails. Postgres version is 7.3.4 Running on Linux Redhat 7.2 4 GB memory 7 Processor 2.5 Ghz Shmmax set to 2 GB Configuration Parameters Shared Buffers 12 288 Max Connections 16 Wal buffers 24 Sort Mem 40960 Vacuum Mem 80192 Checkpoint Timeout 600 Enable Seqscan false Effective Cache Size 200000 Results of explain analyze and expain analyze verbose: explain analyze select * from flash_by_branches; QUERY PLAN =20 ------------------------------------------------------------------------ ---------------------------------------------------------------------- Seq Scan on flash_by_branches (cost=3D100000000.00..100567542.06 rows=3D26854106 width=3D68) (actual time=3D12.14..103936.35 = rows=3D26854106 loops=3D1) Total runtime: 122510.02 msec (2 rows) explain analyze verbose: { SEQSCAN :startup_cost 100000000.00 :total_cost 100567542.06 :rows 26854106 :width 68 :qptargetlist ( { TARGETENTRY :resdom { RESDOM :resno 1 :restype 1043 :restypmod 8 :resname br_code :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { VAR :varno 1 :varattno 1 :vartype 1043 :vartypmod 8 :varlevelsup 0 :varnoold 1 :varoattno 1 } } { TARGETENTRY :resdom { RESDOM :resno 2 :restype 23 :restypmod -1 :resname fty_code :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { VAR :varno 1 :varattno 2 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2 } } { TARGETENTRY :resdom { RESDOM :resno 3 :restype 1082 :restypmod -1 :resname period :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { VAR :varno 1 :varattno 3 :vartype 1082 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 3 } } { TARGETENTRY :resdom { RESDOM :resno 4 :restype 1700 :restypmod 786436 :resname value :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { VAR :varno 1 :varattno 4 :vartype 1700 :vartypmod 786436 :varlevelsup 0 :varnoold 1 :varoattno 4 } } { TARGETENTRY :resdom { RESDOM :resno 7 :restype 1700 :restypmod 786438 :resname value1 :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { VAR :varno 1 :varattno 7 :vartype 1700 :vartypmod 786438 :varlevelsup 0 :varnoold 1 :varoattno 7 } } ) :qpqual <> :lefttree <> :righttree <> :extprm () :locprm () :initplan <> :nprm 0 :scanrelid 1 } Seq Scan on flash_by_branches (cost=3D100000000.00..100567542.06 rows=3D26854106 width=3D68) (actual time=3D6.59..82501.15 rows=3D2685 4106 loops=3D1) Total runtime: 102089.00 msec (196 rows) Please assist. Thanks, Howard Oblowitz --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.859 / Virus Database: 585 - Release Date: 14/02/2005 =20 ------_=_NextPart_001_01C5F96F.7A430C72 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Query Fails with error calloc - Cannot alocate memory

Hi

I am = trying to run a query that selects 26 million rows from = a

table = with 68 byte rows.

When = run on the Server via psql the following error occurs:

calloc : Cannot allocate memory

When = run via ODBC from Cognos Framework Manager only works

if we = limit the retrieval to 3 million rows.

I = notice that the memory used by the query when run on the Server = increases

to = about 2.4 GB before the query fails.

Postgres version is 7.3.4

Running on Linux Redhat 7.2

4 GB = memory

7 = Processor 2.5 Ghz

Shmmax set to 2 GB

Configuration Parameters

Shared Buffers  =         =         12 288

Max = Connections =         = 16

Wal = buffers     =         =         =         = 24

Sort = Mem        =         =         =         = 40960

Vacuum = Mem      =         =         80192

Checkpoint Timeout      =         600

Enable Seqscan  =         = false

Effective Cache Size    = 200000


Results of explain analyze and expain analyze = verbose:

explain analyze select * from = flash_by_branches;

         &nbs= p;            = ;            =             &= nbsp;           &n= bsp;       QUERY = PLAN           &nb= sp;           &nbs= p;            = ;            =  

----------------------------------------------------------= -------------------------------------------------------------------------= -----------

 Seq Scan on flash_by_branches  = (cost=3D100000000.00..100567542.06 rows=3D26854106 width=3D68) (actual = time=3D12.14..103936.35 rows=3D26854106 loops=3D1)

 Total runtime: 122510.02 msec

(2 = rows)

explain analyze verbose:

{ = SEQSCAN

    :startup_cost = 100000000.00

    :total_cost = 100567542.06

    :rows 26854106

    :width 68

    :qptargetlist (

       { = TARGETENTRY

       = :resdom

          { = RESDOM

          = :resno 1

          = :restype 1043

          = :restypmod 8

          = :resname br_code

          = :reskey 0

          = :reskeyop 0

          = :ressortgroupref 0

          = :resjunk false

          = }

       = :expr

          { = VAR

          = :varno 1

          = :varattno 1

          = :vartype 1043

          = :vartypmod 8

          = :varlevelsup 0

          = :varnoold 1

          = :varoattno 1

          = }

       }

       { = TARGETENTRY

       = :resdom

          { = RESDOM

          = :resno 2

          = :restype 23

          = :restypmod -1

          = :resname fty_code

          = :reskey 0

          = :reskeyop 0

          = :ressortgroupref 0

          = :resjunk false

          = }

       = :expr

          { = VAR

          = :varno 1

          = :varattno 2

          = :vartype 23

          = :vartypmod -1

          = :varlevelsup 0

          = :varnoold 1

          = :varoattno 2

        = }

       }

       { = TARGETENTRY

       = :resdom

          { = RESDOM

          = :resno 3

          = :restype 1082

          = :restypmod -1

          = :resname period

          = :reskey 0

          = :reskeyop 0

          = :ressortgroupref 0

          = :resjunk false

          = }

       = :expr

          { = VAR

          = :varno 1

          = :varattno 3

          = :vartype 1082

          = :vartypmod -1

          = :varlevelsup 0

          = :varnoold 1

          = :varoattno 3

          = }

       }

       { = TARGETENTRY

       = :resdom

          { = RESDOM

          = :resno 4

          = :restype 1700

          = :restypmod 786436

          = :resname value

          = :reskey 0

          = :reskeyop 0

          = :ressortgroupref 0

          = :resjunk false

          = }

       = :expr

          { = VAR

          = :varno 1

          = :varattno 4

          = :vartype 1700

          = :vartypmod 786436

          = :varlevelsup 0

          = :varnoold 1

          = :varoattno 4

          = }

       }

       { = TARGETENTRY

       = :resdom

      { RESDOM

          = :resno 7

          = :restype 1700

          = :restypmod 786438

          = :resname value1

          = :reskey 0

          = :reskeyop 0

          = :ressortgroupref 0

          = :resjunk false

          = }

       = :expr

          { = VAR

          = :varno 1

          = :varattno 7

          = :vartype 1700

          = :vartypmod 786438

          = :varlevelsup 0

          = :varnoold 1

          = :varoattno 7

          = }

       }

    )

    :qpqual <>

    :lefttree <>

    :righttree <>

    :extprm ()

    :locprm ()

    :initplan <>

    :nprm 0

    :scanrelid 1

    }

 Seq Scan on flash_by_branches  = (cost=3D100000000.00..100567542.06 rows=3D26854106 width=3D68) (actual = time=3D6.59..82501.15 rows=3D2685

4106 = loops=3D1)

 Total runtime: 102089.00 msec

(196 = rows)



Please assist.

Thanks,

Howard Oblowitz



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.859 / Virus Database: 585 - Release Date: 14/02/2005
 

------_=_NextPart_001_01C5F96F.7A430C72-- From pgsql-performance-owner@postgresql.org Mon Dec 5 06:29:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D50729DCAB8 for ; Mon, 5 Dec 2005 06:29:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30812-08 for ; Mon, 5 Dec 2005 06:29:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgw.computec.de (smtpgw.computec.de [212.123.108.8]) by postgresql.org (Postfix) with ESMTP id 838229DCAAC for ; Mon, 5 Dec 2005 06:28:56 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id 11BC655A5D; Mon, 5 Dec 2005 11:28:56 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04249-01-2; Mon, 5 Dec 2005 11:28:55 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id 50E16559D7; Mon, 5 Dec 2005 11:28:55 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Mon, 5 Dec 2005 11:28:54 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F6264A69CD@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Thread-Index: AcX5AN3qBuO5QRTdSqCDKp1mHFnW2gAgG1/A From: "Markus Wollny" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/119 X-Sequence-Number: 15940 Hi!=20 > -----Urspr=FCngliche Nachricht----- > Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 > Gesendet: Sonntag, 4. Dezember 2005 19:32 > An: Markus Wollny > Cc: pgsql-performance@postgresql.org > Betreff: Re: [PERFORM] Queries taking ages in PG 8.1, have=20 > been much faster in PG<=3D8.0=20 > The data is not quite the same, right? I notice different=20 > numbers of rows being returned. =20 No, you're right, I didn't manage to restore the 8.1 dump into the 8.0.3 = cluster, so I took the quick route and restored the last dump from my = 8.0 installation. The numbers should be roughly within the same range, = though: Table answer has got 8,646,320 rows (counted and estimated, as this db = is not live, obviously), table participant has got 173,998 rows; for = comparison: The production db had an estimated 8,872,130, counted 8,876,648 rows for = table answer, and estimated 178,165, counted 178,248 rows for = participant. As the numbers are a mere 2% apart, I should think that = this wouldn't make that much difference. > It seems that checking question_id/value via the index,=20 > rather than directly on the fetched tuple, is a net loss=20 > here. It looks like 8.1 would have made the right plan=20 > choice if it had made a better estimate of the combined=20 > selectivity of the question_id and value conditions, so=20 > ultimately this is another manifestation of the lack of=20 > cross-column statistics. What I find interesting though is=20 > that the plain index scan in 8.0 is so enormously cheaper=20 > than it's estimated to be. Perhaps the answer table in your=20 > 8.0 installation is almost perfectly ordered by session_id? Not quite - there may be several concurrent sessions at any one time, = but ordinarily the answers for one session-id would be quite close = together, in a lot of cases even in perfect sequence, so "almost = perfectly" might be a fair description, depending on the exact = definition of "almost" :) > Are you using default values for the planner cost parameters?=20 I have to admit that I did tune the random_page_cost and = effective_cache_size settings ages ago (7.1-ish) to a value that seemed = to work best then - and didn't touch it ever since, although my data = pool has grown quite a bit over time. cpu_tuple_cost, = cpu_index_tuple_cost and cpu_operator_cost are using default values. > It looks like reducing random_page_cost would help bring the=20 > planner estimates into line with reality on your machines. I had set random_page_cost to 1.4 already, so I doubt that it would do = much good to further reduce the value - reading the docs and the = suggestions for tuning I would have thought that I should actually = consider increasing this value a bit, as not all of my data will fit in = memory any more. Do you nevertheless want me to try what happens if I = reduce random_page_cost even further? Kind regards Markus From pgsql-performance-owner@postgresql.org Mon Dec 5 09:47:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E63899DCC56 for ; Mon, 5 Dec 2005 09:47:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51828-09 for ; Mon, 5 Dec 2005 09:47:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id EA0DD9DCBB4 for ; Mon, 5 Dec 2005 09:47:31 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 7521C321BE; Mon, 5 Dec 2005 14:47:34 +0100 (MET) From: Olleg Samoylov X-Newsgroups: pgsql.performance Subject: BLCKSZ Date: Mon, 05 Dec 2005 16:47:31 +0300 Organization: Moscow Institute of Physics and Technology Lines: 15 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Debian Thunderbird 1.0.7 (X11/20051019) X-Accept-Language: en-us, en To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/120 X-Sequence-Number: 15941 src/include/pg_config_manual.h define BLCKSZ 8196 (8kb). Somewhere I readed BLCKSZ must be equal to memory page of operational system. And default BLCKSZ 8kb because first OS where postgres was build has memory page size 8kb. I try to test this. Linux, memory page 4kb, disk page 4kb. I set BLCKSZ to 4kb. I get some performance improve, but not big, may be because I have 4Gb on test server (amd64). Can anyone test it also? May be better move BLCKSZ from pg_config_manual.h to pg_config.h? -- Olleg Samoylov From pgsql-performance-owner@postgresql.org Mon Dec 5 09:56:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 047919DCBAE for ; Mon, 5 Dec 2005 09:56:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57059-01 for ; Mon, 5 Dec 2005 09:57:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id AE4729DCAAC for ; Mon, 5 Dec 2005 09:56:54 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B1D3A321BE; Mon, 5 Dec 2005 14:56:58 +0100 (MET) From: Olleg Samoylov X-Newsgroups: pgsql.performance Subject: Re: two disks - best way to use them? Date: Mon, 05 Dec 2005 16:56:55 +0300 Organization: Moscow Institute of Physics and Technology Lines: 13 Message-ID: References: <00fb01c5f772$59471410$0200a8c0@dell8200> 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: Debian Thunderbird 1.0.7 (X11/20051019) X-Accept-Language: en-us, en In-Reply-To: <00fb01c5f772$59471410$0200a8c0@dell8200> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.291 required=5 tests=[AWL=0.291] X-Spam-Score: 0.291 X-Spam-Level: X-Archive-Number: 200512/121 X-Sequence-Number: 15942 Rick Schumeyer wrote: > 1) the input data file > 2) the pg table > 3) the WAL And journal of file system, especially if you not set "noatime" mount option. WAL and file system journal like to make sync. IMHO: on first disk (raid mirror:)) I place /, pg_table and file system journal from second disk. On second /var and pg tables. Thus first disc is synced time to time, second not. -- Olleg Samoylov From pgsql-performance-owner@postgresql.org Mon Dec 5 10:32:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 535409DCAA8 for ; Mon, 5 Dec 2005 10:32:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61661-06 for ; Mon, 5 Dec 2005 10:32:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 28C899DCAA5 for ; Mon, 5 Dec 2005 10:32:50 -0400 (AST) 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 jB5EWr3O029238; Mon, 5 Dec 2005 09:32:54 -0500 (EST) To: "Markus Wollny" cc: pgsql-performance@postgresql.org Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 In-reply-to: <28011CD60FB1724DBA4442E38277F6264A69CD@hermes.computec.de> References: <28011CD60FB1724DBA4442E38277F6264A69CD@hermes.computec.de> Comments: In-reply-to "Markus Wollny" message dated "Mon, 05 Dec 2005 11:28:54 +0100" Date: Mon, 05 Dec 2005 09:32:53 -0500 Message-ID: <29237.1133793173@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/122 X-Sequence-Number: 15943 "Markus Wollny" writes: >> ... What I find interesting though is >> that the plain index scan in 8.0 is so enormously cheaper >> than it's estimated to be. Perhaps the answer table in your >> 8.0 installation is almost perfectly ordered by session_id? > Not quite - there may be several concurrent sessions at any one time, but ordinarily the answers for one session-id would be quite close together, in a lot of cases even in perfect sequence, so "almost perfectly" might be a fair description, depending on the exact definition of "almost" :) Could we see the pg_stats row for answer.session_id in both 8.0 and 8.1? > I had set random_page_cost to 1.4 already, so I doubt that it would do much good to further reduce the value - reading the docs and the suggestions for tuning I would have thought that I should actually consider increasing this value a bit, as not all of my data will fit in memory any more. Do you nevertheless want me to try what happens if I reduce random_page_cost even further? No, that's probably quite low enough already ... regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 5 10:44:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ED4809DCAA5 for ; Mon, 5 Dec 2005 10:44:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61421-09 for ; Mon, 5 Dec 2005 10:44:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgw.computec.de (smtpgw.computec.de [212.123.108.8]) by postgresql.org (Postfix) with ESMTP id 755049DCAE5 for ; Mon, 5 Dec 2005 10:44:50 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id 78BAA559DB; Mon, 5 Dec 2005 15:44:55 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10357-02-34; Mon, 5 Dec 2005 15:44:55 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id 02CFE559D2; Mon, 5 Dec 2005 15:44:55 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Mon, 5 Dec 2005 15:44:54 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F6264A6BD5@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: AW: [PERFORM] Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Thread-Index: AcX5qLBygbWGWsU6Sj6hZyQSta1vmQAAEPgg From: "Markus Wollny" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.96 required=5 tests=[AWL=-0.960, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 0.96 X-Spam-Level: X-Archive-Number: 200512/123 X-Sequence-Number: 15944 =20 > -----Urspr=FCngliche Nachricht----- > Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 > Gesendet: Montag, 5. Dezember 2005 15:33 > An: Markus Wollny > Cc: pgsql-performance@postgresql.org > Betreff: Re: AW: [PERFORM] Queries taking ages in PG 8.1,=20 > have been much faster in PG<=3D8.0=20 =20 > Could we see the pg_stats row for answer.session_id in both=20 > 8.0 and 8.1? Here you are: select null_frac , avg_width , n_distinct , most_common_vals , most_common_freqs , histogram_bounds , Correlation from pg_stats where schemaname =3D 'survey' and tablename =3D 'answer' and attname =3D 'session_id'; 8.1: null_frac 0 avg_width 4 n_distinct 33513 most_common_vals = {1013854,1017890,1021551,1098817,764249,766938,776353,780954,782232,78598= 5} most_common_freqs = {0.001,0.001,0.001,0.001,0.000666667,0.000666667,0.000666667,0.000666667,= 0.000666667,0.000666667} histogram_bounds = {757532,819803,874935,938170,1014421,1081507,1164659,1237281,1288267,1331= 016,1368939} Correlation -0.0736492 8.0.3: null_frac 0 avg_width 4 n_distinct 29287 most_common_vals = {765411,931762,983933,1180453,1181959,1229963,1280249,1288736,1314970,764= 901} most_common_freqs = {0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.000666667} histogram_bounds = {757339,822949,875834,939085,1004782,1065251,1140682,1218336,1270024,1312= 170,1353082} Correlation -0.237136 Kind regards Markus From pgsql-performance-owner@postgresql.org Mon Dec 5 11:02:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9E9BE9DD596 for ; Mon, 5 Dec 2005 11:02:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70314-04 for ; Mon, 5 Dec 2005 11:02:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 0C8D49DD571 for ; Mon, 5 Dec 2005 11:02:39 -0400 (AST) 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 jB5F2c69029519; Mon, 5 Dec 2005 10:02:38 -0500 (EST) To: Olleg Samoylov cc: pgsql-performance@postgresql.org Subject: Re: BLCKSZ In-reply-to: References: Comments: In-reply-to Olleg Samoylov message dated "Mon, 05 Dec 2005 16:47:31 +0300" Date: Mon, 05 Dec 2005 10:02:38 -0500 Message-ID: <29518.1133794958@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200512/124 X-Sequence-Number: 15945 Olleg Samoylov writes: > I try to test this. Linux, memory page 4kb, disk page 4kb. I set BLCKSZ > to 4kb. I get some performance improve, but not big, may be because I > have 4Gb on test server (amd64). It's highly unlikely that reducing BLCKSZ is a good idea. There are bad side-effects on the maximum index entry size, maximum number of tuple fields, etc. In any case, when you didn't say *what* you tested, it's impossible to judge the usefulness of the change. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 5 11:11:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2B3969DCAAC for ; Mon, 5 Dec 2005 11:11:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71669-04 for ; Mon, 5 Dec 2005 11:11:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C4C7D9DCD64 for ; Mon, 5 Dec 2005 11:11:37 -0400 (AST) 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 jB5FBfC7029617; Mon, 5 Dec 2005 10:11:41 -0500 (EST) To: "Markus Wollny" cc: pgsql-performance@postgresql.org Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 In-reply-to: <28011CD60FB1724DBA4442E38277F6264A6BD5@hermes.computec.de> References: <28011CD60FB1724DBA4442E38277F6264A6BD5@hermes.computec.de> Comments: In-reply-to "Markus Wollny" message dated "Mon, 05 Dec 2005 15:44:54 +0100" Date: Mon, 05 Dec 2005 10:11:41 -0500 Message-ID: <29616.1133795501@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.012 required=5 tests=[AWL=0.012] X-Spam-Score: 0.012 X-Spam-Level: X-Archive-Number: 200512/125 X-Sequence-Number: 15946 "Markus Wollny" writes: >> Could we see the pg_stats row for answer.session_id in both >> 8.0 and 8.1? > Here you are: > 8.1: > Correlation -0.0736492 > 8.0.3: > Correlation -0.237136 Interesting --- if the 8.1 database is a dump and restore of the 8.0, you'd expect the physical ordering to be similar. Why is 8.1 showing a significantly lower correlation? That has considerable impact on the estimated cost of an indexscan (plain not bitmap), and so it might explain why 8.1 is mistakenly avoiding the indexscan ... regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 5 11:40:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 171949DCAAC for ; Mon, 5 Dec 2005 11:40:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76081-05 for ; Mon, 5 Dec 2005 11:40:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgw.computec.de (smtpgw.computec.de [212.123.108.8]) by postgresql.org (Postfix) with ESMTP id B1BE49DCAA8 for ; Mon, 5 Dec 2005 11:40:34 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id BAAE7559DF; Mon, 5 Dec 2005 16:40:39 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11803-01-63; Mon, 5 Dec 2005 16:40:39 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id 29AF7559DE; Mon, 5 Dec 2005 16:40:39 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Mon, 5 Dec 2005 16:40:38 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F6264A6C43@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Thread-Index: AcX5rhqelz8jkDwsSIeszzJIp1ZFrwAAGHxA From: "Markus Wollny" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.199 required=5 tests=[AWL=-0.720, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.199 X-Spam-Level: * X-Archive-Number: 200512/126 X-Sequence-Number: 15947 > -----Urspr=FCngliche Nachricht----- > Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 > Gesendet: Montag, 5. Dezember 2005 16:12 > An: Markus Wollny > Cc: pgsql-performance@postgresql.org > Betreff: Re: AW: AW: [PERFORM] Queries taking ages in PG 8.1,=20 > have been much faster in PG<=3D8.0=20 >=20 > "Markus Wollny" writes: > >> Could we see the pg_stats row for answer.session_id in=20 > both 8.0 and=20 > >> 8.1? >=20 > > Here you are: >=20 > > 8.1: > > Correlation -0.0736492 >=20 > > 8.0.3: > > Correlation -0.237136 >=20 > Interesting --- if the 8.1 database is a dump and restore of=20 > the 8.0, you'd expect the physical ordering to be similar. =20 I dumped the data from my 8.0.1 cluster on 2005-11-18 00:23 using = pg_dumpall with no further options; the dump was passed through iconv to = clear up some UTF-8 encoding issues, then restored into a fresh 8.1 = cluster where it went productive; I used the very same dump to restore = the 8.0.3 cluster. So there is a difference between the two datasets, an = additional 230.328 rows in the answers-table. > Why is 8.1 showing a significantly lower correlation? That=20 > has considerable impact on the estimated cost of an indexscan=20 > (plain not bitmap), and so it might explain why 8.1 is=20 > mistakenly avoiding the indexscan ... I just ran a vacuum analyze on the table, just to make sure that the = stats are up to date (forgot that on the previous run, thanks to = pg_autovacuum...), and the current correlation on the 8.1 installation = is now calculated as -0.158921. That's still more than twice the value = as for the 8.0-db. I don't know whether that is significant, though. Kind regards Markus From pgsql-performance-owner@postgresql.org Mon Dec 5 11:45:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BA8209DCAA8 for ; Mon, 5 Dec 2005 11:45:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74498-07 for ; Mon, 5 Dec 2005 11:45:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgw.computec.de (smtpgw.computec.de [212.123.108.8]) by postgresql.org (Postfix) with ESMTP id 6C1219DCADF for ; Mon, 5 Dec 2005 11:45:21 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id 3177855A69; Mon, 5 Dec 2005 16:45:26 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11803-01-82; Mon, 5 Dec 2005 16:45:25 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id C54F055A60; Mon, 5 Dec 2005 16:45:25 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Mon, 5 Dec 2005 16:45:25 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F6264A6C4E@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Thread-Index: AcX5rhqelz8jkDwsSIeszzJIp1ZFrwAAGHxAAAERLmA= From: "Markus Wollny" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.279 required=5 tests=[AWL=-0.640, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.279 X-Spam-Level: * X-Archive-Number: 200512/127 X-Sequence-Number: 15948 =20 > -----Urspr=FCngliche Nachricht----- > Von: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] Im Auftrag=20 > von Markus Wollny > Gesendet: Montag, 5. Dezember 2005 16:41 > An: Tom Lane > Cc: pgsql-performance@postgresql.org > Betreff: Re: [PERFORM] Queries taking ages in PG 8.1, have=20 > been much faster in PG<=3D8.0=20 > an additional 230.328 rows in the answers-table. That was supposed to read 230,328 rows, sorry. From pgsql-performance-owner@postgresql.org Mon Dec 5 11:47:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E265F9DCD0B for ; Mon, 5 Dec 2005 11:47:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74391-07 for ; Mon, 5 Dec 2005 11:48:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 5CA5B9DCD65 for ; Mon, 5 Dec 2005 11:47:56 -0400 (AST) Received: from fuse1.mailanyone.net (unknown [69.31.1.141]) by svr2.postgresql.org (Postfix) with ESMTP id 1BB87F0B1C for ; Mon, 5 Dec 2005 15:47:59 +0000 (GMT) Received: from mailanyone.net by fuse1.mailanyone.net with asmtp (TLSv1:AES256-SHA:256) (MailAnyone extSMTP) id 1EjIZB-0002Jd-OW for pgsql-performance@postgresql.org; Mon, 05 Dec 2005 09:47:51 -0600 Message-ID: <43946148.9010607@tgharold.com> Date: Mon, 05 Dec 2005 10:48:24 -0500 From: Thomas Harold User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728 X-Accept-Language: en-us, en, ja, zh-cn, zh-hk, zh-sg, zh-tw, ko, ko-kp, ko-kr MIME-Version: 1.0 Cc: pgsql-performance@postgresql.org Subject: Re: two disks - best way to use them? References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> In-Reply-To: <6.2.5.6.0.20051202145746.01dc7b68@earthlink.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, score=1.522 required=5 tests=[MISSING_HEADERS=0.189, RCVD_IN_BL_SPAMCOP_NET=1.332, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 1.522 X-Spam-Level: * X-Archive-Number: 200512/128 X-Sequence-Number: 15949 Ron wrote: > At 01:58 PM 12/2/2005, Rick Schumeyer wrote: > >> I installed another drive in my linux pc in an attempt to improve >> performance >> on a large COPY to a table with a geometry index. >> >> Based on previous discussion, it seems there are three things >> competing for the hard drive: >> >> 1) the input data file >> 2) the pg table >> 3) the WAL >> >> What is the best way to distribute these among two drives? From Tom's >> comments >> I would think that the pg table and the WAL should be separate. Does >> it matter where the input data is? > > > Best is to have 3 HD or HD sets, one for each of the above. > > With only 2, and assuming the input file is too large to fit completely > into RAM at once, I'd test to see whether: > a= input on one + pg table & WAL on the other, or > b= WAL on one + pg table & input file on the other > is best. > > If the input file can be made 100% RAM resident, then use > c= pg table on one + WAL and input file on the other. > > The big goal here is to minimize HD head seeks. (noob question incoming) Section 26.4 WAL Internals http://www.postgresql.org/docs/8.1/interactive/wal-internals.html This seems to be the applicable chapter. They talk about creating a symlink for the data/pg_xlog folder to point at another disk set. If I have (2) RAID1 sets with LVM2, can I instead create a logical volume on the 2nd disk set and just mount data/pg_xlog to point at the logical volume on the 2nd disk set? For example, I have an LVM on my primary mirror called 'pgsql'. And I've created a 2nd LVM on my secondary mirror called 'pgxlog'. These are mounted as: /dev/vgraida/pgsql on /var/lib/postgresql type ext3 (rw,noatime) /dev/vgraidb/pgxlog on /var/lib/postgresql/data/pg_xlog type ext3 (rw,noatime) From the application's P.O.V., it's the same thing, right? (It seems to be working, I'm just trying to double-check that I'm not missing something.) From pgsql-performance-owner@postgresql.org Mon Dec 5 12:18:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 120E79DCBAE for ; Mon, 5 Dec 2005 12:18:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78951-05 for ; Mon, 5 Dec 2005 12:18:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 1E1E89DCBD1 for ; Mon, 5 Dec 2005 12:15:51 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id D4B9D1AC3E9; Mon, 5 Dec 2005 08:16:06 -0800 (PST) Date: Mon, 5 Dec 2005 08:15:20 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Thomas Harold Cc: pgsql-performance@postgresql.org Subject: Re: two disks - best way to use them? In-Reply-To: <43946148.9010607@tgharold.com> Message-ID: References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> <43946148.9010607@tgharold.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/129 X-Sequence-Number: 15950 On Mon, 5 Dec 2005, Thomas Harold wrote: > (noob question incoming) > > Section 26.4 WAL Internals > http://www.postgresql.org/docs/8.1/interactive/wal-internals.html > > This seems to be the applicable chapter. They talk about creating a symlink > for the data/pg_xlog folder to point at another disk set. > > If I have (2) RAID1 sets with LVM2, can I instead create a logical volume on > the 2nd disk set and just mount data/pg_xlog to point at the logical volume > on the 2nd disk set? > > For example, I have an LVM on my primary mirror called 'pgsql'. And I've > created a 2nd LVM on my secondary mirror called 'pgxlog'. These are mounted > as: > > /dev/vgraida/pgsql on /var/lib/postgresql type ext3 (rw,noatime) > > /dev/vgraidb/pgxlog on /var/lib/postgresql/data/pg_xlog type ext3 > (rw,noatime) > > From the application's P.O.V., it's the same thing, right? (It seems to be > working, I'm just trying to double-check that I'm not missing something.) > the application can' tell the difference, but the reason for seperating them isn't for the application, it's so that different pieces of hardware can work on different things without having to bounce back and forth between them. useing the same drives with LVM doesn't achieve this goal. the problem is that the WAL is doing a LOT of writes, and postgres waits until each write is completed before going on to the next thing (for safety), if a disk is dedicated to the WAL then the head doesn't move much. if the disk is used for other things as well then the heads have to move across the disk surface between the WAL and where the data is. this drasticly slows down the number of items that can go into the WAL, and therefor slows down the entire system. this slowdown isn't even something as simple as cutting your speed in half (half the time spent working on the WAL, half spent on the data itself), it's more like 10% spent on the WAL, 10% spent on the data, and 80% moveing back and forth between them (I am probably wrong on the exact numbers, but it is something similarly drastic) this is also the reason why it's so good to have a filesystem journal on a different drive. David Lang From pgsql-performance-owner@postgresql.org Mon Dec 5 15:27:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6FC029DD64D for ; Mon, 5 Dec 2005 15:27:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19713-02 for ; Mon, 5 Dec 2005 15:27:21 -0400 (AST) X-Greylist: delayed 03:03:05.945243 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 4FD379DCD05 for ; Mon, 5 Dec 2005 15:27:17 -0400 (AST) Received: from talk.nabble.com (www.nabble.com [72.21.53.35]) by svr2.postgresql.org (Postfix) with ESMTP id EBF3BF0B32 for ; Mon, 5 Dec 2005 16:24:10 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=talk.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1EjJ8I-0002Mf-W9 for pgsql-performance@postgresql.org; Mon, 05 Dec 2005 08:24:07 -0800 Message-ID: <1797831.post@talk.nabble.com> Date: Mon, 5 Dec 2005 08:24:06 -0800 (PST) From: "Mirjam (sent by Nabble.com)" Reply-To: Mirjam To: pgsql-performance@postgresql.org Subject: Re: Best hardware In-Reply-To: <002701c56909$a5491720$0300a8c0@JAGLABLAPTOP> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_583_17857983.1133799846991" X-Nabble-Sender: Nabble Forums X-Nabble-From: Mirjam References: <002701c56909$a5491720$0300a8c0@JAGLABLAPTOP> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.333 required=5 tests=[HTML_MESSAGE=0.001, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.333 X-Spam-Level: * X-Archive-Number: 200512/131 X-Sequence-Number: 15952 ------=_Part_583_17857983.1133799846991 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello Bernd Jagla, Are you the Bernd from Berlin? I am looking for you and found your name on the internet. Would you please contact me? Mirjam Tilstra -- Sent from the PostgreSQL - performance forum at Nabble.com: http://www.nabble.com/Best-hardware-t49131.html#a1797831 ------=_Part_583_17857983.1133799846991 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hello Bernd Jagla,

Are you the Bernd from Berlin? I am looking for you and found your name on the internet. Would you please contact me?

Mirjam Tilstra

Sent from the PostgreSQL - performance forum at Nabble.com:
Re: Best hardware ------=_Part_583_17857983.1133799846991-- From pgsql-performance-owner@postgresql.org Mon Dec 5 12:45:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 91E879DCD00 for ; Mon, 5 Dec 2005 12:44:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83465-02 for ; Mon, 5 Dec 2005 12:44:57 -0400 (AST) X-Greylist: delayed 00:57:06.011565 by SQLgrey- Received: from fuse1.mailanyone.net (unknown [69.31.1.141]) by postgresql.org (Postfix) with ESMTP id 8D3E99DCD02 for ; Mon, 5 Dec 2005 12:44:56 -0400 (AST) Received: from mailanyone.net by fuse1.mailanyone.net with asmtp (TLSv1:AES256-SHA:256) (MailAnyone extSMTP) id 1EjJSM-0003Og-Ao for pgsql-performance@postgresql.org; Mon, 05 Dec 2005 10:44:50 -0600 Message-ID: <43946EA1.8090908@tgharold.com> Date: Mon, 05 Dec 2005 11:45:21 -0500 From: Thomas Harold User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728 X-Accept-Language: en-us, en, ja, zh-cn, zh-hk, zh-sg, zh-tw, ko, ko-kp, ko-kr MIME-Version: 1.0 CC: pgsql-performance@postgresql.org Subject: Re: two disks - best way to use them? References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> <43946148.9010607@tgharold.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.856 required=5 tests=[AWL=0.666, MISSING_HEADERS=0.189, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.856 X-Spam-Level: X-Archive-Number: 200512/130 X-Sequence-Number: 15951 David Lang wrote: > the application can' tell the difference, but the reason for seperating > them isn't for the application, it's so that different pieces of > hardware can work on different things without having to bounce back and > forth between them. > > useing the same drives with LVM doesn't achieve this goal. > > the problem is that the WAL is doing a LOT of writes, and postgres waits > until each write is completed before going on to the next thing (for > safety), if a disk is dedicated to the WAL then the head doesn't move > much. if the disk is used for other things as well then the heads have > to move across the disk surface between the WAL and where the data is. > this drasticly slows down the number of items that can go into the WAL, > and therefor slows down the entire system. > > this slowdown isn't even something as simple as cutting your speed in > half (half the time spent working on the WAL, half spent on the data > itself), it's more like 10% spent on the WAL, 10% spent on the data, and > 80% moveing back and forth between them (I am probably wrong on the > exact numbers, but it is something similarly drastic) Yeah, I don't think I was clear about the config. It's (4) disks setup as a pair of RAID1 sets. My original config was pgsql on the first RAID set (data and WAL). I'm now experimenting with putting the data/pg_xlog folder on the 2nd set of disks. Under the old setup (everything on the original RAID1 set, in a dedicated 32GB LVM volume), I was seeing 80-90% wait percentages in "top". My understanding is that this is an indicator of an overloaded / bottlenecked disk system. This was while doing massive inserts into a test table (millions of narrow rows). I'm waiting to see what happens once I have data/pg_xlog on the 2nd disk set. Thanks for the input. From pgsql-performance-owner@postgresql.org Mon Dec 5 16:17:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B4F069DD60F for ; Mon, 5 Dec 2005 16:17:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42168-02 for ; Mon, 5 Dec 2005 16:17:21 -0400 (AST) X-Greylist: delayed 03:12:19.134403 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 16E239DD61A for ; Mon, 5 Dec 2005 16:17:13 -0400 (AST) Received: from mailrelay.mobixell.com (unknown [62.219.168.154]) by svr2.postgresql.org (Postfix) with ESMTP id 5C78AF0B9A for ; Mon, 5 Dec 2005 17:04:52 +0000 (GMT) Received: from mobiexc.mobixell.com (owa2000.mobixell.com [10.0.0.1]) by mailrelay.mobixell.com (8.12.11/8.12.11) with ESMTP id jB5H2akF003186 for ; Mon, 5 Dec 2005 19:02:38 +0200 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_01C5F9BE.07BDC28A" Subject: Performance degradation after successive UPDATE's Date: Mon, 5 Dec 2005 19:05:01 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Performance degradation after successive UPDATE's Thread-Index: AcX5vgm8qDnYHyq2QT6AVBmrrNIZnQ== From: "Assaf Yaari" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/132 X-Sequence-Number: 15953 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5F9BE.07BDC28A Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. =20 My application updates counters in DB. I left a test over the night that increased counter of specific record. After night running (several hundreds of thousands updates), I found out that the time spent on UPDATE increased to be more than 1.5 second (at the beginning it was less than 10ms)! Issuing VACUUM ANALYZE and even reboot didn't seemed to solve the problem. =20 I succeeded to re-produce this with a simple test: =20 I created a very simple table that looks like that: CREATE TABLE test1 ( id int8 NOT NULL, counter int8 NOT NULL DEFAULT 0, CONSTRAINT "Test1_pkey" PRIMARY KEY (id) ) ; =20 I've inserted 15 entries and wrote a script that increase the counter of specific record over and over. The SQL command looks like this: UPDATE test1 SET counter=3Dnumber WHERE id=3D10; =20 At the beginning the UPDATE time was around 15ms. After ~90000 updates, the execution time increased to be more than 120ms. =20 1. What is the reason for this phenomena? 2. Is there anything that can be done in order to improve this? =20 Thanks, Assaf ------_=_NextPart_001_01C5F9BE.07BDC28A Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi,
 
I'm = using PostgreSQL=20 8.0.3 on Linux RedHat WS 3.0.
 
My = application=20 updates counters in DB. I left a test over the night that increased = counter of=20 specific record. After night running (several hundreds of thousands = updates), I=20 found out that the time spent on UPDATE increased to be more than 1.5 = second (at=20 the beginning it was less than 10ms)! Issuing VACUUM ANALYZE and even = reboot=20 didn't seemed to solve the problem.
 
I = succeeded to=20 re-produce this with a simple test:
 
I = created a very=20 simple table that looks like that:
CREATE = TABLE=20 test1
(
  id int8 NOT NULL,
  counter int8 NOT NULL = DEFAULT=20 0,
  CONSTRAINT "Test1_pkey" PRIMARY KEY (id)
) = ;
 
I've = inserted 15=20 entries and wrote a script that increase the counter of = specific=20 record over and over. The SQL command looks like = this:
UPDATE = test1 SET=20 counter=3Dnumber WHERE id=3D10;
 
At the = beginning the=20 UPDATE time was around 15ms. After ~90000 updates, the execution time = increased=20 to be more than 120ms.
 
1. = What is the=20 reason for this phenomena?
2. Is = there anything=20 that can be done in order to improve this?
 
Thanks,
Assaf
------_=_NextPart_001_01C5F9BE.07BDC28A-- From pgsql-performance-owner@postgresql.org Mon Dec 5 16:31:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 29FE79DCAF0 for ; Mon, 5 Dec 2005 16:31:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40561-09 for ; Mon, 5 Dec 2005 16:31:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 816359DCAAC for ; Mon, 5 Dec 2005 16:31:41 -0400 (AST) Received: (qmail 20429 invoked by uid 500); 5 Dec 2005 20:36:04 -0000 Date: Mon, 5 Dec 2005 14:36:04 -0600 From: Bruno Wolff III To: Assaf Yaari Cc: pgsql-performance@postgresql.org Subject: Re: Performance degradation after successive UPDATE's Message-ID: <20051205203604.GA19356@wolff.to> Mail-Followup-To: Bruno Wolff III , Assaf Yaari , pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.035 required=5 tests=[AWL=0.035] X-Spam-Score: 0.035 X-Spam-Level: X-Archive-Number: 200512/133 X-Sequence-Number: 15954 On Mon, Dec 05, 2005 at 19:05:01 +0200, Assaf Yaari wrote: > Hi, > > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. > > My application updates counters in DB. I left a test over the night that > increased counter of specific record. After night running (several > hundreds of thousands updates), I found out that the time spent on > UPDATE increased to be more than 1.5 second (at the beginning it was > less than 10ms)! Issuing VACUUM ANALYZE and even reboot didn't seemed to > solve the problem. You need to be running vacuum more often to get rid of the deleted rows (update is essentially insert + delete). Once you get too many, plain vacuum won't be able to clean them up without raising the value you use for FSM. By now the table is really bloated and you probably want to use vacuum full on it. From pgsql-performance-owner@postgresql.org Mon Dec 5 18:32:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B9C5C9DCAB1 for ; Mon, 5 Dec 2005 18:32:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63575-10 for ; Mon, 5 Dec 2005 18:32:08 -0400 (AST) X-Greylist: delayed 00:59:50.170504 by SQLgrey- Received: from lobnya.ru (gw.lobnya.ru [213.171.58.250]) by postgresql.org (Postfix) with ESMTP id D9CDF9DCD30 for ; Mon, 5 Dec 2005 18:32:03 -0400 (AST) Received: from [10.0.14.9] ([10.0.14.9] verified) by lobnya.ru (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 6318541; Tue, 06 Dec 2005 00:16:15 +0300 Message-ID: <4394B1D3.7000304@mail.ru> Date: Tue, 06 Dec 2005 00:32:03 +0300 From: Olleg Organization: Moscow Intitute of Physics and Technology User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane CC: pgsql-performance@postgresql.org Subject: Re: BLCKSZ References: <29518.1133794958@sss.pgh.pa.us> In-Reply-To: <29518.1133794958@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/135 X-Sequence-Number: 15956 Tom Lane wrote: > Olleg Samoylov writes: > >>I try to test this. Linux, memory page 4kb, disk page 4kb. I set BLCKSZ >>to 4kb. I get some performance improve, but not big, may be because I >>have 4Gb on test server (amd64). > > It's highly unlikely that reducing BLCKSZ is a good idea. There are bad > side-effects on the maximum index entry size, maximum number of tuple > fields, etc. Yes, when I set BLCKSZ=512, database dont' work. With BLCKSZ=1024 database very slow. (This was surprise me. I expect increase performance in 8 times with 1024 BLCKSZ. :) ) As I already see in this maillist, increase of BLCKSZ reduce performace too. May be exist optimum value? Theoretically BLCKSZ equal memory/disk page/block size may reduce defragmentation drawback of memory and disk. > In any case, when you didn't say *what* you tested, it's > impossible to judge the usefulness of the change. > regards, tom lane I test performace on database test server. This is copy of working billing system to test new features and experiments. Test task was one day traffic log. Average time of a one test was 260 minutes. Postgresql 7.4.8. Server dual Opteron 240, 4Gb RAM. -- Olleg From pgsql-performance-owner@postgresql.org Mon Dec 5 18:11:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF7809DCD56 for ; Mon, 5 Dec 2005 18:11:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59870-09 for ; Mon, 5 Dec 2005 18:11:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 8B6CC9DCD45 for ; Mon, 5 Dec 2005 18:11:52 -0400 (AST) Received: from ylpvm15.prodigy.net (ylpvm15-ext.prodigy.net [207.115.57.46]) by svr2.postgresql.org (Postfix) with ESMTP id C84BEF0B32 for ; Mon, 5 Dec 2005 22:11:54 +0000 (GMT) Received: from pimout5-ext.prodigy.net (pimout5-int.prodigy.net [207.115.4.21]) by ylpvm15.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id jB5MBrW4017439 for ; Mon, 5 Dec 2005 17:11:56 -0500 X-ORBL: [69.104.140.254] Received: from one (adsl-69-104-140-254.dsl.pltn13.pacbell.net [69.104.140.254]) by pimout5-ext.prodigy.net (8.13.4 outbound domainkey aix/8.13.4) with ESMTP id jB5MBcbv021516 for ; Mon, 5 Dec 2005 17:11:43 -0500 Received: from [192.168.5.105] (unknown [192.168.5.105]) by one (Postfix) with ESMTP id 9EA95F1A40 for ; Mon, 5 Dec 2005 14:11:37 -0800 (PST) Date: Mon, 5 Dec 2005 14:13:02 -0800 (PST) From: rm_pg@cheapcomplexdevices.com X-X-Sender: mayer@greenie.cheapcomplexdevices.com To: pgsql-performance@postgresql.org Subject: Missed index opportunity for outer join? 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, score=3.595 required=5 tests=[NO_REAL_NAME=0.55, RCVD_IN_BL_SPAMCOP_NET=1.332, RCVD_IN_NJABL_DUL=1.713] X-Spam-Score: 3.595 X-Spam-Level: *** X-Archive-Number: 200512/134 X-Sequence-Number: 15955 I have a case where an outer join's taking 10X more time than a non-outer join; and it looks to me like the outer join could have taken advantage of the same indexes that the non-outer join did. In both cases, the outermost thing is a nested loop. The top subplan gets all "point features" whre featureid=120. The outer join did not use an index for this. The non-outer join did use an index for this. Any reason it couldn't have use the index there? Also - in both cases the second part of the nested loop is using the same multi-column index on the table "facets". The non-outer-join uses both columns of this multi-column index. The outer-join only uses one of the columns and is much slower. Any reason it couldn't have use both columns of the index there? Attached below are explain analyze for the slow outer join and the fast non-outer join. This is using 8.1.0. Thanks in advance, Ron =============================================================================== == The outer join - slow =============================================================================== fli=# explain analyze select * from userfeatures.point_features upf left join facets b on (b.entity_id = upf.entity_id and b.fac_id=261) where featureid in (120); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop Left Join (cost=2.11..90317.33 rows=1207 width=505) (actual time=8.985..734.761 rows=917 loops=1) -> Seq Scan on point_features upf (cost=0.00..265.85 rows=948 width=80) (actual time=8.792..14.270 rows=917 loops=1) Filter: (featureid = 120) -> Bitmap Heap Scan on facets b (cost=2.11..94.60 rows=31 width=425) (actual time=0.101..0.770 rows=1 loops=917) Recheck Cond: (b.entity_id = "outer".entity_id) Filter: (fac_id = 261) -> Bitmap Index Scan on "fac_val(entity_id,fac_id)" (cost=0.00..2.11 rows=31 width=0) (actual time=0.067..0.067 rows=32 loops=917) Index Cond: (b.entity_id = "outer".entity_id) Total runtime: 736.444 ms (9 rows) =============================================================================== == The non-outer join - fast =============================================================================== fli=# explain analyze select * from userfeatures.point_features upf join facets b on (b.entity_id = upf.entity_id and b.fac_id=261) where featureid in (120); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (cost=23.32..4942.48 rows=1207 width=505) (actual time=0.571..55.867 rows=917 loops=1) -> Bitmap Heap Scan on point_features upf (cost=23.32..172.17 rows=948 width=80) (actual time=0.468..2.226 rows=917 loops=1) Recheck Cond: (featureid = 120) -> Bitmap Index Scan on point_features__featureid (cost=0.00..23.32 rows=948 width=0) (actual time=0.413..0.413 rows=917 loops=1) Index Cond: (featureid = 120) -> Index Scan using "fac_val(entity_id,fac_id)" on facets b (cost=0.00..5.02 rows=1 width=425) (actual time=0.051..0.053 rows=1 loops=917) Index Cond: ((b.entity_id = "outer".entity_id) AND (b.fac_id = 261)) Total runtime: 56.892 ms (8 rows) =============================================================================== == The tables involved. =============================================================================== fli=# \d facets Table "facet.facets" Column | Type | Modifiers -----------+---------+----------- entity_id | integer | nam_hash | integer | val_hash | integer | fac_id | integer | dis_id | integer | fac_val | text | fac_ival | integer | fac_tval | text | fac_nval | numeric | fac_raval | real[] | fac_bval | bytea | Indexes: "fac_val(entity_id,fac_id)" btree (entity_id, fac_id) "facets__dis_id" btree (dis_id) "facets__ent_id" btree (entity_id) "facets__fac_id" btree (fac_id) "facets__id_value" btree (fac_id, fac_val) CLUSTER Foreign-key constraints: "facets_entity_id_fkey" FOREIGN KEY (entity_id) REFERENCES entity(entity_id) ON DELETE CASCADE "facets_fac_id_fkey" FOREIGN KEY (fac_id) REFERENCES facet_lookup(fac_id) ON DELETE CASCADE fli=# \d point_features Table "userfeatures.point_features" Column | Type | Modifiers -----------+----------+------------------------------------------------------------------ pointid | integer | not null default nextval('point_features_pointid_seq'::regclass) entity_id | integer | featureid | integer | sessionid | integer | userid | integer | extid | text | label | text | iconid | integer | the_geom | geometry | Indexes: "point_features__featureid" btree (featureid) "point_features__postgis" gist (the_geom) Check constraints: "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2) "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL) "enforce_srid_the_geom" CHECK (srid(the_geom) = -1) =============================================================================== == version info =============================================================================== fli=# select version(); version ------------------------------------------------------------------------------------- PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3 (SuSE Linux) (1 row) From pgsql-performance-owner@postgresql.org Mon Dec 5 18:38:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 792569DCD56 for ; Mon, 5 Dec 2005 18:38:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67027-02 for ; Mon, 5 Dec 2005 18:38:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 12E499DCB79 for ; Mon, 5 Dec 2005 18:38:17 -0400 (AST) 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 jB5McJ6N003268; Mon, 5 Dec 2005 17:38:19 -0500 (EST) To: rm_pg@cheapcomplexdevices.com cc: pgsql-performance@postgresql.org Subject: Re: Missed index opportunity for outer join? In-reply-to: References: Comments: In-reply-to rm_pg@cheapcomplexdevices.com message dated "Mon, 05 Dec 2005 14:13:02 -0800" Date: Mon, 05 Dec 2005 17:38:19 -0500 Message-ID: <3267.1133822299@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200512/136 X-Sequence-Number: 15957 rm_pg@cheapcomplexdevices.com writes: > In both cases, the outermost thing is a nested loop. The > top subplan gets all "point features" whre featureid=120. > The outer join did not use an index for this. > The non-outer join did use an index for this. Hm, I can't duplicate this in a simple test (see below). There were some changes in this area between 8.1.0 and branch tip, but a quick look at the CVS logs doesn't suggest that any of them would be related (AFAICS the intentions of the patches were to change behavior only for OR clauses, and you haven't got any here). Can you try updating to 8.1 branch tip and see if the problem goes away? Or if not, generate a self-contained test case that shows the problem starting from an empty database? Actually, a quick and dirty thing would be to try my would-be test case below, and see if you get a seqscan on your copy. regards, tom lane regression=# create table point_features(entity_id int, featureid int); CREATE TABLE regression=# create index point_features__featureid on point_features(featureid); CREATE INDEX regression=# create table facets(entity_id int, fac_id int); CREATE TABLE regression=# create index "fac_val(entity_id,fac_id)" on facets(entity_id,fac_id); CREATE INDEX regression=# set enable_hashjoin TO 0; SET regression=# set enable_mergejoin TO 0; SET regression=# explain select * from point_features upf join facets b on (b.entity_id = upf.entity_id and b.fac_id=261) where featureid in (120); QUERY PLAN -------------------------------------------------------------------------------------------------- Nested Loop (cost=1.03..59.90 rows=1 width=16) -> Bitmap Heap Scan on point_features upf (cost=1.03..11.50 rows=10 width=8) Recheck Cond: (featureid = 120) -> Bitmap Index Scan on point_features__featureid (cost=0.00..1.03 rows=10 width=0) Index Cond: (featureid = 120) -> Index Scan using "fac_val(entity_id,fac_id)" on facets b (cost=0.00..4.83 rows=1 width=8) Index Cond: ((b.entity_id = "outer".entity_id) AND (b.fac_id = 261)) (7 rows) regression=# explain select * from point_features upf left join facets b on (b.entity_id = upf.entity_id and b.fac_id=261) where featureid in (120); QUERY PLAN ------------------------------------------------------------------------------------------------- Nested Loop Left Join (cost=2.07..127.70 rows=10 width=16) -> Bitmap Heap Scan on point_features upf (cost=1.03..11.50 rows=10 width=8) Recheck Cond: (featureid = 120) -> Bitmap Index Scan on point_features__featureid (cost=0.00..1.03 rows=10 width=0) Index Cond: (featureid = 120) -> Bitmap Heap Scan on facets b (cost=1.03..11.50 rows=10 width=8) Recheck Cond: (b.entity_id = "outer".entity_id) Filter: (fac_id = 261) -> Bitmap Index Scan on "fac_val(entity_id,fac_id)" (cost=0.00..1.03 rows=10 width=0) Index Cond: (b.entity_id = "outer".entity_id) (10 rows) (Note to self: it is a bit odd that fac_id=261 is pushed down to become an indexqual in one case but not the other ...) From pgsql-performance-owner@postgresql.org Mon Dec 5 19:04:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3E52F9DCD29 for ; Mon, 5 Dec 2005 19:04:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69874-05 for ; Mon, 5 Dec 2005 19:04:03 -0400 (AST) X-Greylist: delayed 00:52:08.840249 by SQLgrey- Received: from ylpvm15.prodigy.net (ylpvm15-ext.prodigy.net [207.115.57.46]) by postgresql.org (Postfix) with ESMTP id EAD419DCCDD for ; Mon, 5 Dec 2005 19:03:58 -0400 (AST) Received: from pimout5-ext.prodigy.net (pimout5-int.prodigy.net [207.115.4.21]) by ylpvm15.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id jB5N3oW6011185 for ; Mon, 5 Dec 2005 18:03:59 -0500 X-ORBL: [69.104.140.254] Received: from one (adsl-69-104-140-254.dsl.pltn13.pacbell.net [69.104.140.254]) by pimout5-ext.prodigy.net (8.13.4 outbound domainkey aix/8.13.4) with ESMTP id jB5N3eGi038436; Mon, 5 Dec 2005 18:03:40 -0500 Received: from [192.168.5.105] (unknown [192.168.5.105]) by one (Postfix) with ESMTP id 97FCDF1A40; Mon, 5 Dec 2005 15:03:39 -0800 (PST) Date: Mon, 5 Dec 2005 15:05:04 -0800 (PST) From: rm_pg@cheapcomplexdevices.com X-X-Sender: mayer@greenie.cheapcomplexdevices.com To: Tom Lane cc: rm_pg@cheapcomplexdevices.com, pgsql-performance@postgresql.org Subject: Re: Missed index opportunity for outer join? In-Reply-To: <3267.1133822299@sss.pgh.pa.us> Message-ID: References: <3267.1133822299@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, score=2.929 required=5 tests=[AWL=0.666, NO_REAL_NAME=0.55, RCVD_IN_NJABL_DUL=1.713] X-Spam-Score: 2.929 X-Spam-Level: ** X-Archive-Number: 200512/137 X-Sequence-Number: 15958 On Mon, 5 Dec 2005, Tom Lane wrote: > > Hm, I can't duplicate this in a simple test... > Can you try updating to 8.1 branch tip ... > Actually, a quick and dirty thing would be to try my would-be test case > below, and see if you get a seqscan on your copy. With your simple test-case I did not get the seqscan on 8.1.0. Output shown below that looks just like yours. I'll try upgrading a devel machine too - but will only be able to try on smalller test databases in the near term. > (Note to self: it is a bit odd that fac_id=261 is pushed down to become > an indexqual in one case but not the other ...) I speculate that the seq_scan wasn't really the slow part compared to not using using both parts of the index in the second part of the plan. The table point_features is tens of thousands of rows, while the table facets is tens of millions. Thanks, Ron =============================================================================== === Output of Tom's test case showing the same results he got. =============================================================================== greenie /home/pg2> createdb foo CREATE DATABASE greenie /home/pg2> psql foo [...] foo=# create table point_features(entity_id int, featureid int); CREATE TABLE foo=# create index point_features__featureid on point_features(featureid); CREATE INDEX foo=# create table facets(entity_id int, fac_id int); CREATE TABLE foo=# create index "fac_val(entity_id,fac_id)" on facets(entity_id,fac_id); CREATE INDEX foo=# set enable_hashjoin TO 0; SET foo=# set enable_mergejoin TO 0; SET foo=# explain select * from point_features upf join facets b on (b.entity_id = upf.entity_id and b.fac_id=261) where featureid in (120); QUERY PLAN -------------------------------------------------------------------------------------------------- Nested Loop (cost=1.03..49.15 rows=1 width=16) -> Bitmap Heap Scan on point_features upf (cost=1.03..10.27 rows=10 width=8) Recheck Cond: (featureid = 120) -> Bitmap Index Scan on point_features__featureid (cost=0.00..1.03 rows=10 width=0) Index Cond: (featureid = 120) -> Index Scan using "fac_val(entity_id,fac_id)" on facets b (cost=0.00..3.88 rows=1 width=8) Index Cond: ((b.entity_id = "outer".entity_id) AND (b.fac_id = 261)) (7 rows) foo=# explain select * from point_features upf left join facets b on (b.entity_id = upf.entity_id and b.fac_id=261) where featureid in (120); QUERY PLAN ------------------------------------------------------------------------------------------------- Nested Loop Left Join (cost=2.07..114.25 rows=10 width=16) -> Bitmap Heap Scan on point_features upf (cost=1.03..10.27 rows=10 width=8) Recheck Cond: (featureid = 120) -> Bitmap Index Scan on point_features__featureid (cost=0.00..1.03 rows=10 width=0) Index Cond: (featureid = 120) -> Bitmap Heap Scan on facets b (cost=1.03..10.27 rows=10 width=8) Recheck Cond: (b.entity_id = "outer".entity_id) Filter: (fac_id = 261) -> Bitmap Index Scan on "fac_val(entity_id,fac_id)" (cost=0.00..1.03 rows=10 width=0) Index Cond: (b.entity_id = "outer".entity_id) (10 rows) foo=# From pgsql-performance-owner@postgresql.org Mon Dec 5 20:07:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 798939DCD29 for ; Mon, 5 Dec 2005 20:07:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83571-02 for ; Mon, 5 Dec 2005 20:07:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by postgresql.org (Postfix) with ESMTP id 33CF99DCD1F for ; Mon, 5 Dec 2005 20:07:47 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 05 Dec 2005 21:06:39 -0300 X-IronPort-AV: i="3.99,218,1131332400"; d="scan'208"; a="5393286:sNHT19370664" Received: from alvh.no-ip.org (201.220.123.252) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 438E66E8000880BE; Mon, 5 Dec 2005 21:07:51 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id EC496C2DC6C; Mon, 5 Dec 2005 21:07:52 -0300 (CLST) Date: Mon, 5 Dec 2005 21:07:52 -0300 From: Alvaro Herrera To: Olleg Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: BLCKSZ Message-ID: <20051206000752.GC20272@surnet.cl> Mail-Followup-To: Olleg , Tom Lane , pgsql-performance@postgresql.org References: <29518.1133794958@sss.pgh.pa.us> <4394B1D3.7000304@mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4394B1D3.7000304@mail.ru> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.482 required=5 tests=[AWL=-0.437, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.482 X-Spam-Level: * X-Archive-Number: 200512/138 X-Sequence-Number: 15959 Olleg wrote: > I test performace on database test server. This is copy of working > billing system to test new features and experiments. Test task was one > day traffic log. Average time of a one test was 260 minutes. Postgresql > 7.4.8. Server dual Opteron 240, 4Gb RAM. Did you execute queries from the log, one after another? That may not be a representative test -- try sending multiple queries in parallel, to see how the server would perform in the real world. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Mon Dec 5 21:21:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CC33E9DCD66 for ; Mon, 5 Dec 2005 21:21:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97397-05 for ; Mon, 5 Dec 2005 21:21:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth01.mail.atl.earthlink.net (smtpauth01.mail.atl.earthlink.net [209.86.89.61]) by postgresql.org (Postfix) with ESMTP id B36659DCD2C for ; Mon, 5 Dec 2005 21:21:23 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=rX15kUB+DOZ2wqmeAOlKadLUYxJDh97Va98PsV9m/w4FBFIelq/6DxSCv1YqkRF6; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth01.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EjRWI-0003EQ-EM; Mon, 05 Dec 2005 20:21:26 -0500 Message-Id: <6.2.5.6.0.20051205183120.01dd6a80@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Mon, 05 Dec 2005 20:21:21 -0500 To: Olleg ,pgsql-performance@postgresql.org From: Ron Subject: Re: BLCKSZ In-Reply-To: <4394B1D3.7000304@mail.ru> References: <29518.1133794958@sss.pgh.pa.us> <4394B1D3.7000304@mail.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc69bc034236db03aa1bfbed9b4156f28e350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200512/139 X-Sequence-Number: 15960 At 04:32 PM 12/5/2005, Olleg wrote: >Tom Lane wrote: >>Olleg Samoylov writes: >> >>>I try to test this. Linux, memory page 4kb, disk page 4kb. I set >>>BLCKSZ to 4kb. I get some performance improve, but not big, may be >>>because I have 4Gb on test server (amd64). >>It's highly unlikely that reducing BLCKSZ is a good idea. There >>are bad side-effects on the maximum index entry size, maximum >>number of tuple fields, etc. > >Yes, when I set BLCKSZ=512, database dont' work. With BLCKSZ=1024 >database very slow. (This was surprise me. I expect increase >performance in 8 times with 1024 BLCKSZ. :) ) No wonder pg did not work or was very slow BLCKSZ= 512 or 1024 means 512 or 1024 *Bytes* respectively. That's 1/16 and 1/8 the default 8KB BLCKSZ. > As I already see in this maillist, increase of BLCKSZ reduce > performace too. Where? BLCKSZ as large as 64KB has been shown to improve performance. If running a RAID, BLCKSZ of ~1/2 the RAID stripe size seems to be a good value. >May be exist optimum value? Theoretically BLCKSZ equal memory/disk >page/block size may reduce defragmentation drawback of memory and disk. Of course there's an optimal value... ...and of course it is dependent on your HW, OS, and DB application. In general, and in a very fuzzy sense, "bigger is better". pg files are laid down in 1GB chunks, so there's probably one limitation. Given the HW you have mentioned, I'd try BLCKSZ= 65536 (you may have to recompile your kernel) and a RAID stripe of 128KB or 256KB as a first guess. >>In any case, when you didn't say *what* you tested, it's >>impossible to judge the usefulness of the change. >> regards, tom lane > >I test performace on database test server. This is copy of working >billing system to test new features and experiments. Test task was >one day traffic log. Average time of a one test was 260 minutes. How large is a record in your billing system? You want it to be an integer divisor of BLCKSZ (so for instance odd sizes in Bytes are BAD), Beyond that, you application domain matters. OLTP like systems need low latency access for frequent small transactions. Data mining like systems need to do IO in as big a chunk as the HW and OS will allow. Probably a good idea for BLCKSZ to be _at least_ max(8KB, 2x record size) > Postgresql 7.4.8. Server dual Opteron 240, 4Gb RAM. _Especially_ with that HW, upgrade to at least 8.0.x ASAP. It's a good idea to not be running pg 7.x anymore anyway, but it's particularly so if you are running 64b SMP boxes. Ron From pgsql-performance-owner@postgresql.org Mon Dec 5 23:07:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 040F59DCC40 for ; Mon, 5 Dec 2005 23:07:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20921-10 for ; Mon, 5 Dec 2005 23:07:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp104.mail.sc5.yahoo.com (smtp104.mail.sc5.yahoo.com [66.163.169.223]) by postgresql.org (Postfix) with SMTP id CB8D09DCAF0 for ; Mon, 5 Dec 2005 23:07:39 -0400 (AST) Received: (qmail 90851 invoked from network); 6 Dec 2005 03:07:44 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=Yahoo.com; h=Received:Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=DmxEjc9XWdlSFHSy1ZtY10huMb3c6ymyvxKar9Ru25imkuN1Tt6MI3K8ht5LOsnWQuCPB2QSKflnlXk+seVtoonKshemky4sce1yqNKFqGMkgttWa64WTl2rLqGqxmZbdib2u2fvteh60nEWSPcX6Nj8yXkX6SERrC5avtuA/44= ; Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp104.mail.sc5.yahoo.com with SMTP; 6 Dec 2005 03:07:43 -0000 Received: from [172.21.8.23] (mars.black-lion.info [192.168.192.101]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id jB637f1o015958; Mon, 5 Dec 2005 22:07:41 -0500 (EST) (envelope-from JanWieck@Yahoo.com) Message-ID: <43950068.3040402@Yahoo.com> Date: Mon, 05 Dec 2005 22:07:20 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Riess CC: pgsql-performance@postgresql.org Subject: Re: 15,000 tables - next step References: <4391BF0F.9000208@Yahoo.com> <20051203162642.GA29022@surnet.cl> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200512/140 X-Sequence-Number: 15961 On 12/4/2005 4:33 AM, Michael Riess wrote: > I will do the following: > > - switch to 10k buffers on a 1GB machine, 20k buffers on a 2GB machine > - try to optimize my connection polls to remember which apps (groups of > 30 tables) were accessed, so that there is a better chance of using caches > - "swap out" tables which are rarely used: export the content, drop the > table, and re-create it on the fly upon access. I hacked pgbench a little and did some tests (finally had to figure out for myself if there is much of an impact with hundreds or thousands of tables). The changes done to pgbench: - Use the [-s n] value allways, instead of determining the scaling from the DB. - Lower the number of accounts per scaling factor to 10,000. - Add another scaling type. Option [-a n] splits up the test into n schemas, each containing [-s n] branches. The tests were performed on a 667 MHz P3, 640MB Ram with a single IDE disk. All tests were IO bound. In all tests the number of clients was 5 default transaction and 50 readonly (option -S). The FreeBSD kernel of the system is configured to handle up to 50,000 open files, fully cache directories in virtual memory and to lock all shared memory into physical ram. The different scalings used were init -a1 -s3000 run -a1 -s300 and init -a3000 -s1 run -a300 -s1 The latter creates a database of 12,000 tables with 1,200 of them actually in use during the test. Both databases are about 4 GB in size. The performance loss for going from -s3000 to -a3000 is about 10-15%. The performance gain for going from 1,000 shared_buffers to 48,000 is roughly 70% (-a3000 test case) and 100% (-s3000 test case). Conclusion: The right shared memory configuration easily outperforms the loss from increase in number of tables, given that the kernel is configured to be up to the task of dealing with thousands of files accessed by that number of backends too. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Mon Dec 5 23:58:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D1E09DCC81 for ; Mon, 5 Dec 2005 23:57:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28167-05 for ; Mon, 5 Dec 2005 23:57:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 66B139DCB80 for ; Mon, 5 Dec 2005 23:54:54 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 2EC6C1AC3E9; Mon, 5 Dec 2005 19:55:14 -0800 (PST) Date: Mon, 5 Dec 2005 19:54:25 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Thomas Harold Cc: pgsql-performance@postgresql.org Subject: Re: two disks - best way to use them? In-Reply-To: <43946EA1.8090908@tgharold.com> Message-ID: References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> <43946148.9010607@tgharold.com> <43946EA1.8090908@tgharold.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/141 X-Sequence-Number: 15962 On Mon, 5 Dec 2005, Thomas Harold wrote: > Yeah, I don't think I was clear about the config. It's (4) disks setup as a > pair of RAID1 sets. My original config was pgsql on the first RAID set (data > and WAL). I'm now experimenting with putting the data/pg_xlog folder on the > 2nd set of disks. > > Under the old setup (everything on the original RAID1 set, in a dedicated > 32GB LVM volume), I was seeing 80-90% wait percentages in "top". My > understanding is that this is an indicator of an overloaded / bottlenecked > disk system. This was while doing massive inserts into a test table > (millions of narrow rows). I'm waiting to see what happens once I have > data/pg_xlog on the 2nd disk set. in that case you logicly have two disks, so see the post from Ron earlier in this thread. David Lang From pgsql-performance-owner@postgresql.org Tue Dec 6 01:51:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 296139DCAEC for ; Tue, 6 Dec 2005 01:51:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44118-08 for ; Tue, 6 Dec 2005 01:51:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EF3DE9DCCC6 for ; Tue, 6 Dec 2005 01:51:15 -0400 (AST) 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 jB65pD5O026214; Tue, 6 Dec 2005 00:51:13 -0500 (EST) To: Ron cc: Olleg , pgsql-performance@postgresql.org Subject: Re: BLCKSZ In-reply-to: <6.2.5.6.0.20051205183120.01dd6a80@earthlink.net> References: <29518.1133794958@sss.pgh.pa.us> <4394B1D3.7000304@mail.ru> <6.2.5.6.0.20051205183120.01dd6a80@earthlink.net> Comments: In-reply-to Ron message dated "Mon, 05 Dec 2005 20:21:21 -0500" Date: Tue, 06 Dec 2005 00:51:13 -0500 Message-ID: <26213.1133848273@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/142 X-Sequence-Number: 15963 Ron writes: > Where? BLCKSZ as large as 64KB has been shown to improve > performance. Not in the Postgres context, because you can't set BLCKSZ higher than 32K without doing extensive surgery on the page item pointer layout. If anyone's actually gone to that much trouble, they sure didn't publicize their results ... >> Postgresql 7.4.8. Server dual Opteron 240, 4Gb RAM. > _Especially_ with that HW, upgrade to at least 8.0.x ASAP. It's a > good idea to not be running pg 7.x anymore anyway, but it's > particularly so if you are running 64b SMP boxes. I agree with this bit --- 8.1 is a significant improvement on any prior version for SMP boxes. It's likely that 8.2 will be better yet, because this is an area we just recently started paying serious attention to. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 01:52:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2E20A9DCF7E for ; Tue, 6 Dec 2005 01:52:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47458-07-2 for ; Tue, 6 Dec 2005 01:52:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 968279DCC3B for ; Tue, 6 Dec 2005 01:52:35 -0400 (AST) Received: from fuse6.mailanyone.net (fuse6.mailanyone.net [69.31.1.175]) by svr2.postgresql.org (Postfix) with ESMTP id 55A11F15D7 for ; Tue, 6 Dec 2005 05:52:35 +0000 (GMT) Received: from mailanyone.net by fuse6.mailanyone.net with asmtp (TLSv1:AES256-SHA:256) (MailAnyone extSMTP) id 1EjVkk-0004rR-4C for pgsql-performance@postgresql.org; Mon, 05 Dec 2005 23:52:38 -0600 Message-ID: <4395273B.90902@tgharold.com> Date: Tue, 06 Dec 2005 00:52:59 -0500 From: Thomas Harold User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728 X-Accept-Language: en-us, en, ja, zh-cn, zh-hk, zh-sg, zh-tw, ko, ko-kp, ko-kr MIME-Version: 1.0 Cc: pgsql-performance@postgresql.org Subject: Re: two disks - best way to use them? References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> <43946148.9010607@tgharold.com> <43946EA1.8090908@tgharold.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.189 required=5 tests=[AWL=-0.333, MISSING_HEADERS=0.189, RCVD_IN_BL_SPAMCOP_NET=1.332, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 1.189 X-Spam-Level: * X-Archive-Number: 200512/143 X-Sequence-Number: 15964 David Lang wrote: > in that case you logicly have two disks, so see the post from Ron > earlier in this thread. And it's a very nice performance gain. Percent spent waiting according to "top" is down around 10-20% instead of 80-90%. While I'm not prepared to benchmark, database performance is way up. The client machines that are writing the data are running closer to 100% CPU (before they were well below 50% CPU utilization). From pgsql-performance-owner@postgresql.org Tue Dec 6 04:12:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 401E59DCAEF for ; Tue, 6 Dec 2005 04:12:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58502-05 for ; Tue, 6 Dec 2005 04:12:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth07.mail.atl.earthlink.net (smtpauth07.mail.atl.earthlink.net [209.86.89.67]) by postgresql.org (Postfix) with ESMTP id 6CAA69DCAEE for ; Tue, 6 Dec 2005 04:12:38 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=SwiSTECHiudR+HN1s1XseXu23NI408nh6W9FUpQ5Nl+29orqMFzZ5m3XQMwPsydZ; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth07.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EjXwC-0001YU-VW; Tue, 06 Dec 2005 03:12:37 -0500 Message-Id: <6.2.5.6.0.20051206030948.01dd4bb0@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 06 Dec 2005 03:12:31 -0500 To: Thomas Harold ,pgsql-performance@postgresql.org From: Ron Subject: Re: two disks - best way to use them? In-Reply-To: <4395273B.90902@tgharold.com> References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> <43946148.9010607@tgharold.com> <43946EA1.8090908@tgharold.com> <4395273B.90902@tgharold.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcec9e5ce382ab44dff2238b7f05c4ac12350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200512/144 X-Sequence-Number: 15965 At 12:52 AM 12/6/2005, Thomas Harold wrote: >David Lang wrote: > >>in that case you logicly have two disks, so see the post from Ron >>earlier in this thread. > >And it's a very nice performance gain. Percent spent waiting >according to "top" is down around 10-20% instead of 80-90%. While >I'm not prepared to benchmark, database performance is way up. The >client machines that are writing the data are running closer to 100% >CPU (before they were well below 50% CPU utilization). For accuracy's sake, which exact config did you finally use? How did you choose the config you finally used? Did you test the three options or just pick one? Ron From pgsql-general-owner@postgresql.org Tue Dec 6 04:45:24 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BD3ED9DCD82 for ; Tue, 6 Dec 2005 04:45:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61550-09 for ; Tue, 6 Dec 2005 04:45:20 -0400 (AST) X-Greylist: delayed 00:06:39.467769 by SQLgrey- Received: from web31508.mail.mud.yahoo.com (web31508.mail.mud.yahoo.com [68.142.198.137]) by postgresql.org (Postfix) with SMTP id 38A529DCD20 for ; Tue, 6 Dec 2005 04:45:17 -0400 (AST) Received: (qmail 90177 invoked by uid 60001); 6 Dec 2005 08:38:38 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=QnpdKxpiezwTK00r3jH+owImXZbyCGeLSaduQSICWa9jqh2/xfCJ5688PoA23PtLIYZf3Ygf4hcFbP3fw45PR6qi7cMleTf8EfzBe9tDGky3uv1fYxbRoV1TZN20wGxXpZAC8eN/RWgVgS94Wi9XtgGIOW2ZzwVGfDl2zwwZPXo= ; Message-ID: <20051206083838.90175.qmail@web31508.mail.mud.yahoo.com> Received: from [202.6.239.250] by web31508.mail.mud.yahoo.com via HTTP; Tue, 06 Dec 2005 00:38:38 PST Date: Tue, 6 Dec 2005 00:38:38 -0800 (PST) From: Jenny Subject: need help To: pgsql-general@postgresql.org, pgsql-sql@postgresql.org, pgsql-performance@postgresql.org 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, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200512/298 X-Sequence-Number: 87861 I'm running PostgreSQL 8.0.3 on i686-pc-linux-gnu (Fedora Core 2). I've been dealing with Psql for over than 2 years now, but I've never had this case before. I have a table that has about 20 rows in it. Table "public.s_apotik" Column | Type | Modifiers -------------------+------------------------------+------------------ obat_id | character varying(10) | not null stock | numeric | not null s_min | numeric | not null s_jual | numeric | s_r_jual | numeric | s_order | numeric | s_r_order | numeric | s_bs | numeric | last_receive | timestamp without time zone | Indexes: "s_apotik_pkey" PRIMARY KEY, btree(obat_id) When I try to UPDATE one of the row, nothing happens for a very long time. First, I run it on PgAdminIII, I can see the miliseconds are growing as I waited. Then I stop the query, because the time needed for it is unbelievably wrong. Then I try to run the query from the psql shell. For example, the table has obat_id : A, B, C, D. db=# UPDATE s_apotik SET stock = 100 WHERE obat_id='A'; (.... nothing happens.. I press the Ctrl-C to stop it. This is what comes out :) Cancel request sent ERROR: canceling query due to user request (If I try another obat_id) db=# UPDATE s_apotik SET stock = 100 WHERE obat_id='B'; (Less than a second, this is what comes out :) UPDATE 1 I can't do anything to that row. I can't DELETE it. Can't DROP the table. I want this data out of my database. What should I do? It's like there's a falsely pointed index here. Any help would be very much appreciated. Regards, Jenny Tania __________________________________________ Yahoo! DSL � Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From pgsql-general-owner@postgresql.org Tue Dec 6 04:54:55 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7A1299DCAEE; Tue, 6 Dec 2005 04:54:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65705-05; Tue, 6 Dec 2005 04:54:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id 6FD9A9DCAC4; Tue, 6 Dec 2005 04:54:42 -0400 (AST) Received: from [10.100.1.50] (074-016-066-080.eggenet.de [80.66.16.74]) by service-web.de (Postfix) with ESMTP id F2363200034; Tue, 6 Dec 2005 09:54:42 +0100 (CET) Message-ID: <439551D0.5070904@wildenhain.de> Date: Tue, 06 Dec 2005 09:54:40 +0100 From: Tino Wildenhain User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050929) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Jenny Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: need help References: <20051206083838.90175.qmail@web31508.mail.mud.yahoo.com> In-Reply-To: <20051206083838.90175.qmail@web31508.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/299 X-Sequence-Number: 87862 Jenny schrieb: > I'm running PostgreSQL 8.0.3 on i686-pc-linux-gnu (Fedora Core 2). I've been > dealing with Psql for over than 2 years now, but I've never had this case > before. > > I have a table that has about 20 rows in it. > > Table "public.s_apotik" > Column | Type | Modifiers > -------------------+------------------------------+------------------ > obat_id | character varying(10) | not null > stock | numeric | not null > s_min | numeric | not null > s_jual | numeric | > s_r_jual | numeric | > s_order | numeric | > s_r_order | numeric | > s_bs | numeric | > last_receive | timestamp without time zone | > Indexes: > "s_apotik_pkey" PRIMARY KEY, btree(obat_id) > > When I try to UPDATE one of the row, nothing happens for a very long time. > First, I run it on PgAdminIII, I can see the miliseconds are growing as I > waited. Then I stop the query, because the time needed for it is unbelievably > wrong. > > Then I try to run the query from the psql shell. For example, the table has > obat_id : A, B, C, D. > db=# UPDATE s_apotik SET stock = 100 WHERE obat_id='A'; > (.... nothing happens.. I press the Ctrl-C to stop it. This is what comes out > :) > Cancel request sent > ERROR: canceling query due to user request > > (If I try another obat_id) > db=# UPDATE s_apotik SET stock = 100 WHERE obat_id='B'; > (Less than a second, this is what comes out :) > UPDATE 1 > > I can't do anything to that row. I can't DELETE it. Can't DROP the table. > I want this data out of my database. > What should I do? It's like there's a falsely pointed index here. > Any help would be very much appreciated. > 1) lets hope you do regulary backups - and actually tested restore. 1a) if not, do it right now 2) reindex the table 3) try again to modify Q: are there any foreign keys involved? If so, reindex those tables too, just in case. did you vacuum regulary? HTH Tino From pgsql-performance-owner@postgresql.org Tue Dec 6 05:09:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A8DF39DCAC4 for ; Tue, 6 Dec 2005 05:07:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68911-05 for ; Tue, 6 Dec 2005 05:07:57 -0400 (AST) X-Greylist: delayed 16:03:03.180469 by SQLgrey- Received: from mailrelay.mobixell.com (unknown [62.219.168.154]) by postgresql.org (Postfix) with ESMTP id F35ED9DCAEF for ; Tue, 6 Dec 2005 05:07:53 -0400 (AST) Received: from mobiexc.mobixell.com (owa2000.mobixell.com [10.0.0.1]) by mailrelay.mobixell.com (8.12.11/8.12.11) with ESMTP id jB695e2x023592; Tue, 6 Dec 2005 11:05:40 +0200 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: Performance degradation after successive UPDATE's Date: Tue, 6 Dec 2005 11:08:07 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Performance degradation after successive UPDATE's Thread-Index: AcX52127RC0QA2X4T5CzwxAs1wA24gAaKxUg From: "Assaf Yaari" To: "Bruno Wolff III" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.334 required=5 tests=[AWL=0.334] X-Spam-Score: 0.334 X-Spam-Level: X-Archive-Number: 200512/146 X-Sequence-Number: 15967 Thanks Bruno, Issuing VACUUM FULL seems not to have influence on the time. I've added to my script VACUUM ANALYZE every 100 UPDATE's and run the test again (on different record) and the time still increase. Any other ideas? Thanks, Assaf.=20 > -----Original Message----- > From: Bruno Wolff III [mailto:bruno@wolff.to]=20 > Sent: Monday, December 05, 2005 10:36 PM > To: Assaf Yaari > Cc: pgsql-performance@postgresql.org > Subject: Re: Performance degradation after successive UPDATE's >=20 > On Mon, Dec 05, 2005 at 19:05:01 +0200, > Assaf Yaari wrote: > > Hi, > > =20 > > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. > > =20 > > My application updates counters in DB. I left a test over the night=20 > > that increased counter of specific record. After night running=20 > > (several hundreds of thousands updates), I found out that the time=20 > > spent on UPDATE increased to be more than 1.5 second (at=20 > the beginning=20 > > it was less than 10ms)! Issuing VACUUM ANALYZE and even=20 > reboot didn't=20 > > seemed to solve the problem. >=20 > You need to be running vacuum more often to get rid of the=20 > deleted rows (update is essentially insert + delete). Once=20 > you get too many, plain vacuum won't be able to clean them up=20 > without raising the value you use for FSM. By now the table=20 > is really bloated and you probably want to use vacuum full on it. >=20 From pgsql-performance-owner@postgresql.org Tue Dec 6 05:22:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 507F59DCAEE for ; Tue, 6 Dec 2005 05:22:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69501-09 for ; Tue, 6 Dec 2005 05:22:31 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) by postgresql.org (Postfix) with ESMTP id 983119DCAC4 for ; Tue, 6 Dec 2005 05:22:28 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so921991nzp for ; Tue, 06 Dec 2005 01:22:30 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=rdVr5G90E+cSxskjnV4RD99QL6hxCjDkr1+jgr8Qj51H97CNUW6b9bN6xtn4vp6Sn8f99VFyrvzb0pKJF86ZpN+5/FIcsp+9eIGjpSS+Gd1bUqe/1fpbVdTBBbkUox71zdpzaRnD1kL6Ng49nw/SyG8PBu7hug8PZTSZByZyjGs= Received: by 10.64.10.9 with SMTP id 9mr271648qbj; Tue, 06 Dec 2005 01:22:30 -0800 (PST) Received: by 10.64.213.18 with HTTP; Tue, 6 Dec 2005 01:22:30 -0800 (PST) Message-ID: Date: Tue, 6 Dec 2005 17:22:30 +0800 From: Kathy Lo To: pgsql-performance@postgresql.org Subject: Memory Leakage Problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/147 X-Sequence-Number: 15968 SGksCgpJIHNldHVwIGEgZGF0YWJhc2Ugc2VydmVyIHVzaW5nIHRoZSBmb2xsb3dpbmcgY29uZmln dXJhdGlvbi4KClJlZGhhdCA5LjAKUG9zdGdyZXNxbCA4LjAuMwoKVGhlbiwgSSBzZXR1cCBhIGNs aWVudCB3b3Jrc3RhdGlvbiB0byBhY2Nlc3MgdGhpcyBkYXRhYmFzZSBzZXJ2ZXIgd2l0aAp0aGUg Zm9sbG93aW5nIGNvbmZpZ3VyYXRpb24uCgpSZWRoYXQgOS4wCnVuaXhPREJDIDIuMi4xMQpwc3Fs b2RiYy0wOC4wMS4wMTAxCgphbmQgd3JpdGUgYSBDKysgcHJvZ3JhbSB0byBydW4gZGF0YWJhc2Ug cXVlcnkuCgpJbiB0aGlzIHByb2dyYW0sIGl0IHdpbGwgYWNjZXNzIHRoaXMgZGF0YWJhc2Ugc2Vy dmVyIHVzaW5nIHNpbXBsZSBhbmQKY29tcGxleCAoam9pbmluZyB0YWJsZXMpIFNRTCBTZWxlY3Qg c3RhdGVtZW50IGFuZCByZXRyaWV2ZSB0aGUgbWF0Y2hlZApyb3dzLiBGb3IgZWFjaCBhY2Nlc3Ms IGl0IHdpbGwgY29ubmVjdCB0aGUgZGF0YWJhc2UgYW5kIGRpc2Nvbm5lY3QgaXQuCgpJIGZvdW5k IHRoYXQgdGhlIG1lbW9yeSBvZiB0aGUgZGF0YWJhc2VyIHNlcnZlciBuZWFybHkgdXNlZCB1cCAo dG90YWwgMkcgUkFNKS4KCkFmdGVyIEkgc3RvcCB0aGUgcHJvZ3JhbSwgdGhlIHVzZWQgbWVtb3J5 IGRpZCBub3QgZnJlZS4KCklzIHRoZXJlIGFueSBjb25maWd1cmF0aW9uIGluIHBvc3RncmVzcWwu Y29uZiBJIHNob3VsZCBzZXQ/IEN1cnJlbnRseSwKSSBqdXN0IHNldCB0aGUgZm9sbG93aW5nIGlu IHBvc3RncmVzcWwuY29uZgoKICAgIGxpc3Rlbl9hZGRyZXNzZXMgPSAnKicKICAgIG1heF9zdGFj a19kZXB0aCA9IDgxMDAgKHdoZW4gSSBydW4gInVsaW1pdCAtcyIgdGhlIG1heC4gdmFsdWUgdGhh dAprZXJuZWwgc3VwcG9ydHMgPSA4MTkyKQogICAgc3RhdHNfcm93X2xldmVsID0gdHJ1ZQoKQW5k LCBJIHJ1biBwZ19hdXRvdmFjdXVtIGFzIGJhY2tncm91bmQgam9iLgoKLS0KS2F0aHkgTG8K From pgsql-performance-owner@postgresql.org Tue Dec 6 05:39:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E34659DCAEE for ; Tue, 6 Dec 2005 05:39:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71477-08 for ; Tue, 6 Dec 2005 05:39:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id BCB719DCC83 for ; Tue, 6 Dec 2005 05:39:18 -0400 (AST) Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by svr2.postgresql.org (Postfix) with ESMTP id B2CBBF0B32 for ; Tue, 6 Dec 2005 09:39:20 +0000 (GMT) Received: from host-83-146-33-145.bulldogdsl.com ([83.146.33.145] helo=orchard) by localhost.localdomain with esmtpa (Exim 4.54) id 1EjZIE-0000mD-Vk for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 09:39:27 +0000 Received: from rory by orchard with local (Exim 4.54) id 1EjZH8-0008DP-B9 for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 09:38:18 +0000 Date: Tue, 6 Dec 2005 09:38:18 +0000 From: Rory Campbell-Lange To: pgsql-performance@postgresql.org Subject: LVM and Postgres Message-ID: <20051206093818.GE6708@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200512/148 X-Sequence-Number: 15969 I need to slice up a web server's disk space to provide space for postgres and storing binaries such as images and sound files. I'm thinking of using logical volume management (LVM) to help manage the amount of space I use between postgres and the data volumes. The server has a 250GB RAID10 (LSI 320-I + BBU) volume which I am thinking of slicing up in the following way (Linux 2.6 kernel): / : ext3 : 47GB (root, home etc) /boot : ext3 : 1GB /tmp : ext2 : 2GB /usr : ext3 : 4GB /var : ext3 : 6GB ----------------------- 60GB VG : 190GB approx ----------------------- Initially divided so: /data : ext3 : 90GB /postgres : xfs : 40GB This gives me left over space of roughly 60GB to extend into on the volume group, which I can balance between the /data and /postgres logical volumes as needed. Are there any major pitfalls to this approach? Thanks, Rory -- Rory Campbell-Lange From pgsql-general-owner@postgresql.org Tue Dec 6 05:41:23 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3B5A89DCD5A for ; Tue, 6 Dec 2005 05:41:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72538-04 for ; Tue, 6 Dec 2005 05:41:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web31502.mail.mud.yahoo.com (web31502.mail.mud.yahoo.com [68.142.198.131]) by postgresql.org (Postfix) with SMTP id 9DE7F9DCC6A for ; Tue, 6 Dec 2005 05:41:13 -0400 (AST) Received: (qmail 42115 invoked by uid 60001); 6 Dec 2005 09:41:15 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=IQ523bWFxQ7NE113BczOC0WJWFR0n4ny/aJ0+RW2df7+H3P6eR9cRPZ8smg9NFcDf86CsvOPUAZ7C350IuaPyk8I4Q3Z7mABlBB8Q0QPXcrM3Q4QymTSPSmoQHqtd2q9pRIiVgfoWRIhbjU0/B0D+L2bWmFsZhrcLOk/pvBGi1M= ; Message-ID: <20051206094115.42113.qmail@web31502.mail.mud.yahoo.com> Received: from [202.6.239.250] by web31502.mail.mud.yahoo.com via HTTP; Tue, 06 Dec 2005 01:41:15 PST Date: Tue, 6 Dec 2005 01:41:15 -0800 (PST) From: Jenny Subject: need help (not anymore) To: pgsql-performance@postgresql.org, pgsql-sql@postgresql.org, pgsql-general@postgresql.org 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, score=0.383 required=5 tests=[AWL=-0.096, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.383 X-Spam-Level: X-Archive-Number: 200512/300 X-Sequence-Number: 87863 I run the VACUUM as you suggested, but still no response from the server. So, I decided to DROP the database. I got a message that the database is being used. I closed every application that accessing it. But, the message remains. I checked the server processes (ps -ax). There were lots of 'UPDATE is waiting ...' on the list. I killed them all. I backuped current database and DROP the database, restore to the backup file I just made. Don't really know why this happened, but thankfully now, everything's normal. Thank you, guys. Regards, Jenny Tania __________________________________________ Yahoo! DSL � Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com From pgsql-performance-owner@postgresql.org Tue Dec 6 05:43:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CFA9D9DCD36 for ; Tue, 6 Dec 2005 05:43:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72138-06 for ; Tue, 6 Dec 2005 05:43:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by postgresql.org (Postfix) with ESMTP id F3DF09DCD5A for ; Tue, 6 Dec 2005 05:43:47 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 06 Dec 2005 10:43:49 +0100 Subject: Can this query go faster??? From: Joost Kraaijeveld To: Pgsql-Performance Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 06 Dec 2005 10:43:49 +0100 Message-Id: <1133862229.8837.61.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/149 X-Sequence-Number: 15970 Hi, Is it possible to get this query run faster than it does now, by adding indexes, changing the query? SELECT customers.objectid FROM prototype.customers, prototype.addresses WHERE customers.contactaddress = addresses.objectid ORDER BY zipCode asc, housenumber asc LIMIT 1 OFFSET 283745 Explain: Limit (cost=90956.71..90956.71 rows=1 width=55) -> Sort (cost=90247.34..91169.63 rows=368915 width=55) Sort Key: addresses.zipcode, addresses.housenumber -> Hash Join (cost=14598.44..56135.75 rows=368915 width=55) Hash Cond: ("outer".contactaddress = "inner".objectid) -> Seq Scan on customers (cost=0.00..31392.15 rows=368915 width=80) -> Hash (cost=13675.15..13675.15 rows=369315 width=55) -> Seq Scan on addresses (cost=0.00..13675.15 rows=369315 width=55) The customers table has an index on contactaddress and objectid. The addresses table has an index on zipcode+housenumber and objectid. TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Dec 6 05:52:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 161399DCC6A for ; Tue, 6 Dec 2005 05:51:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76279-02 for ; Tue, 6 Dec 2005 05:51:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 8CB139DCAEE for ; Tue, 6 Dec 2005 05:51:27 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id BDF273093D; Tue, 6 Dec 2005 10:51:25 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: Can this query go faster??? Date: Tue, 06 Dec 2005 10:51:25 +0100 Organization: Hub.Org Networking Services Lines: 29 Message-ID: References: <1133862229.8837.61.camel@Panoramix> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <1133862229.8837.61.camel@Panoramix> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/151 X-Sequence-Number: 15972 > Hi, > > Is it possible to get this query run faster than it does now, by adding > indexes, changing the query? > > SELECT customers.objectid FROM prototype.customers, prototype.addresses > WHERE > customers.contactaddress = addresses.objectid > ORDER BY zipCode asc, housenumber asc > LIMIT 1 OFFSET 283745 > > Explain: > > Limit (cost=90956.71..90956.71 rows=1 width=55) > -> Sort (cost=90247.34..91169.63 rows=368915 width=55) > Sort Key: addresses.zipcode, addresses.housenumber > -> Hash Join (cost=14598.44..56135.75 rows=368915 width=55) > Hash Cond: ("outer".contactaddress = "inner".objectid) > -> Seq Scan on customers (cost=0.00..31392.15 > rows=368915 width=80) > -> Hash (cost=13675.15..13675.15 rows=369315 width=55) > -> Seq Scan on addresses (cost=0.00..13675.15 > rows=369315 width=55) > > The customers table has an index on contactaddress and objectid. > The addresses table has an index on zipcode+housenumber and objectid. When the resulting relation contains all the info from both tables, indexes won't help, seq scan is inevitable. From pgsql-performance-owner@postgresql.org Tue Dec 6 05:52:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A2E889DCD36 for ; Tue, 6 Dec 2005 05:52:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75866-06 for ; Tue, 6 Dec 2005 05:52:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by postgresql.org (Postfix) with ESMTP id 6F7429DCCC3 for ; Tue, 6 Dec 2005 05:51:59 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so926450nzp for ; Tue, 06 Dec 2005 01:52:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gzyohNjSZKHMCCPIYPXiv1Z4m9N7M16uhfRlcQU1B4Yf5i66JcuHuV28w7DI5VRbCnddmnTLjxRyJ13jsrC0AqnQIwTAAaXxdaSy0A9vYssB3ZI4g44utWS3lnuMR4k1hcZWGr6AQpSIpq5hI/3YBIkTC8zg8D7GI+eWsErVji0= Received: by 10.64.253.8 with SMTP id a8mr295673qbi; Tue, 06 Dec 2005 01:52:01 -0800 (PST) Received: by 10.64.209.2 with HTTP; Tue, 6 Dec 2005 01:52:01 -0800 (PST) Message-ID: <5e744e3d0512060152s14eeb0abg99b3c0c6df5174b5@mail.gmail.com> Date: Tue, 6 Dec 2005 15:22:01 +0530 From: Pandurangan R S To: Assaf Yaari Subject: Re: Performance degradation after successive UPDATE's 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, score=0.139 required=5 tests=[AWL=0.139] X-Spam-Score: 0.139 X-Spam-Level: X-Archive-Number: 200512/150 X-Sequence-Number: 15971 Hi, You might try these steps 1. Do a vacuum full analyze 2. Reindex the index on id column 3. Cluster the table based on this index On 12/5/05, Assaf Yaari wrote: > > Hi, > > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. > > My application updates counters in DB. I left a test over the night that > increased counter of specific record. After night running (several hundre= ds > of thousands updates), I found out that the time spent on UPDATE increase= d > to be more than 1.5 second (at the beginning it was less than 10ms)! Issu= ing > VACUUM ANALYZE and even reboot didn't seemed to solve the problem. > > I succeeded to re-produce this with a simple test: > > I created a very simple table that looks like that: > CREATE TABLE test1 > ( > id int8 NOT NULL, > counter int8 NOT NULL DEFAULT 0, > CONSTRAINT "Test1_pkey" PRIMARY KEY (id) > ) ; > > I've inserted 15 entries and wrote a script that increase the counter of > specific record over and over. The SQL command looks like this: > UPDATE test1 SET counter=3Dnumber WHERE id=3D10; > > At the beginning the UPDATE time was around 15ms. After ~90000 updates, t= he > execution time increased to be more than 120ms. > > 1. What is the reason for this phenomena? > 2. Is there anything that can be done in order to improve this? > > Thanks, > Assaf -- Regards Pandu From pgsql-performance-owner@postgresql.org Tue Dec 6 05:54:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3482B9DCC83 for ; Tue, 6 Dec 2005 05:54:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77107-01 for ; Tue, 6 Dec 2005 05:54:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail3.ecircle.de (unknown [195.140.186.206]) by postgresql.org (Postfix) with ESMTP id E4B6D9DCAEE for ; Tue, 6 Dec 2005 05:53:56 -0400 (AST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by mail3.ecircle.de (READY) with ESMTP id 091E411C49D; Tue, 6 Dec 2005 10:53:56 +0100 (CET) Received: from [192.168.1.110] ([192.168.1.110]) by deimos.muc.ecircle.de with Microsoft SMTPSVC(5.0.2195.6713); Tue, 6 Dec 2005 10:52:57 +0100 Subject: Re: Can this query go faster??? From: Csaba Nagy To: Joost Kraaijeveld Cc: Pgsql-Performance In-Reply-To: <1133862229.8837.61.camel@Panoramix> References: <1133862229.8837.61.camel@Panoramix> Content-Type: text/plain Message-Id: <1133862777.4779.185.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 06 Dec 2005 10:52:57 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Dec 2005 09:52:57.0583 (UTC) FILETIME=[D61017F0:01C5FA4A] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/152 X-Sequence-Number: 15973 Joost, Why do you use an offset here ? I guess you're traversing the table somehow, in this case it would be better to remember the last zipcode + housenumber and put an additional condition to get the next bigger than the last one you've got... that would go for the index on zipcode+housenumber and be very fast. The big offset forces postgres to traverse that many entries until it's able to pick the one row for the result... On Tue, 2005-12-06 at 10:43, Joost Kraaijeveld wrote: > Hi, > > Is it possible to get this query run faster than it does now, by adding > indexes, changing the query? > > SELECT customers.objectid FROM prototype.customers, prototype.addresses > WHERE > customers.contactaddress = addresses.objectid > ORDER BY zipCode asc, housenumber asc > LIMIT 1 OFFSET 283745 > > Explain: > > Limit (cost=90956.71..90956.71 rows=1 width=55) > -> Sort (cost=90247.34..91169.63 rows=368915 width=55) > Sort Key: addresses.zipcode, addresses.housenumber > -> Hash Join (cost=14598.44..56135.75 rows=368915 width=55) > Hash Cond: ("outer".contactaddress = "inner".objectid) > -> Seq Scan on customers (cost=0.00..31392.15 > rows=368915 width=80) > -> Hash (cost=13675.15..13675.15 rows=369315 width=55) > -> Seq Scan on addresses (cost=0.00..13675.15 > rows=369315 width=55) > > The customers table has an index on contactaddress and objectid. > The addresses table has an index on zipcode+housenumber and objectid. > > TIA > > -- > Groeten, > > Joost Kraaijeveld > Askesis B.V. > Molukkenstraat 14 > 6524NB Nijmegen > tel: 024-3888063 / 06-51855277 > fax: 024-3608416 > e-mail: J.Kraaijeveld@Askesis.nl > web: www.askesis.nl > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Dec 6 05:55:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B226A9DCC6A for ; Tue, 6 Dec 2005 05:55:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77007-06 for ; Tue, 6 Dec 2005 05:55:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgw.computec.de (smtpgw.computec.de [212.123.108.8]) by postgresql.org (Postfix) with ESMTP id 3A9D29DCAEE for ; Tue, 6 Dec 2005 05:54:58 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id 304A1559C4; Tue, 6 Dec 2005 10:55:00 +0100 (CET) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29076-01-88; Tue, 6 Dec 2005 10:54:59 +0100 (CET) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id 955FB55984; Tue, 6 Dec 2005 10:54:59 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Can this query go faster??? Date: Tue, 6 Dec 2005 10:54:58 +0100 Message-ID: <28011CD60FB1724DBA4442E38277F6264A6E40@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can this query go faster??? Thread-Index: AcX6SZF1s7NsNnVMQSKWUPaenoZiXwAAG5NQ From: "Markus Wollny" To: "Joost Kraaijeveld" , "Pgsql-Performance" X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.319 required=5 tests=[AWL=-0.600, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.319 X-Spam-Level: * X-Archive-Number: 200512/153 X-Sequence-Number: 15974 Hi, > -----Urspr=FCngliche Nachricht----- > Von: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] Im Auftrag=20 > von Joost Kraaijeveld > Gesendet: Dienstag, 6. Dezember 2005 10:44 > An: Pgsql-Performance > Betreff: [PERFORM] Can this query go faster??? =20 > SELECT customers.objectid FROM prototype.customers,=20 > prototype.addresses WHERE customers.contactaddress =3D=20 > addresses.objectid ORDER BY zipCode asc, housenumber asc=20 > LIMIT 1 OFFSET 283745 >=20 > Explain: >=20 > Limit (cost=3D90956.71..90956.71 rows=3D1 width=3D55) > -> Sort (cost=3D90247.34..91169.63 rows=3D368915 width=3D55) > Sort Key: addresses.zipcode, addresses.housenumber > -> Hash Join (cost=3D14598.44..56135.75 rows=3D368915 = width=3D55) > Hash Cond: ("outer".contactaddress =3D "inner".objectid) > -> Seq Scan on customers (cost=3D0.00..31392.15 > rows=3D368915 width=3D80) > -> Hash (cost=3D13675.15..13675.15 rows=3D369315 = width=3D55) > -> Seq Scan on addresses (cost=3D0.00..13675.15 > rows=3D369315 width=3D55) >=20 > The customers table has an index on contactaddress and objectid. > The addresses table has an index on zipcode+housenumber and objectid. The planner chooses sequential scans on customers.contactaddress and = addresses.objectid instead of using the indices. In order to determine = whether this is a sane decision, you should run EXPLAIN ANALYZE on this = query, once with SET ENABLE_SEQSCAN =3D on; and once with SET = ENABLE_SEQSCAN =3D off;. If the query is significantly faster with = SEQSCAN off, then something is amiss - either you haven't run analyze = often enough so the stats are out of date or you have random_page_cost = set too high (look for the setting in postgresql.conf) - these two are = the "usual suspects". Kind regards Markus From pgsql-performance-owner@postgresql.org Tue Dec 6 06:21:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 60C739DCAEE for ; Tue, 6 Dec 2005 06:21:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82914-05 for ; Tue, 6 Dec 2005 06:21:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by postgresql.org (Postfix) with ESMTP id 141B69DCAC4 for ; Tue, 6 Dec 2005 06:20:59 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 06 Dec 2005 11:21:00 +0100 Subject: Re: Can this query go faster??? From: Joost Kraaijeveld To: Csaba Nagy Cc: Pgsql-Performance In-Reply-To: <1133862777.4779.185.camel@coppola.muc.ecircle.de> References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 06 Dec 2005 11:21:00 +0100 Message-Id: <1133864460.8837.69.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/154 X-Sequence-Number: 15975 On Tue, 2005-12-06 at 10:52 +0100, Csaba Nagy wrote: > Joost, > > Why do you use an offset here ? I guess you're traversing the table > somehow, in this case it would be better to remember the last zipcode + > housenumber and put an additional condition to get the next bigger than > the last one you've got... that would go for the index on > zipcode+housenumber and be very fast. The big offset forces postgres to > traverse that many entries until it's able to pick the one row for the I am forced to translate a sorting dependent record number to a record in the database. The GUI (a Java JTable) works with record /row numbers, which is handy if one has an ISAM database, but not if one uses PostgreSQL. I wonder if using a forward scrolling cursor would be faster. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Dec 6 06:32:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1B2F19DD446 for ; Tue, 6 Dec 2005 06:32:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82532-08 for ; Tue, 6 Dec 2005 06:32:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id D5C299DD441 for ; Tue, 6 Dec 2005 06:32:36 -0400 (AST) Received: from [10.100.1.50] (074-016-066-080.eggenet.de [80.66.16.74]) by service-web.de (Postfix) with ESMTP id E46F9200034; Tue, 6 Dec 2005 11:32:38 +0100 (CET) Message-ID: <439568C4.8050601@wildenhain.de> Date: Tue, 06 Dec 2005 11:32:36 +0100 From: Tino Wildenhain User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050929) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld Cc: Csaba Nagy , Pgsql-Performance Subject: Re: Can this query go faster??? References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> In-Reply-To: <1133864460.8837.69.camel@Panoramix> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/155 X-Sequence-Number: 15976 Joost Kraaijeveld schrieb: > On Tue, 2005-12-06 at 10:52 +0100, Csaba Nagy wrote: > >>Joost, >> >>Why do you use an offset here ? I guess you're traversing the table >>somehow, in this case it would be better to remember the last zipcode + >>housenumber and put an additional condition to get the next bigger than >>the last one you've got... that would go for the index on >>zipcode+housenumber and be very fast. The big offset forces postgres to >>traverse that many entries until it's able to pick the one row for the > > I am forced to translate a sorting dependent record number to a record > in the database. The GUI (a Java JTable) works with record /row numbers, > which is handy if one has an ISAM database, but not if one uses > PostgreSQL. You can have a row number in postgres easily too. For example if you just include a serial for the row number. Cursor would work too but you would need to have a persistent connection. Regards Tino From pgsql-performance-owner@postgresql.org Tue Dec 6 06:40:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3893C9DD55C for ; Tue, 6 Dec 2005 06:40:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84321-07 for ; Tue, 6 Dec 2005 06:40:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from lobnya.ru (gw.lobnya.ru [213.171.58.250]) by postgresql.org (Postfix) with ESMTP id C872E9DD55B for ; Tue, 6 Dec 2005 06:40:49 -0400 (AST) Received: from [10.0.14.9] ([10.0.14.9] verified) by lobnya.ru (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 6349991; Tue, 06 Dec 2005 13:24:57 +0300 Message-ID: <43956AAF.7060108@mail.ru> Date: Tue, 06 Dec 2005 13:40:47 +0300 From: Olleg Organization: Moscow Intitute of Physics and Technology User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ron CC: pgsql-performance@postgresql.org Subject: Re: BLCKSZ References: <29518.1133794958@sss.pgh.pa.us> <4394B1D3.7000304@mail.ru> <6.2.5.6.0.20051205183120.01dd6a80@earthlink.net> In-Reply-To: <6.2.5.6.0.20051205183120.01dd6a80@earthlink.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/156 X-Sequence-Number: 15977 Ron wrote: > In general, and in a very fuzzy sense, "bigger is better". pg files are > laid down in 1GB chunks, so there's probably one limitation. Hm, expect result of tests on other platforms, but if there theoretical dispute... I can't undestand why "bigger is better". For instance in search by index. Index point to page and I need load page to get one row. Thus I load 8kb from disk for every raw. And keep it then in cache. You recommend 64kb. With your recomendation I'll get 8 times more IO throughput, 8 time more head seek on disk, 8 time more memory cache (OS cache and postgresql) become busy. I have small row in often loaded table, 32 bytes. Table is not clustered, used several indices. And you recommend load 64Kb when I need only 32b, isn't it? -- Olleg From pgsql-general-owner@postgresql.org Tue Dec 6 06:46:14 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3B1199DD4F4 for ; Tue, 6 Dec 2005 06:46:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82630-10 for ; Tue, 6 Dec 2005 06:46:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 8B7A99DD5EC for ; Tue, 6 Dec 2005 06:46:08 -0400 (AST) Received: from mx1.magproductions.nl (magtwo.magproductions.nl [217.114.101.51]) by svr2.postgresql.org (Postfix) with ESMTP id D91F5F0BEF for ; Tue, 6 Dec 2005 10:46:10 +0000 (GMT) Received: from cc756500-a.ensch1.ov.home.nl ([82.75.196.246] helo=[192.168.0.135]) by mx1.magproductions.nl with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1EjaKp-00056U-G2; Tue, 06 Dec 2005 11:46:11 +0100 Message-ID: <43956BDC.6070704@magproductions.nl> Date: Tue, 06 Dec 2005 11:45:48 +0100 From: Alban Hertroys User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jenny Cc: pgsql-general@postgresql.org Subject: Re: need help References: <20051206083838.90175.qmail@web31508.mail.mud.yahoo.com> In-Reply-To: <20051206083838.90175.qmail@web31508.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200512/306 X-Sequence-Number: 87869 Jenny wrote: > I'm running PostgreSQL 8.0.3 on i686-pc-linux-gnu (Fedora Core 2). I've been > dealing with Psql for over than 2 years now, but I've never had this case > before. > Then I try to run the query from the psql shell. For example, the table has > obat_id : A, B, C, D. > db=# UPDATE s_apotik SET stock = 100 WHERE obat_id='A'; > (.... nothing happens.. I press the Ctrl-C to stop it. This is what comes out > :) > Cancel request sent > ERROR: canceling query due to user request > > (If I try another obat_id) > db=# UPDATE s_apotik SET stock = 100 WHERE obat_id='B'; > (Less than a second, this is what comes out :) > UPDATE 1 It could well be another client has a lock on that record, for example by doing a SELECT FOR UPDATE w/o a NOWAIT. You can verify by querying pg_locks. IIRC you can also see what query caused the lock by joining against some other system table, but the details escape me atm (check the archives, I learned that by following this list). If it's indeed a locked record, the process causing the lock is listed. Either kill it or call it's owner back from his/her coffee break ;) I doubt it's anything serious. -- Alban Hertroys alban@magproductions.nl magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postbus 416 7500 AK Enschede //Showing your Vision to the World// From pgsql-performance-owner@postgresql.org Tue Dec 6 06:59:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A54CF9DD55C for ; Tue, 6 Dec 2005 06:59:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87946-01 for ; Tue, 6 Dec 2005 06:59:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 03FD09DD4F5 for ; Tue, 6 Dec 2005 06:59:40 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EjaXq-0006Cm-HP for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 11:59:38 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EjaXn-0005h8-00 for ; Tue, 06 Dec 2005 11:59:35 +0100 Date: Tue, 6 Dec 2005 11:59:35 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: BLCKSZ Message-ID: <20051206105935.GA21823@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <29518.1133794958@sss.pgh.pa.us> <4394B1D3.7000304@mail.ru> <6.2.5.6.0.20051205183120.01dd6a80@earthlink.net> <43956AAF.7060108@mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <43956AAF.7060108@mail.ru> X-Operating-System: Linux 2.6.14 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/157 X-Sequence-Number: 15978 On Tue, Dec 06, 2005 at 01:40:47PM +0300, Olleg wrote: > I can't undestand why "bigger is better". For instance in search by > index. Index point to page and I need load page to get one row. Thus I > load 8kb from disk for every raw. And keep it then in cache. You > recommend 64kb. With your recomendation I'll get 8 times more IO > throughput, 8 time more head seek on disk, 8 time more memory cache (OS > cache and postgresql) become busy. Hopefully, you won't have eight times the seeking; a single block ought to be in one chunk on disk. You're of course at your filesystem's mercy, though. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Dec 6 07:21:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 62B209DCBD9 for ; Tue, 6 Dec 2005 07:21:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89268-07 for ; Tue, 6 Dec 2005 07:21:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by postgresql.org (Postfix) with ESMTP id E6B709DCAC4 for ; Tue, 6 Dec 2005 07:21:22 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 06 Dec 2005 12:21:24 +0100 Subject: Re: Can this query go faster??? From: Joost Kraaijeveld To: Tino Wildenhain Cc: Csaba Nagy , Pgsql-Performance In-Reply-To: <439568C4.8050601@wildenhain.de> References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> <439568C4.8050601@wildenhain.de> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 06 Dec 2005 12:21:24 +0100 Message-Id: <1133868084.8837.73.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/158 X-Sequence-Number: 15979 Hi Tino, On Tue, 2005-12-06 at 11:32 +0100, Tino Wildenhain wrote: > You can have a row number in postgres easily too. For example if you > just include a serial for the row number. Not if the order of things is determined runtime and not at insert time... > Cursor would work too but you would need to have a persistent connection. I just tried it: a cursor is not faster (what does not surprise me at all, as the amount of work looks the same to me) I guess there is no solution. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Dec 6 07:36:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C616F9DCAEE for ; Tue, 6 Dec 2005 07:36:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89569-10 for ; Tue, 6 Dec 2005 07:36:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id 2D6B89DD5F7 for ; Tue, 6 Dec 2005 07:36:51 -0400 (AST) Received: from [10.100.1.50] (074-016-066-080.eggenet.de [80.66.16.74]) by service-web.de (Postfix) with ESMTP id 90694200034; Tue, 6 Dec 2005 12:36:53 +0100 (CET) Message-ID: <439577D2.9090208@wildenhain.de> Date: Tue, 06 Dec 2005 12:36:50 +0100 From: Tino Wildenhain User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050929) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld Cc: Csaba Nagy , Pgsql-Performance Subject: Re: Can this query go faster??? References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> <439568C4.8050601@wildenhain.de> <1133868084.8837.73.camel@Panoramix> In-Reply-To: <1133868084.8837.73.camel@Panoramix> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/159 X-Sequence-Number: 15980 Joost Kraaijeveld schrieb: > Hi Tino, > .. > >>Cursor would work too but you would need to have a persistent connection. > > I just tried it: a cursor is not faster (what does not surprise me at > all, as the amount of work looks the same to me) Actually no, if you scroll forward, you just ask the database for the next rows to materialize. So if you are ahead in your database and ask for next rows, it should be faster then working w/ an offset from start each time. From pgsql-performance-owner@postgresql.org Tue Dec 6 07:42:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 95EF39DD5EA for ; Tue, 6 Dec 2005 07:42:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90369-10 for ; Tue, 6 Dec 2005 07:42:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id C0D1D9DD5EC for ; Tue, 6 Dec 2005 07:40:08 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 122B71AC3E9; Tue, 6 Dec 2005 03:40:28 -0800 (PST) Date: Tue, 6 Dec 2005 03:39:41 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: "Steinar H. Gunderson" Cc: pgsql-performance@postgresql.org Subject: Re: BLCKSZ In-Reply-To: <20051206105935.GA21823@uio.no> Message-ID: References: <29518.1133794958@sss.pgh.pa.us> <4394B1D3.7000304@mail.ru> <6.2.5.6.0.20051205183120.01dd6a80@earthlink.net> <43956AAF.7060108@mail.ru> <20051206105935.GA21823@uio.no> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/160 X-Sequence-Number: 15981 On Tue, 6 Dec 2005, Steinar H. Gunderson wrote: > On Tue, Dec 06, 2005 at 01:40:47PM +0300, Olleg wrote: >> I can't undestand why "bigger is better". For instance in search by >> index. Index point to page and I need load page to get one row. Thus I >> load 8kb from disk for every raw. And keep it then in cache. You >> recommend 64kb. With your recomendation I'll get 8 times more IO >> throughput, 8 time more head seek on disk, 8 time more memory cache (OS >> cache and postgresql) become busy. > > Hopefully, you won't have eight times the seeking; a single block ought to be > in one chunk on disk. You're of course at your filesystem's mercy, though. in fact useually it would mean 1/8 as many seeks, since the 64k chunk would be created all at once it's probably going to be one chunk on disk as Steiner points out and that means that you do one seek per 64k instead of one seek per 8k. With current disks it's getting to the point where it's the same cost to read 8k as it is to read 64k (i.e. almost free, you could read substantially more then 64k and not notice it in I/O speed), it's the seeks that are expensive. yes it will eat up more ram, but assuming that you are likly to need other things nearby it's likly to be a win. as processor speed keeps climing compared to memory and disk speed true random access is really not the correct way to think about I/O anymore. It's frequently more appropriate to think of your memory and disks as if they were tape drives (seek then read, repeat) even for memory access what you really do is seek to the beginning of a block (expensive) then read that block into cache (cheap, you get the entire cacheline of 64-128 bytes no matter if you need it or not) and then you can then access that block fairly quickly. with memory on SMP machines it's a constant cost to seek anywhere in memory, with NUMA machines (including multi-socket Opterons) the cost to do the seek and fetch depends on where in memory you are seeking to and what cpu you are running on. it also becomes very expensive for multiple CPU's to write to memory addresses that are in the same block (cacheline) of memory. for disks it's even more dramatic, the seek is incredibly expensive compared to the read/write, and the cost of the seek varies based on how far you need to seek, but once you are on a track you can read the entire track in for about the same cost as a single block (in fact the drive useually does read the entire track before sending the one block on to you). Raid complicates this becouse you have a block size per drive and reading larger then that block size involves multiple drives. most of the work in dealing with these issues and optimizing for them is the job of the OS, some other databases work very hard to take over this work from the OS, Postgres instead tries to let the OS do this work, but we still need to keep it in mind when configuring things becouse it's possible to make it much easier or much harder for the OS optimize things. David Lang From pgsql-performance-owner@postgresql.org Tue Dec 6 08:20:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 398669DD5FD for ; Tue, 6 Dec 2005 08:20:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01165-01 for ; Tue, 6 Dec 2005 08:20:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by postgresql.org (Postfix) with ESMTP id CFDB79DD5F9 for ; Tue, 6 Dec 2005 08:20:42 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 06 Dec 2005 13:20:45 +0100 Subject: Re: Can this query go faster??? From: Joost Kraaijeveld To: Tino Wildenhain Cc: Csaba Nagy , Pgsql-Performance In-Reply-To: <439577D2.9090208@wildenhain.de> References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> <439568C4.8050601@wildenhain.de> <1133868084.8837.73.camel@Panoramix> <439577D2.9090208@wildenhain.de> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 06 Dec 2005 13:20:45 +0100 Message-Id: <1133871645.8837.78.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/161 X-Sequence-Number: 15982 On Tue, 2005-12-06 at 12:36 +0100, Tino Wildenhain wrote: > > > > I just tried it: a cursor is not faster (what does not surprise me at > > all, as the amount of work looks the same to me) > > Actually no, if you scroll forward, you just ask the database for the > next rows to materialize. So if you are ahead in your database and > ask for next rows, it should be faster then working w/ an offset > from start each time. Ah, a misunderstanding: I only need to calculate an index if the user wants a record that is not in or adjacent to the cache (in which case I can do a "select values > last value in the cache". So I must always materialize all rows below the wanted index. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Dec 6 08:30:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 772C29DD5F0 for ; Tue, 6 Dec 2005 08:30:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00688-08 for ; Tue, 6 Dec 2005 08:30:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id 9E2B09DD5EA for ; Tue, 6 Dec 2005 08:30:25 -0400 (AST) Received: from [10.100.1.50] (074-016-066-080.eggenet.de [80.66.16.74]) by service-web.de (Postfix) with ESMTP id 22ADA200034; Tue, 6 Dec 2005 13:30:28 +0100 (CET) Message-ID: <43958461.2060106@wildenhain.de> Date: Tue, 06 Dec 2005 13:30:25 +0100 From: Tino Wildenhain User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050929) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld Cc: Csaba Nagy , Pgsql-Performance Subject: Re: Can this query go faster??? References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> <439568C4.8050601@wildenhain.de> <1133868084.8837.73.camel@Panoramix> <439577D2.9090208@wildenhain.de> <1133871645.8837.78.camel@Panoramix> In-Reply-To: <1133871645.8837.78.camel@Panoramix> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/162 X-Sequence-Number: 15983 Joost Kraaijeveld schrieb: > On Tue, 2005-12-06 at 12:36 +0100, Tino Wildenhain wrote: > >>>I just tried it: a cursor is not faster (what does not surprise me at >>>all, as the amount of work looks the same to me) >> >>Actually no, if you scroll forward, you just ask the database for the >>next rows to materialize. So if you are ahead in your database and >>ask for next rows, it should be faster then working w/ an offset >>from start each time. > > Ah, a misunderstanding: I only need to calculate an index if the user > wants a record that is not in or adjacent to the cache (in which case I > can do a "select values > last value in the cache". So I must always > materialize all rows below the wanted index. > Yes, but still advancing a few blocks from where the cursor is should be faster then re-issuing the query and scroll thru the whole resultset to where you want to go. From pgsql-performance-owner@postgresql.org Tue Dec 6 08:42:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2A5969DCAC3 for ; Tue, 6 Dec 2005 08:42:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03187-04 for ; Tue, 6 Dec 2005 08:42:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail3.ecircle.de (unknown [195.140.186.206]) by postgresql.org (Postfix) with ESMTP id F14FE9DCAEE for ; Tue, 6 Dec 2005 08:42:41 -0400 (AST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by mail3.ecircle.de (READY) with ESMTP id 48B8011C031; Tue, 6 Dec 2005 13:42:45 +0100 (CET) Received: from [192.168.1.110] ([192.168.1.110]) by deimos.muc.ecircle.de with Microsoft SMTPSVC(5.0.2195.6713); Tue, 6 Dec 2005 13:32:57 +0100 Subject: Re: Can this query go faster??? From: Csaba Nagy To: Joost Kraaijeveld Cc: Tino Wildenhain , Pgsql-Performance In-Reply-To: <1133871645.8837.78.camel@Panoramix> References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> <439568C4.8050601@wildenhain.de> <1133868084.8837.73.camel@Panoramix> <439577D2.9090208@wildenhain.de> <1133871645.8837.78.camel@Panoramix> Content-Type: text/plain Message-Id: <1133872377.4779.200.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 06 Dec 2005 13:32:57 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Dec 2005 12:32:57.0567 (UTC) FILETIME=[301966F0:01C5FA61] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/164 X-Sequence-Number: 15985 On Tue, 2005-12-06 at 13:20, Joost Kraaijeveld wrote: [snip] > Ah, a misunderstanding: I only need to calculate an index if the user > wants a record that is not in or adjacent to the cache (in which case I > can do a "select values > last value in the cache". So I must always > materialize all rows below the wanted index. In this case the query will very likely not work faster. It must always visit all the records till the required offset. If the plan should be faster using the index, then you probably need to analyze (I don't recall from your former posts if you did it recently or not), in any case you could check an "explain analyze" to see if the planner is mistaken or not - you might already know this. Cheers, Csaba. From pgsql-performance-owner@postgresql.org Tue Dec 6 08:35:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BB5459DCBD1 for ; Tue, 6 Dec 2005 08:35:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01162-07 for ; Tue, 6 Dec 2005 08:35:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp013.mail.yahoo.com (smtp013.mail.yahoo.com [216.136.173.57]) by postgresql.org (Postfix) with SMTP id CE5A69DCC26 for ; Tue, 6 Dec 2005 08:35:06 -0400 (AST) Received: (qmail 55986 invoked from network); 6 Dec 2005 12:35:04 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=Yahoo.com; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=fXVVE0y1iBb3ag7/VpciRb/eSJggfxWiyLQJJatQRt2NXB8JHECaqzXrV21IC2SLKtBt89UvYk9ldd1e2+P3qW6fWP6fk4WO2JEzHrEtnkXg2nfcsA7WtuTBch+TqH2vamhAI8J+ePDWGic2EScWwg5y13jKkW3oDn25rkExoGE= ; Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp013.mail.yahoo.com with SMTP; 6 Dec 2005 12:35:04 -0000 Received: from [172.21.8.23] (mars.black-lion.info [192.168.192.101]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id jB6CYx1o018065; Tue, 6 Dec 2005 07:35:02 -0500 (EST) (envelope-from JanWieck@Yahoo.com) Message-ID: <4395855F.5050705@Yahoo.com> Date: Tue, 06 Dec 2005 07:34:39 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Assaf Yaari CC: Bruno Wolff III , pgsql-performance@postgresql.org Subject: Re: Performance degradation after successive UPDATE's References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.35 required=5 tests=[AWL=-0.129, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.35 X-Spam-Level: X-Archive-Number: 200512/163 X-Sequence-Number: 15984 On 12/6/2005 4:08 AM, Assaf Yaari wrote: > Thanks Bruno, > > Issuing VACUUM FULL seems not to have influence on the time. > I've added to my script VACUUM ANALYZE every 100 UPDATE's and run the > test again (on different record) and the time still increase. I think he meant - run VACUUM FULL once, - adjust FSM settings to database size and turnover ratio - run VACUUM ANALYZE more frequent from there on. Jan > > Any other ideas? > > Thanks, > Assaf. > >> -----Original Message----- >> From: Bruno Wolff III [mailto:bruno@wolff.to] >> Sent: Monday, December 05, 2005 10:36 PM >> To: Assaf Yaari >> Cc: pgsql-performance@postgresql.org >> Subject: Re: Performance degradation after successive UPDATE's >> >> On Mon, Dec 05, 2005 at 19:05:01 +0200, >> Assaf Yaari wrote: >> > Hi, >> > >> > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. >> > >> > My application updates counters in DB. I left a test over the night >> > that increased counter of specific record. After night running >> > (several hundreds of thousands updates), I found out that the time >> > spent on UPDATE increased to be more than 1.5 second (at >> the beginning >> > it was less than 10ms)! Issuing VACUUM ANALYZE and even >> reboot didn't >> > seemed to solve the problem. >> >> You need to be running vacuum more often to get rid of the >> deleted rows (update is essentially insert + delete). Once >> you get too many, plain vacuum won't be able to clean them up >> without raising the value you use for FSM. By now the table >> is really bloated and you probably want to use vacuum full on it. >> > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Tue Dec 6 09:41:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5A37C9DCADB for ; Tue, 6 Dec 2005 09:41:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12150-03 for ; Tue, 6 Dec 2005 09:41:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth09.mail.atl.earthlink.net (smtpauth09.mail.atl.earthlink.net [209.86.89.69]) by postgresql.org (Postfix) with ESMTP id 04B589DCAC4 for ; Tue, 6 Dec 2005 09:41:12 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=eQqmr2XQKlIPKIAPkrx/MtFcHaOp5EitOUFM1Jw5afmi9jQ5cHuxCAMnB+WmQWAJ; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth09.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1Ejd4F-0002II-OO; Tue, 06 Dec 2005 08:41:15 -0500 Message-Id: <6.2.5.6.0.20051206080854.01de6ba0@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 06 Dec 2005 08:41:11 -0500 To: Joost Kraaijeveld , Pgsql-Performance From: Ron Subject: Re: Can this query go faster??? In-Reply-To: <1133862229.8837.61.camel@Panoramix> References: <1133862229.8837.61.camel@Panoramix> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc343ae2dd30243cf28756bb53ef9a2829350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/165 X-Sequence-Number: 15986 At 04:43 AM 12/6/2005, Joost Kraaijeveld wrote: >Hi, > >Is it possible to get this query run faster than it does now, by adding >indexes, changing the query? > >SELECT customers.objectid FROM prototype.customers, prototype.addresses >WHERE >customers.contactaddress = addresses.objectid >ORDER BY zipCode asc, housenumber asc >LIMIT 1 OFFSET 283745 > >Explain: > >Limit (cost=90956.71..90956.71 rows=1 width=55) > -> Sort (cost=90247.34..91169.63 rows=368915 width=55) > Sort Key: addresses.zipcode, addresses.housenumber > -> Hash Join (cost=14598.44..56135.75 rows=368915 width=55) > Hash Cond: ("outer".contactaddress = "inner".objectid) > -> Seq Scan on customers (cost=0.00..31392.15 >rows=368915 width=80) > -> Hash (cost=13675.15..13675.15 rows=369315 width=55) > -> Seq Scan on addresses (cost=0.00..13675.15 >rows=369315 width=55) > >The customers table has an index on contactaddress and objectid. >The addresses table has an index on zipcode+housenumber and objectid. > >TIA customer names, customers.objectid, addresses, and addresses.objectid should all be static (addresses do not change, just the customers associated with them; and once a customer has been assigned an id that better never change...). To me, this sounds like the addresses and customers tables should be duplicated and then physically laid out in sorted order by .objectid in one set and by the "human friendly" associated string in the other set. Then a finding a specific .objectid or it's associated string can be done in at worse O(lgn) time assuming binary search instead of O(n) time for a sequential scan. If pg is clever enough, it might be able to do better than that. IOW, I'd try duplicating the addresses and customers tables and using the appropriate CLUSTERed Index on each. I know this breaks Normal Form. OTOH, this kind of thing is common practice for data mining problems on static or almost static data. Hope this is helpful, Ron From pgsql-performance-owner@postgresql.org Tue Dec 6 09:58:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6D6949DCAC0 for ; Tue, 6 Dec 2005 09:58:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13299-08 for ; Tue, 6 Dec 2005 09:58:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id E4F8F9DCAAF for ; Tue, 6 Dec 2005 09:58:34 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Can this query go faster??? Date: Tue, 6 Dec 2005 08:58:31 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DDA50@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can this query go faster??? thread-index: AcX6V0PzsfmrU8BCQ5if2LnrULh0BgAFKQug From: "Merlin Moncure" To: "Joost Kraaijeveld" Cc: "Pgsql-Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/166 X-Sequence-Number: 15987 > On Tue, 2005-12-06 at 11:32 +0100, Tino Wildenhain wrote: > > You can have a row number in postgres easily too. For example if you > > just include a serial for the row number. > Not if the order of things is determined runtime and not at insert time... >=20 > > Cursor would work too but you would need to have a persistent > connection. > I just tried it: a cursor is not faster (what does not surprise me at > all, as the amount of work looks the same to me) >=20 > I guess there is no solution. >=20 sure there is. This begs the question: 'why do you want to read exactly 283745 rows ahead of row 'x'?) :) If you are scrolling forwards in a set, just pull in, say, 100-1000 rows at a time, ordered, and grab the next 1000 based on the highest value read previously. You can do this on server side (cursor) or client side (parameterized query). There are advantages and disadvantages to each. If you are looping over this set and doing processing, a cursor would be ideal (try out pl/pgsql). Welcome to PostgreSQL! :)=20 Merlin From pgsql-performance-owner@postgresql.org Tue Dec 6 10:46:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BA5819DCB9C for ; Tue, 6 Dec 2005 10:45:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20383-05 for ; Tue, 6 Dec 2005 10:46:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 620229DCBC4 for ; Tue, 6 Dec 2005 10:45:57 -0400 (AST) 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 jB6Ejxt5029917; Tue, 6 Dec 2005 09:45:59 -0500 (EST) To: Kathy Lo cc: pgsql-performance@postgresql.org Subject: Re: Memory Leakage Problem In-reply-to: References: Comments: In-reply-to Kathy Lo message dated "Tue, 06 Dec 2005 17:22:30 +0800" Date: Tue, 06 Dec 2005 09:45:59 -0500 Message-ID: <29916.1133880359@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/167 X-Sequence-Number: 15988 Kathy Lo writes: > I found that the memory of the databaser server nearly used up (total 2G RAM). > After I stop the program, the used memory did not free. I see no particular reason to believe that you are describing an actual memory leak. More likely, you are just seeing the kernel's normal behavior of eating up unused memory for disk cache space. Repeat after me: zero free memory is the normal and desirable condition on Unix-like systems. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 12:00:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2A9819DCCC3 for ; Tue, 6 Dec 2005 12:00:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34821-04 for ; Tue, 6 Dec 2005 12:00:02 -0400 (AST) X-Greylist: delayed 10:07:29.18447 by SQLgrey- Received: from fuse6.mailanyone.net (fuse6.mailanyone.net [69.31.1.175]) by postgresql.org (Postfix) with ESMTP id CB59D9DCCC4 for ; Tue, 6 Dec 2005 11:59:58 -0400 (AST) Received: from mailanyone.net by fuse6.mailanyone.net with asmtp (TLSv1:AES256-SHA:256) (MailAnyone extSMTP) id 1EjfEV-0001wP-V6 for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 10:00:00 -0600 Message-ID: <4395B59A.1080301@tgharold.com> Date: Tue, 06 Dec 2005 11:00:26 -0500 From: Thomas Harold User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728 X-Accept-Language: en-us, en, ja, zh-cn, zh-hk, zh-sg, zh-tw, ko, ko-kp, ko-kr MIME-Version: 1.0 CC: pgsql-performance@postgresql.org Subject: Re: two disks - best way to use them? References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> <43946148.9010607@tgharold.com> <43946EA1.8090908@tgharold.com> <4395273B.90902@tgharold.com> <6.2.5.6.0.20051206030948.01dd4bb0@earthlink.net> In-Reply-To: <6.2.5.6.0.20051206030948.01dd4bb0@earthlink.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, score=0.634 required=5 tests=[AWL=0.444, MISSING_HEADERS=0.189, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.634 X-Spam-Level: X-Archive-Number: 200512/168 X-Sequence-Number: 15989 Ron wrote: > For accuracy's sake, which exact config did you finally use? > > How did you choose the config you finally used? Did you test the three > options or just pick one? (Note: I'm not the original poster.) I just picked the option of putting the data/pg_xlog directory (WAL) on a 2nd set of spindles. That was the easiest thing for me to change on this test box. The test server is simply a Gentoo box running software RAID and LVM2. The primary disk set is 2x7200RPM 300GB drives and the secondary disk set is 2x5400RPM 300GB drives. Brand new install of PGSQL 8.1, with mostly default settings (I changed FSM pages to be a higher value, max_fsm_pages = 150000). PGSQL was given it's own ext3 32GB LVM volume on the primary disk set (2x7200RPM). Originally, all files were on the primary disk. The task at hand was inserting large quantity of ~45 byte rows (according to "vacuum verbose"), on the order of millions of records per table. There was an unique key and a unique index. Test clients were accessing the database via ODBC / ADO and doing the inserts in a fairly brute-force mode (attempt the insert, calling .CancelUpdate if it fails). When the tables were under 2 million rows, performance was okay. At one point, I had a 1.8Ghz P4, dual Opteron 246, and Opteron 148 CPUs running at nearly 100% CPU processing and doing inserts into the database. So I had 4 clients running, performing inserts to 4 separate tables in the same database. The P4 ran at about half the throughput as the Opterons (client-bound due to the code that generated row data prior to the insert), so I'd score my throughput as roughly 3.3-3.4. Where 1.0 would be full utilization of the Opteron 148 box. However, once the tables started getting above ~2 million rows, performance took a nose dive. CPU utilizations on the 4 client CPUs dropped into the basement (5-20% CPU) and I had to back off on the number of clients. So throughput had dropped down to around 0.25 or so. The linux box was spending nearly all of its time waiting on the primary disks. Moving the data/pg_xlog (WAL) to the 2nd set of disks (2x5400RPM) in the test server made a dramatic difference for this mass insert. I'm running the P4 (100% CPU) and the Opteron 148 (~80% CPU) at the moment. While it's not up to full speed, a throughput of ~1.3 is a lot better then the ~0.25 that I was getting prior. (The two tables currently being written have over 5 million rows each. One table has ~16 million rows.) Wait percentage in "top" is only running 20-30% (dipping as low as 10%). I haven't pushed this new setup hard enough to determine where the upper limit for throughput is. It's very much a niche test (millions of inserts of narrow rows into multiple tables using fairly brain-dead code). But it gives me data points on which to base purchasing of the production box. The original plan was a simple RAID1 setup (2 spindles), but this tells me it's better to order 4 spindles and set it up as a pair of RAID1 sets. Whether 4 spindles is better as two separate RAID1 arrays, or configured as a single RAID1+0 array... dunno. Our application is typically more limited by insert speed then read speed (so I'm leaning towards separate RAID arrays). I'm sure there's also more tuning that could be done to the PGSQL database (in the configuration file). Also, the code is throwaway code that isn't the most elegant. From pgsql-performance-owner@postgresql.org Tue Dec 6 15:20:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8FC809DD451 for ; Tue, 6 Dec 2005 15:20:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67736-09 for ; Tue, 6 Dec 2005 15:20:41 -0400 (AST) X-Greylist: delayed 03:06:24.742031 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 558019DCD4D for ; Tue, 6 Dec 2005 15:20:38 -0400 (AST) Received: from karadi.cs.wisc.edu (karadi.cs.wisc.edu [128.105.167.23]) by svr2.postgresql.org (Postfix) with ESMTP id 4C2A2F0B24 for ; Tue, 6 Dec 2005 16:14:12 +0000 (GMT) Received: from karadi.cs.wisc.edu (localhost [127.0.0.1]) by karadi.cs.wisc.edu (8.13.1/8.13.1) with ESMTP id jB6GE9iU021918 for ; Tue, 6 Dec 2005 10:14:09 -0600 Received: from localhost (akini@localhost) by karadi.cs.wisc.edu (8.13.1/8.13.1/Submit) with ESMTP id jB6GE9CN021915 for ; Tue, 6 Dec 2005 10:14:09 -0600 X-Authentication-Warning: karadi.cs.wisc.edu: akini owned process doing -bs Date: Tue, 6 Dec 2005 10:14:09 -0600 (CST) From: Ameet Kini To: pgsql-performance@postgresql.org Subject: postgresql performance tuning 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, score=0.666 required=5 tests=[AWL=-0.666, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.666 X-Spam-Level: X-Archive-Number: 200512/183 X-Sequence-Number: 16004 Hello, I have a question on postgres's performance tuning, in particular, the vacuum and reindex commands. Currently I do a vacuum (without full) on all of my tables. However, its noted in the docs (e.g. http://developer.postgresql.org/docs/postgres/routine-reindex.html) and on the lists here that indexes may still bloat after a while and hence reindex is necessary. How often do people reindex their tables out there? I guess I'd have to update my cron scripts to do reindexing too along with vacuuming but most probably at a much lower frequency than vacuum. But these scripts do these maintenance tasks at a fixed time (every few hours, days, weeks, etc.) What I would like is to do these tasks on a need basis. So for vacuuming, by "need" I mean every few updates or some such metric that characterizes my workload. Similarly, "need" for the reindex command might mean every few updates or degree of bloat, etc. I came across the pg_autovacuum daemon, which seems to do exactly what I need for vacuums. However, it'd be great if there was a similar automatic reindex utility, like say, a pg_autoreindex daemon. Are there any plans for this feature? If not, then would cron scripts be the next best choice? Thanks, Ameet From pgsql-performance-owner@postgresql.org Tue Dec 6 12:20:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 172C29DCC51 for ; Tue, 6 Dec 2005 12:19:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36573-09 for ; Tue, 6 Dec 2005 12:19:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) by postgresql.org (Postfix) with ESMTP id 8C7999DCBBC for ; Tue, 6 Dec 2005 12:19:56 -0400 (AST) Received: from [192.168.0.2] (cev75-1-81-57-249-136.fbx.proxad.net [81.57.249.136]) (authenticated bits=0) by mail.rilk.com (8.13.0/8.13.0) with ESMTP id jB6GJe4k003576 (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 6 Dec 2005 17:19:54 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: Pailloncy Jean-Gerard Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan Date: Tue, 6 Dec 2005 17:19:34 +0100 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.746.2) X-DCC-CTc-dcc2-Metrics: mail.rilk.com 1031; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/169 X-Sequence-Number: 15990 Hi, After few test, the difference is explained by the =20 effective_cache_size parameter. with effective_cache_size=3D1000 (default) the planner chooses the following plan postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ------------------------------------------------------------------------=20= -------- Aggregate (cost=3D421893.64..421893.65 rows=3D1 width=3D0) -> Unique (cost=3D385193.48..395679.24 rows=3D2097152 width=3D8) -> Sort (cost=3D385193.48..390436.36 rows=3D2097152 width=3D8)= Sort Key: test.val -> Seq Scan on test (cost=3D0.00..31252.52 =20 rows=3D2097152 width=3D8) (5 rows) with effective_cache_size=3D15000 the planner chooses the following plan postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ------------------------------------------------------------------------=20= ------------------ Aggregate (cost=3D101720.39..101720.40 rows=3D1 width=3D0) -> Unique (cost=3D0.00..75505.99 rows=3D2097152 width=3D8) -> Index Scan using testval on test (cost=3D0.00..70263.11 =20= rows=3D2097152 width=3D8) (3 rows) I test some other values for effective_cache_size. The switch from seq to index scan happens between 9900 and 10000 for =20 effective_cache_size. I have my sql server on a OpenBSD 3.8 box with 1 Gb of RAM with =20 nothing else running on it. I setup the cachepercent to 25. I expect to have 25% of 1 Gb of RAM =20 (256 Mb) as file cache. effective_cache_size=3D15000 means 15000 x 8K of OS cache =3D 120,000 Kb = =20 which is lower than my 256 MB of disk cache. I recall the result of my precedent test. #rows 2097152 IndexScan 1363396,581s SeqScan 98758,445s Ratio 13,805 So the planner when effective_cache_size=3D15000 chooses a plan that is =20= 13 times slower than the seqscan one. I did not understand where the problem comes from. Any help welcome. Cordialement, Jean-G=E9rard Pailloncy From pgsql-performance-owner@postgresql.org Tue Dec 6 12:48:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C6ECD9DCAEF for ; Tue, 6 Dec 2005 12:48:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41560-05 for ; Tue, 6 Dec 2005 12:48:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pobox.globalherald.net (pobox.octoberridge.com [192.122.208.6]) by postgresql.org (Postfix) with ESMTP id 8DFF39DCAB0 for ; Tue, 6 Dec 2005 12:48:38 -0400 (AST) Received: from pobox.octoberridge.com (pobox.octoberridge.com [192.122.208.6]) by pobox.globalherald.net (Postfix) with ESMTP id 7605F1C286 for ; Tue, 6 Dec 2005 11:47:44 -0500 (EST) Date: Tue, 6 Dec 2005 11:47:44 -0500 (EST) From: Joshua Kramer X-X-Sender: josh@localhost.localdomain To: pgsql-performance@postgresql.org Subject: TSearch2 vs. Apache Lucene 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, score=0.371 required=5 tests=[AWL=0.371] X-Spam-Score: 0.371 X-Spam-Level: X-Archive-Number: 200512/170 X-Sequence-Number: 15991 Greetings all, I'm going to do a performance comparison with DocMgr and PG81/TSearch2 on one end, and Apache Lucene on the other end. In order to do this, I'm going to create a derivative of the docmgr-autoimport script so that I can specify one file to import at a time. I'll then create a Perl script which logs all details (such as timing, etc.) as the test progresses. As test data, I have approximately 9,000 text files from Project Gutenberg ranging in size from a few hundred bytes to 4.5M. I plan to test the speed of import of each file. Then, I plan to write a web-robot in Perl that will test the speed and number of results returned. Can anyone think of a validation of this test, or how I should configure PG to maximise import and search speed? Can I maximise search speed and import speed, or are those things mutually exclusive? (Note that this will be run on limited hardware - 900MHz Athlon with 512M of ram) Has anyone ever compared TSearch2 to Lucene, as far as performance is concerned? Thanks, -Josh From pgsql-performance-owner@postgresql.org Tue Dec 6 12:57:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DD1189DCCF1 for ; Tue, 6 Dec 2005 12:57:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42545-08 for ; Tue, 6 Dec 2005 12:57:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 70F3B9DCCE5 for ; Tue, 6 Dec 2005 12:57:20 -0400 (AST) 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 jB6GvJZG004679; Tue, 6 Dec 2005 11:57:19 -0500 (EST) To: rm_pg@cheapcomplexdevices.com cc: pgsql-performance@postgresql.org Subject: Re: Missed index opportunity for outer join? In-reply-to: References: <3267.1133822299@sss.pgh.pa.us> Comments: In-reply-to rm_pg@cheapcomplexdevices.com message dated "Mon, 05 Dec 2005 15:05:04 -0800" Date: Tue, 06 Dec 2005 11:57:19 -0500 Message-ID: <4678.1133888239@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/171 X-Sequence-Number: 15992 rm_pg@cheapcomplexdevices.com writes: > On Mon, 5 Dec 2005, Tom Lane wrote: >> (Note to self: it is a bit odd that fac_id=261 is pushed down to become >> an indexqual in one case but not the other ...) > I speculate that the seq_scan wasn't really the slow part > compared to not using using both parts of the index in the > second part of the plan. The table point_features is tens of > thousands of rows, while the table facets is tens of millions. Agreed, but it's still odd that it would use a seqscan in one case and not the other. I found the reason why the fac_id=261 clause isn't getting used as an index qual; it's a bit of excessive paranoia that goes back to 2002. I've fixed that for 8.1.1, but am still wondering about the seqscan on the other side of the join. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 12:59:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7337E9DCAEF for ; Tue, 6 Dec 2005 12:59:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43894-03 for ; Tue, 6 Dec 2005 12:59:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 0099C9DCAAF for ; Tue, 6 Dec 2005 12:59:32 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A6FDA308DA; Tue, 6 Dec 2005 17:59:32 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: TSearch2 vs. Apache Lucene Date: Tue, 06 Dec 2005 17:59:14 +0100 Organization: Hub.Org Networking Services Lines: 10 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/172 X-Sequence-Number: 15993 > Has anyone ever compared TSearch2 to Lucene, as far as performance is > concerned? I'll stay away from TSearch2 until it is fully integrated in the postgres core (like "create index foo_text on foo (texta, textb) USING TSearch2"). Because a full integration is unlikely to happen in the near future (as far as I know), I'll stick to Lucene. Mike From pgsql-performance-owner@postgresql.org Tue Dec 6 16:35:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DEA549DD61A for ; Tue, 6 Dec 2005 16:35:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82915-06 for ; Tue, 6 Dec 2005 16:35:16 -0400 (AST) X-Greylist: delayed 03:10:10.150017 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 501489DCBE7 for ; Tue, 6 Dec 2005 16:10:37 -0400 (AST) Received: from galaxy.systems.pipex.net (galaxy.systems.pipex.net [62.241.162.31]) by svr2.postgresql.org (Postfix) with ESMTP id C9AFDF0C84 for ; Tue, 6 Dec 2005 17:00:28 +0000 (GMT) Received: from [192.168.0.88] (81-178-228-196.dsl.pipex.com [81.178.228.196]) by galaxy.systems.pipex.net (Postfix) with ESMTP id 8BF17E0004D9; Tue, 6 Dec 2005 17:00:21 +0000 (GMT) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <5ECF6B24-6ADB-4FDB-A545-0AFBCB1B66EB@garrett.co.uk> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Russell Garrett Subject: Re: TSearch2 vs. Apache Lucene Date: Tue, 6 Dec 2005 17:00:21 +0000 To: Joshua Kramer X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200512/189 X-Sequence-Number: 16010 On 6 Dec 2005, at 16:47, Joshua Kramer wrote: > Has anyone ever compared TSearch2 to Lucene, as far as performance > is concerned? In our experience (small often-updated documents) Lucene leaves tsearch2 in the dust. This probably has a lot to do with our usage pattern though. For our usage it's very beneficial to have the index on a separate machine to the data, however in many cases this won't make sense. Lucene is also a lot easier to "cluster" than Postgres (it's simply a matter of NFS-mounting the index). Russ Garrett russ@last.fm From pgsql-performance-owner@postgresql.org Tue Dec 6 13:14:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 288E29DCAB0 for ; Tue, 6 Dec 2005 13:14:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45002-09 for ; Tue, 6 Dec 2005 13:14:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by postgresql.org (Postfix) with ESMTP id E47FC9DCAEF for ; Tue, 6 Dec 2005 13:14:21 -0400 (AST) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id jB6HEEv0011300; Tue, 6 Dec 2005 20:14:14 +0300 (MSK) Date: Tue, 6 Dec 2005 20:14:14 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Michael Riess cc: pgsql-performance@postgresql.org Subject: Re: TSearch2 vs. Apache Lucene 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, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200512/173 X-Sequence-Number: 15994 Folks, tsearch2 and Lucene are very different search engines, so it'd be unfair comparison. If you need full access to metadata and instant indexing you, probably, find tsearch2 is more suitable then Lucene. But, if you could live without that features and need to search read only archives you need Lucene. Tsearch2 integration into pgsql would be cool, but, I see no problem to use tsearch2 as an official extension module. After completing our todo, which we hope will likely happens for 8.2 release, you could forget about Lucene and other engines :) We'll be available for developing in spring and we estimate about three months for our todo, so, it's really doable. Oleg On Tue, 6 Dec 2005, Michael Riess wrote: > >> Has anyone ever compared TSearch2 to Lucene, as far as performance is >> concerned? > > I'll stay away from TSearch2 until it is fully integrated in the postgres > core (like "create index foo_text on foo (texta, textb) USING TSearch2"). > Because a full integration is unlikely to happen in the near future (as far > as I know), I'll stick to Lucene. > > Mike > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 From pgsql-performance-owner@postgresql.org Tue Dec 6 13:27:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6BFD99DCCB8 for ; Tue, 6 Dec 2005 13:27:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47410-07 for ; Tue, 6 Dec 2005 13:27:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by postgresql.org (Postfix) with ESMTP id 06B6C9DCCFC for ; Tue, 6 Dec 2005 13:27:34 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jB6HRVN18473; Tue, 6 Dec 2005 12:27:31 -0500 (EST) From: Bruce Momjian Message-Id: <200512061727.jB6HRVN18473@candle.pha.pa.us> Subject: Re: TSearch2 vs. Apache Lucene In-Reply-To: To: Oleg Bartunov Date: Tue, 6 Dec 2005 12:27:31 -0500 (EST) CC: Michael Riess , 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, score=0.012 required=5 tests=[AWL=0.012] X-Spam-Score: 0.012 X-Spam-Level: X-Archive-Number: 200512/174 X-Sequence-Number: 15995 Oleg Bartunov wrote: > Folks, > > tsearch2 and Lucene are very different search engines, so it'd be unfair > comparison. If you need full access to metadata and instant indexing > you, probably, find tsearch2 is more suitable then Lucene. But, if > you could live without that features and need to search read only > archives you need Lucene. > > Tsearch2 integration into pgsql would be cool, but, I see no problem to > use tsearch2 as an official extension module. After completing our > todo, which we hope will likely happens for 8.2 release, you could > forget about Lucene and other engines :) We'll be available for developing > in spring and we estimate about three months for our todo, so, it's > really doable. Agreed. There isn't anything magical about a plug-in vs something integrated, as least in PostgreSQL. In other database, plug-ins can't fully function as integrated, but in PostgreSQL, everything is really a plug-in because it is all abstracted. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Tue Dec 6 13:44:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 460AD9DCD1C for ; Tue, 6 Dec 2005 13:44:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49818-07 for ; Tue, 6 Dec 2005 13:44:04 -0400 (AST) X-Greylist: delayed 01:29:52.203103 by SQLgrey- Received: from karadi.cs.wisc.edu (karadi.cs.wisc.edu [128.105.167.23]) by postgresql.org (Postfix) with ESMTP id 951989DCD4D for ; Tue, 6 Dec 2005 13:44:03 -0400 (AST) Received: from karadi.cs.wisc.edu (localhost [127.0.0.1]) by karadi.cs.wisc.edu (8.13.1/8.13.1) with ESMTP id jB6Hi3Id022145 for ; Tue, 6 Dec 2005 11:44:03 -0600 Received: from localhost (akini@localhost) by karadi.cs.wisc.edu (8.13.1/8.13.1/Submit) with ESMTP id jB6Hi3Vu022142 for ; Tue, 6 Dec 2005 11:44:03 -0600 X-Authentication-Warning: karadi.cs.wisc.edu: akini owned process doing -bs Date: Tue, 6 Dec 2005 11:44:03 -0600 (CST) From: Ameet Kini To: pgsql-performance@postgresql.org Subject: postgresql performance tuning 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/175 X-Sequence-Number: 15996 This didn't get through the first time around, so resending it again. Sorry for any duplicate entries. Hello, I have a question on postgres's performance tuning, in particular, the vacuum and reindex commands. Currently I do a vacuum (without full) on all of my tables. However, its noted in the docs (e.g. http://developer.postgresql.org/docs/postgres/routine-reindex.html) and on the lists here that indexes may still bloat after a while and hence reindex is necessary. How often do people reindex their tables out there? I guess I'd have to update my cron scripts to do reindexing too along with vacuuming but most probably at a much lower frequency than vacuum. But these scripts do these maintenance tasks at a fixed time (every few hours, days, weeks, etc.) What I would like is to do these tasks on a need basis. So for vacuuming, by "need" I mean every few updates or some such metric that characterizes my workload. Similarly, "need" for the reindex command might mean every few updates or degree of bloat, etc. I came across the pg_autovacuum daemon, which seems to do exactly what I need for vacuums. However, it'd be great if there was a similar automatic reindex utility, like say, a pg_autoreindex daemon. Are there any plans for this feature? If not, then would cron scripts be the next best choice? Thanks, Ameet From pgsql-performance-owner@postgresql.org Tue Dec 6 13:48:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7455F9DD5F8 for ; Tue, 6 Dec 2005 13:48:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51308-04 for ; Tue, 6 Dec 2005 13:48:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id B49449DD574 for ; Tue, 6 Dec 2005 13:48:11 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 06 Dec 2005 11:48:08 -0600 Subject: Re: Memory Leakage Problem From: Scott Marlowe To: Kathy Lo Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1133891282.11803.7.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 06 Dec 2005 11:48:08 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/176 X-Sequence-Number: 15997 On Tue, 2005-12-06 at 03:22, Kathy Lo wrote: > Hi, > > In this program, it will access this database server using simple and > complex (joining tables) SQL Select statement and retrieve the matched > rows. For each access, it will connect the database and disconnect it. > > I found that the memory of the databaser server nearly used up (total 2G RAM). > > After I stop the program, the used memory did not free. Ummmm. What exactly do you mean? Can we see the output of top and / or free? I'm guessing that what Tom said is right, you're just seeing a normal state of how unix does things. If your output of free looks like this: -bash-2.05b$ free total used free shared buffers cached Mem:6096912 6069588 27324 0 260728 5547264 -/+ buffers/cache: 261596 5835316 Swap: 4192880 16320 4176560 Then that's normal. That's the output of free on a machine with 6 gigs that runs a reporting database. Note that while it shows almost ALL the memory as used, it is being used by the kernel, which is a good thing. Note that 5547264 or about 90% of memory is being used as kernel cache. That's a good thing. Note you can also get yourself in trouble with top. It's not uncommon for someone to see a bunch of postgres processes each eating up 50 or more megs of ram, and panic and think that they're running out of memory, when, in fact, 44 meg for each of those processes is shared, and the real usage per backend is 6 megs or less. Definitely grab yourself a good unix / linux sysadmin guide. The "in a nutshell" books from O'Reilley (sp?) are a good starting point. From pgsql-performance-owner@postgresql.org Tue Dec 6 14:02:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 773289DD5F8 for ; Tue, 6 Dec 2005 14:02:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52927-05 for ; Tue, 6 Dec 2005 14:02:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id B30369DD44E for ; Tue, 6 Dec 2005 14:02:15 -0400 (AST) 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 jB6I2C0m007984; Tue, 6 Dec 2005 13:02:12 -0500 (EST) To: Bruce Momjian cc: Oleg Bartunov , Michael Riess , pgsql-performance@postgresql.org Subject: Re: TSearch2 vs. Apache Lucene In-reply-to: <200512061727.jB6HRVN18473@candle.pha.pa.us> References: <200512061727.jB6HRVN18473@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Tue, 06 Dec 2005 12:27:31 -0500" Date: Tue, 06 Dec 2005 13:02:12 -0500 Message-ID: <7983.1133892132@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/177 X-Sequence-Number: 15998 Bruce Momjian writes: > Oleg Bartunov wrote: >> Tsearch2 integration into pgsql would be cool, but, I see no problem to >> use tsearch2 as an official extension module. > Agreed. There isn't anything magical about a plug-in vs something > integrated, as least in PostgreSQL. The quality gap between contrib and the main system is a lot smaller than it used to be, at least for those contrib modules that have regression tests. Main and contrib get equal levels of testing from the buildfarm, so they're about on par as far as portability goes. We could never say that before 8.1 ... (Having said that, I think that tsearch2 will eventually become part of core, but probably not for awhile yet.) regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 14:04:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CC4309DD630 for ; Tue, 6 Dec 2005 14:03:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54445-04-6 for ; Tue, 6 Dec 2005 14:03:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7EFF69DD61A for ; Tue, 6 Dec 2005 14:03:52 -0400 (AST) 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 jB6I3kj0008027; Tue, 6 Dec 2005 13:03:46 -0500 (EST) To: Ameet Kini cc: pgsql-performance@postgresql.org Subject: Re: postgresql performance tuning In-reply-to: References: Comments: In-reply-to Ameet Kini message dated "Tue, 06 Dec 2005 11:44:03 -0600" Date: Tue, 06 Dec 2005 13:03:46 -0500 Message-ID: <8026.1133892226@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/178 X-Sequence-Number: 15999 Ameet Kini writes: > I have a question on postgres's performance tuning, in particular, the > vacuum and reindex commands. Currently I do a vacuum (without full) on all > of my tables. However, its noted in the docs (e.g. > http://developer.postgresql.org/docs/postgres/routine-reindex.html) > and on the lists here that indexes may still bloat after a while and hence > reindex is necessary. How often do people reindex their tables out > there? Never, unless you have actual evidence that your indexes are bloating. It's only very specific use-patterns that have problems. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 14:28:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1C2729DD558 for ; Tue, 6 Dec 2005 14:28:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59720-07 for ; Tue, 6 Dec 2005 14:28:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 6D5AD9DCD1C for ; Tue, 6 Dec 2005 14:28:45 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0C3063093F; Tue, 6 Dec 2005 19:28:44 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: TSearch2 vs. Apache Lucene Date: Tue, 06 Dec 2005 19:28:44 +0100 Organization: Hub.Org Networking Services Lines: 29 Message-ID: References: <200512061727.jB6HRVN18473@candle.pha.pa.us> 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <200512061727.jB6HRVN18473@candle.pha.pa.us> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/179 X-Sequence-Number: 16000 Bruce Momjian schrieb: > Oleg Bartunov wrote: >> Folks, >> >> tsearch2 and Lucene are very different search engines, so it'd be unfair >> comparison. If you need full access to metadata and instant indexing >> you, probably, find tsearch2 is more suitable then Lucene. But, if >> you could live without that features and need to search read only >> archives you need Lucene. >> >> Tsearch2 integration into pgsql would be cool, but, I see no problem to >> use tsearch2 as an official extension module. After completing our >> todo, which we hope will likely happens for 8.2 release, you could >> forget about Lucene and other engines :) We'll be available for developing >> in spring and we estimate about three months for our todo, so, it's >> really doable. > > Agreed. There isn't anything magical about a plug-in vs something > integrated, as least in PostgreSQL. In other database, plug-ins can't > fully function as integrated, but in PostgreSQL, everything is really a > plug-in because it is all abstracted. I only remember evaluating TSearch2 about a year ago, and when I read statements like "Vacuum and/or database dump/restore work differently when using TSearch2, sql scripts need to be executed etc." I knew that I would not want to go there. But I don't doubt that it works, and that it is a sane concept. From pgsql-performance-owner@postgresql.org Tue Dec 6 14:32:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 53BF79DD44E for ; Tue, 6 Dec 2005 14:32:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61365-03 for ; Tue, 6 Dec 2005 14:32:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by postgresql.org (Postfix) with ESMTP id CE07B9DCF7E for ; Tue, 6 Dec 2005 14:32:54 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jB6IWsX26488; Tue, 6 Dec 2005 13:32:54 -0500 (EST) From: Bruce Momjian Message-Id: <200512061832.jB6IWsX26488@candle.pha.pa.us> Subject: Re: TSearch2 vs. Apache Lucene In-Reply-To: To: Michael Riess Date: Tue, 6 Dec 2005 13:32:54 -0500 (EST) 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, score=0.011 required=5 tests=[AWL=0.011] X-Spam-Score: 0.011 X-Spam-Level: X-Archive-Number: 200512/180 X-Sequence-Number: 16001 Michael Riess wrote: > Bruce Momjian schrieb: > > Oleg Bartunov wrote: > >> Folks, > >> > >> tsearch2 and Lucene are very different search engines, so it'd be unfair > >> comparison. If you need full access to metadata and instant indexing > >> you, probably, find tsearch2 is more suitable then Lucene. But, if > >> you could live without that features and need to search read only > >> archives you need Lucene. > >> > >> Tsearch2 integration into pgsql would be cool, but, I see no problem to > >> use tsearch2 as an official extension module. After completing our > >> todo, which we hope will likely happens for 8.2 release, you could > >> forget about Lucene and other engines :) We'll be available for developing > >> in spring and we estimate about three months for our todo, so, it's > >> really doable. > > > > Agreed. There isn't anything magical about a plug-in vs something > > integrated, as least in PostgreSQL. In other database, plug-ins can't > > fully function as integrated, but in PostgreSQL, everything is really a > > plug-in because it is all abstracted. > > > I only remember evaluating TSearch2 about a year ago, and when I read > statements like "Vacuum and/or database dump/restore work differently > when using TSearch2, sql scripts need to be executed etc." I knew that I > would not want to go there. > > But I don't doubt that it works, and that it is a sane concept. Good point. I think we had some problems at that point because the API was improved between versions. Even if it had been integrated, we might have had the same problem. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Tue Dec 6 14:33:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A23929DCD1C for ; Tue, 6 Dec 2005 14:33:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59629-08 for ; Tue, 6 Dec 2005 14:33:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id 8B5DE9DCD49 for ; Tue, 6 Dec 2005 14:33:45 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 9A4FAB812 for ; Tue, 6 Dec 2005 13:33:44 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <4CC8779E-4020-426B-B282-7E1FAB1AE93D@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: postgresql performance tuning Date: Tue, 6 Dec 2005 13:33:37 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/181 X-Sequence-Number: 16002 On Dec 6, 2005, at 12:44 PM, Ameet Kini wrote: > I have a question on postgres's performance tuning, in particular, the > vacuum and reindex commands. Currently I do a vacuum (without full) > on all > of my tables. However, its noted in the docs (e.g. > http://developer.postgresql.org/docs/postgres/routine-reindex.html) > and on the lists here that indexes may still bloat after a while > and hence > reindex is necessary. How often do people reindex their tables out Why would you be running a version older than 7.4? Index bloat is mostly a non-issue in recent releases of pg. From pgsql-performance-owner@postgresql.org Tue Dec 6 15:04:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D31289DD60A for ; Tue, 6 Dec 2005 15:04:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64628-07 for ; Tue, 6 Dec 2005 15:04:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id 95D249DD61C for ; Tue, 6 Dec 2005 15:04:05 -0400 (AST) 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: High context switches occurring Date: Tue, 6 Dec 2005 14:04:04 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098EC2@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcXvnMauyWdYhiHHQDarM9k3wrsemQK+kbFw From: "Anjan Dave" To: "Tom Lane" Cc: "Vivek Khera" , "Postgresql Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200512/182 X-Sequence-Number: 16003 I ran a bit exhaustive pgbench on 2 test machines I have (quad dual core Intel and Opteron). Ofcourse the Opteron was much faster, but interestingly, it was experiencing 3x more context switches than the Intel box (upto 100k, versus ~30k avg on Dell). Both are RH4.0 64bit/PG8.1 64bit. Sun (v40z): -bash-3.00$ time pgbench -c 1000 -t 30 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1 number of clients: 1000 number of transactions per client: 30 number of transactions actually processed: 30000/30000 tps =3D 45.871234 (including connections establishing) tps =3D 46.092629 (excluding connections establishing) real 10m54.240s user 0m34.894s sys 3m9.470s Dell (6850): -bash-3.00$ time pgbench -c 1000 -t 30 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1 number of clients: 1000 number of transactions per client: 30 number of transactions actually processed: 30000/30000 tps =3D 22.088214 (including connections establishing) tps =3D 22.162454 (excluding connections establishing) real 22m38.301s user 0m43.520s sys 5m42.108s Thanks, Anjan -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 Sent: Tuesday, November 22, 2005 2:42 PM To: Anjan Dave Cc: Vivek Khera; Postgresql Performance Subject: Re: [PERFORM] High context switches occurring=20 "Anjan Dave" writes: > Would this problem change it's nature in any way on the recent Dual-Core > Intel XEON MP machines? Probably not much. There's some evidence that Opterons have less of a problem than Xeons in multi-chip configurations, but we've seen CS thrashing on Opterons too. I think the issue is probably there to some extent in any modern SMP architecture. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 15:26:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8FBCA9DCAAC for ; Tue, 6 Dec 2005 15:25:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69424-10 for ; Tue, 6 Dec 2005 15:25:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id 766569DCAA8 for ; Tue, 6 Dec 2005 15:25:56 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 93EF5B812 for ; Tue, 6 Dec 2005 14:25:57 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098EC2@vt-pe2550-001.vantage.vantage.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098EC2@vt-pe2550-001.vantage.vantage.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <369D6632-9883-4F66-95AD-99571B82403C@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: High context switches occurring Date: Tue, 6 Dec 2005 14:25:56 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/184 X-Sequence-Number: 16005 On Dec 6, 2005, at 2:04 PM, Anjan Dave wrote: > interestingly, it was experiencing 3x more context switches than the > Intel box (upto 100k, versus ~30k avg on Dell). Both are RH4.0 I'll assume that's context switches per second... so for the opteron that's 65400000 cs's and for the Dell that's 40740000 switches during the duration of the test. Not so much a difference... You see, the opteron was context switching more because it was doing more work :-) From pgsql-performance-owner@postgresql.org Tue Dec 6 16:07:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F2EF39DCAAC for ; Tue, 6 Dec 2005 16:07:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77951-04 for ; Tue, 6 Dec 2005 16:07:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id 0DAEF9DCAA8 for ; Tue, 6 Dec 2005 16:07:02 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 8137FB814 for ; Tue, 6 Dec 2005 15:07:04 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: postgresql performance tuning Date: Tue, 6 Dec 2005 15:07:03 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/185 X-Sequence-Number: 16006 On Dec 6, 2005, at 11:14 AM, Ameet Kini wrote: > need for vacuums. However, it'd be great if there was a similar > automatic > reindex utility, like say, a pg_autoreindex daemon. Are there any > plans > for this feature? If not, then would cron scripts be the next best what evidence do you have that you are suffering index bloat? or are you just looking for solutions to problems that don't exist as an academic exercise? :-) From pgsql-performance-owner@postgresql.org Tue Dec 6 16:12:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 313699DCF7E for ; Tue, 6 Dec 2005 16:12:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76906-08 for ; Tue, 6 Dec 2005 16:12:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 68DB49DCBEC for ; Tue, 6 Dec 2005 16:12:22 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id CD1393094A; Tue, 6 Dec 2005 21:12:23 +0100 (MET) From: August Zajonc X-Newsgroups: pgsql.performance Subject: Re: LVM and Postgres Date: Tue, 06 Dec 2005 12:12:22 -0800 Organization: Hub.Org Networking Services Lines: 42 Message-ID: References: <20051206093818.GE6708@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <20051206093818.GE6708@campbell-lange.net> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/187 X-Sequence-Number: 16008 Rory Campbell-Lange wrote: > The server has a 250GB RAID10 (LSI 320-I + BBU) volume which I am > thinking of slicing up in the following way (Linux 2.6 kernel): > > / : ext3 : 47GB (root, home etc) > /boot : ext3 : 1GB > /tmp : ext2 : 2GB > /usr : ext3 : 4GB > /var : ext3 : 6GB > ----------------------- > 60GB > > VG : 190GB approx > ----------------------- > Initially divided so: > /data : ext3 : 90GB > /postgres : xfs : 40GB > > This gives me left over space of roughly 60GB to extend into on the > volume group, which I can balance between the /data and /postgres > logical volumes as needed. > > Are there any major pitfalls to this approach? > > Thanks, > Rory > It looks like you are using fast disks and xfs for filesystem on the /postgresql partition. That's nice. How many disks in the array? One thing you miss is sticking a bunch of sequential log writes on a separate spindle as far as I can see with this? WAL / XFS (i think) both have this pattern. If you've got a fast disk and can do BBU write caching your WAL writes will hustle. Others can probably speak a bit better on any potential speedups. - August From pgsql-performance-owner@postgresql.org Tue Dec 6 16:11:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3BF8F9DCC3D for ; Tue, 6 Dec 2005 16:11:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77821-06 for ; Tue, 6 Dec 2005 16:11:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 21C209DCAAC for ; Tue, 6 Dec 2005 16:11:14 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 3A6443093F; Tue, 6 Dec 2005 21:11:15 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: Missed index opportunity for outer join? Date: Tue, 06 Dec 2005 12:17:55 -0800 Organization: Hub.Org Networking Services Lines: 34 Message-ID: <4395F1F3.1000803@cheapcomplexdevices.com> References: <3267.1133822299@sss.pgh.pa.us> <4678.1133888239@sss.pgh.pa.us> 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: Tom Lane User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <4678.1133888239@sss.pgh.pa.us> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/186 X-Sequence-Number: 16007 Tom Lane wrote: > rm_pg@cheapcomplexdevices.com writes: >>On Mon, 5 Dec 2005, Tom Lane wrote: > >>I speculate that the seq_scan wasn't really the slow part >>compared to not using using both parts of the index in the >>second part of the plan. The table point_features is tens of >>thousands of rows, while the table facets is tens of millions. > > Agreed, but it's still odd that it would use a seqscan in one case and > not the other. Hmm. Unfortunately that was happening on a production system and the amount of data in the tables has changed - and now I'm no longer getting a seq_scan when I try to reproduce it. That system is still using 8.1.0. The "point_features" table is pretty dynamic and it's possible that the data changed between my 'explain analyze' statement in the first post in this thread. However since both of them show an estimate of "rows=948" and returned an actual of 917 I don't think that happened. > I found the reason why the fac_id=261 clause isn't getting used as an > index qual; it's a bit of excessive paranoia that goes back to 2002. > I've fixed that for 8.1.1, but am still wondering about the seqscan > on the other side of the join. I now have a development system with cvs-tip; but have not yet reproduced the seq scan on it either. I'm using the same data that was in "point_features" with "featureid=120" - but don't have any good way of knowing what other data may have been in the table at the time. If desired, I could set up a cron job to periodically explain analyze that query and see if it recurs. From pgsql-performance-owner@postgresql.org Tue Dec 6 23:56:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 50BB69DCAAC for ; Tue, 6 Dec 2005 16:23:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78956-09 for ; Tue, 6 Dec 2005 16:23:17 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id C0AB59DCB90 for ; Tue, 6 Dec 2005 16:23:14 -0400 (AST) Received: from linares.terra.com.br (linares.terra.com.br [200.176.10.195]) by svr2.postgresql.org (Postfix) with ESMTP id C9ECFF0CDD for ; Tue, 6 Dec 2005 20:23:15 +0000 (GMT) Received: from mubende.terra.com.br (mubende.terra.com.br [200.176.10.8]) by linares.terra.com.br (Postfix) with ESMTP id C21784DC098 for ; Tue, 6 Dec 2005 18:23:11 -0200 (BRST) X-Terra-Karma: -2% X-Terra-Hash: 28962db36df4609c47f4aaea50a4bb97 Received-SPF: pass (mubende.terra.com.br: domain of terra.com.br designates 200.176.10.8 as permitted sender) client-ip=200.176.10.8; envelope-from=edisonazzi@terra.com.br; helo=[192.168.0.10]; Received: from [192.168.0.10] (cm-net-poa-C8B0C7C9.dynamic.brdterra.com.br [200.176.199.201]) (authenticated user edoazzi) by mubende.terra.com.br (Postfix) with ESMTP id AE5092480BE for ; Tue, 6 Dec 2005 18:23:11 -0200 (BRST) Message-ID: <4395F317.4040806@terra.com.br> Date: Tue, 06 Dec 2005 18:22:47 -0200 From: Edison Azzi User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Join the same row 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, score=3.578 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_BL_SPAMCOP_NET=1.332, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 3.578 X-Spam-Level: *** X-Archive-Number: 200512/216 X-Sequence-Number: 16037 Hi, I�m trying to optimize some selects between 2 tables and the best way I found was alter the first table and add the fields of the 2nd table. I adjusted the contents and now a have only one table with all info that I need. Now resides my problem, because of legacy queries I decided to make a Rule that replace the 2nd table. Until now all worked well, but I found when I make a join between de result table and de Rule, even tought is the same row in the same table, the optimizer generete two access for the same row: cta_pag is the table and ctapag_adm is the rule. CREATE OR REPLACE RULE "_RETURN" AS ON SELECT TO ctapag_adm DO INSTEAD SELECT cta_pag.nrlancto, cta_pag.codconta, cta_pag.frequencia, cta_pag.nrlanctopai FROM cta_pag WHERE cta_pag.origem = 'A'::bpchar; This is one of the legacy queries: select * from cta_pag p , ctapag_adm a where a.nrlancto= p.nrlancto and p.nrlancto = 21861; EXPLAIN: Nested Loop (cost=0.00..11.49 rows=1 width=443) (actual time=0.081..0.088 rows=1 loops=1) -> Index Scan using cta_pag_pk on cta_pag p (cost=0.00..5.74 rows=1 width=408) (actual time=0.044..0.046 rows=1 loops=1) Index Cond: (nrlancto = 21861::numeric) -> Index Scan using cta_pag_pk on cta_pag (cost=0.00..5.74 rows=1 width=35) (actual time=0.023..0.025 rows=1 loops=1) Index Cond: (21861::numeric = nrlancto) Filter: (origem = 'A'::bpchar) Total runtime: 0.341 ms Resulting in twice the time for accessing. Acessing just on time the same row: select * from cta_pag p where p.nrlancto = 21861 EXPLAIN: Index Scan using cta_pag_pk on cta_pag p (cost=0.00..5.74 rows=1 width=408) (actual time=0.044..0.047 rows=1 loops=1) Index Cond: (nrlancto = 21861::numeric) Total runtime: 0.161 ms Is there a way to force the optimizer to understand that is the same row? Thanks, Edison -- Edison Azzi From pgsql-performance-owner@postgresql.org Tue Dec 6 16:33:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 460179DD612 for ; Tue, 6 Dec 2005 16:33:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83738-04 for ; Tue, 6 Dec 2005 16:33:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E921A9DD602 for ; Tue, 6 Dec 2005 16:33:30 -0400 (AST) 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 jB6KXVxa015963; Tue, 6 Dec 2005 15:33:31 -0500 (EST) To: Ron Mayer cc: pgsql-performance@postgresql.org Subject: Re: Missed index opportunity for outer join? In-reply-to: <4395F1F3.1000803@cheapcomplexdevices.com> References: <3267.1133822299@sss.pgh.pa.us> <4678.1133888239@sss.pgh.pa.us> <4395F1F3.1000803@cheapcomplexdevices.com> Comments: In-reply-to Ron Mayer message dated "Tue, 06 Dec 2005 12:17:55 -0800" Date: Tue, 06 Dec 2005 15:33:31 -0500 Message-ID: <15962.1133901211@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/188 X-Sequence-Number: 16009 Ron Mayer writes: > The "point_features" table is pretty dynamic and it's possible > that the data changed between my 'explain analyze' statement in > the first post in this thread. However since both of them > show an estimate of "rows=948" and returned an actual of 917 I > don't think that happened. Yeah, I had considered the same explanation and rejected it for the same reason. Also, the difference in estimated cost is significant (265.85 for the seqscan vs 172.17 for the bitmap scan) so it's hard to think that a small change in stats --- so small as to not reflect in estimated row count --- would change the estimate by that much. [ thinks some more... ] Of course, what we have to remember is that the planner is actually going to choose based on the ultimate join cost, not on the subplan costs. The reason the seqscan survived initial comparisons at all is that it has a cheaper startup cost (less time to return the first tuple) than the bitmap scan, and this will be reflected into a cheaper startup cost for the overall nestloop. The extra hundred units of total cost would only reflect into the nestloop total cost --- and there, they would be considered "down in the noise" compared to a 90k total estimate. So probably what happened is that the planner preferred this plan on the basis that the total costs are the same to within estimation error while the startup cost is definitely less. In this explanation, the reason for the change in plans over time could be a change in the statistics for the other table. Is "facets" more dynamic than "point_features"? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 16:40:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2DFC89DD600 for ; Tue, 6 Dec 2005 16:40:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86896-01 for ; Tue, 6 Dec 2005 16:40:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id B1FD29DD612 for ; Tue, 6 Dec 2005 16:40:07 -0400 (AST) Received: (qmail 23398 invoked by uid 500); 6 Dec 2005 20:44:33 -0000 Date: Tue, 6 Dec 2005 14:44:33 -0600 From: Bruno Wolff III To: Assaf Yaari Cc: pgsql-performance@postgresql.org Subject: Re: Performance degradation after successive UPDATE's Message-ID: <20051206204433.GA22168@wolff.to> Mail-Followup-To: Bruno Wolff III , Assaf Yaari , pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.017 required=5 tests=[AWL=0.017] X-Spam-Score: 0.017 X-Spam-Level: X-Archive-Number: 200512/190 X-Sequence-Number: 16011 On Tue, Dec 06, 2005 at 11:08:07 +0200, Assaf Yaari wrote: > Thanks Bruno, > > Issuing VACUUM FULL seems not to have influence on the time. That was just to get the table size back down to something reasonable. > I've added to my script VACUUM ANALYZE every 100 UPDATE's and run the > test again (on different record) and the time still increase. Vacuuming every 100 updates should put an upperbound on how slow things get. I doubt you need to analyze every 100 updates, but that doesn't cost much more on top of a vacuum. However, if there is another transaction open while you are doing the updates, that would prevent clearing out the deleted rows, since they are potentially visible to it. This is something you want to rule out. > Any other ideas? Do you have any triggers on this table? Are you updating any other tables at the same time? In particular ones that are referred to by the problem table. From pgsql-performance-owner@postgresql.org Tue Dec 6 16:49:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 36A419DD61E for ; Tue, 6 Dec 2005 16:49:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90577-04 for ; Tue, 6 Dec 2005 16:49:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by postgresql.org (Postfix) with ESMTP id 169549DD624 for ; Tue, 6 Dec 2005 16:49:09 -0400 (AST) 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 jB6Km3hb005160 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 6 Dec 2005 15:48:04 -0500 (EST) X-Source: non-mednet 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 jB6KmCtB016764; Tue, 6 Dec 2005 15:48:12 -0500 (EST) Message-ID: <4395F914.8070001@rentec.com> Date: Tue, 06 Dec 2005 15:48:20 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Vivek Khera CC: Postgresql Performance Subject: Re: postgresql performance tuning References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jB6Km3hb005160 at Tue Dec 6 15:48:04 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/192 X-Sequence-Number: 16013 Vivek Khera wrote: > > On Dec 6, 2005, at 11:14 AM, Ameet Kini wrote: > >> need for vacuums. However, it'd be great if there was a similar >> automatic >> reindex utility, like say, a pg_autoreindex daemon. Are there any plans >> for this feature? If not, then would cron scripts be the next best > > what evidence do you have that you are suffering index bloat? or are > you just looking for solutions to problems that don't exist as an > academic exercise? :-) The files for the two indices on a single table used 7.8GB of space before a reindex, and 4.4GB after. The table had been reindexed over the weekend and a vacuum was completed on the table about 2 hours ago. The two indices are now 3.4GB smaller. I don't think this counts as bloat, because of our use case. Even so, we reindex our whole database every weekend. -- Alan From pgsql-performance-owner@postgresql.org Tue Dec 6 16:46:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 883B09DCBEC for ; Tue, 6 Dec 2005 16:46:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89828-05 for ; Tue, 6 Dec 2005 16:46:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 1E27C9DD624 for ; Tue, 6 Dec 2005 16:46:24 -0400 (AST) Received: (qmail 24887 invoked by uid 500); 6 Dec 2005 20:50:48 -0000 Date: Tue, 6 Dec 2005 14:50:48 -0600 From: Bruno Wolff III To: Csaba Nagy Cc: Joost Kraaijeveld , Pgsql-Performance Subject: Re: Can this query go faster??? Message-ID: <20051206205048.GB22168@wolff.to> Mail-Followup-To: Bruno Wolff III , Csaba Nagy , Joost Kraaijeveld , Pgsql-Performance References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1133862777.4779.185.camel@coppola.muc.ecircle.de> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.015 required=5 tests=[AWL=0.015] X-Spam-Score: 0.015 X-Spam-Level: X-Archive-Number: 200512/191 X-Sequence-Number: 16012 On Tue, Dec 06, 2005 at 10:52:57 +0100, Csaba Nagy wrote: > Joost, > > Why do you use an offset here ? I guess you're traversing the table > somehow, in this case it would be better to remember the last zipcode + > housenumber and put an additional condition to get the next bigger than > the last one you've got... that would go for the index on > zipcode+housenumber and be very fast. The big offset forces postgres to > traverse that many entries until it's able to pick the one row for the > result... The other problem with saving an offset, is unless the data isn't changing or you are doing all of the searches in one serialized transaction, the fixed offset might not put you back where you left off. Using the last key, instead of counting records is normally a better way to do this. From pgsql-performance-owner@postgresql.org Tue Dec 6 17:22:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8EA7E9DD621 for ; Tue, 6 Dec 2005 17:19:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95411-04 for ; Tue, 6 Dec 2005 17:19:31 -0400 (AST) X-Greylist: delayed 00:17:34.944448 by SQLgrey- Received: from zctfs063.nortelnetworks.com (zctfs063.nortelnetworks.com [47.164.128.120]) by postgresql.org (Postfix) with ESMTP id 782479DD603 for ; Tue, 6 Dec 2005 17:19:27 -0400 (AST) Received: from zharhxm0.corp.nortel.com (zharhxm0.corp.nortel.com [47.165.48.148]) by zctfs063.nortelnetworks.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id jB6L1nB03911 for ; Tue, 6 Dec 2005 22:01:49 +0100 (MET) Received: from zrtphxs1.corp.nortel.com ([47.140.202.46]) by zharhxm0.corp.nortel.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 6 Dec 2005 21:01:47 +0000 Received: from zrtps0m6.us.nortel.com ([47.140.192.58]) by zrtphxs1.corp.nortel.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 6 Dec 2005 16:01:46 -0500 Received: from cash.rhiamet.com (rhiamet.us.nortel.com [47.103.243.53]) by zrtps0m6.us.nortel.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id jB6L15s12108 for ; Tue, 6 Dec 2005 16:01:05 -0500 (EST) Received: from cash.rhiamet.com (bmetcalf@localhost [127.0.0.1]) by cash.rhiamet.com (8.13.5/8.13.5/Debian-3) with ESMTP id jB6L13EX010110 for ; Tue, 6 Dec 2005 15:01:03 -0600 Received: from localhost (bmetcalf@localhost) by cash.rhiamet.com (8.13.5/8.13.5/Submit) with ESMTP id jB6L129q010106 for ; Tue, 6 Dec 2005 15:01:03 -0600 Date: Tue, 6 Dec 2005 15:01:02 -0600 (CST) From: "Brandon Metcalf" To: pgsql-performance@postgresql.org Subject: Context switching and Xeon processors Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 06 Dec 2005 21:01:46.0243 (UTC) FILETIME=[449BAD30:01C5FAA8] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/196 X-Sequence-Number: 16017 We're running a dual Xeon machine with hyperthreading enabled and PostgreSQL 8.0.3. Below is the type of CPUs: processor : 3 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Xeon(TM) CPU 3.20GHz stepping : 1 cpu MHz : 3200.274 cache size : 1024 KB ... We've been tuning the kernel (2.4 SMP flavor) and have improved performance quite a bit. I'm now wondering if turning off HT will improve performance even more. Based on the vmstat output below, is the context switching typical or too high? And what is the latest on the state of PostgreSQL running on Xeon processors with HT turned on? I searched the archives, but couldn't discern anything definitive. r b swpd free buff cache si so bi bo in cs us sy wa id 1 0 135944 64612 17136 3756816 0 0 0 210 154 178 2 0 4 94 1 0 135940 46600 17204 3754496 0 0 1 1231 442 3658 7 3 10 80 1 3 135940 51228 17240 3754680 0 0 0 1268 255 2659 4 1 14 81 1 0 135940 58512 17300 3754684 0 0 0 1818 335 1526 2 1 32 65 1 1 135940 18104 17328 3806516 0 0 17670 476 1314 1962 2 2 41 56 0 1 135940 17776 17232 3811620 0 0 23193 394 1600 2097 2 2 53 44 0 1 135940 17944 17188 3809636 0 0 25459 349 1547 2013 2 2 50 46 0 3 135940 18816 15184 3798312 0 0 24284 1328 1529 4730 6 5 53 36 0 6 135940 23536 6060 3817088 0 0 27376 1332 1350 2628 2 3 56 39 0 5 135940 18008 6036 3827132 0 0 18806 1539 1410 1416 1 2 61 36 0 5 135940 18492 5708 3826660 0 0 3540 10354 736 955 2 2 76 20 0 3 135940 18940 5788 3829864 0 0 2308 7506 707 519 2 1 81 15 1 4 135940 18980 5820 3828836 0 0 138 3503 556 261 1 0 74 24 0 10 135940 39332 5896 3777724 0 0 579 2805 621 4104 7 4 54 35 0 4 135936 37816 5952 3791404 0 0 260 1887 384 1574 2 1 40 57 0 5 135936 29552 5996 3802260 0 0 290 1642 434 1944 3 1 38 58 -- Brandon From pgsql-performance-owner@postgresql.org Tue Dec 6 17:02:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2F879DD61C for ; Tue, 6 Dec 2005 17:02:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90586-09 for ; Tue, 6 Dec 2005 17:02:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 7B3699DD607 for ; Tue, 6 Dec 2005 17:02:05 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D07E83093D; Tue, 6 Dec 2005 22:02:06 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: postgresql performance tuning Date: Tue, 06 Dec 2005 22:02:05 +0100 Organization: Hub.Org Networking Services Lines: 15 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/193 X-Sequence-Number: 16014 Ameet Kini schrieb: > > This didn't get through the first time around, so resending it again. > Sorry for any duplicate entries. > > Hello, > > I have a question on postgres's performance tuning, in particular, the > vacuum and reindex commands. Currently I do a vacuum (without full) on all > of my tables. I'm curious ... why no full vacuum? I bet that the full vacuum will compact your (index) tables as much as a reindex would. I guess the best advice is to increase FSM and to use autovacuum. From pgsql-performance-owner@postgresql.org Tue Dec 6 17:08:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1572E9DCBF3 for ; Tue, 6 Dec 2005 17:08:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91212-09 for ; Tue, 6 Dec 2005 17:08:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 15D9D9DCBE7 for ; Tue, 6 Dec 2005 17:08:31 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 2BF963093D; Tue, 6 Dec 2005 22:08:33 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: Missed index opportunity for outer join? Date: Tue, 06 Dec 2005 13:15:13 -0800 Organization: Hub.Org Networking Services Lines: 18 Message-ID: <4395FF61.6060301@cheapcomplexdevices.com> References: <3267.1133822299@sss.pgh.pa.us> <4678.1133888239@sss.pgh.pa.us> <4395F1F3.1000803@cheapcomplexdevices.com> <15962.1133901211@sss.pgh.pa.us> 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: Tom Lane User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <15962.1133901211@sss.pgh.pa.us> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/194 X-Sequence-Number: 16015 Tom Lane wrote: > ...planner is actually going to choose based on the ultimate join cost, > not on the subplan costs... > > In this explanation, the reason for the change in plans over time could > be a change in the statistics for the other table. Is "facets" more > dynamic than "point_features"? In total rows changing it's more dynamic, but percentage-wise, it's less dynamic (point_features probably turns round 50% of it's rows in a day -- while facets turns over about 3% per day -- but facets is 1000X larger). Facets is a big table with rather odd distributions of values. Many of the values in the indexed columns show up only once, others show up hundreds-of-thousands of times. Perhaps an analyze ran and just randomly sampled differently creating different stats on that table? From pgsql-performance-owner@postgresql.org Tue Dec 6 17:22:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A9469DD5F0 for ; Tue, 6 Dec 2005 17:20:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95523-03 for ; Tue, 6 Dec 2005 17:21:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A6C409DD5F5 for ; Tue, 6 Dec 2005 17:20:56 -0400 (AST) 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 jB6LKvsS016452; Tue, 6 Dec 2005 16:20:57 -0500 (EST) To: stange@rentec.com cc: Vivek Khera , Postgresql Performance Subject: Re: postgresql performance tuning In-reply-to: <4395F914.8070001@rentec.com> References: <4395F914.8070001@rentec.com> Comments: In-reply-to Alan Stange message dated "Tue, 06 Dec 2005 15:48:20 -0500" Date: Tue, 06 Dec 2005 16:20:57 -0500 Message-ID: <16451.1133904057@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/195 X-Sequence-Number: 16016 Alan Stange writes: > Vivek Khera wrote: >> what evidence do you have that you are suffering index bloat? > The files for the two indices on a single table used 7.8GB of space > before a reindex, and 4.4GB after. That's not bloat ... that's pretty nearly in line with the normal expectation for a btree index, which is about 2/3rds fill factor. If the compacted index were 10X smaller then I'd agree that you have a bloat problem. Periodic reindexing on this scale is not doing a lot for you except thrashing your disks --- you're just giving space back to the OS that will shortly be sucked up again by the same index. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 17:26:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF3569DCBEC for ; Tue, 6 Dec 2005 17:25:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96195-03 for ; Tue, 6 Dec 2005 17:25:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id BE30B9DCAA8 for ; Tue, 6 Dec 2005 17:24:57 -0400 (AST) 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 jB6LOxcr016503; Tue, 6 Dec 2005 16:24:59 -0500 (EST) To: Ron Mayer cc: pgsql-performance@postgresql.org Subject: Re: Missed index opportunity for outer join? In-reply-to: <4395FF61.6060301@cheapcomplexdevices.com> References: <3267.1133822299@sss.pgh.pa.us> <4678.1133888239@sss.pgh.pa.us> <4395F1F3.1000803@cheapcomplexdevices.com> <15962.1133901211@sss.pgh.pa.us> <4395FF61.6060301@cheapcomplexdevices.com> Comments: In-reply-to Ron Mayer message dated "Tue, 06 Dec 2005 13:15:13 -0800" Date: Tue, 06 Dec 2005 16:24:59 -0500 Message-ID: <16502.1133904299@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/197 X-Sequence-Number: 16018 Ron Mayer writes: > Tom Lane wrote: >> In this explanation, the reason for the change in plans over time could >> be a change in the statistics for the other table. Is "facets" more >> dynamic than "point_features"? > Facets is a big table with rather odd distributions of values. > Many of the values in the indexed columns show up only > once, others show up hundreds-of-thousands of times. Perhaps > an analyze ran and just randomly sampled differently creating > different stats on that table? If you have background tasks doing ANALYZEs then this explanation seems plausible enough. I'm willing to accept it anyway ... regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 17:38:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 75FDA9DCC0B for ; Tue, 6 Dec 2005 17:36:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97854-04 for ; Tue, 6 Dec 2005 17:36:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by postgresql.org (Postfix) with ESMTP id 40E669DCBEC for ; Tue, 6 Dec 2005 17:36:02 -0400 (AST) Received: from rory by localhost.localdomain with local (Exim 4.54) id 1EjkU3-0003qx-JZ; Tue, 06 Dec 2005 21:36:23 +0000 Date: Tue, 6 Dec 2005 21:36:23 +0000 From: Rory Campbell-Lange To: August Zajonc Cc: pgsql-performance@postgresql.org Subject: Re: LVM and Postgres Message-ID: <20051206213623.GD14427@campbell-lange.net> References: <20051206093818.GE6708@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.666 required=5 tests=[AWL=0.666] X-Spam-Score: 0.666 X-Spam-Level: X-Archive-Number: 200512/199 X-Sequence-Number: 16020 Hi August. Thanks very much for your mail. On 06/12/05, August Zajonc (augustz@augustz.com) wrote: > Rory Campbell-Lange wrote: > >The server has a 250GB RAID10 (LSI 320-I + BBU) volume which I am > >thinking of slicing up in the following way (Linux 2.6 kernel): > > > > / : ext3 : 47GB (root, home etc) > > /boot : ext3 : 1GB > > /tmp : ext2 : 2GB > > /usr : ext3 : 4GB > > /var : ext3 : 6GB > > ----------------------- > > 60GB > > > > VG : 190GB approx > > ----------------------- > > Initially divided so: > > /data : ext3 : 90GB > > /postgres : xfs : 40GB > > > >This gives me left over space of roughly 60GB to extend into on the > >volume group, which I can balance between the /data and /postgres > >logical volumes as needed. > > It looks like you are using fast disks and xfs for filesystem on the > /postgresql partition. That's nice. > > How many disks in the array? Four. > One thing you miss is sticking a bunch of sequential log writes on a > separate spindle as far as I can see with this? WAL / XFS (i think) both > have this pattern. If you've got a fast disk and can do BBU write > caching your WAL writes will hustle. Yes, we don't have any spare disks unfortunately. We have enabled the BBU write, so we are hoping for good performance. I'd be grateful for some advice on dd/bonnie++ tests for checking this. > Others can probably speak a bit better on any potential speedups. I'd better test extending the Logical Volumes too! Many thanks Rory From pgsql-performance-owner@postgresql.org Tue Dec 6 17:38:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CD23B9DCCB8 for ; Tue, 6 Dec 2005 17:36:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98821-03 for ; Tue, 6 Dec 2005 17:36:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 797C79DCC0B for ; Tue, 6 Dec 2005 17:36:55 -0400 (AST) 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 jB6LarGK016609; Tue, 6 Dec 2005 16:36:54 -0500 (EST) To: "Brandon Metcalf" cc: pgsql-performance@postgresql.org Subject: Re: Context switching and Xeon processors In-reply-to: References: Comments: In-reply-to "Brandon Metcalf" message dated "Tue, 06 Dec 2005 15:01:02 -0600" Date: Tue, 06 Dec 2005 16:36:53 -0500 Message-ID: <16608.1133905013@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/198 X-Sequence-Number: 16019 "Brandon Metcalf" writes: > We've been tuning the kernel (2.4 SMP flavor) and have improved > performance quite a bit. I'm now wondering if turning off HT will > improve performance even more. Based on the vmstat output below, is > the context switching typical or too high? Given that your CPU usage is hovering around 2%, it's highly unlikely that you'll be able to measure any change at all by fiddling with HT. What you need to be working on is disk I/O --- the "80% wait" number is what should be getting your attention, not the CS number. (FWIW, on the sort of hardware you're talking about, I wouldn't worry about CS rates lower than maybe 10000/sec --- the hardware can sustain well over 10x that.) regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 17:40:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E223A9DCAB0 for ; Tue, 6 Dec 2005 17:40:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98210-08 for ; Tue, 6 Dec 2005 17:40:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by postgresql.org (Postfix) with ESMTP id 697149DD574 for ; Tue, 6 Dec 2005 17:40:05 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jB6Ldhbw007369 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 6 Dec 2005 16:39:44 -0500 (EST) X-Source: non-mednet 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 jB6Ld5Bk009022; Tue, 6 Dec 2005 16:39:05 -0500 (EST) Message-ID: <4396052F.9050507@rentec.com> Date: Tue, 06 Dec 2005 16:39:59 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Tom Lane CC: Vivek Khera , Postgresql Performance Subject: Re: postgresql performance tuning References: <4395F914.8070001@rentec.com> <16451.1133904057@sss.pgh.pa.us> In-Reply-To: <16451.1133904057@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jB6Ldhbw007369 at Tue Dec 6 16:39:44 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/201 X-Sequence-Number: 16022 Tom Lane wrote: > Alan Stange writes: > >> Vivek Khera wrote: >> >>> what evidence do you have that you are suffering index bloat? >>> > > >> The files for the two indices on a single table used 7.8GB of space >> before a reindex, and 4.4GB after. >> > > That's not bloat ... that's pretty nearly in line with the normal > expectation for a btree index, which is about 2/3rds fill factor. > If the compacted index were 10X smaller then I'd agree that you have > a bloat problem. > I wrote "I don't think this counts as bloat...". I still don't. -- Alan From pgsql-performance-owner@postgresql.org Tue Dec 6 17:38:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E4E2E9DD644 for ; Tue, 6 Dec 2005 17:35:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95521-09 for ; Tue, 6 Dec 2005 17:35:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 52D499DD61A for ; Tue, 6 Dec 2005 17:35:26 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6DF2F30948; Tue, 6 Dec 2005 22:35:27 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: Missed index opportunity for outer join? Date: Tue, 06 Dec 2005 13:42:09 -0800 Organization: Hub.Org Networking Services Lines: 8 Message-ID: <439605B1.5070800@cheapcomplexdevices.com> References: <3267.1133822299@sss.pgh.pa.us> <4678.1133888239@sss.pgh.pa.us> <4395F1F3.1000803@cheapcomplexdevices.com> <15962.1133901211@sss.pgh.pa.us> <4395FF61.6060301@cheapcomplexdevices.com> <16502.1133904299@sss.pgh.pa.us> 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: Tom Lane User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <16502.1133904299@sss.pgh.pa.us> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/200 X-Sequence-Number: 16021 Tom Lane wrote: > If you have background tasks doing ANALYZEs then this explanation seems > plausible enough. I'm willing to accept it anyway ... Yup, there are such tasks. I could dig through logs to try to confirm or reject it; but I think it's reasonably likely that this happened. Basically, data gets added to that table as it becomes ready from other systems, and after each batch a vacuum analyze is run. From pgsql-performance-owner@postgresql.org Tue Dec 6 17:45:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4E8019DCB90 for ; Tue, 6 Dec 2005 17:45:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00317-03 for ; Tue, 6 Dec 2005 17:45:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from zctfs063.nortelnetworks.com (zctfs063.nortelnetworks.com [47.164.128.120]) by postgresql.org (Postfix) with ESMTP id 167299DCBC1 for ; Tue, 6 Dec 2005 17:45:30 -0400 (AST) Received: from zctfhxm0.corp.nortel.com (zctfhxm0.corp.nortel.com [47.164.129.155]) by zctfs063.nortelnetworks.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id jB6LjNB11603; Tue, 6 Dec 2005 22:45:23 +0100 (MET) Received: from zrtphxs1.corp.nortel.com ([47.140.202.46]) by zctfhxm0.corp.nortel.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 6 Dec 2005 22:45:22 +0100 Received: from zrtps0m6.us.nortel.com ([47.140.192.58]) by zrtphxs1.corp.nortel.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 6 Dec 2005 16:45:21 -0500 Received: from cash.rhiamet.com (rhiamet.us.nortel.com [47.103.243.53]) by zrtps0m6.us.nortel.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id jB6Lj7s19991; Tue, 6 Dec 2005 16:45:08 -0500 (EST) Received: from cash.rhiamet.com (bmetcalf@localhost [127.0.0.1]) by cash.rhiamet.com (8.13.5/8.13.5/Debian-3) with ESMTP id jB6Lj5Y3010518; Tue, 6 Dec 2005 15:45:05 -0600 Received: from localhost (bmetcalf@localhost) by cash.rhiamet.com (8.13.5/8.13.5/Submit) with ESMTP id jB6Lj4Hx010514; Tue, 6 Dec 2005 15:45:05 -0600 Date: Tue, 6 Dec 2005 15:45:04 -0600 (CST) From: "Brandon Metcalf" To: Tom Lane cc: pgsql-performance@postgresql.org Subject: Re: Context switching and Xeon processors In-Reply-To: <16608.1133905013@sss.pgh.pa.us> Message-ID: References: <16608.1133905013@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 06 Dec 2005 21:45:21.0224 (UTC) FILETIME=[5B421C80:01C5FAAE] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/202 X-Sequence-Number: 16023 t == tgl@sss.pgh.pa.us writes: t> "Brandon Metcalf" writes: t> > We've been tuning the kernel (2.4 SMP flavor) and have improved t> > performance quite a bit. I'm now wondering if turning off HT will t> > improve performance even more. Based on the vmstat output below, is t> > the context switching typical or too high? t> Given that your CPU usage is hovering around 2%, it's highly unlikely t> that you'll be able to measure any change at all by fiddling with HT. t> What you need to be working on is disk I/O --- the "80% wait" number t> is what should be getting your attention, not the CS number. t> (FWIW, on the sort of hardware you're talking about, I wouldn't worry t> about CS rates lower than maybe 10000/sec --- the hardware can sustain t> well over 10x that.) Yes, I agree the disk I/O is an issue and that's what we've been addressing with the tuning we've been doing and have been able to improve. I think that we really need to go to a RAID 10 array to address the I/O issue, but thought I would investigate the context switching issue. Thanks for the information. -- Brandon From pgsql-performance-owner@postgresql.org Tue Dec 6 17:52:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AA87C9DD5F5 for ; Tue, 6 Dec 2005 17:52:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99814-08 for ; Tue, 6 Dec 2005 17:52:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 20C6F9DD5F2 for ; Tue, 6 Dec 2005 17:52:22 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EjkjX-00076K-PR for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 22:52:24 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EjkjW-0008JE-00 for ; Tue, 06 Dec 2005 22:52:22 +0100 Date: Tue, 6 Dec 2005 22:52:22 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Context switching and Xeon processors Message-ID: <20051206215222.GA30067@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.14 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/203 X-Sequence-Number: 16024 On Tue, Dec 06, 2005 at 03:01:02PM -0600, Brandon Metcalf wrote: > We're running a dual Xeon machine with hyperthreading enabled and > PostgreSQL 8.0.3. The two single most important things that will help you with high rates of context switching: - Turn off hyperthreading. - Upgrade to 8.1. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Dec 6 18:00:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 60B199DCCD8 for ; Tue, 6 Dec 2005 18:00:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02983-03 for ; Tue, 6 Dec 2005 18:00:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 35EBB9DCBEC for ; Tue, 6 Dec 2005 17:57:43 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 810541AC3EA; Tue, 6 Dec 2005 13:57:58 -0800 (PST) Date: Tue, 6 Dec 2005 13:57:12 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Thomas Harold Cc: pgsql-performance@postgresql.org Subject: Re: two disks - best way to use them? In-Reply-To: <4395B59A.1080301@tgharold.com> Message-ID: References: <00fb01c5f772$59471410$0200a8c0@dell8200> <6.2.5.6.0.20051202145746.01dc7b68@earthlink.net> <43946148.9010607@tgharold.com> <43946EA1.8090908@tgharold.com> <4395273B.90902@tgharold.com> <6.2.5.6.0.20051206030948.01dd4bb0@earthlink.net> <4395B59A.1080301@tgharold.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/204 X-Sequence-Number: 16025 On Tue, 6 Dec 2005, Thomas Harold wrote: > Ron wrote: > >> For accuracy's sake, which exact config did you finally use? >> >> How did you choose the config you finally used? Did you test the three >> options or just pick one? > > (Note: I'm not the original poster.) > > I just picked the option of putting the data/pg_xlog directory (WAL) on a 2nd > set of spindles. That was the easiest thing for me to change on this test > box. > > The test server is simply a Gentoo box running software RAID and LVM2. The > primary disk set is 2x7200RPM 300GB drives and the secondary disk set is > 2x5400RPM 300GB drives. Brand new install of PGSQL 8.1, with mostly default > settings (I changed FSM pages to be a higher value, max_fsm_pages = 150000). > PGSQL was given it's own ext3 32GB LVM volume on the primary disk set > (2x7200RPM). Originally, all files were on the primary disk. the WAL is more sensitive to drive speeds then the data is, so you may pick up a little more performance by switching the WAL to the 7200 rpm drives instead of the 5400 rpm drives. if you see a noticable difference with this, consider buying a pair of smaller, but faster drives (10k or 15k rpm drives, or a solid-state drive). you can test this (with significant data risk) by putting the WAL on a ramdisk and see what your performance looks like. David Lang From pgsql-performance-owner@postgresql.org Tue Dec 6 18:03:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 42F7E9DCBC1 for ; Tue, 6 Dec 2005 18:03:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99572-10 for ; Tue, 6 Dec 2005 18:03:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from karadi.cs.wisc.edu (karadi.cs.wisc.edu [128.105.167.23]) by postgresql.org (Postfix) with ESMTP id DD1979DCB90 for ; Tue, 6 Dec 2005 18:03:20 -0400 (AST) Received: from karadi.cs.wisc.edu (localhost [127.0.0.1]) by karadi.cs.wisc.edu (8.13.1/8.13.1) with ESMTP id jB6M3MQg022811 for ; Tue, 6 Dec 2005 16:03:22 -0600 Received: from localhost (akini@localhost) by karadi.cs.wisc.edu (8.13.1/8.13.1/Submit) with ESMTP id jB6M3M7O022808 for ; Tue, 6 Dec 2005 16:03:22 -0600 X-Authentication-Warning: karadi.cs.wisc.edu: akini owned process doing -bs Date: Tue, 6 Dec 2005 16:03:22 -0600 (CST) From: Ameet Kini To: Postgresql Performance Subject: Re: postgresql performance tuning 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, score=0.333 required=5 tests=[AWL=0.333] X-Spam-Score: 0.333 X-Spam-Level: X-Archive-Number: 200512/205 X-Sequence-Number: 16026 > what evidence do you have that you are suffering index bloat? or are > you just looking for solutions to problems that don't exist as an > academic exercise? :-) Well, firstly, its not an academic exercise - Its very much of a real problem that needs a real solution :) I'm running postgresql v8.0 and my problem is that running vacuum on my indices are blazing fast (upto 10x faster) AFTER running reindex. For a table with only 1 index, the time to do a vacuum (without full) went down from 45 minutes to under 3 minutes. Maybe thats not bloat but thats surely surprising. And this was after running vacuum periodically. Ameet > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > Ameet From pgsql-performance-owner@postgresql.org Tue Dec 6 19:45:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4D2CC9DD61A for ; Tue, 6 Dec 2005 19:45:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34078-01 for ; Tue, 6 Dec 2005 19:45:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D2A1C9DD619 for ; Tue, 6 Dec 2005 19:45:01 -0400 (AST) 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 jB6Nj3IU022674; Tue, 6 Dec 2005 18:45:04 -0500 (EST) To: "Anjan Dave" cc: "Vivek Khera" , "Postgresql Performance" Subject: Re: High context switches occurring In-reply-to: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098EC2@vt-pe2550-001.vantage.vantage.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098EC2@vt-pe2550-001.vantage.vantage.com> Comments: In-reply-to "Anjan Dave" message dated "Tue, 06 Dec 2005 14:04:04 -0500" Date: Tue, 06 Dec 2005 18:45:03 -0500 Message-ID: <22673.1133912703@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/206 X-Sequence-Number: 16027 "Anjan Dave" writes: > -bash-3.00$ time pgbench -c 1000 -t 30 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 1000 > number of transactions per client: 30 > number of transactions actually processed: 30000/30000 > tps = 45.871234 (including connections establishing) > tps = 46.092629 (excluding connections establishing) I can hardly think of a worse way to run pgbench :-(. These numbers are about meaningless, for two reasons: 1. You don't want number of clients (-c) much higher than scaling factor (-s in the initialization step). The number of rows in the "branches" table will equal -s, and since every transaction updates one randomly-chosen "branches" row, you will be measuring mostly row-update contention overhead if there's more concurrent transactions than there are rows. In the case -s 1, which is what you've got here, there is no actual concurrency at all --- all the transactions stack up on the single branches row. 2. Running a small number of transactions per client means that startup/shutdown transients overwhelm the steady-state data. You should probably run at least a thousand transactions per client if you want repeatable numbers. Try something like "-s 10 -c 10 -t 3000" to get numbers reflecting test conditions more like what the TPC council had in mind when they designed this benchmark. I tend to repeat such a test 3 times to see if the numbers are repeatable, and quote the middle TPS number as long as they're not too far apart. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 6 20:23:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E91489DCC0B for ; Tue, 6 Dec 2005 20:23:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46842-04 for ; Tue, 6 Dec 2005 20:23:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id 1EC199DCAA8 for ; Tue, 6 Dec 2005 20:23:03 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.82.27]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IR300MX5QEH3BH9@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 18:23:06 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id E912960017B for ; Tue, 06 Dec 2005 19:23:07 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10395-04 for ; Tue, 06 Dec 2005 19:23:07 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id AA808600176; Tue, 06 Dec 2005 19:23:07 -0500 (EST) Date: Tue, 06 Dec 2005 19:23:07 -0500 From: Michael Stone Subject: Re: postgresql performance tuning In-reply-to: To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051207002307.GM7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/207 X-Sequence-Number: 16028 On Tue, Dec 06, 2005 at 04:03:22PM -0600, Ameet Kini wrote: >I'm running postgresql v8.0 and my problem is that running vacuum on my >indices are blazing fast (upto 10x faster) AFTER running reindex. For a >table with only 1 index, the time to do a vacuum (without full) went down >from 45 minutes to under 3 minutes. I've also noticed a fairly large increase in vacuum speed after a reindex. (To the point where the reindex + vacuum was faster than just a vacuum.) Mike Stone From pgsql-performance-owner@postgresql.org Tue Dec 6 20:25:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 233509DD634 for ; Tue, 6 Dec 2005 20:25:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45032-06 for ; Tue, 6 Dec 2005 20:25:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id E1CF19DD621 for ; Tue, 6 Dec 2005 20:25:32 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.82.27]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IR300GCSQINS594@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 18:25:36 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id D9AFC60017B for ; Tue, 06 Dec 2005 19:25:37 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10575-03 for ; Tue, 06 Dec 2005 19:25:37 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id B25D7600176; Tue, 06 Dec 2005 19:25:37 -0500 (EST) Date: Tue, 06 Dec 2005 19:25:37 -0500 From: Michael Stone Subject: Re: LVM and Postgres In-reply-to: <20051206213623.GD14427@campbell-lange.net> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051207002537.GN7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20051206093818.GE6708@campbell-lange.net> <20051206213623.GD14427@campbell-lange.net> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/208 X-Sequence-Number: 16029 On Tue, Dec 06, 2005 at 09:36:23PM +0000, Rory Campbell-Lange wrote: >Yes, we don't have any spare disks unfortunately. We have enabled the >BBU write, so we are hoping for good performance. Even if you don't use seperate disks you'll probably get better performance by putting the WAL on a seperate ext2 partition. xfs gives good performance for the table data, but is not particularly good for the WAL. Mike Stone From pgsql-performance-owner@postgresql.org Tue Dec 6 20:52:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A4F2A9DD5F5 for ; Tue, 6 Dec 2005 20:52:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51699-03 for ; Tue, 6 Dec 2005 20:52:27 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by postgresql.org (Postfix) with ESMTP id 91A7B9DD5F0 for ; Tue, 6 Dec 2005 20:52:22 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i20so197022wra for ; Tue, 06 Dec 2005 16:52:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=PtrbtAs3p9CAI6c6z57o15815CJTxoklQWxygLAdiJjHt/KdFGPn4d3IygfYenE+crJNTnOvhmBK+4wG2AonmdEnFwHAaaQUbAJdbO7ordHEJxcEfQm+RbAd88B+gHMzjUra6tyL7IuWA2ZGriyBk9KbQnp5C3J0tvPa3ZzMg70= Received: by 10.54.144.3 with SMTP id r3mr529865wrd; Tue, 06 Dec 2005 16:52:25 -0800 (PST) Received: by 10.54.86.16 with HTTP; Tue, 6 Dec 2005 16:52:25 -0800 (PST) Message-ID: <33c6269f0512061652u73a690t8af8a276118b1a83@mail.gmail.com> Date: Tue, 6 Dec 2005 19:52:25 -0500 From: Alex Turner To: pgsql-performance@postgresql.org Subject: Re: LVM and Postgres In-Reply-To: <20051207002537.GN7330@mathom.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20051206093818.GE6708@campbell-lange.net> <20051206213623.GD14427@campbell-lange.net> <20051207002537.GN7330@mathom.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/209 X-Sequence-Number: 16030 I would argue that almost certainly won't by doing that as you will create a new place even further away for the disk head to seek to instead of just another file on the same FS that is probably closer to the current head position. Alex On 12/6/05, Michael Stone wrote: > On Tue, Dec 06, 2005 at 09:36:23PM +0000, Rory Campbell-Lange wrote: > >Yes, we don't have any spare disks unfortunately. We have enabled the > >BBU write, so we are hoping for good performance. > > Even if you don't use seperate disks you'll probably get better > performance by putting the WAL on a seperate ext2 partition. xfs gives > good performance for the table data, but is not particularly good for > the WAL. > > Mike Stone > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Tue Dec 6 21:31:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9A0CF9DCD50 for ; Tue, 6 Dec 2005 21:31:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55390-08 for ; Tue, 6 Dec 2005 21:31:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by postgresql.org (Postfix) with ESMTP id 3B31B9DCC07 for ; Tue, 6 Dec 2005 21:31:01 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.82.27]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IR300EXITJTC9H5@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 06 Dec 2005 19:31:05 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 425BE60263D; Tue, 06 Dec 2005 20:31:07 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 12512-02-3; Tue, 06 Dec 2005 20:31:07 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 2871A60017F; Tue, 06 Dec 2005 20:31:07 -0500 (EST) Date: Tue, 06 Dec 2005 20:31:07 -0500 From: Michael Stone Subject: Re: LVM and Postgres In-reply-to: <33c6269f0512061652u73a690t8af8a276118b1a83@mail.gmail.com> To: Alex Turner Cc: pgsql-performance@postgresql.org Mail-followup-to: Alex Turner , pgsql-performance@postgresql.org Message-id: <20051207013107.GP7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20051206093818.GE6708@campbell-lange.net> <20051206213623.GD14427@campbell-lange.net> <20051207002537.GN7330@mathom.us> <33c6269f0512061652u73a690t8af8a276118b1a83@mail.gmail.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/210 X-Sequence-Number: 16031 On Tue, Dec 06, 2005 at 07:52:25PM -0500, Alex Turner wrote: >I would argue that almost certainly won't by doing that as you will >create a new place even further away for the disk head to seek to >instead of just another file on the same FS that is probably closer to >the current head position. I would argue that you should benchmark it instead of speculating. You are perhaps underestimating the effect of the xfs log. (Ordinarily xfs has great performance, but it seems to be fairly lousy at fsync/osync/etc operations in my benchmarks; my wild speculation is that the sync forces a log flush.) At any rate you're going to have a lot of head movement on any reasonably sized filesystem anyway, and I'm not convinced that hoping that your data will happen to land close to your log is a valid, repeatable optimization technique. Note that the WAL will wander around the disk as files are created and deleted, whereas tables are basically updated in place. Mike Stone From pgsql-performance-owner@postgresql.org Tue Dec 6 21:38:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 34DB49DD639 for ; Tue, 6 Dec 2005 21:38:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69075-08 for ; Tue, 6 Dec 2005 21:38:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id CC6479DD5F0 for ; Tue, 6 Dec 2005 21:38:15 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id A5ECE25078; Wed, 7 Dec 2005 09:38:15 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 7792B25074; Wed, 7 Dec 2005 09:38:11 +0800 (WST) Message-ID: <43963D9B.4020605@familyhealth.com.au> Date: Wed, 07 Dec 2005 09:40:43 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Riess Cc: pgsql-performance@postgresql.org Subject: Re: TSearch2 vs. Apache Lucene References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.043 required=5 tests=[AWL=0.043] X-Spam-Score: 0.043 X-Spam-Level: X-Archive-Number: 200512/211 X-Sequence-Number: 16032 ... So you'll avoid a non-core product and instead only use another non-core product...? Chris Michael Riess wrote: > >> Has anyone ever compared TSearch2 to Lucene, as far as performance is >> concerned? > > > I'll stay away from TSearch2 until it is fully integrated in the > postgres core (like "create index foo_text on foo (texta, textb) USING > TSearch2"). Because a full integration is unlikely to happen in the near > future (as far as I know), I'll stick to Lucene. > > Mike > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Wed Dec 7 05:31:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4B5DF9DD561 for ; Wed, 7 Dec 2005 05:31:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05461-09-2 for ; Wed, 7 Dec 2005 05:31:08 -0400 (AST) X-Greylist: delayed 03:20:17.742114 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 0D1B79DCD35 for ; Wed, 7 Dec 2005 05:31:03 -0400 (AST) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by svr2.postgresql.org (Postfix) with ESMTP id 51CBCF0CAE for ; Wed, 7 Dec 2005 03:07:00 +0000 (GMT) Received: from dell8200 (pcp09613107pcs.rte20201.de.comcast.net[68.82.197.68]) by comcast.net (rwcrmhc12) with SMTP id <20051207030657014008o119e>; Wed, 7 Dec 2005 03:06:59 +0000 From: "Rick Schumeyer" To: Subject: table partitioning: effects of many sub-tables (was COPY too slow...) Date: Tue, 6 Dec 2005 22:06:52 -0500 Message-ID: <000101c5fadb$470c7df0$0200a8c0@dell8200> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0002_01C5FAB1.5E3675F0" 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, score=1.333 required=5 tests=[HTML_MESSAGE=0.001, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.333 X-Spam-Level: * X-Archive-Number: 200512/227 X-Sequence-Number: 16048 This is a multi-part message in MIME format. ------=_NextPart_000_0002_01C5FAB1.5E3675F0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Based on a suggestion on the postgis list, I partitioned my 80 million (for now) record table into subtables of about 230k records (the amount of data collected in five minutes). At the moment I have 350 subtables. Everything seems to be great.COPY time is ok, building a geometric index on "only" 230k records is ok, query performance is ok. I'm a little concerned about having so many subtables. 350 tables is not bad, but what happens if the number of subtables grows into the thousands? Is there a practical limit to the effectiveness partitioning? ------=_NextPart_000_0002_01C5FAB1.5E3675F0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Based on a suggestion on the postgis list, I partitioned my 80 = million (for now) record table into

subtables of about 230k records (the amount of data collected in = five minutes).  At the moment

I have 350 subtables.

 

Everything seems to be great…COPY time is ok, building a geometric index on “only” 230k records

is ok, query performance is ok.

 

I’m a little concerned about having so many subtables. =  350 tables is not bad, but what happens if

the number of subtables grows into the thousands?  Is there = a practical limit to the effectiveness

partitioning?

 

------=_NextPart_000_0002_01C5FAB1.5E3675F0-- From pgsql-performance-owner@postgresql.org Wed Dec 7 00:14:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 942FE9DCAB5 for ; Wed, 7 Dec 2005 00:14:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27005-09 for ; Wed, 7 Dec 2005 00:14:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (unknown [216.148.227.153]) by postgresql.org (Postfix) with ESMTP id 5A3B49DCAB1 for ; Wed, 7 Dec 2005 00:14:51 -0400 (AST) Received: from sysexperts.com (c-67-170-228-241.hsd1.ca.comcast.net[67.170.228.241]) by comcast.net (rwcrmhc13) with ESMTP id <20051207041450015004vr81e>; Wed, 7 Dec 2005 04:14:50 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Tue, 06 Dec 2005 20:14:45 -0800 id 0601DBE3.439661B5.00004F8E Date: Tue, 6 Dec 2005 20:14:45 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Cc: Alex Turner Subject: Re: LVM and Postgres Message-ID: <20051207041445.GA6841@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org, Alex Turner References: <20051206093818.GE6708@campbell-lange.net> <20051206213623.GD14427@campbell-lange.net> <20051207002537.GN7330@mathom.us> <33c6269f0512061652u73a690t8af8a276118b1a83@mail.gmail.com> <20051207013107.GP7330@mathom.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <20051207013107.GP7330@mathom.us> Organization: Frobozzco International User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/217 X-Sequence-Number: 16038 Michael Stone wrote: > Note that the WAL will > wander around the disk as files are created and deleted, whereas tables > are basically updated in place. Huh? I was rather under the impression that the WAL files (in pg_xlog, right?) were reused once they'd been created, so their locations on the disk should remain the same, as should their data blocks (roughly, depending on the implementation of the filesystem, of course). -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Wed Dec 7 00:15:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 945BB9DCB3D for ; Wed, 7 Dec 2005 00:15:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36571-06 for ; Wed, 7 Dec 2005 00:15:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id 7BDB19DCB3C for ; Wed, 7 Dec 2005 00:15:47 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 5960D25078; Wed, 7 Dec 2005 12:15:45 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 1917725070; Wed, 7 Dec 2005 12:15:44 +0800 (WST) Message-ID: <43966290.7090908@familyhealth.com.au> Date: Wed, 07 Dec 2005 12:18:24 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Howard Oblowitz Cc: pgsql-performance@postgresql.org Subject: Re: Query Fails with error calloc - Cannot alocate memory References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.069 required=5 tests=[AWL=0.069] X-Spam-Score: 0.069 X-Spam-Level: X-Archive-Number: 200512/218 X-Sequence-Number: 16039 If you're trying to retrieve 26 million rows into RAM in one go of course it'll be trouble. Just use a cursor. (DECLARE/FETCH/MOVE) Chris Howard Oblowitz wrote: > Hi � > > I am trying to run a query that selects 26 million rows from a > > table with 68 byte rows. > > When run on the Server via psql the following error occurs: > > calloc : Cannot allocate memory > > When run via ODBC from Cognos Framework Manager only works > > if we limit the retrieval to 3 million rows. > > I notice that the memory used by the query when run on the Server increases > > to about 2.4 GB before the query fails. > > Postgres version is 7.3.4 > > Running on Linux Redhat 7.2 > > 4 GB memory > > 7 Processor 2.5 Ghz > > Shmmax set to 2 GB > > Configuration Parameters > > Shared Buffers 12 288 > > Max Connections 16 > > Wal buffers 24 > > Sort Mem 40960 > > Vacuum Mem 80192 > > Checkpoint Timeout 600 > > Enable Seqscan false > > Effective Cache Size 200000 > > > Results of explain analyze and expain analyze verbose: > > explain analyze select * from flash_by_branches; > > QUERY > PLAN > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > Seq Scan on flash_by_branches (cost=100000000.00..100567542.06 > rows=26854106 width=68) (actual time=12.14..103936.35 rows=26854106 loops=1) > > Total runtime: 122510.02 msec > > (2 rows) > > explain analyze verbose: > > { SEQSCAN > > :startup_cost 100000000.00 > > :total_cost 100567542.06 > > :rows 26854106 > > :width 68 > > :qptargetlist ( > > { TARGETENTRY > > :resdom > > { RESDOM > > :resno 1 > > :restype 1043 > > :restypmod 8 > > :resname br_code > > :reskey 0 > > :reskeyop 0 > > :ressortgroupref 0 > > :resjunk false > > } > > :expr > > { VAR > > :varno 1 > > :varattno 1 > > :vartype 1043 > > :vartypmod 8 > > :varlevelsup 0 > > :varnoold 1 > > :varoattno 1 > > } > > } > > { TARGETENTRY > > :resdom > > { RESDOM > > :resno 2 > > :restype 23 > > :restypmod -1 > > :resname fty_code > > :reskey 0 > > :reskeyop 0 > > :ressortgroupref 0 > > :resjunk false > > } > > :expr > > { VAR > > :varno 1 > > :varattno 2 > > :vartype 23 > > :vartypmod -1 > > :varlevelsup 0 > > :varnoold 1 > > :varoattno 2 > > } > > } > > { TARGETENTRY > > :resdom > > { RESDOM > > :resno 3 > > :restype 1082 > > :restypmod -1 > > :resname period > > :reskey 0 > > :reskeyop 0 > > :ressortgroupref 0 > > :resjunk false > > } > > :expr > > { VAR > > :varno 1 > > :varattno 3 > > :vartype 1082 > > :vartypmod -1 > > :varlevelsup 0 > > :varnoold 1 > > :varoattno 3 > > } > > } > > { TARGETENTRY > > :resdom > > { RESDOM > > :resno 4 > > :restype 1700 > > :restypmod 786436 > > :resname value > > :reskey 0 > > :reskeyop 0 > > :ressortgroupref 0 > > :resjunk false > > } > > :expr > > { VAR > > :varno 1 > > :varattno 4 > > :vartype 1700 > > :vartypmod 786436 > > :varlevelsup 0 > > :varnoold 1 > > :varoattno 4 > > } > > } > > { TARGETENTRY > > :resdom > > { RESDOM > > :resno 7 > > :restype 1700 > > :restypmod 786438 > > :resname value1 > > :reskey 0 > > :reskeyop 0 > > :ressortgroupref 0 > > :resjunk false > > } > > :expr > > { VAR > > :varno 1 > > :varattno 7 > > :vartype 1700 > > :vartypmod 786438 > > :varlevelsup 0 > > :varnoold 1 > > :varoattno 7 > > } > > } > > ) > > :qpqual <> > > :lefttree <> > > :righttree <> > > :extprm () > > :locprm () > > :initplan <> > > :nprm 0 > > :scanrelid 1 > > } > > Seq Scan on flash_by_branches (cost=100000000.00..100567542.06 > rows=26854106 width=68) (actual time=6.59..82501.15 rows=2685 > > 4106 loops=1) > > Total runtime: 102089.00 msec > > (196 rows) > > > > Please assist. > > Thanks, > > Howard Oblowitz > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.859 / Virus Database: 585 - Release Date: 14/02/2005 > > From pgsql-performance-owner@postgresql.org Wed Dec 7 00:34:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DEB819DCB4C for ; Wed, 7 Dec 2005 00:34:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28281-01 for ; Wed, 7 Dec 2005 00:34:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by postgresql.org (Postfix) with ESMTP id 79EF49DCB44 for ; Wed, 7 Dec 2005 00:34:05 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jB74Y4o20004; Tue, 6 Dec 2005 23:34:04 -0500 (EST) From: Bruce Momjian Message-Id: <200512070434.jB74Y4o20004@candle.pha.pa.us> Subject: Re: High context switches occurring In-Reply-To: <22673.1133912703@sss.pgh.pa.us> To: Tom Lane Date: Tue, 6 Dec 2005 23:34:04 -0500 (EST) CC: Anjan Dave , Vivek Khera , Postgresql Performance 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, score=0.007 required=5 tests=[AWL=0.007] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200512/219 X-Sequence-Number: 16040 Tom Lane wrote: > "Anjan Dave" writes: > > -bash-3.00$ time pgbench -c 1000 -t 30 pgbench > > starting vacuum...end. > > transaction type: TPC-B (sort of) > > scaling factor: 1 > > number of clients: 1000 > > number of transactions per client: 30 > > number of transactions actually processed: 30000/30000 > > tps = 45.871234 (including connections establishing) > > tps = 46.092629 (excluding connections establishing) > > I can hardly think of a worse way to run pgbench :-(. These numbers are > about meaningless, for two reasons: > > 1. You don't want number of clients (-c) much higher than scaling factor > (-s in the initialization step). The number of rows in the "branches" > table will equal -s, and since every transaction updates one Should we throw a warning when someone runs the test this way? -- 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 Dec 7 00:41:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BDF6C9DCB52 for ; Wed, 7 Dec 2005 00:41:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33770-08 for ; Wed, 7 Dec 2005 00:41:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by postgresql.org (Postfix) with ESMTP id 6B0A39DCB44 for ; Wed, 7 Dec 2005 00:41:33 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jB74fGY21078; Tue, 6 Dec 2005 23:41:16 -0500 (EST) From: Bruce Momjian Message-Id: <200512070441.jB74fGY21078@candle.pha.pa.us> Subject: Re: Effects of cascading references in foreign keys In-Reply-To: <12097.1130610925@sss.pgh.pa.us> To: Tom Lane Date: Tue, 6 Dec 2005 23:41:16 -0500 (EST) CC: Michael Fuhr , Bruno Wolff III , Martin Lesser , Stephan Szabo , 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, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200512/220 X-Sequence-Number: 16041 Would someone add a comment in the code about this, or research it? --------------------------------------------------------------------------- Tom Lane wrote: > I wrote: > > Looking at this, I wonder if there isn't a bug or at least an > > inefficiency in 8.1. The KeysEqual short circuit tests are still there > > in ri_triggers.c; aren't they now redundant with the test in triggers.c? > > And don't they need to account for the special case mentioned in the > > comment in triggers.c, that the RI check must still be done if we are > > looking at a row updated by the same transaction that created it? > > OK, I take back the possible-bug comment: the special case only applies > to the FK-side triggers, which is to say RI_FKey_check, and that routine > doesn't attempt to skip the check on equal old/new keys. I'm still > wondering though if the KeysEqual tests in the other RI triggers aren't > now a waste of cycles. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 3: 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 Wed Dec 7 00:49:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 87CBB9DCB55 for ; Wed, 7 Dec 2005 00:49:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20657-08 for ; Wed, 7 Dec 2005 00:49:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5DF789DCB38 for ; Wed, 7 Dec 2005 00:49:30 -0400 (AST) 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 jB74nSMe024709; Tue, 6 Dec 2005 23:49:28 -0500 (EST) To: Bruce Momjian cc: Tatsuo Ishii , Postgresql Performance Subject: Re: High context switches occurring In-reply-to: <200512070434.jB74Y4o20004@candle.pha.pa.us> References: <200512070434.jB74Y4o20004@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Tue, 06 Dec 2005 23:34:04 -0500" Date: Tue, 06 Dec 2005 23:49:28 -0500 Message-ID: <24708.1133930968@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/221 X-Sequence-Number: 16042 Bruce Momjian writes: > Tom Lane wrote: >> 1. You don't want number of clients (-c) much higher than scaling factor >> (-s in the initialization step). > Should we throw a warning when someone runs the test this way? Not a bad idea (though of course only for the "standard" scripts). Tatsuo, what do you think? regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 7 02:23:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2C3B49DCB52 for ; Wed, 7 Dec 2005 02:23:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17599-04 for ; Wed, 7 Dec 2005 02:23:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by postgresql.org (Postfix) with ESMTP id 124439DCAF0 for ; Wed, 7 Dec 2005 02:23:52 -0400 (AST) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id BBEB22399A9; Wed, 7 Dec 2005 01:23:52 -0500 (EST) 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 65751-01-4; Wed, 7 Dec 2005 01:23:51 -0500 (EST) Received: from [192.168.1.104] (d226-86-55.home.cgocable.net [24.226.86.55]) by mailbox.samurai.com (Postfix) with ESMTP id 04B2C2395CB; Wed, 7 Dec 2005 01:23:50 -0500 (EST) Subject: Re: Query Fails with error calloc - Cannot alocate memory From: Neil Conway To: Howard Oblowitz Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Date: Wed, 07 Dec 2005 01:31:37 -0500 Message-Id: <1133937097.8495.81.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/222 X-Sequence-Number: 16043 On Mon, 2005-12-05 at 09:42 +0200, Howard Oblowitz wrote: > I am trying to run a query that selects 26 million rows from a > table with 68 byte rows. > > When run on the Server via psql the following error occurs: > > calloc : Cannot allocate memory That's precisely what I'd expect: the backend will process the query and begin sending back the entire result set to the client. The client will attempt to allocate a local buffer to hold the entire result set, which obviously fails in this case. You probably want to explicitly create and manipulate a cursor via DECLARE, FETCH, and the like -- Postgres will not attempt to do this automatically (for good reason). > Postgres version is 7.3.4 You should consider upgrading, 7.3 is quite old. At the very least, you should probably be using the most recent 7.3.x release, 7.3.11. -Neil From pgsql-performance-owner@postgresql.org Sun Dec 11 14:50:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 343439DCC89 for ; Wed, 7 Dec 2005 03:26:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03897-06 for ; Wed, 7 Dec 2005 03:26:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by postgresql.org (Postfix) with ESMTP id EF5F09DCD0E for ; Wed, 7 Dec 2005 03:26:51 -0400 (AST) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id 28F7A6217D; Wed, 7 Dec 2005 16:26:51 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id 1584C10CD06; Wed, 7 Dec 2005 16:26:51 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id E50BA10CD04; Wed, 7 Dec 2005 16:26:50 +0900 (JST) Received: from localhost (srapc2345.sra.co.jp [133.137.44.184]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id QAA13128; Wed, 7 Dec 2005 16:26:50 +0900 Date: Wed, 07 Dec 2005 16:26:44 +0900 (JST) Message-Id: <20051207.162644.77062542.t-ishii@sraoss.co.jp> To: tgl@sss.pgh.pa.us Cc: pgman@candle.pha.pa.us, t-ishii@sra.co.jp, pgsql-performance@postgresql.org Subject: Re: High context switches occurring From: Tatsuo Ishii In-Reply-To: <24708.1133930968@sss.pgh.pa.us> References: <200512070434.jB74Y4o20004@candle.pha.pa.us> <24708.1133930968@sss.pgh.pa.us> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.157 required=5 tests=[AWL=0.157] X-Spam-Score: 0.157 X-Spam-Level: X-Archive-Number: 200512/277 X-Sequence-Number: 16098 > Bruce Momjian writes: > > Tom Lane wrote: > >> 1. You don't want number of clients (-c) much higher than scaling factor > >> (-s in the initialization step). > > > Should we throw a warning when someone runs the test this way? > > Not a bad idea (though of course only for the "standard" scripts). > Tatsuo, what do you think? That would be annoying since almost every users will get the kind of warnings. What about improving the README? -- Tatsuo Ishii SRA OSS, Inc. Japan From pgsql-performance-owner@postgresql.org Wed Dec 7 03:56:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 858EA9DCAE1 for ; Wed, 7 Dec 2005 03:56:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57120-03 for ; Wed, 7 Dec 2005 03:56:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 1F4B29DCB52 for ; Wed, 7 Dec 2005 03:56:20 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id F163B3093C; Wed, 7 Dec 2005 08:56:17 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: TSearch2 vs. Apache Lucene Date: Wed, 07 Dec 2005 08:56:18 +0100 Organization: Hub.Org Networking Services Lines: 35 Message-ID: References: <43963D9B.4020605@familyhealth.com.au> 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <43963D9B.4020605@familyhealth.com.au> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/223 X-Sequence-Number: 16044 No, my problem is that using TSearch2 interferes with other core components of postgres like (auto)vacuum or dump/restore. > ... > > So you'll avoid a non-core product and instead only use another non-core > product...? > > Chris > > Michael Riess wrote: >> >>> Has anyone ever compared TSearch2 to Lucene, as far as performance is >>> concerned? >> >> >> I'll stay away from TSearch2 until it is fully integrated in the >> postgres core (like "create index foo_text on foo (texta, textb) USING >> TSearch2"). Because a full integration is unlikely to happen in the >> near future (as far as I know), I'll stick to Lucene. >> >> Mike >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 3: Have you checked our extensive FAQ? >> >> http://www.postgresql.org/docs/faq > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Wed Dec 7 04:17:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C609F9DCAF0 for ; Wed, 7 Dec 2005 04:17:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98159-01 for ; Wed, 7 Dec 2005 04:17:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id 7AE079DCAE4 for ; Wed, 7 Dec 2005 04:17:10 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 80B6625074; Wed, 7 Dec 2005 16:17:10 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id E0BEE2506B; Wed, 7 Dec 2005 16:17:07 +0800 (WST) Message-ID: <43969B31.5070904@familyhealth.com.au> Date: Wed, 07 Dec 2005 16:20:01 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Riess Cc: pgsql-performance@postgresql.org Subject: Re: TSearch2 vs. Apache Lucene References: <43963D9B.4020605@familyhealth.com.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.065 required=5 tests=[AWL=0.065] X-Spam-Score: 0.065 X-Spam-Level: X-Archive-Number: 200512/224 X-Sequence-Number: 16045 > No, my problem is that using TSearch2 interferes with other core > components of postgres like (auto)vacuum or dump/restore. That's nonsense...seriously. The only trick with dump/restore is that you have to install the tsearch2 shared library before restoring. That's the same as all contribs though. Chris From pgsql-performance-owner@postgresql.org Wed Dec 7 04:28:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6A8009DCAF0 for ; Wed, 7 Dec 2005 04:28:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18849-07 for ; Wed, 7 Dec 2005 04:28:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id C5E589DCAE1 for ; Wed, 7 Dec 2005 04:28:50 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id BFC303093C; Wed, 7 Dec 2005 09:28:51 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: TSearch2 vs. Apache Lucene Date: Wed, 07 Dec 2005 09:28:52 +0100 Organization: Hub.Org Networking Services Lines: 27 Message-ID: References: <43963D9B.4020605@familyhealth.com.au> <43969B31.5070904@familyhealth.com.au> 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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <43969B31.5070904@familyhealth.com.au> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/225 X-Sequence-Number: 16046 Christopher Kings-Lynne schrieb: >> No, my problem is that using TSearch2 interferes with other core >> components of postgres like (auto)vacuum or dump/restore. > > That's nonsense...seriously. > > The only trick with dump/restore is that you have to install the > tsearch2 shared library before restoring. That's the same as all > contribs though. Well, then it changed since I last read the documentation. That was about a year ago, and since then we are using Lucene ... and as it works quite nicely, I see no reason to switch to TSearch2. Including it with the pgsql core would make it much more attractive to me, as it seems to me that once included into the core, features seem to be more stable. Call me paranoid, if you must ... ;-) > > Chris > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > From pgsql-performance-owner@postgresql.org Wed Dec 7 05:27:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 68B129DCD03 for ; Wed, 7 Dec 2005 05:27:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45641-02 for ; Wed, 7 Dec 2005 05:27:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id BA7619DCEB4 for ; Wed, 7 Dec 2005 05:27:39 -0400 (AST) 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 D6F0146808D; Wed, 7 Dec 2005 09:27:28 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9A20F15EA4; Wed, 7 Dec 2005 09:27:33 +0000 (GMT) Message-ID: <4396AB05.2010806@archonet.com> Date: Wed, 07 Dec 2005 09:27:33 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Edison Azzi Cc: pgsql-performance@postgresql.org Subject: Re: Join the same row References: <4395F317.4040806@terra.com.br> In-Reply-To: <4395F317.4040806@terra.com.br> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/226 X-Sequence-Number: 16047 Edison Azzi wrote: > Hi, >=20 > I=B4m trying to optimize some selects between 2 tables and the best way= I=20 > found was > alter the first table and add the fields of the 2nd table. I adjusted=20 > the contents and > now a have only one table with all info that I need. Now resides my=20 > problem, because > of legacy queries I decided to make a Rule that replace the 2nd table. >=20 > Until now all worked well, but I found when I make a join between de re= sult > table and de Rule, even tought is the same row in the same table, the=20 > optimizer > generete two access for the same row: > cta_pag is the table and ctapag_adm is the rule. >=20 > CREATE OR REPLACE RULE "_RETURN" AS > ON SELECT TO ctapag_adm DO INSTEAD SELECT cta_pag.nrlancto,=20 > cta_pag.codconta, cta_pag.frequencia, cta_pag.nrlanctopai > FROM cta_pag > WHERE cta_pag.origem =3D 'A'::bpchar; >=20 > This is one of the legacy queries: >=20 > select * from cta_pag p , ctapag_adm a where a.nrlancto=3D p.nrlancto a= nd=20 > p.nrlancto =3D 21861; OK - and you get a self-join (which is what you asked for, but you'd=20 like the planner to notice that it might not be necessary). > Resulting in twice the time for accessing. >=20 > Acessing just on time the same row: >=20 > select * from cta_pag p where p.nrlancto =3D 21861 This isn't the same query though. Your rule has an additional condition=20 origem=3D'A'. This means it wouldn't be correct to eliminate the self-joi= n=20 even if the planner could. > Is there a way to force the optimizer to understand that is the same= =20 > row? However, even if you removed the condition on origem, I don't think the=20 planner will notice that it can eliminate the join. It's just too=20 unusual a case for the planner to have a rule for it. I might be wrong about the planner - I'm just another user. One of the=20 developers may correct me. --=20 Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Dec 7 06:46:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DFD019DCD22 for ; Wed, 7 Dec 2005 06:46:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86697-02 for ; Wed, 7 Dec 2005 06:46:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 924449DCD03 for ; Wed, 7 Dec 2005 06:46:30 -0400 (AST) Received: (qmail invoked by alias); 07 Dec 2005 10:46:33 -0000 Received: from p54A64EC2.dip.t-dialin.net (EHLO athlon1000) [84.166.78.194] by mail.gmx.net (mp033) with SMTP; 07 Dec 2005 11:46:33 +0100 X-Authenticated: #594052 Received: from localhost (HELO [127.0.0.1]) [127.0.0.1] by athlon1000 (192.0.0.9) (userid 3) with ESMTP (Classic Hamster Version 2.1 Build 2.1.0.0) ; Wed, 07 Dec 2005 11:46:19 +0100 Message-ID: <4396BD7B.1050708@gmx.de> Date: Wed, 07 Dec 2005 11:46:19 +0100 From: Stephan Vollmer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050923 Thunderbird/1.0.7 Mnenhy/0.7.2.0 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: First query is slow, subsequent queries fast X-Enigmail-Version: 0.93.0.0 OpenPGP: id=8D46FCF8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Posting-Agent: Hamster/2.1.0.0 X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/228 X-Sequence-Number: 16049 Hi everybody! This is my first posting to this list and I'm quite a PostgreSQL newbie. My question is: The first time I execute a query, it is very slow, but subsequent queries are as fast as expected. I would be very glad if somebody could explain why the first query is so slow and what I could do to speed it up. The query operates on a tsearch2 indexed column, but I experienced the same issue on other tables as well, so I don't think it's a tsearch2 issue. To get a better overview of the queries and EXPLAIN outputs, I've put them on a temporary website, together with the table definition and my postgresql.conf: I'm running PostgreSQL 8.1 on Windows XP SP2, Athlon64 3000+, 2 GB RAM, 400 GB SATA HDD, 120 GB ATA HDD. The data reside on the first HDD, the indexes in an index tablespace on the second HDD. In the example below, the first query is still quite fast compared to others. Sometimes the first query takes up to 9000 ms (see website). I've run VACUUM FULL, but it didn't seem to solve the problem. Thanks very much in advance, - Stephan -------------------------------------------------------- Query: -------------------------------------------------------- SELECT keyword, overview FROM publications WHERE idx_fti @@ to_tsquery('default', 'linux & kernel') ORDER BY rank_cd(idx_fti, 'linux & kernel') DESC; -------------------------------------------------------- EXPLAIN for first query: -------------------------------------------------------- Sort (cost=859.89..860.48 rows=237 width=299) (actual time=1817.962..1817.971 rows=10 loops=1) Sort Key: rank_cd(idx_fti, '''linux'' & ''kernel'''::tsquery) -> Bitmap Heap Scan on publications (cost=3.83..850.54 rows=237 width=299) (actual time=1817.839..1817.914 rows=10 loops=1) Filter: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) -> Bitmap Index Scan on idx_fti_idx (cost=0.00..3.83 rows=237 width=0) (actual time=1817.792..1817.792 rows=10 loops=1) Index Cond: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) Total runtime: 1818.068 ms -------------------------------------------------------- EXPLAIN for second query: -------------------------------------------------------- Sort (cost=859.89..860.48 rows=237 width=299) (actual time=4.817..4.826 rows=10 loops=1) Sort Key: rank_cd(idx_fti, '''linux'' & ''kernel'''::tsquery) -> Bitmap Heap Scan on publications (cost=3.83..850.54 rows=237 width=299) (actual time=4.727..4.769 rows=10 loops=1) Filter: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) -> Bitmap Index Scan on idx_fti_idx (cost=0.00..3.83 rows=237 width=0) (actual time=4.675..4.675 rows=10 loops=1) Index Cond: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) Total runtime: 4.914 ms From pgsql-performance-owner@postgresql.org Wed Dec 7 06:55:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3307F9DCD22 for ; Wed, 7 Dec 2005 06:55:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03673-07 for ; Wed, 7 Dec 2005 06:55:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by postgresql.org (Postfix) with ESMTP id 0B6389DCB66 for ; Wed, 7 Dec 2005 06:55:41 -0400 (AST) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id jB7Atajq000242; Wed, 7 Dec 2005 13:55:37 +0300 (MSK) Date: Wed, 7 Dec 2005 13:55:36 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Stephan Vollmer cc: pgsql-performance@postgresql.org Subject: Re: First query is slow, subsequent queries fast In-Reply-To: <4396BD7B.1050708@gmx.de> Message-ID: References: <4396BD7B.1050708@gmx.de> 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, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200512/229 X-Sequence-Number: 16050 Stephan, you cache is too low :) Try to increase shared_buffers, for example, for 2Gb I'd set it to 100,000 On Wed, 7 Dec 2005, Stephan Vollmer wrote: > Hi everybody! > > This is my first posting to this list and I'm quite a PostgreSQL > newbie. My question is: > > The first time I execute a query, it is very slow, but subsequent > queries are as fast as expected. I would be very glad if somebody > could explain why the first query is so slow and what I could do to > speed it up. > > The query operates on a tsearch2 indexed column, but I experienced > the same issue on other tables as well, so I don't think it's a > tsearch2 issue. > > To get a better overview of the queries and EXPLAIN outputs, I've > put them on a temporary website, together with the table definition > and my postgresql.conf: > > > > I'm running PostgreSQL 8.1 on Windows XP SP2, Athlon64 3000+, 2 GB > RAM, 400 GB SATA HDD, 120 GB ATA HDD. The data reside on the first > HDD, the indexes in an index tablespace on the second HDD. > > In the example below, the first query is still quite fast compared > to others. Sometimes the first query takes up to 9000 ms (see > website). I've run VACUUM FULL, but it didn't seem to solve the problem. > > Thanks very much in advance, > > - Stephan > > > -------------------------------------------------------- > Query: > -------------------------------------------------------- > SELECT keyword, overview > FROM publications > WHERE idx_fti @@ to_tsquery('default', 'linux & kernel') > ORDER BY rank_cd(idx_fti, 'linux & kernel') DESC; > > > -------------------------------------------------------- > EXPLAIN for first query: > -------------------------------------------------------- > Sort (cost=859.89..860.48 rows=237 width=299) (actual > time=1817.962..1817.971 rows=10 loops=1) > Sort Key: rank_cd(idx_fti, '''linux'' & ''kernel'''::tsquery) > -> Bitmap Heap Scan on publications (cost=3.83..850.54 rows=237 > width=299) (actual time=1817.839..1817.914 rows=10 loops=1) > Filter: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) > -> Bitmap Index Scan on idx_fti_idx (cost=0.00..3.83 > rows=237 width=0) (actual time=1817.792..1817.792 rows=10 loops=1) > Index Cond: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) > Total runtime: 1818.068 ms > > > -------------------------------------------------------- > EXPLAIN for second query: > -------------------------------------------------------- > Sort (cost=859.89..860.48 rows=237 width=299) (actual > time=4.817..4.826 rows=10 loops=1) > Sort Key: rank_cd(idx_fti, '''linux'' & ''kernel'''::tsquery) > -> Bitmap Heap Scan on publications (cost=3.83..850.54 rows=237 > width=299) (actual time=4.727..4.769 rows=10 loops=1) > Filter: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) > -> Bitmap Index Scan on idx_fti_idx (cost=0.00..3.83 > rows=237 width=0) (actual time=4.675..4.675 rows=10 loops=1) > Index Cond: (idx_fti @@ '''linux'' & ''kernel'''::tsquery) > Total runtime: 4.914 ms > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83 From pgsql-performance-owner@postgresql.org Wed Dec 7 08:14:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 123FE9DCAE1 for ; Wed, 7 Dec 2005 08:14:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98634-03 for ; Wed, 7 Dec 2005 08:14:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailrelay.mobixell.com (unknown [62.219.168.154]) by postgresql.org (Postfix) with ESMTP id AF5ED9DCAD1 for ; Wed, 7 Dec 2005 08:14:18 -0400 (AST) Received: from mobiexc.mobixell.com (owa2000.mobixell.com [10.0.0.1]) by mailrelay.mobixell.com (8.12.11/8.12.11) with ESMTP id jB7CC024027366; Wed, 7 Dec 2005 14:12:00 +0200 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: Performance degradation after successive UPDATE's Date: Wed, 7 Dec 2005 14:14:31 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance degradation after successive UPDATE's Thread-Index: AcX6YcTREf9elp7xREOYoIoxRK5DzgAxK4Yg From: "Assaf Yaari" To: "Jan Wieck" Cc: "Bruno Wolff III" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.167 required=5 tests=[AWL=0.167] X-Spam-Score: 0.167 X-Spam-Level: X-Archive-Number: 200512/230 X-Sequence-Number: 16051 Hi Jan, As I'm novice with PostgreSQL, can you elaborate the term FSM and settings recommendations? BTW: I'm issuing VACUUM ANALYZE every 15 minutes (using cron) and also changes the setting of fsync to false in postgresql.conf but still time seems to be growing. Also no other transactions are open. Thanks, Assaf. > -----Original Message----- > From: Jan Wieck [mailto:JanWieck@Yahoo.com]=20 > Sent: Tuesday, December 06, 2005 2:35 PM > To: Assaf Yaari > Cc: Bruno Wolff III; pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Performance degradation after=20 > successive UPDATE's >=20 > On 12/6/2005 4:08 AM, Assaf Yaari wrote: > > Thanks Bruno, > >=20 > > Issuing VACUUM FULL seems not to have influence on the time. > > I've added to my script VACUUM ANALYZE every 100 UPDATE's=20 > and run the=20 > > test again (on different record) and the time still increase. >=20 > I think he meant >=20 > - run VACUUM FULL once, > - adjust FSM settings to database size and turnover ratio > - run VACUUM ANALYZE more frequent from there on. >=20 >=20 > Jan >=20 > >=20 > > Any other ideas? > >=20 > > Thanks, > > Assaf.=20 > >=20 > >> -----Original Message----- > >> From: Bruno Wolff III [mailto:bruno@wolff.to] > >> Sent: Monday, December 05, 2005 10:36 PM > >> To: Assaf Yaari > >> Cc: pgsql-performance@postgresql.org > >> Subject: Re: Performance degradation after successive UPDATE's > >>=20 > >> On Mon, Dec 05, 2005 at 19:05:01 +0200, > >> Assaf Yaari wrote: > >> > Hi, > >> > =20 > >> > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. > >> > =20 > >> > My application updates counters in DB. I left a test=20 > over the night=20 > >> > that increased counter of specific record. After night running=20 > >> > (several hundreds of thousands updates), I found out=20 > that the time=20 > >> > spent on UPDATE increased to be more than 1.5 second (at > >> the beginning > >> > it was less than 10ms)! Issuing VACUUM ANALYZE and even > >> reboot didn't > >> > seemed to solve the problem. > >>=20 > >> You need to be running vacuum more often to get rid of the deleted=20 > >> rows (update is essentially insert + delete). Once you get=20 > too many,=20 > >> plain vacuum won't be able to clean them up without=20 > raising the value=20 > >> you use for FSM. By now the table is really bloated and=20 > you probably=20 > >> want to use vacuum full on it. > >>=20 > >=20 > > ---------------------------(end of=20 > > broadcast)--------------------------- > > TIP 9: In versions below 8.0, the planner will ignore your desire to > > choose an index scan if your joining column's=20 > datatypes do not > > match >=20 >=20 > -- > = #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D# > # It's easier to get forgiveness for being wrong than for=20 > being right. # > # Let's break this rule - forgive me. =20 > # > = #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=20 > JanWieck@Yahoo.com # >=20 From pgsql-performance-owner@postgresql.org Wed Dec 7 11:50:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 262E89DCAD8 for ; Wed, 7 Dec 2005 11:50:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79983-02 for ; Wed, 7 Dec 2005 11:50:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id A18EC9DCABF for ; Wed, 7 Dec 2005 11:50:29 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 25E64B80A for ; Wed, 7 Dec 2005 10:50:33 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9B119964-6561-4349-B0EA-5CA19F36C407@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: postgresql performance tuning Date: Wed, 7 Dec 2005 10:50:31 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/231 X-Sequence-Number: 16052 On Dec 6, 2005, at 5:03 PM, Ameet Kini wrote: > table with only 1 index, the time to do a vacuum (without full) > went down > from 45 minutes to under 3 minutes. Maybe thats not bloat but thats > surely surprising. And this was after running vacuum periodically. I'll bet either your FSM settings are too low and/or you don't vacuum often enough for your data churn rate. Without more data, it is hard to solve the right problem. From pgsql-performance-owner@postgresql.org Wed Dec 7 11:54:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4E2649DD55F for ; Wed, 7 Dec 2005 11:54:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89835-01 for ; Wed, 7 Dec 2005 11:54:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id 9243C9DD552 for ; Wed, 7 Dec 2005 11:54:40 -0400 (AST) 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: High context switches occurring Date: Wed, 7 Dec 2005 10:54:41 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098ECB@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcX6vxaHOg4SBI2AQImTW5l6K1748gAhSzHw From: "Anjan Dave" To: "Tom Lane" Cc: "Vivek Khera" , "Postgresql Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200512/232 X-Sequence-Number: 16053 Thanks for your inputs, Tom. I was going after high concurrent clients, but should have read this carefully -=20 -s scaling_factor this should be used with -i (initialize) option. number of tuples generated will be multiple of the scaling factor. For example, -s 100 will imply 10M (10,000,000) tuples in the accounts table. default is 1. NOTE: scaling factor should be at least as large as the largest number of clients you intend to test; else you'll mostly be measuring update contention. I'll rerun the tests. Thanks, Anjan -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 Sent: Tuesday, December 06, 2005 6:45 PM To: Anjan Dave Cc: Vivek Khera; Postgresql Performance Subject: Re: [PERFORM] High context switches occurring=20 "Anjan Dave" writes: > -bash-3.00$ time pgbench -c 1000 -t 30 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 1000 > number of transactions per client: 30 > number of transactions actually processed: 30000/30000 > tps =3D 45.871234 (including connections establishing) > tps =3D 46.092629 (excluding connections establishing) I can hardly think of a worse way to run pgbench :-(. These numbers are about meaningless, for two reasons: 1. You don't want number of clients (-c) much higher than scaling factor (-s in the initialization step). The number of rows in the "branches" table will equal -s, and since every transaction updates one randomly-chosen "branches" row, you will be measuring mostly row-update contention overhead if there's more concurrent transactions than there are rows. In the case -s 1, which is what you've got here, there is no actual concurrency at all --- all the transactions stack up on the single branches row. 2. Running a small number of transactions per client means that startup/shutdown transients overwhelm the steady-state data. You should probably run at least a thousand transactions per client if you want repeatable numbers. Try something like "-s 10 -c 10 -t 3000" to get numbers reflecting test conditions more like what the TPC council had in mind when they designed this benchmark. I tend to repeat such a test 3 times to see if the numbers are repeatable, and quote the middle TPS number as long as they're not too far apart. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 7 12:24:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2CCF69DCB92 for ; Wed, 7 Dec 2005 12:24:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04991-05 for ; Wed, 7 Dec 2005 12:24:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id AE34B9DCABF for ; Wed, 7 Dec 2005 12:24:37 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 07 Dec 2005 10:24:33 -0600 Subject: Re: High context switches occurring From: Scott Marlowe To: Tom Lane Cc: Bruce Momjian , Tatsuo Ishii , Postgresql Performance In-Reply-To: <24708.1133930968@sss.pgh.pa.us> References: <200512070434.jB74Y4o20004@candle.pha.pa.us> <24708.1133930968@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1133972672.11803.23.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 07 Dec 2005 10:24:33 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/233 X-Sequence-Number: 16054 On Tue, 2005-12-06 at 22:49, Tom Lane wrote: > Bruce Momjian writes: > > Tom Lane wrote: > >> 1. You don't want number of clients (-c) much higher than scaling factor > >> (-s in the initialization step). > > > Should we throw a warning when someone runs the test this way? > > Not a bad idea (though of course only for the "standard" scripts). > Tatsuo, what do you think? Just to clarify, I think the pgbench program should throw the warning, not postgresql itself. Not sure if that's what you were meaning or not. Maybe even have it require a switch to run in such a mode, like a --yes-i-want-to-run-a-meaningless-test switch or something. From pgsql-performance-owner@postgresql.org Wed Dec 7 14:33:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1E0A19DCB87 for ; Wed, 7 Dec 2005 14:33:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23131-05 for ; Wed, 7 Dec 2005 14:33:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 051019DCB80 for ; Wed, 7 Dec 2005 14:33:48 -0400 (AST) Received: (qmail invoked by alias); 07 Dec 2005 18:33:48 -0000 Received: from p54A64EC2.dip.t-dialin.net (EHLO athlon1000) [84.166.78.194] by mail.gmx.net (mp033) with SMTP; 07 Dec 2005 19:33:48 +0100 X-Authenticated: #594052 Received: from localhost (HELO [127.0.0.1]) [127.0.0.1] by athlon1000 (192.0.0.9) (userid 3) with ESMTP (Classic Hamster Version 2.1 Build 2.1.0.0) ; Wed, 07 Dec 2005 19:33:38 +0100 Message-ID: <43972B01.3070709@gmx.de> Date: Wed, 07 Dec 2005 19:33:37 +0100 From: Stephan Vollmer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050923 Thunderbird/1.0.7 Mnenhy/0.7.2.0 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: First query is slow, subsequent queries fast References: <4396BD7B.1050708@gmx.de> In-Reply-To: X-Enigmail-Version: 0.93.0.0 OpenPGP: id=8D46FCF8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Posting-Agent: Hamster/2.1.0.0 X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/234 X-Sequence-Number: 16055 Hi Oleg, thanks for your quick reply! Oleg Bartunov wrote: > you cache is too low :) Try to increase shared_buffers, for example, > for 2Gb I'd set it to 100,000 Ok, I set shared_buffers to 100000 and indeed it makes a big difference. Other queries than the ones I mentioned are faster, too. Thanks very much for your help, - Stephan From pgsql-performance-owner@postgresql.org Sun Dec 11 14:50:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D20019DCAD8 for ; Wed, 7 Dec 2005 14:45:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63174-05 for ; Wed, 7 Dec 2005 14:45:43 -0400 (AST) X-Greylist: delayed 22:22:29.406015 by SQLgrey- Received: from birao.terra.com.br (birao.terra.com.br [200.176.10.197]) by postgresql.org (Postfix) with ESMTP id F00399DCAAE for ; Wed, 7 Dec 2005 14:45:40 -0400 (AST) Received: from bucavu.terra.com.br (bucavu.terra.com.br [200.176.10.6]) by birao.terra.com.br (Postfix) with ESMTP id 3B491108C167; Wed, 7 Dec 2005 16:45:39 -0200 (BRST) X-Terra-Karma: -2% X-Terra-Hash: e7e2eb7305c21d3a2bfd00461d52737a Received-SPF: pass (bucavu.terra.com.br: domain of terra.com.br designates 200.176.10.6 as permitted sender) client-ip=200.176.10.6; envelope-from=edisonazzi@terra.com.br; helo=[192.168.0.10]; Received: from [192.168.0.10] (cm-net-poa-C8B0C7C9.dynamic.brdterra.com.br [200.176.199.201]) (authenticated user edoazzi) by bucavu.terra.com.br (Postfix) with ESMTP id 7660F153C102; Wed, 7 Dec 2005 16:45:39 -0200 (BRST) Message-ID: <43972DB8.90400@terra.com.br> Date: Wed, 07 Dec 2005 16:45:12 -0200 From: Edison Azzi User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: Richard Huxton CC: pgsql-performance@postgresql.org Subject: Re: Join the same row References: <4395F317.4040806@terra.com.br> <4396AB05.2010806@archonet.com> In-Reply-To: <4396AB05.2010806@archonet.com> 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, score=2.432 required=5 tests=[AWL=0.186, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 2.432 X-Spam-Level: ** X-Archive-Number: 200512/278 X-Sequence-Number: 16099 Richard Huxton escreveu: > Edison Azzi wrote: > >> Hi, >> >> I�m trying to optimize some selects between 2 tables and the best way >> I found was >> alter the first table and add the fields of the 2nd table. I adjusted >> the contents and >> now a have only one table with all info that I need. Now resides my >> problem, because >> of legacy queries I decided to make a Rule that replace the 2nd table. >> >> Until now all worked well, but I found when I make a join between de >> result >> table and de Rule, even tought is the same row in the same table, the >> optimizer >> generete two access for the same row: >> cta_pag is the table and ctapag_adm is the rule. >> >> CREATE OR REPLACE RULE "_RETURN" AS >> ON SELECT TO ctapag_adm DO INSTEAD SELECT cta_pag.nrlancto, >> cta_pag.codconta, cta_pag.frequencia, cta_pag.nrlanctopai >> FROM cta_pag >> WHERE cta_pag.origem = 'A'::bpchar; >> >> This is one of the legacy queries: >> >> select * from cta_pag p , ctapag_adm a where a.nrlancto= p.nrlancto >> and p.nrlancto = 21861; > > > OK - and you get a self-join (which is what you asked for, but you'd > like the planner to notice that it might not be necessary). > >> Resulting in twice the time for accessing. >> >> Acessing just on time the same row: >> >> select * from cta_pag p where p.nrlancto = 21861 > > > This isn't the same query though. Your rule has an additional > condition origem='A'. This means it wouldn't be correct to eliminate > the self-join even if the planner could. > >> Is there a way to force the optimizer to understand that is the >> same row? > > > However, even if you removed the condition on origem, I don't think > the planner will notice that it can eliminate the join. It's just too > unusual a case for the planner to have a rule for it. > > I might be wrong about the planner - I'm just another user. One of the > developers may correct me. You are rigth, the planner will not eliminate the join, see: select * from cta_pag a, cta_pag p where a.nrlancto=p.nrlancto and p.nrlancto = 21861; EXPLAIN: Nested Loop (cost=0.00..11.48 rows=1 width=816) -> Index Scan using cta_pag_pk on cta_pag a (cost=0.00..5.74 rows=1 width=408) Index Cond: (21861::numeric = nrlancto) -> Index Scan using cta_pag_pk on cta_pag p (cost=0.00..5.74 rows=1 width=408) Index Cond: (nrlancto = 21861::numeric) I know that this is too unusual case, but I hoped that the planner could deal with this condition. I�m trying to speed up without have to rewrite a bunch of queries. Now I'll have to think another way to work around this issue. Thanks, Edison. From pgsql-performance-owner@postgresql.org Wed Dec 7 15:02:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 524A99DCCC8 for ; Wed, 7 Dec 2005 15:02:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57810-09 for ; Wed, 7 Dec 2005 15:02:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 324439DD206 for ; Wed, 7 Dec 2005 15:02:09 -0400 (AST) 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 15752428864; Wed, 7 Dec 2005 18:54:51 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7137A15EA4; Wed, 7 Dec 2005 18:55:05 +0000 (GMT) Message-ID: <43973008.2000708@archonet.com> Date: Wed, 07 Dec 2005 18:55:04 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Edison Azzi Cc: pgsql-performance@postgresql.org Subject: Re: Join the same row References: <4395F317.4040806@terra.com.br> <4396AB05.2010806@archonet.com> <43972DB8.90400@terra.com.br> In-Reply-To: <43972DB8.90400@terra.com.br> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/235 X-Sequence-Number: 16056 Edison Azzi wrote: > Richard Huxton escreveu: >> However, even if you removed the condition on origem, I don't think=20 >> the planner will notice that it can eliminate the join. It's just too = >> unusual a case for the planner to have a rule for it. >> >> I might be wrong about the planner - I'm just another user. One of the= =20 >> developers may correct me. >=20 >=20 > You are rigth, the planner will not eliminate the join, see: >=20 > select * from cta_pag a, cta_pag p where a.nrlancto=3Dp.nrlancto and=20 > p.nrlancto =3D 21861; >=20 > EXPLAIN: > Nested Loop (cost=3D0.00..11.48 rows=3D1 width=3D816) > -> Index Scan using cta_pag_pk on cta_pag a (cost=3D0.00..5.74 rows=3D= 1=20 > width=3D408) > Index Cond: (21861::numeric =3D nrlancto) > -> Index Scan using cta_pag_pk on cta_pag p (cost=3D0.00..5.74 rows=3D= 1=20 > width=3D408) > Index Cond: (nrlancto =3D 21861::numeric) >=20 >=20 > I know that this is too unusual case, but I hoped that the planner coul= d=20 > deal > with this condition. I=B4m trying to speed up without have to rewrite a= =20 > bunch of > queries. Now I'll have to think another way to work around this issue. Is the performance really so bad? All the data is guaranteed to be=20 cached for the second index-scan. --=20 Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Dec 7 16:00:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A7CAA9DCB52 for ; Wed, 7 Dec 2005 16:00:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77741-07 for ; Wed, 7 Dec 2005 16:00:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 994589DCAAE for ; Wed, 7 Dec 2005 16:00:05 -0400 (AST) Received: (qmail 8707 invoked by uid 500); 7 Dec 2005 20:04:34 -0000 Date: Wed, 7 Dec 2005 14:04:34 -0600 From: Bruno Wolff III To: Assaf Yaari Cc: Jan Wieck , pgsql-performance@postgresql.org Subject: Re: Performance degradation after successive UPDATE's Message-ID: <20051207200434.GA6624@wolff.to> Mail-Followup-To: Bruno Wolff III , Assaf Yaari , Jan Wieck , pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.014 required=5 tests=[AWL=0.014] X-Spam-Score: 0.014 X-Spam-Level: X-Archive-Number: 200512/236 X-Sequence-Number: 16057 On Wed, Dec 07, 2005 at 14:14:31 +0200, Assaf Yaari wrote: > Hi Jan, > > As I'm novice with PostgreSQL, can you elaborate the term FSM and > settings recommendations? http://developer.postgresql.org/docs/postgres/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-FSM > BTW: I'm issuing VACUUM ANALYZE every 15 minutes (using cron) and also > changes the setting of fsync to false in postgresql.conf but still time > seems to be growing. You generally don't want fsync set to false. > Also no other transactions are open. Have you given us explain analyse samples yet? > > Thanks, > Assaf. > > > -----Original Message----- > > From: Jan Wieck [mailto:JanWieck@Yahoo.com] > > Sent: Tuesday, December 06, 2005 2:35 PM > > To: Assaf Yaari > > Cc: Bruno Wolff III; pgsql-performance@postgresql.org > > Subject: Re: [PERFORM] Performance degradation after > > successive UPDATE's > > > > On 12/6/2005 4:08 AM, Assaf Yaari wrote: > > > Thanks Bruno, > > > > > > Issuing VACUUM FULL seems not to have influence on the time. > > > I've added to my script VACUUM ANALYZE every 100 UPDATE's > > and run the > > > test again (on different record) and the time still increase. > > > > I think he meant > > > > - run VACUUM FULL once, > > - adjust FSM settings to database size and turnover ratio > > - run VACUUM ANALYZE more frequent from there on. > > > > > > Jan > > > > > > > > Any other ideas? > > > > > > Thanks, > > > Assaf. > > > > > >> -----Original Message----- > > >> From: Bruno Wolff III [mailto:bruno@wolff.to] > > >> Sent: Monday, December 05, 2005 10:36 PM > > >> To: Assaf Yaari > > >> Cc: pgsql-performance@postgresql.org > > >> Subject: Re: Performance degradation after successive UPDATE's > > >> > > >> On Mon, Dec 05, 2005 at 19:05:01 +0200, > > >> Assaf Yaari wrote: > > >> > Hi, > > >> > > > >> > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. > > >> > > > >> > My application updates counters in DB. I left a test > > over the night > > >> > that increased counter of specific record. After night running > > >> > (several hundreds of thousands updates), I found out > > that the time > > >> > spent on UPDATE increased to be more than 1.5 second (at > > >> the beginning > > >> > it was less than 10ms)! Issuing VACUUM ANALYZE and even > > >> reboot didn't > > >> > seemed to solve the problem. > > >> > > >> You need to be running vacuum more often to get rid of the deleted > > >> rows (update is essentially insert + delete). Once you get > > too many, > > >> plain vacuum won't be able to clean them up without > > raising the value > > >> you use for FSM. By now the table is really bloated and > > you probably > > >> want to use vacuum full on it. > > >> > > > > > > ---------------------------(end of > > > broadcast)--------------------------- > > > TIP 9: In versions below 8.0, the planner will ignore your desire to > > > choose an index scan if your joining column's > > datatypes do not > > > match > > > > > > -- > > #============================================================= > > =========# > > # It's easier to get forgiveness for being wrong than for > > being right. # > > # Let's break this rule - forgive me. > > # > > #================================================== > > JanWieck@Yahoo.com # > > From pgsql-general-owner@postgresql.org Wed Dec 7 17:33:27 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AFE139DCAAE for ; Wed, 7 Dec 2005 17:33:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37203-07 for ; Wed, 7 Dec 2005 17:33:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 3C0DD9DCAA6 for ; Wed, 7 Dec 2005 17:33:23 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 07 Dec 2005 15:33:25 -0600 Subject: Re: Memory Leakage Problem From: Scott Marlowe To: pgsql general , Kathy Lo In-Reply-To: References: <1133891282.11803.7.camel@state.g2switchworks.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1133991204.11803.43.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 07 Dec 2005 15:33:25 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/407 X-Sequence-Number: 87970 Please keep replies on list, this may help others in the future, and also, don't top post (i.e. put your responses after my responses... Thanks) On Tue, 2005-12-06 at 20:16, Kathy Lo wrote: > For a back-end database server running Postgresql 8.0.3, it's OK. But, > this problem seriously affects the performance of my application > server. > > I upgraded my application server from > > Redhat 7.3 > unixODBC 2.2.4 > Postgresql 7.2.1 with ODBC driver > > to > > Redhat 9.0 > unixODBC 2.2.11 > Postgresql 8.0.3 > psqlodbc-08.01.0101 > pg_autovacuum runs as background job > > Before upgrading, the application server runs perfectly. After > upgrade, this problem appears. > > When the application server receives the request from a client, it > will access the back-end database server using both simple and complex > query. Then, it will create a database locally to store the matched > rows for data processing. After some data processing, it will return > the result to the requested client. If the client finishes browsing > the result, it will drop the local database. OK, there could be a lot of problems here. Are you actually doing "create database ..." for each of these things? I'm not sure that's a real good idea. Even create schema, which would be better, strikes me as not the best way to handle this. > At the same time, this application server can serve many many clients > so the application server has many many local databases at the same > time. Are you sure that you're better off with databases on your application server? You might be better off with either running these temp dbs on the backend server in the same cluster, or creating a cluster just for these jobs that is somewhat more conservative in its memory usage. I would lean towards doing this all on the backend server in one database using multiple schemas. > After running the application server for a few days, the memory of the > application server nearly used up and start to use the swap memory > and, as a result, the application server runs very very slow and the > users complain. Could you provide us with your evidence that the memory is "used up?" What is the problem, and what you perceive as the problem, may not be the same thing. Is it the output of top / free, and if so, could we see it, or whatever output is convincing you you're running out of memory? > I tested the application server without accessing the local database > (not store matched rows). The testing program running in the > application server just retrieved rows from the back-end database > server and then returned to the requested client directly. The memory > usage of the application server becomes normally and it can run for a > long time. Again, what you think is normal, and what normal really are may not be the same thing. Evidence. Please show us the output of top / free or whatever that is showing this. > I found this problem after I upgrading the application server. > > On 12/7/05, Scott Marlowe wrote: > > On Tue, 2005-12-06 at 03:22, Kathy Lo wrote: > > > Hi, > > > > > > > > In this program, it will access this database server using simple and > > > complex (joining tables) SQL Select statement and retrieve the matched > > > rows. For each access, it will connect the database and disconnect it. > > > > > > I found that the memory of the databaser server nearly used up (total 2G > > RAM). > > > > > > After I stop the program, the used memory did not free. > > > > Ummmm. What exactly do you mean? Can we see the output of top and / or > > free? I'm guessing that what Tom said is right, you're just seeing a > > normal state of how unix does things. > > > > If your output of free looks like this: > > > > -bash-2.05b$ free > > total used free shared buffers cached > > Mem:6096912 6069588 27324 0 260728 5547264 > > -/+ buffers/cache: 261596 5835316 > > Swap: 4192880 16320 4176560 > > > > Then that's normal. > > > > That's the output of free on a machine with 6 gigs that runs a reporting > > database. Note that while it shows almost ALL the memory as used, it is > > being used by the kernel, which is a good thing. Note that 5547264 or > > about 90% of memory is being used as kernel cache. That's a good thing. > > > > Note you can also get yourself in trouble with top. It's not uncommon > > for someone to see a bunch of postgres processes each eating up 50 or > > more megs of ram, and panic and think that they're running out of > > memory, when, in fact, 44 meg for each of those processes is shared, and > > the real usage per backend is 6 megs or less. > > > > Definitely grab yourself a good unix / linux sysadmin guide. The "in a > > nutshell" books from O'Reilley (sp?) are a good starting point. > > > > > -- > Kathy Lo From pgsql-general-owner@postgresql.org Wed Dec 7 22:25:06 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B158B9DCD59 for ; Wed, 7 Dec 2005 22:25:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67321-04 for ; Wed, 7 Dec 2005 22:25:09 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.199]) by postgresql.org (Postfix) with ESMTP id 452759DCB0A for ; Wed, 7 Dec 2005 22:25:03 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so557529nzn for ; Wed, 07 Dec 2005 18:25:07 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HFSP+5ICTfeyr8/FltD0JsjU+lOuQbiY0ZPqARSc752yXO9+cfUHETX5SYklNrsLQertfw6s5V+FaMo79SUgydHYTtXIuf5n1Y3CMehq/Q+H3DwyXWCINOKWvEXPBGwYTS0qTOn7PS09UgI0A1gpjKaZavAo9mLmbLGiHzggjoE= Received: by 10.65.181.10 with SMTP id i10mr2447823qbp; Wed, 07 Dec 2005 18:25:07 -0800 (PST) Received: by 10.64.213.18 with HTTP; Wed, 7 Dec 2005 18:25:07 -0800 (PST) Message-ID: Date: Thu, 8 Dec 2005 10:25:07 +0800 From: Kathy Lo To: pgsql general , Scott Marlowe Subject: Re: Memory Leakage Problem In-Reply-To: <1133991204.11803.43.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/415 X-Sequence-Number: 87978 T24gMTIvOC8wNSwgU2NvdHQgTWFybG93ZSA8c21hcmxvd2VAZzJzd2l0Y2h3b3Jrcy5jb20+IHdy b3RlOgo+IFBsZWFzZSBrZWVwIHJlcGxpZXMgb24gbGlzdCwgdGhpcyBtYXkgaGVscCBvdGhlcnMg aW4gdGhlIGZ1dHVyZSwgYW5kCj4gYWxzbywgZG9uJ3QgdG9wIHBvc3QgKGkuZS4gcHV0IHlvdXIg cmVzcG9uc2VzIGFmdGVyIG15IHJlc3BvbnNlcy4uLgo+IFRoYW5rcykKPgo+IE9uIFR1ZSwgMjAw NS0xMi0wNiBhdCAyMDoxNiwgS2F0aHkgTG8gd3JvdGU6Cj4gPiBGb3IgYSBiYWNrLWVuZCBkYXRh YmFzZSBzZXJ2ZXIgcnVubmluZyBQb3N0Z3Jlc3FsIDguMC4zLCBpdCdzIE9LLiBCdXQsCj4gPiB0 aGlzIHByb2JsZW0gc2VyaW91c2x5IGFmZmVjdHMgdGhlIHBlcmZvcm1hbmNlIG9mIG15IGFwcGxp Y2F0aW9uCj4gPiBzZXJ2ZXIuCj4gPgo+ID4gSSB1cGdyYWRlZCBteSBhcHBsaWNhdGlvbiBzZXJ2 ZXIgZnJvbQo+ID4KPiA+ICAgICBSZWRoYXQgNy4zCj4gPiAgICAgdW5peE9EQkMgMi4yLjQKPiA+ ICAgICBQb3N0Z3Jlc3FsIDcuMi4xIHdpdGggT0RCQyBkcml2ZXIKPiA+Cj4gPiB0bwo+ID4KPiA+ ICAgICBSZWRoYXQgOS4wCj4gPiAgICAgdW5peE9EQkMgMi4yLjExCj4gPiAgICAgUG9zdGdyZXNx bCA4LjAuMwo+ID4gICAgIHBzcWxvZGJjLTA4LjAxLjAxMDEKPiA+ICAgICBwZ19hdXRvdmFjdXVt IHJ1bnMgYXMgYmFja2dyb3VuZCBqb2IKPiA+Cj4gPiBCZWZvcmUgdXBncmFkaW5nLCB0aGUgYXBw bGljYXRpb24gc2VydmVyIHJ1bnMgcGVyZmVjdGx5LiBBZnRlcgo+ID4gdXBncmFkZSwgdGhpcyBw cm9ibGVtIGFwcGVhcnMuCj4gPgo+ID4gV2hlbiB0aGUgYXBwbGljYXRpb24gc2VydmVyIHJlY2Vp dmVzIHRoZSByZXF1ZXN0IGZyb20gYSBjbGllbnQsIGl0Cj4gPiB3aWxsIGFjY2VzcyB0aGUgYmFj ay1lbmQgZGF0YWJhc2Ugc2VydmVyIHVzaW5nIGJvdGggc2ltcGxlIGFuZCBjb21wbGV4Cj4gPiBx dWVyeS4gVGhlbiwgaXQgd2lsbCBjcmVhdGUgYSBkYXRhYmFzZSBsb2NhbGx5IHRvIHN0b3JlIHRo ZSBtYXRjaGVkCj4gPiByb3dzIGZvciBkYXRhIHByb2Nlc3NpbmcuIEFmdGVyIHNvbWUgZGF0YSBw cm9jZXNzaW5nLCBpdCB3aWxsIHJldHVybgo+ID4gdGhlIHJlc3VsdCB0byB0aGUgcmVxdWVzdGVk IGNsaWVudC4gSWYgdGhlIGNsaWVudCBmaW5pc2hlcyBicm93c2luZwo+ID4gdGhlIHJlc3VsdCwg aXQgd2lsbCBkcm9wIHRoZSBsb2NhbCBkYXRhYmFzZS4KPgo+IE9LLCB0aGVyZSBjb3VsZCBiZSBh IGxvdCBvZiBwcm9ibGVtcyBoZXJlLiAgQXJlIHlvdSBhY3R1YWxseSBkb2luZwo+ICJjcmVhdGUg ZGF0YWJhc2UgLi4uIiBmb3IgZWFjaCBvZiB0aGVzZSB0aGluZ3M/ICBJJ20gbm90IHN1cmUgdGhh dCdzIGEKPiByZWFsIGdvb2QgaWRlYS4gIEV2ZW4gY3JlYXRlIHNjaGVtYSwgd2hpY2ggd291bGQg YmUgYmV0dGVyLCBzdHJpa2VzIG1lCj4gYXMgbm90IHRoZSBiZXN0IHdheSB0byBoYW5kbGUgdGhp cy4KPgpBY3R1YWxseSwgbXkgcHJvZ3JhbSBpcyB3cml0dGVuIHVzaW5nIEMrKyBzbyBJIHVzZSAi Y3JlYXRlIGRhdGFiYXNlIgpTUUwgdG8gY3JlYXRlIGRhdGFiYXNlLiBJZiBub3QgdGhlIGJlc3Qg d2F5LCBwbGVhc2UgdGVsbCBtZSBhbm90aGVyCm1ldGhvZCB0byBjcmVhdGUgZGF0YWJhc2UgaW4g QysrIHByb2dyYW0uCgo+ID4gQXQgdGhlIHNhbWUgdGltZSwgdGhpcyBhcHBsaWNhdGlvbiBzZXJ2 ZXIgY2FuIHNlcnZlIG1hbnkgbWFueSBjbGllbnRzCj4gPiBzbyB0aGUgYXBwbGljYXRpb24gc2Vy dmVyIGhhcyBtYW55IG1hbnkgbG9jYWwgZGF0YWJhc2VzIGF0IHRoZSBzYW1lCj4gPiB0aW1lLgo+ Cj4gQXJlIHlvdSBzdXJlIHRoYXQgeW91J3JlIGJldHRlciBvZmYgd2l0aCBkYXRhYmFzZXMgb24g eW91ciBhcHBsaWNhdGlvbgo+IHNlcnZlcj8gIFlvdSBtaWdodCBiZSBiZXR0ZXIgb2ZmIHdpdGgg ZWl0aGVyIHJ1bm5pbmcgdGhlc2UgdGVtcCBkYnMgb24KPiB0aGUgYmFja2VuZCBzZXJ2ZXIgaW4g dGhlIHNhbWUgY2x1c3Rlciwgb3IgY3JlYXRpbmcgYSBjbHVzdGVyIGp1c3QgZm9yCj4gdGhlc2Ug am9icyB0aGF0IGlzIHNvbWV3aGF0IG1vcmUgY29uc2VydmF0aXZlIGluIGl0cyBtZW1vcnkgdXNh Z2UuICBJCj4gd291bGQgbGVhbiB0b3dhcmRzIGRvaW5nIHRoaXMgYWxsIG9uIHRoZSBiYWNrZW5k IHNlcnZlciBpbiBvbmUgZGF0YWJhc2UKPiB1c2luZyBtdWx0aXBsZSBzY2hlbWFzLgo+CkJlY2F1 c2UgdGhlIGRhdGEgYXJlIGRpc3RyaWJ1dGVkIGluIG1hbnkgYmFjay1lbmQgZGF0YWJhc2Ugc2Vy dmVycwoocGh5c2ljYWxseSwgaW4gZGlmZmVyZW50IGhhcmR3YXJlIG1hY2hpbmVzKSwgSSBuZWVk IHRvIHVzZQpBcHBsaWNhdGlvbiBzZXJ2ZXIgdG8gdGVtcG9yYXJpbHkgc3RvcmUgdGhlIGRhdGEg cmV0cmlldmVkIGZyb20KZGlmZmVyZW50IG1hY2hpbmVzIGFuZCB0aGVuIGRvIHRoZSBkYXRhIHBy b2Nlc3NpbmcuIEFuZCwgZm9yIHNlY3VyaXR5CnJlYXNvbiwgYWxsIHRoZSB1c2VycyBjYW5ub3Qg ZGlyZWN0bHkgYWNjZXNzIHRoZSBiYWNrLWVuZCBkYXRhYmFzZQpzZXJ2ZXJzLiBTbywgSSB1c2Ug dGhlIGRhdGFiYXNlIGluIGFwcGxpY2F0aW9uIHNlcnZlciB0byBrZWVwIHRoZQpyZXN1bHQgb2Yg ZGF0YSBwcm9jZXNzaW5nLgoKPiA+IEFmdGVyIHJ1bm5pbmcgdGhlIGFwcGxpY2F0aW9uIHNlcnZl ciBmb3IgYSBmZXcgZGF5cywgdGhlIG1lbW9yeSBvZiB0aGUKPiA+IGFwcGxpY2F0aW9uIHNlcnZl ciBuZWFybHkgdXNlZCB1cCBhbmQgc3RhcnQgdG8gdXNlIHRoZSBzd2FwIG1lbW9yeQo+ID4gYW5k LCBhcyBhIHJlc3VsdCwgdGhlIGFwcGxpY2F0aW9uIHNlcnZlciBydW5zIHZlcnkgdmVyeSBzbG93 IGFuZCB0aGUKPiA+IHVzZXJzIGNvbXBsYWluLgo+Cj4gQ291bGQgeW91IHByb3ZpZGUgdXMgd2l0 aCB5b3VyIGV2aWRlbmNlIHRoYXQgdGhlIG1lbW9yeSBpcyAidXNlZCB1cD8iCj4gV2hhdCBpcyB0 aGUgcHJvYmxlbSwgYW5kIHdoYXQgeW91IHBlcmNlaXZlIGFzIHRoZSBwcm9ibGVtLCBtYXkgbm90 IGJlCj4gdGhlIHNhbWUgdGhpbmcuICBJcyBpdCB0aGUgb3V0cHV0IG9mIHRvcCAvIGZyZWUsIGFu ZCBpZiBzbywgY291bGQgd2Ugc2VlCj4gaXQsIG9yIHdoYXRldmVyIG91dHB1dCBpcyBjb252aW5j aW5nIHlvdSB5b3UncmUgcnVubmluZyBvdXQgb2YgbWVtb3J5Pwo+CldoZW4gdGhlIHVzZXIgY29t cGxhaW5zIHRoZSBzeXN0ZW0gYmVjb21lcyB2ZXJ5IHNsb3csIEkgdXNlIHRvcCB0bwp2aWV3IHRo ZSBtZW1vcnkgc3RhdGlzdGljcy4KSW4gdG9wLCBJIGNhbm5vdCBmaW5kIGFueSBwcm9jZXNzZXMg dGhhdCB1c2Ugc28gbWFueSBtZW1vcnkuIEkganVzdApmb3VuZCB0aGF0IGFsbCB0aGUgbWVtb3J5 IHdhcyB1c2VkIHVwIGFuZCB0aGUgU3dhcCBtZW1vcnkgbmVhcmx5IHVzZWQKdXAuCgpJIHNhaWQg aXQgaXMgdGhlIHByb2JsZW0gYmVjYXVzZSwgYmVmb3JlIHVwZ3JhZGluZyB0aGUgYXBwbGljYXRp b24Kc2VydmVyLCBubyBtZW1vcnkgcHJvYmxlbSBldmVuIHJ1bm5pbmcgdGhlIGFwcGxpY2F0aW9u IHNlcnZlciBmb3IgMQptb250aC4gQWZ0ZXIgdXBncmFkaW5nIHRoZSBhcHBsaWNhdGlvbiBzZXJ2 ZXIsIHRoaXMgcHJvYmxlbSBhcHBlYXJzCmp1c3QgYWZ0ZXIgcnVubmluZyB0aGUgYXBwbGljYXRp b24gc2VydmVyIGZvciAxIHdlZWsuIFdoeSBoYXZpbmcgdGhpcwpCSUcgZGlmZmVyZW5jZSBiZXR3 ZWVuIHBvc3RncmVzcWwgNy4yLjEgb24gUmVkaGF0IDcuMyBhbmQgcG9zdGdyZXNxbAo4LjAuMyBv biBSZWRoYXQgOS4wPyBJIG9ubHkgdXBncmFkZSB0aGUgT1MsIHBvc3RncmVzcWwsIHVuaXhPREJD IGFuZApwb3N0Z3Jlc3FsIE9EQkMgZHJpdmVyLiBUaGUgcHJvZ3JhbSBJIHdyaXR0ZW4gSVMgVEhF IFNBTUUuCgo+ID4gSSB0ZXN0ZWQgdGhlIGFwcGxpY2F0aW9uIHNlcnZlciB3aXRob3V0IGFjY2Vz c2luZyB0aGUgbG9jYWwgZGF0YWJhc2UKPiA+IChub3Qgc3RvcmUgbWF0Y2hlZCByb3dzKS4gVGhl IHRlc3RpbmcgcHJvZ3JhbSBydW5uaW5nIGluIHRoZQo+ID4gYXBwbGljYXRpb24gc2VydmVyIGp1 c3QgcmV0cmlldmVkIHJvd3MgZnJvbSB0aGUgYmFjay1lbmQgZGF0YWJhc2UKPiA+IHNlcnZlciBh bmQgdGhlbiByZXR1cm5lZCB0byB0aGUgcmVxdWVzdGVkIGNsaWVudCBkaXJlY3RseS4gVGhlIG1l bW9yeQo+ID4gdXNhZ2Ugb2YgdGhlIGFwcGxpY2F0aW9uIHNlcnZlciBiZWNvbWVzIG5vcm1hbGx5 IGFuZCBpdCBjYW4gcnVuIGZvciBhCj4gPiBsb25nIHRpbWUuCj4KPiBBZ2Fpbiwgd2hhdCB5b3Ug dGhpbmsgaXMgbm9ybWFsLCBhbmQgd2hhdCBub3JtYWwgcmVhbGx5IGFyZSBtYXkgbm90IGJlCj4g dGhlIHNhbWUgdGhpbmcuICBFdmlkZW5jZS4gIFBsZWFzZSBzaG93IHVzIHRoZSBvdXRwdXQgb2Yg dG9wIC8gZnJlZSBvcgo+IHdoYXRldmVyIHRoYXQgaXMgc2hvd2luZyB0aGlzLgo+CkFmdGVyIEkg cmVjZWl2ZWQgdGhlIHVzZXIncyBjb21wbGFpbiwgSSBqdXN0IHVzZSB0b3AgdG8gdmlldyB0aGUK bWVtb3J5IHN0YXRpc3RpYy4gSSBmb3Jnb3QgdG8gc2F2ZSB0aGUgb3V0cHV0LiBCdXQsIEkgYW0g cnVubmluZyBhCnRlc3QgdG8gZ2V0IGJhY2sgdGhlIHByb2JsZW0uIFNvLCBhZnRlciBydW5uaW5n IHRoZSB0ZXN0LCBJIHdpbGwgZ2l2ZQp5b3UgdGhlIG91dHB1dCBvZiB0aGUgdG9wL2ZyZWUuCgo+ ID4gSSBmb3VuZCB0aGlzIHByb2JsZW0gYWZ0ZXIgSSB1cGdyYWRpbmcgdGhlIGFwcGxpY2F0aW9u IHNlcnZlci4KPiA+Cj4gPiBPbiAxMi83LzA1LCBTY290dCBNYXJsb3dlIDxzbWFybG93ZUBnMnN3 aXRjaHdvcmtzLmNvbT4gd3JvdGU6Cj4gPiA+IE9uIFR1ZSwgMjAwNS0xMi0wNiBhdCAwMzoyMiwg S2F0aHkgTG8gd3JvdGU6Cj4gPiA+ID4gSGksCj4gPiA+Cj4gPiA+ID4KPiA+ID4gPiBJbiB0aGlz IHByb2dyYW0sIGl0IHdpbGwgYWNjZXNzIHRoaXMgZGF0YWJhc2Ugc2VydmVyIHVzaW5nIHNpbXBs ZSBhbmQKPiA+ID4gPiBjb21wbGV4IChqb2luaW5nIHRhYmxlcykgU1FMIFNlbGVjdCBzdGF0ZW1l bnQgYW5kIHJldHJpZXZlIHRoZSBtYXRjaGVkCj4gPiA+ID4gcm93cy4gRm9yIGVhY2ggYWNjZXNz LCBpdCB3aWxsIGNvbm5lY3QgdGhlIGRhdGFiYXNlIGFuZCBkaXNjb25uZWN0IGl0Lgo+ID4gPiA+ Cj4gPiA+ID4gSSBmb3VuZCB0aGF0IHRoZSBtZW1vcnkgb2YgdGhlIGRhdGFiYXNlciBzZXJ2ZXIg bmVhcmx5IHVzZWQgdXAgKHRvdGFsCj4gMkcKPiA+ID4gUkFNKS4KPiA+ID4gPgo+ID4gPiA+IEFm dGVyIEkgc3RvcCB0aGUgcHJvZ3JhbSwgdGhlIHVzZWQgbWVtb3J5IGRpZCBub3QgZnJlZS4KPiA+ ID4KPiA+ID4gVW1tbW0uICBXaGF0IGV4YWN0bHkgZG8geW91IG1lYW4/ICBDYW4gd2Ugc2VlIHRo ZSBvdXRwdXQgb2YgdG9wIGFuZCAvIG9yCj4gPiA+IGZyZWU/ICBJJ20gZ3Vlc3NpbmcgdGhhdCB3 aGF0IFRvbSBzYWlkIGlzIHJpZ2h0LCB5b3UncmUganVzdCBzZWVpbmcgYQo+ID4gPiBub3JtYWwg c3RhdGUgb2YgaG93IHVuaXggZG9lcyB0aGluZ3MuCj4gPiA+Cj4gPiA+IElmIHlvdXIgb3V0cHV0 IG9mIGZyZWUgbG9va3MgbGlrZSB0aGlzOgo+ID4gPgo+ID4gPiAtYmFzaC0yLjA1YiQgZnJlZQo+ ID4gPiAgICAgICB0b3RhbCAgICAgICB1c2VkICAgICAgIGZyZWUgICAgIHNoYXJlZCAgICBidWZm ZXJzICAgICBjYWNoZWQKPiA+ID4gTWVtOjYwOTY5MTIgICAgNjA2OTU4OCAgICAgIDI3MzI0ICAg ICAgICAgIDAgICAgIDI2MDcyOCAgICA1NTQ3MjY0Cj4gPiA+IC0vKyBidWZmZXJzL2NhY2hlOiAg ICAgMjYxNTk2ICAgIDU4MzUzMTYKPiA+ID4gU3dhcDogICAgICA0MTkyODgwICAgICAgMTYzMjAg ICAgNDE3NjU2MAo+ID4gPgo+ID4gPiBUaGVuIHRoYXQncyBub3JtYWwuCj4gPiA+Cj4gPiA+IFRo YXQncyB0aGUgb3V0cHV0IG9mIGZyZWUgb24gYSBtYWNoaW5lIHdpdGggNiBnaWdzIHRoYXQgcnVu cyBhIHJlcG9ydGluZwo+ID4gPiBkYXRhYmFzZS4gIE5vdGUgdGhhdCB3aGlsZSBpdCBzaG93cyBh bG1vc3QgQUxMIHRoZSBtZW1vcnkgYXMgdXNlZCwgaXQgaXMKPiA+ID4gYmVpbmcgdXNlZCBieSB0 aGUga2VybmVsLCB3aGljaCBpcyBhIGdvb2QgdGhpbmcuICBOb3RlIHRoYXQgNTU0NzI2NCBvcgo+ ID4gPiBhYm91dCA5MCUgb2YgbWVtb3J5IGlzIGJlaW5nIHVzZWQgYXMga2VybmVsIGNhY2hlLiAg VGhhdCdzIGEgZ29vZCB0aGluZy4KPiA+ID4KPiA+ID4gTm90ZSB5b3UgY2FuIGFsc28gZ2V0IHlv dXJzZWxmIGluIHRyb3VibGUgd2l0aCB0b3AuICBJdCdzIG5vdCB1bmNvbW1vbgo+ID4gPiBmb3Ig c29tZW9uZSB0byBzZWUgYSBidW5jaCBvZiBwb3N0Z3JlcyBwcm9jZXNzZXMgZWFjaCBlYXRpbmcg dXAgNTAgb3IKPiA+ID4gbW9yZSBtZWdzIG9mIHJhbSwgYW5kIHBhbmljIGFuZCB0aGluayB0aGF0 IHRoZXkncmUgcnVubmluZyBvdXQgb2YKPiA+ID4gbWVtb3J5LCB3aGVuLCBpbiBmYWN0LCA0NCBt ZWcgZm9yIGVhY2ggb2YgdGhvc2UgcHJvY2Vzc2VzIGlzIHNoYXJlZCwgYW5kCj4gPiA+IHRoZSBy ZWFsIHVzYWdlIHBlciBiYWNrZW5kIGlzIDYgbWVncyBvciBsZXNzLgo+ID4gPgo+ID4gPiBEZWZp bml0ZWx5IGdyYWIgeW91cnNlbGYgYSBnb29kIHVuaXggLyBsaW51eCBzeXNhZG1pbiBndWlkZS4g IFRoZSAiaW4gYQo+ID4gPiBudXRzaGVsbCIgYm9va3MgZnJvbSBPJ1JlaWxsZXkgKHNwPykgYXJl IGEgZ29vZCBzdGFydGluZyBwb2ludC4KPiA+ID4KPiA+Cj4gPgo+ID4gLS0KPiA+IEthdGh5IExv Cj4KCgotLQpLYXRoeSBMbwo= From pgsql-performance-owner@postgresql.org Wed Dec 7 23:21:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ABDE99DD75F for ; Wed, 7 Dec 2005 23:21:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04049-09 for ; Wed, 7 Dec 2005 23:21:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 1C0AD9DD755 for ; Wed, 7 Dec 2005 23:01:38 -0400 (AST) Received: from mxsf07.cluster1.charter.net (mxsf07.cluster1.charter.net [209.225.28.207]) by svr2.postgresql.org (Postfix) with ESMTP id 646BFF0B52 for ; Thu, 8 Dec 2005 02:47:31 +0000 (GMT) Received: from mxip06a.cluster1.charter.net (mxip06a.cluster1.charter.net [209.225.28.136]) by mxsf07.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id jB82lSSe004515 for ; Wed, 7 Dec 2005 21:47:28 -0500 Received: from 68-118-182-213.dhcp.nwtn.ct.charter.com (HELO [192.168.116.102]) ([68.118.182.213]) by mxip06a.cluster1.charter.net with ESMTP; 07 Dec 2005 21:47:28 -0500 X-IronPort-AV: i="3.99,227,1131339600"; d="scan'208"; a="1717985552:sNHT16281768" Message-ID: <43979EC0.1060400@NarrowPathInc.com> Date: Wed, 07 Dec 2005 21:47:28 -0500 From: Keith Worthington Reply-To: KeithW@NarrowPathInc.com Organization: Narrow Path, Inc. User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Perform Subject: view of view 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, score=1.11 required=5 tests=[AWL=-0.222, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.11 X-Spam-Level: * X-Archive-Number: 200512/237 X-Sequence-Number: 16058 Hi All, I am working on an application that uses PostgreSQL. One of the functions of the application is to generate reports. In order to keep the code in the application simple we create a view of the required data in the database and then simply execute a SELECT * FROM view_of_the_data; All of the manipulation and most of the time even the ordering is handled in the view. My question is how much if any performance degradation is there in creating a view of a view? IOW if I have a view that ties together a couple of tables and manipulates some data what will perform better; a view that filters, manipulates, and orders the data from the first view or a view that performs all the necessary calculations on the original tables? -- Kind Regards, Keith From pgsql-general-owner@postgresql.org Wed Dec 7 23:46:08 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 509929DCD16 for ; Wed, 7 Dec 2005 23:46:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79101-09 for ; Wed, 7 Dec 2005 23:46:08 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by postgresql.org (Postfix) with ESMTP id 445CC9DCB56 for ; Wed, 7 Dec 2005 23:46:00 -0400 (AST) Received: by zproxy.gmail.com with SMTP id l8so524795nzf for ; Wed, 07 Dec 2005 19:46:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=US1gs2OfdyUAmPaqF2rpGBfKgztl9X33vmCaCx6SdrTX/X90clkeFiMaaQ2ai2y1JsaUIoYtL6TigLtODE96jyDRNrfPhcz2tXYn3wYzwaZyCzUJwRatx8im7RH+3cNT+UB94WCkATBEclwJCtHAH+bu1tMM77hQKE8uK0PpcnQ= Received: by 10.64.241.5 with SMTP id o5mr2505995qbh; Wed, 07 Dec 2005 19:46:02 -0800 (PST) Received: by 10.65.235.2 with HTTP; Wed, 7 Dec 2005 19:46:02 -0800 (PST) Message-ID: Date: Thu, 8 Dec 2005 03:46:02 +0000 From: Mike Rylander To: pgsql general Subject: Re: Memory Leakage Problem In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/419 X-Sequence-Number: 87982 On 12/8/05, Kathy Lo wrote: [snip] > When the user complains the system becomes very slow, I use top to > view the memory statistics. > In top, I cannot find any processes that use so many memory. I just > found that all the memory was used up and the Swap memory nearly used > up. Not to add fuel to the fire, but I'm seeing something similar to this on my 4xOpteron with 32GB of RAM running Pg 8.1RC1 on Linux (kernel 2.6.12). I don't see this happening on a similar box with 16GB of RAM running Pg 8.0.3. This is a lightly used box (until it goes into production), so it's not "out of memory", but the memory usage is climbing without any obvious culprit. To cut to the chase, here are some numbers for everyone to digest: total gnu ps resident size # ps ax -o rss|perl -e '$x +=3D $_ for (<>);print "$x\n";' 5810492 total gnu ps virual size # ps ax -o vsz|perl -e '$x +=3D $_ for (<>);print "$x\n";' 10585400 total gnu ps "if all pages were dirtied and swapped" size # ps ax -o size|perl -e '$x +=3D $_ for (<>);print "$x\n";' 1970952 ipcs -m # ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x0052e2c1 1802240 postgres 600 176054272 26 (that's the entire ipcs -m output) and the odd man out, free # free total used free shared buffers cached Mem: 32752268 22498448 10253820 0 329776 8289360 -/+ buffers/cache: 13879312 18872956 Swap: 31248712 136 31248576 I guess dstat is getting it's info from the same source as free, because: # dstat -m 1 ------memory-usage----- _used _buff _cach _free 13G 322M 8095M 9.8G Now, I'm not blaming Pg for the apparent discrepancy in calculated vs. reported-by-free memory usage, but I only noticed this after upgrading to 8.1. I'll collect any more info that anyone would like to see, just let me know. If anyone has any ideas on what is actually happening here I'd love to hear them! -- Mike Rylander mrylander@gmail.com GPLS -- PINES Development Database Developer http://open-ils.org From pgsql-general-owner@postgresql.org Thu Dec 8 00:38:58 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1E54E9DCD82 for ; Thu, 8 Dec 2005 00:38:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69796-05 for ; Thu, 8 Dec 2005 00:38:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E02D79DCD16 for ; Thu, 8 Dec 2005 00:38:54 -0400 (AST) 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 jB84crlN006354; Wed, 7 Dec 2005 23:38:53 -0500 (EST) To: Mike Rylander cc: pgsql general Subject: Re: Memory Leakage Problem In-reply-to: References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> Comments: In-reply-to Mike Rylander message dated "Thu, 08 Dec 2005 03:46:02 +0000" Date: Wed, 07 Dec 2005 23:38:53 -0500 Message-ID: <6353.1134016733@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/424 X-Sequence-Number: 87987 Mike Rylander writes: > To cut to the chase, here are > some numbers for everyone to digest: > total gnu ps resident size > # ps ax -o rss|perl -e '$x += $_ for (<>);print "$x\n";' > 5810492 > total gnu ps virual size > # ps ax -o vsz|perl -e '$x += $_ for (<>);print "$x\n";' > 10585400 > total gnu ps "if all pages were dirtied and swapped" size > # ps ax -o size|perl -e '$x += $_ for (<>);print "$x\n";' > 1970952 I wouldn't put any faith in those numbers at all, because you'll be counting the PG shared memory multiple times. On the Linux versions I've used lately, ps and top report a process' memory size as including all its private memory, plus all the pages of shared memory that it has touched since it started. So if you run say a seqscan over a large table in a freshly-started backend, the reported memory usage will ramp up from a couple meg to the size of your shared_buffer arena plus a couple meg --- but in reality the space used by the process is staying constant at a couple meg. Now, multiply that effect by N backends doing this at once, and you'll have a very skewed view of what's happening in your system. I'd trust the totals reported by free and dstat a lot more than summing per-process numbers from ps or top. > Now, I'm not blaming Pg for the apparent discrepancy in calculated vs. > reported-by-free memory usage, but I only noticed this after upgrading > to 8.1. I don't know of any reason to think that 8.1 would act differently from older PG versions in this respect. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 8 04:36:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8504C9DCAD7 for ; Thu, 8 Dec 2005 04:36:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59664-01 for ; Thu, 8 Dec 2005 04:36:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by postgresql.org (Postfix) with ESMTP id 7474C9DCAA6 for ; Thu, 8 Dec 2005 04:36:45 -0400 (AST) Received: from [80.142.65.56] (helo=swtexchange2.technology.de) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1EkHGe39Co-0008GK; Thu, 08 Dec 2005 09:36:45 +0100 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5FBD2.84AF3128" Subject: INSERTs becoming slower and slower X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0 Date: Thu, 8 Dec 2005 09:36:43 +0100 Message-ID: <16F953410A0F1346848DCB476A989CFE34DA@swtexchange2.technology.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: INSERTs becoming slower and slower Thread-Index: AcX70oSo3bV9cHG6To6DKgMh/25neA== From: =?iso-8859-1?Q?N=F6rder-Tuitje=2C_Marcus?= To: X-Provags-ID: kundenserver.de abuse@kundenserver.de login:24478085a861b01e05bdc3b8f80dc176 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.257 required=5 tests=[HTML_FONT_BIG=0.256, HTML_MESSAGE=0.001, UPPERCASE_25_50=0] X-Spam-Score: 0.257 X-Spam-Level: X-Archive-Number: 200512/238 X-Sequence-Number: 16059 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5FBD2.84AF3128 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am breaking up huge texts (between 25K and 250K words) into single = words using PgPlsql. For this I am using a temp table in the first step : LOOP=09 vLeft :=3D vRight; vTmp :=3D vLeft; =09 LOOP vChr :=3D SUBSTRING ( pText FROM vTmp FOR 1); vTmp :=3D vTmp + 1; EXIT WHEN (vChr =3D ' ' OR vChr IS NULL OR vTmp =3D cBorder); END LOOP; =09 vRight :=3D vTmp; =09 vLit :=3D SUBSTRING(pText FROM vLeft FOR (vRight - vLeft - 1)); IF (LENGTH(vLit) > 0) THEN WRDCNT :=3D WRDCNT +1; INSERT INTO DEX_TEMPDOC(TMP_DOO_ID , TMP_SEQ_ID , TMP_RAWTEXT) VALUES (pDOO_ID , I , vLIT );=09 END IF; =09 I :=3D I + 1; vTmp :=3D LENGTH(vLIT); =09 IF ((WRDCNT % 100) =3D 0) THEN PROGRESS =3D ROUND((100 * I) / DOCLEN,0);=20 RAISE NOTICE '[PROC] % WORDS -- LAST LIT % (Len %) [% PCT / % of %]', = WRDCNT, vLIT, vTMP, PROGRESS, I, DOCLEN; END IF; =09 =09 EXIT WHEN vRight >=3D cBorder; END LOOP; The doc is preprocessed, between each word only a single blank can be. My problem is : The first 25K words are quite quick, but the insert = become slower and slower. starting with 1K words per sec I end up with = 100 words in 10 sec (when I reach 80K-100K words) the only (nonunique index) on tempdoc is on RAWTEXT. What can I do ? Should I drop the index ? Here is my config: shared_buffers =3D 2000 # min 16, at least max_connections*2, = 8KB each work_mem =3D 32768 # min 64, size in KB maintenance_work_mem =3D 16384 # min 1024, size in KB max_stack_depth =3D 8192 # min 100, size in KB enable_hashagg =3D true enable_hashjoin =3D true enable_indexscan =3D true enable_mergejoin =3D true enable_nestloop =3D true enable_seqscan =3D false The machine is a XEON 3GHz, 1GB RAM, SATA RAID 1 Array running 8.0.4 = i686 precompiled Thanks ! Mit freundlichen Gr=FC=DFen=20 Dipl.Inform.Marcus Noerder-Tuitje Entwickler software technology AG Kortumstra=DFe 16 =20 44787 Bochum Tel: 0234 / 52 99 6 26 Fax: 0234 / 52 99 6 22 E-Mail: noerder-tuitje@technology.de =20 Internet: www.technology.de=20 ------_=_NextPart_001_01C5FBD2.84AF3128 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable INSERTs becoming slower and slower

Hi,

I am breaking up huge texts (between = 25K and 250K words) into single words using PgPlsql.

For this I am using a temp table in the = first step :

        LOOP   

        =         vLeft   :=3D vRight;
        =         vTmp    :=3D vLeft;
        =        =20
        =         LOOP
        =         =         vChr :=3D SUBSTRING ( pText FROM vTmp FOR 1);
        =         =         vTmp :=3D vTmp + 1;
        =         =         EXIT WHEN (vChr =3D ' ' OR vChr IS NULL OR vTmp =3D = cBorder);
        =         END LOOP;
        =         =        =20
        =         vRight  :=3D vTmp;
        =        =20
        =         vLit    :=3D SUBSTRING(pText FROM vLeft = FOR (vRight - vLeft - 1));

        =         IF (LENGTH(vLit) > 0) THEN
        =         =         WRDCNT :=3D WRDCNT +1;
        =         =         INSERT INTO DEX_TEMPDOC(TMP_DOO_ID
        =         =         =         =         =         ,       TMP_SEQ_ID
        =         =         =         =         =         ,       = TMP_RAWTEXT)
        =         =         VALUES          =    (pDOO_ID
        =         =         =         =         =         ,       I
        =         =         =         =         =         ,       vLIT
        =         =         =         =         =             ); 
        =         END IF;
        =        =20
        =         I :=3D I + 1;
        =         vTmp :=3D LENGTH(vLIT);

        =        =20
        =         IF ((WRDCNT % 100) =3D 0) THEN
        =         =         PROGRESS =3D ROUND((100 * I) / DOCLEN,0);
        =         =         RAISE NOTICE '[PROC] % WORDS -- LAST LIT % (Len %) [% = PCT / % of %]', WRDCNT, vLIT, vTMP, PROGRESS, I, DOCLEN;

        =         END IF;
        =         =        =20
        =        =20
        =         EXIT WHEN vRight >=3D cBorder;
        END LOOP;


The doc is preprocessed, between each = word only a single blank can be.

My problem is : The first 25K words are = quite quick, but  the insert become slower and slower. starting = with 1K words per sec I end up with 100 words in 10 sec (when I reach = 80K-100K words)

the only (nonunique index) on tempdoc = is on RAWTEXT.

What can I do ? Should I drop the index = ?

Here is my config:

shared_buffers =3D = 2000           # min = 16, at least max_connections*2, 8KB each
work_mem =3D = 32768           &n= bsp;    # min 64, size in KB
maintenance_work_mem =3D = 16384    # min 1024, size in KB
max_stack_depth =3D = 8192          # min 100, = size in KB

enable_hashagg =3D true
enable_hashjoin =3D true
enable_indexscan =3D true
enable_mergejoin =3D true
enable_nestloop =3D true
enable_seqscan =3D false

The machine is a XEON 3GHz, 1GB RAM, = SATA RAID 1 Array running 8.0.4 i686 precompiled


Thanks !



Mit freundlichen Gr=FC=DFen
Dipl.Inform.Marcus Noerder-Tuitje
Entwickler

software technology AG
Kortumstra=DFe = 16  
44787 = Bochum
Tel:  0234 = / 52 99 6 26
Fax: 0234 / 52 = 99 6 22
E-Mail:   noerder-tuitje@technology.de  =
Internet: = www.technology.de


------_=_NextPart_001_01C5FBD2.84AF3128-- From pgsql-performance-owner@postgresql.org Thu Dec 8 04:40:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0E3B99DCAD7 for ; Thu, 8 Dec 2005 04:40:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56681-07 for ; Thu, 8 Dec 2005 04:40:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id 38EF89DCAA6 for ; Thu, 8 Dec 2005 04:40:06 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 9B02625077; Thu, 8 Dec 2005 16:39:56 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id A29C925070; Thu, 8 Dec 2005 16:39:53 +0800 (WST) Message-ID: <4397F253.4030401@familyhealth.com.au> Date: Thu, 08 Dec 2005 16:44:03 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcus Cc: pgsql-performance@postgresql.org Subject: Re: INSERTs becoming slower and slower References: <16F953410A0F1346848DCB476A989CFE34DA@swtexchange2.technology.de> In-Reply-To: <16F953410A0F1346848DCB476A989CFE34DA@swtexchange2.technology.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.058 required=5 tests=[AWL=0.058, UPPERCASE_25_50=0] X-Spam-Score: 0.058 X-Spam-Level: X-Archive-Number: 200512/239 X-Sequence-Number: 16060 You might find it faster to install contrib/tsearch2 for text indexing sort of purposes... N�rder-Tuitje wrote: > > > Hi, > > I am breaking up huge texts (between 25K and 250K words) into single > words using PgPlsql. > > For this I am using a temp table in the first step : > > LOOP > > vLeft := vRight; > vTmp := vLeft; > > LOOP > vChr := SUBSTRING ( pText FROM vTmp FOR 1); > vTmp := vTmp + 1; > EXIT WHEN (vChr = ' ' OR vChr IS NULL OR vTmp = > cBorder); > END LOOP; > > vRight := vTmp; > > vLit := SUBSTRING(pText FROM vLeft FOR (vRight - > vLeft - 1)); > > IF (LENGTH(vLit) > 0) THEN > WRDCNT := WRDCNT +1; > INSERT INTO DEX_TEMPDOC(TMP_DOO_ID > , TMP_SEQ_ID > , TMP_RAWTEXT) > VALUES (pDOO_ID > , I > , vLIT > ); > END IF; > > I := I + 1; > vTmp := LENGTH(vLIT); > > > IF ((WRDCNT % 100) = 0) THEN > PROGRESS = ROUND((100 * I) / DOCLEN,0); > RAISE NOTICE '[PROC] % WORDS -- LAST LIT % (Len > %) [% PCT / % of %]', WRDCNT, vLIT, vTMP, PROGRESS, I, DOCLEN; > > END IF; > > > EXIT WHEN vRight >= cBorder; > END LOOP; > > > The doc is preprocessed, between each word only a single blank can be. > > My problem is : The first 25K words are quite quick, but the insert > become slower and slower. starting with 1K words per sec I end up with > 100 words in 10 sec (when I reach 80K-100K words) > > the only (nonunique index) on tempdoc is on RAWTEXT. > > What can I do ? Should I drop the index ? > > Here is my config: > > shared_buffers = 2000 # min 16, at least max_connections*2, > 8KB each > work_mem = 32768 # min 64, size in KB > maintenance_work_mem = 16384 # min 1024, size in KB > max_stack_depth = 8192 # min 100, size in KB > > enable_hashagg = true > enable_hashjoin = true > enable_indexscan = true > enable_mergejoin = true > enable_nestloop = true > enable_seqscan = false > > The machine is a XEON 3GHz, 1GB RAM, SATA RAID 1 Array running 8.0.4 > i686 precompiled > > > Thanks ! > > > > Mit freundlichen Gr��en > *Dipl.Inform.Marcus Noerder-Tuitje > **Entwickler > * > software technology AG > *Kortumstra�e 16 * > *44787 Bochum* > *Tel: 0234 / 52 99 6 26* > *Fax: 0234 / 52 99 6 22* > *E-Mail: noerder-tuitje@technology.de * > *Internet: www.technology.de * > > From pgsql-performance-owner@postgresql.org Thu Dec 8 10:07:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DA5C99DCC64 for ; Thu, 8 Dec 2005 10:07:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39410-05 for ; Thu, 8 Dec 2005 10:07:18 -0400 (AST) X-Greylist: delayed 03:06:50.760839 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id C090F9DCBC7 for ; Thu, 8 Dec 2005 10:07:10 -0400 (AST) Received: from fe-6c.inet.it (fe-6c.inet.it [213.92.5.112]) by svr2.postgresql.org (Postfix) with ESMTP id 251D5F0B41 for ; Thu, 8 Dec 2005 11:00:22 +0000 (GMT) Received: from 81-174-8-43.f5.ngi.it ([::ffff:81.174.8.43]) by fe-6c.inet.it via I-SMTP-5.2.3-521 id ::ffff:81.174.8.43+R0nd8Ks8mRYGS; Thu, 08 Dec 2005 11:59:58 +0100 Message-ID: <43981225.80600@beccati.com> Date: Thu, 08 Dec 2005 11:59:49 +0100 From: Matteo Beccati User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: Marcus , pgsql-performance@postgresql.org Subject: Re: INSERTs becoming slower and slower References: <16F953410A0F1346848DCB476A989CFE34DA@swtexchange2.technology.de> <4397F253.4030401@familyhealth.com.au> In-Reply-To: <4397F253.4030401@familyhealth.com.au> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/244 X-Sequence-Number: 16065 Christopher Kings-Lynne wrote: > You might find it faster to install contrib/tsearch2 for text indexing > sort of purposes... > > N�rder-Tuitje wrote: >> Here is my config: >> >> shared_buffers = 2000 # min 16, at least max_connections*2, >> 8KB each >> work_mem = 32768 # min 64, size in KB >> maintenance_work_mem = 16384 # min 1024, size in KB >> max_stack_depth = 8192 # min 100, size in KB >> >> enable_hashagg = true >> enable_hashjoin = true >> enable_indexscan = true >> enable_mergejoin = true >> enable_nestloop = true >> enable_seqscan = false >> >> The machine is a XEON 3GHz, 1GB RAM, SATA RAID 1 Array running 8.0.4 >> i686 precompiled Also, shared_buffers (server-wide) are low, compared to a high work_mem (32M for each sort operation, but this also depends on your concurrency level). And disabling sequential scans in your postgresql.conf would probabily lead to sub-optimal plans in many queries. Best regards -- Matteo Beccati http://phpadsnew.com http://phppgads.com From pgsql-performance-owner@postgresql.org Sun Dec 11 14:51:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DDEE59DCAAE for ; Thu, 8 Dec 2005 10:40:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28381-07 for ; Thu, 8 Dec 2005 10:40:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 7909B9DCBC7 for ; Thu, 8 Dec 2005 10:40:32 -0400 (AST) Received: from mail.exie.no (132.80-203-174.nextgentel.com [80.203.174.132]) by svr2.postgresql.org (Postfix) with ESMTP id 66303F0BC7 for ; Thu, 8 Dec 2005 11:26:58 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5FBEA.4A956BD8" Subject: Should Oracle outperform PostgreSQL on a complex multidimensional query? X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Date: Thu, 8 Dec 2005 12:26:55 +0100 Message-ID: <43D5D5C1F10C384B9AB4AE34A0510EC12B2B66@e1.exie.no> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Should Oracle outperform PostgreSQL on a complex multidimensional query? Thread-Index: AcX76ks0M7ht9LVDRK2tRVq5kQ9ZKA== From: =?iso-8859-1?Q?P=E5l_Stenslet?= To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/279 X-Sequence-Number: 16100 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5FBEA.4A956BD8 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I'm currently benchmarking several RDBMSs with respect to analytical = query performance on medium-sized multidimensional data sets. The data = set contains 30,000,000 fact rows evenly distributed in a = multidimensional space of 9 hierarchical dimensions. Each dimension has = 8000 members. =20 The test query selects about one half of the members from each = dimension, and calculates fact sums grouped by 5 high-level members from = each dimensional hierarchy. (There are actually some additional = complications that makes the query end up listing 20 table aliases in = the from-clause, 18 of which are aliases for 2 physical tables.) =20 On Oracle the query runs in less than 3 seconds. All steps have been = taken to ensure that Oracle will apply star schema optimization to the = query (e.g. having loads of single-column bitmap indexes). The query = plan reveals that a bitmap merge takes place before fact lookup. =20 There's a lot of RAM available, and series of queries have been run in = advance to make sure the required data resides in the cache. This is = confirmed by a very high CPU utilization and virtually no I/O during the = query execution. =20 I have established similar conditions for the query in PostgreSQL, and = it runs in about 30 seconds. Again the CPU utilization is high with no = noticable I/O. The query plan is of course very different from that of = Oracle, since PostgreSQL lacks the bitmap index merge operation. It = narrows down the result one dimension at a time, using the single-column = indexes provided. It is not an option for us to provide multi-column = indexes tailored to the specific query, since we want full freedom as to = which dimensions each query will use. =20 Are these the results we should expect when comparing PostgreSQL to = Oracle for such queries, or are there special optimization options for = PostgreSQL that we may have overlooked? (I wouldn't be suprised if there = are, since I spent at least 2 full days trying to trigger the star = optimization magic in my Oracle installation.) ------_=_NextPart_001_01C5FBEA.4A956BD8 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

I'm currently benchmarking several RDBMSs with = respect to analytical query performance on medium-sized multidimensional data sets. = The data set contains 30,000,000 fact rows evenly distributed in a = multidimensional space of 9 hierarchical dimensions. Each dimension has 8000 = members.

 

The test query selects about one half of the members = from each dimension, and calculates fact sums grouped by 5 high-level members = from each dimensional hierarchy. (There are actually some additional = complications that makes the query end up listing 20 table aliases in the from-clause, = 18 of which are aliases for 2 physical tables.)

 

On Oracle the query runs in less than 3 seconds. All = steps have been taken to ensure that Oracle will apply star schema = optimization to the query (e.g. having loads of single-column bitmap indexes). The query = plan reveals that a bitmap merge takes place before fact = lookup.

 

There's a lot of RAM available, and series of queries = have been run in advance to make sure the required data resides in the cache. = This is confirmed by a very high CPU utilization and virtually no I/O during = the query execution.

 

I have established similar conditions for the query = in PostgreSQL, and it runs in about 30 seconds. Again the CPU utilization = is high with no noticable I/O. The query plan is of course very different from = that of Oracle, since PostgreSQL lacks the bitmap index merge operation. It = narrows down the result one dimension at a time, using the single-column indexes provided. It is not an option for us to provide multi-column indexes = tailored to the specific query, since we want full freedom as to which dimensions = each query will use.

 

Are these the results we should expect when comparing PostgreSQL to Oracle for such queries, or are there special optimization = options for PostgreSQL that we may have overlooked? (I wouldn't be suprised if = there are, since I spent at least 2 full days trying to trigger the star = optimization magic in my Oracle installation.)

------_=_NextPart_001_01C5FBEA.4A956BD8-- From pgsql-performance-owner@postgresql.org Thu Dec 8 07:30:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 193449DCB6C for ; Thu, 8 Dec 2005 07:30:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92237-04 for ; Thu, 8 Dec 2005 07:30:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by postgresql.org (Postfix) with ESMTP id 689759DCB64 for ; Thu, 8 Dec 2005 07:29:59 -0400 (AST) Received: from host-83-146-33-145.bulldogdsl.com ([83.146.33.145] helo=orchard) by localhost.localdomain with esmtpa (Exim 4.54) id 1EkJyU-0000vc-8d; Thu, 08 Dec 2005 11:30:11 +0000 Received: from rory by orchard with local (Exim 4.54) id 1EkJx3-0004yZ-RQ; Thu, 08 Dec 2005 11:28:41 +0000 Date: Thu, 8 Dec 2005 11:28:41 +0000 From: Rory Campbell-Lange To: Alex Turner , pgsql-performance@postgresql.org Subject: Re: LVM and Postgres Message-ID: <20051208112841.GA17840@campbell-lange.net> References: <20051206093818.GE6708@campbell-lange.net> <20051206213623.GD14427@campbell-lange.net> <20051207002537.GN7330@mathom.us> <33c6269f0512061652u73a690t8af8a276118b1a83@mail.gmail.com> <20051207013107.GP7330@mathom.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051207013107.GP7330@mathom.us> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.444 required=5 tests=[AWL=0.444] X-Spam-Score: 0.444 X-Spam-Level: X-Archive-Number: 200512/240 X-Sequence-Number: 16061 On 06/12/05, Michael Stone (mstone+postgres@mathom.us) wrote: > On Tue, Dec 06, 2005 at 07:52:25PM -0500, Alex Turner wrote: > >I would argue that almost certainly won't by doing that as you will > >create a new place even further away for the disk head to seek to > >instead of just another file on the same FS that is probably closer to > >the current head position. > > I would argue that you should benchmark it instead of speculating. Is there a good way of benchmarking? We don't have much in the way of test data at present. Regards, Rory -- Rory Campbell-Lange From pgsql-performance-owner@postgresql.org Thu Dec 8 08:14:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ACD859DCB0D for ; Thu, 8 Dec 2005 08:14:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79817-02 for ; Thu, 8 Dec 2005 08:14:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by postgresql.org (Postfix) with ESMTP id 1B5019DCAD7 for ; Thu, 8 Dec 2005 08:14:13 -0400 (AST) Received: from host-83-146-33-145.bulldogdsl.com ([83.146.33.145] helo=orchard) by localhost.localdomain with esmtpa (Exim 4.54) id 1EkKfK-00017P-Mc for pgsql-performance@postgresql.org; Thu, 08 Dec 2005 12:14:27 +0000 Received: from rory by orchard with local (Exim 4.54) id 1EkKdv-00025y-TI for pgsql-performance@postgresql.org; Thu, 08 Dec 2005 12:12:59 +0000 Date: Thu, 8 Dec 2005 12:12:59 +0000 From: Rory Campbell-Lange To: pgsql-performance@postgresql.org Subject: Disk tests for a new database server Message-ID: <20051208121259.GA29104@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.333 required=5 tests=[AWL=0.333] X-Spam-Score: 0.333 X-Spam-Level: X-Archive-Number: 200512/241 X-Sequence-Number: 16062 We are testing disk I/O on our new server (referred to in my recent questions about LVM and XFS on this list) and have run bonnie++ on the xfs partition destined for postgres; results noted below. I haven't been able to find many benchmarks showing desirable IO stats. As far as I can tell the sequential input (around 110000K/sec) looks good while the sequential output (around 50000K/sec) looks fairly average. Advice and comments gratefully received. Suggested Parameters for running pg_bench would be great! Thanks, Rory The server has a dual core AMD Opteron 270 chip (2000MHz), 6GB of RAM and an LSI 320-1 card running 4x147GB disks running in a RAID10 configuration. The server has a freshly compiled 2.6.14.3 linux kernel. partial df output: Filesystem Size Used Avail Use% Mounted on ... /dev/mapper/masvg-masdata 99G 33M 94G 1% /masdata /dev/mapper/masvg-postgres 40G 92M 40G 1% /postgres partial fstab config: ... /dev/mapper/masvg-masdata /masdata ext3 defaults 0 2 /dev/mapper/masvg-postgres /postgres xfs defaults 0 2 Version 1.03 ------Sequential Output------ --Sequential Input- --Random- -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP mas 13000M 52655 99 52951 10 32246 7 41441 72 113438 12 590.0 0 mas 13000M 49306 83 51967 9 32269 7 42442 70 115427 12 590.5 1 mas 13000M 53449 89 51982 10 32625 7 42819 71 111829 11 638.3 0 mas 13000M 51818 88 51639 9 33127 7 42377 70 108585 11 556.5 0 mas 13000M 48930 90 51750 9 32854 7 41220 71 109813 11 566.2 0 mas 13000M 52148 88 47393 9 35343 7 42871 70 109775 12 582.0 0 mas 13000M 52427 88 53040 10 32315 7 42813 71 112045 12 596.7 0 mas 13000M 51967 87 54004 10 30429 7 46180 76 110973 11 625.1 0 mas 13000M 48690 89 46416 9 35678 7 41429 72 111612 11 627.2 0 mas 13000M 52641 88 52807 10 31115 7 43476 72 110694 11 568.2 0 mas 13000M 52186 88 47385 9 35341 7 42959 72 110963 11 558.7 0 mas 13000M 52092 87 53111 10 32135 7 42636 69 110560 11 562.0 1 mas 13000M 49445 90 47378 9 34410 7 41191 72 110736 11 610.3 0 mas 13000M 51704 88 47699 9 35436 7 42413 69 110446 11 612.0 0 mas 13000M 52434 88 53331 10 32479 7 43229 71 109385 11 620.6 0 mas 13000M 52074 89 53291 10 32095 7 43593 72 109541 11 628.0 0 mas 13000M 48084 88 52624 10 32301 7 40975 72 110548 11 594.0 0 mas 13000M 53019 90 52441 10 32411 7 42574 68 111321 11 578.0 0 ------Sequential Create------ --------Random Create-------- -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files:max:min /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP mas 16 7970 36 +++++ +++ 7534 34 7918 36 +++++ +++ 4482 22 mas 16 7945 33 +++++ +++ 7483 30 7918 42 +++++ +++ 4438 20 mas 16 8481 48 +++++ +++ 7468 31 7870 39 +++++ +++ 4385 23 mas 16 7915 36 +++++ +++ 7498 33 7930 41 +++++ +++ 4619 23 mas 16 8553 35 +++++ +++ 8312 38 8613 37 +++++ +++ 4513 24 mas 16 8498 40 +++++ +++ 8215 33 8570 43 +++++ +++ 4858 26 mas 16 7892 39 +++++ +++ 7624 30 5341 28 +++++ +++ 4762 22 mas 16 5408 27 +++++ +++ 9378 37 8573 41 +++++ +++ 4385 21 mas 16 5063 27 +++++ +++ 8656 38 5159 27 +++++ +++ 4705 24 mas 16 4917 25 +++++ +++ 8682 39 5282 28 +++++ +++ 4723 22 mas 16 5027 28 +++++ +++ 8538 36 5173 29 +++++ +++ 4719 23 mas 16 5449 27 +++++ +++ 8630 36 5266 28 +++++ +++ 5463 27 mas 16 5373 27 +++++ +++ 8658 37 5264 26 +++++ +++ 4731 22 mas 16 4959 24 +++++ +++ 9126 46 5160 26 +++++ +++ 4717 24 mas 16 5379 27 +++++ +++ 8620 40 5014 27 +++++ +++ 4701 21 mas 16 5312 29 +++++ +++ 8642 36 7862 42 +++++ +++ 4869 24 mas 16 5057 26 +++++ +++ 8566 36 5120 28 +++++ +++ 4681 21 mas 16 5225 27 +++++ +++ 8740 37 5205 28 +++++ +++ 4744 21 -- Rory Campbell-Lange From pgsql-performance-owner@postgresql.org Thu Dec 8 09:13:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A04BC9DCB65 for ; Thu, 8 Dec 2005 09:13:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39643-08 for ; Thu, 8 Dec 2005 09:13:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 16D359DCAD9 for ; Thu, 8 Dec 2005 09:13:04 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: Re: view of view Content-Transfer-Encoding: quoted-printable Date: Thu, 8 Dec 2005 08:13:01 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DDA8B@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] view of view thread-index: AcX7poK4xoZq1n6bTY2s+iqKJWGbkQAUW5vA From: "Merlin Moncure" To: Cc: "PostgreSQL Perform" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/242 X-Sequence-Number: 16063 > Hi All, >=20 > I am working on an application that uses PostgreSQL. One of the > functions of the application is to generate reports. In order to keep > the code in the application simple we create a view of the required data > in the database and then simply execute a SELECT * FROM > view_of_the_data; All of the manipulation and most of the time even the > ordering is handled in the view. >=20 > My question is how much if any performance degradation is there in > creating a view of a view? >=20 > IOW if I have a view that ties together a couple of tables and > manipulates some data what will perform better; a view that filters, > manipulates, and orders the data from the first view or a view that > performs all the necessary calculations on the original tables? very little, or a lot :). Clear as mud?=20 Views in pg are built with the rule system which basically just expands them into the source queries when it is time to execute them. In my experience, the time to expand the rule and generate the plan is trivial next to actually running the query. What you have to watch out for is if your plan is such that the lower view has to be fully materialized in order for the lower query to execute. For example if you do some string processing on a key expression, it obviously can no longer by used in an index expression. A real simple way to do the materialization test is to do a select * limit 1 from your view-on-view. If it runs quickly, you have no problems. By the way, I consider views on views to be a good indicator of a good design :). Merlin From pgsql-performance-owner@postgresql.org Thu Dec 8 09:46:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2DD6C9DCAD3 for ; Thu, 8 Dec 2005 09:46:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87261-05 for ; Thu, 8 Dec 2005 09:46:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from europa.cosmos.opusvl.com (europa.cosmos.opusvl.com [213.106.249.125]) by postgresql.org (Postfix) with ESMTP id 193A29DCAE0 for ; Thu, 8 Dec 2005 09:46:44 -0400 (AST) Received: from localhost.localdomain ([127.0.0.1]) by europa.cosmos.opusvl.com with esmtp (Exim 4.30) id 1EkM6f-00044R-N9; Thu, 08 Dec 2005 13:46:45 +0000 Message-ID: <43983945.9020706@opusvl.com> Date: Thu, 08 Dec 2005 13:46:45 +0000 From: Rich Doughty Organization: Opus VL User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: KeithW@NarrowPathInc.com CC: PostgreSQL Perform Subject: Re: view of view References: <43979EC0.1060400@NarrowPathInc.com> In-Reply-To: <43979EC0.1060400@NarrowPathInc.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, score=0.167 required=5 tests=[AWL=0.167] X-Spam-Score: 0.167 X-Spam-Level: X-Archive-Number: 200512/243 X-Sequence-Number: 16064 Keith Worthington wrote: > Hi All, > > I am working on an application that uses PostgreSQL. One of the > functions of the application is to generate reports. In order to keep > the code in the application simple we create a view of the required data > in the database and then simply execute a SELECT * FROM > view_of_the_data; All of the manipulation and most of the time even the > ordering is handled in the view. > > My question is how much if any performance degradation is there in > creating a view of a view? > > IOW if I have a view that ties together a couple of tables and > manipulates some data what will perform better; a view that filters, > manipulates, and orders the data from the first view or a view that > performs all the necessary calculations on the original tables? from personal experience, if the inner views contain outer joins performance isn't that great. -- - Rich Doughty From pgsql-general-owner@postgresql.org Thu Dec 8 10:00:08 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5F3819DCAE0 for ; Thu, 8 Dec 2005 10:00:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31578-03 for ; Thu, 8 Dec 2005 10:00:10 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by postgresql.org (Postfix) with ESMTP id 9F1699DCBA7 for ; Thu, 8 Dec 2005 10:00:04 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 9so610591nzo for ; Thu, 08 Dec 2005 06:00:06 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DEbmxml9cNTB3g9AGBMlSNvpMlrhJ5KBkn48BlbWtseHnJQD8+m+wRGE2sRwNOsz9z69/mgaTtRzlPpQ1Dq3cJ4s0kv7SG6uT8LSkZxtMsHGgMh/Sa+OGExjZ8oofdiCmXa5C3c7dFV0Z4L26TYKAKaGjNuQvJMjAnP331jHv2s= Received: by 10.64.185.2 with SMTP id i2mr2772806qbf; Thu, 08 Dec 2005 06:00:06 -0800 (PST) Received: by 10.65.235.2 with HTTP; Thu, 8 Dec 2005 06:00:06 -0800 (PST) Message-ID: Date: Thu, 8 Dec 2005 14:00:06 +0000 From: Mike Rylander To: Tom Lane Subject: Re: Memory Leakage Problem Cc: pgsql general In-Reply-To: <6353.1134016733@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: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/440 X-Sequence-Number: 88003 On 12/8/05, Tom Lane wrote: > Mike Rylander writes: > > To cut to the chase, here are > > some numbers for everyone to digest: > > total gnu ps resident size > > # ps ax -o rss|perl -e '$x +=3D $_ for (<>);print "$x\n";' > > 5810492 > > total gnu ps virual size > > # ps ax -o vsz|perl -e '$x +=3D $_ for (<>);print "$x\n";' > > 10585400 > > total gnu ps "if all pages were dirtied and swapped" size > > # ps ax -o size|perl -e '$x +=3D $_ for (<>);print "$x\n";' > > 1970952 > > I wouldn't put any faith in those numbers at all, because you'll be > counting the PG shared memory multiple times. > > On the Linux versions I've used lately, ps and top report a process' > memory size as including all its private memory, plus all the pages > of shared memory that it has touched since it started. So if you run > say a seqscan over a large table in a freshly-started backend, the > reported memory usage will ramp up from a couple meg to the size of > your shared_buffer arena plus a couple meg --- but in reality the > space used by the process is staying constant at a couple meg. Right, I can definitely see that happening. Some backends are upwards of 200M, some are just a few since they haven't been touched yet. > > Now, multiply that effect by N backends doing this at once, and you'll > have a very skewed view of what's happening in your system. Absolutely ... > > I'd trust the totals reported by free and dstat a lot more than summing > per-process numbers from ps or top. > And there's the part that's confusing me: the numbers for used memory produced by free and dstat, after subtracting the buffers/cache amounts, are /larger/ than those that ps and top report. (top says the same thing as ps, on the whole.) > > Now, I'm not blaming Pg for the apparent discrepancy in calculated vs. > > reported-by-free memory usage, but I only noticed this after upgrading > > to 8.1. > > I don't know of any reason to think that 8.1 would act differently from > older PG versions in this respect. > Neither can I, which is why I don't blame it. ;) I'm just reporting when/where I noticed the issue. > regards, tom lane > -- Mike Rylander mrylander@gmail.com GPLS -- PINES Development Database Developer http://open-ils.org From pgsql-performance-owner@postgresql.org Thu Dec 8 10:29:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B6CFB9DCAAF for ; Thu, 8 Dec 2005 10:29:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28672-02 for ; Thu, 8 Dec 2005 10:29:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailrelay.mobixell.com (unknown [62.219.168.154]) by postgresql.org (Postfix) with ESMTP id DE6D29DCAAE for ; Thu, 8 Dec 2005 10:28:56 -0400 (AST) Received: from mobiexc.mobixell.com (owa2000.mobixell.com [10.0.0.1]) by mailrelay.mobixell.com (8.12.11/8.12.11) with ESMTP id jB8EQe4q030222; Thu, 8 Dec 2005 16:26:41 +0200 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: Performance degradation after successive UPDATE's Date: Thu, 8 Dec 2005 16:29:14 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance degradation after successive UPDATE's Thread-Index: AcX7aOVjaPYDy+YOQUyN0x2EAkNX4QAmptKA From: "Assaf Yaari" To: "Bruno Wolff III" Cc: "Jan Wieck" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200512/245 X-Sequence-Number: 16066 I hope that this will demonstrate the problem and will give the needed information (global_content_id=3D90 is the record that was all the time updated): V-Mark=3D# UPDATE active_content_t SET ac_counter_mm4_outbound=3D100 = WHERE global_content_id=3D90; UPDATE 1 Time: 396.089 ms V-Mark=3D# UPDATE active_content_t SET ac_counter_mm4_outbound=3D100 = WHERE global_content_id=3D80; UPDATE 1 Time: 1.320 ms V-Mark=3D# EXPLAIN UPDATE active_content_t SET ac_counter_mm4_outbound=3D100 WHERE global_content_id=3D90; QUERY PLAN ------------------------------------------------------------------------ ------------------------ Index Scan using active_content_t_pkey on active_content_t (cost=3D0.00..5.50 rows=3D1 width=3D236) Index Cond: (global_content_id =3D 90) (2 rows) Time: 9.092 ms V-Mark=3D# EXPLAIN UPDATE active_content_t SET ac_counter_mm4_outbound=3D100 WHERE global_content_id=3D80; QUERY PLAN ------------------------------------------------------------------------ ------------------------ Index Scan using active_content_t_pkey on active_content_t (cost=3D0.00..5.50 rows=3D1 width=3D236) Index Cond: (global_content_id =3D 80) (2 rows) Time: 0.666 ms=20 > -----Original Message----- > From: Bruno Wolff III [mailto:bruno@wolff.to]=20 > Sent: Wednesday, December 07, 2005 10:05 PM > To: Assaf Yaari > Cc: Jan Wieck; pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Performance degradation after=20 > successive UPDATE's >=20 > On Wed, Dec 07, 2005 at 14:14:31 +0200, > Assaf Yaari wrote: > > Hi Jan, > >=20 > > As I'm novice with PostgreSQL, can you elaborate the term FSM and=20 > > settings recommendations? > http://developer.postgresql.org/docs/postgres/runtime-config-r > esource.html#RUNTIME-CONFIG-RESOURCE-FSM >=20 > > BTW: I'm issuing VACUUM ANALYZE every 15 minutes (using=20 > cron) and also=20 > > changes the setting of fsync to false in postgresql.conf but still=20 > > time seems to be growing. >=20 > You generally don't want fsync set to false. >=20 > > Also no other transactions are open. >=20 > Have you given us explain analyse samples yet? >=20 > >=20 > > Thanks, > > Assaf. > >=20 > > > -----Original Message----- > > > From: Jan Wieck [mailto:JanWieck@Yahoo.com] > > > Sent: Tuesday, December 06, 2005 2:35 PM > > > To: Assaf Yaari > > > Cc: Bruno Wolff III; pgsql-performance@postgresql.org > > > Subject: Re: [PERFORM] Performance degradation after successive=20 > > > UPDATE's > > >=20 > > > On 12/6/2005 4:08 AM, Assaf Yaari wrote: > > > > Thanks Bruno, > > > >=20 > > > > Issuing VACUUM FULL seems not to have influence on the time. > > > > I've added to my script VACUUM ANALYZE every 100 UPDATE's > > > and run the > > > > test again (on different record) and the time still increase. > > >=20 > > > I think he meant > > >=20 > > > - run VACUUM FULL once, > > > - adjust FSM settings to database size and turnover ratio > > > - run VACUUM ANALYZE more frequent from there on. > > >=20 > > >=20 > > > Jan > > >=20 > > > >=20 > > > > Any other ideas? > > > >=20 > > > > Thanks, > > > > Assaf.=20 > > > >=20 > > > >> -----Original Message----- > > > >> From: Bruno Wolff III [mailto:bruno@wolff.to] > > > >> Sent: Monday, December 05, 2005 10:36 PM > > > >> To: Assaf Yaari > > > >> Cc: pgsql-performance@postgresql.org > > > >> Subject: Re: Performance degradation after successive UPDATE's > > > >>=20 > > > >> On Mon, Dec 05, 2005 at 19:05:01 +0200, > > > >> Assaf Yaari wrote: > > > >> > Hi, > > > >> > =20 > > > >> > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. > > > >> > =20 > > > >> > My application updates counters in DB. I left a test > > > over the night > > > >> > that increased counter of specific record. After=20 > night running=20 > > > >> > (several hundreds of thousands updates), I found out > > > that the time > > > >> > spent on UPDATE increased to be more than 1.5 second (at > > > >> the beginning > > > >> > it was less than 10ms)! Issuing VACUUM ANALYZE and even > > > >> reboot didn't > > > >> > seemed to solve the problem. > > > >>=20 > > > >> You need to be running vacuum more often to get rid of the=20 > > > >> deleted rows (update is essentially insert + delete). Once you=20 > > > >> get > > > too many, > > > >> plain vacuum won't be able to clean them up without > > > raising the value > > > >> you use for FSM. By now the table is really bloated and > > > you probably > > > >> want to use vacuum full on it. > > > >>=20 > > > >=20 > > > > ---------------------------(end of > > > > broadcast)--------------------------- > > > > TIP 9: In versions below 8.0, the planner will ignore=20 > your desire to > > > > choose an index scan if your joining column's > > > datatypes do not > > > > match > > >=20 > > >=20 > > > -- > > > = #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D# > > > # It's easier to get forgiveness for being wrong than for being=20 > > > right. # > > > # Let's break this rule - forgive me. =20 > > > # > > > = #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > > > JanWieck@Yahoo.com # > > >=20 >=20 From pgsql-performance-owner@postgresql.org Thu Dec 8 14:17:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8D6609DD560 for ; Thu, 8 Dec 2005 14:17:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41678-09 for ; Thu, 8 Dec 2005 14:17:16 -0400 (AST) X-Greylist: delayed 03:10:35.800424 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 1D5789DCB45 for ; Thu, 8 Dec 2005 14:17:14 -0400 (AST) Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net [66.238.115.135]) by svr2.postgresql.org (Postfix) with ESMTP id 453CAF0B9D for ; Thu, 8 Dec 2005 15:06:45 +0000 (GMT) Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; Thu, 8 Dec 2005 07:11:15 -0800 Received: from mail.tecarta.com ([192.168.160.1]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 8 Dec 2005 07:11:09 -0800 Received: from barracuda.tecarta.com ([192.168.160.200]) by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id M2005120807110920354 for ; Thu, 08 Dec 2005 07:11:09 -0800 X-ASG-Debug-ID: 1134054396-11430-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 E17AB20206D1 for ; Thu, 8 Dec 2005 07:06:36 -0800 (PST) Received: from amd64-gentoo-laptop ([63.206.203.145]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 8 Dec 2005 07:11:04 -0800 X-ASG-Orig-Subj: Re: [PERFORM] Disk tests for a new database server Subject: Re: Disk tests for a new database server From: Steve Poe To: Rory Campbell-Lange Cc: pgsql-performance@postgresql.org In-Reply-To: <20051208121259.GA29104@campbell-lange.net> References: <20051208121259.GA29104@campbell-lange.net> Content-Type: text/plain Date: Thu, 08 Dec 2005 07:06:31 -0800 Message-Id: <1134054391.10837.3.camel@amd64-gentoo-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 08 Dec 2005 15:11:04.0384 (UTC) FILETIME=[9B824C00:01C5FC09] 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= X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.6114 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/251 X-Sequence-Number: 16072 Rory, While I don't have my specific stats with my from my tests with XFS and bonnie for our company's db server, I do recall vividly that seq. output did not increase dramatically until I had 8+ discs in a RAID10 configuration on an LSI card. I was not using LVM. If I had less than 8 discs, seq. output was about equal regardless of file system being uses (EXT3,JFS,or XFS). Steve On Thu, 2005-12-08 at 12:12 +0000, Rory Campbell-Lange wrote: > We are testing disk I/O on our new server (referred to in my recent > questions about LVM and XFS on this list) and have run bonnie++ on the > xfs partition destined for postgres; results noted below. > > I haven't been able to find many benchmarks showing desirable IO stats. > As far as I can tell the sequential input (around 110000K/sec) looks > good while the sequential output (around 50000K/sec) looks fairly > average. > > Advice and comments gratefully received. > Suggested Parameters for running pg_bench would be great! > > Thanks, > Rory > > The server has a dual core AMD Opteron 270 chip (2000MHz), 6GB of RAM > and an LSI 320-1 card running 4x147GB disks running in a RAID10 > configuration. The server has a freshly compiled 2.6.14.3 linux kernel. > > partial df output: > Filesystem Size Used Avail Use% Mounted on > ... > /dev/mapper/masvg-masdata > 99G 33M 94G 1% /masdata > /dev/mapper/masvg-postgres > 40G 92M 40G 1% /postgres > > partial fstab config: > ... > /dev/mapper/masvg-masdata /masdata ext3 defaults 0 2 > /dev/mapper/masvg-postgres /postgres xfs defaults 0 2 > > > Version 1.03 ------Sequential Output------ --Sequential Input- --Random- > -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- > Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP > mas 13000M 52655 99 52951 10 32246 7 41441 72 113438 12 590.0 0 > mas 13000M 49306 83 51967 9 32269 7 42442 70 115427 12 590.5 1 > mas 13000M 53449 89 51982 10 32625 7 42819 71 111829 11 638.3 0 > mas 13000M 51818 88 51639 9 33127 7 42377 70 108585 11 556.5 0 > mas 13000M 48930 90 51750 9 32854 7 41220 71 109813 11 566.2 0 > mas 13000M 52148 88 47393 9 35343 7 42871 70 109775 12 582.0 0 > mas 13000M 52427 88 53040 10 32315 7 42813 71 112045 12 596.7 0 > mas 13000M 51967 87 54004 10 30429 7 46180 76 110973 11 625.1 0 > mas 13000M 48690 89 46416 9 35678 7 41429 72 111612 11 627.2 0 > mas 13000M 52641 88 52807 10 31115 7 43476 72 110694 11 568.2 0 > mas 13000M 52186 88 47385 9 35341 7 42959 72 110963 11 558.7 0 > mas 13000M 52092 87 53111 10 32135 7 42636 69 110560 11 562.0 1 > mas 13000M 49445 90 47378 9 34410 7 41191 72 110736 11 610.3 0 > mas 13000M 51704 88 47699 9 35436 7 42413 69 110446 11 612.0 0 > mas 13000M 52434 88 53331 10 32479 7 43229 71 109385 11 620.6 0 > mas 13000M 52074 89 53291 10 32095 7 43593 72 109541 11 628.0 0 > mas 13000M 48084 88 52624 10 32301 7 40975 72 110548 11 594.0 0 > mas 13000M 53019 90 52441 10 32411 7 42574 68 111321 11 578.0 0 > ------Sequential Create------ --------Random Create-------- > -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- > files:max:min /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP > mas 16 7970 36 +++++ +++ 7534 34 7918 36 +++++ +++ 4482 22 > mas 16 7945 33 +++++ +++ 7483 30 7918 42 +++++ +++ 4438 20 > mas 16 8481 48 +++++ +++ 7468 31 7870 39 +++++ +++ 4385 23 > mas 16 7915 36 +++++ +++ 7498 33 7930 41 +++++ +++ 4619 23 > mas 16 8553 35 +++++ +++ 8312 38 8613 37 +++++ +++ 4513 24 > mas 16 8498 40 +++++ +++ 8215 33 8570 43 +++++ +++ 4858 26 > mas 16 7892 39 +++++ +++ 7624 30 5341 28 +++++ +++ 4762 22 > mas 16 5408 27 +++++ +++ 9378 37 8573 41 +++++ +++ 4385 21 > mas 16 5063 27 +++++ +++ 8656 38 5159 27 +++++ +++ 4705 24 > mas 16 4917 25 +++++ +++ 8682 39 5282 28 +++++ +++ 4723 22 > mas 16 5027 28 +++++ +++ 8538 36 5173 29 +++++ +++ 4719 23 > mas 16 5449 27 +++++ +++ 8630 36 5266 28 +++++ +++ 5463 27 > mas 16 5373 27 +++++ +++ 8658 37 5264 26 +++++ +++ 4731 22 > mas 16 4959 24 +++++ +++ 9126 46 5160 26 +++++ +++ 4717 24 > mas 16 5379 27 +++++ +++ 8620 40 5014 27 +++++ +++ 4701 21 > mas 16 5312 29 +++++ +++ 8642 36 7862 42 +++++ +++ 4869 24 > mas 16 5057 26 +++++ +++ 8566 36 5120 28 +++++ +++ 4681 21 > mas 16 5225 27 +++++ +++ 8740 37 5205 28 +++++ +++ 4744 21 > > > > From pgsql-performance-owner@postgresql.org Thu Dec 8 12:52:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DBBEA9DCAD7 for ; Thu, 8 Dec 2005 12:52:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23586-08 for ; Thu, 8 Dec 2005 12:52:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id 1EE159DCABE for ; Thu, 8 Dec 2005 12:52:18 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id D6BB0B820 for ; Thu, 8 Dec 2005 11:52:17 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) Content-Transfer-Encoding: 7bit Message-Id: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: Postgresql Performance From: Vivek Khera Subject: opinion on disk speed Date: Thu, 8 Dec 2005 11:52:17 -0500 X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/246 X-Sequence-Number: 16067 I have a choice to make on a RAID enclosure: 14x 36GB 15kRPM ultra 320 SCSI drives OR 12x 72GB 10kRPM ultra 320 SCSI drives both would be configured into RAID 10 over two SCSI channels using a megaraid 320-2x card. My goal is speed. Either would provide more disk space than I would need over the next two years. The database does a good number of write transactions, and a decent number of sequential scans over the whole DB (about 60GB including indexes) for large reports. My only concern is the 10kRPM vs 15kRPM. The advantage of the 10k disks is that it would come from the same vendor as the systems to which it will be connected, making procurement easier. From pgsql-performance-owner@postgresql.org Thu Dec 8 13:24:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0E6AD9DD552 for ; Thu, 8 Dec 2005 13:24:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30017-03 for ; Thu, 8 Dec 2005 13:24:51 -0400 (AST) X-Greylist: delayed 00:25:14.72466 by SQLgrey- Received: from mail-relay1.tagaudit.com (unknown [69.64.214.4]) by postgresql.org (Postfix) with ESMTP id 986DF9DD206 for ; Thu, 8 Dec 2005 13:24:49 -0400 (AST) Received: from mail-hub.tagaudit.com (dns2.tagaudit.com [192.168.3.32]) by mail-relay1.tagaudit.com (Postfix) with ESMTP id 4EAE4200000AE for ; Thu, 8 Dec 2005 11:59:34 -0500 (EST) Received: by mail-hub.tagaudit.com (Postfix, from userid 8) id 436502D7C8; Thu, 8 Dec 2005 11:59:34 -0500 (EST) Received: from xeon400.tagaudit.com (vpn.tagaudit.com [192.168.3.17]) by mail-hub.tagaudit.com (Postfix) with ESMTP id 2749E2D7B1 for ; Thu, 8 Dec 2005 11:59:34 -0500 (EST) Received: by xeon400.tagaudit.com with Internet Mail Service (5.5.2656.59) id ; Thu, 8 Dec 2005 11:59:33 -0500 Message-ID: <0C072E7CC947D511AC9600A0CC7341200256D143@xeon400.tagaudit.com> From: Amit V Shah To: "'pgsql-performance@postgresql.org'" Subject: Joining 2 tables with 300 million rows Date: Thu, 8 Dec 2005 11:59:24 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200512/249 X-Sequence-Number: 16070 Hi all, First of all, please pardon if the question is dumb! Is it even feasible or normal to do such a thing ! This query is needed by a webpage so needs to be lightning fast. Anything beyond 2-3 seconds is unacceptable performance. I have two tables CREATE TABLE runresult ( id_runresult int8 NOT NULL, rundefinition_id_rundefinition int4 NOT NULL, measure_id_measure int4 NOT NULL, value float4 NOT NULL, "sequence" varchar(20) NOT NULL, CONSTRAINT pk_runresult_ars PRIMARY KEY (id_runresult), ) CREATE TABLE runresult_has_catalogtable ( runresult_id_runresult int8 NOT NULL, catalogtable_id_catalogtable int4 NOT NULL, value int4 NOT NULL, CONSTRAINT pk_runresult_has_catalogtable PRIMARY KEY (runresult_id_runresult, catalogtable_id_catalogtable, value) CONSTRAINT fk_temp FOREIGN KEY (runresult_id_runresult) REFERENCES runresult(id_runresult) ON UPDATE RESTRICT ON DELETE RESTRICT ) Each table has around 300 million records (will grow to probably billions). Below is the query and the explain analyze -- explain analyze SELECT measure.description, runresult.value FROM ((((rundefinition INNER JOIN runresult ON rundefinition.id_rundefinition = runresult.rundefinition_id_rundefinition) INNER JOIN runresult_has_catalogtable ON runresult.id_runresult = runresult_has_catalogtable.runresult_id_runresult) INNER JOIN runresult_has_catalogtable AS runresult_has_catalogtable_1 ON runresult.id_runresult = runresult_has_catalogtable_1.runresult_id_runresult) INNER JOIN runresult_has_catalogtable AS runresult_has_catalogtable_2 ON runresult.id_runresult = runresult_has_catalogtable_2.runresult_id_runresult) INNER JOIN measure ON runresult.measure_id_measure = measure.id_measure WHERE (((runresult_has_catalogtable.catalogtable_id_catalogtable)=52) AND ((runresult_has_catalogtable_1.catalogtable_id_catalogtable)=54) AND ((runresult_has_catalogtable_2.catalogtable_id_catalogtable)=55) AND ((runresult_has_catalogtable.value)=15806) AND ((runresult_has_catalogtable_1.value)=1) AND ((runresult_has_catalogtable_2.value) In (21,22,23,24)) AND ((rundefinition.id_rundefinition)=10106)); 'Nested Loop (cost=0.00..622582.70 rows=1 width=28) (actual time=25.221..150.563 rows=22 loops=1)' ' -> Nested Loop (cost=0.00..622422.24 rows=2 width=52) (actual time=25.201..150.177 rows=22 loops=1)' ' -> Nested Loop (cost=0.00..622415.97 rows=2 width=32) (actual time=25.106..149.768 rows=22 loops=1)' ' -> Nested Loop (cost=0.00..621258.54 rows=15 width=24) (actual time=24.582..149.061 rows=30 loops=1)' ' -> Index Scan using pk_rundefinition on rundefinition (cost=0.00..3.86 rows=1 width=4) (actual time=0.125..0.147 rows=1 loops=1)' ' Index Cond: (id_rundefinition = 10106)' ' -> Nested Loop (cost=0.00..621254.54 rows=15 width=28) (actual time=24.443..148.784 rows=30 loops=1)' ' -> Index Scan using runresult_has_catalogtable_value on runresult_has_catalogtable (cost=0.00..575069.35 rows=14437 width=8) (actual time=0.791..33.036 rows=10402 loops=1)' ' Index Cond: (value = 15806)' ' Filter: (catalogtable_id_catalogtable = 52)' ' -> Index Scan using pk_runresult_ars on runresult (cost=0.00..3.19 rows=1 width=20) (actual time=0.007..0.007 rows=0 loops=10402)' ' Index Cond: (runresult.id_runresult = "outer".runresult_id_runresult)' ' Filter: (10106 = rundefinition_id_rundefinition)' ' -> Index Scan using runresult_has_catalogtable_id_runresult on runresult_has_catalogtable runresult_has_catalogtable_1 (cost=0.00..76.65 rows=41 width=8) (actual time=0.015..0.017 rows=1 loops=30)' ' Index Cond: (runresult_has_catalogtable_1.runresult_id_runresult = "outer".runresult_id_runresult)' ' Filter: ((catalogtable_id_catalogtable = 54) AND (value = 1))' ' -> Index Scan using pk_measure on measure (cost=0.00..3.12 rows=1 width=28) (actual time=0.008..0.010 rows=1 loops=22)' ' Index Cond: ("outer".measure_id_measure = measure.id_measure)' ' -> Index Scan using runresult_has_catalogtable_id_runresult on runresult_has_catalogtable runresult_has_catalogtable_2 (cost=0.00..79.42 rows=65 width=8) (actual time=0.007..0.010 rows=1 loops=22)' ' Index Cond: (runresult_has_catalogtable_2.runresult_id_runresult = "outer".runresult_id_runresult)' ' Filter: ((catalogtable_id_catalogtable = 55) AND ((value = 21) OR (value = 22) OR (value = 23) OR (value = 24)))' 'Total runtime: 150.863 ms' From pgsql-performance-owner@postgresql.org Thu Dec 8 13:03:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 361FD9DCB5E for ; Thu, 8 Dec 2005 13:03:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51435-08 for ; Thu, 8 Dec 2005 13:03:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by postgresql.org (Postfix) with ESMTP id E3E559DCB45 for ; Thu, 8 Dec 2005 13:03:29 -0400 (AST) 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 1EkPB2-0009Kk-0B for pgsql-performance@postgresql.org; Thu, 08 Dec 2005 17:03:28 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: opinion on disk speed Date: Thu, 8 Dec 2005 17:03:27 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] opinion on disk speed Thread-Index: AcX8F9h2DCfcgYKxRZqKKQYKwmyHKgAAK/4w From: "Dave Page" To: "Vivek Khera" , "Postgresql Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.532 required=5 tests=[AWL=0.532] X-Spam-Score: 0.532 X-Spam-Level: X-Archive-Number: 200512/247 X-Sequence-Number: 16068 =20 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > Vivek Khera > Sent: 08 December 2005 16:52 > To: Postgresql Performance > Subject: [PERFORM] opinion on disk speed >=20 > I have a choice to make on a RAID enclosure: >=20 > 14x 36GB 15kRPM ultra 320 SCSI drives >=20 > OR >=20 > 12x 72GB 10kRPM ultra 320 SCSI drives >=20 > both would be configured into RAID 10 over two SCSI channels using a =20 > megaraid 320-2x card. >=20 > My goal is speed. Either would provide more disk space than I would =20 > need over the next two years. >=20 > The database does a good number of write transactions, and a decent =20 > number of sequential scans over the whole DB (about 60GB including =20 > indexes) for large reports. >=20 > My only concern is the 10kRPM vs 15kRPM. The advantage of the 10k =20 > disks is that it would come from the same vendor as the systems to =20 > which it will be connected, making procurement easier. 15K drives (well, the Seagate Cheetah X15's that I have a lot of at least) can run very hot compared to the 10K's. Might be worth bearing (no pun intended) in mind. Other than that, without knowing the full specs of the drives, you've got 2 extra spindles and a probably-lower-seek time if you go for the X15's so that would seem likely to be the faster option. Regards, Dave From pgsql-performance-owner@postgresql.org Thu Dec 8 13:09:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E105C9DD552 for ; Thu, 8 Dec 2005 13:09:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55141-09 for ; Thu, 8 Dec 2005 13:09:50 -0400 (AST) X-Greylist: delayed 01:19:43.390029 by SQLgrey- Received: from linux.spb.org (linux.spb.org [195.70.198.16]) by postgresql.org (Postfix) with ESMTP id 182EA9DD07B for ; Thu, 8 Dec 2005 13:09:48 -0400 (AST) Received: from office1.i-free.ru (unknown [81.222.216.82]) by linux.spb.org (Postfix) with ESMTP id C3680CFA52 for ; Thu, 8 Dec 2005 20:10:23 +0300 (MSK) Received: from [192.168.0.250] (helo=deepcore) by office1.i-free.ru with smtp (Exim 3.36 #1 (Debian)) id 1EkPH8-0002Zw-00 for ; Thu, 08 Dec 2005 20:09:46 +0300 Date: Thu, 8 Dec 2005 20:10:29 +0300 From: Evgeny Gridasov To: pgsql-performance@postgresql.org Subject: slow COMMITs Message-Id: <20051208201029.f36a44ca.eugrid@fpm.kubsu.ru> In-Reply-To: References: X-Mailer: Sylpheed version 2.1.8 (GTK+ 2.6.2; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/248 X-Sequence-Number: 16069 Hi everybody! My system is 2xXEON 3 GHz, 4GB RAM, RAID-10 (4 SCSI HDDs), running Postgres 8.1.0, taken from CVS REL8_1_STABLE, compiled with gcc-3.4 with options "-march=nocona -O2 -mfpmath=sse -msse3". Hyperthreading is disabled. There are about 300,000 - 500,000 transactions per day. Database size is about 14 Gigabytes. The problem is that all queries run pretty good except transaction COMMITs. Sometimes it takes about 300-500 ms to commit a transaction and it is unacceptebly slow for my application. I had this problem before, on 8.0.x and 7.4.x, but since 8.1 upgrade all queries began to work very fast except commit. BTW, I ran my own performance test, a multithreaded typical application user emulator, on 7.4 and 8.1. 8.1 performance was 8x times faster than 7.4, on the same machine and with the same config file settings. Some settings from my postgresql.conf: shared_buffers = 32768 temp_buffers = 32768 work_mem = 12228 bg_writer_delay = 400 wal_buffers = 128 commit_delay = 30000 checkpoint_segments = 8 effective_cache_size = 262144 # postgres is the one and the only application on this machine default_statistics_target = 250 all statistic collection enabled autovacuum runs every 120 seconds. vacuum is run after 2000 updates, analyze is run after 1000 updates. I've run vmstat to monitor hard disk activity. It was 50-500 Kb/sec for reading and 200-1500 Kb/sec for writing. There are some peak hdd reads and writes (10-20Mb/s) but commit time does not always depend upon them. What parameters should I tune? -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Thu Dec 8 13:50:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2D1CA9DCB7C for ; Thu, 8 Dec 2005 13:50:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72727-01 for ; Thu, 8 Dec 2005 13:50:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id D8E699DCB45 for ; Thu, 8 Dec 2005 13:50:33 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 08 Dec 2005 11:50:33 -0600 Subject: Re: opinion on disk speed From: Scott Marlowe To: Vivek Khera Cc: Postgresql Performance In-Reply-To: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1134064233.3587.20.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 08 Dec 2005 11:50:33 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/250 X-Sequence-Number: 16071 On Thu, 2005-12-08 at 10:52, Vivek Khera wrote: > I have a choice to make on a RAID enclosure: > > 14x 36GB 15kRPM ultra 320 SCSI drives > > OR > > 12x 72GB 10kRPM ultra 320 SCSI drives > > both would be configured into RAID 10 over two SCSI channels using a > megaraid 320-2x card. > > My goal is speed. Either would provide more disk space than I would > need over the next two years. > > The database does a good number of write transactions, and a decent > number of sequential scans over the whole DB (about 60GB including > indexes) for large reports. > > My only concern is the 10kRPM vs 15kRPM. The advantage of the 10k > disks is that it would come from the same vendor as the systems to > which it will be connected, making procurement easier. I would say that the RAID controller and the amount of battery backed cache will have a greater impact than the difference in seek times on those two drives. Also, having two more drives in the 15k category is likely to play to its advantage more so than the speed of the drive spindles and seek times. If you're worried about higher failures due to heat etc... you could always make a couple of the drives spares. Looking at the datasheet for the seagate 10k and 15k drives, it would appear there is another difference, The 10k drives list a sustained xfer rate of 39 to 80 MBytes / second, while the 15k drives list one of 58 to 96. That's quite a bit faster. So, sequential scans should be faster as well. Power consumption isn't much differnt, about a watt more for the 15ks, so that's no big deal. I'd do a bit of googling to see if there are a lot more horror stories with 15k drives than with the 10k ones. From pgsql-performance-owner@postgresql.org Thu Dec 8 17:54:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7E57F9DD75A for ; Thu, 8 Dec 2005 17:54:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68882-08 for ; Thu, 8 Dec 2005 17:54:00 -0400 (AST) X-Greylist: delayed 03:07:12.637815 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id E69C79DCBDC for ; Thu, 8 Dec 2005 17:53:56 -0400 (AST) Received: from mail.aveo.aveopharma.com (67.109.105.227.ptr.us.xo.net [67.109.105.227]) by svr2.postgresql.org (Postfix) with SMTP id BAC21F0B6B for ; Thu, 8 Dec 2005 18:46:43 +0000 (GMT) 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: Joining 2 tables with 300 million rows Date: Thu, 8 Dec 2005 13:47:13 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Joining 2 tables with 300 million rows Thread-Index: AcX8HG6Y+DJkrdJTRuiS12nFfWLsPgACzKrg From: "Dmitri Bichko" To: "Amit V Shah" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/253 X-Sequence-Number: 16074 What's the problem? You are joining two 300 million row tables in 0.15 of a second - seems reasonable. Dmitri > -----Original Message----- > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > Amit V Shah > Sent: Thursday, December 08, 2005 11:59 AM > To: 'pgsql-performance@postgresql.org' > Subject: [PERFORM] Joining 2 tables with 300 million rows >=20 >=20 > Hi all, >=20 > First of all, please pardon if the question is dumb! Is it=20 > even feasible or normal to do such a thing ! This query is=20 > needed by a webpage so needs to be lightning fast. Anything=20 > beyond 2-3 seconds is unacceptable performance. >=20 > I have two tables >=20 > CREATE TABLE runresult > ( > id_runresult int8 NOT NULL, > rundefinition_id_rundefinition int4 NOT NULL, > measure_id_measure int4 NOT NULL, > value float4 NOT NULL, > "sequence" varchar(20) NOT NULL, > CONSTRAINT pk_runresult_ars PRIMARY KEY (id_runresult), > )=20 >=20 >=20 > CREATE TABLE runresult_has_catalogtable > ( > runresult_id_runresult int8 NOT NULL, > catalogtable_id_catalogtable int4 NOT NULL, > value int4 NOT NULL, > CONSTRAINT pk_runresult_has_catalogtable PRIMARY KEY=20 > (runresult_id_runresult, catalogtable_id_catalogtable, value) > CONSTRAINT fk_temp FOREIGN KEY (runresult_id_runresult) REFERENCES > runresult(id_runresult) ON UPDATE RESTRICT ON DELETE RESTRICT > )=20 >=20 > Each table has around 300 million records (will grow to=20 > probably billions). Below is the query and the explain analyze -- >=20 > explain analyze SELECT measure.description, runresult.value=20 > FROM ((((rundefinition INNER JOIN runresult ON=20 > rundefinition.id_rundefinition =3D=20 > runresult.rundefinition_id_rundefinition)=20 > INNER JOIN runresult_has_catalogtable ON runresult.id_runresult =3D > runresult_has_catalogtable.runresult_id_runresult)=20 > INNER JOIN runresult_has_catalogtable AS=20 > runresult_has_catalogtable_1 ON runresult.id_runresult =3D > runresult_has_catalogtable_1.runresult_id_runresult)=20 > INNER JOIN runresult_has_catalogtable AS=20 > runresult_has_catalogtable_2 ON runresult.id_runresult =3D > runresult_has_catalogtable_2.runresult_id_runresult)=20 > INNER JOIN measure ON runresult.measure_id_measure =3D=20 > measure.id_measure WHERE=20 > (((runresult_has_catalogtable.catalogtable_id_catalogtable)=3D52)=20 > AND ((runresult_has_catalogtable_1.catalogtable_id_catalogtable)=3D54)=20= > AND ((runresult_has_catalogtable_2.catalogtable_id_catalogtable)=3D55)=20= > AND ((runresult_has_catalogtable.value)=3D15806)=20 > AND ((runresult_has_catalogtable_1.value)=3D1)=20 > AND ((runresult_has_catalogtable_2.value) In (21,22,23,24))=20 > AND ((rundefinition.id_rundefinition)=3D10106)); >=20 > 'Nested Loop (cost=3D0.00..622582.70 rows=3D1 width=3D28) (actual=20 > time=3D25.221..150.563 rows=3D22 loops=3D1)' ' -> Nested Loop =20 > (cost=3D0.00..622422.24 rows=3D2 width=3D52) (actual=20 > time=3D25.201..150.177 rows=3D22 loops=3D1)' > ' -> Nested Loop (cost=3D0.00..622415.97 rows=3D2=20 > width=3D32) (actual > time=3D25.106..149.768 rows=3D22 loops=3D1)' > ' -> Nested Loop (cost=3D0.00..621258.54 rows=3D15=20 > width=3D24) > (actual time=3D24.582..149.061 rows=3D30 loops=3D1)' > ' -> Index Scan using pk_rundefinition on=20 > rundefinition > (cost=3D0.00..3.86 rows=3D1 width=3D4) (actual time=3D0.125..0.147=20 > rows=3D1 loops=3D1)' > ' Index Cond: (id_rundefinition =3D 10106)' > ' -> Nested Loop (cost=3D0.00..621254.54 rows=3D15= > width=3D28) (actual time=3D24.443..148.784 rows=3D30 loops=3D1)' > ' -> Index Scan using > runresult_has_catalogtable_value on=20 > runresult_has_catalogtable (cost=3D0.00..575069.35 rows=3D14437=20 > width=3D8) (actual time=3D0.791..33.036 rows=3D10402 loops=3D1)' > ' Index Cond: (value =3D 15806)' > ' Filter:=20 > (catalogtable_id_catalogtable =3D > 52)' > ' -> Index Scan using pk_runresult_ars on > runresult (cost=3D0.00..3.19 rows=3D1 width=3D20) (actual=20 > time=3D0.007..0.007 rows=3D0 loops=3D10402)' > ' Index Cond: (runresult.id_runresult =3D= > "outer".runresult_id_runresult)' > ' Filter: (10106 =3D > rundefinition_id_rundefinition)' > ' -> Index Scan using=20 > runresult_has_catalogtable_id_runresult > on runresult_has_catalogtable runresult_has_catalogtable_1=20 > (cost=3D0.00..76.65 rows=3D41 width=3D8) (actual time=3D0.015..0.017=20= > rows=3D1 loops=3D30)' > ' Index Cond: > (runresult_has_catalogtable_1.runresult_id_runresult =3D=20 > "outer".runresult_id_runresult)' > ' Filter: ((catalogtable_id_catalogtable =3D=20 > 54) AND (value > =3D 1))' > ' -> Index Scan using pk_measure on measure =20 > (cost=3D0.00..3.12 rows=3D1 > width=3D28) (actual time=3D0.008..0.010 rows=3D1 loops=3D22)' > ' Index Cond: ("outer".measure_id_measure =3D > measure.id_measure)' > ' -> Index Scan using=20 > runresult_has_catalogtable_id_runresult on=20 > runresult_has_catalogtable runresult_has_catalogtable_2 =20 > (cost=3D0.00..79.42 rows=3D65 width=3D8) (actual time=3D0.007..0.010=20= > rows=3D1 loops=3D22)' > ' Index Cond:=20 > (runresult_has_catalogtable_2.runresult_id_runresult =3D > "outer".runresult_id_runresult)' > ' Filter: ((catalogtable_id_catalogtable =3D 55) AND=20 > ((value =3D 21) OR > (value =3D 22) OR (value =3D 23) OR (value =3D 24)))' > 'Total runtime: 150.863 ms' >=20 >=20 >=20 > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >=20 The information transmitted is intended only for the person or entity to = which it is addressed and may contain confidential and/or privileged mate= rial. Any review, retransmission, dissemination or other use of, or takin= g of any action in reliance upon, this information by persons or entities= other than the intended recipient is prohibited. If you received this in= error, please contact the sender and delete the material from any comput= er From pgsql-performance-owner@postgresql.org Thu Dec 8 15:22:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3AF3E9DD733 for ; Thu, 8 Dec 2005 15:22:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35143-04 for ; Thu, 8 Dec 2005 15:21:59 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 7DC259DCD83 for ; Thu, 8 Dec 2005 15:21:55 -0400 (AST) Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net [71.128.90.172]) by svr2.postgresql.org (Postfix) with ESMTP id 1ECAEF0B3A for ; Thu, 8 Dec 2005 19:21:55 +0000 (GMT) Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) by gghcwest.com (8.12.10/8.12.9) with ESMTP id jB8JJUmd006435; Thu, 8 Dec 2005 11:19:31 -0800 Received: from jwb by toonses.gghcwest.com with local (Exim 4.52) id 1EkRKu-0006Of-MK; Thu, 08 Dec 2005 11:21:48 -0800 Subject: Re: opinion on disk speed From: "Jeffrey W. Baker" To: Vivek Khera Cc: Postgresql Performance In-Reply-To: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 08 Dec 2005 11:21:48 -0800 Message-Id: <1134069708.24172.8.camel@toonses.gghcwest.com> Mime-Version: 1.0 X-Mailer: Evolution 2.5.2 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/252 X-Sequence-Number: 16073 On Thu, 2005-12-08 at 11:52 -0500, Vivek Khera wrote: > I have a choice to make on a RAID enclosure: > > 14x 36GB 15kRPM ultra 320 SCSI drives > > OR > > 12x 72GB 10kRPM ultra 320 SCSI drives > > both would be configured into RAID 10 over two SCSI channels using a > megaraid 320-2x card. > > My goal is speed. Either would provide more disk space than I would > need over the next two years. > > The database does a good number of write transactions, and a decent > number of sequential scans over the whole DB (about 60GB including > indexes) for large reports. The STR of 15k is quite a bit higher than 10k. I'd be inclined toward the 15k if it doesn't impact the budget. For the write transactions, the speed and size of the DIMM on that LSI card will matter the most. I believe the max memory on that adapter is 512MB. These cost so little that it wouldn't make sense to go with anything smaller. When comparing the two disks, don't forget to check for supported SCSI features. In the past I've been surprised that some 10k disks don't support packetization, QAS, and so forth. All 15k disks seem to support these. Don't forget to post some benchmarks when your vendor delivers ;) -jwb From pgsql-performance-owner@postgresql.org Thu Dec 8 18:01:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 957CF9DCB7E for ; Thu, 8 Dec 2005 18:01:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72652-03-2 for ; Thu, 8 Dec 2005 18:01:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail-relay1.tagaudit.com (unknown [69.64.214.4]) by postgresql.org (Postfix) with ESMTP id 026829DD748 for ; Thu, 8 Dec 2005 18:01:01 -0400 (AST) Received: from mail-hub.tagaudit.com (dns2.tagaudit.com [192.168.3.32]) by mail-relay1.tagaudit.com (Postfix) with ESMTP id E861E200000AF for ; Thu, 8 Dec 2005 17:01:03 -0500 (EST) Received: by mail-hub.tagaudit.com (Postfix, from userid 8) id DF0C22D825; Thu, 8 Dec 2005 17:01:03 -0500 (EST) Received: from xeon400.tagaudit.com (xeon400.tagaudit.com [192.168.3.17]) by mail-hub.tagaudit.com (Postfix) with ESMTP id C194E2D7E7 for ; Thu, 8 Dec 2005 17:01:03 -0500 (EST) Received: by xeon400.tagaudit.com with Internet Mail Service (5.5.2656.59) id ; Thu, 8 Dec 2005 17:01:03 -0500 Message-ID: <0C072E7CC947D511AC9600A0CC7341200256D14C@xeon400.tagaudit.com> From: Amit V Shah To: pgsql-performance@postgresql.org Subject: Re: Joining 2 tables with 300 million rows Date: Thu, 8 Dec 2005 17:01:01 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.439 required=5 tests=[AWL=-0.480, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.439 X-Spam-Level: * X-Archive-Number: 200512/254 X-Sequence-Number: 16075 Hi, The thing is, although it shows 0.15 seconds, when I run the actual query, it takes around 40-45 seconds (sorry I forgot to mention that). And then sometimes it depends on data. Some parameters have very less number of records, and others have lot more. I dont know how to read the "explan" results very well, but looked like there were no sequential scans and it only used indexes. Also, another problem is, the second time I run this query, it returns it from cache I believe. So the second time I run it, it returns in like 2 seconds or so ! Thats why I was worrying if joining 2 tables like that is even advisable at all ... Thanks, Amit -----Original Message----- From: Dmitri Bichko [mailto:dbichko@aveopharma.com] Sent: Thursday, December 08, 2005 1:47 PM To: Amit V Shah; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Joining 2 tables with 300 million rows What's the problem? You are joining two 300 million row tables in 0.15 of a second - seems reasonable. Dmitri > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of > Amit V Shah > Sent: Thursday, December 08, 2005 11:59 AM > To: 'pgsql-performance@postgresql.org' > Subject: [PERFORM] Joining 2 tables with 300 million rows > > > Hi all, > > First of all, please pardon if the question is dumb! Is it > even feasible or normal to do such a thing ! This query is > needed by a webpage so needs to be lightning fast. Anything > beyond 2-3 seconds is unacceptable performance. > > I have two tables > > CREATE TABLE runresult > ( > id_runresult int8 NOT NULL, > rundefinition_id_rundefinition int4 NOT NULL, > measure_id_measure int4 NOT NULL, > value float4 NOT NULL, > "sequence" varchar(20) NOT NULL, > CONSTRAINT pk_runresult_ars PRIMARY KEY (id_runresult), > ) > > > CREATE TABLE runresult_has_catalogtable > ( > runresult_id_runresult int8 NOT NULL, > catalogtable_id_catalogtable int4 NOT NULL, > value int4 NOT NULL, > CONSTRAINT pk_runresult_has_catalogtable PRIMARY KEY > (runresult_id_runresult, catalogtable_id_catalogtable, value) > CONSTRAINT fk_temp FOREIGN KEY (runresult_id_runresult) REFERENCES > runresult(id_runresult) ON UPDATE RESTRICT ON DELETE RESTRICT > ) > > Each table has around 300 million records (will grow to > probably billions). Below is the query and the explain analyze -- > > explain analyze SELECT measure.description, runresult.value > FROM ((((rundefinition INNER JOIN runresult ON > rundefinition.id_rundefinition = > runresult.rundefinition_id_rundefinition) > INNER JOIN runresult_has_catalogtable ON runresult.id_runresult = > runresult_has_catalogtable.runresult_id_runresult) > INNER JOIN runresult_has_catalogtable AS > runresult_has_catalogtable_1 ON runresult.id_runresult = > runresult_has_catalogtable_1.runresult_id_runresult) > INNER JOIN runresult_has_catalogtable AS > runresult_has_catalogtable_2 ON runresult.id_runresult = > runresult_has_catalogtable_2.runresult_id_runresult) > INNER JOIN measure ON runresult.measure_id_measure = > measure.id_measure WHERE > (((runresult_has_catalogtable.catalogtable_id_catalogtable)=52) > AND ((runresult_has_catalogtable_1.catalogtable_id_catalogtable)=54) > AND ((runresult_has_catalogtable_2.catalogtable_id_catalogtable)=55) > AND ((runresult_has_catalogtable.value)=15806) > AND ((runresult_has_catalogtable_1.value)=1) > AND ((runresult_has_catalogtable_2.value) In (21,22,23,24)) > AND ((rundefinition.id_rundefinition)=10106)); > > 'Nested Loop (cost=0.00..622582.70 rows=1 width=28) (actual > time=25.221..150.563 rows=22 loops=1)' ' -> Nested Loop > (cost=0.00..622422.24 rows=2 width=52) (actual > time=25.201..150.177 rows=22 loops=1)' > ' -> Nested Loop (cost=0.00..622415.97 rows=2 > width=32) (actual > time=25.106..149.768 rows=22 loops=1)' > ' -> Nested Loop (cost=0.00..621258.54 rows=15 > width=24) > (actual time=24.582..149.061 rows=30 loops=1)' > ' -> Index Scan using pk_rundefinition on > rundefinition > (cost=0.00..3.86 rows=1 width=4) (actual time=0.125..0.147 > rows=1 loops=1)' > ' Index Cond: (id_rundefinition = 10106)' > ' -> Nested Loop (cost=0.00..621254.54 rows=15 > width=28) (actual time=24.443..148.784 rows=30 loops=1)' > ' -> Index Scan using > runresult_has_catalogtable_value on > runresult_has_catalogtable (cost=0.00..575069.35 rows=14437 > width=8) (actual time=0.791..33.036 rows=10402 loops=1)' > ' Index Cond: (value = 15806)' > ' Filter: > (catalogtable_id_catalogtable = > 52)' > ' -> Index Scan using pk_runresult_ars on > runresult (cost=0.00..3.19 rows=1 width=20) (actual > time=0.007..0.007 rows=0 loops=10402)' > ' Index Cond: (runresult.id_runresult = > "outer".runresult_id_runresult)' > ' Filter: (10106 = > rundefinition_id_rundefinition)' > ' -> Index Scan using > runresult_has_catalogtable_id_runresult > on runresult_has_catalogtable runresult_has_catalogtable_1 > (cost=0.00..76.65 rows=41 width=8) (actual time=0.015..0.017 > rows=1 loops=30)' > ' Index Cond: > (runresult_has_catalogtable_1.runresult_id_runresult = > "outer".runresult_id_runresult)' > ' Filter: ((catalogtable_id_catalogtable = > 54) AND (value > = 1))' > ' -> Index Scan using pk_measure on measure > (cost=0.00..3.12 rows=1 > width=28) (actual time=0.008..0.010 rows=1 loops=22)' > ' Index Cond: ("outer".measure_id_measure = > measure.id_measure)' > ' -> Index Scan using > runresult_has_catalogtable_id_runresult on > runresult_has_catalogtable runresult_has_catalogtable_2 > (cost=0.00..79.42 rows=65 width=8) (actual time=0.007..0.010 > rows=1 loops=22)' > ' Index Cond: > (runresult_has_catalogtable_2.runresult_id_runresult = > "outer".runresult_id_runresult)' > ' Filter: ((catalogtable_id_catalogtable = 55) AND > ((value = 21) OR > (value = 22) OR (value = 23) OR (value = 24)))' > 'Total runtime: 150.863 ms' > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Thu Dec 8 18:56:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7E00A9DCD5B for ; Thu, 8 Dec 2005 18:55:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90026-06 for ; Thu, 8 Dec 2005 18:56:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by postgresql.org (Postfix) with ESMTP id 1B29E9DCC2B for ; Thu, 8 Dec 2005 18:55:56 -0400 (AST) Received: from rory by localhost.localdomain with local (Exim 4.54) id 1EkUgW-0003ml-Fm; Thu, 08 Dec 2005 22:56:20 +0000 Date: Thu, 8 Dec 2005 22:56:20 +0000 From: Rory Campbell-Lange To: Steve Poe Cc: pgsql-performance@postgresql.org Subject: Re: Disk tests for a new database server Message-ID: <20051208225620.GA14485@campbell-lange.net> References: <20051208121259.GA29104@campbell-lange.net> <1134054391.10837.3.camel@amd64-gentoo-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1134054391.10837.3.camel@amd64-gentoo-laptop> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.333 required=5 tests=[AWL=0.333] X-Spam-Score: 0.333 X-Spam-Level: X-Archive-Number: 200512/255 X-Sequence-Number: 16076 Hi Steve On 08/12/05, Steve Poe (spoe@sfnet.cc) wrote: > Rory, > > While I don't have my specific stats with my from my tests with XFS and > bonnie for our company's db server, I do recall vividly that seq. output > did not increase dramatically until I had 8+ discs in a RAID10 > configuration on an LSI card. I was not using LVM. If I had less than 8 > discs, seq. output was about equal regardless of file system being uses > (EXT3,JFS,or XFS). Thanks for the information. I certainly had not appreciated this fact. Regards, Rory > On Thu, 2005-12-08 at 12:12 +0000, Rory Campbell-Lange wrote: > > We are testing disk I/O on our new server (referred to in my recent > > questions about LVM and XFS on this list) and have run bonnie++ on the > > xfs partition destined for postgres; results noted below. > > > > I haven't been able to find many benchmarks showing desirable IO stats. > > As far as I can tell the sequential input (around 110000K/sec) looks > > good while the sequential output (around 50000K/sec) looks fairly > > average. > > > > Advice and comments gratefully received. > > Suggested Parameters for running pg_bench would be great! > > > > Thanks, > > Rory ... > > Version 1.03 ------Sequential Output------ --Sequential Input- --Random- > > -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- > > Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP > > mas 13000M 52655 99 52951 10 32246 7 41441 72 113438 12 590.0 0 > > mas 13000M 49306 83 51967 9 32269 7 42442 70 115427 12 590.5 1 > > mas 13000M 53449 89 51982 10 32625 7 42819 71 111829 11 638.3 0 > > mas 13000M 51818 88 51639 9 33127 7 42377 70 108585 11 556.5 0 ... > > ------Sequential Create------ --------Random Create-------- > > -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- > > files:max:min /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP > > mas 16 7970 36 +++++ +++ 7534 34 7918 36 +++++ +++ 4482 22 > > mas 16 7945 33 +++++ +++ 7483 30 7918 42 +++++ +++ 4438 20 > > mas 16 8481 48 +++++ +++ 7468 31 7870 39 +++++ +++ 4385 23 > > mas 16 7915 36 +++++ +++ 7498 33 7930 41 +++++ +++ 4619 23 > > mas 16 8553 35 +++++ +++ 8312 38 8613 37 +++++ +++ 4513 24 > > mas 16 8498 40 +++++ +++ 8215 33 8570 43 +++++ +++ 4858 26 From pgsql-performance-owner@postgresql.org Thu Dec 8 22:30:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9CC609DCBF0 for ; Thu, 8 Dec 2005 22:30:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33418-10 for ; Thu, 8 Dec 2005 22:30:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id B88839DCAE4 for ; Thu, 8 Dec 2005 22:30:16 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 796381AC3E9; Thu, 8 Dec 2005 15:44:20 -0800 (PST) Date: Thu, 8 Dec 2005 15:43:32 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Vivek Khera Cc: Postgresql Performance Subject: Re: opinion on disk speed In-Reply-To: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> Message-ID: References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/256 X-Sequence-Number: 16077 On Thu, 8 Dec 2005, Vivek Khera wrote: > I have a choice to make on a RAID enclosure: > > 14x 36GB 15kRPM ultra 320 SCSI drives > > OR > > 12x 72GB 10kRPM ultra 320 SCSI drives > > both would be configured into RAID 10 over two SCSI channels using a megaraid > 320-2x card. > > My goal is speed. Either would provide more disk space than I would need > over the next two years. > > The database does a good number of write transactions, and a decent number of > sequential scans over the whole DB (about 60GB including indexes) for large > reports. > > My only concern is the 10kRPM vs 15kRPM. The advantage of the 10k disks is > that it would come from the same vendor as the systems to which it will be > connected, making procurement easier. if space isn't an issue then you fall back to the old standby rules of thumb more spindles are better (more disk heads that can move around independantly) faster drives are better (less time to read or write a track) so the 15k drive option is better one other note, you probably don't want to use all the disks in a raid10 array, you probably want to split a pair of them off into a seperate raid1 array and put your WAL on it. David Lang From pgsql-performance-owner@postgresql.org Fri Dec 9 06:01:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9312C9DCABE for ; Fri, 9 Dec 2005 06:01:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39938-05 for ; Fri, 9 Dec 2005 06:01:55 -0400 (AST) X-Greylist: delayed 00:25:41.966781 by SQLgrey- Received: from danbo.digsys.bg (danbo.digsys.bg [192.92.129.13]) by postgresql.org (Postfix) with ESMTP id 86E579DCAB7 for ; Fri, 9 Dec 2005 06:01:49 -0400 (AST) Received: from [193.68.6.22] (luke.digsys.bg [193.68.6.22]) by danbo.digsys.bg (8.11.6/8.10.1) with ESMTP id jB99a9C07962 for ; Fri, 9 Dec 2005 11:36:09 +0200 (EET) Message-ID: <4399500A.4020607@faith.digsys.bg> Date: Fri, 09 Dec 2005 11:36:10 +0200 From: Kaloyan Iliev User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20051109 X-Accept-Language: bg, en, en-us MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Query not using index Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/257 X-Sequence-Number: 16078 Hi all, I have a problem with a query which doeson't want to use indexes. I tried to create different indexes but nothing help. Can anyone suggest what index I need. This query is executed 1.5Milion times per day and I need it to be veri fast. I made my test on 8.0.0 beta but the production database is still 7.4.6 so i need suggestions for 7.4.6. I will post the table with the indexes and the query plans. iplog=# \d croute Table "public.croute" Column | Type | Modifiers -----------------+--------------------------+----------- confid | integer | network | cidr | comment | text | router | text | port | text | valid_at | timestamp with time zone | archived_at | timestamp with time zone | Indexes: "croute_netwo" btree (network) WHERE confid > 0 AND archived_at IS NULL "croute_netwokr_valid_at" btree (network, valid_at) "croute_network" btree (network) WHERE archived_at IS NULL "croute_network_all" btree (network) iplog=# select version(); version -------------------------------------------------------------------------------------------------------------- PostgreSQL 8.0.0beta1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk) (1 row) !!!!!!!!!!!!THIS IS THE QUERY!!!!!!!!!!!!!!!!! customer=> explain analyze SELECT * customer-> FROM croute customer-> WHERE '193.68.0.8/32' <<= network AND customer-> (archived_at is NULL OR archived_at > '17-11-2005') AND customer-> valid_at < '1-12-2005'::date AND customer-> confid > 0; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Seq Scan on croute (cost=0.00..441.62 rows=413 width=102) (actual time=14.131..37.515 rows=1 loops=1) Filter: (('193.68.0.8/32'::cidr <<= network) AND ((archived_at IS NULL) OR (archived_at > '2005-11-17 00:00:00+02'::timestamp with time zone)) AND (valid_at < ('2005-12-01'::date)::timestamp with time zone) AND (confid > 0)) Total runtime: 37.931 ms (3 rows) customer=> select count(*) from croute; count ------- 10066 (1 row) This is the result of the query: confid | network | comment | router | port | valid_at | archived_at | -------+---------------+---------+------+----+-------------------------+-----------+ 19971 | xx.xx.xx.xx/32 | xxxxx | ? | ? | 2005-03-11 00:00:00+02 | | (1 row) And last I try to stop the sequance scan but it doesn't help. I suppose I don't have the right index. iplog=# set enable_seqscan = off; SET iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.8/32' <<= network AND iplog-# (archived_at is NULL OR archived_at > '17-11-2005') AND iplog-# valid_at < '1-12-2005'::date AND iplog-# confid > 0; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on croute (cost=100000000.00..100000780.64 rows=1030 width=103) (actual time=29.593..29.819 rows=1 loops=1) Filter: (('193.68.0.8/32'::cidr <<= network) AND ((archived_at IS NULL) OR (archived_at > '2005-11-17 00:00:00+02'::timestamp with time zone)) AND (valid_at < '2005-12-01'::date) AND (confid > 0)) Total runtime: 29.931 ms (3 rows) I try creating one last index on all fields but it doesn't help. iplog=# CREATE INDEX croute_all on croute(network,archived_at,valid_at,confid); CREATE INDEX iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.8/32' <<= network AND iplog-# (archived_at is NULL OR archived_at > '17-11-2005') AND iplog-# valid_at < '1-12-2005'::date AND iplog-# confid > 0; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on croute (cost=100000000.00..100000780.64 rows=1030 width=103) (actual time=29.626..29.879 rows=1 loops=1) Filter: (('193.68.0.8/32'::cidr <<= network) AND ((archived_at IS NULL) OR (archived_at > '2005-11-17 00:00:00+02'::timestamp with time zone)) AND (valid_at < '2005-12-01'::date) AND (confid > 0)) Total runtime: 30.060 ms (3 rows) Thanks in advance to all. Kaloyan Iliev From pgsql-performance-owner@postgresql.org Fri Dec 9 10:15:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ECE8F9DCAB7 for ; Fri, 9 Dec 2005 10:15:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93924-07 for ; Fri, 9 Dec 2005 10:15:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id E13499DCAB6 for ; Fri, 9 Dec 2005 10:15:24 -0400 (AST) Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by svr2.postgresql.org (Postfix) with ESMTP id F39C6F0B03 for ; Fri, 9 Dec 2005 14:15:28 +0000 (GMT) Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id A3D29D2298D for ; Fri, 9 Dec 2005 09:15:24 -0500 (EST) Received: from web3.messagingengine.com ([10.202.2.212]) by frontend1.internal (MEProxy); Fri, 09 Dec 2005 09:15:24 -0500 Received: by web3.messagingengine.com (Postfix, from userid 99) id 24ED7B15A; Fri, 9 Dec 2005 09:15:25 -0500 (EST) Message-Id: <1134137725.8767.249418727@webmail.messagingengine.com> X-Sasl-Enc: rLFPvL45+0tepntI0kvfNISo+Peq/3ChIDuEti07D8BD 1134137725 From: "Jeremy Haile" 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.15; A1.64; B3.05; Q3.03) Subject: Re: opinion on disk speed Date: Fri, 09 Dec 2005 09:15:25 -0500 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200512/258 X-Sequence-Number: 16079 > one other note, you probably don't want to use all the disks in a raid10 > array, you probably want to split a pair of them off into a seperate > raid1 array and put your WAL on it. Is a RAID 1 array of two disks sufficient for WAL? What's a typical setup for a high performance PostgreSQL installation? RAID 1 for WAL and RAID 10 for data? I've read that splitting the WAL and data offers huge performance benefits. How much additional benefit is gained by moving indexes to another RAID array? Would you typically set the indexes RAID array up as RAID 1 or 10? From pgsql-performance-owner@postgresql.org Fri Dec 9 11:06:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 116FE9DCAB7 for ; Fri, 9 Dec 2005 11:06:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07059-02 for ; Fri, 9 Dec 2005 11:06:09 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.205]) by postgresql.org (Postfix) with ESMTP id D59B19DCB68 for ; Fri, 9 Dec 2005 11:06:02 -0400 (AST) Received: by zproxy.gmail.com with SMTP id n29so984884nzf for ; Fri, 09 Dec 2005 07:06:07 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=GWvoWeJwKzrUebv+HCmunyz2IStVPxoo8Kq7O4uVCQAm+8189Ywoua1J81c0MUuJXUA7oqdGM+xMK2bEfD6cJZwbi8nr+JfqiUjsI7k6qO4FBE2xeNgdawu3W98hJWhhiL99fESxjmKPi7WaNccoYVOFKsiBF3iBeyJdBjpJn30= Received: by 10.64.253.17 with SMTP id a17mr3909183qbi; Fri, 09 Dec 2005 07:06:07 -0800 (PST) Received: by 10.65.180.14 with HTTP; Fri, 9 Dec 2005 07:06:07 -0800 (PST) Message-ID: Date: Fri, 9 Dec 2005 10:06:07 -0500 From: Jaime Casanova To: Kaloyan Iliev Subject: Re: Query not using index Cc: pgsql-performance@postgresql.org In-Reply-To: <4399500A.4020607@faith.digsys.bg> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4399500A.4020607@faith.digsys.bg> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.194 required=5 tests=[AWL=0.194] X-Spam-Score: 0.194 X-Spam-Level: X-Archive-Number: 200512/259 X-Sequence-Number: 16080 On 12/9/05, Kaloyan Iliev wrote: > Hi all, > > I have a problem with a query which doeson't want to use indexes. I > tried to create different indexes but nothing help. Can anyone suggest > what index I need. > This query is executed 1.5Milion times per day and I need it to be veri > fast. I made my test on 8.0.0 beta but the production database is still > 7.4.6 so i need suggestions for 7.4.6. > I will post the table with the indexes and the query plans. > iplog=3D# \d croute > Table "public.croute" > Column | Type | Modifiers > -----------------+--------------------------+----------- > confid | integer | > network | cidr | > comment | text | > router | text | > port | text | > valid_at | timestamp with time zone | > archived_at | timestamp with time zone | > Indexes: > "croute_netwo" btree (network) WHERE confid > 0 AND archived_at IS NUL= L > "croute_netwokr_valid_at" btree (network, valid_at) > "croute_network" btree (network) WHERE archived_at IS NULL > "croute_network_all" btree (network) > > > iplog=3D# select version(); > version > -------------------------------------------------------------------------= ------------------------------------- > PostgreSQL 8.0.0beta1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) > 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk) > (1 row) > > !!!!!!!!!!!!THIS IS THE QUERY!!!!!!!!!!!!!!!!! > customer=3D> explain analyze SELECT * > customer-> FROM croute > customer-> WHERE '193.68.0.8/32' <<=3D > network AND > customer-> (archived_at is NULL > OR archived_at > '17-11-2005') AND > customer-> valid_at < > '1-12-2005'::date AND > customer-> confid > 0; > > QUERY PLAN > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ----- > Seq Scan on croute (cost=3D0.00..441.62 rows=3D413 width=3D102) (actual > time=3D14.131..37.515 rows=3D1 loops=3D1) > Filter: (('193.68.0.8/32'::cidr <<=3D network) AND ((archived_at IS > NULL) OR (archived_at > '2005-11-17 00:00:00+02'::timestamp with time > zone)) AND (valid_at < ('2005-12-01'::date)::timestamp with time zone) > AND (confid > 0)) > Total runtime: 37.931 ms > (3 rows) > > customer=3D> select count(*) from croute; > count > ------- > 10066 > (1 row) > This is the result of the query: > confid | network | comment | router | port | > valid_at | archived_at | > -------+---------------+---------+------+----+-------------------------+-= ----------+ > 19971 | xx.xx.xx.xx/32 | xxxxx | ? | ? | 2005-03-11 > 00:00:00+02 | | > (1 row) > And last I try to stop the sequance scan but it doesn't help. I suppose > I don't have the right index. > iplog=3D# set enable_seqscan =3D off; > SET > iplog=3D# explain analyze SELECT * > iplog-# FROM croute > iplog-# WHERE '193.68.0.8/32' <<=3D > network AND > iplog-# (archived_at is NULL OR > archived_at > '17-11-2005') AND > iplog-# valid_at < > '1-12-2005'::date AND > iplog-# confid > 0; > > QUERY PLAN > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------- > Seq Scan on croute (cost=3D100000000.00..100000780.64 rows=3D1030 > width=3D103) (actual time=3D29.593..29.819 rows=3D1 loops=3D1) > Filter: (('193.68.0.8/32'::cidr <<=3D network) AND ((archived_at IS > NULL) OR (archived_at > '2005-11-17 00:00:00+02'::timestamp with time > zone)) AND (valid_at < '2005-12-01'::date) AND (confid > 0)) > Total runtime: 29.931 ms > (3 rows) > > I try creating one last index on all fields but it doesn't help. > iplog=3D# CREATE INDEX croute_all on > croute(network,archived_at,valid_at,confid); > CREATE INDEX > iplog=3D# explain analyze SELECT * > iplog-# FROM croute > iplog-# WHERE '193.68.0.8/32' <<=3D > network AND > iplog-# (archived_at is NULL OR > archived_at > '17-11-2005') AND > iplog-# valid_at < > '1-12-2005'::date AND > iplog-# confid > 0; > > QUERY PLAN > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------- > Seq Scan on croute (cost=3D100000000.00..100000780.64 rows=3D1030 > width=3D103) (actual time=3D29.626..29.879 rows=3D1 loops=3D1) > Filter: (('193.68.0.8/32'::cidr <<=3D network) AND ((archived_at IS > NULL) OR (archived_at > '2005-11-17 00:00:00+02'::timestamp with time > zone)) AND (valid_at < '2005-12-01'::date) AND (confid > 0)) > Total runtime: 30.060 ms > (3 rows) > > > Thanks in advance to all. > > Kaloyan Iliev > > In oracle you can use this instead... SELECT * FROM croute WHERE '193.68.0.8/32' <<=3D network AND archived_at is NULL AND valid_at < '1-12-2005'::date AND confid > 0; UNION SELECT * FROM croute WHERE '193.68.0.8/32' <<=3D network AND archived_at > '17-11-2005'::date AND valid_at < '1-12-2005'::date AND confid > 0; although i think that your query can make use of bitmap index in 8.1 -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Fri Dec 9 11:38:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 71B089DCAB7 for ; Fri, 9 Dec 2005 11:38:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12064-02 for ; Fri, 9 Dec 2005 11:38:59 -0400 (AST) X-Greylist: delayed 00:06:42.090831 by SQLgrey- Received: from jefftrout.com (pool-71-248-161-214.bstnma.fios.verizon.net [71.248.161.214]) by postgresql.org (Postfix) with SMTP id 65F4F9DD725 for ; Fri, 9 Dec 2005 11:38:50 -0400 (AST) Received: (qmail 82821 invoked from network); 9 Dec 2005 15:33:06 -0000 Received: from pool-71-248-161-214.bstnma.fios.verizon.net (HELO ?10.10.10.105?) (71.248.161.214) by 192.168.0.101 with SMTP; 9 Dec 2005 15:33:06 -0000 In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256D14C@xeon400.tagaudit.com> References: <0C072E7CC947D511AC9600A0CC7341200256D14C@xeon400.tagaudit.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Jeff Trout Subject: Re: Joining 2 tables with 300 million rows Date: Fri, 9 Dec 2005 10:32:12 -0500 To: Amit V Shah X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.988 required=5 tests=[RCVD_IN_SORBS_DUL=1.988] X-Spam-Score: 1.988 X-Spam-Level: * X-Archive-Number: 200512/260 X-Sequence-Number: 16081 On Dec 8, 2005, at 5:01 PM, Amit V Shah wrote: > Hi, > > The thing is, although it shows 0.15 seconds, when I run the actual > query, > it takes around 40-45 seconds (sorry I forgot to mention that). And > then > sometimes it depends on data. Some parameters have very less number of > records, and others have lot more. I dont know how to read the > "explan" > results very well, but looked like there were no sequential scans > and it > only used indexes. > The planner will look at the data you used and it may decide to switch the plan if it realizes your're quering a very frequent value. Another thing that may be a factor is the network - when doing explain analyze it doesn't have to transfer the dataset to the client. -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Fri Dec 9 11:46:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 570429DCABA for ; Fri, 9 Dec 2005 11:46:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14557-01 for ; Fri, 9 Dec 2005 11:46:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by postgresql.org (Postfix) with ESMTP id 7186A9DCAB7 for ; Fri, 9 Dec 2005 11:46:05 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jB9Fk8CT004326; Fri, 9 Dec 2005 09:46:09 -0600 Date: Fri, 9 Dec 2005 09:47:18 -0600 From: Frank Wiles To: "Dave Page" Cc: vivek@khera.org, pgsql-performance@postgresql.org Subject: Re: opinion on disk speed Message-Id: <20051209094718.49f7b402.frank@wiles.org> In-Reply-To: References: X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/261 X-Sequence-Number: 16082 On Thu, 8 Dec 2005 17:03:27 -0000 "Dave Page" wrote: > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org > > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of > > Vivek Khera > > > I have a choice to make on a RAID enclosure: > > > > 14x 36GB 15kRPM ultra 320 SCSI drives > > > > OR > > > > 12x 72GB 10kRPM ultra 320 SCSI drives > > > > both would be configured into RAID 10 over two SCSI channels using > > a megaraid 320-2x card. > > 15K drives (well, the Seagate Cheetah X15's that I have a lot of at > least) can run very hot compared to the 10K's. Might be worth bearing > (no pun intended) in mind. > > Other than that, without knowing the full specs of the drives, you've > got 2 extra spindles and a probably-lower-seek time if you go for the > X15's so that would seem likely to be the faster option. I agree, the extra spindles and lower seek times are better if all you are concerned about is raw speed. However, that has to be balanced, from an overall perspective, with the nice single point of ordering/contact/support/warranty of the one vendor. It's a tough call. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Fri Dec 9 11:50:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8A8D79DD761 for ; Fri, 9 Dec 2005 11:50:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12938-05 for ; Fri, 9 Dec 2005 11:50:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by postgresql.org (Postfix) with ESMTP id EC2399DCCC7 for ; Fri, 9 Dec 2005 11:50:20 -0400 (AST) Received: from [84.143.12.137] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1EkkVm2qsS-0007EU; Fri, 09 Dec 2005 16:50:19 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1EkkVl-0006a0-GY; Fri, 09 Dec 2005 16:50:17 +0100 Message-ID: <4399A7B8.2020500@pse-consulting.de> Date: Fri, 09 Dec 2005 15:50:16 +0000 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Frank Wiles CC: vivek@khera.org, pgsql-performance@postgresql.org Subject: Re: opinion on disk speed References: <20051209094718.49f7b402.frank@wiles.org> In-Reply-To: <20051209094718.49f7b402.frank@wiles.org> 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, score=0.666 required=5 tests=[AWL=-0.666, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.666 X-Spam-Level: X-Archive-Number: 200512/263 X-Sequence-Number: 16084 Frank Wiles wrote: > > > I agree, the extra spindles and lower seek times are better if all > you are concerned about is raw speed. > > However, that has to be balanced, from an overall perspective, with > the nice single point of ordering/contact/support/warranty of the > one vendor. It's a tough call. Well, if your favourite dealer can't supply you with such common equipment as 15k drives you should consider changing the dealer. They don't seem to be aware of db hardware reqirements. Regards, Andreas From pgsql-performance-owner@postgresql.org Fri Dec 9 11:49:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C3E789DD725 for ; Fri, 9 Dec 2005 11:49:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13256-05 for ; Fri, 9 Dec 2005 11:49:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by postgresql.org (Postfix) with ESMTP id 91B709DD75D for ; Fri, 9 Dec 2005 11:49:07 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jB9FnA4x004333; Fri, 9 Dec 2005 09:49:11 -0600 Date: Fri, 9 Dec 2005 09:50:20 -0600 From: Frank Wiles To: Scott Marlowe Cc: vivek@khera.org, pgsql-performance@postgresql.org Subject: Re: opinion on disk speed Message-Id: <20051209095020.73e603ca.frank@wiles.org> In-Reply-To: <1134064233.3587.20.camel@state.g2switchworks.com> References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> <1134064233.3587.20.camel@state.g2switchworks.com> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/262 X-Sequence-Number: 16083 On Thu, 08 Dec 2005 11:50:33 -0600 Scott Marlowe wrote: > Power consumption isn't much differnt, about a watt more for the 15ks, > so that's no big deal. I'd do a bit of googling to see if there are a > lot more horror stories with 15k drives than with the 10k ones. Just an FYI, but I've run both 10k and 15k rpm drives in PostgreSQL servers and haven't experienced any "horror stories". They do run hotter, but this shouldn't be a big issue in a decent case in a typical server room environment. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Fri Dec 9 11:57:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C50BC9DD761 for ; Fri, 9 Dec 2005 11:57:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16126-02 for ; Fri, 9 Dec 2005 11:57:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by postgresql.org (Postfix) with ESMTP id 6B8F29DD732 for ; Fri, 9 Dec 2005 11:57:24 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jB9FvQBD004363; Fri, 9 Dec 2005 09:57:27 -0600 Date: Fri, 9 Dec 2005 09:58:36 -0600 From: Frank Wiles To: "Jeremy Haile" Cc: pgsql-performance@postgresql.org Subject: Re: opinion on disk speed Message-Id: <20051209095836.1c846c2e.frank@wiles.org> In-Reply-To: <1134137725.8767.249418727@webmail.messagingengine.com> References: <1134137725.8767.249418727@webmail.messagingengine.com> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/264 X-Sequence-Number: 16085 On Fri, 09 Dec 2005 09:15:25 -0500 "Jeremy Haile" wrote: > > one other note, you probably don't want to use all the disks in a > > raid10 array, you probably want to split a pair of them off into a > > seperate raid1 array and put your WAL on it. > > Is a RAID 1 array of two disks sufficient for WAL? What's a typical > setup for a high performance PostgreSQL installation? RAID 1 for WAL > and RAID 10 for data? > > I've read that splitting the WAL and data offers huge performance > benefits. How much additional benefit is gained by moving indexes to > another RAID array? Would you typically set the indexes RAID array up > as RAID 1 or 10? Yes most people put the WAL on a RAID 1 and use all the remaining disks in RAID 10 for data. Whether or not moving your indexes onto a different RAID array is worthwhile is harder to judge. If your indexes are small enough that they will usually be in ram, but your data is to large to fit then having the extra spindles available on the data partition is probably better. As always, it is probably best to test both configurations to see which is optimal for your particular application and setup. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Sun Dec 11 14:51:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1C8AD9DCB62 for ; Fri, 9 Dec 2005 13:01:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26994-05 for ; Fri, 9 Dec 2005 13:01:51 -0400 (AST) X-Greylist: delayed 00:23:01.836203 by SQLgrey- Received: from danbo.digsys.bg (danbo.digsys.bg [192.92.129.13]) by postgresql.org (Postfix) with ESMTP id 87E859DCAB7 for ; Fri, 9 Dec 2005 13:01:49 -0400 (AST) Received: from [193.68.6.22] (luke.digsys.bg [193.68.6.22]) by danbo.digsys.bg (8.11.6/8.10.1) with ESMTP id jB9GcfC04060 for ; Fri, 9 Dec 2005 18:38:45 +0200 (EET) Message-ID: <4399B312.2080907@mbox.digsys.bg> Date: Fri, 09 Dec 2005 18:38:42 +0200 From: Kaloyan Iliev Reply-To: kaloyan@digsys.bg Organization: Digital Systems User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20051109 X-Accept-Language: bg, en, en-us MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query not using index References: <4399500A.4020607@faith.digsys.bg> In-Reply-To: <4399500A.4020607@faith.digsys.bg> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/280 X-Sequence-Number: 16101 Hi all, Thanks for the reply. I made some more test and find out that the problem is with the <<= operator for the network type. Can I create index which to work with <<=. Because if I use = the index is used. But not for <<=. iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.10/32' <<= network; QUERY PLAN --------------------------------------------------------------------------------------------------------- Seq Scan on croute (cost=0.00..707.27 rows=4891 width=103) (actual time=10.313..29.621 rows=2 loops=1) Filter: ('193.68.0.10/32'::cidr <<= network) Total runtime: 29.729 ms (3 rows) iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.10/32' = network; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Index Scan using croute_network_all on croute (cost=0.00..17.99 rows=4 width=103) (actual time=0.053..0.059 rows=1 loops=1) Index Cond: ('193.68.0.10/32'::cidr = network) Total runtime: 0.167 ms (3 rows) Waiting for replies. Thanks to all in advance. Kaloyan Iliev From pgsql-performance-owner@postgresql.org Fri Dec 9 12:39:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 501129DCAB7 for ; Fri, 9 Dec 2005 12:39:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23920-04 for ; Fri, 9 Dec 2005 12:39:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from danbo.digsys.bg (danbo.digsys.bg [192.92.129.13]) by postgresql.org (Postfix) with ESMTP id 9B7099DCAB6 for ; Fri, 9 Dec 2005 12:39:09 -0400 (AST) Received: from [193.68.6.22] (luke.digsys.bg [193.68.6.22]) by danbo.digsys.bg (8.11.6/8.10.1) with ESMTP id jB9Gd8C04078 for ; Fri, 9 Dec 2005 18:39:08 +0200 (EET) Message-ID: <4399B32D.4010508@faith.digsys.bg> Date: Fri, 09 Dec 2005 18:39:09 +0200 From: Kaloyan Iliev User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20051109 X-Accept-Language: bg, en, en-us MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query not using index References: <4399500A.4020607@faith.digsys.bg> In-Reply-To: <4399500A.4020607@faith.digsys.bg> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/265 X-Sequence-Number: 16086 Hi all, Thanks for the reply. I made some more test and find out that the problem is with the <<= operator for the network type. Can I create index which to work with <<=. Because if I use = the index is used. But not for <<=. iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.10/32' <<= network; QUERY PLAN --------------------------------------------------------------------------------------------------------- Seq Scan on croute (cost=0.00..707.27 rows=4891 width=103) (actual time=10.313..29.621 rows=2 loops=1) Filter: ('193.68.0.10/32'::cidr <<= network) Total runtime: 29.729 ms (3 rows) iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.10/32' = network; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Index Scan using croute_network_all on croute (cost=0.00..17.99 rows=4 width=103) (actual time=0.053..0.059 rows=1 loops=1) Index Cond: ('193.68.0.10/32'::cidr = network) Total runtime: 0.167 ms (3 rows) Waiting for replies. Thanks to all in advance. Kaloyan Iliev From pgsql-performance-owner@postgresql.org Sat Dec 10 07:34:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 366B29DCADA for ; Sat, 10 Dec 2005 07:34:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37233-07 for ; Sat, 10 Dec 2005 07:34:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35514.mail.mud.yahoo.com (web35514.mail.mud.yahoo.com [66.163.179.138]) by postgresql.org (Postfix) with SMTP id C54FA9DCAA9 for ; Sat, 10 Dec 2005 07:34:20 -0400 (AST) Received: (qmail 85998 invoked by uid 60001); 10 Dec 2005 11:34:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ZOjDgSxq4IDNhLHmlEGYHfhXXsBeGbrL2x+z/l0kqg+/KfC5i+8P57bKbGEF+03rrPqzW/Job4INemRMAvTeYzpvwtD7/4MEd4qU8+47K6HpQYM6siEKmyRJZJxBU3MXGd8E1c/9bpdEmrQ6WI+GKAGNr64GAO3m+ONrCVRofFA= ; Message-ID: <20051210113423.85996.qmail@web35514.mail.mud.yahoo.com> Received: from [201.2.194.120] by web35514.mail.mud.yahoo.com via HTTP; Sat, 10 Dec 2005 11:34:23 GMT Date: Sat, 10 Dec 2005 11:34:23 +0000 (GMT) From: Carlos Benkendorf Subject: Is RAID10 the best choice? To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-795247381-1134214463=:84670" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.48 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.48 X-Spam-Level: X-Archive-Number: 200512/266 X-Sequence-Number: 16087 --0-795247381-1134214463=:84670 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello, I would like to know which is the best configuration to use 4 scsi drives with a pg 8.1 server. Configuring them as a RAID10 set seems a good choice but now I�m figuring another configuration: SCSI drive 1: operational system SCSI drive 2: pg_xlog SCSI drive 3: data SCSI drive 4: index I know the difference between them when you analyze risks of loosing data but how about performance? What should be better? Obs.: Our system uses always an index for every access.. (enable_seqscan(false)) Thanks in advance! Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-795247381-1134214463=:84670 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hello,
 
I would like to know which is the best configuration to use 4 scsi drives with a pg 8.1 server.
 
Configuring them as a RAID10 set seems a good choice but now I�m figuring another configuration:
SCSI drive 1: operational system
SCSI drive 2: pg_xlog
SCSI drive 3: data
SCSI drive 4: index
 
I know the difference between them when you analyze risks of loosing data but how about performance?
 
What should be better?
 
Obs.: Our system uses always an index for every access.. (enable_seqscan(false))
 
Thanks in advance!
 
Benkendorf


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-795247381-1134214463=:84670-- From pgsql-performance-owner@postgresql.org Sat Dec 10 11:36:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0C7399DCC1A for ; Sat, 10 Dec 2005 11:36:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72395-09 for ; Sat, 10 Dec 2005 11:36:18 -0400 (AST) X-Greylist: delayed 00:06:39.07307 by SQLgrey- Received: from web36410.mail.mud.yahoo.com (web36410.mail.mud.yahoo.com [209.191.85.145]) by postgresql.org (Postfix) with SMTP id 0DFFB9DCBEE for ; Sat, 10 Dec 2005 11:36:11 -0400 (AST) Received: (qmail 71245 invoked by uid 60001); 10 Dec 2005 15:29:37 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=lsthmKHhluywJpM8rvQ23N2bw6V5BG2HVnT8pUMe4uCMs4liAC+lOPboB5+NvhFeTMgD0kUO/jFWMvUmHYPi5phXRb+XjS7AH3mfuX0zfeDaoB96ldzscYX/zt1TR29j3D6UDdtD7j1Dg8x+P8e2y65lpIHqgZh+BveKMX5BMTA= ; Message-ID: <20051210152937.71243.qmail@web36410.mail.mud.yahoo.com> Received: from [201.2.194.120] by web36410.mail.mud.yahoo.com via HTTP; Sat, 10 Dec 2005 15:29:37 GMT Date: Sat, 10 Dec 2005 15:29:37 +0000 (GMT) From: Henrique Engelmann Subject: Clustered tables and seqscan disabled To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-826323334-1134228577=:53389" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.425 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, HTML_10_20=0.945, HTML_MESSAGE=0.001] X-Spam-Score: 1.425 X-Spam-Level: * X-Archive-Number: 200512/267 X-Sequence-Number: 16088 --0-826323334-1134228577=:53389 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, Sometime ago I worked in an implantation project that uses postgresql and I remember than the software house recommended us to use seqscan off... I was not very sure, but I thought the best way should be set seqscan on and let postgresql choose the best access plan (index or seqscan). Even against the other team members I changed the configuration to seqscan on and the system didn�t worked anymore. Studying better the reasons I verified that applications were expecting data in primary index order but with seqscan ON sometimes postgresql didn�t use an index and naturally data came without order. I suggested changing the application and including a order by clause... but the software house didn�t make it because they said the system was originally designed for oracle and they did not need to use the ORDER BY clause with Oracle and even so the data were always retrieved in primary index order. I�m thinking with myself ... what kind of problems will they have in the future? I think this kind of configuration is very dependent of clustered tables... Am I right? Best regards! Engelmann. __________________________________________________ Fa�a liga��es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ --0-826323334-1134228577=:53389 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi,
 
Sometime ago I worked in an implantation project that uses postgresql and I remember than the software house recommended us to use seqscan off...
I was not very sure, but I thought the best way should be set seqscan on and let postgresql choose the best access plan (index or seqscan). Even against the other team members I changed the configuration to seqscan on and the system didn�t worked anymore.
 
Studying better the reasons I verified that applications were expecting data in primary index order but with seqscan ON sometimes postgresql didn�t use an index and naturally data came without order.
 
I suggested changing the application and including  a order by clause... but
the software house didn�t make it because they said the system was originally designed for oracle and they did not need to use the ORDER BY clause with Oracle and even so the data were always retrieved in primary index order.
 
I�m thinking with myself ... what kind of problems will they have in the future?
 
I think this kind of configuration is very dependent of clustered tables... Am I right?
 
Best regards!
Engelmann.

__________________________________________________
Fa�a liga��es para outros computadores com o novo Yahoo! Messenger
http://br.beta.messenger.yahoo.com/ --0-826323334-1134228577=:53389-- From pgsql-performance-owner@postgresql.org Sat Dec 10 11:53:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E10B69DCAB7 for ; Sat, 10 Dec 2005 11:53:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77582-04 for ; Sat, 10 Dec 2005 11:53:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from astra.telenet-ops.be (astra.telenet-ops.be [195.130.132.58]) by postgresql.org (Postfix) with ESMTP id 94CE19DCAB4 for ; Sat, 10 Dec 2005 11:53:00 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by astra.telenet-ops.be (Postfix) with SMTP id 0CA16381F4 for ; Sat, 10 Dec 2005 16:53:04 +0100 (CET) Received: from [10.0.1.5] (d5152B3BA.access.telenet.be [81.82.179.186]) by astra.telenet-ops.be (Postfix) with ESMTP id E8222380E7 for ; Sat, 10 Dec 2005 16:53:03 +0100 (CET) Message-ID: <439AFA8C.5070303@implements.be> Date: Sat, 10 Dec 2005 16:55:56 +0100 From: Yves Vindevogel Reply-To: yves.vindevogel@implements.be User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Executing a shell command from a PG function Content-Type: multipart/mixed; boundary="------------020903010408070707020100" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.823 required=5 tests=[RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 1.823 X-Spam-Level: * X-Archive-Number: 200512/268 X-Sequence-Number: 16089 This is a multi-part message in MIME format. --------------020903010408070707020100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, Is it possible to run a shell script, passing values of fields to it, in a Postgres function ? Yves Vindevogel --------------020903010408070707020100 Content-Type: text/x-vcard; charset=utf-8; name="yves.vindevogel.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="yves.vindevogel.vcf" begin:vcard fn:Yves Vindevogel n:Vindevogel;Yves org:Implements adr:;;Kempische Steenweg 206;Hasselt;;3500;Belgium email;internet:yves.vindevogel@implements.be tel;work:+32 (11) 43 55 76 tel;home:+32 (11) 43 55 76 tel;cell:+32 (478) 80 82 91 x-mozilla-html:TRUE url:http://www.implements.be version:2.1 end:vcard --------------020903010408070707020100-- From pgsql-performance-owner@postgresql.org Sat Dec 10 12:14:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0D1F69DCBCF for ; Sat, 10 Dec 2005 12:14:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77723-09 for ; Sat, 10 Dec 2005 12:14:16 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by postgresql.org (Postfix) with ESMTP id 27F8D9DCD48 for ; Sat, 10 Dec 2005 12:14:14 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so1114766wra for ; Sat, 10 Dec 2005 08:14:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WAPSF7MrOZ0BG1MB6n01su+YQ3RMMq4TXpUhn36XCda4Y4d6phMGgQ0yV8cKnHqIBgJ97p5g15tuWDMiZzO9H6bXreU7GWA/u1ftv0uANG3QWe4QodVKQ0F6MKRxOPrUU+rkI5/ItWABG0flufZblJkZXPfyN/0W5FHUv/u/Mok= Received: by 10.54.73.14 with SMTP id v14mr2014209wra; Sat, 10 Dec 2005 08:14:14 -0800 (PST) Received: by 10.54.98.6 with HTTP; Sat, 10 Dec 2005 08:14:14 -0800 (PST) Message-ID: Date: Sat, 10 Dec 2005 11:14:14 -0500 From: Jaime Casanova To: yves.vindevogel@implements.be Subject: Re: Executing a shell command from a PG function Cc: pgsql-performance@postgresql.org In-Reply-To: <439AFA8C.5070303@implements.be> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <439AFA8C.5070303@implements.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.148 required=5 tests=[AWL=0.148] X-Spam-Score: 0.148 X-Spam-Level: X-Archive-Number: 200512/269 X-Sequence-Number: 16090 On 12/10/05, Yves Vindevogel wrote: > Hi, > > Is it possible to run a shell script, passing values of fields to it, in > a Postgres function ? > > Yves Vindevogel > search for the pl/sh language -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Sat Dec 10 12:22:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 60B079DCD25 for ; Sat, 10 Dec 2005 12:22:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79949-06 for ; Sat, 10 Dec 2005 12:22:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 45B069DCD01 for ; Sat, 10 Dec 2005 12:22:24 -0400 (AST) 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 jBAGMH8c081560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 10 Dec 2005 09:22:20 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBAGMHRL042134; Sat, 10 Dec 2005 09:22:17 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBAGMGgD042133; Sat, 10 Dec 2005 09:22:16 -0700 (MST) (envelope-from mfuhr) Date: Sat, 10 Dec 2005 09:22:15 -0700 From: Michael Fuhr To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Executing a shell command from a PG function Message-ID: <20051210162215.GA42041@winnie.fuhr.org> References: <439AFA8C.5070303@implements.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <439AFA8C.5070303@implements.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/270 X-Sequence-Number: 16091 On Sat, Dec 10, 2005 at 04:55:56PM +0100, Yves Vindevogel wrote: > Is it possible to run a shell script, passing values of fields to it, in > a Postgres function ? Not directly from SQL or PL/pgSQL functions, but you can execute shell commands with the untrusted versions of PL/Perl, PL/Tcl, PL/Python, etc. There's even a PL/sh: http://pgfoundry.org/projects/plsh/ -- Michael Fuhr From pgsql-performance-owner@postgresql.org Sat Dec 10 12:50:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 200D59DCBCF for ; Sat, 10 Dec 2005 12:50:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87388-05 for ; Sat, 10 Dec 2005 12:50:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hoboe1bl1.telenet-ops.be (hoboe1bl1.telenet-ops.be [195.130.137.72]) by postgresql.org (Postfix) with ESMTP id B323C9DCAAD for ; Sat, 10 Dec 2005 12:50:51 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by hoboe1bl1.telenet-ops.be (Postfix) with SMTP id 4621A38316 for ; Sat, 10 Dec 2005 17:50:48 +0100 (CET) Received: from [10.0.1.5] (d5152B3BA.access.telenet.be [81.82.179.186]) by hoboe1bl1.telenet-ops.be (Postfix) with ESMTP id 23B823830D for ; Sat, 10 Dec 2005 17:50:48 +0100 (CET) Message-ID: <439B0813.3020206@implements.be> Date: Sat, 10 Dec 2005 17:53:39 +0100 From: Yves Vindevogel Reply-To: yves.vindevogel@implements.be User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Executing a shell command from a PG function References: <439AFA8C.5070303@implements.be> <20051210162215.GA42041@winnie.fuhr.org> In-Reply-To: <20051210162215.GA42041@winnie.fuhr.org> Content-Type: multipart/mixed; boundary="------------020309030105090800080905" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.823 required=5 tests=[RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 1.823 X-Spam-Level: * X-Archive-Number: 200512/271 X-Sequence-Number: 16092 This is a multi-part message in MIME format. --------------020309030105090800080905 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Thanks Michael and Jaime. The pg/sh thing is probably what I was looking for. Tnx Michael Fuhr wrote: >On Sat, Dec 10, 2005 at 04:55:56PM +0100, Yves Vindevogel wrote: > > >>Is it possible to run a shell script, passing values of fields to it, in >>a Postgres function ? >> >> > >Not directly from SQL or PL/pgSQL functions, but you can execute >shell commands with the untrusted versions of PL/Perl, PL/Tcl, >PL/Python, etc. There's even a PL/sh: > >http://pgfoundry.org/projects/plsh/ > > > --------------020309030105090800080905 Content-Type: text/x-vcard; charset=utf-8; name="yves.vindevogel.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="yves.vindevogel.vcf" begin:vcard fn:Yves Vindevogel n:Vindevogel;Yves org:Implements adr:;;Kempische Steenweg 206;Hasselt;;3500;Belgium email;internet:yves.vindevogel@implements.be tel;work:+32 (11) 43 55 76 tel;home:+32 (11) 43 55 76 tel;cell:+32 (478) 80 82 91 x-mozilla-html:TRUE url:http://www.implements.be version:2.1 end:vcard --------------020309030105090800080905-- From pgsql-performance-owner@postgresql.org Sat Dec 10 12:53:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9BBD89DCD3B for ; Sat, 10 Dec 2005 12:53:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88981-09 for ; Sat, 10 Dec 2005 12:53:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 58A219DCBEE for ; Sat, 10 Dec 2005 12:53:51 -0400 (AST) 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 jBAGroRM021006; Sat, 10 Dec 2005 11:53:50 -0500 (EST) To: Henrique Engelmann cc: pgsql-performance@postgresql.org Subject: Re: Clustered tables and seqscan disabled In-reply-to: <20051210152937.71243.qmail@web36410.mail.mud.yahoo.com> References: <20051210152937.71243.qmail@web36410.mail.mud.yahoo.com> Comments: In-reply-to Henrique Engelmann message dated "Sat, 10 Dec 2005 15:29:37 +0000" Date: Sat, 10 Dec 2005 11:53:50 -0500 Message-ID: <21005.1134233630@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/272 X-Sequence-Number: 16093 Henrique Engelmann writes: > I suggested changing the application and including a order by clause... but > the software house didn�t make it because they said the system was originally designed for oracle and they did not need to use the ORDER BY clause with Oracle and even so the data were always retrieved in primary index order. > I�m thinking with myself ... what kind of problems will they have in the future? If you aren't working with these people any more, be glad. They are obviously utterly incompetent. The SQL standard is perfectly clear about the matter: without ORDER BY, there is no guarantee about the order in which rows are retrieved. The fact that one specific implementation might have chanced to produce the rows in desired order (under all the conditions they had bothered to test, which I bet wasn't a lot) does not make their code correct. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Dec 10 16:17:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 21ECD9DCD65 for ; Sat, 10 Dec 2005 16:17:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27622-09 for ; Sat, 10 Dec 2005 16:17:15 -0400 (AST) X-Greylist: delayed 03:02:30.235297 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 1F81A9DCB51 for ; Sat, 10 Dec 2005 16:17:13 -0400 (AST) Received: from pinus.cc.fer.hr (pinus.cc.fer.hr [161.53.73.18]) by svr2.postgresql.org (Postfix) with ESMTP id 3AE05F0B6E for ; Sat, 10 Dec 2005 17:14:40 +0000 (GMT) Received: from [161.53.72.113] (lara.cc.fer.hr [161.53.72.113]) by pinus.cc.fer.hr (8.12.2/8.12.2) with ESMTP id jBAHDtFx000250 for ; Sat, 10 Dec 2005 18:14:18 +0100 (MET) Message-ID: <439B0C9A.6010109@fer.hr> Date: Sat, 10 Dec 2005 18:12:58 +0100 From: Ivan Voras User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050921) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Bitmasks Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/274 X-Sequence-Number: 16095 Can indexes be used for bit-filtering queries? For example: create table tt ( flags integer not null default 0, str varchar ); select * from tt where (flags & 16) != 0; I suspected radix trees could be used for this but it seems it doesn't work that way. If not, is there a way of quickly filtering by such "elements of a set" that doesn't involve creating 32 boolean fields (which would also need to be pretty uselessly indexed separately)? Would strings and regular expressions work? From pgsql-performance-owner@postgresql.org Sat Dec 10 13:14:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3BFA79DCD41 for ; Sat, 10 Dec 2005 13:14:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94715-09 for ; Sat, 10 Dec 2005 13:14:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from email.aon.at (warsl404pip7.highway.telekom.at [195.3.96.91]) by postgresql.org (Postfix) with ESMTP id 4C1839DCC2A for ; Sat, 10 Dec 2005 13:14:15 -0400 (AST) Received: (qmail 17314 invoked from network); 10 Dec 2005 17:14:11 -0000 Received: from m148p014.dipool.highway.telekom.at (HELO Sokrates) ([62.46.8.110]) (envelope-sender ) by smarthub76.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 10 Dec 2005 17:14:11 -0000 From: Manfred Koizar To: Tom Lane Cc: "Markus Wollny" , pgsql-performance@postgresql.org Subject: Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0 Date: Sat, 10 Dec 2005 18:14:00 +0100 Message-ID: References: <28011CD60FB1724DBA4442E38277F6264A6BD5@hermes.computec.de> <29616.1133795501@sss.pgh.pa.us> In-Reply-To: <29616.1133795501@sss.pgh.pa.us> X-Mailer: Forte Agent 3.1/32.783 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, score=2.15 required=5 tests=[RCVD_IN_NJABL_PROXY=0.327, RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 2.15 X-Spam-Level: ** X-Archive-Number: 200512/273 X-Sequence-Number: 16094 On Mon, 05 Dec 2005 10:11:41 -0500, Tom Lane wrote: >> Correlation -0.0736492 >> Correlation -0.237136 >That has considerable impact on the >estimated cost of an indexscan The cost estimator uses correlationsquared. So all correlations between -0.3 and +0.3 can be considered equal under the assumption that estimation errors of up to 10% are acceptable. Servus Manfred From pgsql-performance-owner@postgresql.org Sun Dec 11 02:12:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1D5EC9DCAE5 for ; Sun, 11 Dec 2005 02:12:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61947-09 for ; Sun, 11 Dec 2005 02:12:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id 8553A9DCAB8 for ; Sun, 11 Dec 2005 02:12:15 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1ElKRM-0007pc-00; Sun, 11 Dec 2005 01:12:08 -0500 To: Ivan Voras Cc: pgsql-performance@postgresql.org Subject: Re: Bitmasks References: <439B0C9A.6010109@fer.hr> In-Reply-To: <439B0C9A.6010109@fer.hr> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 11 Dec 2005 01:12:08 -0500 Message-ID: <87oe3of9hj.fsf@stark.xeocode.com> Lines: 21 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/275 X-Sequence-Number: 16096 Ivan Voras writes: > select * from tt where (flags & 16) != 0; > > I suspected radix trees could be used for this but it seems it doesn't work > that way. You would need a gist index method to make this work. I actually worked on one for a while and had it working. But it wasn't really finished. If there's interest I could finish it up and put it up somewhere like pgfoundry. > If not, is there a way of quickly filtering by such "elements of a set" that > doesn't involve creating 32 boolean fields (which would also need to be pretty > uselessly indexed separately)? You could create 32 partial indexes on some other column which wouldn't really take much more space than a single index on that other column. But that won't let you combine them effectively as a gist index would. -- greg From pgsql-performance-owner@postgresql.org Sun Dec 11 07:53:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BF1F09DCCB0 for ; Sun, 11 Dec 2005 07:53:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24567-02 for ; Sun, 11 Dec 2005 07:53:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35506.mail.mud.yahoo.com (web35506.mail.mud.yahoo.com [66.163.179.130]) by postgresql.org (Postfix) with SMTP id 158CA9DCC85 for ; Sun, 11 Dec 2005 07:53:33 -0400 (AST) Received: (qmail 91043 invoked by uid 60001); 11 Dec 2005 11:53:36 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=vhr5gcqdDf/DMNL4oN9E5zU2Gqyq8hmzsOu6kDCAEdbfqXJmrdfnqPyTe2CNTxa8TYgJVfouy+VJ43RQfd/GpDwl5xx+fgBfNNrVlRtBhjUjY5kq7pn2mKIi30WPGUVa/VOFf1I3/Vw43UpxjvNl7sd/CKbC/MJT0hykZRvDBT8= ; Message-ID: <20051211115336.91041.qmail@web35506.mail.mud.yahoo.com> Received: from [201.3.214.111] by web35506.mail.mud.yahoo.com via HTTP; Sun, 11 Dec 2005 11:53:36 GMT Date: Sun, 11 Dec 2005 11:53:36 +0000 (GMT) From: Carlos Benkendorf Subject: How much expensive are row level statistics? To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-846690964-1134302016=:89985" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.48 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.48 X-Spam-Level: X-Archive-Number: 200512/276 X-Sequence-Number: 16097 --0-846690964-1134302016=:89985 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, I would like to use autovacuum but is not too much expensive collecting row level statistics? Are there some numbers that I could use? Thanks in advance! Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-846690964-1134302016=:89985 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

Hi,
 
I would like to use autovacuum but is not too much expensive collecting row level statistics?
 
Are there some numbers that I could use?
 
Thanks in advance!
 
Benkendorf


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-846690964-1134302016=:89985-- From pgsql-performance-owner@postgresql.org Sun Dec 11 15:44:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A3B99DCAEF for ; Sun, 11 Dec 2005 15:44:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22947-06 for ; Sun, 11 Dec 2005 15:44:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id E4BE09DCAC3 for ; Sun, 11 Dec 2005 15:44:46 -0400 (AST) 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 jBBJii9F083083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 11 Dec 2005 12:44:46 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBBJihI1097345; Sun, 11 Dec 2005 12:44:43 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBBJihAm097344; Sun, 11 Dec 2005 12:44:43 -0700 (MST) (envelope-from mfuhr) Date: Sun, 11 Dec 2005 12:44:43 -0700 From: Michael Fuhr To: Carlos Benkendorf Cc: pgsql-performance@postgresql.org Subject: Re: How much expensive are row level statistics? Message-ID: <20051211194442.GA97174@winnie.fuhr.org> References: <20051211115336.91041.qmail@web35506.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051211115336.91041.qmail@web35506.mail.mud.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.023 required=5 tests=[AWL=0.023] X-Spam-Score: 0.023 X-Spam-Level: X-Archive-Number: 200512/281 X-Sequence-Number: 16102 On Sun, Dec 11, 2005 at 11:53:36AM +0000, Carlos Benkendorf wrote: > I would like to use autovacuum but is not too much expensive > collecting row level statistics? The cost depends on your usage patterns. I did tests with one of my applications and saw no significant performance difference for simple selects, but a series of insert/update/delete operations ran about 30% slower when block- and row-level statistics were enabled versus when the statistics collector was disabled. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Sun Dec 11 16:36:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A0AD19DCAC3 for ; Sun, 11 Dec 2005 16:36:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31146-06 for ; Sun, 11 Dec 2005 16:36:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 8B7EE9DCD40 for ; Sun, 11 Dec 2005 16:36:28 -0400 (AST) 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 jBBKaPZK018629; Sun, 11 Dec 2005 15:36:25 -0500 (EST) To: Edison Azzi cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: Join the same row In-reply-to: <43972DB8.90400@terra.com.br> References: <4395F317.4040806@terra.com.br> <4396AB05.2010806@archonet.com> <43972DB8.90400@terra.com.br> Comments: In-reply-to Edison Azzi message dated "Wed, 07 Dec 2005 16:45:12 -0200" Date: Sun, 11 Dec 2005 15:36:25 -0500 Message-ID: <18628.1134333385@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/282 X-Sequence-Number: 16103 Edison Azzi writes: > You are rigth, the planner will not eliminate the join, see: > select * from cta_pag a, cta_pag p where a.nrlancto=p.nrlancto and > p.nrlancto = 21861; > EXPLAIN: > Nested Loop (cost=0.00..11.48 rows=1 width=816) > -> Index Scan using cta_pag_pk on cta_pag a (cost=0.00..5.74 rows=1 > width=408) > Index Cond: (21861::numeric = nrlancto) > -> Index Scan using cta_pag_pk on cta_pag p (cost=0.00..5.74 rows=1 > width=408) > Index Cond: (nrlancto = 21861::numeric) But do you care? That second fetch of the same row isn't going to cost much of anything, since everything it needs to touch will have been sucked into cache already. I don't really see the case for adding logic to the planner to detect this particular flavor of badly-written query. Notice that the planner *is* managing to propagate the constant comparison to both relations. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Dec 11 16:38:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3C27D9DD44C for ; Sun, 11 Dec 2005 16:38:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30401-08 for ; Sun, 11 Dec 2005 16:38:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 203CB9DCD40 for ; Sun, 11 Dec 2005 16:38:54 -0400 (AST) 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 jBBKcsCd018667; Sun, 11 Dec 2005 15:38:54 -0500 (EST) To: =?iso-8859-1?Q?P=E5l_Stenslet?= cc: pgsql-performance@postgresql.org Subject: Re: Should Oracle outperform PostgreSQL on a complex multidimensional query? In-reply-to: <43D5D5C1F10C384B9AB4AE34A0510EC12B2B66@e1.exie.no> References: <43D5D5C1F10C384B9AB4AE34A0510EC12B2B66@e1.exie.no> Comments: In-reply-to =?iso-8859-1?Q?P=E5l_Stenslet?= message dated "Thu, 08 Dec 2005 12:26:55 +0100" Date: Sun, 11 Dec 2005 15:38:54 -0500 Message-ID: <18666.1134333534@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/283 X-Sequence-Number: 16104 =?iso-8859-1?Q?P=E5l_Stenslet?= writes: > I have established similar conditions for the query in PostgreSQL, and = > it runs in about 30 seconds. Again the CPU utilization is high with no = > noticable I/O. The query plan is of course very different from that of = > Oracle, since PostgreSQL lacks the bitmap index merge operation. Perhaps you should be trying this on PG 8.1? In any case, without specific details of your schema or a look at EXPLAIN ANALYZE results, it's unlikely that anyone is going to have any useful comments for you. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Dec 11 17:15:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 317B19DD558 for ; Sun, 11 Dec 2005 17:15:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38178-08 for ; Sun, 11 Dec 2005 17:15:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id DDFC19DCC99 for ; Sun, 11 Dec 2005 17:15:39 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Sun, 11 Dec 2005 16:15:32 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 11 Dec 2005 16:15:32 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Should Oracle outperform PostgreSQL on a complex Date: Sun, 11 Dec 2005 16:15:14 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01D89B6E@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Should Oracle outperform PostgreSQL on a complex multidimensional query? Thread-Index: AcX76ks0M7ht9LVDRK2tRVq5kQ9ZKACrQlEg From: "Luke Lonergan" To: "=?iso-8859-1?Q?P=E5l_Stenslet?=" , pgsql-performance@postgresql.org cc: "Jie Zhang" X-OriginalArrivalTime: 11 Dec 2005 21:15:32.0442 (UTC) FILETIME=[052063A0:01C5FE98] X-WSS-ID: 6F82497E4CW1607036-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/284 X-Sequence-Number: 16105 Paal,=20 > I'm currently benchmarking several RDBMSs with respect to=20 > analytical query performance on medium-sized multidimensional=20 > data sets. The data set contains 30,000,000 fact rows evenly=20 > distributed in a multidimensional space of 9 hierarchical=20 > dimensions. Each dimension has 8000 members. Can you provide the schema and queries here please? > On Oracle the query runs in less than 3 seconds. All steps=20 > have been taken to ensure that Oracle will apply star schema=20 > optimization to the query (e.g. having loads of single-column=20 > bitmap indexes). The query plan reveals that a bitmap merge=20 > takes place before fact lookup. Postgres currently lacks a bitmap index, though 8.1 has a bitmap = "predicate merge" in 8.1 We have recently completed an Oracle-like bitmap index that we will = contribute shortly to Postgres and it performs very similarly to the = "other commercial databases" version. > I have established similar conditions for the query in=20 > PostgreSQL, and it runs in about 30 seconds. Again the CPU=20 > utilization is high with no noticable I/O. The query plan is=20 > of course very different from that of Oracle, since=20 > PostgreSQL lacks the bitmap index merge operation. It narrows=20 > down the result one dimension at a time, using the=20 > single-column indexes provided. It is not an option for us to=20 > provide multi-column indexes tailored to the specific query,=20 > since we want full freedom as to which dimensions each query will use. This sounds like a very good case for bitmap index, please forward the = schema and queries. > Are these the results we should expect when comparing=20 > PostgreSQL to Oracle for such queries, or are there special=20 > optimization options for PostgreSQL that we may have=20 > overlooked? (I wouldn't be suprised if there are, since I=20 > spent at least 2 full days trying to trigger the star=20 > optimization magic in my Oracle installation.) See above. - Luke From pgsql-performance-owner@postgresql.org Sun Dec 11 22:07:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 70E369DCBE9 for ; Sun, 11 Dec 2005 22:07:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99368-01 for ; Sun, 11 Dec 2005 22:08:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.194]) by postgresql.org (Postfix) with ESMTP id 1A15A9DCBC1 for ; Sun, 11 Dec 2005 22:07:55 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 16so655015nzp for ; Sun, 11 Dec 2005 18:07:59 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=uALwugr/kaW2UVVk58y43zYxj81mTentErZN9yARDiXwdwUYAPPlxixHus4k8MtArjyFscjtsqpZKwedc/q5TcXQasEEKV/qt6N57SWxwDF9dA/cNjM25dZJdNS0y1HD5m9mbdMlBBJYbGRMIKP4GkMLsMp3uNdAUrWoMG+ml5Y= Received: by 10.65.113.8 with SMTP id q8mr142722qbm; Sun, 11 Dec 2005 18:07:59 -0800 (PST) Received: by 10.65.160.12 with HTTP; Sun, 11 Dec 2005 18:07:59 -0800 (PST) Message-ID: Date: Mon, 12 Dec 2005 15:07:59 +1300 From: Mike C To: pgsql-performance@postgresql.org Subject: Table Partitions / Partial Indexes MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5767_5091265.1134353279570" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/285 X-Sequence-Number: 16106 ------=_Part_5767_5091265.1134353279570 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, I've got a table with ~60 Million rows and am having performance problems querying it. Disks are setup as 4x10K SCSI 76GB, RAID 1+0. The table is being inserted into multiple times every second of the day, with no updates and every 2nd day we delete 1/60th of the data (as it becomes old). Vacuum analyze is scheduled to run 3 times a day. Query: select sum(TOTAL_FROM) as TOTAL_IN, sum(TOTAL_TO) as TOTAL_OUT, SOURCE_MAC from PC_TRAFFIC where FK_DEVICE =3D 996 and TRAFFIC_DATE >=3D '2005-10-14 00:00:00' and TRAFFIC_DATE <=3D '2005-11-13 23:59:59' group by SOURCE_MAC order by 1 desc Table: CREATE TABLE PC_TRAFFIC ( PK_PC_TRAFFIC INTEGER NOT NULL, TRAFFIC_DATE TIMESTAMP NOT NULL, SOURCE_MAC CHAR(20) NOT NULL, DEST_IP CHAR(15), DEST_PORT INTEGER, TOTAL_TO DOUBLE PRECISION, TOTAL_FROM DOUBLE PRECISION, FK_DEVICE SMALLINT, PROTOCOL_TYPE SMALLINT ); CREATE INDEX pc_traffic_pkidx ON pc_traffic (pk_pc_traffic); CREATE INDEX pc_traffic_idx3 ON pc_traffic (fk_device, traffic_date); Plan: Sort (cost=3D76650.58..76650.58 rows=3D2 width=3D40) Sort Key: sum(total_from) -> HashAggregate (cost=3D76650.54..76650.57 rows=3D2 width=3D40) -> Bitmap Heap Scan on pc_traffic=20 (cost=3D534.64..76327.03rows=3D43134 width=3D40) Recheck Cond: ((fk_device =3D 996) AND (traffic_date >=3D '2005-10-01 00:00:00'::timestamp without time zone) AND (traffic_date <=3D '2005-10-31 23:59:59'::timestamp without time zone)) -> Bitmap Index Scan on pc_traffic_idx3=20 (cost=3D0.00..534.64rows=3D43134 width=3D0) Index Cond: ((fk_device =3D 996) AND (traffic_date >= =3D '2005-10-01 00:00:00'::timestamp without time zone) AND (traffic_date <=3D '2005-10-31 23:59:59'::timestamp without time zone)) (7 rows) CLUSTER on PC_TRAFFIC_IDX3 gives me significantly improved performance: Sort (cost=3D39886.65..39886.66 rows=3D2 width=3D40) Sort Key: sum(total_from) -> HashAggregate (cost=3D39886.61..39886.64 rows=3D2 width=3D40) -> Index Scan using pc_traffic_idx3 on pc_traffic (cost=3D 0.00..39551.26 rows=3D44714 width=3D40) Index Cond: ((fk_device =3D 996) AND (traffic_date >=3D '2005-10-01 00:00:00'::timestamp without time zone) AND (traffic_date <=3D '2005-10-31 23:59:59'::timestamp without time zone)) (5 rows) However the clustering is only effective on the first shot. Because of the constant usage of the table we can't perform a vacuum full nor any exclusiv= e lock function. Would table partitioning/partial indexes help much? Partitioning on date range doesn't make much sense for this setup, where a typical 1-month query spans both tables (as the billing month for the customer might start midway through a calendar month). Noting that the index scan was quicker than the bitmap, I'm trying to make the indexes smaller/more likely to index scan. I have tried partitioning against fk_device, with 10 child tables. I'm using fk_device % 10 =3D 1, fk_device % 10 =3D 2, fk_device % 10 =3D 3, etc... as the check constraint. CREATE TABLE pc_traffic_0 (CHECK(FK_DEVICE % 10 =3D 0)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_1 (CHECK(FK_DEVICE % 10 =3D 1)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_2 (CHECK(FK_DEVICE % 10 =3D 2)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_3 (CHECK(FK_DEVICE % 10 =3D 3)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_4 (CHECK(FK_DEVICE % 10 =3D 4)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_5 (CHECK(FK_DEVICE % 10 =3D 5)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_6 (CHECK(FK_DEVICE % 10 =3D 6)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_7 (CHECK(FK_DEVICE % 10 =3D 7)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_8 (CHECK(FK_DEVICE % 10 =3D 8)) INHERITS (pc_traffi= c); CREATE TABLE pc_traffic_9 (CHECK(FK_DEVICE % 10 =3D 9)) INHERITS (pc_traffi= c); ... indexes now look like: CREATE INDEX pc_traffic_6_idx3 ON pc_traffic_6 (fk_device, traffic_date); To take advantage of the query my SQL now has to include the mod operation (so the query planner picks up the correct child tables): select sum(TOTAL_FROM) as TOTAL_IN, sum(TOTAL_TO) as TOTAL_OUT, SOURCE_MAC from PC_TRAFFIC where FK_DEVICE =3D 996 and FK_DEVICE % 10 =3D 6 and TRAFFIC_DATE >=3D '2005-10-14 00:00:00' and TRAFFIC_DATE <=3D '2005-11-13 23:59:59' group by SOURCE_MAC order by 1 desc Sorry I would show the plan but I'm rebuilding the dev database atm. It was faster though and did pick up the correct child table. It was also a bitmap scan on the index IIRC. Would I be better off creating many partial indexes instead of multiple tables AND multiple indexes? Am I using a horrid method for partitioning the data? (% 10) Should there be that big of an improvement for multiple tables given that all the data is still stored on the same filesystem? Any advice on table splitting much appreciated. Cheers, Mike C. ------=_Part_5767_5091265.1134353279570 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello,

I've got a table with ~60 Million rows and am having performance problems querying it. Disks are setup as 4x10K SCSI 76GB, RAID 1+0. The table is being inserted into multiple times every second of the day, with no updates and every 2nd day we delete 1/60th of the data (as it becomes old). Vacuum analyze is scheduled to run 3 times a day.

Query:

select sum(TOTAL_FROM) as TOTAL_IN, sum(TOTAL_TO) as TOTAL_OUT, SOURCE_MAC from PC_TRAFFIC where FK_DEVICE =3D 996 and TRAFFIC_DATE >=3D '2005-10-14 00:00:00' and TRAFFIC_DATE <=3D '2005-11-13 23:59:59' group by SOURCE_MAC order by 1 desc

Ta= ble:

CREATE TABLE PC_TRAFFIC (
     PK_PC_TRA= FFIC  INTEGER NOT NULL,
     TRAFFIC_DATE&= nbsp;  TIMESTAMP NOT NULL,
     SOURCE_MAC = ;    CHAR(20) NOT NULL,
     DEST_IP      &nb= sp; CHAR(15),
     DEST_PORT   &= nbsp;  INTEGER,
     TOTAL_TO  &= nbsp;    DOUBLE PRECISION,
     TOTAL= _FROM     DOUBLE PRECISION,
    = FK_DEVICE      SMALLINT,
  &nbs= p;  PROTOCOL_TYPE  SMALLINT
);

CREATE INDEX pc_traffic_pkidx ON pc_traffic (pk_pc_traffic);
CREATE = INDEX pc_traffic_idx3 ON pc_traffic (fk_device, traffic_date);

Plan:=
Sort  (cost=3D76650.58..76650.58 rows=3D2 width=3D40)
&nbs= p;  Sort Key: sum(total_from)
   ->  HashAggregate  (cost=3D76650.54= ..76650.57 rows=3D2 width=3D40)
      &nbs= p;  ->  Bitmap Heap Scan on pc_traffic  (cost=3D534.64..76327.03 rows=3D43134 width=3D40)
=             &nb= sp;  Recheck Cond: ((fk_device =3D 996) AND (traffic_date >=3D '2005-10-01 00:00:00'::timestamp without time zone) AND (traffic_date <=3D '2005-10-31 23:59:59'::timestamp without time zone))
   &= nbsp;           ->  Bitmap Index Scan on pc_traffic_idx3  (cost=3D0.00..534.64 rows=3D43134 width=3D0)
=             &nb= sp;        Index Cond: ((fk_device =3D 996) AND (traffic_date >=3D '2005-10-01 00:00:00'::timestamp without time zone) AND (traffic_date <=3D '2005-10-31 23:59:59'::timestamp without time zone))
(7 rows)

CLU= STER on PC_TRAFFIC_IDX3 gives me significantly improved performance:
Sort  (cost=3D39886.65..39886.66 rows=3D2 width=3D40)
 =   Sort Key: sum(total_from)
   ->  HashAggregate  (cost=3D39886.61= ..39886.64 rows=3D2 width=3D40)
      &nbs= p;  ->  Index Scan using pc_traffic_idx3 on pc_traffic  (cost=3D0.00..39551.26 rows=3D44714 width=3D40)
&n= bsp;            = ;  Index Cond: ((fk_device =3D 996) AND (traffic_date >=3D '2005-10-01 00:00:00'::timestamp without time zone) AND (traffic_date <=3D '2005-10-31 23:59:59'::timestamp without time zone))
(5 rows)

How= ever the clustering is only effective on the first shot. Because of the constant usage of the table we can't perform a vacuum full nor any exclusive lock function.

Would table partitioning/partial indexes help much? Partitioning on date range doesn't make much sense for this setup, where a typical 1-month query spans both tables (as the billing month for the customer might start midway through a calendar month).

Noting that the index scan was quicker than the bitmap, I'm trying to make the indexes smaller/more likely to index scan. I have tried partitioning against fk_device, with 10 child tables. I'm using fk_device % 10 =3D 1, fk_device % 10 =3D 2, fk_device % 10 =3D 3, etc... as the check constraint.

CREATE TABLE pc_traffic_0 (CHECK(FK_= DEVICE % 10 =3D 0)) INHERITS (pc_traffic);
CREATE TABLE pc_traffic_1 (CH= ECK(FK_DEVICE % 10 =3D 1)) INHERITS (pc_traffic);
CREATE TABLE pc_traffi= c_2 (CHECK(FK_DEVICE % 10 =3D 2)) INHERITS (pc_traffic);
CREATE TABLE pc_traffic_3 (CHECK(FK_DEVICE % 10 =3D 3)) INHERITS (pc_tr= affic);
CREATE TABLE pc_traffic_4 (CHECK(FK_DEVICE % 10 =3D 4)) INHERITS= (pc_traffic);
CREATE TABLE pc_traffic_5 (CHECK(FK_DEVICE % 10 =3D 5)) I= NHERITS (pc_traffic);
CREATE TABLE pc_traffic_6 (CHECK(FK_DEVICE % 10 =3D 6)) INHERITS (pc_tr= affic);
CREATE TABLE pc_traffic_7 (CHECK(FK_DEVICE % 10 =3D 7)) INHERITS= (pc_traffic);
CREATE TABLE pc_traffic_8 (CHECK(FK_DEVICE % 10 =3D 8)) I= NHERITS (pc_traffic);
CREATE TABLE pc_traffic_9 (CHECK(FK_DEVICE % 10 =3D 9)) INHERITS (pc_tr= affic);

... indexes now look like:
CREATE INDEX pc_traffic_6_idx3= ON pc_traffic_6 (fk_device, traffic_date);

To take advantage of the query my SQL now has to include the mod operation (so the query planner picks up the correct child tables):

select sum(TOTAL_FROM) as TOTAL_IN, sum(TOTAL_TO) as TOTAL_OUT, SOURCE_MAC from PC_TRAFFIC where FK_DEVICE =3D 996 and FK_DEVICE % 10 =3D 6 and TRAFFIC_DATE >=3D '2005-10-14 00:00:00' and TRAFFIC_DATE <=3D '2005-11-13 23:59:59' group by SOURCE_MAC order by 1 desc

Sorry I would show the plan but I'm rebuilding the dev database atm. It was faster though and did pick up the correct child table. It was also a bitmap scan on the index IIRC.

Would I be better off creating many p= artial indexes instead of multiple tables AND multiple indexes?
Am I usi= ng a horrid method for partitioning the data? (% 10)
Should there be that big of an improvement for multiple tables given that a= ll the data is still stored on the same filesystem?
Any advice on table splitting much appreciated.

Cheers,

Mike= C.

------=_Part_5767_5091265.1134353279570-- From pgsql-performance-owner@postgresql.org Sun Dec 11 22:39:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 885D89DCAC2 for ; Sun, 11 Dec 2005 22:39:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99454-08 for ; Sun, 11 Dec 2005 22:39:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 39B729DCAA9 for ; Sun, 11 Dec 2005 22:39:07 -0400 (AST) 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 jBC2d8lZ020806; Sun, 11 Dec 2005 21:39:08 -0500 (EST) To: Mike C cc: pgsql-performance@postgresql.org Subject: Re: Table Partitions / Partial Indexes In-reply-to: References: Comments: In-reply-to Mike C message dated "Mon, 12 Dec 2005 15:07:59 +1300" Date: Sun, 11 Dec 2005 21:39:08 -0500 Message-ID: <20805.1134355148@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/286 X-Sequence-Number: 16107 Mike C writes: > CLUSTER on PC_TRAFFIC_IDX3 gives me significantly improved performance: How can you tell? Neither of these are EXPLAIN ANALYZE output. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Dec 11 22:49:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B14469DD713 for ; Sun, 11 Dec 2005 22:49:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09646-05 for ; Sun, 11 Dec 2005 22:49:12 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by postgresql.org (Postfix) with ESMTP id 449949DD446 for ; Sun, 11 Dec 2005 22:49:05 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i12so1875954wra for ; Sun, 11 Dec 2005 18:49:10 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=BPHLO7nJKpg5k/uW5pTkk9x3Z4PbCX2rYCAhXERqZah+XJ/d/N07cSiSXpCssEUbztSFQl+6L1FIdiGwr7pDGzT+n4FroCTt3ZMGY9avF6oXB9tWdXYHqccPLMmRieRLPdRhq2AozLZ5l2drxM6z6gvu5aVx0Mmb8boGLghvBco= Received: by 10.65.241.17 with SMTP id t17mr5387253qbr; Sun, 11 Dec 2005 18:49:10 -0800 (PST) Received: by 10.65.160.12 with HTTP; Sun, 11 Dec 2005 18:49:10 -0800 (PST) Message-ID: Date: Mon, 12 Dec 2005 15:49:10 +1300 From: Mike C To: pgsql-performance@postgresql.org Subject: Re: Table Partitions / Partial Indexes In-Reply-To: <20805.1134355148@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6339_20576547.1134355750237" References: <20805.1134355148@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/287 X-Sequence-Number: 16108 ------=_Part_6339_20576547.1134355750237 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 12/12/05, Tom Lane wrote: > > Mike C writes: > > CLUSTER on PC_TRAFFIC_IDX3 gives me significantly improved performance: > > How can you tell? Neither of these are EXPLAIN ANALYZE output. > > regards, tom lane Sorry that's a result of my bad record keeping. I've been keeping records o= f the explain but not the analyze. IIRC the times dropped from ~25 seconds down to ~8 seconds (using analyze). Regards, Mike ------=_Part_6339_20576547.1134355750237 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 12/12/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
smith.not.western= @gmail.com> writes:
> CLUSTER on PC_TRAFFIC_IDX3 gives me sign= ificantly improved performance:

How can you tell?  Neither= of these are EXPLAIN ANALYZE output.

           &= nbsp;           &nbs= p;regards, tom lane


Sorry that's a result of my bad record keeping. I've been keeping records of the explain but not the analyze. IIRC the times dropped from ~25 seconds down to ~8 seconds (using analyze).

Regards,

Mike


------=_Part_6339_20576547.1134355750237-- From pgsql-performance-owner@postgresql.org Mon Dec 12 00:45:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 61B249DCD2C for ; Mon, 12 Dec 2005 00:45:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19782-05 for ; Mon, 12 Dec 2005 00:45:53 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by postgresql.org (Postfix) with ESMTP id 38D539DCBC1 for ; Mon, 12 Dec 2005 00:45:51 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so1331071wri for ; Sun, 11 Dec 2005 20:45:51 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uVus7prEe5YlV//kZEhbANPHssF0XSIVuhVMwBTqWagc2v6GTlx9nC8zSm/aIW/ZchbXTF6pX2nwEW/bEgLnhsxZKsS7P1YDQQ/vuQS6lbB0TNm/oWKSzk/zc8UWECkcyx6xPw4gVw+aQxkxx/R0/Uf94LZ0PCxisr9l0poxFUg= Received: by 10.54.153.18 with SMTP id a18mr276377wre; Sun, 11 Dec 2005 20:45:51 -0800 (PST) Received: by 10.54.86.14 with HTTP; Sun, 11 Dec 2005 20:45:51 -0800 (PST) Message-ID: <33c6269f0512112045u2dfe2393y59df6a89a7a5437a@mail.gmail.com> Date: Sun, 11 Dec 2005 23:45:51 -0500 From: Alex Turner To: Carlos Benkendorf Subject: Re: Is RAID10 the best choice? Cc: pgsql-performance@postgresql.org In-Reply-To: <20051210113423.85996.qmail@web35514.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20051210113423.85996.qmail@web35514.mail.mud.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/288 X-Sequence-Number: 16109 Personaly I would split into two RAID 1s. One for pg_xlog, one for the rest. This gives probably the best performance/reliability combination. Alex. On 12/10/05, Carlos Benkendorf wrote: > Hello, > > I would like to know which is the best configuration to use 4 scsi drives > with a pg 8.1 server. > > Configuring them as a RAID10 set seems a good choice but now I=B4m figuri= ng > another configuration: > SCSI drive 1: operational system > SCSI drive 2: pg_xlog > SCSI drive 3: data > SCSI drive 4: index > > I know the difference between them when you analyze risks of loosing data > but how about performance? > > What should be better? > > Obs.: Our system uses always an index for every access.. > (enable_seqscan(false)) > > Thanks in advance! > > Benkendorf > > ________________________________ > Yahoo! doce lar. Fa=E7a do Yahoo! sua homepage. > > From pgsql-performance-owner@postgresql.org Mon Dec 12 07:44:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2DD179DD8B1 for ; Mon, 12 Dec 2005 07:44:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68611-10 for ; Mon, 12 Dec 2005 07:44:05 -0400 (AST) X-Greylist: delayed 02:47:23.710938 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id BB7479DD879 for ; Mon, 12 Dec 2005 07:43:59 -0400 (AST) Received: from galagonx.fixdial.interware.hu (galagonx.fixdial.interware.hu [195.70.45.31]) by svr2.postgresql.org (Postfix) with ESMTP id 1A61CF0B83 for ; Mon, 12 Dec 2005 08:56:36 +0000 (GMT) Received: from szballa-xp.intra ([172.20.80.67]) by galagonx.fixdial.interware.hu with esmtp (Exim 3.36 #1 (Debian)) id 1EljU1-0000QF-00 for ; Mon, 12 Dec 2005 09:56:33 +0100 Message-ID: <439D3AC6.1090405@confinsystems.com> Date: Mon, 12 Dec 2005 09:54:30 +0100 From: Szabolcs BALLA User-Agent: Mozilla Thunderbird 1.0.5 (Windows/20050711) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: 7.4.7 vs. 8.1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/290 X-Sequence-Number: 16111 Hi, I am ready to install ver. 8.1 to our db server, but I have some questions about it. When I use autovacuum (8.1) is it required to use "vacuum analyze" for maintenance or autovacuum is enough? We have 2 processors (hyperthread) and is it needed to configure the psql to use it or is it enough to configure the kernel base only? Is 8.1 stable? Thanks Szabek From pgsql-performance-owner@postgresql.org Mon Dec 12 05:13:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6E49D9DCAB1 for ; Mon, 12 Dec 2005 05:13:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36004-08 for ; Mon, 12 Dec 2005 05:13:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-out2.blueyonder.co.uk (smtp-out2.blueyonder.co.uk [195.188.213.5]) by postgresql.org (Postfix) with ESMTP id E75029DCAAD for ; Mon, 12 Dec 2005 05:13:41 -0400 (AST) Received: from Eve ([82.44.78.202]) by smtp-out2.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.6713); Mon, 12 Dec 2005 09:14:38 +0000 Reply-To: From: "Andy Ballingall" To: Subject: 2 phase commit: performance implications? Date: Mon, 12 Dec 2005 09:13:55 -0000 Organization: Areyoulocal Ltd. 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.2900.2180 Thread-Index: AcX+/GCDFRLFCEh8QiSSfz0oTQiLgA== Message-ID: X-OriginalArrivalTime: 12 Dec 2005 09:14:38.0175 (UTC) FILETIME=[79FCC6F0:01C5FEFC] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/289 X-Sequence-Number: 16110 Hello, Clearly, I shouldn't actually use these transactions unless I have to, and in cases where I do use it, I'd expect the completion of the transaction to depend on the speed of all participating databases in the transaction, but are there any additional overheads which might come with a significant time penalty that might commonly be overlooked by someone like me with no previous experience with two-phase commit (2PC)? --- The application: I'm evaluating a design for a database scheme where the nation is partitioned into small areas (e.g. 2km squares), each area serviced solely by its own dedicated database. All queries are locally pinpointed, with a limited search radius, and the database enclosing the centre is responsible for executing the query. The only issue is to ensure that a query near a boundary between two adjacent areas behaves as though there was no partitioning. To do this, I'm looking into using 8.1's new 2PC to allow me to selectively copy data inserted near a boundary into the adjacent neighbouring databases, so that this data will appear in boundary searches carried out by the neighbours. The percentage of inserts which are copied into neighbours is intended to be roughly 25%, most of which involve just a single copy. My scheme intends to ensure that all the databases are able to fit entirely in RAM, and in addition, the amount of data in each database will be relatively small (and therefore quick to sift through). Inserted data is 'small', and most of the time, each database is servicing read requests rather than writing, updating or inserting. A single nationwide database would be logically simpler, but in my case, the application is a website, and I want a hardware solution that is cheap to start with, easily extensible, allows a close coupling between the apache server responsible for a region and the database it hits. Any insights gratefully received! Andy Ballingall From pgsql-performance-owner@postgresql.org Mon Dec 12 08:05:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BFF779DCAC1 for ; Mon, 12 Dec 2005 08:04:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77528-02 for ; Mon, 12 Dec 2005 08:05:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 001899DD204 for ; Mon, 12 Dec 2005 08:04:55 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1ElmQL-0003za-1H; Mon, 12 Dec 2005 13:04:57 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1ElmQI-0000sj-00; Mon, 12 Dec 2005 13:04:54 +0100 Date: Mon, 12 Dec 2005 13:04:54 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Cc: Szabolcs BALLA Subject: Re: 7.4.7 vs. 8.1 Message-ID: <20051212120454.GA3356@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org, Szabolcs BALLA References: <439D3AC6.1090405@confinsystems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <439D3AC6.1090405@confinsystems.com> X-Operating-System: Linux 2.6.14 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/291 X-Sequence-Number: 16112 On Mon, Dec 12, 2005 at 09:54:30AM +0100, Szabolcs BALLA wrote: > When I use autovacuum (8.1) is it required to use "vacuum analyze" for > maintenance or autovacuum is enough? autovacuum should be enough. > We have 2 processors (hyperthread) and is it needed to configure the > psql to use it or is it enough to configure the kernel base only? Turn _off_ hyperthreading; it's more likely to do harm than good. > Is 8.1 stable? Yes. Note that 8.1.1 should be out quite soon. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Mon Dec 12 13:48:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 960949DD633 for ; Mon, 12 Dec 2005 13:48:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10572-05 for ; Mon, 12 Dec 2005 13:48:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by postgresql.org (Postfix) with ESMTP id 2720B9DD5A1 for ; Mon, 12 Dec 2005 13:48:49 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 12 Dec 2005 10:25:47 -0300 X-IronPort-AV: i="3.99,243,1131332400"; d="scan'208"; a="774879:sNHT15084776" Received: from alvh.no-ip.org (201.220.122.65) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 438E66E800136FEA; Mon, 12 Dec 2005 10:23:19 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 9C5F7C37221; Mon, 12 Dec 2005 10:23:42 -0300 (CLST) Date: Mon, 12 Dec 2005 10:23:42 -0300 From: Alvaro Herrera To: Michael Fuhr Cc: Carlos Benkendorf , pgsql-performance@postgresql.org Subject: Re: How much expensive are row level statistics? Message-ID: <20051212132342.GE19555@surnet.cl> Mail-Followup-To: Michael Fuhr , Carlos Benkendorf , pgsql-performance@postgresql.org References: <20051211115336.91041.qmail@web35506.mail.mud.yahoo.com> <20051211194442.GA97174@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051211194442.GA97174@winnie.fuhr.org> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.531 required=5 tests=[AWL=-0.388, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.531 X-Spam-Level: * X-Archive-Number: 200512/293 X-Sequence-Number: 16114 Michael Fuhr wrote: > On Sun, Dec 11, 2005 at 11:53:36AM +0000, Carlos Benkendorf wrote: > > I would like to use autovacuum but is not too much expensive > > collecting row level statistics? > > The cost depends on your usage patterns. I did tests with one of > my applications and saw no significant performance difference for > simple selects, but a series of insert/update/delete operations ran > about 30% slower when block- and row-level statistics were enabled > versus when the statistics collector was disabled. This series of i/u/d operations ran with no sleep in between, right? I wouldn't expect a normal OLTP operation to be like this. (If it is you have a serious shortage of hardware ...) -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support From pgsql-performance-owner@postgresql.org Mon Dec 12 12:24:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5C24B9DD559 for ; Mon, 12 Dec 2005 12:24:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64786-05 for ; Mon, 12 Dec 2005 12:24:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay101-f36.bay101.hotmail.com [64.4.56.46]) by postgresql.org (Postfix) with ESMTP id A7C0C9DD55D for ; Mon, 12 Dec 2005 12:24:42 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 12 Dec 2005 08:24:41 -0800 Message-ID: Received: from 64.4.56.200 by by101fd.bay101.hotmail.msn.com with HTTP; Mon, 12 Dec 2005 16:24:40 GMT X-Originating-IP: [84.210.10.106] X-Originating-Email: [bealach_na_bo@hotmail.com] X-Sender: bealach_na_bo@hotmail.com In-Reply-To: <91002EEA-58BC-46F0-9F27-AEC11A50A02C@sitening.com> From: "Bealach-na Bo" To: tfo@sitening.com Cc: pgsql-performance@postgresql.org Subject: Re: Very slow queries - please help Date: Mon, 12 Dec 2005 16:24:40 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 12 Dec 2005 16:24:41.0147 (UTC) FILETIME=[8DC1D8B0:01C5FF38] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200512/292 X-Sequence-Number: 16113 Thanks very much - there are a lot of good articles there... Reading as fast as I can :) Best, Bealach >From: "Thomas F. O'Connell" >To: Bealach-na Bo >CC: PgSQL - Performance >Subject: Re: [PERFORM] Very slow queries - please help >Date: Sun, 4 Dec 2005 00:40:01 -0600 > > >On Nov 24, 2005, at 12:14 PM, Bealach-na Bo wrote: > >>The consensus seems to be that I need more indexes and I also need to >>look into the NOT IN statement as a possible bottleneck. I've >>introduced the indexes which has led to a DRAMATIC change in response >>time. Now I have to experiment with INNER JOIN -> OUTER JOIN >>variations, SET ENABLE_SEQSCAN=OFF. >> >>Forgive me for not mentioning each person individually and by name. >>You have all contributed to confirming what I had suspected (and >>hoped): that *I* have a lot to learn! >> >>I'm attaching table descriptions, the first few lines of top output >>while the queries were running, index lists, sample queries and >>EXPLAIN ANALYSE output BEFORE and AFTER the introduction of the >>indexes. As I said, DRAMATIC :) I notice that the CPU usage does not >>vary very much, it's nearly 100% anyway, but the memory usage drops >>markedly, which is another very nice result of the index introduction. >> >>Any more comments and tips would be very welcome. > >You might find the following resources from techdocs instructive: > >http://techdocs.postgresql.org/redir.php?link=/techdocs/ >pgsqladventuresep2.php > >http://techdocs.postgresql.org/redir.php?link=/techdocs/ >pgsqladventuresep3.php > >These documents provide some guidance into the process of index selection. >It seems like you could still stand to benefit from more indexes based on >your queries, table definitions, and current indexes. > >-- >Thomas F. O'Connell >Database Architecture and Programming >Co-Founder >Sitening, LLC > >http://www.sitening.com/ >110 30th Avenue North, Suite 6 >Nashville, TN 37203-6320 >615-260-0005 (cell) >615-469-5150 (office) >615-469-5151 (fax) > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Mon Dec 12 14:30:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5FE6F9DD442 for ; Mon, 12 Dec 2005 14:30:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20606-02 for ; Mon, 12 Dec 2005 14:30:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id B95FE9DD75F for ; Mon, 12 Dec 2005 14:30:16 -0400 (AST) Received: from 172.16.1.26 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Mon, 12 Dec 2005 13:30:04 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 12 Dec 2005 13:30:04 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Mon, 12 Dec 2005 18:30:04 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 12 Dec 2005 10:30:03 -0800 Subject: Re: Should Oracle outperform PostgreSQL on a complex From: "Luke Lonergan" To: "P=?ISO-8859-1?B?5Q==?=l Stenslet" , pgsql-performance@postgresql.org cc: "Jie Zhang" , "Tom Lane" Message-ID: Thread-Topic: [PERFORM] Should Oracle outperform PostgreSQL on a complex multidimensional query? Thread-Index: AcX76ks0M7ht9LVDRK2tRVq5kQ9ZKACrQlEgABV4NuAAFzb0pw== In-Reply-To: <43D5D5C1F10C384B9AB4AE34A0510EC12B2D58@e1.exie.no> MIME-Version: 1.0 X-OriginalArrivalTime: 12 Dec 2005 18:30:04.0785 (UTC) FILETIME=[1231E610:01C5FF4A] X-WSS-ID: 6F831E262V82198538-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/294 X-Sequence-Number: 16115 Paal, On 12/12/05 2:10 AM, "P=E5l Stenslet" wrote: > Here are the schema details, but first a little introduction: Terrific, very helpful and thanks for both. I wonder why the bitmap scan isn't selected in this query, Tom might have some opinion and suggestions about it. I'd like to run your case with Bizgres and the new bitmap index to see if w= e can increase the selectivity on the query and knock down the times being spent joining. I think the AND bitmap operations should do just that. Can you provide one more thing - either the smalltalk code to generate the csv files or I can provide a web server to upload to (or yours). Thanks! - Luke From pgsql-performance-owner@postgresql.org Mon Dec 12 14:33:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 780759DD555 for ; Mon, 12 Dec 2005 14:33:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20072-05 for ; Mon, 12 Dec 2005 14:33:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 1D41F9DCA95 for ; Mon, 12 Dec 2005 14:33:28 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: How much expensive are row level statistics? Date: Mon, 12 Dec 2005 13:33:27 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] How much expensive are row level statistics? thread-index: AcX+i2Z3e/gV7juTSIGPSlUEUn5x5AAvloJg From: "Merlin Moncure" To: "Michael Fuhr" Cc: , "Carlos Benkendorf" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/295 X-Sequence-Number: 16116 >=20 > On Sun, Dec 11, 2005 at 11:53:36AM +0000, Carlos Benkendorf wrote: > > I would like to use autovacuum but is not too much expensive > > collecting row level statistics? >=20 > The cost depends on your usage patterns. I did tests with one of > my applications and saw no significant performance difference for > simple selects, but a series of insert/update/delete operations ran > about 30% slower when block- and row-level statistics were enabled > versus when the statistics collector was disabled. That approximately confirms my results, except that the penalty may even be a little bit higher in the worst-case scenario. Row level stats hit the hardest if you are doing 1 row at a time operations over a persistent connection. Since my apps inherited this behavior from their COBOL legacy, I keep them off. If your app follows the monolithic query approach to problem solving (pull lots of rows in, edit them on the client, and send them back), penalty is basically zero. =20 Merlin From pgsql-performance-owner@postgresql.org Mon Dec 12 14:42:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 097099DCB13 for ; Mon, 12 Dec 2005 14:42:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22541-03 for ; Mon, 12 Dec 2005 14:42:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id 697399DCA95 for ; Mon, 12 Dec 2005 14:42:46 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 25A60B80D for ; Mon, 12 Dec 2005 13:42:44 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <4399A7B8.2020500@pse-consulting.de> References: <20051209094718.49f7b402.frank@wiles.org> <4399A7B8.2020500@pse-consulting.de> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6AB96CA7-BAD9-4CF5-8EF0-FAB0AEDB9333@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: opinion on disk speed Date: Mon, 12 Dec 2005 13:42:43 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/296 X-Sequence-Number: 16117 On Dec 9, 2005, at 10:50 AM, Andreas Pflug wrote: > Well, if your favourite dealer can't supply you with such common > equipment as 15k drives you should consider changing the dealer. > They don't seem to be aware of db hardware reqirements. Thanks to all for your opinions. I'm definitely sticking with 15k drives like I've done in the past for all my other servers. The reason I considered the 10k was because of the simplicity of ordering from the same vendor. They do offer 15k drives, but at double the capacity I needed (73GB drives) which would make the cost way high and overkill for what I need. From pgsql-performance-owner@postgresql.org Mon Dec 12 14:50:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E86909DD6FA for ; Mon, 12 Dec 2005 14:50:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24608-02 for ; Mon, 12 Dec 2005 14:50:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 150619DD607 for ; Mon, 12 Dec 2005 14:50:18 -0400 (AST) 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 jBCIoGww084426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Dec 2005 11:50:19 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBCIoGQ1060622; Mon, 12 Dec 2005 11:50:16 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBCIoGsW060621; Mon, 12 Dec 2005 11:50:16 -0700 (MST) (envelope-from mfuhr) Date: Mon, 12 Dec 2005 11:50:16 -0700 From: Michael Fuhr To: Merlin Moncure Cc: pgsql-performance@postgresql.org, Carlos Benkendorf Subject: Re: How much expensive are row level statistics? Message-ID: <20051212185016.GA60523@winnie.fuhr.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200512/297 X-Sequence-Number: 16118 On Mon, Dec 12, 2005 at 01:33:27PM -0500, Merlin Moncure wrote: > > The cost depends on your usage patterns. I did tests with one of > > my applications and saw no significant performance difference for > > simple selects, but a series of insert/update/delete operations ran > > about 30% slower when block- and row-level statistics were enabled > > versus when the statistics collector was disabled. > > That approximately confirms my results, except that the penalty may even > be a little bit higher in the worst-case scenario. Row level stats hit > the hardest if you are doing 1 row at a time operations over a > persistent connection. That's basically how the application I tested works: it receives data from a stream and performs whatever insert/update/delete statements are necessary to update the database for each chunk of data. Repeat a few thousand times. -- Michael Fuhr From pgsql-general-owner@postgresql.org Mon Dec 12 16:19:28 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 941EE9DD55C for ; Mon, 12 Dec 2005 16:19:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99153-04 for ; Mon, 12 Dec 2005 16:19:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 4C7BC9DD442 for ; Mon, 12 Dec 2005 16:19:24 -0400 (AST) Received: from shadow.freedomhealthcare.org (mail.freedomhealthcare.org [192.216.106.9]) by svr2.postgresql.org (Postfix) with ESMTP id 53E15F0B41 for ; Mon, 12 Dec 2005 20:19:25 +0000 (GMT) Received: from galvatron.freedomhealthcare.org ([10.1.0.164]) by shadow.freedomhealthcare.org with Microsoft SMTPSVC(5.0.2195.6713); Mon, 12 Dec 2005 15:16:15 -0500 Received: from [10.3.3.21] (unknown [10.3.3.21]) by galvatron.freedomhealthcare.org (Postfix) with ESMTP id 52BE016CB59; Mon, 12 Dec 2005 15:19:21 -0500 (EST) Message-ID: <439DDB49.3000905@freedomhealthcare.org> Date: Mon, 12 Dec 2005 15:19:21 -0500 From: Will Glynn User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mike Rylander Cc: Tom Lane , pgsql general Subject: Re: Memory Leakage Problem References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 12 Dec 2005 20:16:15.0281 (UTC) FILETIME=[E74E7210:01C5FF58] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/589 X-Sequence-Number: 88152 Mike Rylander wrote: >Right, I can definitely see that happening. Some backends are upwards >of 200M, some are just a few since they haven't been touched yet. > > >>Now, multiply that effect by N backends doing this at once, and you'll >>have a very skewed view of what's happening in your system. >> > >Absolutely ... > >>I'd trust the totals reported by free and dstat a lot more than summing >>per-process numbers from ps or top. >> > >And there's the part that's confusing me: the numbers for used memory >produced by free and dstat, after subtracting the buffers/cache >amounts, are /larger/ than those that ps and top report. (top says the >same thing as ps, on the whole.) > I'm seeing the same thing on one of our 8.1 servers. Summing RSS from `ps` or RES from `top` accounts for about 1 GB, but `free` says: total used free shared buffers cached Mem: 4060968 3870328 190640 0 14788 432048 -/+ buffers/cache: 3423492 637476 Swap: 2097144 175680 1921464 That's 3.4 GB/170 MB in RAM/swap, up from 2.7 GB/0 last Thursday, 2.2 GB/0 last Monday, or 1.9 GB after a reboot ten days ago. Stopping Postgres brings down the number, but not all the way -- it drops to about 2.7 GB, even though the next most memory-intensive process is `ntpd` at 5 MB. (Before Postgres starts, there's less than 30 MB of stuff running.) The only way I've found to get this box back to normal is to reboot it. >>>Now, I'm not blaming Pg for the apparent discrepancy in calculated vs. >>>reported-by-free memory usage, but I only noticed this after upgrading >>>to 8.1. >>> >>I don't know of any reason to think that 8.1 would act differently from >>older PG versions in this respect. >> > >Neither can I, which is why I don't blame it. ;) I'm just reporting >when/where I noticed the issue. > I can't offer any explanation for why this server is starting to swap -- where'd the memory go? -- but I know it started after upgrading to PostgreSQL 8.1. I'm not saying it's something in the PostgreSQL code, but this server definitely didn't do this in the months under 7.4. Mike: is your system AMD64, by any chance? The above system is, as is another similar story I heard. --Will Glynn Freedom Healthcare From pgsql-performance-owner@postgresql.org Mon Dec 12 16:37:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E46D49DD564 for ; Mon, 12 Dec 2005 16:37:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05495-09 for ; Mon, 12 Dec 2005 16:37:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 840E19DD558 for ; Mon, 12 Dec 2005 16:37:40 -0400 (AST) 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 jBCKbdsV084515 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Dec 2005 13:37:41 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBCKbcmj061588; Mon, 12 Dec 2005 13:37:38 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBCKbccn061587; Mon, 12 Dec 2005 13:37:38 -0700 (MST) (envelope-from mfuhr) Date: Mon, 12 Dec 2005 13:37:38 -0700 From: Michael Fuhr To: Carlos Benkendorf , pgsql-performance@postgresql.org Subject: Re: How much expensive are row level statistics? Message-ID: <20051212203738.GA61439@winnie.fuhr.org> References: <20051211115336.91041.qmail@web35506.mail.mud.yahoo.com> <20051211194442.GA97174@winnie.fuhr.org> <20051212132342.GE19555@surnet.cl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051212132342.GE19555@surnet.cl> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.019 required=5 tests=[AWL=0.019] X-Spam-Score: 0.019 X-Spam-Level: X-Archive-Number: 200512/298 X-Sequence-Number: 16119 On Mon, Dec 12, 2005 at 10:23:42AM -0300, Alvaro Herrera wrote: > Michael Fuhr wrote: > > The cost depends on your usage patterns. I did tests with one of > > my applications and saw no significant performance difference for > > simple selects, but a series of insert/update/delete operations ran > > about 30% slower when block- and row-level statistics were enabled > > versus when the statistics collector was disabled. > > This series of i/u/d operations ran with no sleep in between, right? > I wouldn't expect a normal OLTP operation to be like this. (If it is > you have a serious shortage of hardware ...) There's no sleeping but there is some client-side processing between groups of i/u/d operations. As I mentioned in another message, the application reads a chunk of data from a stream, does a few i/u/d operations to update the database, and repeats several thousand times. The hardware is old but it's adequate for this application. What kind of overhead would you expect? -- Michael Fuhr From pgsql-general-owner@postgresql.org Mon Dec 12 16:48:50 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CCBDE9DCC26 for ; Mon, 12 Dec 2005 16:48:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08952-01 for ; Mon, 12 Dec 2005 16:48:50 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) by postgresql.org (Postfix) with ESMTP id 2F9929DCB57 for ; Mon, 12 Dec 2005 16:48:46 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 16so846567nzp for ; Mon, 12 Dec 2005 12:48:48 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sH5d4dHbMayCstSE5M2VWsb5+UeZZMqYahRgId2D/aUFcoh5Yp3WW/crWlqJhgFtPtZVcUyVI05Tre+Zzvc4bIfJXaNBAbw0Qo+5DlsB7KYoxw6tRFg/i0f+bZDnSzlQk1P6CZ32PSBUUuKJ3SNrI5qKhjK+7agUpdOCmlKCneQ= Received: by 10.65.186.16 with SMTP id n16mr91852qbp; Mon, 12 Dec 2005 12:48:48 -0800 (PST) Received: by 10.65.235.2 with HTTP; Mon, 12 Dec 2005 12:48:48 -0800 (PST) Message-ID: Date: Mon, 12 Dec 2005 20:48:48 +0000 From: Mike Rylander To: Will Glynn Subject: Re: Memory Leakage Problem Cc: Tom Lane , pgsql general In-Reply-To: <439DDB49.3000905@freedomhealthcare.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/593 X-Sequence-Number: 88156 On 12/12/05, Will Glynn wrote: > Mike Rylander wrote: > > >Right, I can definitely see that happening. Some backends are upwards > >of 200M, some are just a few since they haven't been touched yet. > > > > > >>Now, multiply that effect by N backends doing this at once, and you'll > >>have a very skewed view of what's happening in your system. > >> > > > >Absolutely ... > > > >>I'd trust the totals reported by free and dstat a lot more than summing > >>per-process numbers from ps or top. > >> > > > >And there's the part that's confusing me: the numbers for used memory > >produced by free and dstat, after subtracting the buffers/cache > >amounts, are /larger/ than those that ps and top report. (top says the > >same thing as ps, on the whole.) > > > > I'm seeing the same thing on one of our 8.1 servers. Summing RSS from > `ps` or RES from `top` accounts for about 1 GB, but `free` says: > > total used free shared buffers cached > Mem: 4060968 3870328 190640 0 14788 432048 > -/+ buffers/cache: 3423492 637476 > Swap: 2097144 175680 1921464 > > That's 3.4 GB/170 MB in RAM/swap, up from 2.7 GB/0 last Thursday, 2.2 > GB/0 last Monday, or 1.9 GB after a reboot ten days ago. Stopping > Postgres brings down the number, but not all the way -- it drops to > about 2.7 GB, even though the next most memory-intensive process is > `ntpd` at 5 MB. (Before Postgres starts, there's less than 30 MB of > stuff running.) The only way I've found to get this box back to normal > is to reboot it. > > >>>Now, I'm not blaming Pg for the apparent discrepancy in calculated vs. > >>>reported-by-free memory usage, but I only noticed this after upgrading > >>>to 8.1. > >>> > >>I don't know of any reason to think that 8.1 would act differently from > >>older PG versions in this respect. > >> > > > >Neither can I, which is why I don't blame it. ;) I'm just reporting > >when/where I noticed the issue. > > > I can't offer any explanation for why this server is starting to swap -- > where'd the memory go? -- but I know it started after upgrading to > PostgreSQL 8.1. I'm not saying it's something in the PostgreSQL code, > but this server definitely didn't do this in the months under 7.4. > > Mike: is your system AMD64, by any chance? The above system is, as is > another similar story I heard. > It sure is. Gentoo with kernel version 2.6.12, built for x86_64.=20 Looks like we have a contender for the common factor. :) > --Will Glynn > Freedom Healthcare > -- Mike Rylander mrylander@gmail.com GPLS -- PINES Development Database Developer http://open-ils.org From pgsql-performance-owner@postgresql.org Mon Dec 12 17:59:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 233BB9DCABF for ; Mon, 12 Dec 2005 17:59:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31225-06 for ; Mon, 12 Dec 2005 17:59:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id A3B849DCAB1 for ; Mon, 12 Dec 2005 17:59:08 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 0F69CB81E; Mon, 12 Dec 2005 16:59:10 -0500 (EST) In-Reply-To: <1134069708.24172.8.camel@toonses.gghcwest.com> References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> <1134069708.24172.8.camel@toonses.gghcwest.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <47A29011-9F37-4DA6-A138-0CEE7DCBCBDE@khera.org> Cc: Postgresql Performance Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: opinion on disk speed Date: Mon, 12 Dec 2005 16:59:09 -0500 To: Jeffrey W. Baker X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/299 X-Sequence-Number: 16120 On Dec 8, 2005, at 2:21 PM, Jeffrey W. Baker wrote: > For the write transactions, the speed and size of the DIMM on that LSI > card will matter the most. I believe the max memory on that > adapter is > 512MB. These cost so little that it wouldn't make sense to go with > anything smaller. From where did you get LSI MegaRAID controller with 512MB? The 320-2X doesn't seem to come with more than 128 from the factory. Can you just swap out the DIMM card for higher capacity? From pgsql-performance-owner@postgresql.org Mon Dec 12 18:16:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 709169DCB13 for ; Mon, 12 Dec 2005 18:16:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36716-01 for ; Mon, 12 Dec 2005 18:16:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) by postgresql.org (Postfix) with ESMTP id 7898E9DCABF for ; Mon, 12 Dec 2005 18:16:47 -0400 (AST) Received: from [65.87.16.98] (account jrogers@neopolitan.com HELO [10.0.0.221]) by mx1.neopolitan.us (CommuniGate Pro SMTP 4.2.10) with ESMTP-TLS id 11410725; Mon, 12 Dec 2005 14:16:49 -0800 In-Reply-To: <47A29011-9F37-4DA6-A138-0CEE7DCBCBDE@khera.org> References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> <1134069708.24172.8.camel@toonses.gghcwest.com> <47A29011-9F37-4DA6-A138-0CEE7DCBCBDE@khera.org> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: "J. Andrew Rogers" Subject: Re: opinion on disk speed Date: Mon, 12 Dec 2005 14:16:47 -0800 To: Vivek Khera X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200512/300 X-Sequence-Number: 16121 On Dec 12, 2005, at 1:59 PM, Vivek Khera wrote: > From where did you get LSI MegaRAID controller with 512MB? The > 320-2X doesn't seem to come with more than 128 from the factory. > > Can you just swap out the DIMM card for higher capacity? We've swapped out the DIMMs on MegaRAID controllers. Given the cost of a standard low-end DIMM these days (which is what the LSI controllers use last I checked), it is a very cheap upgrade. Admittedly I've never actually run benchmarks to see if it made a significant difference in practice, but it certainly seems like it should in theory and the upgrade cost is below the noise floor for most database servers. J. Andrew Rogers From pgsql-performance-owner@postgresql.org Mon Dec 12 18:19:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A62FA9DD06E for ; Mon, 12 Dec 2005 18:19:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35156-06 for ; Mon, 12 Dec 2005 18:19:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id 222C79DCD57 for ; Mon, 12 Dec 2005 18:19:38 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id A1F48B80D; Mon, 12 Dec 2005 17:19:40 -0500 (EST) In-Reply-To: References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> <1134069708.24172.8.camel@toonses.gghcwest.com> <47A29011-9F37-4DA6-A138-0CEE7DCBCBDE@khera.org> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: opinion on disk speed Date: Mon, 12 Dec 2005 17:19:39 -0500 To: J. Andrew Rogers X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/301 X-Sequence-Number: 16122 On Dec 12, 2005, at 5:16 PM, J. Andrew Rogers wrote: > We've swapped out the DIMMs on MegaRAID controllers. Given the > cost of a standard low-end DIMM these days (which is what the LSI > controllers use last I checked), it is a very cheap upgrade. What's the max you can put into one of these cards? I haven't been able to find docs on which specific DIMM type they use... Thanks! From pgsql-performance-owner@postgresql.org Mon Dec 12 18:24:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 62B5C9DD447 for ; Mon, 12 Dec 2005 18:24:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34772-09 for ; Mon, 12 Dec 2005 18:24:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 531C39DD1FC for ; Mon, 12 Dec 2005 18:24:31 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id 9E16B15272; Mon, 12 Dec 2005 16:24:33 -0600 (CST) Date: Mon, 12 Dec 2005 16:24:33 -0600 From: "Jim C. Nasby" To: Francisco Reyes Cc: PostgreSQL performance Subject: Re: Small table or partial index? Message-ID: <20051212222433.GH54639@pervasive.com> 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-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/302 X-Sequence-Number: 16123 On Fri, Dec 02, 2005 at 06:28:09PM -0500, Francisco Reyes wrote: > I am in the process of designing a new system. > There will be a long list of words such as > > -word table > word_id integer > word varchar > special boolean > > Some "special" words are used to determine if some work is to be done and > will be what we care the most for one type of operation. Tough call. The key here is the amount of time required to do a join. It also depends on if you need all the special words or not. Your best bet is to try and benchmark both ways. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Mon Dec 12 18:34:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1C5D99DCAB1 for ; Mon, 12 Dec 2005 18:34:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37957-05 for ; Mon, 12 Dec 2005 18:34:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from email.aon.at (warsl404pip8.highway.telekom.at [195.3.96.102]) by postgresql.org (Postfix) with ESMTP id E976B9DD71E for ; Mon, 12 Dec 2005 18:34:18 -0400 (AST) Received: (qmail 2326 invoked from network); 12 Dec 2005 22:34:16 -0000 Received: from m154p029.dipool.highway.telekom.at (HELO Sokrates) ([62.46.9.61]) (envelope-sender ) by smarthub75.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 12 Dec 2005 22:34:16 -0000 From: Manfred Koizar To: Amit V Shah Cc: "'pgsql-performance@postgresql.org'" Subject: Re: Joining 2 tables with 300 million rows Date: Mon, 12 Dec 2005 23:34:12 +0100 Message-ID: <0osrp1hs1s4vokl16l04u62n1pbsn8j77s@4ax.com> References: <0C072E7CC947D511AC9600A0CC7341200256D143@xeon400.tagaudit.com> In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256D143@xeon400.tagaudit.com> X-Mailer: Forte Agent 3.1/32.783 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, score=1.075 required=5 tests=[AWL=1.075] X-Spam-Score: 1.075 X-Spam-Level: * X-Archive-Number: 200512/303 X-Sequence-Number: 16124 On Thu, 8 Dec 2005 11:59:24 -0500 , Amit V Shah wrote: > CONSTRAINT pk_runresult_has_catalogtable PRIMARY KEY >(runresult_id_runresult, catalogtable_id_catalogtable, value) >' -> Index Scan using runresult_has_catalogtable_id_runresult >on runresult_has_catalogtable runresult_has_catalogtable_1 >(cost=0.00..76.65 rows=41 width=8) (actual time=0.015..0.017 rows=1 >loops=30)' >' Index Cond: >(runresult_has_catalogtable_1.runresult_id_runresult = >"outer".runresult_id_runresult)' >' Filter: ((catalogtable_id_catalogtable = 54) AND (value >= 1))' If I were the planner, I'd use the primary key index. You seem to have a redundant(?) index on runresult_has_catalogtable(runresult_id_runresult). Dropping it might help, or it might make things much worse. But at this stage this is pure speculation. Give us more information first. Show us the complete definition (including *all* indices) of all tables occurring in your query. What Postgres version is this? And please post EXPLAIN ANALYSE output of a *slow* query. Servus Manfred From pgsql-performance-owner@postgresql.org Mon Dec 12 19:01:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 94CEE9DD597 for ; Mon, 12 Dec 2005 19:01:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45812-02 for ; Mon, 12 Dec 2005 19:01:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 4E02E9DD5E6 for ; Mon, 12 Dec 2005 19:00:59 -0400 (AST) 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 jBCN11Dh002507; Mon, 12 Dec 2005 18:01:01 -0500 (EST) To: "Merlin Moncure" cc: "Michael Fuhr" , pgsql-performance@postgresql.org, "Carlos Benkendorf" Subject: Re: How much expensive are row level statistics? In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Mon, 12 Dec 2005 13:33:27 -0500" Date: Mon, 12 Dec 2005 18:01:01 -0500 Message-ID: <2506.1134428461@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/304 X-Sequence-Number: 16125 "Merlin Moncure" writes: >> The cost depends on your usage patterns. I did tests with one of >> my applications and saw no significant performance difference for >> simple selects, but a series of insert/update/delete operations ran >> about 30% slower when block- and row-level statistics were enabled >> versus when the statistics collector was disabled. > That approximately confirms my results, except that the penalty may even > be a little bit higher in the worst-case scenario. Row level stats hit > the hardest if you are doing 1 row at a time operations over a > persistent connection. IIRC, the only significant cost from enabling stats is the cost of transmitting the counts to the stats collector, which is a cost basically paid once at each transaction commit. So short transactions will definitely have more overhead than longer ones. Even for a really simple transaction, though, 30% seems high --- the stats code is designed deliberately to minimize the penalty. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 12 19:12:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0A8F89DCAB1 for ; Mon, 12 Dec 2005 19:12:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45894-04 for ; Mon, 12 Dec 2005 19:12:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id A2EAB9DCAB5 for ; Mon, 12 Dec 2005 19:12:04 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 12 Dec 2005 17:12:01 -0600 Subject: Re: opinion on disk speed From: Scott Marlowe To: Vivek Khera Cc: "J.AndrewRogers" , pgsql-performance@postgresql.org In-Reply-To: References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> <1134069708.24172.8.camel@toonses.gghcwest.com> <47A29011-9F37-4DA6-A138-0CEE7DCBCBDE@khera.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1134429121.3587.87.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 12 Dec 2005 17:12:01 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/305 X-Sequence-Number: 16126 On Mon, 2005-12-12 at 16:19, Vivek Khera wrote: > On Dec 12, 2005, at 5:16 PM, J. Andrew Rogers wrote: > > > We've swapped out the DIMMs on MegaRAID controllers. Given the > > cost of a standard low-end DIMM these days (which is what the LSI > > controllers use last I checked), it is a very cheap upgrade. > > What's the max you can put into one of these cards? I haven't been > able to find docs on which specific DIMM type they use... I found the manual for the 4 port U320 SCSI controller, and it listed 256 Meg for single data rate DIMM, and 512 Meg for DDR DIMM. This was on the lsi at: http://www.lsilogic.com/files/docs/techdocs/storage_stand_prod/RAIDpage/mr_320_ug.pdf I believe. They've got a new one coming out, that's SAS, like SCSI on SATA or something. It comes with 256Meg, removeable, but doesn't yet say what the max size it. I'd love to have one of these that could hold a couple of gigs for a TPC type test. From pgsql-performance-owner@postgresql.org Mon Dec 12 19:17:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0B10A9DCAB1 for ; Mon, 12 Dec 2005 19:17:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47517-04 for ; Mon, 12 Dec 2005 19:17:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) by postgresql.org (Postfix) with ESMTP id BAB659DD562 for ; Mon, 12 Dec 2005 19:17:49 -0400 (AST) Received: from [65.87.16.98] (account jrogers@neopolitan.com HELO [10.0.0.221]) by mx1.neopolitan.us (CommuniGate Pro SMTP 4.2.10) with ESMTP-TLS id 11411112; Mon, 12 Dec 2005 15:17:51 -0800 In-Reply-To: References: <3E73FEF8-DD9D-4DF7-9BB1-C020A4186296@khera.org> <1134069708.24172.8.camel@toonses.gghcwest.com> <47A29011-9F37-4DA6-A138-0CEE7DCBCBDE@khera.org> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <71739A0D-1F86-4092-8AE2-AE58C03B4729@neopolitan.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: "J. Andrew Rogers" Subject: Re: opinion on disk speed Date: Mon, 12 Dec 2005 15:17:50 -0800 To: Vivek Khera X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.439 required=5 tests=[AWL=-0.480, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.439 X-Spam-Level: * X-Archive-Number: 200512/306 X-Sequence-Number: 16127 On Dec 12, 2005, at 2:19 PM, Vivek Khera wrote: > On Dec 12, 2005, at 5:16 PM, J. Andrew Rogers wrote: > >> We've swapped out the DIMMs on MegaRAID controllers. Given the >> cost of a standard low-end DIMM these days (which is what the LSI >> controllers use last I checked), it is a very cheap upgrade. > > What's the max you can put into one of these cards? I haven't been > able to find docs on which specific DIMM type they use... Table 3.7 in the MegaRAID Adapter User's Guide has the specs and limits for various controllers. For the 320-2x, the limit is 512MB of PC100 ECC RAM. J. Andrew Rogers From pgsql-performance-owner@postgresql.org Mon Dec 12 21:07:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1EE159DCB55 for ; Mon, 12 Dec 2005 21:07:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69972-01 for ; Mon, 12 Dec 2005 21:07:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id A1E699DCB34 for ; Mon, 12 Dec 2005 21:07:52 -0400 (AST) 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 jBD17q8o084716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Dec 2005 18:07:55 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBD17q36063520; Mon, 12 Dec 2005 18:07:52 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBD17p9U063519; Mon, 12 Dec 2005 18:07:51 -0700 (MST) (envelope-from mfuhr) Date: Mon, 12 Dec 2005 18:07:51 -0700 From: Michael Fuhr To: Tom Lane Cc: Merlin Moncure , pgsql-performance@postgresql.org, Carlos Benkendorf Subject: Re: How much expensive are row level statistics? Message-ID: <20051213010751.GA63416@winnie.fuhr.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> <2506.1134428461@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2506.1134428461@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.019 required=5 tests=[AWL=0.019] X-Spam-Score: 0.019 X-Spam-Level: X-Archive-Number: 200512/307 X-Sequence-Number: 16128 On Mon, Dec 12, 2005 at 06:01:01PM -0500, Tom Lane wrote: > IIRC, the only significant cost from enabling stats is the cost of > transmitting the counts to the stats collector, which is a cost > basically paid once at each transaction commit. So short transactions > will definitely have more overhead than longer ones. Even for a really > simple transaction, though, 30% seems high --- the stats code is > designed deliberately to minimize the penalty. Now there goes Tom with his skeptical eye again, and here comes me saying "oops" again. Further tests show that for this application the killer is stats_command_string, not stats_block_level or stats_row_level. Here are timings for the same set of operations (thousands of insert, update, and delete statements in one transaction) run under various settings: stats_command_string = off stats_block_level = off stats_row_level = off time: 2:09.46 stats_command_string = off stats_block_level = on stats_row_level = off time: 2:12.28 stats_command_string = off stats_block_level = on stats_row_level = on time: 2:14.38 stats_command_string = on stats_block_level = off stats_row_level = off time: 2:50.58 stats_command_string = on stats_block_level = on stats_row_level = on time: 2:53.76 [Wanders off, swearing that he ran these tests before and saw higher penalties for block- and row-level statistics.] -- Michael Fuhr From pgsql-performance-owner@postgresql.org Mon Dec 12 23:20:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 86B709DCCC2 for ; Mon, 12 Dec 2005 23:20:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96604-08 for ; Mon, 12 Dec 2005 23:20:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 64A3A9DCC87 for ; Mon, 12 Dec 2005 23:20:41 -0400 (AST) 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 jBD3KjYY001668; Mon, 12 Dec 2005 22:20:45 -0500 (EST) To: Michael Fuhr cc: Merlin Moncure , pgsql-performance@postgresql.org, Carlos Benkendorf Subject: Re: How much expensive are row level statistics? In-reply-to: <20051213010751.GA63416@winnie.fuhr.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> <2506.1134428461@sss.pgh.pa.us> <20051213010751.GA63416@winnie.fuhr.org> Comments: In-reply-to Michael Fuhr message dated "Mon, 12 Dec 2005 18:07:51 -0700" Date: Mon, 12 Dec 2005 22:20:45 -0500 Message-ID: <1667.1134444045@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/308 X-Sequence-Number: 16129 Michael Fuhr writes: > Further tests show that for this application > the killer is stats_command_string, not stats_block_level or > stats_row_level. I tried it with pgbench -c 10, and got these results: 41% reduction in TPS rate for stats_command_string 9% reduction in TPS rate for stats_block/row_level (any combination) strace'ing a backend confirms my belief that stats_block/row_level send just one stats message per transaction (at least for the relatively small number of tables touched per transaction by pgbench). However stats_command_string sends 14(!) --- there are seven commands per pgbench transaction and each results in sending a message and later an message. Given the rather lackadaisical way in which the stats collector makes the data available, it seems like the backends are being much too enthusiastic about posting their stats_command_string status immediately. Might be worth thinking about how to cut back the overhead by suppressing some of these messages. regards, tom lane From pgsql-general-owner@postgresql.org Tue Dec 13 00:17:57 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6D6079DCCC2 for ; Tue, 13 Dec 2005 00:17:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05877-09 for ; Tue, 13 Dec 2005 00:17:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 626599DCC99 for ; Tue, 13 Dec 2005 00:17:55 -0400 (AST) 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 jBD4Hp4H002216; Mon, 12 Dec 2005 23:17:51 -0500 (EST) To: Mike Rylander cc: Will Glynn , pgsql general Subject: Re: Memory Leakage Problem In-reply-to: References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> Comments: In-reply-to Mike Rylander message dated "Mon, 12 Dec 2005 20:48:48 +0000" Date: Mon, 12 Dec 2005 23:17:51 -0500 Message-ID: <2215.1134447471@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/615 X-Sequence-Number: 88178 Mike Rylander writes: > On 12/12/05, Will Glynn wrote: >> Mike: is your system AMD64, by any chance? The above system is, as is >> another similar story I heard. > It sure is. Gentoo with kernel version 2.6.12, built for x86_64. > Looks like we have a contender for the common factor. :) Please tell me you're *not* running a production database on Gentoo. regards, tom lane From pgsql-general-owner@postgresql.org Tue Dec 13 00:31:55 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 47B7C9DCCC2 for ; Tue, 13 Dec 2005 00:31:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13906-08 for ; Tue, 13 Dec 2005 00:31:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by postgresql.org (Postfix) with ESMTP id D11869DCC99 for ; Tue, 13 Dec 2005 00:31:52 -0400 (AST) Received: from [192.168.1.102] (or-67-76-146-141.sta.sprint-hsd.net [67.76.146.141]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id jBD4Op0h015347; Mon, 12 Dec 2005 20:24:53 -0800 Message-ID: <439E4EB8.5000301@commandprompt.com> Date: Mon, 12 Dec 2005 20:31:52 -0800 From: "Joshua D. Drake" User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: Tom Lane CC: Mike Rylander , Will Glynn , pgsql general Subject: Re: Memory Leakage Problem References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <2215.1134447471@sss.pgh.pa.us> In-Reply-To: <2215.1134447471@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Mon, 12 Dec 2005 20:24:54 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/616 X-Sequence-Number: 88179 > >> It sure is. Gentoo with kernel version 2.6.12, built for x86_64. >> Looks like we have a contender for the common factor. :) >> > > Please tell me you're *not* running a production database on Gentoo. > > > regards, tom lane > You don't even want to know how many companies I know that are doing this very thing and no, it was not my suggestion. Joshua D. Drake > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-general-owner@postgresql.org Tue Dec 13 03:36:59 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B58629DDCB8 for ; Tue, 13 Dec 2005 03:36:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45478-10 for ; Tue, 13 Dec 2005 03:36:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mercury.wardbrook.com (host-84-9-98-118.bulldogdsl.com [84.9.98.118]) by postgresql.org (Postfix) with ESMTP id E8B629DDCB7 for ; Tue, 13 Dec 2005 03:36:52 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mercury.wardbrook.com (Postfix) with ESMTP id 18320532EB; Tue, 13 Dec 2005 07:34:07 +0000 (GMT) Received: by mercury.wardbrook.com (Postfix, from userid 505) id E246D532EF; Tue, 13 Dec 2005 07:34:05 +0000 (GMT) Received: from [192.168.0.64] (unknown [192.168.0.1]) by mercury.wardbrook.com (Postfix) with ESMTP id 87E3E532EB; Tue, 13 Dec 2005 07:34:04 +0000 (GMT) Message-ID: <439E7B7A.9080205@wardbrook.com> Date: Tue, 13 Dec 2005 07:42:50 +0000 From: John Sidney-Woollett User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Will Glynn Cc: Mike Rylander , Tom Lane , pgsql general Subject: Re: Memory Leakage Problem References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> In-Reply-To: <439DDB49.3000905@freedomhealthcare.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS 0.3.12 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/618 X-Sequence-Number: 88181 We're seeing memory problems on one of our postgres databases. We're using 7.4.6, and I suspect the kernel version is a key factor with this problem. One running under Redhat Linux 2.4.18-14smp #1 SMP and the other Debian Linux 2.6.8.1-4-686-smp #1 SMP The second Debian server is a replicated slave using Slony. We NEVER see any problems on the "older" Redhat (our master) DB, whereas the Debian slave database requires slony and postgres to be stopped every 2-3 weeks. This server just consumes more and more memory until it goes swap crazy and the load averages start jumping through the roof. Stopping the two services restores the server to some sort of normality - the load averages drop dramatically and remain low. But the memory is only fully recovered by a server reboot. Over time memory gets used up, until you get to the point where those services require another stop and start. Just my 2 cents... John Will Glynn wrote: > Mike Rylander wrote: > >> Right, I can definitely see that happening. Some backends are upwards >> of 200M, some are just a few since they haven't been touched yet. >> >> >>> Now, multiply that effect by N backends doing this at once, and you'll >>> have a very skewed view of what's happening in your system. >>> >> >> Absolutely ... >> >>> I'd trust the totals reported by free and dstat a lot more than summing >>> per-process numbers from ps or top. >>> >> >> And there's the part that's confusing me: the numbers for used memory >> produced by free and dstat, after subtracting the buffers/cache >> amounts, are /larger/ than those that ps and top report. (top says the >> same thing as ps, on the whole.) >> > > I'm seeing the same thing on one of our 8.1 servers. Summing RSS from > `ps` or RES from `top` accounts for about 1 GB, but `free` says: > > total used free shared buffers cached > Mem: 4060968 3870328 190640 0 14788 432048 > -/+ buffers/cache: 3423492 637476 > Swap: 2097144 175680 1921464 > > That's 3.4 GB/170 MB in RAM/swap, up from 2.7 GB/0 last Thursday, 2.2 > GB/0 last Monday, or 1.9 GB after a reboot ten days ago. Stopping > Postgres brings down the number, but not all the way -- it drops to > about 2.7 GB, even though the next most memory-intensive process is > `ntpd` at 5 MB. (Before Postgres starts, there's less than 30 MB of > stuff running.) The only way I've found to get this box back to normal > is to reboot it. > >>>> Now, I'm not blaming Pg for the apparent discrepancy in calculated vs. >>>> reported-by-free memory usage, but I only noticed this after upgrading >>>> to 8.1. >>>> >>> I don't know of any reason to think that 8.1 would act differently from >>> older PG versions in this respect. >>> >> >> Neither can I, which is why I don't blame it. ;) I'm just reporting >> when/where I noticed the issue. >> > I can't offer any explanation for why this server is starting to swap -- > where'd the memory go? -- but I know it started after upgrading to > PostgreSQL 8.1. I'm not saying it's something in the PostgreSQL code, > but this server definitely didn't do this in the months under 7.4. > > Mike: is your system AMD64, by any chance? The above system is, as is > another similar story I heard. > > --Will Glynn > Freedom Healthcare > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match From pgsql-general-owner@postgresql.org Tue Dec 13 03:47:54 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 95DBA9DDC10 for ; Tue, 13 Dec 2005 03:47:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50506-07 for ; Tue, 13 Dec 2005 03:47:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 025499DDC00 for ; Tue, 13 Dec 2005 03:47:49 -0400 (AST) 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 jBD7lhLa003667; Tue, 13 Dec 2005 02:47:43 -0500 (EST) To: John Sidney-Woollett cc: Will Glynn , Mike Rylander , pgsql general Subject: Re: Memory Leakage Problem In-reply-to: <439E7B7A.9080205@wardbrook.com> References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> Comments: In-reply-to John Sidney-Woollett message dated "Tue, 13 Dec 2005 07:42:50 +0000" Date: Tue, 13 Dec 2005 02:47:43 -0500 Message-ID: <3666.1134460063@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/619 X-Sequence-Number: 88182 John Sidney-Woollett writes: > This server just consumes more and more memory until it goes swap crazy > and the load averages start jumping through the roof. *What* is consuming memory, exactly --- which processes? regards, tom lane From pgsql-general-owner@postgresql.org Tue Dec 13 03:59:16 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A9F5B9DC80E for ; Tue, 13 Dec 2005 03:59:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54160-08 for ; Tue, 13 Dec 2005 03:59:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mercury.wardbrook.com (host-84-9-98-118.bulldogdsl.com [84.9.98.118]) by postgresql.org (Postfix) with ESMTP id 4738B9DC80C for ; Tue, 13 Dec 2005 03:59:07 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mercury.wardbrook.com (Postfix) with ESMTP id 377F7532EB; Tue, 13 Dec 2005 07:56:22 +0000 (GMT) Received: by mercury.wardbrook.com (Postfix, from userid 505) id 0DC4B532EF; Tue, 13 Dec 2005 07:56:21 +0000 (GMT) Received: from [192.168.0.64] (unknown [192.168.0.1]) by mercury.wardbrook.com (Postfix) with ESMTP id B9928532EB; Tue, 13 Dec 2005 07:56:19 +0000 (GMT) Message-ID: <439E80B1.8030800@wardbrook.com> Date: Tue, 13 Dec 2005 08:05:05 +0000 From: John Sidney-Woollett User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql general Subject: Re: Memory Leakage Problem References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> <3666.1134460063@sss.pgh.pa.us> In-Reply-To: <3666.1134460063@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS 0.3.12 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/621 X-Sequence-Number: 88184 Sorry but I don't know how to determine that. We stopped and started postgres yesterday so the server is behaving well at the moment. top shows top - 07:51:48 up 34 days, 6 min, 1 user, load average: 0.00, 0.02, 0.00 Tasks: 85 total, 1 running, 84 sleeping, 0 stopped, 0 zombie Cpu(s): 0.6% us, 0.2% sy, 0.0% ni, 99.1% id, 0.2% wa, 0.0% hi, 0.0% si Mem: 1035612k total, 1030380k used, 5232k free, 48256k buffers Swap: 497972k total, 122388k used, 375584k free, 32716k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 27852 postgres 16 0 17020 11m 14m S 1.0 1.2 18:00.34 postmaster 27821 postgres 15 0 16236 6120 14m S 0.3 0.6 1:30.68 postmaster 4367 root 16 0 2040 1036 1820 R 0.3 0.1 0:00.05 top 1 root 16 0 1492 148 1340 S 0.0 0.0 0:04.75 init 2 root RT 0 0 0 0 S 0.0 0.0 0:02.00 migration/0 3 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0 4 root RT 0 0 0 0 S 0.0 0.0 0:04.78 migration/1 5 root 34 19 0 0 0 S 0.0 0.0 0:00.04 ksoftirqd/1 6 root RT 0 0 0 0 S 0.0 0.0 0:04.58 migration/2 7 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2 8 root RT 0 0 0 0 S 0.0 0.0 0:21.28 migration/3 9 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/3 10 root 5 -10 0 0 0 S 0.0 0.0 0:00.14 events/0 11 root 5 -10 0 0 0 S 0.0 0.0 0:00.04 events/1 12 root 5 -10 0 0 0 S 0.0 0.0 0:00.01 events/2 13 root 5 -10 0 0 0 S 0.0 0.0 0:00.00 events/3 14 root 8 -10 0 0 0 S 0.0 0.0 0:00.00 khelper This server only has postgres and slon running on it. There is also postfix but it is only used to relay emails from the root account to another server - it isn't really doing anything (I hope). ps shows UID PID PPID C STIME TIME CMD root 1 0 0 Nov09 00:00:04 init [2] root 2 1 0 Nov09 00:00:02 [migration/0] root 3 1 0 Nov09 00:00:00 [ksoftirqd/0] root 4 1 0 Nov09 00:00:04 [migration/1] root 5 1 0 Nov09 00:00:00 [ksoftirqd/1] root 6 1 0 Nov09 00:00:04 [migration/2] root 7 1 0 Nov09 00:00:00 [ksoftirqd/2] root 8 1 0 Nov09 00:00:21 [migration/3] root 9 1 0 Nov09 00:00:00 [ksoftirqd/3] root 10 1 0 Nov09 00:00:00 [events/0] root 11 1 0 Nov09 00:00:00 [events/1] root 12 1 0 Nov09 00:00:00 [events/2] root 13 1 0 Nov09 00:00:00 [events/3] root 14 11 0 Nov09 00:00:00 [khelper] root 15 10 0 Nov09 00:00:00 [kacpid] root 67 11 0 Nov09 00:17:10 [kblockd/0] root 68 10 0 Nov09 00:00:52 [kblockd/1] root 69 11 0 Nov09 00:00:07 [kblockd/2] root 70 10 0 Nov09 00:00:09 [kblockd/3] root 82 1 1 Nov09 09:08:14 [kswapd0] root 83 11 0 Nov09 00:00:00 [aio/0] root 84 10 0 Nov09 00:00:00 [aio/1] root 85 11 0 Nov09 00:00:00 [aio/2] root 86 10 0 Nov09 00:00:00 [aio/3] root 222 1 0 Nov09 00:00:00 [kseriod] root 245 1 0 Nov09 00:00:00 [scsi_eh_0] root 278 1 0 Nov09 00:00:37 [kjournald] root 359 1 0 Nov09 00:00:00 udevd root 1226 1 0 Nov09 00:00:00 [kjournald] root 1229 10 0 Nov09 00:00:16 [reiserfs/0] root 1230 11 0 Nov09 00:00:08 [reiserfs/1] root 1231 10 0 Nov09 00:00:00 [reiserfs/2] root 1232 11 0 Nov09 00:00:00 [reiserfs/3] root 1233 1 0 Nov09 00:00:00 [kjournald] root 1234 1 0 Nov09 00:00:13 [kjournald] root 1235 1 0 Nov09 00:00:24 [kjournald] root 1583 1 0 Nov09 00:00:00 [pciehpd_event] root 1598 1 0 Nov09 00:00:00 [shpchpd_event] root 1669 1 0 Nov09 00:00:00 [khubd] daemon 2461 1 0 Nov09 00:00:00 /sbin/portmap root 2726 1 0 Nov09 00:00:10 /sbin/syslogd root 2737 1 0 Nov09 00:00:00 /sbin/klogd message 2768 1 0 Nov09 00:00:00 /usr/bin/dbus-daemon-1 --system root 2802 1 0 Nov09 00:04:38 [nfsd] root 2804 1 0 Nov09 00:03:32 [nfsd] root 2803 1 0 Nov09 00:04:58 [nfsd] root 2806 1 0 Nov09 00:04:40 [nfsd] root 2807 1 0 Nov09 00:04:41 [nfsd] root 2805 1 0 Nov09 00:03:51 [nfsd] root 2808 1 0 Nov09 00:04:36 [nfsd] root 2809 1 0 Nov09 00:03:20 [nfsd] root 2811 1 0 Nov09 00:00:00 [lockd] root 2812 1 0 Nov09 00:00:00 [rpciod] root 2815 1 0 Nov09 00:00:00 /usr/sbin/rpc.mountd root 2933 1 0 Nov09 00:00:17 /usr/lib/postfix/master postfix 2938 2933 0 Nov09 00:00:11 qmgr -l -t fifo -u -c root 2951 1 0 Nov09 00:00:09 /usr/sbin/sshd root 2968 1 0 Nov09 00:00:00 /sbin/rpc.statd root 2969 1 0 Nov09 00:01:41 /usr/sbin/xinetd -pidfile /var/r root 2980 1 0 Nov09 00:00:07 /usr/sbin/ntpd -p /var/run/ntpd. root 2991 1 0 Nov09 00:00:01 /sbin/mdadm -F -m root -s daemon 3002 1 0 Nov09 00:00:00 /usr/sbin/atd root 3013 1 0 Nov09 00:00:03 /usr/sbin/cron root 3029 1 0 Nov09 00:00:00 /sbin/getty 38400 tty1 root 3031 1 0 Nov09 00:00:00 /sbin/getty 38400 tty2 root 3032 1 0 Nov09 00:00:00 /sbin/getty 38400 tty3 root 3033 1 0 Nov09 00:00:00 /sbin/getty 38400 tty4 root 3034 1 0 Nov09 00:00:00 /sbin/getty 38400 tty5 root 3035 1 0 Nov09 00:00:00 /sbin/getty 38400 tty6 postgres 27806 1 0 Dec12 00:00:00 /usr/local/pgsql/bin/postmaster postgres 27809 27806 0 Dec12 00:00:00 postgres: stats buffer process postgres 27810 27809 0 Dec12 00:00:00 postgres: stats collector proces postgres 27821 27806 0 Dec12 00:01:30 postgres: postgres bp_live postgres 27842 1 0 Dec12 00:00:00 /usr/local/pgsql/bin/slon -d 1 b postgres 27844 27842 0 Dec12 00:00:00 /usr/local/pgsql/bin/slon -d 1 b postgres 27847 27806 0 Dec12 00:00:50 postgres: postgres bp_live postgres 27852 27806 1 Dec12 00:18:00 postgres: postgres bp_live postgres 27853 27806 0 Dec12 00:00:33 postgres: postgres bp_live postgres 27854 27806 0 Dec12 00:00:18 postgres: postgres bp_live root 32735 10 0 05:35 00:00:00 [pdflush] postfix 2894 2933 0 07:04 00:00:00 pickup -l -t fifo -u -c root 3853 10 0 07:37 00:00:00 [pdflush] All I know is that stopping postgres brings the server back to normality. Stopping slon on its own is not enough. John Tom Lane wrote: > John Sidney-Woollett writes: > >>This server just consumes more and more memory until it goes swap crazy >>and the load averages start jumping through the roof. > > > *What* is consuming memory, exactly --- which processes? > > regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 13 07:37:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2F8D69DC81E for ; Tue, 13 Dec 2005 07:37:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38088-01 for ; Tue, 13 Dec 2005 07:37:19 -0400 (AST) X-Greylist: delayed 03:16:20.941163 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 28B8D9DC836 for ; Tue, 13 Dec 2005 07:37:14 -0400 (AST) Received: from mercure.sigma.fr (mercure.sigma.fr [195.25.81.9]) by svr2.postgresql.org (Postfix) with ESMTP id 29F82F0B89 for ; Tue, 13 Dec 2005 08:20:53 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mercure.sigma.fr (Postfix) with ESMTP id 25657911E for ; Tue, 13 Dec 2005 09:20:48 +0100 (CET) Received: from mercure.sigma.fr ([127.0.0.1]) by localhost (mercure-1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29971-09 for ; Tue, 13 Dec 2005 09:20:47 +0100 (CET) Received: from delpiv3000-124l (unknown [89.195.0.5]) by mercure.sigma.fr (Postfix) with ESMTP id E6406909F for ; Tue, 13 Dec 2005 09:20:47 +0100 (CET) Content-class: urn:content-classes:message From: Marc Cousin Organization: Sigma Informatique To: pgsql-performance@postgresql.org Subject: partitioning Date: Tue, 13 Dec 2005 09:20:47 +0100 User-Agent: KMail/1.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_fRonD9okC9edavU" Message-Id: <200512130920.47583.mcousin@sigma.fr> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at sigma.fr X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.811 required=5 tests=[RCVD_IN_WHOIS_BOGONS=1.811, UPPERCASE_25_50=0] X-Spam-Score: 1.811 X-Spam-Level: * X-Archive-Number: 200512/309 X-Sequence-Number: 16130 This is a multi-part message in MIME format. --Boundary-00=_fRonD9okC9edavU Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I've been working on trying to partition a big table (I've never partitioned a table in any other database till now). Everything went ok, except one query that didn't work afterwards. I've put the partition description, indexes, etc ..., and the explain plan attached. The query is extremely fast without partition (index scan backards on the primary key) The query is : "select * from logs order by id desc limit 100;" id is the primary key. It is indexed on all partitions. But the explain plan does full table scan on all partitions. While I think I understand why it is doing this plan right now, is there something that could be done to optimize this case ? Or put a warning in the docs about this kind of behaviour. I guess normally someone would partition to get faster queries :) Anyway, I thought I should mention this, as it has been quite a surprise. --Boundary-00=_fRonD9okC9edavU Content-Type: text/plain; charset="iso-8859-1"; name="partition.txt" Content-Transfer-Encoding: base64 Content-Description: partition.txt Content-Disposition: attachment; filename="partition.txt" Q1JFQVRFIFRBQkxFIGxvZ3NfMTUwIChDSEVDSyAoIGlkX21hY2hpbmUgPSAxNTApKSBJTkhFUklU UyAobG9ncykgVEFCTEVTUEFDRSBkYXRhX2xvZ3M7DQpDUkVBVEUgVEFCTEUgbG9nc18xNjMgKENI RUNLICggaWRfbWFjaGluZSA9IDE2MykpIElOSEVSSVRTIChsb2dzKSBUQUJMRVNQQUNFIGRhdGFf bG9nczsNCkNSRUFURSBUQUJMRSBsb2dzXzI4OSAoQ0hFQ0sgKCBpZF9tYWNoaW5lID0gMjg5KSkg SU5IRVJJVFMgKGxvZ3MpIFRBQkxFU1BBQ0UgZGF0YV9sb2dzOw0KQ1JFQVRFIFRBQkxFIGxvZ3Nf MzE5IChDSEVDSyAoIGlkX21hY2hpbmUgPSAzMTkpKSBJTkhFUklUUyAobG9ncykgVEFCTEVTUEFD RSBkYXRhX2xvZ3M7DQpDUkVBVEUgVEFCTEUgbG9nc18yMzggKENIRUNLICggaWRfbWFjaGluZSA9 IDIzOCkpIElOSEVSSVRTIChsb2dzKSBUQUJMRVNQQUNFIGRhdGFfbG9nczsNCkNSRUFURSBUQUJM RSBsb2dzXzE0OCAoQ0hFQ0sgKCBpZF9tYWNoaW5lID0gMTQ4KSkgSU5IRVJJVFMgKGxvZ3MpIFRB QkxFU1BBQ0UgZGF0YV9sb2dzOw0KQ1JFQVRFIFRBQkxFIGxvZ3NfMTc2IChDSEVDSyAoIGlkX21h Y2hpbmUgPSAxNzYpKSBJTkhFUklUUyAobG9ncykgVEFCTEVTUEFDRSBkYXRhX2xvZ3M7DQpDUkVB VEUgVEFCTEUgbG9nc18xNjQgKENIRUNLICggaWRfbWFjaGluZSA9IDE2NCkpIElOSEVSSVRTIChs b2dzKSBUQUJMRVNQQUNFIGRhdGFfbG9nczsNCkNSRUFURSBUQUJMRSBsb2dzXzMxNiAoQ0hFQ0sg KCBpZF9tYWNoaW5lID0gMzE2KSkgSU5IRVJJVFMgKGxvZ3MpIFRBQkxFU1BBQ0UgZGF0YV9sb2dz Ow0KQ1JFQVRFIFRBQkxFIGxvZ3NfMzEzIChDSEVDSyAoIGlkX21hY2hpbmUgPSAzMTMpKSBJTkhF UklUUyAobG9ncykgVEFCTEVTUEFDRSBkYXRhX2xvZ3M7DQpDUkVBVEUgVEFCTEUgbG9nc18yMTcg KENIRUNLICggaWRfbWFjaGluZSA9IDIxNykpIElOSEVSSVRTIChsb2dzKSBUQUJMRVNQQUNFIGRh dGFfbG9nczsNCkNSRUFURSBUQUJMRSBsb2dzXzE2NyAoQ0hFQ0sgKCBpZF9tYWNoaW5lID0gMTY3 KSkgSU5IRVJJVFMgKGxvZ3MpIFRBQkxFU1BBQ0UgZGF0YV9sb2dzOw0KQ1JFQVRFIFRBQkxFIGxv Z3NfMjg3IChDSEVDSyAoIGlkX21hY2hpbmUgPSAyODcpKSBJTkhFUklUUyAobG9ncykgVEFCTEVT UEFDRSBkYXRhX2xvZ3M7DQpDUkVBVEUgVEFCTEUgbG9nc18yNzkgKENIRUNLICggaWRfbWFjaGlu ZSA9IDI3OSkpIElOSEVSSVRTIChsb2dzKSBUQUJMRVNQQUNFIGRhdGFfbG9nczsNCkNSRUFURSBU QUJMRSBsb2dzXzI0OCAoQ0hFQ0sgKCBpZF9tYWNoaW5lID0gMjQ4KSkgSU5IRVJJVFMgKGxvZ3Mp IFRBQkxFU1BBQ0UgZGF0YV9sb2dzOw0KQ1JFQVRFIFRBQkxFIGxvZ3NfMjgwIChDSEVDSyAoIGlk X21hY2hpbmUgPSAyODApKSBJTkhFUklUUyAobG9ncykgVEFCTEVTUEFDRSBkYXRhX2xvZ3M7DQpD UkVBVEUgVEFCTEUgbG9nc18xNjUgKENIRUNLICggaWRfbWFjaGluZSA9IDE2NSkpIElOSEVSSVRT IChsb2dzKSBUQUJMRVNQQUNFIGRhdGFfbG9nczsNCkNSRUFURSBUQUJMRSBsb2dzXzMzMCAoQ0hF Q0sgKCBpZF9tYWNoaW5lID0gMzMwKSkgSU5IRVJJVFMgKGxvZ3MpIFRBQkxFU1BBQ0UgZGF0YV9s b2dzOw0KQ1JFQVRFIFRBQkxFIGxvZ3NfMTQ5IChDSEVDSyAoIGlkX21hY2hpbmUgPSAxNDkpKSBJ TkhFUklUUyAobG9ncykgVEFCTEVTUEFDRSBkYXRhX2xvZ3M7DQpDUkVBVEUgVEFCTEUgbG9nc18x NTcgKENIRUNLICggaWRfbWFjaGluZSA9IDE1NykpIElOSEVSSVRTIChsb2dzKSBUQUJMRVNQQUNF IGRhdGFfbG9nczsNCkNSRUFURSBUQUJMRSBsb2dzXzI3MiAoQ0hFQ0sgKCBpZF9tYWNoaW5lID0g MjcyKSkgSU5IRVJJVFMgKGxvZ3MpIFRBQkxFU1BBQ0UgZGF0YV9sb2dzOw0KQ1JFQVRFIFRBQkxF IGxvZ3NfMzExIChDSEVDSyAoIGlkX21hY2hpbmUgPSAzMTEpKSBJTkhFUklUUyAobG9ncykgVEFC TEVTUEFDRSBkYXRhX2xvZ3M7DQpDUkVBVEUgVEFCTEUgbG9nc18zMDkgKENIRUNLICggaWRfbWFj aGluZSA9IDMwOSkpIElOSEVSSVRTIChsb2dzKSBUQUJMRVNQQUNFIGRhdGFfbG9nczsNCkNSRUFU RSBUQUJMRSBsb2dzXzMxOCAoQ0hFQ0sgKCBpZF9tYWNoaW5lID0gMzE4KSkgSU5IRVJJVFMgKGxv Z3MpIFRBQkxFU1BBQ0UgZGF0YV9sb2dzOw0KDQoNCkNSRUFURSBVTklRVUUgSU5ERVggbG9nc18x NTBfcGtleSBPTiBsb2dzXzE1MCAoaWQpIFRBQkxFU1BBQ0UgaW5kZXhfbG9ncztDUkVBVEUgSU5E RVggZGF0ZV8xNTAgT04gbG9nc18xNTAgKGRhdGUpIFRBQkxFU1BBQ0UgaW5kZXhfbG9ncyA7Q1JF QVRFIElOREVYIGV2ZW50XzE1MCBPTiBsb2dzXzE1MCAoZXZlbmVtZW50KSBUQUJMRVNQQUNFIGlu ZGV4X2xvZ3M7DQoNCg0KLi4uLi4NCg0KDQpsb2dzPT4gZXhwbGFpbiBzZWxlY3QgKiBmcm9tIGxv Z3Mgb3JkZXIgYnkgaWQgZGVzYyBsaW1pdCAxMDA7DQogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFFVRVJZIFBMQU4NCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLQ0KIExpbWl0ICAoY29zdD0xNjUyNDY0Ny4yOS4uMTY1MjQ2NDcuNTQgcm93cz0xMDAg d2lkdGg9Mjk1KQ0KICAgLT4gIFNvcnQgIChjb3N0PTE2NTI0NjQ3LjI5Li4xNjU2ODM2Ny4xMSBy b3dzPTE3NDg3OTI3IHdpZHRoPTI5NSkNCiAgICAgICAgIFNvcnQgS2V5OiBwdWJsaWMubG9ncy5p ZA0KICAgICAgICAgLT4gIFJlc3VsdCAgKGNvc3Q9MC4wMC4uODI3NjIyLjI3IHJvd3M9MTc0ODc5 Mjcgd2lkdGg9Mjk1KQ0KICAgICAgICAgICAgICAgLT4gIEFwcGVuZCAgKGNvc3Q9MC4wMC4uODI3 NjIyLjI3IHJvd3M9MTc0ODc5Mjcgd2lkdGg9Mjk1KQ0KICAgICAgICAgICAgICAgICAgICAgLT4g IFNlcSBTY2FuIG9uIGxvZ3MgIChjb3N0PTAuMDAuLjgyNjIzMi43OCByb3dzPTE3NDUxOTc4IHdp ZHRoPTE2NSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEgU2NhbiBvbiBsb2dzXzE1MCBs b2dzICAoY29zdD0wLjAwLi4xOTkuMDQgcm93cz02MTA0IHdpZHRoPTE0NCkNCiAgICAgICAgICAg ICAgICAgICAgIC0+ICBTZXEgU2NhbiBvbiBsb2dzXzE2MyBsb2dzICAoY29zdD0wLjAwLi4yNjEu Nzkgcm93cz03MDc5IHdpZHRoPTE2OSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEgU2Nh biBvbiBsb2dzXzI4OSBsb2dzICAoY29zdD0wLjAwLi40MjguOTMgcm93cz0xMDY5MyB3aWR0aD0y MDApDQogICAgICAgICAgICAgICAgICAgICAtPiAgU2VxIFNjYW4gb24gbG9nc18zMTkgbG9ncyAg KGNvc3Q9MC4wMC4uMzEuOTIgcm93cz05OTIgd2lkdGg9MTI5KQ0KICAgICAgICAgICAgICAgICAg ICAgLT4gIFNlcSBTY2FuIG9uIGxvZ3NfMjM4IGxvZ3MgIChjb3N0PTAuMDAuLjI4LjAxIHJvd3M9 NzAxIHdpZHRoPTE5OSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEgU2NhbiBvbiBsb2dz XzE0OCBsb2dzICAoY29zdD0wLjAwLi44MC4xNSByb3dzPTIwMTUgd2lkdGg9MTk1KQ0KICAgICAg ICAgICAgICAgICAgICAgLT4gIFNlcSBTY2FuIG9uIGxvZ3NfMTc2IGxvZ3MgIChjb3N0PTAuMDAu LjEyLjQwIHJvd3M9MjQwIHdpZHRoPTI5NSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEg U2NhbiBvbiBsb2dzXzE2NCBsb2dzICAoY29zdD0wLjAwLi4xMi40MCByb3dzPTI0MCB3aWR0aD0y OTUpDQogICAgICAgICAgICAgICAgICAgICAtPiAgU2VxIFNjYW4gb24gbG9nc18zMTYgbG9ncyAg KGNvc3Q9MC4wMC4uMTIuNDAgcm93cz0yNDAgd2lkdGg9Mjk1KQ0KICAgICAgICAgICAgICAgICAg ICAgLT4gIFNlcSBTY2FuIG9uIGxvZ3NfMzEzIGxvZ3MgIChjb3N0PTAuMDAuLjEyLjQwIHJvd3M9 MjQwIHdpZHRoPTI5NSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEgU2NhbiBvbiBsb2dz XzIxNyBsb2dzICAoY29zdD0wLjAwLi4xMi40MCByb3dzPTI0MCB3aWR0aD0yOTUpDQogICAgICAg ICAgICAgICAgICAgICAtPiAgU2VxIFNjYW4gb24gbG9nc18xNjcgbG9ncyAgKGNvc3Q9MC4wMC4u NTcuMzYgcm93cz0xNTM2IHdpZHRoPTE3MCkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEg U2NhbiBvbiBsb2dzXzI4NyBsb2dzICAoY29zdD0wLjAwLi4xMi40MCByb3dzPTI0MCB3aWR0aD0y OTUpDQogICAgICAgICAgICAgICAgICAgICAtPiAgU2VxIFNjYW4gb24gbG9nc18yNzkgbG9ncyAg KGNvc3Q9MC4wMC4uMTIuNDAgcm93cz0yNDAgd2lkdGg9Mjk1KQ0KICAgICAgICAgICAgICAgICAg ICAgLT4gIFNlcSBTY2FuIG9uIGxvZ3NfMjQ4IGxvZ3MgIChjb3N0PTAuMDAuLjEyLjQwIHJvd3M9 MjQwIHdpZHRoPTI5NSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEgU2NhbiBvbiBsb2dz XzI4MCBsb2dzICAoY29zdD0wLjAwLi4xMi40MCByb3dzPTI0MCB3aWR0aD0yOTUpDQogICAgICAg ICAgICAgICAgICAgICAtPiAgU2VxIFNjYW4gb24gbG9nc18xNjUgbG9ncyAgKGNvc3Q9MC4wMC4u MzQuMDkgcm93cz05MDkgd2lkdGg9MTY4KQ0KICAgICAgICAgICAgICAgICAgICAgLT4gIFNlcSBT Y2FuIG9uIGxvZ3NfMzMwIGxvZ3MgIChjb3N0PTAuMDAuLjYyLjQ2IHJvd3M9MTc0NiB3aWR0aD0x NjApDQogICAgICAgICAgICAgICAgICAgICAtPiAgU2VxIFNjYW4gb24gbG9nc18xNDkgbG9ncyAg KGNvc3Q9MC4wMC4uMTIuNDAgcm93cz0yNDAgd2lkdGg9Mjk1KQ0KICAgICAgICAgICAgICAgICAg ICAgLT4gIFNlcSBTY2FuIG9uIGxvZ3NfMTU3IGxvZ3MgIChjb3N0PTAuMDAuLjEyLjQwIHJvd3M9 MjQwIHdpZHRoPTI5NSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEgU2NhbiBvbiBsb2dz XzI3MiBsb2dzICAoY29zdD0wLjAwLi4zMi4xNCByb3dzPTgxNCB3aWR0aD0xODMpDQogICAgICAg ICAgICAgICAgICAgICAtPiAgU2VxIFNjYW4gb24gbG9nc18zMTEgbG9ncyAgKGNvc3Q9MC4wMC4u MTIuNDAgcm93cz0yNDAgd2lkdGg9Mjk1KQ0KICAgICAgICAgICAgICAgICAgICAgLT4gIFNlcSBT Y2FuIG9uIGxvZ3NfMzA5IGxvZ3MgIChjb3N0PTAuMDAuLjEyLjQwIHJvd3M9MjQwIHdpZHRoPTI5 NSkNCiAgICAgICAgICAgICAgICAgICAgIC0+ICBTZXEgU2NhbiBvbiBsb2dzXzMxOCBsb2dzICAo Y29zdD0wLjAwLi4xMi40MCByb3dzPTI0MCB3aWR0aD0yOTUpDQoNCg== --Boundary-00=_fRonD9okC9edavU-- From pgsql-general-owner@postgresql.org Tue Dec 13 04:22:49 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 719049DD8F6 for ; Tue, 13 Dec 2005 04:22:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60539-01 for ; Tue, 13 Dec 2005 04:22:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 675189DD8F3 for ; Tue, 13 Dec 2005 04:22:33 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id 645E51528A; Tue, 13 Dec 2005 02:22:34 -0600 (CST) Date: Tue, 13 Dec 2005 02:22:34 -0600 From: "Jim C. Nasby" To: "Joshua D. Drake" Cc: Tom Lane , Mike Rylander , Will Glynn , pgsql general Subject: Re: Memory Leakage Problem Message-ID: <20051213082234.GG20728@pervasive.com> References: <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <2215.1134447471@sss.pgh.pa.us> <439E4EB8.5000301@commandprompt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <439E4EB8.5000301@commandprompt.com> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.037 required=5 tests=[AWL=0.037] X-Spam-Score: 0.037 X-Spam-Level: X-Archive-Number: 200512/624 X-Sequence-Number: 88187 On Mon, Dec 12, 2005 at 08:31:52PM -0800, Joshua D. Drake wrote: > > > >>It sure is. Gentoo with kernel version 2.6.12, built for x86_64. > >>Looks like we have a contender for the common factor. :) > >> > > > >Please tell me you're *not* running a production database on Gentoo. > > > > > > regards, tom lane > > > You don't even want to know how many companies I know that are doing > this very thing and no, it was not my suggestion. "Like the annoying teenager next door with a 90hp import sporting a 6 foot tall bolt-on wing, Gentoo users are proof that society is best served by roving gangs of armed vigilantes, dishing out swift, cold justice with baseball bats..." http://funroll-loops.org/ From pgsql-performance-owner@postgresql.org Tue Dec 13 07:40:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2BE299DC81D for ; Tue, 13 Dec 2005 07:40:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38813-02 for ; Tue, 13 Dec 2005 07:40:15 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by postgresql.org (Postfix) with ESMTP id 0BF399DC82F for ; Tue, 13 Dec 2005 07:40:10 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 71so1597898wra for ; Tue, 13 Dec 2005 03:40:11 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Ff9lx6tpXTGNQ4qM6WnnCkOOo/Hq+vCyOQ0t58MRfBFRmCVGthjkyoGyQulC0vFrHMjBVurparzTwyuaOqlIvhUOMzK8/wgTVUuSwd2C19sdG0PbijRw7uuhNPY/qEsRkkOtuMhW+p7h12Nv3TtgAXs1j7MD/A0XN4gFzQIPAJg= Received: by 10.64.232.11 with SMTP id e11mr6503285qbh; Tue, 13 Dec 2005 03:40:11 -0800 (PST) Received: by 10.64.209.2 with HTTP; Tue, 13 Dec 2005 03:40:11 -0800 (PST) Message-ID: <5e744e3d0512130340r25159d86n840831eb5aa6dd65@mail.gmail.com> Date: Tue, 13 Dec 2005 17:10:11 +0530 From: Pandurangan R S To: Marc Cousin Subject: Re: partitioning Cc: pgsql-performance@postgresql.org In-Reply-To: <200512130920.47583.mcousin@sigma.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512130920.47583.mcousin@sigma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.023 required=5 tests=[AWL=0.023] X-Spam-Score: 0.023 X-Spam-Level: X-Archive-Number: 200512/310 X-Sequence-Number: 16131 Did you set constraint_exclusion =3D true in postgresql.conf file? On 12/13/05, Marc Cousin wrote: > Hi, > > I've been working on trying to partition a big table (I've never partitio= ned a > table in any other database till now). > Everything went ok, except one query that didn't work afterwards. > > I've put the partition description, indexes, etc ..., and the explain pla= n > attached. > > The query is extremely fast without partition (index scan backards on the > primary key) > > The query is : "select * from logs order by id desc limit 100;" > id is the primary key. > > It is indexed on all partitions. > > But the explain plan does full table scan on all partitions. > > While I think I understand why it is doing this plan right now, is there > something that could be done to optimize this case ? Or put a warning in = the > docs about this kind of behaviour. I guess normally someone would partiti= on > to get faster queries :) > > Anyway, I thought I should mention this, as it has been quite a surprise. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > > > -- Regards Pandu From pgsql-performance-owner@postgresql.org Tue Dec 13 07:50:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 195229DC817 for ; Tue, 13 Dec 2005 07:50:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40007-01 for ; Tue, 13 Dec 2005 07:50:09 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.197]) by postgresql.org (Postfix) with ESMTP id 668A69DC81E for ; Tue, 13 Dec 2005 07:50:04 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so735600nzn for ; Tue, 13 Dec 2005 03:50:07 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=TURf7IFJhvG1Zner/upCOrHSFoTVEkjxNGtZ05C40/XeL66zafFMqs6zDSrVY7VdkQoPStwpSoD5q5vXmhtX5Ja8BbNNJa/UZ8+JHqlag89S5ReNFRgwhOExXxSXjtKLxQlTsQAbY1Y/hoHCsHifFuydvSf5aUJ/iBjP4H2jJM4= Received: by 10.64.253.16 with SMTP id a16mr503041qbi; Tue, 13 Dec 2005 03:50:07 -0800 (PST) Received: by 10.64.209.2 with HTTP; Tue, 13 Dec 2005 03:50:07 -0800 (PST) Message-ID: <5e744e3d0512130350l12d136abx2ad661c6d6b6a21e@mail.gmail.com> Date: Tue, 13 Dec 2005 17:20:07 +0530 From: Pandurangan R S To: Marc Cousin Subject: Re: partitioning Cc: pgsql-performance@postgresql.org In-Reply-To: <5e744e3d0512130340r25159d86n840831eb5aa6dd65@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512130920.47583.mcousin@sigma.fr> <5e744e3d0512130340r25159d86n840831eb5aa6dd65@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200512/311 X-Sequence-Number: 16132 I just saw that there is no where clause in the query, that you had fed to explain plan. you need to include a where clause based on id_machine column to see the ef= fect. On 12/13/05, Pandurangan R S wrote: > Did you set constraint_exclusion =3D true in postgresql.conf file? > > On 12/13/05, Marc Cousin wrote: > > Hi, > > > > I've been working on trying to partition a big table (I've never partit= ioned a > > table in any other database till now). > > Everything went ok, except one query that didn't work afterwards. > > > > I've put the partition description, indexes, etc ..., and the explain p= lan > > attached. > > > > The query is extremely fast without partition (index scan backards on t= he > > primary key) > > > > The query is : "select * from logs order by id desc limit 100;" > > id is the primary key. > > > > It is indexed on all partitions. > > > > But the explain plan does full table scan on all partitions. > > > > While I think I understand why it is doing this plan right now, is ther= e > > something that could be done to optimize this case ? Or put a warning i= n the > > docs about this kind of behaviour. I guess normally someone would parti= tion > > to get faster queries :) > > > > Anyway, I thought I should mention this, as it has been quite a surpris= e. > > > > > > > > ---------------------------(end of broadcast)--------------------------= - > > TIP 1: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that you= r > > message can get through to the mailing list cleanly > > > > > > > > > > > -- > Regards > Pandu > From pgsql-performance-owner@postgresql.org Tue Dec 13 09:11:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 90C499DC814 for ; Tue, 13 Dec 2005 09:11:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58231-02 for ; Tue, 13 Dec 2005 09:11:30 -0400 (AST) X-Greylist: delayed 04:50:34.580375 by SQLgrey- Received: from mercure.sigma.fr (mercure.sigma.fr [195.25.81.9]) by postgresql.org (Postfix) with ESMTP id 6688A9DC81D for ; Tue, 13 Dec 2005 09:11:24 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mercure.sigma.fr (Postfix) with ESMTP id 609AD8F46 for ; Tue, 13 Dec 2005 14:11:26 +0100 (CET) Received: from mercure.sigma.fr ([127.0.0.1]) by localhost (mercure-1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12589-09 for ; Tue, 13 Dec 2005 14:11:26 +0100 (CET) Received: from delpiv3000-124l (unknown [89.195.0.5]) by mercure.sigma.fr (Postfix) with ESMTP id 10A558EC3 for ; Tue, 13 Dec 2005 14:11:25 +0100 (CET) From: Marc Cousin Organization: Sigma Informatique To: pgsql-performance@postgresql.org Subject: Re: partitioning Date: Tue, 13 Dec 2005 14:11:24 +0100 User-Agent: KMail/1.9 References: <5e744e3d0512130350l12d136abx2ad661c6d6b6a21e@mail.gmail.com> In-Reply-To: <5e744e3d0512130350l12d136abx2ad661c6d6b6a21e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200512131411.24825.mcousin@sigma.fr> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at sigma.fr X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.811 required=5 tests=[RCVD_IN_WHOIS_BOGONS=1.811] X-Spam-Score: 1.811 X-Spam-Level: * X-Archive-Number: 200512/312 X-Sequence-Number: 16133 Yes, that's how I solved it... and I totally agree that it's hard for the=20 planner to guess what to do on the partitions. But maybe there should be=20 something in the docs explaining the limitations ... I'm only asking for the biggest 100 ids from the table, so I thought maybe = the=20 planner would take the 100 biggest from all partitions or something like th= at=20 and return me the 100 biggest from those results. It didn't and that's quit= e=20 logical. What I meant is that I understand why the planner chooses this plan, but ma= ybe=20 it should be written somewhere in the docs that some plans will be worse=20 after partitionning. Le Mardi 13 D=C3=A9cembre 2005 12:50, vous avez =C3=A9crit=C2=A0: > I just saw that there is no where clause in the query, that you had > fed to explain plan. > you need to include a where clause based on id_machine column to see the > effect. > > On 12/13/05, Pandurangan R S wrote: > > Did you set constraint_exclusion =3D true in postgresql.conf file? > > > > On 12/13/05, Marc Cousin wrote: > > > Hi, > > > > > > I've been working on trying to partition a big table (I've never > > > partitioned a table in any other database till now). > > > Everything went ok, except one query that didn't work afterwards. > > > > > > I've put the partition description, indexes, etc ..., and the explain > > > plan attached. > > > > > > The query is extremely fast without partition (index scan backards on > > > the primary key) > > > > > > The query is : "select * from logs order by id desc limit 100;" > > > id is the primary key. > > > > > > It is indexed on all partitions. > > > > > > But the explain plan does full table scan on all partitions. > > > > > > While I think I understand why it is doing this plan right now, is > > > there something that could be done to optimize this case ? Or put a > > > warning in the docs about this kind of behaviour. I guess normally > > > someone would partition to get faster queries :) > > > > > > Anyway, I thought I should mention this, as it has been quite a > > > surprise. > > > > > > > > > > > > ---------------------------(end of > > > broadcast)--------------------------- TIP 1: if posting/reading throu= gh > > > Usenet, please send an appropriate subscribe-nomail command to > > > majordomo@postgresql.org so that your message can get through to the > > > mailing list cleanly > > > > -- > > Regards > > Pandu From pgsql-general-owner@postgresql.org Tue Dec 13 11:13:13 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 835CE9DC85D for ; Tue, 13 Dec 2005 11:13:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77748-06 for ; Tue, 13 Dec 2005 11:13:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id F360C9DC84F for ; Tue, 13 Dec 2005 11:13:09 -0400 (AST) 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 jBDFDCO7006376; Tue, 13 Dec 2005 10:13:12 -0500 (EST) To: John Sidney-Woollett cc: pgsql general Subject: Re: Memory Leakage Problem In-reply-to: <439E80B1.8030800@wardbrook.com> References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> <3666.1134460063@sss.pgh.pa.us> <439E80B1.8030800@wardbrook.com> Comments: In-reply-to John Sidney-Woollett message dated "Tue, 13 Dec 2005 08:05:05 +0000" Date: Tue, 13 Dec 2005 10:13:12 -0500 Message-ID: <6375.1134486792@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/637 X-Sequence-Number: 88200 John Sidney-Woollett writes: > Tom Lane wrote: >> *What* is consuming memory, exactly --- which processes? > Sorry but I don't know how to determine that. Try "ps auxw", or some other incantation if you prefer, so long as it includes some statistics about process memory use. What you showed us is certainly not helpful. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 13 11:18:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 603A99DC80C for ; Tue, 13 Dec 2005 11:18:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79675-06 for ; Tue, 13 Dec 2005 11:18:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 5F4A99DC817 for ; Tue, 13 Dec 2005 11:18:22 -0400 (AST) Received: from analytic.mv.ru (analytic.mv.ru [213.242.11.222]) by svr2.postgresql.org (Postfix) with ESMTP id 67EF9F0B4F for ; Tue, 13 Dec 2005 15:18:26 +0000 (GMT) Received: by analytic.mv.ru (Postfix, from userid 2002) id A2E8020DB; Tue, 13 Dec 2005 18:18:19 +0300 (MSK) Date: Tue, 13 Dec 2005 18:18:19 +0300 From: =?utf-8?B?0JrQu9GO0YfQvdC40LrQvtCyINCQLtChLg==?= To: pgsql-performance@postgresql.org Subject: query from partitions Message-ID: <20051213151818.GA10021@mail.analytic.mv.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/313 X-Sequence-Number: 16134 Hi. create table device(id int); insert into device values(1); insert into device values(2); ..... insert into device values(250); create table base ( id int, data float, datatime timestamp, mode int, status int); create table base_1 ( check ( id = 1 and datatime >= DATE '2005-01-01' and datatime < DATE '2006-01-01' ) ) INHERITS (base); create table base_2 ( check ( id = 2 and datatime >= DATE '2005-01-01' and datatime < DATE '2006-01-01' ) ) INHERITS (base); .... create table base_250 And select * from base where id in (1,2) and datatime between '2005-05-15' and '2005-05-17'; 10 seconds select * from base where id in (select id from device where id = 1 or id = 2) and datatime between '2005-05-15' and '2005-05-17'; 10 minits Why? -- mailto: alexs@analytic.mv.ru From pgsql-performance-owner@postgresql.org Tue Dec 13 11:59:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C8A7D9DC817 for ; Tue, 13 Dec 2005 11:59:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92312-07 for ; Tue, 13 Dec 2005 11:59:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 76DD89DC81E for ; Tue, 13 Dec 2005 11:59:13 -0400 (AST) 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 5F089418A38; Tue, 13 Dec 2005 15:59:01 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 377F715EA4; Tue, 13 Dec 2005 15:59:12 +0000 (GMT) Message-ID: <439EEFCF.8000505@archonet.com> Date: Tue, 13 Dec 2005 15:59:11 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: =?UTF-8?B?ItCa0LvRjtGH0L3QuNC60L7QsiDQkC7QoS4i?= Cc: pgsql-performance@postgresql.org Subject: Re: query from partitions References: <20051213151818.GA10021@mail.analytic.mv.ru> In-Reply-To: <20051213151818.GA10021@mail.analytic.mv.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/314 X-Sequence-Number: 16135 =D0=9A=D0=BB=D1=8E=D1=87=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2 =D0=90.=D0=A1. wro= te: > And > select * from base=20 > where id in (1,2) and datatime between '2005-05-15' and '2005-05-17'; > 10 seconds >=20 > select * from base > where id in (select id from device where id =3D 1 or id =3D 2) and > datatime between '2005-05-15' and '2005-05-17'; > 10 minits >=20 > Why? Run EXPLAIN ANALYSE on both queries to see how the plan has changed. My guess for why the plans are different is that in the first case your=20 query ends up as ...where (id=3D1 or id=3D2)... In the second case, the planner doesn't know what it's going to get back = from the subquery until it's executed it, so can't tell it just needs to = scan base_1,base_2. Result: you'll scan all child tables of base. I think the planner will occasionally evaluate constants before=20 planning, but I don't think it will ever execute a subquery and then=20 re-plan the outer query based on those results. Of course, someone might = pop up and tell me I'm wrong now... --=20 Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Tue Dec 13 12:08:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E1AA39DC85A for ; Tue, 13 Dec 2005 12:08:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95581-02 for ; Tue, 13 Dec 2005 12:08:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 1DD3D9DC85D for ; Tue, 13 Dec 2005 12:08:55 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EmChw-0005t8-Vl; Tue, 13 Dec 2005 17:08:53 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EmChw-00011u-00; Tue, 13 Dec 2005 17:08:52 +0100 Date: Tue, 13 Dec 2005 17:08:52 +0100 From: "Steinar H. Gunderson" To: =?utf-8?B?0JrQu9GO0YfQvdC40LrQvtCyINCQLtChLg==?= Cc: pgsql-performance@postgresql.org Subject: Re: query from partitions Message-ID: <20051213160852.GA3740@uio.no> Mail-Followup-To: =?utf-8?B?0JrQu9GO0YfQvdC40LrQvtCyINCQLtChLg==?= , pgsql-performance@postgresql.org References: <20051213151818.GA10021@mail.analytic.mv.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20051213151818.GA10021@mail.analytic.mv.ru> X-Operating-System: Linux 2.6.14 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/315 X-Sequence-Number: 16136 On Tue, Dec 13, 2005 at 06:18:19PM +0300, Ключников А.С. wrote: > select * from base > where id in (select id from device where id = 1 or id = 2) and > datatime between '2005-05-15' and '2005-05-17'; > 10 minits That's a really odd way of saying "1 or 2". It probably has to go through all the records in device, not realizing it can just scan for two of them (using two index scans). I'd guess an EXPLAIN ANALYZE would confirm something like this happening (you'd want to run that and post the results here anyhow). /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Dec 13 12:09:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 732E69DC863 for ; Tue, 13 Dec 2005 12:08:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95273-04 for ; Tue, 13 Dec 2005 12:08:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from zoraida.natserv.net (p65-147.acedsl.com [66.114.65.147]) by postgresql.org (Postfix) with ESMTP id 2766A9DC817 for ; Tue, 13 Dec 2005 12:08:56 -0400 (AST) Received: from zoraida.natserv.net (zoraida.natserv.net [66.114.65.147]) by zoraida.natserv.net (Postfix) with ESMTP id 7A3A77DEB; Tue, 13 Dec 2005 11:08:55 -0500 (EST) References: <20051212222433.GH54639@pervasive.com> Message-ID: X-Mailer: http://www.courier-mta.org/cone/ From: Francisco Reyes To: Jim =?ISO-8859-1?B?Qy4=?= Nasby Cc: PostgreSQL performance Subject: Re: Small table or partial index? Date: Tue, 13 Dec 2005 11:08:55 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="US-ASCII" Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/316 X-Sequence-Number: 16137 Jim C. Nasby writes: > On Fri, Dec 02, 2005 at 06:28:09PM -0500, Francisco Reyes wrote: >> I am in the process of designing a new system. >> There will be a long list of words such as >> >> -word table >> word_id integer >> word varchar >> special boolean >> >> Some "special" words are used to determine if some work is to be done and >> will be what we care the most for one type of operation. > > Tough call. The key here is the amount of time required to do a join. It > also depends on if you need all the special words or not. Your best bet > is to try and benchmark both ways. In your opinion do you think performance will be comparable? I am hoping I will have time to test, but not sure if will have time and the tables will be pretty large. :-( From pgsql-general-owner@postgresql.org Tue Dec 13 12:40:35 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 832C89DC863 for ; Tue, 13 Dec 2005 12:40:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02915-07 for ; Tue, 13 Dec 2005 12:40:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mercury.wardbrook.com (host-84-9-98-118.bulldogdsl.com [84.9.98.118]) by postgresql.org (Postfix) with ESMTP id C72159DC872 for ; Tue, 13 Dec 2005 12:40:31 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mercury.wardbrook.com (Postfix) with ESMTP id AC51B532EB; Tue, 13 Dec 2005 16:37:45 +0000 (GMT) Received: by mercury.wardbrook.com (Postfix, from userid 505) id 7C50D532EF; Tue, 13 Dec 2005 16:37:44 +0000 (GMT) Received: from www.airinformation.com (localhost.localdomain [127.0.0.1]) by mercury.wardbrook.com (Postfix) with SMTP id CEF6D532EB; Tue, 13 Dec 2005 16:37:42 +0000 (GMT) Received: from 195.152.219.3 (SquirrelMail authenticated user johnsw) by mercury.wardbrook.com with HTTP; Tue, 13 Dec 2005 16:37:42 -0000 (GMT) Message-ID: <6597.195.152.219.3.1134491862.squirrel@mercury.wardbrook.com> In-Reply-To: <6375.1134486792@sss.pgh.pa.us> References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> <3666.1134460063@sss.pgh.pa.us> <439E80B1.8030800@wardbrook.com> <6375.1134486792@sss.pgh.pa.us> Date: Tue, 13 Dec 2005 16:37:42 -0000 (GMT) Subject: Re: Memory Leakage Problem From: "John Sidney-Woollett" To: "Tom Lane" Cc: "John Sidney-Woollett" , "pgsql general" Reply-To: johnsw@wardbrook.com User-Agent: SquirrelMail/1.4.2 [CVS] 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 AMaViS 0.3.12 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/646 X-Sequence-Number: 88209 Tom Lane said: > John Sidney-Woollett writes: >> Tom Lane wrote: >>> *What* is consuming memory, exactly --- which processes? > >> Sorry but I don't know how to determine that. > > Try "ps auxw", or some other incantation if you prefer, so long as it > includes some statistics about process memory use. What you showed us > is certainly not helpful. At the moment not one process's VSZ is over 16Mb with the exception of one of the slon processes which is at 66Mb. I'll run this over the next few days and especially as the server starts bogging down to see if it identifies the culprit. Is it possible to grab memory outsize of a processes space? Or would a leak always show up by an ever increasing VSZ amount? Thanks John From pgsql-performance-owner@postgresql.org Tue Dec 13 12:58:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 10FDC9DC85D for ; Tue, 13 Dec 2005 12:58:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05028-08 for ; Tue, 13 Dec 2005 12:58:05 -0400 (AST) X-Greylist: delayed 01:39:47.480109 by SQLgrey- Received: from analytic.mv.ru (analytic.mv.ru [213.242.11.222]) by postgresql.org (Postfix) with ESMTP id 4B78B9DC887 for ; Tue, 13 Dec 2005 12:58:03 -0400 (AST) Received: by analytic.mv.ru (Postfix, from userid 2002) id 76BD620DB; Tue, 13 Dec 2005 19:58:00 +0300 (MSK) Date: Tue, 13 Dec 2005 19:57:59 +0300 From: =?utf-8?B?0JrQu9GO0YfQvdC40LrQvtCyINCQLtChLg==?= To: pgsql-performance@postgresql.org Subject: Re: query from partitions Message-ID: <20051213165759.GA10514@mail.analytic.mv.ru> Mail-Followup-To: pgsql-performance@postgresql.org References: <20051213151818.GA10021@mail.analytic.mv.ru> <439EEFCF.8000505@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <439EEFCF.8000505@archonet.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/317 X-Sequence-Number: 16138 * Richard Huxton [2005-12-13 15:59:11 +0000]: > Ключников А.С. wrote: > >And > >select * from base > > where id in (1,2) and datatime between '2005-05-15' and '2005-05-17'; > >10 seconds > > > >select * from base > > where id in (select id from device where id = 1 or id = 2) and > > datatime between '2005-05-15' and '2005-05-17'; > >10 minits > > > >Why? > > Run EXPLAIN ANALYSE on both queries to see how the plan has changed. explain select distinct on(id) * from base where id in (1,2) and data_type=2 and datatime < '2005-11-02' order by id, datatime desc; Unique (cost=10461.14..10527.30 rows=2342 width=38) -> Sort (cost=10461.14..10494.22 rows=13232 width=38) Sort Key: public.base.id, public.base.datatime -> Result (cost=0.00..9555.29 rows=13232 width=38) -> Append (cost=0.00..9555.29 rows=13232 width=38) -> Seq Scan on base (cost=0.00..32.60 rows=1 width=38) Filter: (((id = 1) OR (id = 2)) AND (data_type = 2) AND (datatime < '2005-11-02 00:00:00'::timestamp without time zone)) -> Seq Scan on base_batch base (cost=0.00..32.60 rows=1 width=38) ....................... -> Seq Scan on base_1_2004 base (cost=0.00..32.60 rows=1 width=38) Filter: (((id = 1) OR (id = 2)) AND (data_type = 2) AND (datatime < '2005-11-02 00:00:00'::timestamp without time zone)) (записей: 34) and explain select distinct on(id) * from base where id in (select id from device where id = 1 or id = 2) and data_type=2 and datatime < '2005-11-02' order by id, datatime desc; Unique (cost=369861.89..369872.52 rows=2126 width=38) -> Sort (cost=369861.89..369867.21 rows=2126 width=38) Sort Key: public.base.id, public.base.datatime -> Hash IN Join (cost=5.88..369744.39 rows=2126 width=38) Hash Cond: ("outer".id = "inner".id) -> Append (cost=0.00..368654.47 rows=212554 width=38) -> Seq Scan on base (cost=0.00..26.95 rows=2 width=38) Filter: ((data_type = 2) AND (datatime < '2005-11-02 00:00:00'::timestamp without time zone)) -> Seq Scan on base_batch base (cost=0.00..26.95 rows=2 width=38) Filter: ((data_type = 2) AND (datatime < '2005-11-02 00:00:00'::timestamp without time zone)) -> Seq Scan on base_lines_05_12 base (cost=0.00..26.95 rows=2 width=38) ............................ -> Hash (cost=5.88..5.88 rows=2 width=4) -> Seq Scan on device (cost=0.00..5.88 rows=2 width=4) Filter: ((id = 1) OR (id = 2)) (записей: 851) > > My guess for why the plans are different is that in the first case your > query ends up as ...where (id=1 or id=2)... > > In the second case, the planner doesn't know what it's going to get back > from the subquery until it's executed it, so can't tell it just needs to > scan base_1,base_2. Result: you'll scan all child tables of base. > > I think the planner will occasionally evaluate constants before > planning, but I don't think it will ever execute a subquery and then > re-plan the outer query based on those results. Of course, someone might > pop up and tell me I'm wrong now... > > -- > Richard Huxton > Archonet Ltd > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match -- С уважением, Ключников А.С. Ведущий инженер ПРП "Аналитприбор" 432030 г.Ульяновск, а/я 3117 тел./факс +7 (8422) 43-44-78 mailto: alexs@analytic.mv.ru From pgsql-performance-owner@postgresql.org Tue Dec 13 13:25:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B9B7A9DC87F for ; Tue, 13 Dec 2005 13:25:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43637-04 for ; Tue, 13 Dec 2005 13:25:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from karadi.cs.wisc.edu (karadi.cs.wisc.edu [128.105.167.23]) by postgresql.org (Postfix) with ESMTP id 0DCA09DC86F for ; Tue, 13 Dec 2005 13:25:40 -0400 (AST) Received: from karadi.cs.wisc.edu (localhost [127.0.0.1]) by karadi.cs.wisc.edu (8.13.1/8.13.1) with ESMTP id jBDHPfS6001057 for ; Tue, 13 Dec 2005 11:25:41 -0600 Received: from localhost (akini@localhost) by karadi.cs.wisc.edu (8.13.1/8.13.1/Submit) with ESMTP id jBDHPeYh001054 for ; Tue, 13 Dec 2005 11:25:40 -0600 X-Authentication-Warning: karadi.cs.wisc.edu: akini owned process doing -bs Date: Tue, 13 Dec 2005 11:25:40 -0600 (CST) From: Ameet Kini To: pgsql-performance@postgresql.org Subject: Lots of postmaster processes (fwd) 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, score=0.133 required=5 tests=[AWL=0.133] X-Spam-Score: 0.133 X-Spam-Level: X-Archive-Number: 200512/318 X-Sequence-Number: 16139 Resending it here as it may be more relevant here... Ameet ---------- Forwarded message ---------- Date: Tue, 13 Dec 2005 11:24:26 -0600 (CST) From: Ameet Kini To: pgsql-admin@postgresql.org Subject: Lots of postmaster processes In our installation of the postgres 7.4.7, we are seeing a lot of the following postmaster processes (around 50) being spawned by the initial postmaster process once in a while: postgres 3977 1 1 Nov03 ? 15:11:38 /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 ...... postgres 31985 3977 0 10:08 ? 00:00:00 /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 postgres 31986 3977 0 10:08 ? 00:00:00 /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 postgres 31987 3977 0 10:08 ? 00:00:00 /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 postgres 31988 3977 0 10:08 ? 00:00:00 /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 ...... At the same time when these processes being spawned, sometimes there is also the checkpoint subprocess. I am not sure if that is related. The document doesn't provide any information. The other activity going on at the same time is a 'COPY' statement from a client application. These extra processes put a considerable load on the machine and cause it to hang up. Thanks, Ameet From pgsql-general-owner@postgresql.org Tue Dec 13 13:40:15 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B71B89DC85D for ; Tue, 13 Dec 2005 13:40:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57554-02 for ; Tue, 13 Dec 2005 13:40:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id EA9AD9DC856 for ; Tue, 13 Dec 2005 13:40:06 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 13 Dec 2005 11:40:06 -0600 Subject: Re: Memory Leakage Problem From: Scott Marlowe To: Tom Lane Cc: John Sidney-Woollett , pgsql general In-Reply-To: <6375.1134486792@sss.pgh.pa.us> References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> <3666.1134460063@sss.pgh.pa.us> <439E80B1.8030800@wardbrook.com> <6375.1134486792@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1134495605.3587.110.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 13 Dec 2005 11:40:06 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/651 X-Sequence-Number: 88214 On Tue, 2005-12-13 at 09:13, Tom Lane wrote: > John Sidney-Woollett writes: > > Tom Lane wrote: > >> *What* is consuming memory, exactly --- which processes? > > > Sorry but I don't know how to determine that. > > Try "ps auxw", or some other incantation if you prefer, so long as it > includes some statistics about process memory use. What you showed us > is certainly not helpful. Or run top and hit M while it's running, and it'll sort according to what uses the most memory. From pgsql-general-owner@postgresql.org Tue Dec 13 13:58:31 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 865B39DC81E for ; Tue, 13 Dec 2005 13:58:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62408-05 for ; Tue, 13 Dec 2005 13:58:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A397B9DC819 for ; Tue, 13 Dec 2005 13:58:22 -0400 (AST) 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 jBDHwMqv008386; Tue, 13 Dec 2005 12:58:22 -0500 (EST) To: johnsw@wardbrook.com cc: "pgsql general" Subject: Re: Memory Leakage Problem In-reply-to: <6597.195.152.219.3.1134491862.squirrel@mercury.wardbrook.com> References: <1133891282.11803.7.camel@state.g2switchworks.com> <1133991204.11803.43.camel@state.g2switchworks.com> <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> <3666.1134460063@sss.pgh.pa.us> <439E80B1.8030800@wardbrook.com> <6375.1134486792@sss.pgh.pa.us> <6597.195.152.219.3.1134491862.squirrel@mercury.wardbrook.com> Comments: In-reply-to "John Sidney-Woollett" message dated "Tue, 13 Dec 2005 16:37:42 +0000" Date: Tue, 13 Dec 2005 12:58:22 -0500 Message-ID: <8385.1134496702@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/655 X-Sequence-Number: 88218 "John Sidney-Woollett" writes: > Is it possible to grab memory outsize of a processes space? Not unless there's a kernel bug involved. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 13 18:48:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C96719DC898 for ; Tue, 13 Dec 2005 18:48:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53048-07 for ; Tue, 13 Dec 2005 18:48:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 978639DC81E for ; Tue, 13 Dec 2005 18:48:01 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.28.16]) by smtp.nildram.co.uk (Postfix) with ESMTP id 4DCFB26DAA3; Tue, 13 Dec 2005 22:47:59 +0000 (GMT) Subject: Re: query from partitions From: Simon Riggs To: Richard Huxton Cc: =?iso-8859-5?Q?=22=BA=DB=EE=E7=DD=D8=DA=DE=D2_?= =?iso-8859-5?Q?=B0=2E=C1=2E=22?= , pgsql-performance@postgresql.org In-Reply-To: <439EEFCF.8000505@archonet.com> References: <20051213151818.GA10021@mail.analytic.mv.ru> <439EEFCF.8000505@archonet.com> Content-Type: text/plain; charset=utf-8 Date: Tue, 13 Dec 2005 22:48:02 +0000 Message-Id: <1134514082.27873.116.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/319 X-Sequence-Number: 16140 On Tue, 2005-12-13 at 15:59 +0000, Richard Huxton wrote: > Ключников А.С. wrote: > > And > > select * from base > > where id in (1,2) and datatime between '2005-05-15' and '2005-05-17'; > > 10 seconds > > > > select * from base > > where id in (select id from device where id = 1 or id = 2) and > > datatime between '2005-05-15' and '2005-05-17'; > > 10 minits > > > > Why? > > Run EXPLAIN ANALYSE on both queries to see how the plan has changed. > > My guess for why the plans are different is that in the first case your > query ends up as ...where (id=1 or id=2)... > > In the second case, the planner doesn't know what it's going to get back > from the subquery until it's executed it, so can't tell it just needs to > scan base_1,base_2. Result: you'll scan all child tables of base. > > I think the planner will occasionally evaluate constants before > planning, but I don't think it will ever execute a subquery and then > re-plan the outer query based on those results. Of course, someone might > pop up and tell me I'm wrong now... Thats right. Partitioning doesn't work for joins in 8.1. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Dec 13 19:17:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 207FE9DC859 for ; Tue, 13 Dec 2005 19:17:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60388-07 for ; Tue, 13 Dec 2005 19:17:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id CF50C9DC84B for ; Tue, 13 Dec 2005 19:17:03 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.28.16]) by smtp.nildram.co.uk (Postfix) with ESMTP id F16B926A821; Tue, 13 Dec 2005 23:17:01 +0000 (GMT) Subject: Re: Table Partitions / Partial Indexes From: Simon Riggs To: Mike C Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Date: Tue, 13 Dec 2005 23:17:05 +0000 Message-Id: <1134515825.27873.122.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/320 X-Sequence-Number: 16141 On Mon, 2005-12-12 at 15:07 +1300, Mike C wrote: > Partitioning on date range doesn't make much sense for this setup, > where a typical 1-month query spans both tables (as the billing month > for the customer might start midway through a calendar month). Maybe not for queries, but if you use a date range then you never need to run a DELETE and never need to VACUUM. You could split the data into two-day chunks. > Am I using a horrid method for partitioning the data? (% 10) No, but what benefit do you think it provides. I'm not sure I see... > Should there be that big of an improvement for multiple tables given > that all the data is still stored on the same filesystem? You could store partitions in separate tablespaces/filesystems. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Dec 13 19:18:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0C7D59DC8A0 for ; Tue, 13 Dec 2005 19:18:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60430-09 for ; Tue, 13 Dec 2005 19:18:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id A420B9DC89F for ; Tue, 13 Dec 2005 19:18:48 -0400 (AST) Received: from wsmail05.firstam.com (unknown [208.246.100.97]) by svr2.postgresql.org (Postfix) with ESMTP id 681CCF0B1A for ; Tue, 13 Dec 2005 23:18:49 +0000 (GMT) Received: from 172.21.131.5 by wsmailap02.firstam.com with ESMTP ( Tumbleweed MMS SMTP Relay (MMS v5.6.3)); Tue, 13 Dec 2005 15:18:28 -0800 X-Server-Uuid: 7F57BFB8-2F8F-44C6-8C75-DD639B93CEA6 Received: from pisgsna01smmx01.ana.firstamdata.com ([172.17.88.35]) by famarp01.firstam.com (MOS 3.5.6-GR) with ESMTP id FWT49168; Tue, 13 Dec 2005 15:18:34 -0800 (PST) Received: from pisgana01sxch21.ana.firstamdata.com (Not Verified[192.168.173.71]) by pisgsna01smmx01.ana.firstamdata.com with NetIQ MailMarshal (v6,0,3,8) id ; Tue, 13 Dec 2005 15: 18:35 -0800 Received: from pisgsna01sxch01.ana.firstamdata.com ([172.17.88.70]) by pisgana01sxch21.ana.firstamdata.com with Microsoft SMTPSVC(6.0.3790.211 ); Tue, 13 Dec 2005 15:18:34 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Should Oracle outperform PostgreSQL on a complex Date: Tue, 13 Dec 2005 15:18:35 -0800 Message-ID: Thread-Topic: [PERFORM] Should Oracle outperform PostgreSQL on a complex multidimensional query? Thread-Index: AcX+kvtVuQdMYUxFQDaQbvi6pzvBswBp+aUg From: "Tomeh, Husam" To: "=?iso-8859-1?Q?P=E5l_Stenslet?=" Cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 13 Dec 2005 23:18:34.0570 (UTC) FILETIME=[8A0B3AA0:01C6003B] X-WSS-ID: 6F81894E24O507294-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/321 X-Sequence-Number: 16142 =20 Postgres 8.1 performance rocks (compared with 8.0) specially with the use= =20in-memory index bitmaps. Complex queries that used to take 30+ minutes= , it takes now a few minutes to complete in 8.1. Many thanks to the all = wonderful developers for the huge 8.1 performance boost. --- =20 =20 Husam Tomeh -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-ow= ner@postgresql.org] On Behalf Of Tom Lane Sent: Sunday, December 11, 2005 12:39 PM To: P=E5l Stenslet Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Should Oracle outperform PostgreSQL on a complex m= ultidimensional query? Perhaps you should be trying this on PG 8.1? In any case, without specific details of your schema or a look at EXPLAIN ANALYZE results, it's unlikely that anyone is going to have any useful comments for you. =09 regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster ********************************************************************** This message contains confidential information intended only for the use = of the addressee(s) named above and may contain information that is legal= ly privileged. If you are not the addressee, or the person responsible f= or delivering it to the addressee, you are hereby notified that reading, = disseminating, distributing or copying this message is strictly prohibite= d. If you have received this message by mistake, please immediately noti= fy us by replying to the message and delete the original message immediat= ely thereafter. Thank you. =0D =20 FADLD Tag ********************************************************************** From pgsql-performance-owner@postgresql.org Tue Dec 13 19:28:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9C3AE9DC8AE for ; Tue, 13 Dec 2005 19:28:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62883-09 for ; Tue, 13 Dec 2005 19:28:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 6C2BA9DC898 for ; Tue, 13 Dec 2005 19:28:47 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.28.16]) by smtp.nildram.co.uk (Postfix) with ESMTP id 0E7B526A6FD; Tue, 13 Dec 2005 23:28:46 +0000 (GMT) Subject: Re: Should Oracle outperform PostgreSQL on a complex From: Simon Riggs To: =?ISO-8859-1?Q?P=E5l?= Stenslet Cc: pgsql-performance@postgresql.org In-Reply-To: <43D5D5C1F10C384B9AB4AE34A0510EC12B2B66@e1.exie.no> References: <43D5D5C1F10C384B9AB4AE34A0510EC12B2B66@e1.exie.no> Content-Type: text/plain; charset=utf-8 Date: Tue, 13 Dec 2005 23:28:49 +0000 Message-Id: <1134516529.27873.133.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/322 X-Sequence-Number: 16143 On Thu, 2005-12-08 at 12:26 +0100, Pål Stenslet wrote: > I'm currently benchmarking several RDBMSs with respect to analytical > query performance on medium-sized multidimensional data sets. The data > set contains 30,000,000 fact rows evenly distributed in a > multidimensional space of 9 hierarchical dimensions. Each dimension > has 8000 members. > I have established similar conditions for the query in PostgreSQL, and > it runs in about 30 seconds. Again the CPU utilization is high with no > noticable I/O. The query plan is of course very different from that of > Oracle, since PostgreSQL lacks the bitmap index merge operation. It > narrows down the result one dimension at a time, using the > single-column indexes provided. It is not an option for us to provide > multi-column indexes tailored to the specific query, since we want > full freedom as to which dimensions each query will use. > Are these the results we should expect when comparing PostgreSQL to > Oracle for such queries, or are there special optimization options for > PostgreSQL that we may have overlooked? (I wouldn't be suprised if > there are, since I spent at least 2 full days trying to trigger the > star optimization magic in my Oracle installation.) Yes, I'd expect something like this right now in 8.1; the numbers stack up to PostgreSQL doing equivalent join speeds, but w/o star join. You've confused the issue here since: - Oracle performs star joins using a bit map index transform. It is the star join that is the important bit here, not the just the bitmap part. - PostgreSQL does actually provide bitmap index merge, but not star join (YET!) [I've looked into this, but there seem to be multiple patent claims covering various aspects of this technique, yet at least other 3 vendors manage to achieve this. So far I've not dug too deeply, but I understand the optimizations we'd need to perform in PostgreSQL to do this.] Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Dec 13 19:54:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6B27F9DC84B for ; Tue, 13 Dec 2005 19:54:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69761-06 for ; Tue, 13 Dec 2005 19:54:12 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.193]) by postgresql.org (Postfix) with ESMTP id CB0149DC813 for ; Tue, 13 Dec 2005 19:54:07 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so916279nzn for ; Tue, 13 Dec 2005 15:54:10 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=ptFOLyAY00LSDQltMfdKrKZtN+vU/QJ+6NcAQo/nxFXzYweofj9XcwcHBdmzk0p+S/A/GFoc2b+Rye1i8tKw9wfGZL+PBLiTVCNRRhS47lpwoega9J7uRVZjlup4qpQem8GmzlOayiKVnuAn9gbUCmvLwQ8qDtnTtjoy88FNicQ= Received: by 10.65.75.20 with SMTP id c20mr142259qbl; Tue, 13 Dec 2005 15:54:08 -0800 (PST) Received: by 10.64.53.8 with HTTP; Tue, 13 Dec 2005 15:54:07 -0800 (PST) Message-ID: Date: Wed, 14 Dec 2005 12:54:08 +1300 From: Mike C To: Simon Riggs Subject: Re: Table Partitions / Partial Indexes Cc: pgsql-performance@postgresql.org In-Reply-To: <1134515825.27873.122.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10439_17780420.1134518048005" References: <1134515825.27873.122.camel@localhost.localdomain> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.107, HTML_MESSAGE=0.001] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200512/323 X-Sequence-Number: 16144 ------=_Part_10439_17780420.1134518048005 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 12/14/05, Simon Riggs wrote: > > Maybe not for queries, but if you use a date range then you never need > to run a DELETE and never need to VACUUM. > > You could split the data into two-day chunks. That's an interesting idea, thanks. > Am I using a horrid method for partitioning the data? (% 10) > > No, but what benefit do you think it provides. I'm not sure I see... I was trying to get both the indexes to be smaller without loosing selectivity, and make any table scans/index scans faster from having to rea= d less data. > Should there be that big of an improvement for multiple tables given > > that all the data is still stored on the same filesystem? > > You could store partitions in separate tablespaces/filesystems. > Ideally that's what I would do, but to make the most of that I would have t= o have a dedicated RAID setup for each partition right? (Which is a bit price= y for the budget). Cheers, Mike ------=_Part_10439_17780420.1134518048005 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 12/14/05, Simon Riggs <simon@2ndquadrant.com> wrote:
Maybe not for queries, but if you use a date range then you never need
t= o run a DELETE and never need to VACUUM.

You could split the data in= to two-day chunks.

That's an interesting idea, thanks.

> Am= I using a horrid method for partitioning the data? (% 10)

No, but w= hat benefit do you think it provides. I'm not sure I see...

I was trying to get both the indexes to be smaller without loosing selectivity, and make any table scans/index scans faster from having to read less data.

> Should= there be that big of an improvement for multiple tables given
> that= all the data is still stored on the same filesystem?

You could store partitions in separate tablespaces/filesystems.
=

Ideally that's what I would do, but to make the most of that I would have to have a dedicated RAID setup for each partition right? (Which is a bit pricey for the budget).

Cheers,

Mike
------=_Part_10439_17780420.1134518048005-- From pgsql-performance-owner@postgresql.org Tue Dec 13 21:55:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DB2159DC8A1 for ; Tue, 13 Dec 2005 21:55:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00531-05 for ; Tue, 13 Dec 2005 21:55:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id AAED89DC88B for ; Tue, 13 Dec 2005 21:55:08 -0400 (AST) Received: from 172.16.1.24 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Tue, 13 Dec 2005 20:55:03 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Dec 2005 20:55:03 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Should Oracle outperform PostgreSQL on a complex Date: Tue, 13 Dec 2005 20:54:38 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01D8A4E3@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Should Oracle outperform PostgreSQL on a complex Thread-Index: AcYAPQqmA8v0hpZxQIikSeL69/2oLgAE50Eg From: "Luke Lonergan" To: "Simon Riggs" , "=?iso-8859-1?Q?P=E5l_Stenslet?=" cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 14 Dec 2005 01:55:03.0213 (UTC) FILETIME=[661C75D0:01C60051] X-WSS-ID: 6F81A4FD2341120107-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/324 X-Sequence-Number: 16145 Simon,=20 > Yes, I'd expect something like this right now in 8.1; the=20 > numbers stack up to PostgreSQL doing equivalent join speeds,=20 > but w/o star join. I do expect a significant improvement from 8.1 using the new bitmap = index because there is no need to scan the full Btree indexes. Also, = the new bitmap index has a fast compressed bitmap storage and access = that make the AND operations speedy with no loss like the bitmap scan = lossy compression, which may enhance the selectivity on very large = datasets. > You've confused the issue here since: > - Oracle performs star joins using a bit map index transform.=20 > It is the star join that is the important bit here, not the=20 > just the bitmap part. > - PostgreSQL does actually provide bitmap index merge, but=20 > not star join > (YET!) Yes, that is true, a star join optimization may be a big deal, I'm not = sure. I've certainly talked to people with that experience from = RedBrick, Teradata and Oracle. =20 > [I've looked into this, but there seem to be multiple patent=20 > claims covering various aspects of this technique, yet at=20 > least other 3 vendors manage to achieve this. So far I've not=20 > dug too deeply, but I understand the optimizations we'd need=20 > to perform in PostgreSQL to do this.] Hmm - I bet there's a way. You should test the new bitmap index in Bizgres - it rocks hard. We're = prepping a Postgres 8.1.1 patch soon, but you can get it in Bizgres CVS = now. - Luke From pgsql-performance-owner@postgresql.org Wed Dec 21 01:02:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 45BA49DC862 for ; Wed, 14 Dec 2005 02:50:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74910-09 for ; Wed, 14 Dec 2005 02:50:01 -0400 (AST) X-Greylist: delayed 00:06:39.1047 by SQLgrey- Received: from mail.bway.net (xena.bway.net [216.220.96.26]) by postgresql.org (Postfix) with ESMTP id 1A68D9DC812 for ; Wed, 14 Dec 2005 02:49:58 -0400 (AST) Received: (qmail 7103 invoked by uid 0); 14 Dec 2005 06:43:19 -0000 Received: from unknown (HELO white.nat.fasttrackmonkey.com) (spork@bway.net@216.220.116.154) by smtp.bway.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 14 Dec 2005 06:43:19 -0000 Date: Wed, 14 Dec 2005 01:43:41 -0500 (EST) From: Charles Sprickman To: pgsql-performance@postgresql.org Subject: SAN/NAS options 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/521 X-Sequence-Number: 16342 Hello all, It seems that I'm starting to outgrow our current Postgres setup. We've been running a handful of machines as standalone db servers. This is all in a colocation environment, so everything is stuffed into 1U Supermicro boxes. Our standard build looks like this: Supermicro 1U w/SCA backplane and 4 bays 2x2.8 GHz Xeons Adaptec 2015S "zero channel" RAID card 2 or 4 x 73GB Seagate 10K Ultra 320 drives (mirrored+striped) 2GB RAM FreeBSD 4.11 PGSQL data from 5-10GB per box Recently I started studying what we were running up against in our nightly runs that do a ton of updates/inserts to prep things for the tasks the db does during the business day (light mix of selects/inserts/updates). While we have plenty of disk bandwidth (according to bonnie), we are really dying on IOPS. I'm guessing this is a mix of a rather anemic RAID controller (ever notice how adaptec doesn't publish any real performance specs on raid cards?) and having only two or four spindles (effectively 1 or 2 on writes). So that's where we are... I'm new to the whole SAN thing, but did recently pick up a few used NetApp shelves and a Fibre Channel RAID HBA (Mylex ExtremeRAID 3000, also used) to toy with. I started wondering if I could put something together to both get our storage on one set of boxes and allow me to get data striped across more drives. Our budget is not huge and we are not adverse to getting used gear where appropriate. What do you folks recommend? I'm just starting to look at what's out there for SANs and NAS, and from what I've seen, our options are: NetApp Filers - the pluses with these are that if we use NFS, we don't have to worry about either large filesystem support in FreeBSD (2TB practical limit), or limitation on "growing" partitions as the NetApp just deals with that. I also understand these make backups a bit simpler. I have a great, trusted, spare-stocking source for these. Apple X-Serve RAID - well, it's pretty cheap. Honestly, that's all I know about it - they don't talk about IOPS numbers, and I have no idea what lurks in that box as a RAID controller. SAN box w/integrated RAID - it seems like this might not be a good choice since the RAID hardware in the box may be where I hit any limits. I also imagine I'm probably overpaying for some OEM RAID controller integrated into the box. No idea where to look for used gear. SAN box, JBOD - this seems like it might be affordable as well. A few big shelves full of drives a SAN "switch" to plug all the shelves and hosts into and a FC RAID card in each host. No idea where to look for used gear here either. You'll note that I'm being somewhat driven by my OS of choice, FreeBSD. Unlike Solaris or other commercial offerings, there is no nice volume management available. While I'd love to keep managing a dozen or so FreeBSD boxes, I could be persuaded to go to Solaris x86 if the volume management really shines and Postgres performs well on it. Lastly, one thing that I'm not yet finding in trying to educate myself on SANs is a good overview of what's come out in the past few years that's more affordable than the old big-iron stuff. For example I saw some brief info on this list's archives about the Dell/EMC offerings. Anything else in that vein to look at? I hope this isn't too far off topic for this list. Postgres is the main application that I'm looking to accomodate. Anything else I can do with whatever solution we find is just gravy... Thanks! Charles From pgsql-performance-owner@postgresql.org Wed Dec 14 02:55:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C05549DC812 for ; Wed, 14 Dec 2005 02:55:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75317-10 for ; Wed, 14 Dec 2005 02:55:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.bway.net (xena.bway.net [216.220.96.26]) by postgresql.org (Postfix) with ESMTP id 547D89DC810 for ; Wed, 14 Dec 2005 02:55:48 -0400 (AST) Received: (qmail 25656 invoked by uid 0); 14 Dec 2005 06:55:48 -0000 Received: from unknown (HELO white.nat.fasttrackmonkey.com) (spork@bway.net@216.220.116.154) by smtp.bway.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 14 Dec 2005 06:55:48 -0000 Date: Wed, 14 Dec 2005 01:56:10 -0500 (EST) From: Charles Sprickman To: pgsql-performance@postgresql.org Subject: SAN/NAS options 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/325 X-Sequence-Number: 16146 Hello all, It seems that I'm starting to outgrow our current Postgres setup. We've been running a handful of machines as standalone db servers. This is all in a colocation environment, so everything is stuffed into 1U Supermicro boxes. Our standard build looks like this: Supermicro 1U w/SCA backplane and 4 bays 2x2.8 GHz Xeons Adaptec 2015S "zero channel" RAID card 2 or 4 x 73GB Seagate 10K Ultra 320 drives (mirrored+striped) 2GB RAM FreeBSD 4.11 PGSQL data from 5-10GB per box Recently I started studying what we were running up against in our nightly runs that do a ton of updates/inserts to prep things for the tasks the db does during the business day (light mix of selects/inserts/updates). While we have plenty of disk bandwidth (according to bonnie), we are really dying on IOPS. I'm guessing this is a mix of a rather anemic RAID controller (ever notice how adaptec doesn't publish any real performance specs on raid cards?) and having only two or four spindles (effectively 1 or 2 on writes). So that's where we are... I'm new to the whole SAN thing, but did recently pick up a few used NetApp shelves and a Fibre Channel RAID HBA (Mylex ExtremeRAID 3000, also used) to toy with. I started wondering if I could put something together to both get our storage on one set of boxes and allow me to get data striped across more drives. Our budget is not huge and we are not adverse to getting used gear where appropriate. What do you folks recommend? I'm just starting to look at what's out there for SANs and NAS, and from what I've seen, our options are: NetApp Filers - the pluses with these are that if we use NFS, we don't have to worry about either large filesystem support in FreeBSD (2TB practical limit), or limitation on "growing" partitions as the NetApp just deals with that. I also understand these make backups a bit simpler. I have a great, trusted, spare-stocking source for these. Apple X-Serve RAID - well, it's pretty cheap. Honestly, that's all I know about it - they don't talk about IOPS numbers, and I have no idea what lurks in that box as a RAID controller. SAN box w/integrated RAID - it seems like this might not be a good choice since the RAID hardware in the box may be where I hit any limits. I also imagine I'm probably overpaying for some OEM RAID controller integrated into the box. No idea where to look for used gear. SAN box, JBOD - this seems like it might be affordable as well. A few big shelves full of drives a SAN "switch" to plug all the shelves and hosts into and a FC RAID card in each host. No idea where to look for used gear here either. You'll note that I'm being somewhat driven by my OS of choice, FreeBSD. Unlike Solaris or other commercial offerings, there is no nice volume management available. While I'd love to keep managing a dozen or so FreeBSD boxes, I could be persuaded to go to Solaris x86 if the volume management really shines and Postgres performs well on it. Lastly, one thing that I'm not yet finding in trying to educate myself on SANs is a good overview of what's come out in the past few years that's more affordable than the old big-iron stuff. For example I saw some brief info on this list's archives about the Dell/EMC offerings. Anything else in that vein to look at? I hope this isn't too far off topic for this list. Postgres is the main application that I'm looking to accomodate. Anything else I can do with whatever solution we find is just gravy... Thanks! Charles From pgsql-performance-owner@postgresql.org Wed Dec 14 03:14:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AFD2F9DC80F for ; Wed, 14 Dec 2005 03:14:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81041-05 for ; Wed, 14 Dec 2005 03:14:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id 201EC9DC84D for ; Wed, 14 Dec 2005 03:14:20 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Wed, 14 Dec 2005 02:14:04 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 14 Dec 2005 02:10:46 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: SAN/NAS options Date: Wed, 14 Dec 2005 02:10:20 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01D8A503@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] SAN/NAS options Thread-Index: AcYAe4B/Q/D7Ap88RCK/1kQczSlfyAAALjvw From: "Luke Lonergan" To: "Charles Sprickman" , pgsql-performance@postgresql.org X-OriginalArrivalTime: 14 Dec 2005 07:10:46.0759 (UTC) FILETIME=[81582F70:01C6007D] X-WSS-ID: 6F8119A73ZO1404773-03-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/326 X-Sequence-Number: 16147 Charles, > Lastly, one thing that I'm not yet finding in trying to=20 > educate myself on SANs is a good overview of what's come out=20 > in the past few years that's more affordable than the old=20 > big-iron stuff. For example I saw some brief info on this=20 > list's archives about the Dell/EMC offerings. Anything else=20 > in that vein to look at? My two cents: SAN is a bad investment, go for big internal storage. The 3Ware or Areca SATA RAID adapters kick butt and if you look in the newest colos (I was just in ours "365main.net" today), you will see rack on rack of machines with from 4 to 16 internal SATA drives. Are they all DB servers? Not necessarily, but that's where things are headed. You can get a 3U server with dual opteron 250s, 16GB RAM and 16x 400GB SATAII drives with the 3Ware 9550SX controller for $10K - we just ordered 4 of them. I don't think you can buy an external disk chassis and a Fibre channel NIC for that. Performance? 800MB/s RAID5 reads, 400MB/s RAID5 writes. Random IOs are also very high for RAID10, but we don't use it so YMMV - look at Areca and 3Ware. Managability? Good web management interfaces with 6+ years of development from 3Ware, e-mail, online rebuild options, all the goodies. No "snapshot" or offline backup features like the high-end SANs, but do you really need it? Need more power or storage over time? Run a parallel DB like Bizgres MPP, you can add more servers with internal storage and increase your I/O, CPU and memory. - Luke From pgsql-performance-owner@postgresql.org Wed Dec 14 03:29:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D1439DC81E for ; Wed, 14 Dec 2005 03:29:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84453-03 for ; Wed, 14 Dec 2005 03:29:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id E0A289DC810 for ; Wed, 14 Dec 2005 03:29:00 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRH008QX8SCLT@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Wed, 14 Dec 2005 20:29:00 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-199.dsl.clear.net.nz [218.101.29.199]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id AB0008D9151; Wed, 14 Dec 2005 20:28:59 +1300 (NZDT) Date: Wed, 14 Dec 2005 20:28:56 +1300 From: Mark Kirkwood Subject: Re: SAN/NAS options In-reply-to: To: Charles Sprickman Cc: pgsql-performance@postgresql.org Message-id: <439FC9B8.8020709@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.666 required=5 tests=[AWL=0.666] X-Spam-Score: 0.666 X-Spam-Level: X-Archive-Number: 200512/327 X-Sequence-Number: 16148 Charles Sprickman wrote: > Hello all, > > It seems that I'm starting to outgrow our current Postgres setup. We've > been running a handful of machines as standalone db servers. This is > all in a colocation environment, so everything is stuffed into 1U > Supermicro boxes. Our standard build looks like this: > > Supermicro 1U w/SCA backplane and 4 bays > 2x2.8 GHz Xeons > Adaptec 2015S "zero channel" RAID card > 2 or 4 x 73GB Seagate 10K Ultra 320 drives (mirrored+striped) > 2GB RAM > FreeBSD 4.11 > PGSQL data from 5-10GB per box > > Recently I started studying what we were running up against in our > nightly runs that do a ton of updates/inserts to prep things for the > tasks the db does during the business day (light mix of > selects/inserts/updates). While we have plenty of disk bandwidth > (according to bonnie), we are really dying on IOPS. I'm guessing this is > a mix of a rather anemic RAID controller (ever notice how adaptec > doesn't publish any real performance specs on raid cards?) and having > only two or four spindles (effectively 1 or 2 on writes). > > So that's where we are... > > I'm new to the whole SAN thing, but did recently pick up a few used > NetApp shelves and a Fibre Channel RAID HBA (Mylex ExtremeRAID 3000, > also used) to toy with. I started wondering if I could put something > together to both get our storage on one set of boxes and allow me to get > data striped across more drives. Our budget is not huge and we are not > adverse to getting used gear where appropriate. > > What do you folks recommend? I'm just starting to look at what's out > there for SANs and NAS, and from what I've seen, our options are: > Leaving the whole SAN issue for a moment: It would be interesting to see if moving to FreeBSD 6.0 would help you - the vfs layer is no longer throttled by the (SMP) GIANT lock in this version, and that may make quite a difference (given you have SMP boxes). Another interesting thing to try is rebuilding the database ufs filesystem(s) with 32K blocks and 4K frags (as opposed to 8K/1K or 16K/2K - can't recall the default on 4.x). I found this to give a factor of 2 speedup on random disk access (specifically queries doing indexed joins). Is it mainly your 2 disk machines that are IOPS bound? if so, a cheap option may be to buy 2 more cheetahs for them! If it's the 4's, well how about a 2U U320 diskpack from whomever supplies you the Supermicro boxes? I have just noticed Luke's posting - I would second the advice to avoid SAN - in my experience it's an expensive way to buy storage. best wishes Mark From pgsql-general-owner@postgresql.org Wed Dec 14 05:21:54 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D8D7B9DC810 for ; Wed, 14 Dec 2005 05:21:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07087-07 for ; Wed, 14 Dec 2005 05:21:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svana.org (svana.org [203.20.62.76]) by postgresql.org (Postfix) with ESMTP id 32A6A9DC81E for ; Wed, 14 Dec 2005 05:21:49 -0400 (AST) Received: from kleptog by svana.org with local (Exim 3.35 #1 (Debian)) id 1EmSpR-0004WP-00; Wed, 14 Dec 2005 20:21:41 +1100 Date: Wed, 14 Dec 2005 10:21:41 +0100 From: Martijn van Oosterhout To: John Sidney-Woollett Cc: Tom Lane , pgsql general Subject: Re: Memory Leakage Problem Message-ID: <20051214092137.GA16967@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: John Sidney-Woollett , Tom Lane , pgsql general References: <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> <3666.1134460063@sss.pgh.pa.us> <439E80B1.8030800@wardbrook.com> <6375.1134486792@sss.pgh.pa.us> <6597.195.152.219.3.1134491862.squirrel@mercury.wardbrook.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline In-Reply-To: <6597.195.152.219.3.1134491862.squirrel@mercury.wardbrook.com> User-Agent: Mutt/1.3.28i X-PGP-Key-ID: Length=1024; ID=0x0DC67BE6 X-PGP-Key-Fingerprint: 295F A899 A81A 156D B522 48A7 6394 F08A 0DC6 7BE6 X-PGP-Key-URL: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200512/688 X-Sequence-Number: 88251 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 13, 2005 at 04:37:42PM -0000, John Sidney-Woollett wrote: > I'll run this over the next few days and especially as the server starts > bogging down to see if it identifies the culprit. >=20 > Is it possible to grab memory outsize of a processes space? Or would a > leak always show up by an ever increasing VSZ amount? The only way to know what a process can access is by looking in /proc//maps. This lists all the memory ranges a process can access. The thing about postgres is that each backend dies when the connection closes, so only a handful of processes are going to be around long enough to cause a problem. The ones you need to look at are the number of mappings with a zero-inode excluding the shared memory segment. A diff between two days might tell you which segments are growing. Must be for exactly the same process to be meaningful. Have a nice day, --=20 Martijn van Oosterhout http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them. --AhhlLboLdkugWU4S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQFDn+QhIB7bNG8LQkwRAkjkAJ44/Ma4ZorBghQhnd5c9BZL2AxiYwCbBdWs T/rAoXwOlskZeM1XskRgouM= =XKzb -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S-- From pgsql-performance-owner@postgresql.org Wed Dec 14 09:34:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E64CA9DC99A for ; Wed, 14 Dec 2005 09:34:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99923-01 for ; Wed, 14 Dec 2005 09:34:04 -0400 (AST) X-Greylist: delayed 00:06:37.615997 by SQLgrey- Received: from sapo.pt (relay6.ptmail.sapo.pt [212.55.154.26]) by postgresql.org (Postfix) with SMTP id 1648B9DC943 for ; Wed, 14 Dec 2005 09:33:58 -0400 (AST) Received: (qmail 25848 invoked by uid 0); 14 Dec 2005 13:27:23 -0000 Received: from unknown (HELO sapo.pt) (10.134.35.205) by relay6 with SMTP; 14 Dec 2005 13:27:23 -0000 Received: (qmail 31434 invoked from network); 14 Dec 2005 13:27:23 -0000 X-AntiVirus: PTMail-AV 0.3.87.1 X-Virus-Status: Clean (0.02268 seconds) Received: from unknown (HELO flintstone) (nop05020b@[81.193.91.110]) (envelope-sender ) by mta10 (qmail-ldap-1.03) with SMTP for ; 14 Dec 2005 13:27:23 -0000 From: To: Subject: Convert IN sublink to join Date: Wed, 14 Dec 2005 13:27:21 -0000 Message-ID: <000001c600b2$1ccb44e0$017ba8c0@flintstone> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0001_01C600B2.1CCB44E0" X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcYAshydtVvyCU6JT6uypjEOaIrung== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=4.082 required=5 tests=[DEAR_SOMETHING=1.612, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, HTML_MESSAGE=0.001, NO_REAL_NAME=0.55] X-Spam-Score: 4.082 X-Spam-Level: **** X-Archive-Number: 200512/328 X-Sequence-Number: 16149 This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C600B2.1CCB44E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Dear Sir or Madam: The function "convert_IN_to_join(Query *parse, SubLink *sublink)", from file: /src/backend/optimizer/plan/subselect.c, is responsible for converting IN type sublinks to joins, whenever appropriate. The following lines of code, extracted from convert_IN_to_join, verify if the subquery is correlated: /* * The sub-select must not refer to any Vars of the parent query. * (Vars of higher levels should be okay, though.) */ if (contain_vars_of_level((Node *) subselect, 1)) return NULL; By commenting this code region I was able to optimize several correlated subqueries. Apparently, the rest of the PostgreSQL code is ready to handle the "convert subquery to join" optimization. Is this test really necessary? Please analyze the following example: DDL: CREATE TABLE "students" ( sid char(5) primary key, name char(20) not null, age integer, email char(20) not null, unique( email ), avgrade float not null ); CREATE TABLE "enrolled" ( sid char(5), cid char(5), grade real not null, primary key(sid,cid), foreign key(sid) references students (sid) on delete restrict ); DML: 1) correlated IN subquery: "Find all students who's grade in 'TFC' class is higher than their average grade." select a.sid, a.name from students a where a.sid IN ( select i.sid from enrolled i where i.grade > a.avgrade AND i.cid = 'TFC'); QUERY PLAN: Seq Scan on students a (cost=0.00..5763804.50 rows=5000 width=33) Filter: (subplan) SubPlan -> Seq Scan on enrolled i (cost=0.00..1144.00 rows=3473 width=9) Filter: ((grade > $0) AND (cid = 'TFC'::bpchar)) 2) the same query after commenting out the above code region in convert_IN_to_join: QUERY PLAN: Hash Join (cost=1050.24..1518.21 rows=693 width=33) Hash Cond: ("outer".sid = "inner".sid) Join Filter: ("inner".grade > "outer".avgrade) -> Seq Scan on students a (cost=0.00..367.00 rows=10000 width=41) -> Hash (cost=1045.04..1045.04 rows=2078 width=13) -> HashAggregate (cost=1045.04..1045.04 rows=2078 width=13) -> Seq Scan on enrolled i (cost=0.00..1019.00 rows=10417 width=13) Filter: (cid = 'TFC'::bpchar) 3) Clearly, it is possible to extract the IN subquery from query 1 since the outer attribute a.sid matches, at most once, with the inner tuple i.sid. Although s.sid is not a primary key by itself, together with "i.cid = 'TFC'" conjunct, it forms a unique tuple. Here is an efficient alternative to query 1: select a.sid, a.name from students a, enrolled i where a.sid = i.sid AND i.cid = 'TFC' AND i.grade > a.avgrade; QUERY PLAN: Hash Join (cost=480.00..2366.86 rows=3473 width=33) Hash Cond: ("outer".sid = "inner".sid) Join Filter: ("outer".grade > "inner".avgrade) -> Seq Scan on enrolled i (cost=0.00..1019.00 rows=10417 width=13) Filter: (cid = 'TFC'::bpchar) -> Hash (cost=367.00..367.00 rows=10000 width=41) -> Seq Scan on students a (cost=0.00..367.00 rows=10000 width=41) I have verified that both 2) and 3) return the exact same tuples, query 1) never completed due to the highly inefficient execution plan. Please help me with this issue. Kind regards, Francisco Santos ------=_NextPart_000_0001_01C600B2.1CCB44E0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear Sir or Madam:

Dear Sir or Madam:

The function "convert_IN_to_join(Query *parse, SubLink = *sublink)", from file: <postgres-8.0.4 = root>/src/backend/optimizer/plan/subselect.c, is responsible for converting IN type sublinks to joins, whenever appropriate.

The following lines of code, extracted from convert_IN_to_join, verify = if the subquery is correlated:

      /*
       * The sub-select must not refer to = any Vars of the parent query.
       * (Vars of higher levels should be = okay, though.)
       */
      if (contain_vars_of_level((Node *) = subselect, 1))
      =         return NULL;

By commenting this code region I was able to optimize several correlated subqueries. Apparently, the rest of the PostgreSQL code is ready to = handle the "convert subquery to join" optimization. Is this test really = necessary?

Please analyze the following example:

DDL:
CREATE TABLE "students" ( sid char(5) primary key, name = char(20) not null, age integer, email char(20) not null, unique( email ), avgrade = float not null );
CREATE TABLE "enrolled" ( sid char(5), cid char(5), grade real = not null, primary key(sid,cid), foreign key(sid) references students (sid) = on delete restrict  );

DML:

1) correlated IN subquery:
"Find all students who's grade in 'TFC' class is higher than their = average grade."
select a.sid, a.name from students a where a.sid IN ( select i.sid from enrolled i where i.grade > a.avgrade AND i.cid =3D 'TFC');

QUERY PLAN:

 Seq Scan on students a  (cost=3D0.00..5763804.50 rows=3D5000 = width=3D33)
   Filter: (subplan)
   SubPlan
     ->  Seq Scan on enrolled i  = (cost=3D0.00..1144.00 rows=3D3473 width=3D9)
           Filter: = ((grade > $0) AND (cid =3D 'TFC'::bpchar))

2) the same query after commenting out the above code region in convert_IN_to_join:

QUERY PLAN:

 Hash Join  (cost=3D1050.24..1518.21 rows=3D693 = width=3D33)
   Hash Cond: ("outer".sid =3D = "inner".sid)
   Join Filter: ("inner".grade > = "outer".avgrade)
   ->  Seq Scan on students a  = (cost=3D0.00..367.00 rows=3D10000 width=3D41)
   ->  Hash  (cost=3D1045.04..1045.04 rows=3D2078 = width=3D13)
         ->  = HashAggregate  (cost=3D1045.04..1045.04 rows=3D2078 width=3D13)
            &= nbsp;  ->  Seq Scan on enrolled i  = (cost=3D0.00..1019.00 rows=3D10417 width=3D13)
            &= nbsp;        Filter: (cid =3D = 'TFC'::bpchar)


3) Clearly, it is possible to extract the IN subquery from query 1 since = the outer attribute a.sid matches, at most once, with the inner tuple i.sid. Although s.sid is not a primary key by itself, together with "i.cid = =3D 'TFC'" conjunct, it forms a unique tuple. Here is an efficient = alternative to query 1:

select a.sid, a.name from students a, enrolled i where a.sid =3D i.sid = AND  i.cid =3D 'TFC' AND i.grade > a.avgrade;

QUERY PLAN:

 Hash Join  (cost=3D480.00..2366.86 rows=3D3473 = width=3D33)
   Hash Cond: ("outer".sid =3D = "inner".sid)
   Join Filter: ("outer".grade > = "inner".avgrade)
   ->  Seq Scan on enrolled i  = (cost=3D0.00..1019.00 rows=3D10417 width=3D13)
         Filter: (cid =3D = 'TFC'::bpchar)
   ->  Hash  (cost=3D367.00..367.00 rows=3D10000 = width=3D41)
         ->  Seq Scan on = students a  (cost=3D0.00..367.00 rows=3D10000 width=3D41)


I have verified that both 2) and 3) return the exact same tuples, query = 1) never completed due to the highly inefficient execution plan.
Please help me with this issue.

Kind regards,
Francisco Santos

 

------=_NextPart_000_0001_01C600B2.1CCB44E0-- From pgsql-general-owner@postgresql.org Wed Dec 14 09:46:04 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 330359DC9C3 for ; Wed, 14 Dec 2005 09:46:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06149-04 for ; Wed, 14 Dec 2005 09:46:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mercury.wardbrook.com (host-84-9-98-118.bulldogdsl.com [84.9.98.118]) by postgresql.org (Postfix) with ESMTP id 535D69DC99D for ; Wed, 14 Dec 2005 09:45:59 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mercury.wardbrook.com (Postfix) with ESMTP id C32AD532EB; Wed, 14 Dec 2005 13:43:16 +0000 (GMT) Received: by mercury.wardbrook.com (Postfix, from userid 505) id 99A34532EF; Wed, 14 Dec 2005 13:43:15 +0000 (GMT) Received: from [192.168.0.64] (unknown [192.168.0.1]) by mercury.wardbrook.com (Postfix) with ESMTP id 6CAAB532EB; Wed, 14 Dec 2005 13:43:14 +0000 (GMT) Message-ID: <43A02380.6070203@wardbrook.com> Date: Wed, 14 Dec 2005 13:52:00 +0000 From: John Sidney-Woollett User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Martijn van Oosterhout Cc: pgsql general Subject: Re: Memory Leakage Problem References: <6353.1134016733@sss.pgh.pa.us> <439DDB49.3000905@freedomhealthcare.org> <439E7B7A.9080205@wardbrook.com> <3666.1134460063@sss.pgh.pa.us> <439E80B1.8030800@wardbrook.com> <6375.1134486792@sss.pgh.pa.us> <6597.195.152.219.3.1134491862.squirrel@mercury.wardbrook.com> <20051214092137.GA16967@svana.org> In-Reply-To: <20051214092137.GA16967@svana.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS 0.3.12 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/692 X-Sequence-Number: 88255 Martijn Thanks for the tip. Since the connections on this server are from slon, I'm hoping that they hand around for a *long* time, and long enough to take a look to see what is going on. John Martijn van Oosterhout wrote: > On Tue, Dec 13, 2005 at 04:37:42PM -0000, John Sidney-Woollett wrote: > >>I'll run this over the next few days and especially as the server starts >>bogging down to see if it identifies the culprit. >> >>Is it possible to grab memory outsize of a processes space? Or would a >>leak always show up by an ever increasing VSZ amount? > > > The only way to know what a process can access is by looking in > /proc//maps. This lists all the memory ranges a process can > access. The thing about postgres is that each backend dies when the > connection closes, so only a handful of processes are going to be > around long enough to cause a problem. > > The ones you need to look at are the number of mappings with a > zero-inode excluding the shared memory segment. A diff between two days > might tell you which segments are growing. Must be for exactly the same > process to be meaningful. > > Have a nice day, From pgsql-performance-owner@postgresql.org Wed Dec 14 11:26:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E6B059DC887 for ; Wed, 14 Dec 2005 11:26:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80662-01 for ; Wed, 14 Dec 2005 11:26:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C1E6D9DC82E for ; Wed, 14 Dec 2005 11:26:48 -0400 (AST) 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 jBEFQrZP019523; Wed, 14 Dec 2005 10:26:53 -0500 (EST) To: francisco.santos@tagus.ist.utl.pt cc: pgsql-performance@postgresql.org Subject: Re: Convert IN sublink to join In-reply-to: <000001c600b2$1ccb44e0$017ba8c0@flintstone> References: <000001c600b2$1ccb44e0$017ba8c0@flintstone> Comments: In-reply-to message dated "Wed, 14 Dec 2005 13:27:21 +0000" Date: Wed, 14 Dec 2005 10:26:53 -0500 Message-ID: <19522.1134574013@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/329 X-Sequence-Number: 16150 writes: > /* > * The sub-select must not refer to any Vars of the parent query. > * (Vars of higher levels should be okay, though.) > */ > if (contain_vars_of_level((Node *) subselect, 1)) > return NULL; > By commenting this code region I was able to optimize several correlated > subqueries. It's only pure luck that your test case still produces the right answer. The IN code depends on the assumption that the sub-SELECT is independent of the outer query. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 14 13:53:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 639189DC9EF for ; Wed, 14 Dec 2005 13:53:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38273-06-5 for ; Wed, 14 Dec 2005 13:53:57 -0400 (AST) X-Greylist: delayed 01:00:01.240526 by SQLgrey- Received: from investoranalytics.com (sucker.investoranalytics.com [209.176.75.254]) by postgresql.org (Postfix) with ESMTP id BB28C9DC9F4 for ; Wed, 14 Dec 2005 13:53:54 -0400 (AST) Received: from [10.1.1.6] (HELO [10.1.1.6]) by investoranalytics.com (CommuniGate Pro SMTP 4.3.7) with ESMTP id 362832; Wed, 14 Dec 2005 11:55:24 -0500 User-Agent: Microsoft-Entourage/11.0.0.040405 Date: Wed, 14 Dec 2005 11:53:52 -0500 Subject: Re: SAN/NAS options From: Andrew Rawnsley To: Charles Sprickman , Message-ID: In-Reply-To: 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/330 X-Sequence-Number: 16151 The Apple is, as you say, cheap (except, the Apple markup on the disks fuzzes that a bit). Its easy to set up, and has been quite reliable for me, but do not expect anything resembling good DB performance out of it (I gave up running anything but backup DBs on it). From the mouth of Apple guys, it (and Xsan) are heavily optimized for sequential access. They want to sell piles of these to the music/film industry, where they have some cred. Oracle has apparently gotten some performance gains through raw device pixie dust and voodoo, but even as a (reluctant, kicking-and-screaming) Oracle guy I wouldn't go there. Other goofy things about it: it isn't 1 device with 14 disks and redundant controllers. Its 2 7 disk arrays with non-redundant controllers. It doesn't do RAID10. If you want a gob-o-space with no performance requirements, its fine. Otherwise... On 12/14/05 1:56 AM, "Charles Sprickman" wrote: > Hello all, > > It seems that I'm starting to outgrow our current Postgres setup. We've been > running a handful of machines as standalone db servers. This is all in a > colocation environment, so everything is stuffed into 1U Supermicro boxes. > Our > standard build looks like this: > > Supermicro 1U w/SCA backplane and 4 bays > 2x2.8 GHz Xeons > Adaptec 2015S "zero channel" RAID card > 2 or 4 x 73GB Seagate 10K Ultra 320 drives (mirrored+striped) > 2GB RAM > FreeBSD 4.11 > PGSQL data from 5-10GB per box > > Recently I started studying what we were running up against in our nightly > runs > that do a ton of updates/inserts to prep things for the tasks the db does > during the business day (light mix of selects/inserts/updates). While we have > plenty of disk bandwidth (according to bonnie), we are really dying on IOPS. > I'm guessing this is a mix of a rather anemic RAID controller (ever notice how > adaptec doesn't publish any real performance specs on raid cards?) and having > only two or four spindles (effectively 1 or 2 on writes). > > So that's where we are... > > I'm new to the whole SAN thing, but did recently pick up a few used NetApp > shelves and a Fibre Channel RAID HBA (Mylex ExtremeRAID 3000, also used) to > toy > with. I started wondering if I could put something together to both get our > storage on one set of boxes and allow me to get data striped across more > drives. Our budget is not huge and we are not adverse to getting used gear > where appropriate. > > What do you folks recommend? I'm just starting to look at what's out there > for > SANs and NAS, and from what I've seen, our options are: > > NetApp Filers - the pluses with these are that if we use NFS, we don't have to > worry about either large filesystem support in FreeBSD (2TB practical limit), > or limitation on "growing" partitions as the NetApp just deals with that. I > also understand these make backups a bit simpler. I have a great, trusted, > spare-stocking source for these. > > Apple X-Serve RAID - well, it's pretty cheap. Honestly, that's all I know > about it - they don't talk about IOPS numbers, and I have no idea what lurks > in > that box as a RAID controller. > > SAN box w/integrated RAID - it seems like this might not be a good choice > since > the RAID hardware in the box may be where I hit any limits. I also imagine > I'm > probably overpaying for some OEM RAID controller integrated into the box. No > idea where to look for used gear. > > SAN box, JBOD - this seems like it might be affordable as well. A few big > shelves full of drives a SAN "switch" to plug all the shelves and hosts into > and a FC RAID card in each host. No idea where to look for used gear here > either. > > You'll note that I'm being somewhat driven by my OS of choice, FreeBSD. Unlike > Solaris or other commercial offerings, there is no nice volume management > available. While I'd love to keep managing a dozen or so FreeBSD boxes, I > could be persuaded to go to Solaris x86 if the volume management really shines > and Postgres performs well on it. > > Lastly, one thing that I'm not yet finding in trying to educate myself on SANs > is a good overview of what's come out in the past few years that's more > affordable than the old big-iron stuff. For example I saw some brief info on > this list's archives about the Dell/EMC offerings. Anything else in that vein > to look at? > > I hope this isn't too far off topic for this list. Postgres is the main > application that I'm looking to accomodate. Anything else I can do with > whatever solution we find is just gravy... > > Thanks! > > Charles > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Wed Dec 14 14:32:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9A5979DC86B for ; Wed, 14 Dec 2005 14:32:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50383-05 for ; Wed, 14 Dec 2005 14:32:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by postgresql.org (Postfix) with ESMTP id 2F9C69DC830 for ; Wed, 14 Dec 2005 14:32:48 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.72.158]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IRI00CSU3HR86O3@vms040.mailsrvcs.net> for pgsql-performance@postgresql.org; Wed, 14 Dec 2005 12:32:16 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 85D8562E5DF for ; Wed, 14 Dec 2005 13:32:15 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15205-02 for ; Wed, 14 Dec 2005 13:32:15 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 5F5206005F5; Wed, 14 Dec 2005 13:32:15 -0500 (EST) Date: Wed, 14 Dec 2005 13:32:15 -0500 From: Michael Stone Subject: Re: SAN/NAS options In-reply-to: To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051214183215.GJ11779@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/331 X-Sequence-Number: 16152 On Wed, Dec 14, 2005 at 11:53:52AM -0500, Andrew Rawnsley wrote: >Other goofy things about it: it isn't 1 device with 14 disks and redundant >controllers. Its 2 7 disk arrays with non-redundant controllers. It doesn't >do RAID10. And if you want hot spares you need *two* per tray (one for each controller). That definately changes the cost curve. :) Mike Stone From pgsql-performance-owner@postgresql.org Wed Dec 21 01:01:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 167929DCA41 for ; Wed, 14 Dec 2005 20:34:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34766-03 for ; Wed, 14 Dec 2005 20:34:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 175FC9DC94C for ; Wed, 14 Dec 2005 20:33:57 -0400 (AST) Received: from m001.prodv.de (m001.prodv.de [217.7.175.96]) by svr2.postgresql.org (Postfix) with ESMTP id 475C3F0B3F for ; Wed, 14 Dec 2005 21:28:41 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id C186CBEA5 for ; Wed, 14 Dec 2005 22:28:38 +0100 (CET) Received: from m001.prodv.de ([127.0.0.1]) by localhost (m001 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16022-07 for ; Wed, 14 Dec 2005 22:28:38 +0100 (CET) Received: from x401.p01.prodv.loc (x401.p01.prodv.loc [172.22.1.117]) by m001.prodv.de (Postfix) with ESMTP id 79B11AE63 for ; Wed, 14 Dec 2005 22:28:38 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: effizient query with jdbc Date: Wed, 14 Dec 2005 22:28:24 +0100 Message-ID: <618D880A81409C48B2766AFACEAC37EECB7AAB@x401.p01.prodv.loc> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: effizient query with jdbc Thread-Index: AcYA9VB6W3amBPg8QVCRcOUs+bs2ow== From: =?iso-8859-1?Q?B=FChler=2C_Johannes?= To: X-Virus-Scanned: amavisd-new at prodv.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/518 X-Sequence-Number: 16339 Hi, I have a java.util.List of values (10000) which i wanted to use for a = query in the where clause of an simple select statement. iterating over = the list and and use an prepared Statement is quite slow. Is there a = more efficient way to execute such a query. Thanks for any help. =20 Johannes =20 ..... =20 List ids =3D new ArrayList();=20 .... List is filled with 10000 values ... List uuids =3D new ArrayList(); =20 PreparedStatement pstat =3D db.prepareStatement("SELECT UUID FROM = MDM.KEYWORDS_INFO WHERE KEYWORDS_ID =3D ?"); =20 for (Iterator iter =3D ids.iterator(); iter.hasNext();) { String id =3D (String) iter.next(); pstat.setString(1, id); rs =3D pstat.executeQuery(); if (rs.next()) { uuids.add(rs.getString(1)); } rs.close(); } ... =20 From pgsql-performance-owner@postgresql.org Wed Dec 14 16:57:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8FE419DC898 for ; Wed, 14 Dec 2005 16:57:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90555-10 for ; Wed, 14 Dec 2005 16:57:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) by postgresql.org (Postfix) with ESMTP id 0D54C9DC87E for ; Wed, 14 Dec 2005 16:57:55 -0400 (AST) Received: from localhost (linux.dunaweb.hu [127.0.0.1]) by linux.dunaweb.hu (Postfix) with ESMTP id 4569A8E0722 for ; Wed, 14 Dec 2005 21:57:53 +0100 (CET) Received: from linux.dunaweb.hu ([127.0.0.1]) by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05795-10 for ; Wed, 14 Dec 2005 21:57:51 +0100 (CET) Received: from szolnok.dunaweb.hu (unknown [192.168.3.154]) by linux.dunaweb.hu (Postfix) with ESMTP id E6F3B8E06F9 for ; Wed, 14 Dec 2005 21:57:51 +0100 (CET) Received: from [81.17.177.202] (unknown [81.17.177.202]) by szolnok.dunaweb.hu (Postfix) with ESMTP id 41C3F8913CC for ; Wed, 14 Dec 2005 21:57:56 +0100 (CET) Message-ID: <43A08EF5.4060306@dunaweb.hu> Date: Wed, 14 Dec 2005 22:30:29 +0100 From: Zoltan Boszormenyi User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: hu-hu, hu, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Auto-tuning a VIEW? Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: amavisd-new at dunaweb.hu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/332 X-Sequence-Number: 16153 Hi, we have a VIEW that is an UNION of 12 SELECTs, and every member of the UNION have a constant field to be able to distinguish between them. An often performed operation on this VIEW is to search for only one record that can be found by the value of the constant field and the serial of a table in one of the UNION members. Unfortunately, the search operation works in such a way so these two fields are concatenated and the results is searched for. Here is a shorter example, so it gets obvious what I tried to describe: create view v1 (code,num) as select 'AAA',id from table1 union select 'BBB',id from table2; The query is: select * from v1 where code||num = 'AAA2005000001'; My problem is that this is slow, even after creating expression indexes on the tables for e.g. ('AAA'||id). If I optimize the UNION manually, it becomes: select * from table1 where 'AAA'||id = 'AAA2005000001' union select * from table2 where 'BBB'||id = 'AAA2005000001'; and because of the expression indexes it's fast. Is there a GEQO setting that make the above optimization on VIEWs automatic? From the VIEW definition, the database already knows the connection between the fields of the view and the fields of the table(s) so the above optimization could be performed automatically. Best regards, Zolt�n B�sz�rm�nyi From pgsql-performance-owner@postgresql.org Wed Dec 14 17:45:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CA9159DCA12 for ; Wed, 14 Dec 2005 17:45:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02510-03 for ; Wed, 14 Dec 2005 17:45:20 -0400 (AST) X-Greylist: delayed 00:06:40.04202 by SQLgrey- Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id 320689DC9D4 for ; Wed, 14 Dec 2005 17:45:16 -0400 (AST) Received: (qmail 2671 invoked from network); 14 Dec 2005 22:38:51 +0100 Received: from boutiquenumerique.com (HELO peufeu.com) (82.67.9.10) by boutiquenumerique.com with SMTP; 14 Dec 2005 22:38:51 +0100 To: "Zoltan Boszormenyi" , pgsql-performance@postgresql.org Subject: Re: Auto-tuning a VIEW? References: <43A08EF5.4060306@dunaweb.hu> Message-ID: Date: Wed, 14 Dec 2005 22:38:49 +0100 From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <43A08EF5.4060306@dunaweb.hu> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/333 X-Sequence-Number: 16154 > create view v1 (code,num) as > select 'AAA',id from table1 > union > select 'BBB',id from table2; As your rows are, by definition, distinct between each subquery, you should use UNION ALL instead of UNION to save postgres the trouble of hunting non-existing duplicates. This will save you a few sorts. > select * from v1 where code||num = 'AAA2005000001'; Why don't you use code='AAA' and num='2005000001' ? From pgsql-performance-owner@postgresql.org Wed Dec 14 18:09:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 427A29DC898 for ; Wed, 14 Dec 2005 18:09:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04759-07 for ; Wed, 14 Dec 2005 18:09:16 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.200]) by postgresql.org (Postfix) with ESMTP id 883B19DC830 for ; Wed, 14 Dec 2005 18:09:12 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i30so177407wxd for ; Wed, 14 Dec 2005 14:09:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=tPkcCdB/Pmp8n6KJAJLa6dcDtl7LwCgDeWqM3fqsqgri46qQeSccUosCSSAqk0zg3lKxV2iR65zYme4WfocMs31U6cMNH/j0xoSTdPSR6V+tX3YIsSgt7/jFafSnfkqgcH72TvCSf4ke+hnWQ0emz21KePkyNYyusckWB6tiutE= Received: by 10.70.124.13 with SMTP id w13mr1509626wxc; Wed, 14 Dec 2005 14:09:14 -0800 (PST) Received: from ?192.168.1.100? ( [67.44.112.218]) by mx.gmail.com with ESMTP id i34sm1485155wxd.2005.12.14.14.08.53; Wed, 14 Dec 2005 14:09:14 -0800 (PST) From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Simple Join Date: Wed, 14 Dec 2005 16:03:52 -0600 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512141603.52583.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/335 X-Sequence-Number: 16156 I'll just start by warning that I'm new-ish to postgresql. I'm running 8.1 installed from source on a Debian Sarge server. I have a simple query that I believe I've placed the indexes correctly for, and I still end up with a seq scan. It makes sense, kinda, but it should be able to use the index to gather the right values. I do have a production set of data inserted into the tables, so this is running realistically: dli=# explain analyze SELECT ordered_products.product_id dli-# FROM to_ship, ordered_products dli-# WHERE to_ship.ordered_product_id = ordered_products.id AND dli-# ordered_products.paid = TRUE AND dli-# ordered_products.suspended_sub = FALSE; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=5126.19..31528.40 rows=20591 width=8) (actual time=6517.438..25123.115 rows=14367 loops=1) Hash Cond: ("outer".ordered_product_id = "inner".id) -> Seq Scan on to_ship (cost=0.00..11529.12 rows=611612 width=8) (actual time=393.206..15711.715 rows=611612 loops=1) -> Hash (cost=4954.79..4954.79 rows=21759 width=16) (actual time=6076.153..6076.153 rows=18042 loops=1) -> Index Scan using paid_index on ordered_products (cost=0.00..4954.79 rows=21759 width=16) (actual time=136.472..5966.275 rows=18042 loops=1) Index Cond: (paid = true) Filter: (paid AND (NOT suspended_sub)) Total runtime: 25136.190 ms (8 rows) This is running on just about the world's slowest server (with a laptop hard drive to boot), but how can I avoid the seq scan, or in general speed up this query? to_ship will have far less tuples than ordered_products, but it's still not small, as you can see. From pgsql-performance-owner@postgresql.org Wed Dec 14 18:18:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 914949DCA36 for ; Wed, 14 Dec 2005 18:18:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05326-09-3 for ; Wed, 14 Dec 2005 18:18:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id E7BDC9DCA49 for ; Wed, 14 Dec 2005 18:18:25 -0400 (AST) Received: (qmail 2980 invoked from network); 14 Dec 2005 23:18:41 +0100 Received: from boutiquenumerique.com (HELO peufeu.com) (82.67.9.10) by boutiquenumerique.com with SMTP; 14 Dec 2005 23:18:41 +0100 To: "Zoltan Boszormenyi" Cc: pgsql-performance@postgresql.org Subject: Re: Auto-tuning a VIEW? References: <43A08EF5.4060306@dunaweb.hu> <43A09F1F.6030105@dunaweb.hu> Message-ID: Date: Wed, 14 Dec 2005 23:18:40 +0100 From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <43A09F1F.6030105@dunaweb.hu> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/336 X-Sequence-Number: 16157 > Thanks, now the SELECT from the huge VIEW runs under one third of the > original runtime. Nice. >>> select * from v1 where code||num = 'AAA2005000001'; I do not know if it is at all possible, but maybe you could use a rule to, on select to your view, do instead a select on the two separate columns used in the key, with a bit of massaging on the values using substring()... From pgsql-performance-owner@postgresql.org Wed Dec 14 18:06:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C7AD69DC9D8 for ; Wed, 14 Dec 2005 18:06:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06706-04 for ; Wed, 14 Dec 2005 18:06:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) by postgresql.org (Postfix) with ESMTP id B2C859DC898 for ; Wed, 14 Dec 2005 18:06:44 -0400 (AST) Received: from localhost (linux.dunaweb.hu [127.0.0.1]) by linux.dunaweb.hu (Postfix) with ESMTP id 820B08E0589; Wed, 14 Dec 2005 23:06:42 +0100 (CET) Received: from linux.dunaweb.hu ([127.0.0.1]) by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23415-01; Wed, 14 Dec 2005 23:06:41 +0100 (CET) Received: from szolnok.dunaweb.hu (unknown [192.168.3.154]) by linux.dunaweb.hu (Postfix) with ESMTP id 80DA38E0366; Wed, 14 Dec 2005 23:06:41 +0100 (CET) Received: from [81.17.177.202] (unknown [81.17.177.202]) by szolnok.dunaweb.hu (Postfix) with ESMTP id 18B418913CC; Wed, 14 Dec 2005 23:06:46 +0100 (CET) Message-ID: <43A09F1F.6030105@dunaweb.hu> Date: Wed, 14 Dec 2005 23:39:27 +0100 From: Zoltan Boszormenyi User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: hu-hu, hu, en-us, en MIME-Version: 1.0 To: PFC Cc: pgsql-performance@postgresql.org Subject: Re: Auto-tuning a VIEW? References: <43A08EF5.4060306@dunaweb.hu> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: amavisd-new at dunaweb.hu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/334 X-Sequence-Number: 16155 PFC írta: > >> create view v1 (code,num) as >> select 'AAA',id from table1 >> union >> select 'BBB',id from table2; > > > As your rows are, by definition, distinct between each subquery, > you should use UNION ALL instead of UNION to save postgres the > trouble of hunting non-existing duplicates. This will save you a few > sorts. Thanks, now the SELECT from the huge VIEW runs under one third of the original runtime. >> select * from v1 where code||num = 'AAA2005000001'; > > > Why don't you use code='AAA' and num='2005000001' ? That's the point, the software environment we use cannot use it. The whole stuff is built on PowerBuilder 8.0.x, using PFC. The communication between the sheet and the response forms allows only one key field, and changing the foundation is risky. One particular application that uses the before mentioned VIEW with the huge UNION also cannot workaround the problem, that's why I asked it. The system is using Informix 9.21 and it's dog slow. I worked with PostgreSQL earlier, and my tests show that PostgreSQL 8.x is at least 5 times faster on normal queries than this other DBMS. So I am trying to port the database contents to PostgreSQL first and test some often used processing, to see whether it's feasible to switch later. Interestingly, the example query I provided runs about two times faster in Informix than in PostgreSQL. I experimented a little and found what I described. Best regards, Zoltán Böszörményi From pgsql-performance-owner@postgresql.org Wed Dec 14 18:47:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C38949DCA0D for ; Wed, 14 Dec 2005 18:47:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11588-05 for ; Wed, 14 Dec 2005 18:47:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 8D83D9DCA1D for ; Wed, 14 Dec 2005 18:47:02 -0400 (AST) 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 jBEMl3Tw007485; Wed, 14 Dec 2005 17:47:03 -0500 (EST) To: Kevin Brown cc: pgsql-performance@postgresql.org Subject: Re: Simple Join In-reply-to: <200512141603.52583.blargity@gmail.com> References: <200512141603.52583.blargity@gmail.com> Comments: In-reply-to Kevin Brown message dated "Wed, 14 Dec 2005 16:03:52 -0600" Date: Wed, 14 Dec 2005 17:47:03 -0500 Message-ID: <7484.1134600423@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/337 X-Sequence-Number: 16158 Kevin Brown writes: > I'm running 8.1 installed from source on a Debian Sarge server. I have a > simple query that I believe I've placed the indexes correctly for, and I > still end up with a seq scan. It makes sense, kinda, but it should be able > to use the index to gather the right values. I continue to marvel at how many people think that if it's not using an index it must ipso facto be a bad plan ... That plan looks perfectly fine to me. You could try forcing some other choices by fooling with the planner enable switches (eg set enable_seqscan = off) but I doubt you'll find much improvement. There are too many rows being pulled from ordered_products to make an index nestloop a good idea. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 14 19:18:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 571119DCA18 for ; Wed, 14 Dec 2005 19:18:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19505-07 for ; Wed, 14 Dec 2005 19:18:28 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by postgresql.org (Postfix) with ESMTP id 7B9789DCA28 for ; Wed, 14 Dec 2005 19:18:24 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so502591wri for ; Wed, 14 Dec 2005 15:18:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:cc:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=dGgVHgQOsWhDa7fE7J7TlUAmQZ9Dvjcg/9P8NqhnItKeLosD1zPSJcCHxOcQxgmXZtFRAG5Qus69KOA6A8GvnYwfl6Cks83RK2RlSvJByO5BzYWA8MdAFhteHu5mqcNXOI9WHR6nfLtQ3SfoM91s/N1E3AejQu80h2f3HaOc0LY= Received: by 10.54.125.7 with SMTP id x7mr1283841wrc; Wed, 14 Dec 2005 15:18:26 -0800 (PST) Received: from ?192.168.1.100? ( [67.44.112.218]) by mx.gmail.com with ESMTP id 35sm2568994wra.2005.12.14.15.18.07; Wed, 14 Dec 2005 15:18:26 -0800 (PST) From: Kevin Brown To: Tom Lane Subject: Re: Simple Join Date: Wed, 14 Dec 2005 17:12:56 -0600 User-Agent: KMail/1.8 References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> In-Reply-To: <7484.1134600423@sss.pgh.pa.us> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512141712.56919.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/338 X-Sequence-Number: 16159 On Wednesday 14 December 2005 16:47, you wrote: > Kevin Brown writes: > > I'm running 8.1 installed from source on a Debian Sarge server. I have a > > simple query that I believe I've placed the indexes correctly for, and I > > still end up with a seq scan. It makes sense, kinda, but it should be > > able to use the index to gather the right values. > > I continue to marvel at how many people think that if it's not using an > index it must ipso facto be a bad plan ... > > That plan looks perfectly fine to me. You could try forcing some other > choices by fooling with the planner enable switches (eg set > enable_seqscan = off) but I doubt you'll find much improvement. There > are too many rows being pulled from ordered_products to make an index > nestloop a good idea. That's fine, so being a postgres novice, as I stated in my original post, what would be the best way to improve performance? Redundant column that's updated via a trigger? I'm asking this list because I'd like to do it right, as opposed to get it done. > regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 14 19:23:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B91A29DCA2F for ; Wed, 14 Dec 2005 19:23:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19741-07 for ; Wed, 14 Dec 2005 19:23:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by postgresql.org (Postfix) with ESMTP id C43399DCA29 for ; Wed, 14 Dec 2005 19:23:17 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so234134wri for ; Wed, 14 Dec 2005 15:23:20 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EuCL0mx1FtGlZgddrUgWI59O/oh4fnsp4RT6MDLFB6xFJRdv5HROeFx1kOo4plyvHhBVvBpqA8VmyoNnQ/hu3Ho52ZBS3LhzK1W+ZX/EMYuOmHQs/mHOZs6CFN4jw8cp+SU8m9PnJI728S53G6GrrKikXocwLGHzMcWr4g58SN8= Received: by 10.54.127.3 with SMTP id z3mr1405454wrc; Wed, 14 Dec 2005 15:23:20 -0800 (PST) Received: by 10.54.98.6 with HTTP; Wed, 14 Dec 2005 15:23:20 -0800 (PST) Message-ID: Date: Wed, 14 Dec 2005 18:23:20 -0500 From: Jaime Casanova To: Kevin Brown Subject: Re: Simple Join Cc: pgsql-performance@postgresql.org In-Reply-To: <200512141603.52583.blargity@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512141603.52583.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.105 required=5 tests=[AWL=0.105] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200512/339 X-Sequence-Number: 16160 On 12/14/05, Kevin Brown wrote: > I'll just start by warning that I'm new-ish to postgresql. > > I'm running 8.1 installed from source on a Debian Sarge server. I have a > simple query that I believe I've placed the indexes correctly for, and I > still end up with a seq scan. It makes sense, kinda, but it should be ab= le > to use the index to gather the right values. I do have a production set = of > data inserted into the tables, so this is running realistically: > what hardware? > dli=3D# explain analyze SELECT ordered_products.product_id > dli-# FROM to_ship, ordered_products > dli-# WHERE to_ship.ordered_product_id =3D ordered_products.id AND > dli-# ordered_products.paid =3D TRUE AND > dli-# ordered_products.suspended_sub =3D FALSE; > QUERY PLAN > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------ > Hash Join (cost=3D5126.19..31528.40 rows=3D20591 width=3D8) (actual > time=3D6517.438..25123.115 rows=3D14367 loops=3D1) > Hash Cond: ("outer".ordered_product_id =3D "inner".id) > -> Seq Scan on to_ship (cost=3D0.00..11529.12 rows=3D611612 width=3D8= ) (actual > time=3D393.206..15711.715 rows=3D611612 loops=3D1) > -> Hash (cost=3D4954.79..4954.79 rows=3D21759 width=3D16) (actual > time=3D6076.153..6076.153 rows=3D18042 loops=3D1) > -> Index Scan using paid_index on ordered_products > (cost=3D0.00..4954.79 rows=3D21759 width=3D16) (actual time=3D136.472..59= 66.275 > rows=3D18042 loops=3D1) > Index Cond: (paid =3D true) > Filter: (paid AND (NOT suspended_sub)) > Total runtime: 25136.190 ms > (8 rows) > show the tables and the indexes for those tables > This is running on just about the world's slowest server (with a laptop h= ard > drive to boot), but how can I avoid the seq scan, or in general speed up = this > query? > > to_ship will have far less tuples than ordered_products, but it's still n= ot > small, as you can see. > -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Wed Dec 14 19:30:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 932C99DC81E for ; Wed, 14 Dec 2005 19:30:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22032-04 for ; Wed, 14 Dec 2005 19:30:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id DE7D89DCA36 for ; Wed, 14 Dec 2005 19:30:18 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRI00MN2HAKLO@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 15 Dec 2005 12:30:21 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-129.dsl.clear.net.nz [218.101.28.129]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 6437AFCF05A; Thu, 15 Dec 2005 12:30:20 +1300 (NZDT) Date: Thu, 15 Dec 2005 12:30:18 +1300 From: Mark Kirkwood Subject: Re: Simple Join In-reply-to: <200512141603.52583.blargity@gmail.com> To: Kevin Brown Cc: pgsql-performance@postgresql.org Message-id: <43A0AB0A.3000403@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.444 required=5 tests=[AWL=0.444] X-Spam-Score: 0.444 X-Spam-Level: X-Archive-Number: 200512/340 X-Sequence-Number: 16161 Kevin Brown wrote: > I'll just start by warning that I'm new-ish to postgresql. > > I'm running 8.1 installed from source on a Debian Sarge server. I have a > simple query that I believe I've placed the indexes correctly for, and I > still end up with a seq scan. It makes sense, kinda, but it should be able > to use the index to gather the right values. I do have a production set of > data inserted into the tables, so this is running realistically: > > dli=# explain analyze SELECT ordered_products.product_id > dli-# FROM to_ship, ordered_products > dli-# WHERE to_ship.ordered_product_id = ordered_products.id AND > dli-# ordered_products.paid = TRUE AND > dli-# ordered_products.suspended_sub = FALSE; You scan 600000 rows from to_ship to get about 25000 - so some way to cut this down would help. Try out an explicit INNER JOIN which includes the filter info for paid and suspended_sub in the join condition (you may need indexes on each of id, paid and suspended_sub, so that the 8.1 optimizer can use a bitmap scan): SELECT ordered_products.product_id FROM to_ship INNER JOIN ordered_products ON (to_ship.ordered_product_id = ordered_products.id AND ordered_products.paid = TRUE AND ordered_products.suspended_sub = FALSE); From pgsql-performance-owner@postgresql.org Wed Dec 14 19:50:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 462719DC94C for ; Wed, 14 Dec 2005 19:50:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25482-05 for ; Wed, 14 Dec 2005 19:50:20 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by postgresql.org (Postfix) with ESMTP id 216379DC85C for ; Wed, 14 Dec 2005 19:50:15 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so508179wri for ; Wed, 14 Dec 2005 15:50:19 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:cc:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=PY1VCa0NOFJAR3Sz12yn+N+ph54TgV7rD9iPMtzMrYZIVxXay3FwMT7UhkKmzqssvfpMWZPg+eVe3OkQemLcK4v8TZu56AQaNLfc8BdrlnefCj66tm+8V71/vd8jv9uSP398YJDZCWNnwlEVMsxCPuDGW64YFOGmR/JndbOt1Rk= Received: by 10.54.139.14 with SMTP id m14mr1359397wrd; Wed, 14 Dec 2005 15:50:18 -0800 (PST) Received: from ?192.168.1.100? ( [67.44.112.218]) by mx.gmail.com with ESMTP id 35sm2596388wra.2005.12.14.15.49.18; Wed, 14 Dec 2005 15:50:18 -0800 (PST) From: Kevin Brown To: Jaime Casanova Subject: Re: Simple Join Date: Wed, 14 Dec 2005 17:44:10 -0600 User-Agent: KMail/1.8 References: <200512141603.52583.blargity@gmail.com> In-Reply-To: Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512141744.10753.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[UPPERCASE_25_50=0] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/342 X-Sequence-Number: 16163 On Wednesday 14 December 2005 17:23, you wrote: > what hardware? Via 800 mhz (about equiv to a 300 mhz pentium 2) 128 mb of slow ram 4200 rpm ide hard drive. Told you it was slow. :-) This is not the production system. I don't expect this to be "fast" but everything else happens in under 2 seconds, so I know I could do this faster. Especially becaue the information I'm looking for probably just needs some denormalization, or other such trick to pop right out. I'm using this system so I can locate my performance bottlenecks easier, and actually, it's plenty fast enough except for this one single query. I don't necessarily want to optimize the query, more than just get the info faster, so that's why I'm posting here. > show the tables and the indexes for those tables No prob: CREATE TABLE to_ship ( id int8 NOT NULL DEFAULT nextval(('to_ship_seq'::text)::regclass), ordered_product_id int8 NOT NULL, bounced int4 NOT NULL DEFAULT 0, operator_id varchar(20) NOT NULL, "timestamp" timestamptz NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, CONSTRAINT to_ship_pkey PRIMARY KEY (id), CONSTRAINT to_ship_ordered_product_id_fkey FOREIGN KEY (ordered_product_id) REFERENCES ordered_products (id) ON UPDATE RESTRICT ON DELETE RESTRICT ) WITHOUT OIDS; CREATE TABLE ordered_products ( id int8 NOT NULL DEFAULT nextval(('ordered_products_seq'::text)::regclass), order_id int8 NOT NULL, product_id int8 NOT NULL, recipient_address_id int8 NOT NULL, hide bool NOT NULL DEFAULT false, renewal bool NOT NULL DEFAULT false, "timestamp" timestamptz NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, operator_id varchar(20) NOT NULL, suspended_sub bool NOT NULL DEFAULT false, quantity int4 NOT NULL DEFAULT 1, price_paid numeric NOT NULL, tax_paid numeric NOT NULL DEFAULT 0, shipping_paid numeric NOT NULL DEFAULT 0, remaining_issue_obligation int4 NOT NULL DEFAULT 0, parent_product_id int8, delivery_method_id int8 NOT NULL, paid bool NOT NULL DEFAULT false, CONSTRAINT ordered_products_pkey PRIMARY KEY (id), CONSTRAINT ordered_products_order_id_fkey FOREIGN KEY (order_id) REFERENCES orders (id) ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT ordered_products_parent_product_id_fkey FOREIGN KEY (parent_product_id) REFERENCES ordered_products (id) ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT ordered_products_recipient_address_id_fkey FOREIGN KEY (recipient_address_id) REFERENCES addresses (id) ON UPDATE RESTRICT ON DELETE RESTRICT ) WITHOUT OIDS; === The two indexes that should matter === CREATE INDEX ordered_product_id_index ON to_ship USING btree (ordered_product_id); CREATE INDEX paid_index ON ordered_products USING btree (paid); ordered_products.id is a primary key, so it should have an implicit index. From pgsql-performance-owner@postgresql.org Wed Dec 14 19:47:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CA3F49DCA25 for ; Wed, 14 Dec 2005 19:47:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24566-05 for ; Wed, 14 Dec 2005 19:47:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 327EE9DCA23 for ; Wed, 14 Dec 2005 19:47:34 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EmgLQ-0000k9-D3 for pgsql-performance@postgresql.org; Thu, 15 Dec 2005 00:47:36 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EmgLQ-00036I-00 for ; Thu, 15 Dec 2005 00:47:36 +0100 Date: Thu, 15 Dec 2005 00:47:36 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Simple Join Message-ID: <20051214234736.GA11885@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <200512141603.52583.blargity@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200512141603.52583.blargity@gmail.com> X-Operating-System: Linux 2.6.14 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/341 X-Sequence-Number: 16162 On Wed, Dec 14, 2005 at 04:03:52PM -0600, Kevin Brown wrote: > -> Index Scan using paid_index on ordered_products > (cost=0.00..4954.79 rows=21759 width=16) (actual time=136.472..5966.275 > rows=18042 loops=1) > Index Cond: (paid = true) > Filter: (paid AND (NOT suspended_sub)) > Total runtime: 25136.190 ms You might want to consider an index on (paid,suspended_sub), not just (paid); it's probably not going to give you any dramatic improvements, but it could help a bit. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Dec 14 20:02:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4F7D79DCA35 for ; Wed, 14 Dec 2005 20:02:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25340-07 for ; Wed, 14 Dec 2005 20:02:47 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by postgresql.org (Postfix) with ESMTP id 1C6F29DCA30 for ; Wed, 14 Dec 2005 20:02:42 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so240522wri for ; Wed, 14 Dec 2005 16:02:46 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=CZpehUGJlyfUSsdTDtm30YEi4qWB4SAs1BL30lqgPBiaaPNvX98y7S/IfatG6lr4Y3oG93iocyBesADlYy34iL2SCelaIRcJqTl3DGrgbfeX9DOaJM/Wee03MwBB1bhwWT2g3Ssj8msY2xvNNwZgkwdk4eNCKPGg3Fe+ad8QGMM= Received: by 10.54.145.12 with SMTP id s12mr360008wrd; Wed, 14 Dec 2005 16:02:45 -0800 (PST) Received: from ?192.168.1.100? ( [67.44.112.218]) by mx.gmail.com with ESMTP id 26sm2143651wrl.2005.12.14.16.02.16; Wed, 14 Dec 2005 16:02:45 -0800 (PST) From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: Simple Join Date: Wed, 14 Dec 2005 17:52:45 -0600 User-Agent: KMail/1.8 References: <200512141603.52583.blargity@gmail.com> <43A0AB0A.3000403@paradise.net.nz> In-Reply-To: <43A0AB0A.3000403@paradise.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512141752.45866.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/343 X-Sequence-Number: 16164 On Wednesday 14 December 2005 17:30, Mark Kirkwood wrote: > You scan 600000 rows from to_ship to get about 25000 - so some way to > cut this down would help. Yup. I'm open to anything too, as this is the only real part of the system that cares. So either maintaining a denormalized copy column, or whatever would be fine. We're doing far more reads than writes. > Try out an explicit INNER JOIN which includes the filter info for paid > and suspended_sub in the join condition (you may need indexes on each of > id, paid and suspended_sub, so that the 8.1 optimizer can use a bitmap > scan): I only had two explicit indexes. One was on to_ship.ordered_product_id and the other was on ordered_products.paid. ordered_products.id is a primary key. This is on your query with an index added on suspended_sub: dli=# explain analyze SELECT ordered_products.product_id dli-# FROM to_ship INNER JOIN ordered_products dli-# ON (to_ship.ordered_product_id = ordered_products.id dli(# AND ordered_products.paid = TRUE AND dli(# ordered_products.suspended_sub = FALSE); QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=5126.19..31528.40 rows=20591 width=8) (actual time=4554.190..23519.618 rows=14367 loops=1) Hash Cond: ("outer".ordered_product_id = "inner".id) -> Seq Scan on to_ship (cost=0.00..11529.12 rows=611612 width=8) (actual time=11.254..15192.042 rows=611612 loops=1) -> Hash (cost=4954.79..4954.79 rows=21759 width=16) (actual time=4494.900..4494.900 rows=18042 loops=1) -> Index Scan using paid_index on ordered_products (cost=0.00..4954.79 rows=21759 width=16) (actual time=72.431..4414.697 rows=18042 loops=1) Index Cond: (paid = true) Filter: (paid AND (NOT suspended_sub)) Total runtime: 23532.785 ms (8 rows) So what's the best way to performance wiggle this info out of the db? The list of values is only about 30 tuples long out of this query, so I was figuring I could trigger on insert to to_ship to place the value into another table if it didn't already exist. I'd rather the writing be slow than the reading. From pgsql-performance-owner@postgresql.org Wed Dec 14 20:23:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2FE39DC94C for ; Wed, 14 Dec 2005 20:23:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32881-09 for ; Wed, 14 Dec 2005 20:23:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from loki.globexplorer.com (loki.globexplorer.com [12.25.176.46]) by postgresql.org (Postfix) with ESMTP id 838399DC830 for ; Wed, 14 Dec 2005 20:23:43 -0400 (AST) 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: [postgis-users] Is my query planner failing me, or vice versa? Date: Wed, 14 Dec 2005 16:23:47 -0800 Message-ID: <71E37EF6B7DCC1499CEA0316A2568328024BBCD3@loki.wc.globexplorer.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [postgis-users] Is my query planner failing me, or vice versa? Thread-Index: AcYA0vdq4uO9CAnFToS21/vINs8HRwAPoTXQ From: "Gregory S. Williamson" To: Cc: "PostGIS Users Discussion" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/344 X-Sequence-Number: 16165 Forgive the cross-posting, but I found myself wondering if might not be = some way future way of telling the planner that a given table (column ?) = has a high likelyhood of being TOASTed. Similar to the random_page_cost = in spirit. We've got a lot of indexed data that is spatial and have some = table where no data is toasted (road segments) and others where = evrything is. An idle suggestion from one who knows that he is meddling with ;-} Greg Williamson DBA GlobeXplorer LLC > -----Original Message----- > From: postgis-users-bounces@postgis.refractions.net > [mailto:postgis-users-bounces@postgis.refractions.net]On Behalf Of > Jessica M Salmon > Sent: Wednesday, December 14, 2005 9:09 AM > To: PostGIS Users Discussion > Subject: Re: [postgis-users] Is my query planner failing me, or vice = versa? >=20 > Thanks, Marcus, for explaining. >=20 > And thanks, Robert, for asking that question about adjusting page = size. >=20 > My tuples are definitely toasted (some of my geometries are 30X too = big for > a single page!), so I'm glad I'm aware of the TOAST tables now. I = suppose > there's not much to be done about it, but it's good to know. >=20 > Thanks everyone for such an array of insightful help. >=20 > -Meghan From pgsql-performance-owner@postgresql.org Wed Dec 14 20:36:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B2D7B9DCA07 for ; Wed, 14 Dec 2005 20:36:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33515-09 for ; Wed, 14 Dec 2005 20:36:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 57F6F9DC94C for ; Wed, 14 Dec 2005 20:36:07 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRI002P8KC41L@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 15 Dec 2005 13:36:04 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-129.dsl.clear.net.nz [218.101.28.129]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id ADE2042BB8B; Thu, 15 Dec 2005 13:36:02 +1300 (NZDT) Date: Thu, 15 Dec 2005 13:36:00 +1300 From: Mark Kirkwood Subject: Re: Simple Join In-reply-to: <200512141752.45866.blargity@gmail.com> To: Kevin Brown Cc: pgsql-performance@postgresql.org Message-id: <43A0BA70.8000802@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> <43A0AB0A.3000403@paradise.net.nz> <200512141752.45866.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.266 required=5 tests=[AWL=0.266] X-Spam-Score: 0.266 X-Spam-Level: X-Archive-Number: 200512/345 X-Sequence-Number: 16166 Kevin Brown wrote: > > > I only had two explicit indexes. One was on to_ship.ordered_product_id and > the other was on ordered_products.paid. ordered_products.id is a primary > key. This is on your query with an index added on suspended_sub: > > dli=# explain analyze SELECT ordered_products.product_id > dli-# FROM to_ship INNER JOIN ordered_products > dli-# ON (to_ship.ordered_product_id = ordered_products.id > dli(# AND ordered_products.paid = TRUE AND > dli(# ordered_products.suspended_sub = FALSE); > QUERY PLAN > --------------------------------------------------------------------------------------------------------------------------------------------------------- > Hash Join (cost=5126.19..31528.40 rows=20591 width=8) (actual > time=4554.190..23519.618 rows=14367 loops=1) > Hash Cond: ("outer".ordered_product_id = "inner".id) > -> Seq Scan on to_ship (cost=0.00..11529.12 rows=611612 width=8) (actual > time=11.254..15192.042 rows=611612 loops=1) > -> Hash (cost=4954.79..4954.79 rows=21759 width=16) (actual > time=4494.900..4494.900 rows=18042 loops=1) > -> Index Scan using paid_index on ordered_products > (cost=0.00..4954.79 rows=21759 width=16) (actual time=72.431..4414.697 > rows=18042 loops=1) > Index Cond: (paid = true) > Filter: (paid AND (NOT suspended_sub)) > Total runtime: 23532.785 ms > (8 rows) > Well - that had no effect at all :-) You don't have and index on to_ship.ordered_product_id do you? - try adding one (ANALYZE again), and let use know what happens (you may want to play with SET enable_seqscan=off as well). And also, if you are only ever interested in paid = true and suspended_sub = false, then you can recreate these indexes as partials - e.g: CREATE INDEX paid_index ON ordered_products (paid) WHERE paid = true; CREATE INDEX suspended_sub_index ON ordered_products (suspended_sub) WHERE suspended_sub = false; > So what's the best way to performance wiggle this info out of the db? The > list of values is only about 30 tuples long out of this query, so I was > figuring I could trigger on insert to to_ship to place the value into another > table if it didn't already exist. I'd rather the writing be slow than the > reading. Yeah - all sort of horrible denormalizations are possible :-), hopefully we can get the original query to work ok, and avoid the need to add code or triggers to you app. From pgsql-performance-owner@postgresql.org Wed Dec 14 21:51:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF9D09DC830 for ; Wed, 14 Dec 2005 21:51:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46223-09 for ; Wed, 14 Dec 2005 21:51:53 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.199]) by postgresql.org (Postfix) with ESMTP id C04BF9DCA1F for ; Wed, 14 Dec 2005 21:51:46 -0400 (AST) Received: by nproxy.gmail.com with SMTP id o63so103723nfa for ; Wed, 14 Dec 2005 17:51:49 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=ZfIZ4P0F6g6qKPp9dLNIqYc4SQAwbcrYRdJjUb7cXDB+H0a8TZkRrZlwoRrXE3KdD5LzfYkbjyFrYFAWrXSp/a36zZXiu7LL0BB32sqfFtAmXhow3S7icR5r3xyXJFcI5hOrBuhJViD5NnONLqTXZVip2lAfCg/HgP/r40XgY6M= Received: by 10.48.240.13 with SMTP id n13mr56380nfh; Wed, 14 Dec 2005 17:51:48 -0800 (PST) Received: by 10.48.164.6 with HTTP; Wed, 14 Dec 2005 17:51:48 -0800 (PST) Message-ID: <45b42ce40512141751i6829eec0q6d088b1ec5bc27b4@mail.gmail.com> Date: Thu, 15 Dec 2005 01:51:48 +0000 From: Harry Jackson To: pgsql-performance@postgresql.org Subject: PostgreSQL performance question. MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9121_26628779.1134611508594" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/346 X-Sequence-Number: 16167 ------=_Part_9121_26628779.1134611508594 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline SGkgYWxsLAoKSSBoYXZlIGJlZW4gdXNpbmcgUG9zdGdyZVNRTCAoY3VycmVudGx5IDcuNC43KSBm b3Igc2V2ZXJhbCB5ZWFycyBub3cgYW5kIGFtCnZlcnkgaGFwcHkgd2l0aCBpdCBidXQgSSBjdXJy ZW50bHkgcnVuIGEgd2Vic2l0ZSB0aGF0IGhhcyBoYWQgYSBsaXR0bGUgYml0Cm9mIGEgYm9vc3Qg YW5kIEkgYW0gc3RhcnRpbmcgdG8gc2VlIHNvbWUgcGVyZm9ybWFuY2UgcHJvYmxlbXMgKE5vdApu ZWNlc3NhcmlseSBQb3N0Z3JlU1FMKS4KClRoZSBvcmlnaW5hbCB3ZWJzaXRlIHNlcnZlciByYW4g b24gYSBzaW5nbGUgbWFjaGluZSBEdWFsIDEuNCBEZWxsIDE2NTAuIEkKbW92ZWQgdGhlIGRhdGFi YXNlIG9mZiB0aGlzIG1hY2hpbmUgYW5kIG9udG8gYSBEdWFsIE9wdGVyb24gMjQ4IHdpdGggdHdv ClNBVEEgIGhhcmQgZGlza3MgbWlycm9yZWQgdXNpbmcgc29mdHdhcmUgcmFpZC4gVGhlIEFwYWNo ZSBzZXJ2ZXIgcmVtYWlucyBvbgp0aGUgc21hbGwgbWFjaGluZSBhbG9uZyB3aXRoIGEgU3F1aWQg UHJveHkuIEkgYWxzbyBzdGFydGVkIHRvIGFncmVzc2l2ZWx5CmNhY2hlIG1vc3QgcmVxdWVzdHMg dG8gdGhlIGRhdGFiYXNlIGFuZCBoYXZlIHRha2VuIHRoZSByZXF1ZXN0cyBoaXR0aW5nIHRoZQpk YXRhYmFzZSBkb3duIGJ5IGFib3V0ICU2NSB1c2luZyBTcXVpZCBhbmQgbWVtY2FjaGVkLiBJIGFt IGxvb2tpbmcgdG8gdGFrZQp0aGlzIHRvIGFib3V0ICU4MCBvdmVyIHRoZSBuZXh0IGZldyB3ZWVr cy4gVGhlIHByb2JsZW0gaXMgdGhhdCB0aGUgZGF0YWJhc2UKaGFzIGluY3JlYXNlZCBpbiBzaXpl IGJ5IG92ZXIgMTAwJSBvdmVyIHRoZSBzYW1lIHBlcmlvZCBhbmQgbG9va3MgbGlrZWx5IHRvCmlu Y3JlYXNlIGZ1cnRoZXIuCgpUaGUgZGF0YWJhc2UgaGFzIGJlZW4gYWxsb2NhdGVkIDJHYiB3b3J0 aCBvZiBzaGFyZWQgYnVmZmVycyBhbmQgSSBoYXZlCnR3ZWFrZWQgbW9zdCBvZiB0aGUgc2V0dGlu Z3MgaW4gdGhlIGNvbmZpZyByZWNlbnRseSB0byBzZWUgaWYgSSBjb3VsZAppbmNyZWFzZSB0aGUg cGVyZm9ybWFuY2UgYW55IG1vcmUgYW5kIGhhdmUgc2VlbiB2ZXJ5IGxpdHRsZSBwZXJmb3JtYW5j ZSBnYWluCmZvciB0aGUgdmFyaW91cyB0eXBlcyBvZiBxdWVyaWVzIHRoYXQgSSBhbSBydW5uaW5n LgoKSXQgd291bGQgYXBwZWFyIHRoYXQgdGhlIG9ubHkgYWx0ZXJuYXRpdmUgbWF5IGJlIGEgbmV3 IG1hY2hpbmUgdGhhdCBoYXMgYQpiZXR0ZXIgZGlzayBzdWJzeXN0ZW0gb3IgYSBsYXJnZSBkaXNr IGFycmF5IHRoZW4gYnVuZyBtb3JlIFJBTSBpbiB0aGUKT3B0ZXJvbiBtYWNoaW5lIChtYXggMTZH YiA0R2IgZml0dGVkKSBvciBwdXJjaGFzZSBhbm90aGVyIG1hY2hpbmUgd2l0aCBidWlsdAppbiBV MzIwIFNDU0kgaWUgYW4gSFAgUHJvbGlhbnQgREwzODAgb3IgRGVsbCAyODUwLgoKU29tZSBpbmRp Y2F0aW9uIG9mIGN1cnJlbnQgcGVyZm9ybWFuY2UgaXMgYXMgZm9sbG93cy4gSSBrbm93IHRoZXNl CnN0YXRlbWVudHMgYXJlIGhhcmRseSBpbmRpY2F0aXZlIG9mIGEgZnVsbCBydW5uaW5nIGFwcGxp Y2F0aW9uIGFuZApldmVyeXRoaW5nIHRoYXQgZ29lcyB3aXRoIGl0IGJ1dCBJIHdvdWxkIGJlIHZl cnkgaW50ZXJlc3RlZCBpbiBoZWFyaW5nIGlmCmFueW9uZSBoYXMgYSBzaW1pbGFyIHNldHVwIGFu ZCBpcyBhYmxlIHRvIHNxdWVlemUgYSBsb3QgbW9yZSBvdXQgb2YKUG9zdGdyZVNRTC4gRnJvbSB3 aGF0IEkgY2FuIHNlZSBoZXJlIHRoZSBudW1iZXJzIGxvb2sgT0sgZm9yIHRoZSBoYXJkd2FyZSBJ CmFtIHJ1bm5pbmcgb24gYW5kIHRoYXQgaXRzIG5vdCBQb3N0Z3JlU1FMIHRoYXQgaXMgdGhlIHBy b2JsZW0uCgpJbnNlcnRpbmcgMSBtaWxsaW9uIHJvd3MgaW50byB0aGUgZm9sbG93aW5nIHRhYmxl LlRoZXNlIGFyZSByYXcgaW5zZXJ0CnN0YXRlbWVudHMuCgogQ29sdW1uIHwgICAgICAgICAgVHlw ZSAgICAgICAgICB8IE1vZGlmaWVycwotLS0tLS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0r LS0tLS0tLS0tLS0KICBpZCAgICAgfCBpbnRlZ2VyICAgICAgICAgICAgICAgIHwKIGRhdGEgICB8 IGNoYXJhY3RlciB2YXJ5aW5nKDEwMCkgfAoKd2hlcmUgImRhdGEiIGhhcyBhbiBhdmVyYWdlIG9m IDk1IGNoYXJhY3RlcnMuCgoyM21pbnMgMTIgc2Vjb25kcy4KCldyYXBwaW5nIHRoaXMgaW4gYSB0 cmFuc2FjdGlvbjoKCjFtaW4gNDcgc2Vjb25kcy4KClNlbGVjdCBmcm9tIHRoZSBmb2xsb3dpbmcg dGFibGUuCgoKICAgICAgICBUYWJsZSAicHVibGljLnRlc3QiCkNvbHVtbiAgIHwgICAgICAgICAg ICAgVHlwZSAgICAgICAgICAgfCAgICAgTW9kaWZpZXJzCiB0ZXh0ICAgICAgICB8IGNoYXJhY3Rl ciB2YXJ5aW5nKDUwKSB8IG5vdCBudWxsCiBpZCAgICAgICAgICAgfCBpbnRlZ2VyICAgICAgICAg ICAgICAgICAgICAgfCBub3QgbnVsbAogbnVtICAgICAgIHwgaW50ZWdlciAgICAgICAgICAgICAg ICAgICAgIHwgZGVmYXVsdCAwCkluZGV4ZXM6CiAgICAidGVzdF9wa2V5IiBwcmltYXJ5IGtleSwg YnRyZWUgKHRleHQsIGlkKQogICAgInRlc3RfaWRfaWR4IiBidHJlZSAoaWQpCiAgICAidGVzdF90 ZXh0X2lkeCIgYnRyZWUgKHRleHQpCgpzZWxlY3QgY291bnQoKikgZnJvbSB0ZXN0OwogIGNvdW50 Ci0tLS0tLS0tLS0KIDE0Mjg5NDIwCigxIHJvdykKCiMgc2VsZWN0ICogZnJvbSB0ZXN0IHdoZXJl IHRleHQgPSAndWsnIDsKVGltZTogMTY4MC42MDcgbXMKCkdldCBpdCBpbnRvIFJBTSBoZW5jZSB0 aGUgc2xpZ2h0IGRlbGF5IGhlcmUuIFRoaXMgZGVsYXkgaGFzIGEgc2VyaW91cyBpbXBhY3QKb24g dGhlIHVzZXIgd2FpdGluZyBpbiB0aGUgd2ViIGFwcGxpY2F0aW9uLgoKIyBzZWxlY3QgKiBmcm9t IHRlc3Qgd2hlcmUgdGV4dCA9ICd1aycgOwpUaW1lOiA0NzcuNzM5IG1zCgpBZnRlciBpdCBpcyBp biBSQU0uCgpzZWxlY3QgY291bnQoKikgZnJvbSB0ZXN0IHdoZXJlIHRleHQgPSAndWsnIDsKIGNv dW50Ci0tLS0tLS0tCiAxMjEwNTgKKDEgcm93KQoKClRoZSB3ZWJzaXRlIGhhcyBhIGZhaXJseSBo aWdoIHZvbHVtZSBvZiBpbnNlcnRzIGFuZCBkZWxldGVzIHdoaWNoIGFsc28gbWVhbnMKdGhhdCBJ IHVzZSBwZ19hdXRvdmFjdW0gdG8ga2VlcCB0aGluZ3MgcmVhc29uYWJseSBjbGVhbi4gSG93ZXZl ciwgSSBmaW5kCnRoYXQgZXZlcnkgY291cGxlIG9mIHdlZWtzIHBlcmZvcm1hbmNlIGRlZ3JhZGVz IHNvIG11Y2ggdGhhdCBJIG5lZWQgdG8gZG8gYQp2YWN1dW0gZnVsbCB3aGljaCBjYW4gdGFrZSBh IGxvbmcgdGltZSBhbmQgY3JpcHBsZXMgdGhlIGRhdGFiYXNlLiBJIGhhdmUKcmVhZCBpbiB0aGUg ZG9jcyB0aGF0IHlvdSBzaG91bGQgb25seSBuZWVkIHRvIHZhY3V1bSBmdWxsIHJhcmVseSBidXQg SSBhbQpmaW5kaW5nIGluIHByYWN0aWNlIHRoaXMgaXMgbm90IHRoZSBjYXNlIHdoaWNoIG1pZ2h0 IHN1Z2dlc3QgdGhhdCBJIGhhdmUKc29tZXRoaW5nIHNldCB3cm9uZyBpbiBteSBjb25maWcgZmls ZS4KCm1heF9mc21fcGFnZXMgPSA1MDAwMDAgIyBJIGFtIHRoaW5raW5nIHRoaXMgbWlnaHQgYmUg YSBiaXQgbG93LgptYXhfZnNtX3JlbGF0aW9ucyA9IDEwMDAKCkFueSBwb2ludGVycyB0byBiZXR0 ZXIgaGFyZHdhcmUgb3IgcmVjb21tZW5kYXRpb25zIG9uIHNldHRpbmdzIGdsYWRseQpyZWNpZXZl ZC4KClJlZ2FyZHMsCkhhcnJ5IEphY2tzb24uCgotLQpodHRwOi8vd3d3LmhqYWNrc29uLm9yZwpo dHRwOi8vd3d3LnVrbHVnLmNvLnVrCg== ------=_Part_9121_26628779.1134611508594 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline SGkgYWxsLDxicj4KCjxicj4KCkkgaGF2ZSBiZWVuIHVzaW5nIFBvc3RncmVTUUwgKGN1cnJlbnRs eSA3LjQuNykgZm9yIHNldmVyYWwgeWVhcnMgbm93CmFuZCBhbSB2ZXJ5IGhhcHB5IHdpdGggaXQg YnV0IEkgY3VycmVudGx5IHJ1biBhIHdlYnNpdGUgdGhhdCBoYXMgaGFkIGEKbGl0dGxlIGJpdCBv ZiBhIGJvb3N0IGFuZCBJIGFtIHN0YXJ0aW5nIHRvIHNlZSBzb21lIHBlcmZvcm1hbmNlCnByb2Js ZW1zIChOb3QgbmVjZXNzYXJpbHkgUG9zdGdyZVNRTCkuPGJyPgoKPGJyPgoKVGhlIG9yaWdpbmFs IHdlYnNpdGUgc2VydmVyIHJhbiBvbiBhIHNpbmdsZSBtYWNoaW5lIER1YWwgMS40IERlbGwgMTY1 MC4KSSBtb3ZlZCB0aGUgZGF0YWJhc2Ugb2ZmIHRoaXMgbWFjaGluZSBhbmQgb250byBhIER1YWwg T3B0ZXJvbiAyNDggd2l0aAp0d28gU0FUQSZuYnNwOyBoYXJkIGRpc2tzIG1pcnJvcmVkIHVzaW5n IHNvZnR3YXJlIHJhaWQuIFRoZSBBcGFjaGUKc2VydmVyIHJlbWFpbnMgb24gdGhlIHNtYWxsIG1h Y2hpbmUgYWxvbmcgd2l0aCBhIFNxdWlkIFByb3h5LiBJIGFsc28Kc3RhcnRlZCB0byBhZ3Jlc3Np dmVseSBjYWNoZSBtb3N0IHJlcXVlc3RzIHRvIHRoZSBkYXRhYmFzZSBhbmQgaGF2ZQp0YWtlbiB0 aGUgcmVxdWVzdHMgaGl0dGluZyB0aGUgZGF0YWJhc2UgZG93biBieSBhYm91dCAlNjUgdXNpbmcg U3F1aWQKYW5kIG1lbWNhY2hlZC4gSSBhbSBsb29raW5nIHRvIHRha2UgdGhpcyB0byBhYm91dCAl ODAgb3ZlciB0aGUgbmV4dCBmZXcKd2Vla3MuIFRoZSBwcm9ibGVtIGlzIHRoYXQgdGhlIGRhdGFi YXNlIGhhcyBpbmNyZWFzZWQgaW4gc2l6ZSBieSBvdmVyCjEwMCUgb3ZlciB0aGUgc2FtZSBwZXJp b2QgYW5kIGxvb2tzIGxpa2VseSB0byBpbmNyZWFzZSBmdXJ0aGVyLjxicj4KCjxicj4KClRoZSBk YXRhYmFzZSBoYXMgYmVlbiBhbGxvY2F0ZWQgMkdiIHdvcnRoIG9mIHNoYXJlZCBidWZmZXJzIGFu ZCBJIGhhdmUKdHdlYWtlZCBtb3N0IG9mIHRoZSBzZXR0aW5ncyBpbiB0aGUgY29uZmlnIHJlY2Vu dGx5IHRvIHNlZSBpZiBJIGNvdWxkCmluY3JlYXNlIHRoZSBwZXJmb3JtYW5jZSBhbnkgbW9yZSBh bmQgaGF2ZSBzZWVuIHZlcnkgbGl0dGxlIHBlcmZvcm1hbmNlCmdhaW4gZm9yIHRoZSB2YXJpb3Vz IHR5cGVzIG9mIHF1ZXJpZXMgdGhhdCBJIGFtIHJ1bm5pbmcuPGJyPgoKPGJyPgoKSXQgd291bGQg YXBwZWFyIHRoYXQgdGhlIG9ubHkgYWx0ZXJuYXRpdmUgbWF5IGJlIGEgbmV3IG1hY2hpbmUgdGhh dCBoYXMKYSBiZXR0ZXIgZGlzayBzdWJzeXN0ZW0gb3IgYSBsYXJnZSBkaXNrIGFycmF5IHRoZW4g YnVuZyBtb3JlIFJBTSBpbiB0aGUKT3B0ZXJvbiBtYWNoaW5lIChtYXggMTZHYiA0R2IgZml0dGVk KSBvciBwdXJjaGFzZSBhbm90aGVyIG1hY2hpbmUgd2l0aApidWlsdCBpbiBVMzIwIFNDU0kgaWUg YW4gSFAgUHJvbGlhbnQgREwzODAgb3IgRGVsbCAyODUwLiA8YnIgY2xlYXI9ImFsbCI+Cjxicj4K ClNvbWUgaW5kaWNhdGlvbiBvZiBjdXJyZW50IHBlcmZvcm1hbmNlIGlzIGFzIGZvbGxvd3MuIEkg a25vdyB0aGVzZQpzdGF0ZW1lbnRzIGFyZSBoYXJkbHkgaW5kaWNhdGl2ZSBvZiBhIGZ1bGwgcnVu bmluZyBhcHBsaWNhdGlvbiBhbmQKZXZlcnl0aGluZyB0aGF0IGdvZXMgd2l0aCBpdCBidXQgSSB3 b3VsZCBiZSB2ZXJ5IGludGVyZXN0ZWQgaW4gaGVhcmluZwppZiBhbnlvbmUgaGFzIGEgc2ltaWxh ciBzZXR1cCBhbmQgaXMgYWJsZSB0byBzcXVlZXplIGEgbG90IG1vcmUgb3V0IG9mClBvc3RncmVT UUwuIEZyb20gd2hhdCBJIGNhbiBzZWUgaGVyZSB0aGUgbnVtYmVycyBsb29rIE9LIGZvciB0aGUK aGFyZHdhcmUgSSBhbSBydW5uaW5nIG9uIGFuZCB0aGF0IGl0cyBub3QgUG9zdGdyZVNRTCB0aGF0 IGlzIHRoZQpwcm9ibGVtLjxicj4KCjxicj4KCkluc2VydGluZyAxIG1pbGxpb24gcm93cyBpbnRv IHRoZSBmb2xsb3dpbmcgdGFibGUuVGhlc2UgYXJlIHJhdyBpbnNlcnQgc3RhdGVtZW50cy48YnI+ Cgo8YnI+CgombmJzcDtDb2x1bW4gfCZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNw OyZuYnNwOyZuYnNwOyZuYnNwOwpUeXBlJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5i c3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IHwgTW9kaWZpZXJzIDxicj4KCi0tLS0tLS0tKy0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLSstLS0tLS0tLS0tLTxicj4KPGRpdiBpZD0ibWJfMCI+CiZuYnNwO2lk Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7IHwKaW50ZWdlciZuYnNwOyZuYnNwOyZuYnNwOyZuYnNw OyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZu YnNwOyZuYnNwOwp8IDxicj4KJm5ic3A7ZGF0YSZuYnNwOyZuYnNwOyB8IGNoYXJhY3RlciB2YXJ5 aW5nKDEwMCkgfCA8YnI+Cjxicj4Kd2hlcmUgJnF1b3Q7ZGF0YSZxdW90OyBoYXMgYW4gYXZlcmFn ZSBvZiA5NSBjaGFyYWN0ZXJzLjxicj4KPGJyPgoyM21pbnMgMTIgc2Vjb25kcy48YnI+Cjxicj4K V3JhcHBpbmcgdGhpcyBpbiBhIHRyYW5zYWN0aW9uOjxicj4KPGJyPgoxbWluIDQ3IHNlY29uZHMu PGJyPgo8YnI+ClNlbGVjdCBmcm9tIHRoZSBmb2xsb3dpbmcgdGFibGUuPGJyPgo8YnI+Cgo8YnI+ CgombmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsgVGFibGUgJnF1b3Q7 cHVibGljLnRlc3QmcXVvdDs8YnI+CkNvbHVtbiZuYnNwOyZuYnNwOyB8ICZuYnNwOyAmbmJzcDsm bmJzcDsKJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7ClR5cGUmbmJzcDsmbmJz cDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsKfCZuYnNw OyZuYnNwOyZuYnNwOyZuYnNwOwpNb2RpZmllcnMmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJz cDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsgPGJyPgoKJm5ic3A7dGV4dCZuYnNwOyZu YnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyB8IGNoYXJhY3RlciB2YXJ5aW5nKDUw KSB8IG5vdCBudWxsPGJyPgombmJzcDtpZCAmbmJzcDsmbmJzcDsgJm5ic3A7Jm5ic3A7Jm5ic3A7 Jm5ic3A7Jm5ic3A7Jm5ic3A7IHwKaW50ZWdlciZuYnNwOyZuYnNwOyZuYnNwOyAmbmJzcDsgJm5i c3A7ICZuYnNwOyZuYnNwOwombmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJz cDsmbmJzcDsmbmJzcDsgfCBub3QgbnVsbDxicj4KJm5ic3A7bnVtJm5ic3A7Jm5ic3A7Jm5ic3A7 Jm5ic3A7Jm5ic3A7Jm5ic3A7IHwKaW50ZWdlciZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNw OyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyAmbmJzcDsKJm5ic3A7ICZuYnNwOyZuYnNwOyAmbmJz cDsmbmJzcDsmbmJzcDsgfCBkZWZhdWx0IDA8YnI+CgpJbmRleGVzOjxicj4KCiZuYnNwOyZuYnNw OyZuYnNwOyAmcXVvdDt0ZXN0X3BrZXkmcXVvdDsgcHJpbWFyeSBrZXksIGJ0cmVlICh0ZXh0LCBp ZCk8YnI+CgombmJzcDsmbmJzcDsmbmJzcDsgJnF1b3Q7dGVzdF9pZF9pZHgmcXVvdDsgYnRyZWUg KGlkKTxicj4KCiZuYnNwOyZuYnNwOyZuYnNwOyAmcXVvdDt0ZXN0X3RleHRfaWR4JnF1b3Q7IGJ0 cmVlICh0ZXh0KTxicj4KCjxicj4Kc2VsZWN0IGNvdW50KCopIGZyb20gdGVzdDs8YnI+CiZuYnNw OyBjb3VudCZuYnNwOyZuYnNwOyA8YnI+Ci0tLS0tLS0tLS08YnI+CiZuYnNwOzE0Mjg5NDIwPGJy PgooMSByb3cpPGJyPgo8YnI+CiMgc2VsZWN0ICogZnJvbSB0ZXN0IHdoZXJlIHRleHQgPSAndWsn IDs8YnI+ClRpbWU6IDE2ODAuNjA3IG1zPGJyPgo8YnI+CkdldCBpdCBpbnRvIFJBTSBoZW5jZSB0 aGUgc2xpZ2h0IGRlbGF5IGhlcmUuIFRoaXMgZGVsYXkgaGFzIGEgc2VyaW91cyBpbXBhY3Qgb24g dGhlIHVzZXIgd2FpdGluZyBpbiB0aGUgd2ViIGFwcGxpY2F0aW9uLjxicj4KPGJyPgojIHNlbGVj dCAqIGZyb20gdGVzdCB3aGVyZSB0ZXh0ID0gJ3VrJyA7PGJyPgpUaW1lOiA0NzcuNzM5IG1zPGJy Pgo8YnI+CkFmdGVyIGl0IGlzIGluIFJBTS48YnI+Cjxicj4Kc2VsZWN0IGNvdW50KCopIGZyb20g dGVzdCB3aGVyZSB0ZXh0ID0gJ3VrJyA7PGJyPgombmJzcDtjb3VudCZuYnNwOyA8YnI+Ci0tLS0t LS0tPGJyPgombmJzcDsxMjEwNTg8YnI+CigxIHJvdyk8YnI+Cjxicj4KPGJyPgpUaGUgd2Vic2l0 ZSBoYXMgYSBmYWlybHkgaGlnaCB2b2x1bWUgb2YgaW5zZXJ0cyBhbmQgZGVsZXRlcyB3aGljaCBh bHNvCm1lYW5zIHRoYXQgSSB1c2UgcGdfYXV0b3ZhY3VtIHRvIGtlZXAgdGhpbmdzIHJlYXNvbmFi bHkgY2xlYW4uIEhvd2V2ZXIsCkkgZmluZCB0aGF0IGV2ZXJ5IGNvdXBsZSBvZiB3ZWVrcyBwZXJm b3JtYW5jZSBkZWdyYWRlcyBzbyBtdWNoIHRoYXQgSQpuZWVkIHRvIGRvIGEgdmFjdXVtIGZ1bGwg d2hpY2ggY2FuIHRha2UgYSBsb25nIHRpbWUgYW5kIGNyaXBwbGVzIHRoZQpkYXRhYmFzZS4gSSBo YXZlIHJlYWQgaW4gdGhlIGRvY3MgdGhhdCB5b3Ugc2hvdWxkIG9ubHkgbmVlZCB0byB2YWN1dW0K ZnVsbCByYXJlbHkgYnV0IEkgYW0gZmluZGluZyBpbiBwcmFjdGljZSB0aGlzIGlzIG5vdCB0aGUg Y2FzZSB3aGljaAptaWdodCBzdWdnZXN0IHRoYXQgSSBoYXZlIHNvbWV0aGluZyBzZXQgd3Jvbmcg aW4gbXkgY29uZmlnIGZpbGUuPGJyPgo8YnI+Cm1heF9mc21fcGFnZXMgPSA1MDAwMDAgIyBJIGFt IHRoaW5raW5nIHRoaXMgbWlnaHQgYmUgYSBiaXQgbG93Ljxicj4KbWF4X2ZzbV9yZWxhdGlvbnMg PSAxMDAwPGJyPgo8YnI+CkFueSBwb2ludGVycyB0byBiZXR0ZXIgaGFyZHdhcmUgb3IgcmVjb21t ZW5kYXRpb25zIG9uIHNldHRpbmdzIGdsYWRseSByZWNpZXZlZC48YnI+Cjxicj4KUmVnYXJkcyw8 YnI+CkhhcnJ5IEphY2tzb24uPC9kaXY+Cjxicj4tLSA8YnI+PGEgaHJlZj0iaHR0cDovL3d3dy5o amFja3Nvbi5vcmciPmh0dHA6Ly93d3cuaGphY2tzb24ub3JnPC9hPjxicj48YSBocmVmPSJodHRw Oi8vd3d3LnVrbHVnLmNvLnVrIj5odHRwOi8vd3d3LnVrbHVnLmNvLnVrPC9hPgo= ------=_Part_9121_26628779.1134611508594-- From pgsql-performance-owner@postgresql.org Wed Dec 14 21:59:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8AF9A9DCA5E for ; Wed, 14 Dec 2005 21:59:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59343-07 for ; Wed, 14 Dec 2005 21:59:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id 5C2CE9DCA1B for ; Wed, 14 Dec 2005 21:59:26 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id C5CA425075; Thu, 15 Dec 2005 09:59:29 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 82EBF25070; Thu, 15 Dec 2005 09:59:27 +0800 (WST) Message-ID: <43A0CEAA.6060800@familyhealth.com.au> Date: Thu, 15 Dec 2005 10:02:18 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Harry Jackson Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL performance question. References: <45b42ce40512141751i6829eec0q6d088b1ec5bc27b4@mail.gmail.com> In-Reply-To: <45b42ce40512141751i6829eec0q6d088b1ec5bc27b4@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200512/347 X-Sequence-Number: 16168 > I have been using PostgreSQL (currently 7.4.7) for several years now and > am very happy with it but I currently run a website that has had a > little bit of a boost and I am starting to see some performance problems > (Not necessarily PostgreSQL). PostgreSQL 8.1.1 should give you greater performance... > The database has been allocated 2Gb worth of shared buffers and I have > tweaked most of the settings in the config recently to see if I could > increase the performance any more and have seen very little performance > gain for the various types of queries that I am running. That sounds like far too many shared buffers? I wouldn't usually use more than a few tens of thousands, eg. 10k-50k. And that'd only be on 8.1 that has more efficient buffer management. > Get it into RAM hence the slight delay here. This delay has a serious > impact on the user waiting in the web application. > > # select * from test where text = 'uk' ; > Time: 477.739 ms You need to show us the explain analyze plan output for this. But 477ms is far too slow for an index scan on a million row table. > max_fsm_pages = 500000 # I am thinking this might be a bit low. > max_fsm_relations = 1000 Maybe do a once-off vacuum full to make sure all your tables are clean? Chris From pgsql-performance-owner@postgresql.org Wed Dec 14 22:29:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F205A9DC9E5 for ; Wed, 14 Dec 2005 22:29:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78286-04 for ; Wed, 14 Dec 2005 22:29:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linuxworld.com.au (unknown [203.34.46.50]) by postgresql.org (Postfix) with ESMTP id 0323C9DC830 for ; Wed, 14 Dec 2005 22:29:50 -0400 (AST) 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 jBF2ThEk019308; Thu, 15 Dec 2005 13:29:43 +1100 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id jBF2ThMd019305; Thu, 15 Dec 2005 13:29:43 +1100 X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs Date: Thu, 15 Dec 2005 13:29:43 +1100 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: Harry Jackson cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL performance question. In-Reply-To: <45b42ce40512141751i6829eec0q6d088b1ec5bc27b4@mail.gmail.com> Message-ID: References: <45b42ce40512141751i6829eec0q6d088b1ec5bc27b4@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/348 X-Sequence-Number: 16169 On Thu, 15 Dec 2005, Harry Jackson wrote: > Hi all, > I have been using PostgreSQL (currently 7.4.7) for several years now and > am very happy with it but I currently run a website that has had a > little bit of a boost and I am starting to see some performance problems > (Not necessarily PostgreSQL). Definately plan an 8.1 upgrade. [snip] > The database has been allocated 2Gb worth of shared buffers and I have > tweaked most of the settings in the config recently to see if I could > increase the performance any more and have seen very little performance > gain for the various types of queries that I am running. 2 GB is too much for 7.4. I'm not sure about 8.1 because there hasn't been any conclusive testing I think. OSDL is using 200000, which is ~1.5GB. Why not turn on log_min_duration_statement or process the log with PQA (http://pgfoundry.org/projects/pqa/) to look for expensive queries. Also, why kind of IO load are you seeing (iostat will tell you). > It would appear that the only alternative may be a new machine that has > a better disk subsystem or a large disk array then bung more RAM in the > Opteron machine (max 16Gb 4Gb fitted) or purchase another machine with > built in U320 SCSI ie an HP Proliant DL380 or Dell 2850. Have a look at what your IO load is like, first. > Some indication of current performance is as follows. I know these > statements are hardly indicative of a full running application and > everything that goes with it but I would be very interested in hearing > if anyone has a similar setup and is able to squeeze a lot more out of > PostgreSQL. From what I can see here the numbers look OK for the > hardware I am running on and that its not PostgreSQL that is the > problem. > Inserting 1 million rows into the following table.These are raw insert > statements. [snip] Yes, the performance looks a bit poor. I'd say that 8.1 will help address that. Also, don't under estimate the effects of CLUSTER on performance, particularly <8.1. Thanks, Gavin From pgsql-performance-owner@postgresql.org Thu Dec 15 01:36:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CFB0A9DC82D for ; Thu, 15 Dec 2005 01:36:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85881-04 for ; Thu, 15 Dec 2005 01:36:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7ECE39DC804 for ; Thu, 15 Dec 2005 01:36:27 -0400 (AST) 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 jBF5aKYL010012; Thu, 15 Dec 2005 00:36:20 -0500 (EST) To: "Gregory S. Williamson" cc: pgsql-performance@postgresql.org, "PostGIS Users Discussion" Subject: Re: [postgis-users] Is my query planner failing me, or vice versa? In-reply-to: <71E37EF6B7DCC1499CEA0316A2568328024BBCD3@loki.wc.globexplorer.net> References: <71E37EF6B7DCC1499CEA0316A2568328024BBCD3@loki.wc.globexplorer.net> Comments: In-reply-to "Gregory S. Williamson" message dated "Wed, 14 Dec 2005 16:23:47 -0800" Date: Thu, 15 Dec 2005 00:36:20 -0500 Message-ID: <10011.1134624980@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/349 X-Sequence-Number: 16170 "Gregory S. Williamson" writes: > Forgive the cross-posting, but I found myself wondering if might not > be some way future way of telling the planner that a given table > (column ?) has a high likelyhood of being TOASTed. What would you expect the planner to do with the information, exactly? We could certainly cause ANALYZE to record some estimate of this, but I'm not too clear on what happens after that... regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 21 01:01:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF0E39DCA67 for ; Thu, 15 Dec 2005 02:22:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11307-06 for ; Thu, 15 Dec 2005 02:22:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from m001.prodv.de (m001.prodv.de [217.7.175.96]) by postgresql.org (Postfix) with ESMTP id E47679DC82A for ; Thu, 15 Dec 2005 02:22:47 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 3CA4ABD47 for ; Thu, 15 Dec 2005 07:22:48 +0100 (CET) Received: from m001.prodv.de ([127.0.0.1]) by localhost (m001 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25113-08 for ; Thu, 15 Dec 2005 07:22:48 +0100 (CET) Received: from x401.p01.prodv.loc (x401.p01.prodv.loc [172.22.1.117]) by m001.prodv.de (Postfix) with ESMTP id ED943AA3C for ; Thu, 15 Dec 2005 07:22:47 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: effizient query with jdbc Date: Thu, 15 Dec 2005 07:22:47 +0100 Message-ID: <618D880A81409C48B2766AFACEAC37EEFBE717@x401.p01.prodv.loc> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: effizient query with jdbc Thread-Index: AcYBP/ezdeSxw+fXRjSi7DV9j+dxkA== From: =?iso-8859-1?Q?B=FChler=2C_Johannes?= To: X-Virus-Scanned: amavisd-new at prodv.de X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.224 required=5 tests=[AWL=0.224] X-Spam-Score: 0.224 X-Spam-Level: X-Archive-Number: 200512/517 X-Sequence-Number: 16338 Hi,=20 I have a java.util.List of values (10000) which i wanted to use for a = query in the where clause of an simple select statement. iterating over = the list and and use an prepared Statement is quite slow. Is there a = more efficient way to execute such a query.=20 Thanks for any help.=20 Johannes=20 .....=20 List ids =3D new ArrayList();=20 .... List is filled with 10000 values ... List uuids =3D new ArrayList();=20 PreparedStatement pstat =3D db.prepareStatement("SELECT UUID FROM = MDM.KEYWORDS_INFO WHERE KEYWORDS_ID =3D ?");=20 for (Iterator iter =3D ids.iterator(); iter.hasNext();) { String id =3D (String) iter.next(); pstat.setString(1, id); rs =3D pstat.executeQuery(); if (rs.next()) { uuids.add(rs.getString(1)); } rs.close(); }=20 ...=20 From pgsql-performance-owner@postgresql.org Wed Dec 21 01:01:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2B6069DC9AE for ; Thu, 15 Dec 2005 02:52:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13673-08 for ; Thu, 15 Dec 2005 02:52:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail5.dslextreme.com (mail5.dslextreme.com [66.51.199.81]) by postgresql.org (Postfix) with SMTP id DA4D79DC82D for ; Thu, 15 Dec 2005 02:52:50 -0400 (AST) Received: (qmail 23460 invoked from network); 15 Dec 2005 06:52:10 -0000 Received: from unknown (HELO [10.1.1.1]) (66.245.216.230) by mail5.dslextreme.com with SMTP; Wed, 14 Dec 2005 22:52:10 -0800 Subject: Re: Simple Join From: Mitchell Skinner To: Tom Lane Cc: Kevin Brown , pgsql-performance@postgresql.org In-Reply-To: <7484.1134600423@sss.pgh.pa.us> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> Content-Type: text/plain Date: Wed, 14 Dec 2005 22:52:47 -0800 Message-Id: <1134629567.14248.27.camel@firebolt> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[UPPERCASE_25_50=0] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/520 X-Sequence-Number: 16341 On Wed, 2005-12-14 at 17:47 -0500, Tom Lane wrote: > That plan looks perfectly fine to me. You could try forcing some other > choices by fooling with the planner enable switches (eg set > enable_seqscan = off) but I doubt you'll find much improvement. There > are too many rows being pulled from ordered_products to make an index > nestloop a good idea. Well, I'm no expert either, but if there was an index on ordered_products (paid, suspended_sub, id) it should be mergejoinable with the index on to_ship.ordered_product_id, right? Given the conditions on paid and suspended_sub. If you (Kevin) try adding such an index, ideally it would get used given that you're only pulling out a small fraction of the rows in to_ship. If it doesn't get used, then I had a similar issue with 8.0.3 where an index that was mergejoinable (only because of the restrictions in the where clause) wasn't getting picked up. Mitch Kevin Brown wrote: > CREATE TABLE to_ship > ( > id int8 NOT NULL DEFAULT nextval(('to_ship_seq'::text)::regclass), > ordered_product_id int8 NOT NULL, > bounced int4 NOT NULL DEFAULT 0, > operator_id varchar(20) NOT NULL, > "timestamp" timestamptz NOT NULL DEFAULT ('now'::text)::timestamp(6) > with > time zone, > CONSTRAINT to_ship_pkey PRIMARY KEY (id), > CONSTRAINT to_ship_ordered_product_id_fkey FOREIGN KEY > (ordered_product_id) > REFERENCES ordered_products (id) ON UPDATE RESTRICT ON DELETE RESTRICT > ) > WITHOUT OIDS; > > CREATE TABLE ordered_products > ( > id int8 NOT NULL DEFAULT > nextval(('ordered_products_seq'::text)::regclass), > order_id int8 NOT NULL, > product_id int8 NOT NULL, > recipient_address_id int8 NOT NULL, > hide bool NOT NULL DEFAULT false, > renewal bool NOT NULL DEFAULT false, > "timestamp" timestamptz NOT NULL DEFAULT ('now'::text)::timestamp(6) > with > time zone, > operator_id varchar(20) NOT NULL, > suspended_sub bool NOT NULL DEFAULT false, > quantity int4 NOT NULL DEFAULT 1, > price_paid numeric NOT NULL, > tax_paid numeric NOT NULL DEFAULT 0, > shipping_paid numeric NOT NULL DEFAULT 0, > remaining_issue_obligation int4 NOT NULL DEFAULT 0, > parent_product_id int8, > delivery_method_id int8 NOT NULL, > paid bool NOT NULL DEFAULT false, > CONSTRAINT ordered_products_pkey PRIMARY KEY (id), > CONSTRAINT ordered_products_order_id_fkey FOREIGN KEY (order_id) > REFERENCES > orders (id) ON UPDATE RESTRICT ON DELETE RESTRICT, > CONSTRAINT ordered_products_parent_product_id_fkey FOREIGN KEY > (parent_product_id) REFERENCES ordered_products (id) ON UPDATE > RESTRICT ON > DELETE RESTRICT, > CONSTRAINT ordered_products_recipient_address_id_fkey FOREIGN KEY > (recipient_address_id) REFERENCES addresses (id) ON UPDATE RESTRICT ON > DELETE > RESTRICT > ) > WITHOUT OIDS; > > === The two indexes that should matter === > CREATE INDEX ordered_product_id_index > ON to_ship > USING btree > (ordered_product_id); > > CREATE INDEX paid_index > ON ordered_products > USING btree > (paid); > > ordered_products.id is a primary key, so it should have an implicit > index. From pgsql-performance-owner@postgresql.org Wed Dec 21 01:01:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B35BB9DC9E3 for ; Thu, 15 Dec 2005 03:44:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31520-02 for ; Thu, 15 Dec 2005 03:44:41 -0400 (AST) X-Greylist: delayed 00:29:57.687204 by SQLgrey- Received: from smtp.tiscali.ch (smtp.tiscali.ch [212.40.5.52]) by postgresql.org (Postfix) with ESMTP id DCACB9DC9F4 for ; Thu, 15 Dec 2005 03:44:37 -0400 (AST) Received: from malmo.geotask.ch (adsl-145-217-fixip.tiscali.ch [212.254.145.217]) by smtp.tiscali.ch (8.11.7/8.11.7) with ESMTP id jBF7Edp20351 for ; Thu, 15 Dec 2005 08:14:39 +0100 Date: Thu, 15 Dec 2005 08:07:14 +0100 From: Johannes =?ISO-8859-1?B?QvxobGVy?= Subject: effizient query with jdbc Message-ID: <20051215080714.03919654@malmo.geotask.ch> Organization: GeoTask AG X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i686-suse-linux) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: undisclosed-recipients:; X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.883 required=5 tests=[UNDISC_RECIPS=0.883] X-Spam-Score: 0.883 X-Spam-Level: X-Archive-Number: 200512/519 X-Sequence-Number: 16340 Hi, I have a java.util.List of values (10000) which i wanted to use for a query in the where clause of an simple select statement. iterating over the list and and use an prepared Statement is quite slow. Is there a more efficient way to execute such a query. Thanks for any help. Johannes ..... List ids = new ArrayList(); .... List is filled with 10000 values ... List uuids = new ArrayList(); PreparedStatement pstat = db.prepareStatement("SELECT UUID FROM MDM.KEYWORDS_INFO WHERE KEYWORDS_ID = ?"); for (Iterator iter = ids.iterator(); iter.hasNext();) { String id = (String) iter.next(); pstat.setString(1, id); rs = pstat.executeQuery(); if (rs.next()) { uuids.add(rs.getString(1)); } rs.close(); } ... From pgsql-performance-owner@postgresql.org Thu Dec 15 03:51:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4584F9DC9D0 for ; Thu, 15 Dec 2005 03:51:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31254-03 for ; Thu, 15 Dec 2005 03:51:46 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.199]) by postgresql.org (Postfix) with ESMTP id 239459DC9E3 for ; Thu, 15 Dec 2005 03:51:43 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s14so251081wxc for ; Wed, 14 Dec 2005 23:51:45 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:cc:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=GklcTlxsEdNVwJdS6Ij21EYcul/1aBoNnk863FTN7/wUlZbTBXqSXgBFEUW1DENky58CHJJ0qeBhzR0MK4MPEpGEDa1qTeG4sDeyUoZ7jzFdfwwpKH0PazJGcTjFCqCNv7sLpXY2e0/bVEMtp5ys4cfRZPg3C/fHTC+uNGsVnGY= Received: by 10.70.12.11 with SMTP id 11mr2282131wxl; Wed, 14 Dec 2005 23:51:45 -0800 (PST) Received: from ?192.168.1.100? ( [67.44.112.218]) by mx.gmail.com with ESMTP id h16sm2412116wxd.2005.12.14.23.51.20; Wed, 14 Dec 2005 23:51:44 -0800 (PST) From: Kevin Brown To: Mark Kirkwood Subject: Re: Simple Join Date: Thu, 15 Dec 2005 01:46:06 -0600 User-Agent: KMail/1.8 References: <200512141603.52583.blargity@gmail.com> <200512141752.45866.blargity@gmail.com> <43A0BA70.8000802@paradise.net.nz> In-Reply-To: <43A0BA70.8000802@paradise.net.nz> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512150146.06336.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/350 X-Sequence-Number: 16171 On Wednesday 14 December 2005 18:36, you wrote: > Well - that had no effect at all :-) You don't have and index on > to_ship.ordered_product_id do you? - try adding one (ANALYZE again), and > let use know what happens (you may want to play with SET > enable_seqscan=off as well). I _DO_ have an index on to_ship.ordered_product_id. It's a btree. > And also, if you are only ever interested in paid = true and > suspended_sub = false, then you can recreate these indexes as partials - > e.g: > > CREATE INDEX paid_index ON ordered_products (paid) WHERE paid = true; > CREATE INDEX suspended_sub_index ON ordered_products (suspended_sub) > WHERE suspended_sub = false; They're currently defined as individuals and I'm depending on the bitmap indexing. > > So what's the best way to performance wiggle this info out of the db? > > The list of values is only about 30 tuples long out of this query, so I > > was figuring I could trigger on insert to to_ship to place the value into > > another table if it didn't already exist. I'd rather the writing be slow > > than the reading. > > Yeah - all sort of horrible denormalizations are possible :-), hopefully > we can get the original query to work ok, and avoid the need to add code > or triggers to you app. That'd be great. From pgsql-performance-owner@postgresql.org Thu Dec 15 03:53:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 87EC09DC862 for ; Thu, 15 Dec 2005 03:53:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31972-02 for ; Thu, 15 Dec 2005 03:53:58 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.206]) by postgresql.org (Postfix) with ESMTP id 4C0CD9DC82A for ; Thu, 15 Dec 2005 03:53:55 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s14so251289wxc for ; Wed, 14 Dec 2005 23:53:57 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:cc:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=c9mjYXxrUAbk6kRwm2ZPmn5ZFWXXy4ADiS7ZzovXO8PQl5VxtUJDSSMdLBAMsvqixgAF1EuQDc9DgnxMKK9yrJWRrlgK+k3mtKQlcz6wdDKKpv5LnGUSZ2WA1+5xzqCQH+YFINggRhYa/AOHwRsUB5KxFJzBcMb2qTWGbOYZK8w= Received: by 10.70.24.12 with SMTP id 12mr2203329wxx; Wed, 14 Dec 2005 23:53:56 -0800 (PST) Received: from ?192.168.1.100? ( [67.44.112.218]) by mx.gmail.com with ESMTP id i16sm2431079wxd.2005.12.14.23.53.18; Wed, 14 Dec 2005 23:53:56 -0800 (PST) From: Kevin Brown To: Mitchell Skinner Subject: Re: Simple Join Date: Thu, 15 Dec 2005 01:48:15 -0600 User-Agent: KMail/1.8 References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> In-Reply-To: <1134629567.14248.27.camel@firebolt> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512150148.16125.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[UPPERCASE_25_50=0] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/351 X-Sequence-Number: 16172 On Thursday 15 December 2005 00:52, you wrote: > On Wed, 2005-12-14 at 17:47 -0500, Tom Lane wrote: > > That plan looks perfectly fine to me. You could try forcing some other > > choices by fooling with the planner enable switches (eg set > > enable_seqscan = off) but I doubt you'll find much improvement. There > > are too many rows being pulled from ordered_products to make an index > > nestloop a good idea. > > Well, I'm no expert either, but if there was an index on > ordered_products (paid, suspended_sub, id) it should be mergejoinable > with the index on to_ship.ordered_product_id, right? Given the > conditions on paid and suspended_sub. > > If you (Kevin) try adding such an index, ideally it would get used given > that you're only pulling out a small fraction of the rows in to_ship. > If it doesn't get used, then I had a similar issue with 8.0.3 where an > index that was mergejoinable (only because of the restrictions in the > where clause) wasn't getting picked up. The following is already there: CREATE INDEX ordered_product_id_index ON to_ship USING btree (ordered_product_id); That's why I emailed this list. > Mitch > > Kevin Brown wrote: > > CREATE TABLE to_ship > > ( > > id int8 NOT NULL DEFAULT nextval(('to_ship_seq'::text)::regclass), > > ordered_product_id int8 NOT NULL, > > bounced int4 NOT NULL DEFAULT 0, > > operator_id varchar(20) NOT NULL, > > "timestamp" timestamptz NOT NULL DEFAULT ('now'::text)::timestamp(6) > > with > > time zone, > > CONSTRAINT to_ship_pkey PRIMARY KEY (id), > > CONSTRAINT to_ship_ordered_product_id_fkey FOREIGN KEY > > (ordered_product_id) > > REFERENCES ordered_products (id) ON UPDATE RESTRICT ON DELETE RESTRICT > > ) > > WITHOUT OIDS; > > > > CREATE TABLE ordered_products > > ( > > id int8 NOT NULL DEFAULT > > nextval(('ordered_products_seq'::text)::regclass), > > order_id int8 NOT NULL, > > product_id int8 NOT NULL, > > recipient_address_id int8 NOT NULL, > > hide bool NOT NULL DEFAULT false, > > renewal bool NOT NULL DEFAULT false, > > "timestamp" timestamptz NOT NULL DEFAULT ('now'::text)::timestamp(6) > > with > > time zone, > > operator_id varchar(20) NOT NULL, > > suspended_sub bool NOT NULL DEFAULT false, > > quantity int4 NOT NULL DEFAULT 1, > > price_paid numeric NOT NULL, > > tax_paid numeric NOT NULL DEFAULT 0, > > shipping_paid numeric NOT NULL DEFAULT 0, > > remaining_issue_obligation int4 NOT NULL DEFAULT 0, > > parent_product_id int8, > > delivery_method_id int8 NOT NULL, > > paid bool NOT NULL DEFAULT false, > > CONSTRAINT ordered_products_pkey PRIMARY KEY (id), > > CONSTRAINT ordered_products_order_id_fkey FOREIGN KEY (order_id) > > REFERENCES > > orders (id) ON UPDATE RESTRICT ON DELETE RESTRICT, > > CONSTRAINT ordered_products_parent_product_id_fkey FOREIGN KEY > > (parent_product_id) REFERENCES ordered_products (id) ON UPDATE > > RESTRICT ON > > DELETE RESTRICT, > > CONSTRAINT ordered_products_recipient_address_id_fkey FOREIGN KEY > > (recipient_address_id) REFERENCES addresses (id) ON UPDATE RESTRICT ON > > DELETE > > RESTRICT > > ) > > WITHOUT OIDS; > > > > === The two indexes that should matter === > > CREATE INDEX ordered_product_id_index > > ON to_ship > > USING btree > > (ordered_product_id); > > > > CREATE INDEX paid_index > > ON ordered_products > > USING btree > > (paid); > > > > ordered_products.id is a primary key, so it should have an implicit > > index. From pgsql-performance-owner@postgresql.org Thu Dec 15 04:15:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 88D9F9DCAB2 for ; Thu, 15 Dec 2005 04:15:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37065-01 for ; Thu, 15 Dec 2005 04:15:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id E0C559DCA8C for ; Thu, 15 Dec 2005 04:15:10 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRJ00K6R5LA9N@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 15 Dec 2005 21:15:10 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-129.dsl.clear.net.nz [218.101.28.129]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 809A94A786F; Thu, 15 Dec 2005 21:15:09 +1300 (NZDT) Date: Thu, 15 Dec 2005 21:15:05 +1300 From: Mark Kirkwood Subject: Re: Simple Join In-reply-to: <200512150146.06336.blargity@gmail.com> To: Kevin Brown Cc: pgsql-performance@postgresql.org Message-id: <43A12609.70208@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> <200512141752.45866.blargity@gmail.com> <43A0BA70.8000802@paradise.net.nz> <200512150146.06336.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.167 required=5 tests=[AWL=0.167] X-Spam-Score: 0.167 X-Spam-Level: X-Archive-Number: 200512/352 X-Sequence-Number: 16173 Kevin Brown wrote: > On Wednesday 14 December 2005 18:36, you wrote: > >>Well - that had no effect at all :-) You don't have and index on >>to_ship.ordered_product_id do you? - try adding one (ANALYZE again), and >>let use know what happens (you may want to play with SET >>enable_seqscan=off as well). > > > I _DO_ have an index on to_ship.ordered_product_id. It's a btree. > Sorry - read right past it! Did you try out enable_seqscan=off? I'm interested to see if we can get 8.1 bitmap anding the three possibly useful columns together on ordered_products and *then* doing the join to to_ship. Cheers Mark From pgsql-performance-owner@postgresql.org Thu Dec 15 07:02:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 23D4F9DCB0B for ; Thu, 15 Dec 2005 07:02:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69293-02 for ; Thu, 15 Dec 2005 07:02:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail5.dslextreme.com (mail5.dslextreme.com [66.51.199.81]) by postgresql.org (Postfix) with SMTP id 941CC9DCB34 for ; Thu, 15 Dec 2005 07:02:04 -0400 (AST) Received: (qmail 17528 invoked from network); 15 Dec 2005 11:01:28 -0000 Received: from unknown (HELO [10.1.1.1]) (mitchskin@66.245.216.230) by mail5.dslextreme.com with SMTP; Thu, 15 Dec 2005 03:01:28 -0800 Subject: Re: Simple Join From: Mitch Skinner To: Kevin Brown Cc: pgsql-performance@postgresql.org In-Reply-To: <200512150148.16125.blargity@gmail.com> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> Content-Type: text/plain Date: Thu, 15 Dec 2005 03:02:06 -0800 Message-Id: <1134644526.14248.60.camel@firebolt> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/353 X-Sequence-Number: 16174 On Thu, 2005-12-15 at 01:48 -0600, Kevin Brown wrote: > > Well, I'm no expert either, but if there was an index on > > ordered_products (paid, suspended_sub, id) it should be mergejoinable > > with the index on to_ship.ordered_product_id, right? Given the > > conditions on paid and suspended_sub. > > > The following is already there: > > CREATE INDEX ordered_product_id_index > ON to_ship > USING btree > (ordered_product_id); > > That's why I emailed this list. I saw that; what I'm suggesting is that that you try creating a 3-column index on ordered_products using the paid, suspended_sub, and id columns. In that order, I think, although you could also try the reverse. It may or may not help, but it's worth a shot--the fact that all of those columns are used together in the query suggests that you might do better with a three-column index on those. With all three columns indexed individually, you're apparently not getting the bitmap plan that Mark is hoping for. I imagine this has to do with the lack of multi-column statistics in postgres, though you could also try raising the statistics target on the columns of interest. Setting enable_seqscan to off, as others have suggested, is also a worthwhile experiment, just to see what you get. Mitch From pgsql-performance-owner@postgresql.org Thu Dec 15 07:04:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 141999DCAE2 for ; Thu, 15 Dec 2005 07:04:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70441-01 for ; Thu, 15 Dec 2005 07:04:02 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 324669DCAB1 for ; Thu, 15 Dec 2005 07:03:58 -0400 (AST) Received: from mail.logix-tt.com (serval.logix-tt.com [213.239.221.42]) by svr4.postgresql.org (Postfix) with ESMTP id 2D7A25AF02E for ; Thu, 15 Dec 2005 11:04:01 +0000 (GMT) Received: from kingfisher.intern.logix-tt.com (Ka199.k.pppool.de [85.75.161.153]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 86D5924400F; Thu, 15 Dec 2005 12:10:09 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id E407F2DDA; Thu, 15 Dec 2005 12:03:23 +0100 (CET) Message-ID: <43A14D7B.8030705@logix-tt.com> Date: Thu, 15 Dec 2005 12:03:23 +0100 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostGIS Users Discussion Cc: pgsql-performance@postgresql.org Subject: Re: [postgis-users] Is my query planner failing me, or vice versa? References: <71E37EF6B7DCC1499CEA0316A2568328024BBCD3@loki.wc.globexplorer.net> In-Reply-To: <71E37EF6B7DCC1499CEA0316A2568328024BBCD3@loki.wc.globexplorer.net> X-Enigmail-Version: 0.93.0.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/354 X-Sequence-Number: 16175 Hi, Gregory, Gregory S. Williamson wrote: > Forgive the cross-posting, but I found myself wondering if might not > be some way future way of telling the planner that a given table > (column ?) has a high likelyhood of being TOASTed. Similar to the > random_page_cost in spirit. We've got a lot of indexed data that is > spatial and have some table where no data is toasted (road segments) > and others where evrything is. I'd personally put this into ANALYZE, it already collects statistics, so it could also calculate TOASTing likelyhood and average TOASTed size. Maybe that 8.X PostgreSQL already does this, I'm a bit lagging :-) Markus From pgsql-performance-owner@postgresql.org Thu Dec 15 08:03:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 64E589DC862 for ; Thu, 15 Dec 2005 08:03:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85259-06 for ; Thu, 15 Dec 2005 08:03:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from loki.globexplorer.com (loki.globexplorer.com [12.25.176.46]) by postgresql.org (Postfix) with ESMTP id 452A89DC819 for ; Thu, 15 Dec 2005 08:03:14 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Subject: Re: [postgis-users] Is my query planner failing me, or vice versa? Date: Thu, 15 Dec 2005 04:03:16 -0800 Message-ID: <71E37EF6B7DCC1499CEA0316A2568328024BBCDA@loki.wc.globexplorer.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [postgis-users] Is my query planner failing me, or vice versa? Thread-Index: AcYBOXxvcJoeR6zRSKm3Zv2qNxeRtQANOBwe From: "Gregory S. Williamson" To: "Tom Lane" Cc: , "PostGIS Users Discussion" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/355 X-Sequence-Number: 16176 Well, what does the random_page_cost do internally ? I don't think I'd expect postgres to be able to *do* anything in = particular, any more than I would expect it to "do" something about slow = disk I/O or having limited cache. But it might be useful to the EXPLAIN = ANALYZE in estimating costs of retrieving such data.=20 Admittedly, this is not as clear as wanting a sequential scan in = preference to indexed reads when there are either very few rows or a = huge number, but it strikes me as useful to me the DBA to have this = factoid thrust in front of me when considering why a given query is = slower than I might like. Perhaps an added time based on this factor and = the random_page_cost value, since lots of TOAST data and a high access = time would indicate to my (ignorant!) mind that retrieval would be = slower, especially over large data sets. Forgive my ignorance ... obviously I am but a humble user. grin. G -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us] Sent: Wed 12/14/2005 9:36 PM To: Gregory S. Williamson Cc: pgsql-performance@postgresql.org; PostGIS Users Discussion Subject: Re: [PERFORM] [postgis-users] Is my query planner failing me, = or vice versa?=20 "Gregory S. Williamson" writes: > Forgive the cross-posting, but I found myself wondering if might not > be some way future way of telling the planner that a given table > (column ?) has a high likelyhood of being TOASTed. What would you expect the planner to do with the information, exactly? We could certainly cause ANALYZE to record some estimate of this, but I'm not too clear on what happens after that... regards, tom lane !DSPAM:43a100d6285261205920220! From pgsql-performance-owner@postgresql.org Wed Dec 21 01:03:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E768D9DCBD4 for ; Thu, 15 Dec 2005 10:20:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11738-02 for ; Thu, 15 Dec 2005 10:20:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from webbased16.localdomain (mail.webbased.co.uk [213.152.63.91]) by postgresql.org (Postfix) with ESMTP id DEE6B9DCBC1 for ; Thu, 15 Dec 2005 10:20:12 -0400 (AST) Received: from ibmsparks (firewall [213.152.63.90]) by webbased16.localdomain (8.11.6/8.11.6) with ESMTP id jBFEKIP28427; Thu, 15 Dec 2005 14:20:18 GMT Message-Id: <200512151420.jBFEKIP28427@webbased16.localdomain> From: "Mark Cave-Ayland" To: "'PostGIS Users Discussion'" , "'Tom Lane'" Cc: Date: Thu, 15 Dec 2005 14:20:55 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcYBOXxvcJoeR6zRSKm3Zv2qNxeRtQANOBweAAUGUWA= In-Reply-To: <71E37EF6B7DCC1499CEA0316A2568328024BBCDA@loki.wc.globexplorer.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-webbased16-MailScanner-Information: Please contact the ISP for more information X-webbased16-MailScanner: Found to be clean X-MailScanner-From: m.cave-ayland@webbased.co.uk Subject: Re: [postgis-users] Is my query planner failing me,or vice versa? X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/524 X-Sequence-Number: 16345 > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Wed 12/14/2005 9:36 PM > To: Gregory S. Williamson > Cc: pgsql-performance@postgresql.org; PostGIS Users Discussion > Subject: Re: [PERFORM] [postgis-users] Is my query planner failing me, > or vice versa? > "Gregory S. Williamson" writes: > > Forgive the cross-posting, but I found myself wondering if might not > > be some way future way of telling the planner that a given table > > (column ?) has a high likelyhood of being TOASTed. > > What would you expect the planner to do with the information, exactly? > > We could certainly cause ANALYZE to record some estimate of this, but > I'm not too clear on what happens after that... > > regards, tom lane > > > -----Original Message----- > From: postgis-users-bounces@postgis.refractions.net [mailto:postgis-users- > bounces@postgis.refractions.net] On Behalf Of Gregory S. Williamson > Sent: 15 December 2005 12:03 > To: Tom Lane > Cc: pgsql-performance@postgresql.org; PostGIS Users Discussion > Subject: RE: [PERFORM] [postgis-users] Is my query planner failing me,or > vice versa? > > Well, what does the random_page_cost do internally ? > > I don't think I'd expect postgres to be able to *do* anything in > particular, any more than I would expect it to "do" something about slow > disk I/O or having limited cache. But it might be useful to the EXPLAIN > ANALYZE in estimating costs of retrieving such data. > > Admittedly, this is not as clear as wanting a sequential scan in > preference to indexed reads when there are either very few rows or a huge > number, but it strikes me as useful to me the DBA to have this factoid > thrust in front of me when considering why a given query is slower than I > might like. Perhaps an added time based on this factor and the > random_page_cost value, since lots of TOAST data and a high access time > would indicate to my (ignorant!) mind that retrieval would be slower, > especially over large data sets. > > Forgive my ignorance ... obviously I am but a humble user. grin. > > G As I understood from the original discussions with Markus/Tom, the problem was that the optimizer didn't consider the value of the VacAttrStats stawidth value when calculating the cost of a sequential scan. I don't know if this is still the case though - Tom will probably have a rough idea already whereas I would need to spend some time sifting through the source. However, I do know that the PostGIS statistics collector does store the average detoasted geometry size in stawidth during ANALYZE so the value is there if it can be used. Kind regards, Mark. ------------------------ WebBased Ltd 17 Research Way Plymouth PL6 8BT T: +44 (0)1752 797131 F: +44 (0)1752 791023 http://www.webbased.co.uk http://www.infomapper.com http://www.swtc.co.uk This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. From pgsql-performance-owner@postgresql.org Wed Dec 21 01:02:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F29C69DCC00 for ; Thu, 15 Dec 2005 11:15:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22221-02 for ; Thu, 15 Dec 2005 11:15:07 -0400 (AST) X-Greylist: delayed 00:30:37.275019 by SQLgrey- Received: from core.kontent.de (core.kontent.de [81.88.34.3]) by postgresql.org (Postfix) with ESMTP id 091459DCBFC for ; Thu, 15 Dec 2005 11:14:59 -0400 (AST) Received: (from www@localhost) by core.kontent.de (8.11.4/8.11.4) id jBFEiNF25690; Thu, 15 Dec 2005 15:44:23 +0100 Message-Id: <200512151444.jBFEiNF25690@core.kontent.de> X-Authentication-Warning: core.kontent.de: www set sender to johannesbuehler@oderbruecke.de using -f To: pgsql-performance@postgresql.org Subject: effizient query with jdbc Date: Thu, 15 Dec 2005 15:44:23 +0100 From: johannesbuehler@oderbruecke.de Reply-To: johannesbuehler@oderbruecke.de MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: QUOTED-PRINTABLE X-Mailer: KONTENT WebMail (http://www.kontent.de/) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.55 required=5 tests=[NO_REAL_NAME=0.55] X-Spam-Score: 0.55 X-Spam-Level: X-Archive-Number: 200512/522 X-Sequence-Number: 16343 Hi,=20 I have a java.util.List of values (10000) which i wanted to use for a query= in the where clause of an simple select statement. iterating over the list= and and use an prepared Statement is quite slow. Is there a more efficient= way to execute such a query.=20 Thanks for any help.=20 Johannes=20 .....=20 List ids =3D new ArrayList(); .... List is filled with 10000 values ... List uuids =3D new ArrayList();=20 PreparedStatement pstat =3D db.prepareStatement("SELECT UUID FROM MDM.KEYWO= RDS_INFO WHERE KEYWORDS_ID =3D ?");=20 for (Iterator iter =3D ids.iterator(); iter.hasNext();) { String id =3D (String) iter.next(); pstat.setString(1, id); rs =3D pstat.executeQuery(); if (rs.next()) { uuids.add(rs.getString(1)); } rs.close(); }=20 ...=20 From pgsql-performance-owner@postgresql.org Thu Dec 15 15:29:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A633C9DCA02 for ; Thu, 15 Dec 2005 15:29:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18772-08 for ; Thu, 15 Dec 2005 15:29:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 3718F9DCC31 for ; Thu, 15 Dec 2005 15:29:25 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRK0003N0SUXU@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 16 Dec 2005 08:29:22 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-62.dsl.clear.net.nz [218.101.28.62]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 04AD0D254E0; Fri, 16 Dec 2005 08:29:17 +1300 (NZDT) Date: Fri, 16 Dec 2005 08:29:17 +1300 From: Mark Kirkwood Subject: Re: Simple Join In-reply-to: <1134644526.14248.60.camel@firebolt> To: Mitch Skinner Cc: Kevin Brown , pgsql-performance@postgresql.org Message-id: <43A1C40D.8040006@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.148 required=5 tests=[AWL=0.148] X-Spam-Score: 0.148 X-Spam-Level: X-Archive-Number: 200512/356 X-Sequence-Number: 16177 Mitch Skinner wrote: > I saw that; what I'm suggesting is that that you try creating a 3-column > index on ordered_products using the paid, suspended_sub, and id columns. > In that order, I think, although you could also try the reverse. It may > or may not help, but it's worth a shot--the fact that all of those > columns are used together in the query suggests that you might do better > with a three-column index on those. > > With all three columns indexed individually, you're apparently not > getting the bitmap plan that Mark is hoping for. I imagine this has to > do with the lack of multi-column statistics in postgres, though you > could also try raising the statistics target on the columns of interest. > > Setting enable_seqscan to off, as others have suggested, is also a > worthwhile experiment, just to see what you get. > > Right on. Some of these "coerced" plans may perform much better. If so, we can look at tweaking your runtime config: e.g. effective_cache_size random_page_cost default_statistics_target to see if said plans can be chosen "naturally". cheers Mark From pgsql-performance-owner@postgresql.org Thu Dec 15 17:13:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CCCCE9DC804 for ; Thu, 15 Dec 2005 17:13:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76355-04 for ; Thu, 15 Dec 2005 17:13:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id 095AD9DC820 for ; Thu, 15 Dec 2005 17:13:07 -0400 (AST) 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: SAN/NAS options Date: Thu, 15 Dec 2005 16:13:04 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF7850270033B@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] SAN/NAS options Thread-Index: AcYAe4B/Q/D7Ap88RCK/1kQczSlfyAAALjvwAE/z2oA= From: "Anjan Dave" To: "Luke Lonergan" , "Charles Sprickman" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200512/357 X-Sequence-Number: 16178 Luke, How did you measure 800MB/sec, is it cached, or physical I/O? -anjan -----Original Message----- From: Luke Lonergan [mailto:LLonergan@greenplum.com]=20 Sent: Wednesday, December 14, 2005 2:10 AM To: Charles Sprickman; pgsql-performance@postgresql.org Subject: Re: [PERFORM] SAN/NAS options Charles, > Lastly, one thing that I'm not yet finding in trying to=20 > educate myself on SANs is a good overview of what's come out=20 > in the past few years that's more affordable than the old=20 > big-iron stuff. For example I saw some brief info on this=20 > list's archives about the Dell/EMC offerings. Anything else=20 > in that vein to look at? My two cents: SAN is a bad investment, go for big internal storage. The 3Ware or Areca SATA RAID adapters kick butt and if you look in the newest colos (I was just in ours "365main.net" today), you will see rack on rack of machines with from 4 to 16 internal SATA drives. Are they all DB servers? Not necessarily, but that's where things are headed. You can get a 3U server with dual opteron 250s, 16GB RAM and 16x 400GB SATAII drives with the 3Ware 9550SX controller for $10K - we just ordered 4 of them. I don't think you can buy an external disk chassis and a Fibre channel NIC for that. Performance? 800MB/s RAID5 reads, 400MB/s RAID5 writes. Random IOs are also very high for RAID10, but we don't use it so YMMV - look at Areca and 3Ware. Managability? Good web management interfaces with 6+ years of development from 3Ware, e-mail, online rebuild options, all the goodies. No "snapshot" or offline backup features like the high-end SANs, but do you really need it? Need more power or storage over time? Run a parallel DB like Bizgres MPP, you can add more servers with internal storage and increase your I/O, CPU and memory. - Luke ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Thu Dec 15 18:01:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 292AD9DC81B for ; Thu, 15 Dec 2005 18:01:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85291-03 for ; Thu, 15 Dec 2005 18:01:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id 1B5839DCA82 for ; Thu, 15 Dec 2005 17:40:39 -0400 (AST) Received: from 172.16.1.26 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Thu, 15 Dec 2005 16:40:17 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 15 Dec 2005 16:40:14 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: SAN/NAS options Date: Thu, 15 Dec 2005 16:40:14 -0500 Message-ID: <3E37B936B592014B978C4415F90D662DE11FB6@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] SAN/NAS options Thread-Index: AcYAe4B/Q/D7Ap88RCK/1kQczSlfyAAALjvwAE/z2oAAAQZJXQ== From: "Luke Lonergan" To: adave@vantage.com, spork@bway.net, pgsql-performance@postgresql.org X-OriginalArrivalTime: 15 Dec 2005 21:40:14.0739 (UTC) FILETIME=[224BF630:01C601C0] X-WSS-ID: 6FBF3D373U4322757-04-01 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/358 X-Sequence-Number: 16179 UGh5c2ljYWwgdXNpbmcgeGZzIG9uIExpbnV4Lg0KLSBMdWtlDQotLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLQ0KU2VudCBmcm9tIG15IEJsYWNrQmVycnkgV2lyZWxlc3MgRGV2aWNlDQoNCg0KLS0t LS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCkZyb206IEFuamFuIERhdmUgPGFkYXZlQHZhbnRhZ2Uu Y29tPg0KVG86IEx1a2UgTG9uZXJnYW4gPExMb25lcmdhbkBncmVlbnBsdW0uY29tPjsgQ2hhcmxl cyBTcHJpY2ttYW4gPHNwb3JrQGJ3YXkubmV0PjsgcGdzcWwtcGVyZm9ybWFuY2VAcG9zdGdyZXNx bC5vcmcgPHBnc3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnPg0KU2VudDogVGh1IERlYyAx NSAxNjoxMzowNCAyMDA1DQpTdWJqZWN0OiBSRTogW1BFUkZPUk1dIFNBTi9OQVMgb3B0aW9ucw0K DQpMdWtlLA0KDQpIb3cgZGlkIHlvdSBtZWFzdXJlIDgwME1CL3NlYywgaXMgaXQgY2FjaGVkLCBv ciBwaHlzaWNhbCBJL08/DQoNCi1hbmphbg0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0K RnJvbTogTHVrZSBMb25lcmdhbiBbbWFpbHRvOkxMb25lcmdhbkBncmVlbnBsdW0uY29tXSANClNl bnQ6IFdlZG5lc2RheSwgRGVjZW1iZXIgMTQsIDIwMDUgMjoxMCBBTQ0KVG86IENoYXJsZXMgU3By aWNrbWFuOyBwZ3NxbC1wZXJmb3JtYW5jZUBwb3N0Z3Jlc3FsLm9yZw0KU3ViamVjdDogUmU6IFtQ RVJGT1JNXSBTQU4vTkFTIG9wdGlvbnMNCg0KQ2hhcmxlcywNCg0KPiBMYXN0bHksIG9uZSB0aGlu ZyB0aGF0IEknbSBub3QgeWV0IGZpbmRpbmcgaW4gdHJ5aW5nIHRvIA0KPiBlZHVjYXRlIG15c2Vs ZiBvbiBTQU5zIGlzIGEgZ29vZCBvdmVydmlldyBvZiB3aGF0J3MgY29tZSBvdXQgDQo+IGluIHRo ZSBwYXN0IGZldyB5ZWFycyB0aGF0J3MgbW9yZSBhZmZvcmRhYmxlIHRoYW4gdGhlIG9sZCANCj4g YmlnLWlyb24gc3R1ZmYuICBGb3IgZXhhbXBsZSBJIHNhdyBzb21lIGJyaWVmIGluZm8gb24gdGhp cyANCj4gbGlzdCdzIGFyY2hpdmVzIGFib3V0IHRoZSBEZWxsL0VNQyBvZmZlcmluZ3MuICBBbnl0 aGluZyBlbHNlIA0KPiBpbiB0aGF0IHZlaW4gdG8gbG9vayBhdD8NCg0KTXkgdHdvIGNlbnRzOiBT QU4gaXMgYSBiYWQgaW52ZXN0bWVudCwgZ28gZm9yIGJpZyBpbnRlcm5hbCBzdG9yYWdlLg0KDQpU aGUgM1dhcmUgb3IgQXJlY2EgU0FUQSBSQUlEIGFkYXB0ZXJzIGtpY2sgYnV0dCBhbmQgaWYgeW91 IGxvb2sgaW4gdGhlDQpuZXdlc3QgY29sb3MgKEkgd2FzIGp1c3QgaW4gb3VycyAiMzY1bWFpbi5u ZXQiIHRvZGF5KSwgeW91IHdpbGwgc2VlIHJhY2sNCm9uIHJhY2sgb2YgbWFjaGluZXMgd2l0aCBm cm9tIDQgdG8gMTYgaW50ZXJuYWwgU0FUQSBkcml2ZXMuICBBcmUgdGhleQ0KYWxsIERCIHNlcnZl cnM/ICBOb3QgbmVjZXNzYXJpbHksIGJ1dCB0aGF0J3Mgd2hlcmUgdGhpbmdzIGFyZSBoZWFkZWQu DQoNCllvdSBjYW4gZ2V0IGEgM1Ugc2VydmVyIHdpdGggZHVhbCBvcHRlcm9uIDI1MHMsIDE2R0Ig UkFNIGFuZCAxNnggNDAwR0INClNBVEFJSSBkcml2ZXMgd2l0aCB0aGUgM1dhcmUgOTU1MFNYIGNv bnRyb2xsZXIgZm9yICQxMEsgLSB3ZSBqdXN0DQpvcmRlcmVkIDQgb2YgdGhlbS4gIEkgZG9uJ3Qg dGhpbmsgeW91IGNhbiBidXkgYW4gZXh0ZXJuYWwgZGlzayBjaGFzc2lzDQphbmQgYSBGaWJyZSBj aGFubmVsIE5JQyBmb3IgdGhhdC4NCg0KUGVyZm9ybWFuY2U/ICA4MDBNQi9zIFJBSUQ1IHJlYWRz LCA0MDBNQi9zIFJBSUQ1IHdyaXRlcy4gIFJhbmRvbSBJT3MgYXJlDQphbHNvIHZlcnkgaGlnaCBm b3IgUkFJRDEwLCBidXQgd2UgZG9uJ3QgdXNlIGl0IHNvIFlNTVYgLSBsb29rIGF0IEFyZWNhDQph bmQgM1dhcmUuDQoNCk1hbmFnYWJpbGl0eT8gR29vZCB3ZWIgbWFuYWdlbWVudCBpbnRlcmZhY2Vz IHdpdGggNisgeWVhcnMgb2YNCmRldmVsb3BtZW50IGZyb20gM1dhcmUsIGUtbWFpbCwgb25saW5l IHJlYnVpbGQgb3B0aW9ucywgYWxsIHRoZSBnb29kaWVzLg0KTm8gInNuYXBzaG90IiBvciBvZmZs aW5lIGJhY2t1cCBmZWF0dXJlcyBsaWtlIHRoZSBoaWdoLWVuZCBTQU5zLCBidXQgZG8NCnlvdSBy ZWFsbHkgbmVlZCBpdD8NCg0KTmVlZCBtb3JlIHBvd2VyIG9yIHN0b3JhZ2Ugb3ZlciB0aW1lPyBS dW4gYSBwYXJhbGxlbCBEQiBsaWtlIEJpemdyZXMNCk1QUCwgeW91IGNhbiBhZGQgbW9yZSBzZXJ2 ZXJzIHdpdGggaW50ZXJuYWwgc3RvcmFnZSBhbmQgaW5jcmVhc2UgeW91cg0KSS9PLCBDUFUgYW5k IG1lbW9yeS4NCg0KLSBMdWtlDQoNCg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBv ZiBicm9hZGNhc3QpLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQpUSVAgNTogZG9uJ3QgZm9y Z2V0IHRvIGluY3JlYXNlIHlvdXIgZnJlZSBzcGFjZSBtYXAgc2V0dGluZ3MNCg0KDQo= From pgsql-performance-owner@postgresql.org Thu Dec 15 19:09:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1EFF19DCC38 for ; Thu, 15 Dec 2005 19:09:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99255-05 for ; Thu, 15 Dec 2005 19:09:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id D65AC9DCB94 for ; Thu, 15 Dec 2005 19:09:23 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBFN9a1c024108 for ; Thu, 15 Dec 2005 15:09:36 -0800 Message-ID: <43A1F6DB.3080805@modgraph-usa.com> Date: Thu, 15 Dec 2005 15:06:03 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 CC: pgsql-performance@postgresql.org Subject: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> In-Reply-To: <43A1C40D.8040006@paradise.net.nz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.189 required=5 tests=[MISSING_HEADERS=0.189] X-Spam-Score: 0.189 X-Spam-Level: X-Archive-Number: 200512/359 X-Sequence-Number: 16180 I asked a while back if there were any plans to allow developers to override the optimizer's plan and force certain plans, and received a fairly resounding "No". The general feeling I get is that a lot of work has gone into the optimizer, and by God we're going to use it! I think this is just wrong, and I'm curious whether I'm alone in this opinion. Over and over, I see questions posted to this mailing list about execution plans that don't work out well. Many times there are good answers - add an index, refactor the design, etc. - that yield good results. But, all too often the answer comes down to something like this recent one: > Right on. Some of these "coerced" plans may perform > much better. If so, we can look at tweaking your runtime > config: e.g. > > effective_cache_size > random_page_cost > default_statistics_target > > to see if said plans can be chosen "naturally". I see this over and over. Tweak the parameters to "force" a certain plan, because there's no formal way for a developer to say, "I know the best plan." There isn't a database in the world that is as smart as a developer, or that can have insight into things that only a developer can possibly know. Here's a real-life example that caused me major headaches. It's a trivial query, but Postgres totally blows it: select * from my_table where row_num >= 50000 and row_num < 100000 and myfunc(foo, bar); How can Postgres possibly know what "myfunc()" does? In this example, my_table is about 10 million rows and row_num is indexed. When the row_num range is less than about 30,000, Postgres (correctly) uses an row_num index scan, then filters by myfunc(). But beyond that, it chooses a sequential scan, filtering by myfunc(). This is just wrong. Postgres can't possibly know that myfunc() is VERY expensive. The correct plan would be to switch from index to filtering on row_num. Even if 99% of the database is selected by row_num, it should STILL at least filter by row_num first, and only filter by myfunc() as the very last step. How can a database with no ability to override a plan possibly cope with this? Without the explicit ability to override the plan Postgres generates, these problems dominate our development efforts. Postgres does an excellent job optimizing on 90% of the SQL we write, but the last 10% is nearly impossible to get right. We spend huge amounts of time on trial-and-error queries, second guessing Postgress, creating unnecessary temporary tables, sticking in the occasional OFFSET in a subquery to prevent merging layers, and so forth. This same application also runs on Oracle, and although I've cursed Oracle's stupid planner many times, at least I can force it to do it right if I need to. The danger of forced plans is that inexperienced developers tend to abuse them. So it goes -- the documentation should be clear that forced plans are always a last resort. But there's no getting around the fact that Postgres needs a way for a developer to specify the execution plan. Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 19:44:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6DBD19DCAA3 for ; Thu, 15 Dec 2005 19:44:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05883-03 for ; Thu, 15 Dec 2005 19:44:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id B833E9DCA02 for ; Thu, 15 Dec 2005 19:44:49 -0400 (AST) 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 jBFNinRI088867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Dec 2005 16:44:51 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBFNinx0047459; Thu, 15 Dec 2005 16:44:49 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBFNimhO047458; Thu, 15 Dec 2005 16:44:48 -0700 (MST) (envelope-from mfuhr) Date: Thu, 15 Dec 2005 16:44:48 -0700 From: Michael Fuhr To: Tom Lane Cc: Merlin Moncure , pgsql-performance@postgresql.org, Carlos Benkendorf Subject: Re: How much expensive are row level statistics? Message-ID: <20051215234448.GA47382@winnie.fuhr.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> <2506.1134428461@sss.pgh.pa.us> <20051213010751.GA63416@winnie.fuhr.org> <1667.1134444045@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1667.1134444045@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.014 required=5 tests=[AWL=0.014] X-Spam-Score: 0.014 X-Spam-Level: X-Archive-Number: 200512/360 X-Sequence-Number: 16181 On Mon, Dec 12, 2005 at 10:20:45PM -0500, Tom Lane wrote: > Given the rather lackadaisical way in which the stats collector makes > the data available, it seems like the backends are being much too > enthusiastic about posting their stats_command_string status > immediately. Might be worth thinking about how to cut back the > overhead by suppressing some of these messages. Would a GUC setting akin to log_min_duration_statement be feasible? Does the backend support, or could it be easily modified to support, a mechanism that would post the command string after a configurable amount of time had expired, and then continue processing the query? That way admins could avoid the overhead of posting messages for short-lived queries that nobody's likely to see in pg_stat_activity anyway. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Thu Dec 15 20:06:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 569709DC835 for ; Thu, 15 Dec 2005 20:06:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13716-01 for ; Thu, 15 Dec 2005 20:06:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 32FB49DC820 for ; Thu, 15 Dec 2005 20:06:35 -0400 (AST) 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 jBG06dUe018417; Thu, 15 Dec 2005 19:06:39 -0500 (EST) To: Michael Fuhr cc: Merlin Moncure , pgsql-performance@postgresql.org, Carlos Benkendorf Subject: Re: How much expensive are row level statistics? In-reply-to: <20051215234448.GA47382@winnie.fuhr.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> <2506.1134428461@sss.pgh.pa.us> <20051213010751.GA63416@winnie.fuhr.org> <1667.1134444045@sss.pgh.pa.us> <20051215234448.GA47382@winnie.fuhr.org> Comments: In-reply-to Michael Fuhr message dated "Thu, 15 Dec 2005 16:44:48 -0700" Date: Thu, 15 Dec 2005 19:06:39 -0500 Message-ID: <18416.1134691599@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/361 X-Sequence-Number: 16182 Michael Fuhr writes: > Does the backend support, or could it be easily modified to support, > a mechanism that would post the command string after a configurable > amount of time had expired, and then continue processing the query? Not really, unless you want to add the overhead of setting a timer interrupt for every query. Which is sort of counterproductive when the motivation is to reduce overhead ... (It might be more or less free if you have statement_timeout set, since there would be a setitimer call anyway. But I don't think that's the norm.) regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 15 20:23:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 92E6A9DC9D7 for ; Thu, 15 Dec 2005 20:23:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04808-09 for ; Thu, 15 Dec 2005 20:23:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 701C59DC820 for ; Thu, 15 Dec 2005 20:23:47 -0400 (AST) 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 jBG0NnuW018538; Thu, 15 Dec 2005 19:23:49 -0500 (EST) To: "Craig A. James" cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer In-reply-to: <43A1F6DB.3080805@modgraph-usa.com> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Thu, 15 Dec 2005 15:06:03 -0800" Date: Thu, 15 Dec 2005 19:23:49 -0500 Message-ID: <18537.1134692629@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/362 X-Sequence-Number: 16183 "Craig A. James" writes: > I see this over and over. Tweak the parameters to "force" a certain > plan, because there's no formal way for a developer to say, "I know > the best plan." I think you've misunderstood those conversations entirely. The point is not to force the planner into a certain plan, it is to explore what's going on with a view to understanding why the planner isn't making a good choice, and thence hopefully improve the planner in future. (Now, that's not necessarily what the user with an immediate problem is thinking, but that's definitely what the developers are thinking.) > There isn't a database in the world that is as smart as a developer, People who are convinced they are smarter than the machine are often wrong ;-). If we did put in the nontrivial amount of work needed to have such a facility, it would probably get abused more often than it was used correctly. I'd rather spend the work on making the planner better. This discussion has been had before (many times) ... see the -hackers archives for detailed arguments. The one that carries the most weight in my mind is that planner hints embedded in applications will not adapt to changing circumstances --- the plan that was best when you designed the code might not be best today. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 15 21:50:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1CA9E9DCC9F for ; Thu, 15 Dec 2005 21:50:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29151-03 for ; Thu, 15 Dec 2005 21:50:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id F0D9E9DC84D for ; Thu, 15 Dec 2005 21:50:46 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 7E7BC25077; Fri, 16 Dec 2005 09:50:47 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 67CFB25070; Fri, 16 Dec 2005 09:50:44 +0800 (WST) Message-ID: <43A21D74.8030002@familyhealth.com.au> Date: Fri, 16 Dec 2005 09:50:44 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> In-Reply-To: <43A1F6DB.3080805@modgraph-usa.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.032 required=5 tests=[AWL=0.032] X-Spam-Score: 0.032 X-Spam-Level: X-Archive-Number: 200512/363 X-Sequence-Number: 16184 > select * from my_table where row_num >= 50000 and row_num < 100000 > and myfunc(foo, bar); You just create an index on myfunc(foo, bar) Chris From pgsql-performance-owner@postgresql.org Thu Dec 15 22:00:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D7429DC84D for ; Thu, 15 Dec 2005 22:00:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30091-07 for ; Thu, 15 Dec 2005 22:00:49 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by postgresql.org (Postfix) with ESMTP id B487F9DC820 for ; Thu, 15 Dec 2005 22:00:43 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so497218wri for ; Thu, 15 Dec 2005 18:00:47 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JePW29c16uwXJeNrd+g2tWm2jd3M3sDp5YKVu9lpcAjzo1YwcfTzG+DUtpZ7MZgrs+LJqaQDeTzpL7Du7X2fGuBaoGkrPKJepl/9cfS2yQvwVTML80q1UvPj9+qxzu5bfycKCRZ1SjCCqq5JtuDlahVt+L+xbcC2k4H2tjunnhg= Received: by 10.54.77.16 with SMTP id z16mr2021427wra; Thu, 15 Dec 2005 18:00:44 -0800 (PST) Received: by 10.54.98.6 with HTTP; Thu, 15 Dec 2005 18:00:44 -0800 (PST) Message-ID: Date: Thu, 15 Dec 2005 21:00:44 -0500 From: Jaime Casanova To: Christopher Kings-Lynne Subject: Re: Overriding the optimizer Cc: "Craig A. James" , pgsql-performance@postgresql.org In-Reply-To: <43A21D74.8030002@familyhealth.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.094 required=5 tests=[AWL=0.094] X-Spam-Score: 0.094 X-Spam-Level: X-Archive-Number: 200512/364 X-Sequence-Number: 16185 On 12/15/05, Christopher Kings-Lynne wrote: > > select * from my_table where row_num >=3D 50000 and row_num < 10= 0000 > > and myfunc(foo, bar); > > You just create an index on myfunc(foo, bar) > > Chris > only if myfunc(foo, bar) is immutable... -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Thu Dec 15 22:02:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EB0269DCC9F for ; Thu, 15 Dec 2005 22:02:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29388-07 for ; Thu, 15 Dec 2005 22:02:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id CE1C59DCCAC for ; Thu, 15 Dec 2005 22:02:37 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id B15F425070; Fri, 16 Dec 2005 10:02:41 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 519B624FFA; Fri, 16 Dec 2005 10:02:35 +0800 (WST) Message-ID: <43A2203B.2050102@familyhealth.com.au> Date: Fri, 16 Dec 2005 10:02:35 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jaime Casanova Cc: "Craig A. James" , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.031 required=5 tests=[AWL=0.031] X-Spam-Score: 0.031 X-Spam-Level: X-Archive-Number: 200512/365 X-Sequence-Number: 16186 >>> select * from my_table where row_num >= 50000 and row_num < 100000 >>> and myfunc(foo, bar); >> >>You just create an index on myfunc(foo, bar) > > only if myfunc(foo, bar) is immutable... And if it's not then the best any database can do is to index scan row_num - so still you have no problem. Chris From pgsql-performance-owner@postgresql.org Thu Dec 15 22:19:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E26B89DCC9E for ; Thu, 15 Dec 2005 22:19:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32963-09 for ; Thu, 15 Dec 2005 22:19:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id AD56B9DCCD0 for ; Thu, 15 Dec 2005 22:19:27 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG2JhAb025513; Thu, 15 Dec 2005 18:19:43 -0800 Message-ID: <43A22368.8060307@modgraph-usa.com> Date: Thu, 15 Dec 2005 18:16:08 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane CC: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <18537.1134692629@sss.pgh.pa.us> In-Reply-To: <18537.1134692629@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, score=0.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200512/366 X-Sequence-Number: 16187 Tom, >>I see this over and over. Tweak the parameters to "force" a certain >>plan, because there's no formal way for a developer to say, "I know >>the best plan." > > I think you've misunderstood those conversations entirely. The point > is not to force the planner into a certain plan, it is to explore what's > going on with a view to understanding why the planner isn't making a > good choice, and thence hopefully improve the planner in future. No, I understood the conversations very clearly. But no matter how clever the optimizer, it simply can't compete with a developer who has knowledge that Postgres *can't* have. The example of a user-written function is obvious. >>There isn't a database in the world that is as smart as a developer, > > People who are convinced they are smarter than the machine are often > wrong ;-). Often, but not always -- as I noted in my original posting. And when the developer is smarter than Postgres, and Postgres makes the wrong choice, what is the developer supposed to do? This isn't academic -- the wrong plans Postgres makes can be *catastrophic*, e.g. turning a 3-second query into a three-hour query. How about this: Instead of arguing in the abstract, tell me in concrete terms how you would address the very specific example I gave, where myfunc() is a user-written function. To make it a little more challenging, try this: myfunc() can behave very differently depending on the parameters, and sometimes (but not always), the application knows how it will behave and could suggest a good execution plan. (And before anyone suggests that I rewrite myfunc(), I should explain that it's in the class of NP-complete problems. The function is inherently hard and can't be made faster or more predictable.) The example I raised in a previous thread, of irregular usage, is the same: I have a particular query that I *always* want to be fast even if it's only used rarely, but the system swaps its tables out of the file-system cache, based on "low usage", even though the "high usage" queries are low priority. How can Postgres know such things when there's no way for me to tell it? The answers from the Postgres community were essentially, "Postgres is smarter than you, let it do its job." Unfortunately, this response completely ignores the reality: Postgres is NOT doing its job, and can't, because it doesn't have enough information. Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 22:21:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D329D9DCC9E for ; Thu, 15 Dec 2005 22:21:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32446-10 for ; Thu, 15 Dec 2005 22:21:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 9E2E79DCCC8 for ; Thu, 15 Dec 2005 22:21:27 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG2LhKN025528 for ; Thu, 15 Dec 2005 18:21:43 -0800 Message-ID: <43A223E1.5040903@modgraph-usa.com> Date: Thu, 15 Dec 2005 18:18:09 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> In-Reply-To: <43A21D74.8030002@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, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200512/367 X-Sequence-Number: 16188 Christopher Kings-Lynne wrote: >> select * from my_table where row_num >= 50000 and row_num < 100000 >> and myfunc(foo, bar); > > > You just create an index on myfunc(foo, bar) Thanks, but myfunc() takes parameters (shown here as "foo, bar"), one of which is not a column, it's external and changes with every query. A function index won't work. Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 22:26:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 96B9C9DC84B for ; Thu, 15 Dec 2005 22:26:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31577-08 for ; Thu, 15 Dec 2005 22:26:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 4DB329DC820 for ; Thu, 15 Dec 2005 22:26:40 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG2QuDL025563 for ; Thu, 15 Dec 2005 18:26:56 -0800 Message-ID: <43A2251A.60907@modgraph-usa.com> Date: Thu, 15 Dec 2005 18:23:22 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> <43A2203B.2050102@familyhealth.com.au> In-Reply-To: <43A2203B.2050102@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, score=0.032 required=5 tests=[AWL=0.032] X-Spam-Score: 0.032 X-Spam-Level: X-Archive-Number: 200512/369 X-Sequence-Number: 16190 Christopher Kings-Lynne wrote: >>>> select * from my_table where row_num >= 50000 and row_num < >>>> 100000 >>>> and myfunc(foo, bar); >>> >>> >>> You just create an index on myfunc(foo, bar) >> >> >> only if myfunc(foo, bar) is immutable... > > > And if it's not then the best any database can do is to index scan > row_num - so still you have no problem. Boy, you picked a *really* bad example ;-) The problem is that Postgres decided to filter on myfunc() *first*, and then filter on row_num, resulting in a query time that jumped from seconds to hours. And there's no way for me to tell Postgres not to do that! So, "you still have no problem" is exactly wrong, because Postgres picked the wrong plan. Postgres decided that applying myfunc() to 10,000,000 rows was a better plan than an index scan of 50,000 row_nums. So I'm screwed. Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 22:25:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B5EEA9DC84D for ; Thu, 15 Dec 2005 22:25:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34645-04 for ; Thu, 15 Dec 2005 22:25:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id 7A7709DC84B for ; Thu, 15 Dec 2005 22:25:18 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id AE26825074; Fri, 16 Dec 2005 10:25:22 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 6705B24FFA; Fri, 16 Dec 2005 10:25:21 +0800 (WST) Message-ID: <43A22592.1000101@familyhealth.com.au> Date: Fri, 16 Dec 2005 10:25:22 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> In-Reply-To: <43A1F6DB.3080805@modgraph-usa.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/368 X-Sequence-Number: 16189 > > Right on. Some of these "coerced" plans may perform > much better. > If so, we can look at tweaking your runtime > > config: e.g. > > > > effective_cache_size > > random_page_cost > > default_statistics_target > > > > to see if said plans can be chosen "naturally". > > I see this over and over. Tweak the parameters to "force" a certain > plan, because there's no formal way for a developer to say, "I know the > best plan." No, this is "fixing your wrongn, inaccurate parameters so that postgresql can choose a better plan". I don't necessarily disagree with your assertion that we need planner hints, but unless you or someone else is willing to submit a patch with the feature it's unlikely to ever be implemented... Chris From pgsql-performance-owner@postgresql.org Thu Dec 15 22:31:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2EF6D9DCC9E for ; Thu, 15 Dec 2005 22:31:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33632-09 for ; Thu, 15 Dec 2005 22:31:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 08A4F9DCC1E for ; Thu, 15 Dec 2005 22:31:01 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRK00BAYKBTYJ@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 16 Dec 2005 15:31:05 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-124.dsl.clear.net.nz [218.101.29.124]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 27F85116A357; Fri, 16 Dec 2005 15:31:04 +1300 (NZDT) Date: Fri, 16 Dec 2005 15:31:03 +1300 From: Mark Kirkwood Subject: Re: Overriding the optimizer In-reply-to: <43A1F6DB.3080805@modgraph-usa.com> To: "Craig A. James" Cc: pgsql-performance@postgresql.org Message-id: <43A226E7.7040508@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.133 required=5 tests=[AWL=0.133] X-Spam-Score: 0.133 X-Spam-Level: X-Archive-Number: 200512/370 X-Sequence-Number: 16191 Craig A. James wrote: > I asked a while back if there were any plans to allow developers to > override the optimizer's plan and force certain plans, and received a > fairly resounding "No". The general feeling I get is that a lot of work > has gone into the optimizer, and by God we're going to use it! > > I think this is just wrong, and I'm curious whether I'm alone in this > opinion. > > Over and over, I see questions posted to this mailing list about > execution plans that don't work out well. Many times there are good > answers - add an index, refactor the design, etc. - that yield good > results. But, all too often the answer comes down to something like > this recent one: > > > Right on. Some of these "coerced" plans may perform > much better. > If so, we can look at tweaking your runtime > > config: e.g. > > > > effective_cache_size > > random_page_cost > > default_statistics_target > > > > to see if said plans can be chosen "naturally". > > I see this over and over. Tweak the parameters to "force" a certain > plan, because there's no formal way for a developer to say, "I know the > best plan." > I hear what you are saying, but to use this fine example - I don't know what the best plan is - these experiments part of an investigation to find *if* there is a better plan, and if so, why Postgres is not finding it. > There isn't a database in the world that is as smart as a developer, or > that can have insight into things that only a developer can possibly > know. That is often true - but the aim is to get Postgres's optimizer closer to developer smartness. After years of using several other database products (some supporting hint type constructs and some not), I have come to believe that hinting (or similar) actually *hinders* the development of a great optimizer. Best wishes Mark From pgsql-performance-owner@postgresql.org Thu Dec 15 22:34:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 825F79DCC9E for ; Thu, 15 Dec 2005 22:34:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34935-08 for ; Thu, 15 Dec 2005 22:34:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id 5AC089DCCBA for ; Thu, 15 Dec 2005 22:34:38 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id A620625070; Fri, 16 Dec 2005 10:34:42 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 715A224FFA; Fri, 16 Dec 2005 10:34:40 +0800 (WST) Message-ID: <43A227BE.9030106@familyhealth.com.au> Date: Fri, 16 Dec 2005 10:34:38 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> <43A2203B.2050102@familyhealth.com.au> <43A2251A.60907@modgraph-usa.com> In-Reply-To: <43A2251A.60907@modgraph-usa.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/371 X-Sequence-Number: 16192 > Boy, you picked a *really* bad example ;-) > > The problem is that Postgres decided to filter on myfunc() *first*, and > then filter on row_num, resulting in a query time that jumped from > seconds to hours. And there's no way for me to tell Postgres not to do > that! Can you paste explain analyze and your effective_cache_size, etc. settings. > So, "you still have no problem" is exactly wrong, because Postgres > picked the wrong plan. Postgres decided that applying myfunc() to > 10,000,000 rows was a better plan than an index scan of 50,000 > row_nums. So I'm screwed. This seems like a case where PostgreSQL's current optimiser should easily know what to do if your config settings are correct and you've been running ANALYZE, so I'd like to see your settings and the explain analyze plan... Chris From pgsql-performance-owner@postgresql.org Thu Dec 15 22:47:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6E8119DC8A0 for ; Thu, 15 Dec 2005 22:47:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34925-08 for ; Thu, 15 Dec 2005 22:47:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 0F02C9DC84B for ; Thu, 15 Dec 2005 22:47:21 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG2lcTr025675 for ; Thu, 15 Dec 2005 18:47:38 -0800 Message-ID: <43A229F3.20200@modgraph-usa.com> Date: Thu, 15 Dec 2005 18:44:03 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A22592.1000101@familyhealth.com.au> In-Reply-To: <43A22592.1000101@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, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/372 X-Sequence-Number: 16193 Christopher Kings-Lynne wrote: > I don't necessarily disagree with your assertion that we need planner > hints, but unless you or someone else is willing to submit a patch with > the feature it's unlikely to ever be implemented... Now that's an answer I understand and appreciate. Open-source development relies on many volunteers, and I've benefitted from it since the early 1980's when emacs and Common Lisp first came to my attention. I've even written a widely-circulated article about open-source development, which some of you may have read: http://www.moonviewscientific.com/essays/software_lifecycle.htm I hope nobody here thinks I'm critical of all the hard work that's been put into Postgres. My hope is to raise the awareness of this issue in the hope that it's at least put on "the list" for serious consideration. Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 22:55:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1FC519DC820 for ; Thu, 15 Dec 2005 22:55:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37746-09 for ; Thu, 15 Dec 2005 22:55:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 058D99DC8A0 for ; Thu, 15 Dec 2005 22:55:36 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG2trtA025718 for ; Thu, 15 Dec 2005 18:55:53 -0800 Message-ID: <43A22BE3.6020103@modgraph-usa.com> Date: Thu, 15 Dec 2005 18:52:19 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 CC: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> In-Reply-To: <43A226E7.7040508@paradise.net.nz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=-0.076, MISSING_HEADERS=0.189] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200512/373 X-Sequence-Number: 16194 Mark Kirkwood wrote: > I hear what you are saying, but to use this fine example - I don't know > what the best plan is - these experiments part of an investigation to > find *if* there is a better plan, and if so, why Postgres is not finding > it. > >> There isn't a database in the world that is as smart as a developer, >> or that can have insight into things that only a developer can >> possibly know. > > That is often true - but the aim is to get Postgres's optimizer closer > to developer smartness. What would be cool would be some way the developer could alter the plan, but they way of doing so would strongly encourage the developer to send the information to this mailing list. Postgres would essentially say, "Ok, you can do that, but we want to know why!" > After years of using several other database products (some supporting > hint type constructs and some not), I have come to believe that hinting > (or similar) actually *hinders* the development of a great optimizer. I agree. It takes the pressure off the optimizer gurus. If the users can just work around every problem, then the optimizer can suck and the system is still usable. Lest anyone think I'm an all-out advocate of overriding the optimizer, I know from first-hand experience what a catastrophe it can be. An Oracle hint I used worked fine on my test schema, but the customer's "table" turned out to be a view, and Oracle's optimizer worked well on the view whereas my hint was horrible. Unfortunately, without the hint, Oracle sucked when working on an ordinary table. Hints are dangerous, and I consider them a last resort. Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 23:07:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B92B29DC84B for ; Thu, 15 Dec 2005 23:07:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46551-01 for ; Thu, 15 Dec 2005 23:07:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 7325E9DC820 for ; Thu, 15 Dec 2005 23:07:21 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG37cCP025775 for ; Thu, 15 Dec 2005 19:07:38 -0800 Message-ID: <43A22EA3.50007@modgraph-usa.com> Date: Thu, 15 Dec 2005 19:04:03 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <18537.1134692629@sss.pgh.pa.us> In-Reply-To: <18537.1134692629@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, score=0.032 required=5 tests=[AWL=0.032] X-Spam-Score: 0.032 X-Spam-Level: X-Archive-Number: 200512/374 X-Sequence-Number: 16195 Tom Lane wrote: > This discussion has been had before (many times) ... see the -hackers > archives for detailed arguments. The one that carries the most weight > in my mind is that planner hints embedded in applications will not adapt > to changing circumstances --- the plan that was best when you designed > the code might not be best today. Absolutely right. But what am I supposed to do *today* if the planner makes a mistake? Shut down my web site? Ropes are useful, but you can hang yourself with them. Knives are useful, but you can cut yourself with them. Should we ban useful tools because they cause harm to the careless? Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 23:15:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 20B6D9DC84B for ; Thu, 15 Dec 2005 23:15:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46874-06 for ; Thu, 15 Dec 2005 23:15:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id DFFF59DC820 for ; Thu, 15 Dec 2005 23:15:10 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG3FRfF025815 for ; Thu, 15 Dec 2005 19:15:27 -0800 Message-ID: <43A23079.8060307@modgraph-usa.com> Date: Thu, 15 Dec 2005 19:11:53 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> <43A2203B.2050102@familyhealth.com.au> <43A2251A.60907@modgraph-usa.com> <43A227BE.9030106@familyhealth.com.au> In-Reply-To: <43A227BE.9030106@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, score=0.027 required=5 tests=[AWL=0.027] X-Spam-Score: 0.027 X-Spam-Level: X-Archive-Number: 200512/375 X-Sequence-Number: 16196 Christopher Kings-Lynne wrote: > Can you paste explain analyze and your effective_cache_size, etc. settings. > ... > This seems like a case where PostgreSQL's current optimiser should > easily know what to do if your config settings are correct and you've > been running ANALYZE, so I'd like to see your settings and the explain > analyze plan... I could, but it would divert us from the main topic of this discussion. It's not about that query, which was just an example. It's the larger issue. Tom's earlier response tells the story better than I can: > This discussion has been had before (many times) ... see > the -hackers archives for detailed arguments. If it's "been had before (many times)", and now I'm bringing it up again, then it's clearly an ongoing problem that hasn't been resolved. Craig From pgsql-performance-owner@postgresql.org Thu Dec 15 23:17:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5146B9DC84D for ; Thu, 15 Dec 2005 23:17:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46718-04 for ; Thu, 15 Dec 2005 23:17:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 3BC519DC84B for ; Thu, 15 Dec 2005 23:17:00 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRK00EROMGGUP@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 16 Dec 2005 16:17:04 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-124.dsl.clear.net.nz [218.101.29.124]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 59C2173B875; Fri, 16 Dec 2005 16:17:04 +1300 (NZDT) Date: Fri, 16 Dec 2005 16:16:58 +1300 From: Mark Kirkwood Subject: Re: Overriding the optimizer In-reply-to: <43A22BE3.6020103@modgraph-usa.com> To: "Craig A. James" Cc: pgsql-performance@postgresql.org Message-id: <43A231AA.9070708@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.121] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200512/376 X-Sequence-Number: 16197 Craig A. James wrote: > > What would be cool would be some way the developer could alter the plan, > but they way of doing so would strongly encourage the developer to send > the information to this mailing list. Postgres would essentially say, > "Ok, you can do that, but we want to know why!" > Yeah it would - an implementation I have seen that I like is where the developer can supply the *entire* execution plan with a query. This is complex enough to make casual use unlikely :-), but provides the ability to try out other plans, and also fix that vital query that must run today..... cheers Mark From pgsql-performance-owner@postgresql.org Thu Dec 15 23:20:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F34DE9DCCDF for ; Thu, 15 Dec 2005 23:20:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46324-09 for ; Thu, 15 Dec 2005 23:20:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by postgresql.org (Postfix) with ESMTP id 957DC9DCCC3 for ; Thu, 15 Dec 2005 23:20:30 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 4333725070; Fri, 16 Dec 2005 11:20:34 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id C84C724FFA; Fri, 16 Dec 2005 11:20:32 +0800 (WST) Message-ID: <43A2327C.8000206@familyhealth.com.au> Date: Fri, 16 Dec 2005 11:20:28 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> <43A2203B.2050102@familyhealth.com.au> <43A2251A.60907@modgraph-usa.com> <43A227BE.9030106@familyhealth.com.au> <43A23079.8060307@modgraph-usa.com> In-Reply-To: <43A23079.8060307@modgraph-usa.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.027 required=5 tests=[AWL=0.027] X-Spam-Score: 0.027 X-Spam-Level: X-Archive-Number: 200512/377 X-Sequence-Number: 16198 >> ... This seems like a case where PostgreSQL's current optimiser should >> easily know what to do if your config settings are correct and you've >> been running ANALYZE, so I'd like to see your settings and the explain >> analyze plan... > > I could, but it would divert us from the main topic of this discussion. > It's not about that query, which was just an example. It's the larger > issue. So your main example bad query is possibly just a case of lack of analyze stats and wrong postgresql.conf config? And that's what causes you to shut down your database? Don't you want your problem FIXED? But like I said - no developer is interested in doing planner hints. Possibly you could get a company to sponsor it. Maybe what you want is a statement of "If someone submits a good, working, fully implemented patch that does planner hints, then we'll accept it." Chris From pgsql-performance-owner@postgresql.org Thu Dec 15 23:41:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7B71F9DCCC0 for ; Thu, 15 Dec 2005 23:41:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66870-04 for ; Thu, 15 Dec 2005 23:42:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 383809DCCB9 for ; Thu, 15 Dec 2005 23:41:53 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG3gBCl025955 for ; Thu, 15 Dec 2005 19:42:11 -0800 Message-ID: <43A236BC.1070300@modgraph-usa.com> Date: Thu, 15 Dec 2005 19:38:36 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> <43A2203B.2050102@familyhealth.com.au> <43A2251A.60907@modgraph-usa.com> <43A227BE.9030106@familyhealth.com.au> <43A23079.8060307@modgraph-usa.com> <43A2327C.8000206@familyhealth.com.au> In-Reply-To: <43A2327C.8000206@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, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/378 X-Sequence-Number: 16199 Christopher Kings-Lynne wrote: > So your main example bad query is possibly just a case of lack of > analyze stats and wrong postgresql.conf config? And that's what causes > you to shut down your database? Don't you want your problem FIXED? I'm trying to help by raising a question that I think is important, and have an honest, perhaps vigorous, but respectful, discussion about it. I respect everyone's opinion, and I hope you respect mine. I've been in this business a long time, and I don't raise issues lightly. Yes, I want my query fixed. And I may post it, in a thread with a new title. In fact, I posted a different query with essentially the same problem a while back and got nothing that helped: http://archives.postgresql.org/pgsql-performance/2005-11/msg00133.php (I can't help but point out that Tom's response was to suggest a way to fool the optimizer so as to prevent it from "optimizing" the query. In other words, he told me a trick that would force a particular plan on the optimizer. Which is exactly the point of this discussion.) The point is that the particular query is not relevant -- it's the fact that this topic (according to Tom) has been and continues to be raised. This should tell us all something, that it's not going to go away, and that it's a real issue. Regards, Craig From pgsql-performance-owner@postgresql.org Fri Dec 16 00:01:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 93E5D9DCA35 for ; Fri, 16 Dec 2005 00:01:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66870-10 for ; Fri, 16 Dec 2005 00:01:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 09F189DC820 for ; Fri, 16 Dec 2005 00:01:13 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG41PTO026047 for ; Thu, 15 Dec 2005 20:01:25 -0800 Message-ID: <43A23B3E.5050809@modgraph-usa.com> Date: Thu, 15 Dec 2005 19:57:50 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <43A231AA.9070708@paradise.net.nz> In-Reply-To: <43A231AA.9070708@paradise.net.nz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.021 required=5 tests=[AWL=0.021] X-Spam-Score: 0.021 X-Spam-Level: X-Archive-Number: 200512/379 X-Sequence-Number: 16200 > Yeah it would - an implementation I have seen that I like is where the > developer can supply the *entire* execution plan with a query. This is > complex enough to make casual use unlikely :-), but provides the ability > to try out other plans, and also fix that vital query that must run > today..... So, to move on to the concrete... I'm not familiar with the innards of Postgres except in a theoretical way. Maybe this is a totally naive or dumb question, but I have to ask: How hard would it be to essentially turn off the optimizer? 1. Evaluate WHERE clauses left-to-right. select ... from FOO where A and B and C; This would just apply the criteria left-to-right, first A, then B, then C. If an index was available it would use it, but only in left-to-right order, i.e. if A had no index but B did, then too bad, you should have written "B and A and C". 2. Evaluate joins left-to-right. select ... from FOO join BAR on (...) join BAZ on (...) where ... This would join FOO to BAR, then join the result to BAZ. The only optimization would be to apply relevant "where" conditions to each join before processing the next join. 3. Don't flatten sub-selects select ... from (select ... from FOO where ...) as X where ...; This would do the inner select then use the result in the outer select, and wouldn't attempt to flatten the query. Thanks, Craig From pgsql-performance-owner@postgresql.org Fri Dec 16 00:07:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A93489DCA43 for ; Fri, 16 Dec 2005 00:07:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72063-01 for ; Fri, 16 Dec 2005 00:07:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 59D4C9DC84A for ; Fri, 16 Dec 2005 00:04:58 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id D3FCC1AC3E9; Thu, 15 Dec 2005 20:03:56 -0800 (PST) Date: Thu, 15 Dec 2005 20:02:58 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer In-Reply-To: <43A22BE3.6020103@modgraph-usa.com> Message-ID: References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/380 X-Sequence-Number: 16201 On Thu, 15 Dec 2005, Craig A. James wrote: > Mark Kirkwood wrote: >> I hear what you are saying, but to use this fine example - I don't know >> what the best plan is - these experiments part of an investigation to find >> *if* there is a better plan, and if so, why Postgres is not finding it. >> >>> There isn't a database in the world that is as smart as a developer, or >>> that can have insight into things that only a developer can possibly know. >> >> That is often true - but the aim is to get Postgres's optimizer closer to >> developer smartness. > > What would be cool would be some way the developer could alter the plan, but > they way of doing so would strongly encourage the developer to send the > information to this mailing list. Postgres would essentially say, "Ok, you > can do that, but we want to know why!" at the risk of sounding flippent (which is NOT what I intend) I will point out that with the source you can change the optimizer any way you need to :-) that being said, in your example the issue is the cost of the user created function and the fact that postgres doesn't know it's cost. would a resonable answer be to give postgres a way to learn how expensive the call is? a couple ways I could see to do this. 1. store some stats automagicly when the function is called and update the optimization plan when you do an ANALYSE 2. provide a way for a user to explicitly set a cost factor for a function (with a default value that's sane for fairly trivial functions so that it would only have to be set for unuseually expensive functions) now, neither of these will work all the time if a given function is sometimes cheap and sometimes expensive (depending on it's parameters), but in that case I would say that if the application knows that a function will be unusueally expensive under some conditions (and knows what those conditions will be) it may be a reasonable answer to duplicate the function, one copy that it uses most of the time, and a second copy that it uses when it expects it to be expensive. at this point the cost of the function can be set via either of the methods listed above) >> After years of using several other database products (some supporting hint >> type constructs and some not), I have come to believe that hinting (or >> similar) actually *hinders* the development of a great optimizer. > > I agree. It takes the pressure off the optimizer gurus. If the users can > just work around every problem, then the optimizer can suck and the system is > still usable. > > Lest anyone think I'm an all-out advocate of overriding the optimizer, I know > from first-hand experience what a catastrophe it can be. An Oracle hint I > used worked fine on my test schema, but the customer's "table" turned out to > be a view, and Oracle's optimizer worked well on the view whereas my hint was > horrible. Unfortunately, without the hint, Oracle sucked when working on an > ordinary table. Hints are dangerous, and I consider them a last resort. I've been on the linux-kernel mailing list for the last 9 years, and have seen a similar debate rage during that entire time about kernel memory management. overall both of these tend to be conflicts between short-term and long-term benifits. in the short-term the application user wants to be able to override the system to get the best performance _now_ in the long run the system designers don't trust the application programmers to get the hints right and want to figure out the right optimizer plan, even if it takes a lot longer to do so. the key to this balance seems to be to work towards as few controls as possible, becouse the user will get them wrong far more frequently then they get them right, but when you hit a point where there's absolutly no way for the system to figure things out (and it's a drastic difference) provide the application with a way to hint to the system that things are unusueal, but always keep looking for patterns that will let the system detect the need itself even the existing defaults are wrong as frequently as they are right (they were set when hardware was very different then it is today) so some way to gather real-world stats and set the system defaults based on actual hardware performance is really the right way to go (even for things like sequential scan speed that are set in the config file today) David Lang From pgsql-performance-owner@postgresql.org Fri Dec 16 00:10:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BEDA09DCA43 for ; Fri, 16 Dec 2005 00:10:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71250-02 for ; Fri, 16 Dec 2005 00:10:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id C843A9DCA5C for ; Fri, 16 Dec 2005 00:07:27 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 260531AC3EA; Thu, 15 Dec 2005 20:06:27 -0800 (PST) Date: Thu, 15 Dec 2005 20:05:29 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Mark Kirkwood Cc: Mitch Skinner , Kevin Brown , pgsql-performance@postgresql.org Subject: Re: Simple Join In-Reply-To: <43A1C40D.8040006@paradise.net.nz> Message-ID: References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/381 X-Sequence-Number: 16202 On Fri, 16 Dec 2005, Mark Kirkwood wrote: > > Right on. Some of these "coerced" plans may perform much better. If so, we > can look at tweaking your runtime config: e.g. > > effective_cache_size > random_page_cost > default_statistics_target > > to see if said plans can be chosen "naturally". Mark, I've seen these config options listed as tweaking targets fairly frequently, has anyone put any thought or effort into creating a test program that could analyse the actual system and set the defaults based on the measured performance? David Lang From pgsql-performance-owner@postgresql.org Fri Dec 16 00:27:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 786CA9DCA5C for ; Fri, 16 Dec 2005 00:27:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72063-07 for ; Fri, 16 Dec 2005 00:27:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 5DF8A9DCA43 for ; Fri, 16 Dec 2005 00:24:57 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 92EB21AC3E9; Thu, 15 Dec 2005 20:23:56 -0800 (PST) Date: Thu, 15 Dec 2005 20:22:58 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: "Craig A. James" Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer In-Reply-To: <43A22368.8060307@modgraph-usa.com> Message-ID: References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <18537.1134692629@sss.pgh.pa.us> <43A22368.8060307@modgraph-usa.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/384 X-Sequence-Number: 16205 On Thu, 15 Dec 2005, Craig A. James wrote: > The example I raised in a previous thread, of irregular usage, is the same: I > have a particular query that I *always* want to be fast even if it's only > used rarely, but the system swaps its tables out of the file-system cache, > based on "low usage", even though the "high usage" queries are low priority. > How can Postgres know such things when there's no way for me to tell it? actually, postgres doesn't manage the file-system cache, it deliberatly leaves that up to the OS it is running on to do that job. one (extremely ugly) method that you could use would be to have a program that looks up what files are used to store your high priority tables and then write a trivial program to keep those files in memory (it may be as simple as mmaping the files and then going to sleep, or you may have to read various points through the file to keep them current in the cache, it WILL vary depending on your OS and filesystem in use) oracle goes to extremes with this sort of control, I'm actually mildly surprised that they still run on a host OS and haven't completely taken over the machine (I guess they don't want to have to write device drivers, that's about the only OS code they really want to use, they do their own memory management, filesystem, and user systems), by avoiding areas like this postgres sacrafices a bit of performance, but gains a much broader set of platforms (hardware and OS) that it can run on. and this by itself can result in significant wins (does oracle support Opteron CPU's in 64 bit mode yet? as of this summer it just wasn't an option) David Lang From pgsql-performance-owner@postgresql.org Fri Dec 16 00:23:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 335949DCA43 for ; Fri, 16 Dec 2005 00:23:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73053-04-3 for ; Fri, 16 Dec 2005 00:23:30 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by postgresql.org (Postfix) with ESMTP id 0B9899DCA35 for ; Fri, 16 Dec 2005 00:23:28 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so516362wri for ; Thu, 15 Dec 2005 20:23:28 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=YmzghltmzmpBawgLAemOsmbGnKY6on4xPitkeZtAGvxqpLWRL3rW4hQYvLVCrklk3aW4iMcMpCFTNiCElErUY6Utt+wVCGfVuva2AD5vQ9AcK11+MwVfJKTZxFQXS0GPle1zY9dMJqJYcni5FeKildUC9RyVZzOLYaQ+GSCB3Ps= Received: by 10.54.140.8 with SMTP id n8mr3136378wrd; Thu, 15 Dec 2005 20:23:28 -0800 (PST) Received: by 10.54.98.6 with HTTP; Thu, 15 Dec 2005 20:23:27 -0800 (PST) Message-ID: Date: Thu, 15 Dec 2005 23:23:27 -0500 From: Jaime Casanova To: "Craig A. James" Subject: Re: Overriding the optimizer Cc: pgsql-performance@postgresql.org In-Reply-To: <43A23B3E.5050809@modgraph-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512141603.52583.blargity@gmail.com> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <43A231AA.9070708@paradise.net.nz> <43A23B3E.5050809@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.092 required=5 tests=[AWL=0.092] X-Spam-Score: 0.092 X-Spam-Level: X-Archive-Number: 200512/382 X-Sequence-Number: 16203 On 12/15/05, Craig A. James wrote: > > Yeah it would - an implementation I have seen that I like is where the > > developer can supply the *entire* execution plan with a query. This is > > complex enough to make casual use unlikely :-), but provides the abilit= y > > to try out other plans, and also fix that vital query that must run > > today..... > > So, to move on to the concrete... > > I'm not familiar with the innards of Postgres except in a theoretical way= . > Maybe this is a totally naive or dumb question, but I have to ask: How > hard would it be to essentially turn off the optimizer? > > 1. Evaluate WHERE clauses left-to-right. > > select ... from FOO where A and B and C; > > This would just apply the criteria left-to-right, first A, then B, then C= . > If an index was available it would use it, but only in left-to-right orde= r, > i.e. if A had no index but B did, then too bad, you should have written "= B > and A and C". > pg < 8.1 when you use multi-column indexes do exactly this... but i don't know why everyone wants this... > > 2. Evaluate joins left-to-right. > > select ... from FOO join BAR on (...) join BAZ on (...) where ... > > This would join FOO to BAR, then join the result to BAZ. The only > optimization would be to apply relevant "where" conditions to each join > before processing the next join. > using explicit INNER JOIN syntax and parenthesis > > 3. Don't flatten sub-selects > > select ... from (select ... from FOO where ...) as X where ...; > select ... from (select ... from FOO where ... offset 0) as X where ...; > This would do the inner select then use the result in the outer select, a= nd > wouldn't attempt to flatten the query. > > Thanks, > Craig > what else? -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Fri Dec 16 00:25:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 325319DCA35 for ; Fri, 16 Dec 2005 00:25:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76646-03 for ; Fri, 16 Dec 2005 00:25:26 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by postgresql.org (Postfix) with ESMTP id D95189DC84B for ; Fri, 16 Dec 2005 00:25:24 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so516618wri for ; Thu, 15 Dec 2005 20:25:24 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bw+52jNUur1FqplkfTQZyJ2ZXJptc3wZ7uvpDADPKg7cxUbGQYum6wIQ2JLxUDklMQFmaA+5d+zIJArgxtcLLv3Vt1MNW+6PD8B8zIkUy7f140dOuTfH1yWc7vSJ0pTWlbfqgaDYBDH1zdlXmjGB94/L4eDy+6QVeqcNHGhWY/I= Received: by 10.54.122.6 with SMTP id u6mr3250773wrc; Thu, 15 Dec 2005 20:25:24 -0800 (PST) Received: by 10.54.98.6 with HTTP; Thu, 15 Dec 2005 20:25:24 -0800 (PST) Message-ID: Date: Thu, 15 Dec 2005 23:25:24 -0500 From: Jaime Casanova To: David Lang Subject: Re: Overriding the optimizer Cc: "Craig A. James" , 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: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.092 required=5 tests=[AWL=0.092] X-Spam-Score: 0.092 X-Spam-Level: X-Archive-Number: 200512/383 X-Sequence-Number: 16204 On 12/15/05, David Lang wrote: > On Thu, 15 Dec 2005, Craig A. James wrote: > > > Mark Kirkwood wrote: > >> I hear what you are saying, but to use this fine example - I don't kno= w > >> what the best plan is - these experiments part of an investigation to > find > >> *if* there is a better plan, and if so, why Postgres is not finding it= . > >> > >>> There isn't a database in the world that is as smart as a developer, = or > >>> that can have insight into things that only a developer can possibly > know. > >> > >> That is often true - but the aim is to get Postgres's optimizer closer= to > >> developer smartness. > > > > What would be cool would be some way the developer could alter the plan= , > but > > they way of doing so would strongly encourage the developer to send the > > information to this mailing list. Postgres would essentially say, "Ok, > you > > can do that, but we want to know why!" > > at the risk of sounding flippent (which is NOT what I intend) I will poin= t > out that with the source you can change the optimizer any way you need to > :-) > > that being said, in your example the issue is the cost of the user create= d > function and the fact that postgres doesn't know it's cost. > > would a resonable answer be to give postgres a way to learn how expensive > the call is? > > a couple ways I could see to do this. > > 1. store some stats automagicly when the function is called and update th= e > optimization plan when you do an ANALYSE > > 2. provide a way for a user to explicitly set a cost factor for a functio= n > (with a default value that's sane for fairly trivial functions so that it > would only have to be set for unuseually expensive functions) > > now, neither of these will work all the time if a given function is > sometimes cheap and sometimes expensive (depending on it's parameters), > but in that case I would say that if the application knows that a functio= n > will be unusueally expensive under some conditions (and knows what those > conditions will be) it may be a reasonable answer to duplicate the > function, one copy that it uses most of the time, and a second copy that > it uses when it expects it to be expensive. at this point the cost of the > function can be set via either of the methods listed above) > > >> After years of using several other database products (some supporting > hint > >> type constructs and some not), I have come to believe that hinting (or > >> similar) actually *hinders* the development of a great optimizer. > > > > I agree. It takes the pressure off the optimizer gurus. If the users = can > > just work around every problem, then the optimizer can suck and the sys= tem > is > > still usable. > > > > Lest anyone think I'm an all-out advocate of overriding the optimizer, = I > know > > from first-hand experience what a catastrophe it can be. An Oracle hin= t I > > used worked fine on my test schema, but the customer's "table" turned o= ut > to > > be a view, and Oracle's optimizer worked well on the view whereas my hi= nt > was > > horrible. Unfortunately, without the hint, Oracle sucked when working = on > an > > ordinary table. Hints are dangerous, and I consider them a last resort= . > > I've been on the linux-kernel mailing list for the last 9 years, and have > seen a similar debate rage during that entire time about kernel memory > management. overall both of these tend to be conflicts between short-term > and long-term benifits. > > in the short-term the application user wants to be able to override the > system to get the best performance _now_ > > in the long run the system designers don't trust the application > programmers to get the hints right and want to figure out the right > optimizer plan, even if it takes a lot longer to do so. > > the key to this balance seems to be to work towards as few controls as > possible, becouse the user will get them wrong far more frequently then > they get them right, but when you hit a point where there's absolutly no > way for the system to figure things out (and it's a drastic difference) > provide the application with a way to hint to the system that things are > unusueal, but always keep looking for patterns that will let the system > detect the need itself > > even the existing defaults are wrong as frequently as they are right (the= y > were set when hardware was very different then it is today) so some way t= o > gather real-world stats and set the system defaults based on actual > hardware performance is really the right way to go (even for things like > sequential scan speed that are set in the config file today) > > David Lang > there was discussion on this and IIRC the consensus was that could be useful tu give some statistics to user defined functions... i don't if someone is working on this or even if it is doable... -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Fri Dec 16 01:08:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E262A9DCCEF for ; Fri, 16 Dec 2005 01:08:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99175-01 for ; Fri, 16 Dec 2005 01:08:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by postgresql.org (Postfix) with ESMTP id E875A9DCCDF for ; Fri, 16 Dec 2005 01:08:42 -0400 (AST) Received: from sysexperts.com (c-67-170-228-241.hsd1.ca.comcast.net[67.170.228.241]) by comcast.net (rwcrmhc13) with ESMTP id <20051216050838015004soe1e>; Fri, 16 Dec 2005 05:08:38 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Thu, 15 Dec 2005 21:08:33 -0800 id 1E02360A.43A24BD1.00000F2F Date: Thu, 15 Dec 2005 21:08:33 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051216050833.GA691@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> <43A2203B.2050102@familyhealth.com.au> <43A2251A.60907@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <43A2251A.60907@modgraph-usa.com> Organization: Frobozzco International User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/385 X-Sequence-Number: 16206 Craig A. James wrote: > > > Christopher Kings-Lynne wrote: > >>>> select * from my_table where row_num >= 50000 and row_num < > >>>>100000 > >>>> and myfunc(foo, bar); > >>> > >>> > >>>You just create an index on myfunc(foo, bar) > >> > >> > >>only if myfunc(foo, bar) is immutable... > > > > > >And if it's not then the best any database can do is to index scan > >row_num - so still you have no problem. > > Boy, you picked a *really* bad example ;-) > > The problem is that Postgres decided to filter on myfunc() *first*, and > then filter on row_num, resulting in a query time that jumped from seconds > to hours. And there's no way for me to tell Postgres not to do that! Apologies in advance if all of this has been said, or if any of it is wrong. What kind of plan do you get if you eliminate the myfunc(foo, bar) from the query entirely? An index scan or a full table scan? If the latter then (assuming that the statistics are accurate) the reason you want inclusion of myfunc() to change the plan must be the expense of the function, not the expense of the scan (index versus sequential). While the expense of the function isn't, as far as I know, known or used by the planner, that obviously needn't be the case. On the other hand, if the inclusion of the function call changes the plan that is selected from an index scan to a sequential scan, then that, I think, is clearly a bug, since even a zero-cost function cannot make the sequential scan more efficient than an index scan which is already more efficient than the base sequential scan. > So, "you still have no problem" is exactly wrong, because Postgres picked > the wrong plan. Postgres decided that applying myfunc() to 10,000,000 > rows was a better plan than an index scan of 50,000 row_nums. So I'm > screwed. If PostgreSQL is indeed applying myfunc() to 10,000,000 rows, then that is a bug if the function is declared VOLATILE (which is the default if no volatility is specified), because it implies that it's applying the function to rows that don't match the selection condition. From your prior description, it sounds like your function is declared STABLE. For your specific situation, my opinion is that the proper modification to PostgreSQL would be to give it (if it isn't already there) the ability to include the cost of functions in the plan. The cost needn't be something that it automatically measures -- it could be specified at function creation time. -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Fri Dec 16 01:20:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DA6FD9DC83E for ; Fri, 16 Dec 2005 01:20:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06084-02 for ; Fri, 16 Dec 2005 01:20:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by postgresql.org (Postfix) with ESMTP id B17089DC820 for ; Fri, 16 Dec 2005 01:20:26 -0400 (AST) Received: from sysexperts.com (c-67-170-228-241.hsd1.ca.comcast.net[67.170.228.241]) by comcast.net (rwcrmhc13) with ESMTP id <20051216052026015004ufe7e>; Fri, 16 Dec 2005 05:20:26 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Thu, 15 Dec 2005 21:20:25 -0800 id 18325A61.43A24E99.00001038 Date: Thu, 15 Dec 2005 21:20:25 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051216052025.GB691@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <43A22BE3.6020103@modgraph-usa.com> Organization: Frobozzco International User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/386 X-Sequence-Number: 16207 Craig A. James wrote: > Hints are dangerous, and I consider them a last resort. If you consider them a last resort, then why do you consider them to be a better alternative than a workaround such as turning off enable_seqscan, when all the other tradeoffs are considered? If your argument is that planner hints would give you finer grained control, then the question is whether you'd rather the developers spend their time implementing planner hints or improving the planner. I'd rather they did the latter, as long as workarounds are available when needed. A workaround will probably give the user greater incentive to report the problem than use of planner hints. -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Fri Dec 16 01:44:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DBBF79DC84C for ; Fri, 16 Dec 2005 01:44:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13460-10 for ; Fri, 16 Dec 2005 01:44:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id 3B6209DC84B for ; Fri, 16 Dec 2005 01:44:29 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBG5igP5026545 for ; Thu, 15 Dec 2005 21:44:42 -0800 Message-ID: <43A25372.8090706@modgraph-usa.com> Date: Thu, 15 Dec 2005 21:41:06 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 CC: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> In-Reply-To: <20051216052025.GB691@filer> 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, score=0.113 required=5 tests=[AWL=-0.076, MISSING_HEADERS=0.189] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200512/387 X-Sequence-Number: 16208 Kevin Brown wrote: >>Hints are dangerous, and I consider them a last resort. > > If you consider them a last resort, then why do you consider them to > be a better alternative than a workaround such as turning off > enable_seqscan, when all the other tradeoffs are considered? If I understand enable_seqscan, it's an all-or-nothing affair. Turning it off turns it off for the whole database, right? The same is true of all of the planner-tuning parameters in the postgres conf file. Since the optimizer does a good job most of the time, I'd hate to change a global setting like this -- what else would be affected? I could try this, but it would make me nervous to alter the whole system to fix one particular query. > If your argument is that planner hints would give you finer grained > control, then the question is whether you'd rather the developers > spend their time implementing planner hints or improving the planner. I agree 100% -- I'd much prefer a better planner. But when it comes down to a do-or-die situation, you need a hack, some sort of workaround, to get you working *today*. Regards, Craig From pgsql-performance-owner@postgresql.org Fri Dec 16 01:45:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B5B679DCC9D for ; Fri, 16 Dec 2005 01:45:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12899-09 for ; Fri, 16 Dec 2005 01:45:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by postgresql.org (Postfix) with ESMTP id ABE159DCCDF for ; Fri, 16 Dec 2005 01:45:07 -0400 (AST) Received: from sysexperts.com (c-67-170-228-241.hsd1.ca.comcast.net[67.170.228.241]) by comcast.net (rwcrmhc12) with ESMTP id <20051216054458014008icv0e>; Fri, 16 Dec 2005 05:45:03 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Thu, 15 Dec 2005 21:44:58 -0800 id 18325A61.43A2545A.000011F5 Date: Thu, 15 Dec 2005 21:44:58 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: How much expensive are row level statistics? Message-ID: <20051216054457.GC691@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> <2506.1134428461@sss.pgh.pa.us> <20051213010751.GA63416@winnie.fuhr.org> <1667.1134444045@sss.pgh.pa.us> <20051215234448.GA47382@winnie.fuhr.org> <18416.1134691599@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: <18416.1134691599@sss.pgh.pa.us> Organization: Frobozzco International User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/388 X-Sequence-Number: 16209 Tom Lane wrote: > Michael Fuhr writes: > > Does the backend support, or could it be easily modified to support, > > a mechanism that would post the command string after a configurable > > amount of time had expired, and then continue processing the query? > > Not really, unless you want to add the overhead of setting a timer > interrupt for every query. Which is sort of counterproductive when > the motivation is to reduce overhead ... > > (It might be more or less free if you have statement_timeout set, since > there would be a setitimer call anyway. But I don't think that's the > norm.) Actually, it's probably not necessary to set the timer at the beginning of every query. It's probably sufficient to just have it go off periodically, e.g. once every second, and thus set it when the timer goes off. And the running command wouldn't need to be re-posted if it's the same as last time around. Turn off the timer if the connection is idle now and was idle last time around (or not, if there's no harm in having the timer running all the time), turn it on again at the start of the next transaction. In essence, the backend would be "polling" itself every second or so and recording its state at that time, rather than on every transaction. Assuming that doing all that wouldn't screw something else up... -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Fri Dec 16 01:48:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E924E9DCC9D for ; Fri, 16 Dec 2005 01:48:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21472-02 for ; Fri, 16 Dec 2005 01:48:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.151]) by postgresql.org (Postfix) with ESMTP id 721359DC9D3 for ; Fri, 16 Dec 2005 01:48:56 -0400 (AST) Received: from sysexperts.com (c-67-170-228-241.hsd1.ca.comcast.net[67.170.228.241]) by comcast.net (rwcrmhc11) with ESMTP id <2005121605485601300c8opke>; Fri, 16 Dec 2005 05:48:56 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Thu, 15 Dec 2005 21:48:55 -0800 id 18325A61.43A25547.00001244 Date: Thu, 15 Dec 2005 21:48:55 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051216054855.GD691@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> <43A25372.8090706@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <43A25372.8090706@modgraph-usa.com> Organization: Frobozzco International User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/389 X-Sequence-Number: 16210 Craig A. James wrote: > Kevin Brown wrote: > >>Hints are dangerous, and I consider them a last resort. > > > >If you consider them a last resort, then why do you consider them to > >be a better alternative than a workaround such as turning off > >enable_seqscan, when all the other tradeoffs are considered? > > If I understand enable_seqscan, it's an all-or-nothing affair. Turning it > off turns it off for the whole database, right? The same is true of all > of the planner-tuning parameters in the postgres conf file. Nope. What's in the conf file are the defaults. You can change them on a per-connection basis, via the SET command. Thus, before doing your problematic query: SET enable_seqscan = off; and then, after your query is done, SET enable_seqscan = on; > >If your argument is that planner hints would give you finer grained > >control, then the question is whether you'd rather the developers > >spend their time implementing planner hints or improving the planner. > > I agree 100% -- I'd much prefer a better planner. But when it comes down > to a do-or-die situation, you need a hack, some sort of workaround, to get > you working *today*. And that's why I was asking about workarounds versus planner hints. I expect that the situations in which the planner gets things wrong *and* where there's no workaround are very rare indeed. -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Fri Dec 16 01:50:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1BB9A9DCCDF for ; Fri, 16 Dec 2005 01:50:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18878-06 for ; Fri, 16 Dec 2005 01:50:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 961229DCCEC for ; Fri, 16 Dec 2005 01:50:15 -0400 (AST) Received: (qmail 22807 invoked by uid 500); 16 Dec 2005 05:55:11 -0000 Date: Thu, 15 Dec 2005 23:55:11 -0600 From: Bruno Wolff III To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051216055511.GA18354@wolff.to> Mail-Followup-To: Bruno Wolff III , "Craig A. James" , pgsql-performance@postgresql.org References: <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> <43A25372.8090706@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43A25372.8090706@modgraph-usa.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.012 required=5 tests=[AWL=0.012] X-Spam-Score: 0.012 X-Spam-Level: X-Archive-Number: 200512/390 X-Sequence-Number: 16211 On Thu, Dec 15, 2005 at 21:41:06 -0800, "Craig A. James" wrote: > > If I understand enable_seqscan, it's an all-or-nothing affair. Turning it > off turns it off for the whole database, right? The same is true of all of You can turn it off just for specific queries. However, it will apply to all joins within a query. From pgsql-performance-owner@postgresql.org Fri Dec 16 09:22:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EB0C49DC849 for ; Fri, 16 Dec 2005 09:22:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16035-09 for ; Fri, 16 Dec 2005 09:22:39 -0400 (AST) X-Greylist: delayed 00:06:38.484639 by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by postgresql.org (Postfix) with ESMTP id D165A9DC807 for ; Fri, 16 Dec 2005 09:22:33 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so873144wri for ; Fri, 16 Dec 2005 05:22:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=gUabGgWu45/N7XVfM0O3lY/GW4RvCKWibYku3bw7BHdD3WO/75Bpm5ZG/HwjaFUB1thx+P1kCF+oqCrP4fQfDt9mXSUon+qbXmKry8XYBDJP4aMEE0sNQ2A24wo66CeEwux8Dl4dfeEC/lQGuM9Fw/zJzBiMfhuROv3r2ZxsgBo= Received: by 10.65.186.7 with SMTP id n7mr2061066qbp; Fri, 16 Dec 2005 05:15:58 -0800 (PST) Received: by 10.64.233.5 with HTTP; Fri, 16 Dec 2005 05:15:58 -0800 (PST) Message-ID: Date: Fri, 16 Dec 2005 14:15:58 +0100 From: Moritz Bayer To: pgsql-performance@postgresql.org Subject: Crashing DB or Server? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5127_8563544.1134738958471" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.643 required=5 tests=[HTML_00_10=0.642, HTML_MESSAGE=0.001] X-Spam-Score: 0.643 X-Spam-Level: X-Archive-Number: 200512/392 X-Sequence-Number: 16213 ------=_Part_5127_8563544.1134738958471 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello group, I've got a really bad problem with my postgres DB and server. It is a linux machine with 1GB of RAM and 2 CPUs. The postgres Version is 7.4. The problem is, that once the postmaster has started, the System is just about useless. At least querys to the db are so slow, that it most often runs into timeouts. First I thought something was wrong with my querys or I forgot to close the connections. But this isn't the case, I cut all the connections to the server so that there are no incoming requests. Still, once I start the postmaster and look into the statistics of the top-command= , the IOWAIT parameter of all CPUs are at about 100%. This is really weird, just a few hours ago the machine run very smooth serving the data for a big portal. Has anybody an idea what might have happened here? I need a quick solution, since I'm talking about an live server that should be running 24 hours a day. Thanks in advance, Moritz PS: I'm not a administrator so I don't know if I have wrote down all the relevant data. If not, please ask for it and give me a hint how to get them ------=_Part_5127_8563544.1134738958471 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello group,

I've got a really bad problem with my postgres DB and server.
It is a linux machine with 1GB of RAM and 2 CPUs.
The postgres Version is 7.4.

The problem is, that once the postmaster has started, the System is just about useless. At least querys to the db are so slow, that it most often runs into timeouts. First I thought something was wrong with my querys or I forgot to close the connections. But this isn't the case, I cut all the connections to the server so that there are no incoming requests. Still, once I start the postmaster and look into the statistics of the top-command, the IOWAIT parameter of all CPUs are at about 100%.

This is really weird, just a few hours ago the machine run very smooth serv= ing the data for a big portal.

Has anybody an idea what might have happened here?
I need a quick solution, since I'm talking about an live server that should= be running 24 hours a day.

Thanks in advance,
Moritz

PS: I'm not a administrator so I don't know if I have wrote down all the relevant data. If not, please ask for it and give me a hint how to get them


------=_Part_5127_8563544.1134738958471-- From pgsql-performance-owner@postgresql.org Fri Dec 16 09:17:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2BBD49DCA06 for ; Fri, 16 Dec 2005 09:17:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16922-04 for ; Fri, 16 Dec 2005 09:17:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 225D39DC807 for ; Fri, 16 Dec 2005 09:17:25 -0400 (AST) Received: from [192.168.0.2] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id D109B269EC8; Fri, 16 Dec 2005 13:17:23 +0000 (GMT) Subject: Re: How much expensive are row level statistics? From: Simon Riggs To: Tom Lane Cc: Michael Fuhr , Merlin Moncure , pgsql-performance@postgresql.org, Carlos Benkendorf In-Reply-To: <18416.1134691599@sss.pgh.pa.us> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> <2506.1134428461@sss.pgh.pa.us> <20051213010751.GA63416@winnie.fuhr.org> <1667.1134444045@sss.pgh.pa.us> <20051215234448.GA47382@winnie.fuhr.org> <18416.1134691599@sss.pgh.pa.us> Content-Type: text/plain Date: Fri, 16 Dec 2005 13:17:25 +0000 Message-Id: <1134739045.2964.15.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/391 X-Sequence-Number: 16212 On Thu, 2005-12-15 at 19:06 -0500, Tom Lane wrote: > Michael Fuhr writes: > > Does the backend support, or could it be easily modified to support, > > a mechanism that would post the command string after a configurable > > amount of time had expired, and then continue processing the query? > > Not really, unless you want to add the overhead of setting a timer > interrupt for every query. Which is sort of counterproductive when > the motivation is to reduce overhead ... > > (It might be more or less free if you have statement_timeout set, since > there would be a setitimer call anyway. But I don't think that's the > norm.) We could do the deferred send fairly easily. You need only set a timer when stats_command_string = on, so we'd only do that when requested by the admin. Overall, that would be a cheaper way of doing it than now. However, I'm more inclined to the idea of a set of functions that allow an administrator to retrieve the full SQL text executing in a backend, with an option to return an EXPLAIN of the currently executing plan. Right now, stats only gives you the first 1000 chars, so you're always stuck if its a big query. Plus we don't yet have a way of getting the exact EXPLAIN of a running query (you can get close, but it could differ). Pull is better than push. Asking specific backends what they're doing when you need to know will be efficient; asking them to send their command strings, all of the time, deferred or not will always be more wasteful. Plus if you forgot to turn on stats_command_string before execution, then you've no way of knowing anyhow. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Fri Dec 16 09:38:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B087F9DCC10 for ; Fri, 16 Dec 2005 09:38:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22041-04 for ; Fri, 16 Dec 2005 09:38:33 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.200]) by postgresql.org (Postfix) with ESMTP id 2E8579DCBBD for ; Fri, 16 Dec 2005 09:38:26 -0400 (AST) Received: by nproxy.gmail.com with SMTP id o63so248462nfa for ; Fri, 16 Dec 2005 05:38:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CH06uw5m04NoqciMLwpnSe//WTYnohDyTgZB1ilSUV1D7GDcfLQkJGW0z+f0Yh0jKgM7AxOBfmXVQq1wkK4adSOk+CSLGgAVfA7mlnYWeKe+Figfybjt/aSE0D4WrWScEtoSRsMBhFVt57k010/eXs/jTYbuBvXw1k1kLfyqIHs= Received: by 10.48.225.15 with SMTP id x15mr11945nfg; Fri, 16 Dec 2005 05:38:24 -0800 (PST) Received: by 10.48.164.6 with HTTP; Fri, 16 Dec 2005 05:38:24 -0800 (PST) Message-ID: <45b42ce40512160538n7b77a2aexe9d13616f6c25a69@mail.gmail.com> Date: Fri, 16 Dec 2005 13:38:24 +0000 From: Harry Jackson To: pgsql-performance@postgresql.org Subject: Re: Crashing DB or Server? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/393 X-Sequence-Number: 16214 T24gMTIvMTYvMDUsIE1vcml0eiBCYXllciA8bW9yaXR6LmJheWVyQGdvb2dsZW1haWwuY29tPiB3 cm90ZToKPiAgVGhpcyBpcyByZWFsbHkgd2VpcmQsIGp1c3QgYSBmZXcgaG91cnMgYWdvIHRoZSBt YWNoaW5lIHJ1biB2ZXJ5IHNtb290aAo+IHNlcnZpbmcgdGhlIGRhdGEgZm9yIGEgYmlnIHBvcnRh bC4KCkNhbiB5b3UgbG9nIHRoZSBzdGF0ZW1lbnRzIHRoYXQgYXJlIHRha2luZyBhIGxvbmcgdGlt ZSBhbmQgcG9zdCB0aGVtCnRvIHRoZSBsaXN0IHdpdGggdGhlIHRhYmxlIHN0cnVjdHVyZXMgYW5k IGluZGV4ZXMgZm9yIHRoZSB0YWJsZXMgYmVpbmcKdXNlZC4KClRvIGRvIHRoaXMgdHVybiBvbiBs b2dnaW5nIGZvciBzdGF0ZW1lbnRzIHRha2luZyBhIGxvbmcgdGltZSwgZWRpdApwb3N0Z3Jlc3Fs LmNvbmYgZmlsZSBhbmQgY2hhbmdlIHRoZSBmb2xsb3dpbmcgdHdvIHBhcmFtZXRlcnMuCgpsb2df bWluX2R1cmF0aW9uX3N0YXRlbWVudCA9IDIwMDAgIyAyIHNlY29uZHMKCllvdXIgbG9nIHNob3Vs ZCBub3cgYmUgY2F0Y2hpbmcgdGhlIHN0YXRlbWVudHMgdGhhdCBhcmUgc2xvdy4gVGhlbiB1c2UK dGhlIHN0YXRlbWVudHMgdG8gZ2V0IHRoZSBleHBsYWluIHBsYW4gaWUKCmRibmFtcj0jIGV4cGxh aW4gW3NxbCB0aGF0cyB0YWtpbmcgYSBsb25nIHRpbWVdCgpXZSB3b3VsZCBhbHNvIG5lZWQgdG8g c2VlIHRoZSB0YWJsZSBzdHJ1Y3R1cmVzLgoKZGJuYW1lPSMgXGQgW3RhYmxlIG5hbWUgb2YgZWFj aCB0YWJsZSBpbiBhYm92ZSBleHBsYWluIHBsYW5dCgo+ICBIYXMgYW55Ym9keSBhbiBpZGVhIHdo YXQgbWlnaHQgaGF2ZSBoYXBwZW5lZCBoZXJlPwo+ICBJIG5lZWQgYSBxdWljayBzb2x1dGlvbiwg c2luY2UgSSdtIHRhbGtpbmcgYWJvdXQgYW4gbGl2ZSBzZXJ2ZXIgdGhhdCBzaG91bGQKPiBiZSBy dW5uaW5nIDI0IGhvdXJzIGEgZGF5LgoKSXQgbWF5IGJlIHRoYXQgdGhlIHBsYW5uZXIgaGFzIHN0 YXJ0ZWQgdG8gcGljayBhIGJhZCBwbGFuLiBUaGlzIGNhbgpoYXBwZW4gaWYgdGhlIGRhdGFiYXNl IGlzIHJlZ3VsYXJseSBjaGFuZ2luZyBhbmQgdGhlIHN0YXRzIGFyZSBub3QgdXAKdG8gZGF0ZS4g SSBiZWxpZXZlIGl0IGNhbiBoYXBwZW4gZXZlbiBpZiB0aGUgc3RhdHMgYXJlIHVwIHRvIGRhdGUg YnV0CmlzIG11Y2ggbGVzcyBsaWtlbHkgdG8gZG8gc28uCgpJdCBtaWdodCBhbHNvIGJlIGFuIGlk ZWEgdG8gdmFjdXVtIHRoZSBkYXRhYmFzZS4KCmRibmFtZT0jIFZBQ1VVTSBBTkFMWVpFOwoKVGhp cyB3aWxsIGxvYWQgdGhlIHNlcnZlciB1cCBmb3IgYSB3aGlsZSB0aG91Z2guCgotLQpodHRwOi8v d3d3LmhqYWNrc29uLm9yZwpodHRwOi8vd3d3LnVrbHVnLmNvLnVrCg== From pgsql-performance-owner@postgresql.org Fri Dec 16 10:17:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9A4029DC84C for ; Fri, 16 Dec 2005 10:17:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31712-05 for ; Fri, 16 Dec 2005 10:17:11 -0400 (AST) X-Greylist: delayed 00:06:17.104624 by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) by postgresql.org (Postfix) with ESMTP id D8CE19DCB7A for ; Fri, 16 Dec 2005 10:17:04 -0400 (AST) Received: by zproxy.gmail.com with SMTP id i11so695922nzi for ; Fri, 16 Dec 2005 06:17:09 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=O1S52Gvg3RsmYXia1d/tfakWFH1CR9A/JIImgIBH1PpHCDaAT51bRzjynL8nn1nsNbBA6HZ7FrQAcPRvrXN/r4t1HAoOmbhOZvayXYzedJr3JQfhtj2qaSg7LZG12gLBS59wuTNggIylakKuzcsA6w9QHaxpodwP2CHweixG51s= Received: by 10.64.242.14 with SMTP id p14mr1321900qbh; Fri, 16 Dec 2005 06:10:51 -0800 (PST) Received: by 10.64.233.5 with HTTP; Fri, 16 Dec 2005 06:10:51 -0800 (PST) Message-ID: Date: Fri, 16 Dec 2005 15:10:51 +0100 From: Moritz Bayer To: Harry Jackson Subject: Re: Crashing DB or Server? Cc: pgsql-performance@postgresql.org In-Reply-To: <45b42ce40512160538n7b77a2aexe9d13616f6c25a69@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5805_29498591.1134742251334" References: <45b42ce40512160538n7b77a2aexe9d13616f6c25a69@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.442 required=5 tests=[AWL=0.441, HTML_MESSAGE=0.001, UPPERCASE_25_50=0] X-Spam-Score: 0.442 X-Spam-Level: X-Archive-Number: 200512/394 X-Sequence-Number: 16215 ------=_Part_5805_29498591.1134742251334 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, actually every SELECT statements takes a couple of minutes. For example SELECT * FROM pg_stat_activity already takes 260 sec. And the IOWAIT value increases just after starting the postmaster, no querys are processed. I started vacuumizing the tables of the DB. Still, it doesn't make a difference. So I don't know if the structure of the tables are relevant. For example, I have got about 30 of those: CREATE TABLE "public"."tbl_highscore_app4" ( "id" BIGSERIAL, "userid" INTEGER NOT NULL, "score" INTEGER DEFAULT 0 NOT NULL, "occured" DATE DEFAULT now() NOT NULL, CONSTRAINT "tbl_highscore_app4_pkey" PRIMARY KEY("userid") ) WITHOUT OIDS; the select-statements are done through functions, for example CREATE OR REPLACE FUNCTION "public"."getownrankingapp4" (integer, integer) RETURNS integer AS' DECLARE i_userid INTEGER; DECLARE i_score INTEGER; DECLARE i_rank INTEGER; begin i_userid :=3D $1; i_score :=3D $2; i_rank :=3D 1; if i_score <=3D 0 then SELECT INTO i_rank max(id) FROM tbl_highscore_app4_tmp; if i_rank IS null then i_rank =3D 1; else i_rank =3D i_rank +1; end if; else SELECT INTO i_rank max(id) FROM tbl_highscore_app4_tmp WHERE score>=3Di_score; if i_rank IS null then i_rank =3D 1; end if; end if= ; return (i_rank); END 'LANGUAGE 'plpgsql' VOLATILE RETURNS NULL ON NULL INPUT SECURITY INVOKER; The tmp table looks like this (and is filled once a night with the current data): CREATE TABLE "public"."tbl_highscore_app4_tmp" ( "id" INTEGER NOT NULL, "userid" INTEGER NOT NULL, "score" INTEGER NOT NULL ) WITH OIDS; CREATE INDEX "tbl_highscore_app4_tmp_index" ON "public"."tbl_highscore_app4_tmp" USING btree ("score"); ------=_Part_5805_29498591.1134742251334 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,

actually every SELECT statements takes a couple of minutes.
For example
SELECT * FROM pg_stat_activity already takes 260 sec.

And the IOWAIT value increases just after  starting the postmaster, no= querys are processed.

I started vacuumizing the tables of the DB.  Still, it doesn't make a = difference.

So I don't know if the structure of the tables are relevant.
For example, I have got about 30 of those:

CREATE TABLE "public"."tbl_highscore_app4" (
  "id" BIGSERIAL,
  "userid" INTEGER NOT NULL,
  "score" INTEGER DEFAULT 0 NOT NULL,
  "occured" DATE DEFAULT now() NOT NULL,
  CONSTRAINT "tbl_highscore_app4_pkey" PRIMARY KEY("use= rid")
) WITHOUT OIDS;

the select-statements are done through functions, for example

CREATE OR REPLACE FUNCTION "public"."getownrankingapp4"= (integer, integer) RETURNS integer AS'
DECLARE i_userid INTEGER;
DECLARE i_score INTEGER; 
DECLARE i_rank INTEGER; 
begin 
i_userid :=3D $1; 
i_score :=3D $2; 
i_rank :=3D 1; 
 if i_score <=3D 0 then 
            &nb= sp; SELECT INTO i_rank max(id) FROM   tbl_highscore_app4_tmp; 
             if= i_rank IS null then   
            &nb= sp;     i_rank =3D 1; 
             el= se   
            &nb= sp;     i_rank =3D i_rank +1; 
            end if;&= nbsp;
 else 
        SELECT INTO i_rank max(id) FROM tbl_highscore_app4_tmp WHERE score>=3Di_score;  if i_rank IS null then    i_rank =3D 1;  end if;  end if; 
return (i_rank); 
END
'LANGUAGE 'plpgsql' VOLATILE RETURNS NULL ON NULL INPUT SECURITY INVOKER;

The tmp table looks like this (and is filled once a night with the current = data):

CREATE TABLE "public"."tbl_highscore_app4_tmp" (
  "id" INTEGER NOT NULL,
  "userid" INTEGER NOT NULL,
  "score" INTEGER NOT NULL
) WITH OIDS;

CREATE INDEX "tbl_highscore_app4_tmp_index" ON "public"= ."tbl_highscore_app4_tmp"
USING btree ("score");




------=_Part_5805_29498591.1134742251334-- From pgsql-performance-owner@postgresql.org Fri Dec 16 10:18:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0DCC79DCD00 for ; Fri, 16 Dec 2005 10:18:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36280-01 for ; Fri, 16 Dec 2005 10:18:36 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 7F3D69DCCC6 for ; Fri, 16 Dec 2005 10:18:30 -0400 (AST) Received: from pilfer.dreamhost.com (pilfer.dreamhost.com [66.33.217.5]) by svr4.postgresql.org (Postfix) with ESMTP id 52E505AF186 for ; Fri, 16 Dec 2005 14:18:35 +0000 (GMT) Received: from [127.0.0.1] (shemp.dreamhost.com [66.33.213.12]) by pilfer.dreamhost.com (Postfix) with ESMTP id CA897109EAD for ; Fri, 16 Dec 2005 06:18:30 -0800 (PST) Message-ID: <43A2CCEF.9030605@kylecordes.com> Date: Fri, 16 Dec 2005 08:19:27 -0600 From: Kyle Cordes User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> In-Reply-To: <20051216052025.GB691@filer> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/395 X-Sequence-Number: 16216 Kevin Brown wrote: >Craig A. James wrote: > > >>Hints are dangerous, and I consider them a last resort. >> >> > >If you consider them a last resort, then why do you consider them to >be a better alternative than a workaround such as turning off >enable_seqscan, when all the other tradeoffs are considered? > > I would like a bit finer degree of control on this - I'd like to be able to tell PG that for my needs, it is never OK to scan an entire table of more than N rows. I'd typically set N to 1,000,000 or so. What I would really like is for my DBMS to give me a little more pushback - I'd like to ask it to run a query, and have it either find a "good" way to run the query, or politely refuse to run it at all. Yes, I know that is an unusual request :-) The context is this - in a busy OLTP system, sometimes a query comes through that, for whatever reason (foolishness on my part as a developer, unexpected use by a user, imperfection of the optimizer, etc.), takes a really long time to run, usually because it table-scans one or more large tables. If several of these happen at once, it can grind an important production system effectively to a halt. I'd like to have a few users/operations get a "sorry, I couldn't find a good way to do that" message, rather than all the users find that their system has effectively stopped working. Kyle Cordes www.kylecordes.com From pgsql-performance-owner@postgresql.org Fri Dec 16 10:25:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 85FE89DC81A for ; Fri, 16 Dec 2005 10:25:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31748-09 for ; Fri, 16 Dec 2005 10:25:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 68F449DCD09 for ; Fri, 16 Dec 2005 10:25:44 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id ABDCD31581; Fri, 16 Dec 2005 15:25:48 +0100 (MET) From: "PostgreSQL" X-Newsgroups: pgsql.performance Subject: ALTER TABLE SET TABLESPACE and pg_toast Date: Fri, 16 Dec 2005 08:25:41 -0600 Organization: Hub.Org Networking Services Lines: 16 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/396 X-Sequence-Number: 16217 We're storing tif images in a table as bytea. We were running low on our primary space and moved several tables, including the one with the images, to a second tablespace using ALTER TABLE SET TABLESPACE. This moved quite cleaned out quite a bit of space on the original tablespace, but not as much as it should have. It does not appear that the corresponding pg_toast tables were moved. So, my questions are: 1) Is there a way to move pg_toast tables to new tablespaces (or at least assure that new ones are created there)? 2) Also, is there a good way to determine which pg_toast tables are associated with any particular table and column? Thank you for your help, Martin From pgsql-performance-owner@postgresql.org Fri Dec 16 10:33:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 989AB9DCD5D for ; Fri, 16 Dec 2005 10:33:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32029-10 for ; Fri, 16 Dec 2005 10:33:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail3.ecircle.de (mail3.ecircle.de [195.140.186.206]) by postgresql.org (Postfix) with ESMTP id 469E89DCCC6 for ; Fri, 16 Dec 2005 10:33:46 -0400 (AST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by mail3.ecircle.de (READY) with ESMTP id 711FE11C410; Fri, 16 Dec 2005 15:33:49 +0100 (CET) Received: from [192.168.1.110] ([192.168.1.110]) by deimos.muc.ecircle.de with Microsoft SMTPSVC(5.0.2195.6713); Fri, 16 Dec 2005 15:32:46 +0100 Subject: Re: Crashing DB or Server? From: Csaba Nagy To: Moritz Bayer Cc: Harry Jackson , postgres performance list In-Reply-To: References: <45b42ce40512160538n7b77a2aexe9d13616f6c25a69@mail.gmail.com> Content-Type: text/plain Message-Id: <1134743566.14216.47.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 16 Dec 2005 15:32:47 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Dec 2005 14:32:46.0966 (UTC) FILETIME=[95722160:01C6024D] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/397 X-Sequence-Number: 16218 Moritz, Is it possible that you use lots of temporary tables, and you don't vacuum the system tables ? That would cause such symptoms I guess... Try to make a "vacuum analyze" connected as the postgres super user, that will vacuum all your system tables too. Note that if you have a really big bloat, a simple vacuum might not help, so you might need to do "vacuum full analyze", and possibly reindex on some tables - I'm not an expert on this, so others might have better advice. Cheers, Csaba. On Fri, 2005-12-16 at 15:10, Moritz Bayer wrote: > Hi, > > actually every SELECT statements takes a couple of minutes. > For example > SELECT * FROM pg_stat_activity already takes 260 sec. > > And the IOWAIT value increases just after starting the postmaster, no > querys are processed. > > I started vacuumizing the tables of the DB. Still, it doesn't make a > difference. > > So I don't know if the structure of the tables are relevant. > For example, I have got about 30 of those: > > CREATE TABLE "public"."tbl_highscore_app4" ( > "id" BIGSERIAL, > "userid" INTEGER NOT NULL, > "score" INTEGER DEFAULT 0 NOT NULL, > "occured" DATE DEFAULT now() NOT NULL, > CONSTRAINT "tbl_highscore_app4_pkey" PRIMARY KEY("userid") > ) WITHOUT OIDS; > > the select-statements are done through functions, for example > > CREATE OR REPLACE FUNCTION "public"."getownrankingapp4" (integer, > integer) RETURNS integer AS' > DECLARE i_userid INTEGER; > DECLARE i_score INTEGER; > DECLARE i_rank INTEGER; > begin > i_userid := $1; > i_score := $2; > i_rank := 1; > if i_score <= 0 then > SELECT INTO i_rank max(id) FROM > tbl_highscore_app4_tmp; > if i_rank IS null then > i_rank = 1; > else > i_rank = i_rank +1; > end if; > else > SELECT INTO i_rank max(id) FROM tbl_highscore_app4_tmp WHERE > score>=i_score; if i_rank IS null then i_rank = 1; end if; end > if; > return (i_rank); > END > 'LANGUAGE 'plpgsql' VOLATILE RETURNS NULL ON NULL INPUT SECURITY > INVOKER; > > > The tmp table looks like this (and is filled once a night with the > current data): > > CREATE TABLE "public"."tbl_highscore_app4_tmp" ( > "id" INTEGER NOT NULL, > "userid" INTEGER NOT NULL, > "score" INTEGER NOT NULL > ) WITH OIDS; > > CREATE INDEX "tbl_highscore_app4_tmp_index" ON > "public"."tbl_highscore_app4_tmp" > USING btree ("score"); > > > > From pgsql-performance-owner@postgresql.org Fri Dec 16 10:40:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A65D79DC84C for ; Fri, 16 Dec 2005 10:40:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41668-01 for ; Fri, 16 Dec 2005 10:40:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 4A5CE9DC81A for ; Fri, 16 Dec 2005 10:40:36 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: How much expensive are row level statistics? Date: Fri, 16 Dec 2005 09:40:39 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DDB39@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] How much expensive are row level statistics? Thread-Index: AcX/gajfaxsw4B5hQ420xf/1JcpQRgCy+O6A From: "Merlin Moncure" To: "Michael Fuhr" Cc: "Tom Lane" , , "Carlos Benkendorf" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/398 X-Sequence-Number: 16219 > Now there goes Tom with his skeptical eye again, and here comes me > saying "oops" again. Further tests show that for this application I made the same mistake, fwiw. The big hit comes with command_string. However, row level stats bring a big enough penalty (~10% on my usage) that I keep them turned off. The penalty is not just run time either, but increased cpu time. It just isn't an essential feature so unless it causes near zero extra load it will stay off on my servers. Additionally, back when I was testing the win32/pg platform I was getting random restarts of the stats collector when the server was under high load and row_level stats were on. This was a while back so this issue may or may not be resolved...it was really nasty because it cleared out pg_stats_activity which in turn ruined my admin tools. I should probably give that another look. Merlin From pgsql-performance-owner@postgresql.org Fri Dec 16 10:45:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4C1399DC84C for ; Fri, 16 Dec 2005 10:45:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38149-09 for ; Fri, 16 Dec 2005 10:45:36 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by postgresql.org (Postfix) with ESMTP id 607CA9DC81A for ; Fri, 16 Dec 2005 10:45:30 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so598091wri for ; Fri, 16 Dec 2005 06:45:35 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bf/+VQSU2JspQ/khSjk5tnFAMVqbHoPHlaxgdFhnB7pzbFl9cNtIjaKkpxKj6OG1EnFIIxdT9zDJx2d7alDDLWiF8tgrHkZQW7Tt4I7zK6TYb8OdyB3QrhxR2MN9xD3s9KqmE8SiObngKrBLRiCjJfJgXGORuyHXBqVYjNgeetw= Received: by 10.54.122.19 with SMTP id u19mr3713594wrc; Fri, 16 Dec 2005 06:45:35 -0800 (PST) Received: by 10.54.98.6 with HTTP; Fri, 16 Dec 2005 06:45:34 -0800 (PST) Message-ID: Date: Fri, 16 Dec 2005 09:45:34 -0500 From: Jaime Casanova To: Kyle Cordes Subject: Re: Overriding the optimizer Cc: pgsql-performance@postgresql.org In-Reply-To: <43A2CCEF.9030605@kylecordes.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512141603.52583.blargity@gmail.com> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> <43A2CCEF.9030605@kylecordes.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.09 required=5 tests=[AWL=0.090] X-Spam-Score: 0.09 X-Spam-Level: X-Archive-Number: 200512/399 X-Sequence-Number: 16220 On 12/16/05, Kyle Cordes wrote: > Kevin Brown wrote: > > >Craig A. James wrote: > > > > > >>Hints are dangerous, and I consider them a last resort. > >> > >> > > > >If you consider them a last resort, then why do you consider them to > >be a better alternative than a workaround such as turning off > >enable_seqscan, when all the other tradeoffs are considered? > > > > > > I would like a bit finer degree of control on this - I'd like to be able > to tell PG that for my needs, it is never OK to scan an entire table of > more than N rows. I'd typically set N to 1,000,000 or so. What I would > really like is for my DBMS to give me a little more pushback - I'd like > to ask it to run a query, and have it either find a "good" way to run > the query, or politely refuse to run it at all. > > Yes, I know that is an unusual request :-) > > The context is this - in a busy OLTP system, sometimes a query comes > through that, for whatever reason (foolishness on my part as a > developer, unexpected use by a user, imperfection of the optimizer, > etc.), takes a really long time to run, usually because it table-scans > one or more large tables. If several of these happen at once, it can > grind an important production system effectively to a halt. I'd like to > have a few users/operations get a "sorry, I couldn't find a good way to > do that" message, rather than all the users find that their system has > effectively stopped working. > > Kyle Cordes > www.kylecordes.com > > set statement_timeout in postgresql.conf -- Atentamente, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Fri Dec 16 10:54:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1EAE69DCD79 for ; Fri, 16 Dec 2005 10:54:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41017-06 for ; Fri, 16 Dec 2005 10:54:05 -0400 (AST) X-Greylist: delayed 00:06:42.305935 by SQLgrey- Received: from v00051.home.net.pl (post.pl [212.85.96.51]) by postgresql.org (Postfix) with SMTP id 201D69DCD5D for ; Fri, 16 Dec 2005 10:53:58 -0400 (AST) Received: from localhost (HELO ?10.16.0.65?) (bogomips.post@home@127.0.0.1) by matrix01b.home.net.pl with SMTP; Fri, 16 Dec 2005 14:47:18 -0000 Subject: Re: Overriding the optimizer From: Tomasz Rybak To: pgsql-performance@postgresql.org In-Reply-To: <43A231AA.9070708@paradise.net.nz> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <43A231AA.9070708@paradise.net.nz> Content-Type: text/plain; charset=ISO-8859-2 Date: Fri, 16 Dec 2005 15:47:19 +0100 Message-Id: <1134744439.5124.7.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/400 X-Sequence-Number: 16221 Dnia 16-12-2005, pi� o godzinie 16:16 +1300, Mark Kirkwood napisa�(a): > Craig A. James wrote: > > > > > What would be cool would be some way the developer could alter the plan, > > but they way of doing so would strongly encourage the developer to send > > the information to this mailing list. Postgres would essentially say, > > "Ok, you can do that, but we want to know why!" > > > > Yeah it would - an implementation I have seen that I like is where the > developer can supply the *entire* execution plan with a query. This is > complex enough to make casual use unlikely :-), but provides the ability > to try out other plans, and also fix that vital query that must run > today..... I think you could use SPI for that. There is function SPI_prepare, which prepares plan, and SPI_execute_plan, executing it. These functions are defined in src/backend/executor/spi.c. I think (someone please correct me if I'm wrong) you could prepare plan yourself, instead of taking it from SPI_prepare, and give it to SPI_execute_plan. SPI_prepare calls _SPI_prepare_plan, which parses query and calls pg_analyze_and_rewrite. In your version don't call this function, but provide PostgreSQL with your own plan (not-optimised according to PostrgeSQL, but meeting your criteria). -- Tomasz Rybak From pgsql-performance-owner@postgresql.org Fri Dec 16 11:23:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BECB79DCD43 for ; Fri, 16 Dec 2005 11:23:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54032-06 for ; Fri, 16 Dec 2005 11:23:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 07B589DCBA1 for ; Fri, 16 Dec 2005 11:23:16 -0400 (AST) 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 jBGFNLOV026245; Fri, 16 Dec 2005 10:23:21 -0500 (EST) To: "PostgreSQL" cc: pgsql-performance@postgresql.org Subject: Re: ALTER TABLE SET TABLESPACE and pg_toast In-reply-to: References: Comments: In-reply-to "PostgreSQL" message dated "Fri, 16 Dec 2005 08:25:41 -0600" Date: Fri, 16 Dec 2005 10:23:21 -0500 Message-ID: <26244.1134746601@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/401 X-Sequence-Number: 16222 "PostgreSQL" writes: > We're storing tif images in a table as bytea. We were running low on our > primary space and moved several tables, including the one with the images, > to a second tablespace using ALTER TABLE SET TABLESPACE. > This moved quite cleaned out quite a bit of space on the original > tablespace, but not as much as it should have. It does not appear that the > corresponding pg_toast tables were moved. I think you're mistaken; at least, the SET TABLESPACE code certainly intends to move a table's toast table and index along with the table. What's your evidence for saying it didn't happen, and which PG version are you using exactly? > 2) Also, is there a good way to determine which pg_toast tables are > associated with any particular table and column? pg_class.reltoastrelid and reltoastidxid. See http://www.postgresql.org/docs/8.1/static/storage.html http://www.postgresql.org/docs/8.1/static/catalog-pg-class.html regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 16 12:52:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 279619DC81A for ; Fri, 16 Dec 2005 12:52:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68457-06 for ; Fri, 16 Dec 2005 12:52:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by postgresql.org (Postfix) with ESMTP id CE92B9DC84E for ; Fri, 16 Dec 2005 12:52:47 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jBGGr1O8030692; Fri, 16 Dec 2005 08:53:01 -0800 Message-ID: <43A2F011.9050809@modgraph-usa.com> Date: Fri, 16 Dec 2005 08:49:21 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jaime Casanova , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> <43A2CCEF.9030605@kylecordes.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, score=0.026 required=5 tests=[AWL=0.026] X-Spam-Score: 0.026 X-Spam-Level: X-Archive-Number: 200512/402 X-Sequence-Number: 16223 Jaime Casanova wrote: >>The context is this - in a busy OLTP system, sometimes a query comes >>through that, for whatever reason (foolishness on my part as a >>developer, unexpected use by a user, imperfection of the optimizer, >>etc.), takes a really long time to run, usually because it table-scans >>one or more large tables. If several of these happen at once, it can >>grind an important production system effectively to a halt. I'd like to >>have a few users/operations get a "sorry, I couldn't find a good way to >>do that" message, rather than all the users find that their system has >>effectively stopped working. > ... > set statement_timeout in postgresql.conf I found it's better to use "set statement_timeout" in the code, rather than setting it globally. Someone else pointed out to me that setting it in postgresql.conf makes it apply to ALL transactions, including VACUUM, ANALYZE and so forth. I put it in my code just around the queries that are "user generated" -- queries that are from users' input. I expect any SQL that I write to finish in a reasonable time ;-). Craig From pgsql-performance-owner@postgresql.org Fri Dec 16 15:14:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0985D9DCD9E for ; Fri, 16 Dec 2005 15:14:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09310-03 for ; Fri, 16 Dec 2005 15:14:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail5.dslextreme.com (mail5.dslextreme.com [66.51.199.81]) by postgresql.org (Postfix) with SMTP id 877C29DCDA1 for ; Fri, 16 Dec 2005 15:13:58 -0400 (AST) Received: (qmail 2137 invoked from network); 16 Dec 2005 19:13:06 -0000 Received: from unknown (HELO [10.1.1.1]) (mitchskin@66.245.216.230) by mail5.dslextreme.com with SMTP; Fri, 16 Dec 2005 11:13:06 -0800 Subject: Re: Overriding the optimizer From: Mitch Skinner To: pgsql-performance@postgresql.org In-Reply-To: <43A2251A.60907@modgraph-usa.com> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A21D74.8030002@familyhealth.com.au> <43A2203B.2050102@familyhealth.com.au> <43A2251A.60907@modgraph-usa.com> Content-Type: text/plain Date: Fri, 16 Dec 2005 11:13:31 -0800 Message-Id: <1134760411.3208.17.camel@firebolt> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/403 X-Sequence-Number: 16224 On Thu, 2005-12-15 at 18:23 -0800, Craig A. James wrote: > So, "you still have no problem" is exactly wrong, because Postgres picked the wrong plan. Postgres decided that applying myfunc() to 10,000,000 rows was a better plan than an index scan of 50,000 row_nums. So I'm screwed. FWIW, The cost_functionscan procedure in costsize.c has the following comment: /* * For now, estimate function's cost at one operator eval per function * call. Someday we should revive the function cost estimate columns in * pg_proc... */ I recognize that you're trying to talk about the issue in general rather than about this particular example. However, the example does seem to me to be exactly the case where the effort might be better spent improving the optimizer (reviving the function cost estimate columns), rather than implementing a general hinting facility. Which one is more effort? I don't really know for sure, but cost_functionscan does seem pretty straightforward. What percentage of problems raised on this list can be fixed by setting configuration parameters, adding indexes, increasing statistics, or re-architecting a crazy schema? I've only been lurking for a few months, but it seems like a pretty large fraction. Of the remainder, what percentage represent actual useful feedback about what needs improvement in the optimizer? A pretty large fraction, I think. Including your example. Personally, I think whoever was arguing for selectivity hints in -hackers recently made a pretty good point, so I'm partly on your side. Actually, function cost "hints" don't really seem that much different from selectivity hints, and both seem to me to be slicker solutions (closer to the right level of abstraction) than a general hint facility. Mitch From pgsql-performance-owner@postgresql.org Fri Dec 16 15:40:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D8109DCCC4 for ; Fri, 16 Dec 2005 15:40:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23585-02 for ; Fri, 16 Dec 2005 15:40:23 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.196]) by postgresql.org (Postfix) with ESMTP id 97AE59DCCC3 for ; Fri, 16 Dec 2005 15:40:20 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s14so530646wxc for ; Fri, 16 Dec 2005 11:40:22 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=rLxqVBOPgefeuU5tpa8ka9nXq6+kamXQXInaq9S1Lph8ZJt1yTa8TFodgiDv/NSZVVQ+EYLU01R68xEX6QFbjlwvYlzG0ABv4x8LllA13t/cUQaieAWeP+xBiq7QynpuTIYjbpu15APJcyETrqerYbE7QmlkUygmZeJA1HcUZjs= Received: by 10.70.44.16 with SMTP id r16mr1394643wxr; Fri, 16 Dec 2005 11:40:22 -0800 (PST) Received: by 10.70.84.7 with HTTP; Fri, 16 Dec 2005 11:40:22 -0800 (PST) Message-ID: <1d219a6f0512161140o2aad4256lf8e33fe65871f5a0@mail.gmail.com> Date: Fri, 16 Dec 2005 14:40:22 -0500 From: Chris Hoover To: pgsql-performance@postgresql.org Subject: 8.1 - pg_autovacuum question 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/404 X-Sequence-Number: 16225 In PostgreSQL 8.1, is the pg_autovacuum daemon affected by the vacuum_cost_* variables? I need to make sure that if we turn autovacuuming on when we upgrade to 8.1, we don't cause any i/o issues. Thanks, Chris From pgsql-performance-owner@postgresql.org Fri Dec 16 16:26:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 05FD49DCBAE for ; Fri, 16 Dec 2005 16:26:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33771-09 for ; Fri, 16 Dec 2005 16:26:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from alvh.no-ip.org (201-221-201-24.bk11-dsl.surnet.cl [201.221.201.24]) by postgresql.org (Postfix) with ESMTP id CC9FF9DC880 for ; Fri, 16 Dec 2005 16:26:51 -0400 (AST) Received: by alvh.no-ip.org (Postfix, from userid 1000) id 8D6F7C2DC71; Fri, 16 Dec 2005 17:26:55 -0300 (CLST) Date: Fri, 16 Dec 2005 17:26:55 -0300 From: Alvaro Herrera To: Chris Hoover Cc: pgsql-performance@postgresql.org Subject: Re: 8.1 - pg_autovacuum question Message-ID: <20051216202655.GF27602@surnet.cl> Mail-Followup-To: Chris Hoover , pgsql-performance@postgresql.org References: <1d219a6f0512161140o2aad4256lf8e33fe65871f5a0@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1d219a6f0512161140o2aad4256lf8e33fe65871f5a0@mail.gmail.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.472 required=5 tests=[AWL=-0.447, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.472 X-Spam-Level: * X-Archive-Number: 200512/405 X-Sequence-Number: 16226 Chris Hoover wrote: > In PostgreSQL 8.1, is the pg_autovacuum daemon affected by the > vacuum_cost_* variables? I need to make sure that if we turn > autovacuuming on when we upgrade to 8.1, we don't cause any i/o > issues. What pg_autovacuum daemon? The contrib one? I don't know. The integrated one? Yes it is; and you can set autovacuum-specific values in postgresql.conf and table-specific values (used for autovacuum only) in pg_autovacuum. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Fri Dec 16 17:11:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E9909DC880 for ; Fri, 16 Dec 2005 17:11:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47779-01 for ; Fri, 16 Dec 2005 17:11:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 204AD9DC84E for ; Fri, 16 Dec 2005 17:11:19 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRM008FC06WCP@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 17 Dec 2005 10:11:20 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-173.dsl.clear.net.nz [218.101.28.173]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 0480E14B0000; Sat, 17 Dec 2005 10:11:19 +1300 (NZDT) Date: Sat, 17 Dec 2005 10:11:19 +1300 From: Mark Kirkwood Subject: Re: Simple Join In-reply-to: To: David Lang Cc: Mitch Skinner , Kevin Brown , pgsql-performance@postgresql.org Message-id: <43A32D77.4020500@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.777 required=5 tests=[AWL=-0.555, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.777 X-Spam-Level: X-Archive-Number: 200512/406 X-Sequence-Number: 16227 David Lang wrote: > On Fri, 16 Dec 2005, Mark Kirkwood wrote: > >> >> Right on. Some of these "coerced" plans may perform much better. If >> so, we can look at tweaking your runtime config: e.g. >> >> effective_cache_size >> random_page_cost >> default_statistics_target >> >> to see if said plans can be chosen "naturally". > > > Mark, I've seen these config options listed as tweaking targets fairly > frequently, has anyone put any thought or effort into creating a test > program that could analyse the actual system and set the defaults based > on the measured performance? > I am sure this has been discussed before, I found this thread - http://archives.postgresql.org/pgsql-performance/2004-07/msg00189.php but I seem to recall others (but offhand can't find any of them). I think that the real difficultly here is that the construction of the test program is non trivial - for instance, the best test program for tuning *my* workload is my application with its collection of data, but it is probably not a good test program for *anyone else's* workload. cheers Mark From pgsql-performance-owner@postgresql.org Fri Dec 16 17:56:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 91E939DC84E for ; Fri, 16 Dec 2005 17:56:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52330-07 for ; Fri, 16 Dec 2005 17:56:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 65EF79DCCFC for ; Fri, 16 Dec 2005 17:56:50 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id CB7DF1525C; Fri, 16 Dec 2005 15:56:52 -0600 (CST) Date: Fri, 16 Dec 2005 15:56:52 -0600 From: "Jim C. Nasby" To: Ameet Kini Cc: pgsql-performance@postgresql.org Subject: Re: Lots of postmaster processes (fwd) Message-ID: <20051216215652.GS53809@pervasive.com> 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-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200512/407 X-Sequence-Number: 16228 Dunno if this has gotten a reply elsewhere, but during a checkpoint the database can become quite busy. If that happens and performance slows down, other queries will slow down as well. If you have an app where a a high rate of incomming requests (like a busy website), existing backends won't be able to keep up with demand, so incomming connections will end up spawning more connections to the database. On Tue, Dec 13, 2005 at 11:25:40AM -0600, Ameet Kini wrote: > > > Resending it here as it may be more relevant here... > Ameet > > ---------- Forwarded message ---------- > Date: Tue, 13 Dec 2005 11:24:26 -0600 (CST) > From: Ameet Kini > To: pgsql-admin@postgresql.org > Subject: Lots of postmaster processes > > > > In our installation of the postgres 7.4.7, we are seeing a lot of the > following postmaster processes (around 50) being spawned by the initial > postmaster process once in a while: > > postgres 3977 1 1 Nov03 ? 15:11:38 > /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 > > ...... > > postgres 31985 3977 0 10:08 ? 00:00:00 > /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 > > postgres 31986 3977 0 10:08 ? 00:00:00 > /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 > > postgres 31987 3977 0 10:08 ? 00:00:00 > /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 > > postgres 31988 3977 0 10:08 ? 00:00:00 > /s/postgresql-7.4.7/bin/postmaster -D /scratch.1/postgres/condor-db-7.4.7 > > ...... > > > At the same time when these processes being spawned, sometimes there is > also the checkpoint subprocess. I am not sure if that is related. The > document doesn't provide any information. The other activity going on at > the same time is a 'COPY' statement from a client application. > > These extra processes put a considerable load on the machine and cause it > to hang up. > > Thanks, > Ameet > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Fri Dec 16 18:18:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E5C549DCB82 for ; Fri, 16 Dec 2005 18:18:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60224-08 for ; Fri, 16 Dec 2005 18:18:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 9AC069DCAEF for ; Fri, 16 Dec 2005 18:17:59 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id B0BD71525C; Fri, 16 Dec 2005 16:18:01 -0600 (CST) Date: Fri, 16 Dec 2005 16:18:01 -0600 From: "Jim C. Nasby" To: Mark Kirkwood Cc: Charles Sprickman , pgsql-performance@postgresql.org Subject: Re: SAN/NAS options Message-ID: <20051216221801.GT53809@pervasive.com> References: <439FC9B8.8020709@paradise.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <439FC9B8.8020709@paradise.net.nz> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.007] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200512/408 X-Sequence-Number: 16229 On Wed, Dec 14, 2005 at 08:28:56PM +1300, Mark Kirkwood wrote: > Another interesting thing to try is rebuilding the database ufs > filesystem(s) with 32K blocks and 4K frags (as opposed to 8K/1K or > 16K/2K - can't recall the default on 4.x). I found this to give a factor > of 2 speedup on random disk access (specifically queries doing indexed > joins). Even if you're doing a lot of random IO? I would think that random IO would perform better if you use smaller (8K) blocks, since there's less data being read in and then just thrown away that way. > Is it mainly your 2 disk machines that are IOPS bound? if so, a cheap > option may be to buy 2 more cheetahs for them! If it's the 4's, well how > about a 2U U320 diskpack from whomever supplies you the Supermicro boxes? Also, on the 4 drive machines if you can spare the room you might see a big gain by putting the tables on one mirror and the OS and transaction logs on the other. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Fri Dec 16 18:19:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 551B29DCD9A for ; Fri, 16 Dec 2005 18:19:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54664-10 for ; Fri, 16 Dec 2005 18:19:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 42E509DCD80 for ; Fri, 16 Dec 2005 18:19:07 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id ABD751529A; Fri, 16 Dec 2005 16:19:09 -0600 (CST) Date: Fri, 16 Dec 2005 16:19:09 -0600 From: "Jim C. Nasby" To: Charles Sprickman Cc: pgsql-performance@postgresql.org Subject: Re: SAN/NAS options Message-ID: <20051216221909.GU53809@pervasive.com> 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-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.007] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200512/409 X-Sequence-Number: 16230 On Wed, Dec 14, 2005 at 01:56:10AM -0500, Charles Sprickman wrote: You'll note that I'm being somewhat driven by my OS of choice, FreeBSD. > Unlike Solaris or other commercial offerings, there is no nice volume > management available. While I'd love to keep managing a dozen or so > FreeBSD boxes, I could be persuaded to go to Solaris x86 if the volume > management really shines and Postgres performs well on it. Have you looked at vinum? It might not qualify as a true volume manager, but it's still pretty handy. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Fri Dec 16 18:38:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A5B549DC84E for ; Fri, 16 Dec 2005 18:38:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59661-08 for ; Fri, 16 Dec 2005 18:38:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 75AD99DCBAE for ; Fri, 16 Dec 2005 18:38:44 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id CD0561528B; Fri, 16 Dec 2005 16:38:46 -0600 (CST) Date: Fri, 16 Dec 2005 16:38:46 -0600 From: "Jim C. Nasby" To: Kevin Brown , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051216223846.GV53809@pervasive.com> References: <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> <43A25372.8090706@modgraph-usa.com> <20051216054855.GD691@filer> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051216054855.GD691@filer> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200512/410 X-Sequence-Number: 16231 On Thu, Dec 15, 2005 at 09:48:55PM -0800, Kevin Brown wrote: > Craig A. James wrote: > > Kevin Brown wrote: > > >>Hints are dangerous, and I consider them a last resort. > > > > > >If you consider them a last resort, then why do you consider them to > > >be a better alternative than a workaround such as turning off > > >enable_seqscan, when all the other tradeoffs are considered? > > > > If I understand enable_seqscan, it's an all-or-nothing affair. Turning it > > off turns it off for the whole database, right? The same is true of all > > of the planner-tuning parameters in the postgres conf file. > > Nope. What's in the conf file are the defaults. You can change them > on a per-connection basis, via the SET command. Thus, before doing > your problematic query: > > SET enable_seqscan = off; > > and then, after your query is done, > > SET enable_seqscan = on; You can also turn it off inside a transaction and have it only affect that transaction so that you can't accidentally forget to turn it back on (which could seriously hose things up if you're doing this in conjunction with a connection pool). -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Fri Dec 16 18:41:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BF2949DC880 for ; Fri, 16 Dec 2005 18:41:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64233-04 for ; Fri, 16 Dec 2005 18:41:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 9EC849DC84E for ; Fri, 16 Dec 2005 18:41:18 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id 31BDE1529A; Fri, 16 Dec 2005 16:41:21 -0600 (CST) Date: Fri, 16 Dec 2005 16:41:21 -0600 From: "Jim C. Nasby" To: Mark Kirkwood Cc: "Craig A. James" , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051216224121.GW53809@pervasive.com> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43A226E7.7040508@paradise.net.nz> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.011 required=5 tests=[AWL=0.011] X-Spam-Score: 0.011 X-Spam-Level: X-Archive-Number: 200512/411 X-Sequence-Number: 16232 On Fri, Dec 16, 2005 at 03:31:03PM +1300, Mark Kirkwood wrote: > After years of using several other database products (some supporting > hint type constructs and some not), I have come to believe that hinting > (or similar) actually *hinders* the development of a great optimizer. I don't think you can assume that would hold true for an open-source database. Unlike a commercial database, it's trivially easy to notify developers about a bad query plan. With a commercial database you'd have to open a support ticket and hope they actually use that info to improve the planner. Here you need just send an email to this list and the developers will at least see it, and will usually try and fix the issue. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Fri Dec 16 18:45:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B0F599DCCEE for ; Fri, 16 Dec 2005 18:45:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64975-07 for ; Fri, 16 Dec 2005 18:45:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 4BD619DCD5D for ; Fri, 16 Dec 2005 18:45:10 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id BD4891525C; Fri, 16 Dec 2005 16:45:12 -0600 (CST) Date: Fri, 16 Dec 2005 16:45:12 -0600 From: "Jim C. Nasby" To: Mark Kirkwood Cc: "Craig A. James" , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051216224512.GX53809@pervasive.com> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <43A231AA.9070708@paradise.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43A231AA.9070708@paradise.net.nz> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200512/412 X-Sequence-Number: 16233 On Fri, Dec 16, 2005 at 04:16:58PM +1300, Mark Kirkwood wrote: > Craig A. James wrote: > > > > >What would be cool would be some way the developer could alter the plan, > >but they way of doing so would strongly encourage the developer to send > >the information to this mailing list. Postgres would essentially say, > >"Ok, you can do that, but we want to know why!" > > > > Yeah it would - an implementation I have seen that I like is where the > developer can supply the *entire* execution plan with a query. This is > complex enough to make casual use unlikely :-), but provides the ability > to try out other plans, and also fix that vital query that must run > today..... Being able to specify an exact plan would also provide for query plan stability; something that is critically important in certain applications. If you have to meet a specific response time requirement for a query, you can't afford to have the optimizer suddenly decide that some other plan might be faster when in fact it's much slower. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Fri Dec 16 18:49:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 21A8A9DC880 for ; Fri, 16 Dec 2005 18:49:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66152-01 for ; Fri, 16 Dec 2005 18:49:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 21FE39DC84E for ; Fri, 16 Dec 2005 18:49:55 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRM00CW84R941@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 17 Dec 2005 11:49:57 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-173.dsl.clear.net.nz [218.101.28.173]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 0078116BC7A4; Sat, 17 Dec 2005 11:49:56 +1300 (NZDT) Date: Sat, 17 Dec 2005 11:49:55 +1300 From: Mark Kirkwood Subject: Re: SAN/NAS options In-reply-to: <20051216221801.GT53809@pervasive.com> To: "Jim C. Nasby" Cc: Charles Sprickman , pgsql-performance@postgresql.org Message-id: <43A34493.4020204@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <439FC9B8.8020709@paradise.net.nz> <20051216221801.GT53809@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.873 required=5 tests=[AWL=-0.459, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.873 X-Spam-Level: X-Archive-Number: 200512/413 X-Sequence-Number: 16234 Jim C. Nasby wrote: > On Wed, Dec 14, 2005 at 08:28:56PM +1300, Mark Kirkwood wrote: > >>Another interesting thing to try is rebuilding the database ufs >>filesystem(s) with 32K blocks and 4K frags (as opposed to 8K/1K or >>16K/2K - can't recall the default on 4.x). I found this to give a factor >>of 2 speedup on random disk access (specifically queries doing indexed >>joins). > > > Even if you're doing a lot of random IO? I would think that random IO > would perform better if you use smaller (8K) blocks, since there's less > data being read in and then just thrown away that way. > > Yeah, that's what I would have expected too! but the particular queries I tested do a ton of random IO (correlation of 0.013 on the join column for the big table). I did wonder if the gain has something to do with the underlying RAID stripe size (64K or 256K in my case), as I have only tested the 32K vs 8K/16K on RAIDed systems. I guess for a system where the number of concurrent users give rise to memory pressure, it will cause more thrashing of the file buffer cache, much could be a net loss. Still worth trying out I think, you will know soon enough if it is a win or lose! Note that I did *not* alter Postgres page/block size (BLCKSZ) from 8K, so no dump/reload is required to test this out. cheers Mark From pgsql-performance-owner@postgresql.org Fri Dec 16 18:51:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A659D9DC883 for ; Fri, 16 Dec 2005 18:51:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65693-06 for ; Fri, 16 Dec 2005 18:51:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by postgresql.org (Postfix) with ESMTP id 5443E9DC84E for ; Fri, 16 Dec 2005 18:51:04 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.72.158]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IRM002RV4T4DG02@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 16 Dec 2005 16:51:04 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 98BD7600662 for ; Fri, 16 Dec 2005 17:51:03 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29765-03-10 for ; Fri, 16 Dec 2005 17:51:03 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 7FA8F600483; Fri, 16 Dec 2005 17:51:03 -0500 (EST) Date: Fri, 16 Dec 2005 17:51:03 -0500 From: Michael Stone Subject: Re: SAN/NAS options In-reply-to: <20051216221801.GT53809@pervasive.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051216225103.GE2883@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <439FC9B8.8020709@paradise.net.nz> <20051216221801.GT53809@pervasive.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/414 X-Sequence-Number: 16235 On Fri, Dec 16, 2005 at 04:18:01PM -0600, Jim C. Nasby wrote: >Even if you're doing a lot of random IO? I would think that random IO >would perform better if you use smaller (8K) blocks, since there's less >data being read in and then just thrown away that way. The overhead of reading an 8k block instead of a 32k block is too small to measure on modern hardware. The seek is what dominates; leaving the read head on a little longer and then transmitting a little more over a 200 megabyte channel is statistical fuzz. Mike Stone From pgsql-performance-owner@postgresql.org Fri Dec 16 20:25:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 51D6D9DCDA9 for ; Fri, 16 Dec 2005 20:25:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84261-03 for ; Fri, 16 Dec 2005 20:25:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 6ACAC9DCDA8 for ; Fri, 16 Dec 2005 20:25:22 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id 051AA15284; Fri, 16 Dec 2005 18:25:25 -0600 (CST) Date: Fri, 16 Dec 2005 18:25:25 -0600 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Re: SAN/NAS options Message-ID: <20051217002525.GC53809@pervasive.com> References: <439FC9B8.8020709@paradise.net.nz> <20051216221801.GT53809@pervasive.com> <20051216225103.GE2883@mathom.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051216225103.GE2883@mathom.us> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.022 required=5 tests=[AWL=0.022] X-Spam-Score: 0.022 X-Spam-Level: X-Archive-Number: 200512/415 X-Sequence-Number: 16236 On Fri, Dec 16, 2005 at 05:51:03PM -0500, Michael Stone wrote: > On Fri, Dec 16, 2005 at 04:18:01PM -0600, Jim C. Nasby wrote: > >Even if you're doing a lot of random IO? I would think that random IO > >would perform better if you use smaller (8K) blocks, since there's less > >data being read in and then just thrown away that way. > > The overhead of reading an 8k block instead of a 32k block is too small > to measure on modern hardware. The seek is what dominates; leaving the > read head on a little longer and then transmitting a little more over a > 200 megabyte channel is statistical fuzz. True, but now you've got 4x the amount of data in your cache that you probably don't need. Looks like time to do some benchmarking... -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Fri Dec 16 20:48:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 432129DC880 for ; Fri, 16 Dec 2005 20:48:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84588-09 for ; Fri, 16 Dec 2005 20:48:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by postgresql.org (Postfix) with ESMTP id 374CC9DC883 for ; Fri, 16 Dec 2005 20:47:57 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.72.158]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IRM0029OA81DSI2@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 16 Dec 2005 18:48:01 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id B82B1600662 for ; Fri, 16 Dec 2005 19:48:00 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30829-06 for ; Fri, 16 Dec 2005 19:48:00 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 82525600442; Fri, 16 Dec 2005 19:48:00 -0500 (EST) Date: Fri, 16 Dec 2005 19:48:00 -0500 From: Michael Stone Subject: Re: SAN/NAS options In-reply-to: <20051217002525.GC53809@pervasive.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051217004800.GF2883@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <439FC9B8.8020709@paradise.net.nz> <20051216221801.GT53809@pervasive.com> <20051216225103.GE2883@mathom.us> <20051217002525.GC53809@pervasive.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200512/416 X-Sequence-Number: 16237 On Fri, Dec 16, 2005 at 06:25:25PM -0600, Jim C. Nasby wrote: >True, but now you've got 4x the amount of data in your cache that you >probably don't need. Or you might be 4x more likely to have data cached that's needed later. If you're hitting disk either way, that's probably more likely than the extra IO pushing something critical out--if *all* the important stuff were cached you wouldn't be doing the seeks in the first place. This will obviously be heavily dependent on the amount of ram you've got and your workload, so (as always) you'll have to benchmark it to get past the hand-waving stage. Mike Stone From pgsql-performance-owner@postgresql.org Fri Dec 16 21:41:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CDBFB9DC9F0 for ; Fri, 16 Dec 2005 21:41:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92136-07 for ; Fri, 16 Dec 2005 21:41:27 -0400 (AST) X-Greylist: delayed 11:22:54.842655 by SQLgrey- Received: from filch.dreamhost.com (filch.dreamhost.com [66.33.217.6]) by postgresql.org (Postfix) with ESMTP id AB82B9DC883 for ; Fri, 16 Dec 2005 21:41:21 -0400 (AST) Received: from [127.0.0.1] (shemp.dreamhost.com [66.33.213.12]) by filch.dreamhost.com (Postfix) with ESMTP id 3BB9D5F8CD for ; Fri, 16 Dec 2005 17:41:25 -0800 (PST) Message-ID: <43A36D06.3090804@kylecordes.com> Date: Fri, 16 Dec 2005 19:42:30 -0600 From: Kyle Cordes User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer References: <200512141603.52583.blargity@gmail.com> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <20051216052025.GB691@filer> <43A2CCEF.9030605@kylecordes.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, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/417 X-Sequence-Number: 16238 Jaime Casanova wrote: >>What I would >>really like is for my DBMS to give me a little more pushback - I'd like >>to ask it to run a query, and have it either find a "good" way to run >>the query, or politely refuse to run it at all. >> >> >set statement_timeout in postgresql.conf > > That is what I am doing now, and it is much better than nothing. But it's not really sufficient, in that it is still quite possible for users repeatedly trying an operation that unexpectedly causes excessive DB usage, to load down the system to the point of failure. In other words, I'd ideally like it to give up right away, not after N seconds of table scanning my 100-million-row tables... and not with a timeout, but with an explicit throwing up of its hands, exasperated, that it could not come up with an efficient way to run my query. Kyle Cordes www.kylecordes.com From pgsql-performance-owner@postgresql.org Fri Dec 16 22:44:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 042859DCA20 for ; Fri, 16 Dec 2005 22:44:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04260-05 for ; Fri, 16 Dec 2005 22:44:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.152]) by postgresql.org (Postfix) with ESMTP id E679F9DC9F0 for ; Fri, 16 Dec 2005 22:44:17 -0400 (AST) Received: from candle.pha.pa.us (unknown[71.225.87.206](misconfigured sender)) by comcast.net (rwcrmhc12) with ESMTP id <20051217024417014008f180e>; Sat, 17 Dec 2005 02:44:21 +0000 Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBH2iJV11094; Fri, 16 Dec 2005 21:44:19 -0500 (EST) From: Bruce Momjian Message-Id: <200512170244.jBH2iJV11094@candle.pha.pa.us> Subject: Re: How much expensive are row level statistics? In-Reply-To: <1667.1134444045@sss.pgh.pa.us> To: Tom Lane Date: Fri, 16 Dec 2005 21:44:19 -0500 (EST) CC: Michael Fuhr , Merlin Moncure , pgsql-performance@postgresql.org, Carlos Benkendorf 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, score=0.087 required=5 tests=[AWL=0.087] X-Spam-Score: 0.087 X-Spam-Level: X-Archive-Number: 200512/418 X-Sequence-Number: 16239 Tom Lane wrote: > Michael Fuhr writes: > > Further tests show that for this application > > the killer is stats_command_string, not stats_block_level or > > stats_row_level. > > I tried it with pgbench -c 10, and got these results: > 41% reduction in TPS rate for stats_command_string Woh, 41%. That's just off the charts! What are we doing internally that would cause that? -- 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 Sat Dec 17 00:28:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5F6A19DCA75 for ; Sat, 17 Dec 2005 00:28:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33724-09 for ; Sat, 17 Dec 2005 00:28:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by postgresql.org (Postfix) with ESMTP id 0D77E9DC84D for ; Sat, 17 Dec 2005 00:28:16 -0400 (AST) Received: from candle.pha.pa.us ([71.225.87.206]) by comcast.net (sccrmhc12) with ESMTP id <20051217042800012007n9n8e>; Sat, 17 Dec 2005 04:28:15 +0000 Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBH4S2W23715; Fri, 16 Dec 2005 23:28:02 -0500 (EST) From: Bruce Momjian Message-Id: <200512170428.jBH4S2W23715@candle.pha.pa.us> Subject: Re: Should Oracle outperform PostgreSQL on a complex In-Reply-To: <1134516529.27873.133.camel@localhost.localdomain> To: Simon Riggs Date: Fri, 16 Dec 2005 23:28:02 -0500 (EST) CC: =?ISO-8859-1?Q?P=E5l_Stenslet?= , 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, score=0.103 required=5 tests=[AWL=0.103] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200512/419 X-Sequence-Number: 16240 How are star joins different from what we do now? --------------------------------------------------------------------------- Simon Riggs wrote: > On Thu, 2005-12-08 at 12:26 +0100, P?l Stenslet wrote: > > I'm currently benchmarking several RDBMSs with respect to analytical > > query performance on medium-sized multidimensional data sets. The data > > set contains 30,000,000 fact rows evenly distributed in a > > multidimensional space of 9 hierarchical dimensions. Each dimension > > has 8000 members. > > > I have established similar conditions for the query in PostgreSQL, and > > it runs in about 30 seconds. Again the CPU utilization is high with no > > noticable I/O. The query plan is of course very different from that of > > Oracle, since PostgreSQL lacks the bitmap index merge operation. It > > narrows down the result one dimension at a time, using the > > single-column indexes provided. It is not an option for us to provide > > multi-column indexes tailored to the specific query, since we want > > full freedom as to which dimensions each query will use. > > > Are these the results we should expect when comparing PostgreSQL to > > Oracle for such queries, or are there special optimization options for > > PostgreSQL that we may have overlooked? (I wouldn't be suprised if > > there are, since I spent at least 2 full days trying to trigger the > > star optimization magic in my Oracle installation.) > > Yes, I'd expect something like this right now in 8.1; the numbers stack > up to PostgreSQL doing equivalent join speeds, but w/o star join. > > You've confused the issue here since: > - Oracle performs star joins using a bit map index transform. It is the > star join that is the important bit here, not the just the bitmap part. > - PostgreSQL does actually provide bitmap index merge, but not star join > (YET!) > > [I've looked into this, but there seem to be multiple patent claims > covering various aspects of this technique, yet at least other 3 vendors > manage to achieve this. So far I've not dug too deeply, but I understand > the optimizations we'd need to perform in PostgreSQL to do this.] > > Best Regards, Simon Riggs > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > -- 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 Sat Dec 17 01:21:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 562FC9DC880 for ; Sat, 17 Dec 2005 01:21:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39662-08 for ; Sat, 17 Dec 2005 01:21:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 1A98E9DC84D for ; Sat, 17 Dec 2005 01:21:55 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRM004FDMWIX4@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 17 Dec 2005 18:21:54 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-173.dsl.clear.net.nz [218.101.28.173]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 334DA7D2519; Sat, 17 Dec 2005 18:21:54 +1300 (NZDT) Date: Sat, 17 Dec 2005 18:21:50 +1300 From: Mark Kirkwood Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <200512170428.jBH4S2W23715@candle.pha.pa.us> To: Bruce Momjian Cc: Simon Riggs , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Message-id: <43A3A06E.2090900@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512170428.jBH4S2W23715@candle.pha.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.946 required=5 tests=[AWL=-0.386, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.946 X-Spam-Level: X-Archive-Number: 200512/420 X-Sequence-Number: 16241 Bruce Momjian wrote: > How are star joins different from what we do now? > > --------------------------------------------------------------------------- > Recall that a "star" query with n tables means a query where there are (n - 1) supposedly small tables (dimensions) and 1 large table (fact) - which has foreign keys to each dimension. As I understand it, the classic "tar join" is planned like this: 1) The result of the restriction clauses on each of the (small) dimension tables is computed. 2) The cartesian product of all the results of 1) is formed. 3) The fact (big) table is joined to the pseudo relation formed by 2). From what I have seen most vendor implementations do not (always) perform the full cartesion product of the dimensions, but do some of them, join to the fact, then join to the remaining dimensions afterwards. There is another join strategy called the "star transformation" where some of the dimension joins get rewritten as subqueries, then the above method is used again! This tends to be useful when the cartesion products would be stupidly large (e.g. "sparse" facts, or few restriction clauses) regards Mark P.s : Luke or Simon might have a better definition... but thought I'd chuck in my 2c... :-) From pgsql-performance-owner@postgresql.org Sat Dec 17 03:28:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 466F29DC880 for ; Sat, 17 Dec 2005 03:28:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67809-04 for ; Sat, 17 Dec 2005 03:28:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id F20E29DC84D for ; Sat, 17 Dec 2005 03:28:11 -0400 (AST) 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 jBH7SBBH004253; Sat, 17 Dec 2005 02:28:11 -0500 (EST) To: "Craig A. James" cc: pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer In-reply-to: <43A22368.8060307@modgraph-usa.com> References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <18537.1134692629@sss.pgh.pa.us> <43A22368.8060307@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Thu, 15 Dec 2005 18:16:08 -0800" Date: Sat, 17 Dec 2005 02:28:11 -0500 Message-ID: <4252.1134804491@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.012 required=5 tests=[AWL=0.012] X-Spam-Score: 0.012 X-Spam-Level: X-Archive-Number: 200512/421 X-Sequence-Number: 16242 "Craig A. James" writes: > How about this: Instead of arguing in the abstract, tell me in > concrete terms how you would address the very specific example I gave, > where myfunc() is a user-written function. To make it a little more > challenging, try this: myfunc() can behave very differently depending > on the parameters, and sometimes (but not always), the application > knows how it will behave and could suggest a good execution plan. A word to the wise: regression=# explain select * from tenk1 where ten > 5 and ten < 9 regression-# and myfunc(unique1,unique2); QUERY PLAN ------------------------------------------------------------------ Seq Scan on tenk1 (cost=0.00..533.00 rows=982 width=244) Filter: ((ten > 5) AND (ten < 9) AND myfunc(unique1, unique2)) (2 rows) regression=# explain select * from tenk1 where myfunc(unique1,unique2) regression-# and ten > 5 and ten < 9; QUERY PLAN ------------------------------------------------------------------ Seq Scan on tenk1 (cost=0.00..533.00 rows=982 width=244) Filter: (myfunc(unique1, unique2) AND (ten > 5) AND (ten < 9)) (2 rows) I might have taken your original complaint more seriously if it weren't so blatantly bogus. Your query as written absolutely would not have evaluated myfunc() first, because there was no reason for the planner to reorder the WHERE list. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Dec 17 04:45:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 344FD9DC883 for ; Sat, 17 Dec 2005 04:45:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01089-09 for ; Sat, 17 Dec 2005 04:45:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id D62F89DC880 for ; Sat, 17 Dec 2005 04:42:51 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id F03911AC3E9; Sat, 17 Dec 2005 00:41:52 -0800 (PST) Date: Sat, 17 Dec 2005 00:40:51 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Mark Kirkwood Cc: "Craig A. James" , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer In-Reply-To: <43A231AA.9070708@paradise.net.nz> Message-ID: References: <200512141603.52583.blargity@gmail.com> <7484.1134600423@sss.pgh.pa.us> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <43A231AA.9070708@paradise.net.nz> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/422 X-Sequence-Number: 16243 On Fri, 16 Dec 2005, Mark Kirkwood wrote: > Craig A. James wrote: > >> >> What would be cool would be some way the developer could alter the plan, >> but they way of doing so would strongly encourage the developer to send the >> information to this mailing list. Postgres would essentially say, "Ok, you >> can do that, but we want to know why!" >> > > Yeah it would - an implementation I have seen that I like is where the > developer can supply the *entire* execution plan with a query. This is > complex enough to make casual use unlikely :-), but provides the ability to > try out other plans, and also fix that vital query that must run today..... hmm, I wonder if this option would have uses beyond the production hacks that are being discussed. specificly developers working on the optimizer (or related things like clustered databases) could use the same hooks to develop and modify the 'optimizer' externally to postgres (doing an explain would let them find the costs that postgres thinks each option has, along with it's reccomendation, but the developer could try different execution plans without having to recompile postgres between runs. and for clustered databases where the data is split between machines this would be a hook that the cluster engine could use to put it's own plan into place without having to modify and recompile) David Lang From pgsql-performance-owner@postgresql.org Sat Dec 17 05:15:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 03FA49DC883 for ; Sat, 17 Dec 2005 05:15:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40176-04 for ; Sat, 17 Dec 2005 05:15:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id ADFD29DC849 for ; Sat, 17 Dec 2005 05:15:52 -0400 (AST) Received: from [192.168.0.2] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id C5388269A07; Sat, 17 Dec 2005 09:15:51 +0000 (GMT) Subject: Re: Should Oracle outperform PostgreSQL on a complex From: Simon Riggs To: Bruce Momjian Cc: =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org In-Reply-To: <200512170428.jBH4S2W23715@candle.pha.pa.us> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> Content-Type: text/plain Date: Sat, 17 Dec 2005 09:15:53 +0000 Message-Id: <1134810953.2964.117.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.017 required=5 tests=[AWL=0.017] X-Spam-Score: 0.017 X-Spam-Level: X-Archive-Number: 200512/423 X-Sequence-Number: 16244 On Fri, 2005-12-16 at 23:28 -0500, Bruce Momjian wrote: > How are star joins different from what we do now? Various ways of doing them, but all use plans that you wouldn't have come up with via normal join planning. Methods: 1. join all N small tables together in a cartesian product, then join to main Large table once (rather than N times) 2. transform joins into subselects, then return subselect rows via an index bitmap. Joins are performed via a bitmap addition process. You can fake (1) yourself with a temporary table, and the basics for (2) are now in place also. The characteristics of these joins make them suitable for large Data Warehouses with Fact-Dimension style designs. Many RDBMS have this, but we need to be careful of patent claims. I'm sure there's a way through that, but I'm not looking for it yet. Anybody else wishing to assist with a detailed analysis would be much appreciated. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sat Dec 17 08:31:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9DCAC9DCCD7 for ; Sat, 17 Dec 2005 08:31:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84298-04 for ; Sat, 17 Dec 2005 08:31:43 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by postgresql.org (Postfix) with ESMTP id 885279DCCB4 for ; Sat, 17 Dec 2005 08:31:38 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so750336wri for ; Sat, 17 Dec 2005 04:31:40 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nmn66QcWcklWyZnsiU8IwNNNDySAF0ScGJpafdzkNV3UFyVwrugXkPyniV7dHcUdLBD3Ku+h/3y8JkOOzP0qIfh1WMtbRsp3W5xd/Cw+P7V+yBka5Eeb2J/mgEyeM0Jo1bIs1rdYrRVVi1Wf7adCrvhoIjWoFm83NYDD9Yci4oY= Received: by 10.54.121.13 with SMTP id t13mr86070wrc; Sat, 17 Dec 2005 04:31:40 -0800 (PST) Received: by 10.54.98.6 with HTTP; Sat, 17 Dec 2005 04:31:40 -0800 (PST) Message-ID: Date: Sat, 17 Dec 2005 07:31:40 -0500 From: Jaime Casanova To: "Jim C. Nasby" Subject: Re: Overriding the optimizer Cc: Mark Kirkwood , "Craig A. James" , pgsql-performance@postgresql.org In-Reply-To: <20051216224512.GX53809@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512141603.52583.blargity@gmail.com> <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <43A231AA.9070708@paradise.net.nz> <20051216224512.GX53809@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.086 required=5 tests=[AWL=0.086] X-Spam-Score: 0.086 X-Spam-Level: X-Archive-Number: 200512/424 X-Sequence-Number: 16245 > > Yeah it would - an implementation I have seen that I like is where the > > developer can supply the *entire* execution plan with a query. This is > > complex enough to make casual use unlikely :-), but provides the abilit= y > > to try out other plans, and also fix that vital query that must run > > today..... > > Being able to specify an exact plan would also provide for query plan > stability; something that is critically important in certain > applications. If you have to meet a specific response time requirement > for a query, you can't afford to have the optimizer suddenly decide that > some other plan might be faster when in fact it's much slower. Plan stability doesn't mean time response stability... The plan that today is almost instantaneous tomorrow can take hours... -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Sat Dec 17 10:56:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C8DD19DCC7C for ; Sat, 17 Dec 2005 10:56:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06316-02 for ; Sat, 17 Dec 2005 10:56:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.151]) by postgresql.org (Postfix) with ESMTP id 776479DCBE7 for ; Sat, 17 Dec 2005 10:56:46 -0400 (AST) Received: from candle.pha.pa.us ([71.225.87.206]) by comcast.net (rwcrmhc11) with ESMTP id <2005121714565001300c8cdde>; Sat, 17 Dec 2005 14:56:50 +0000 Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBHEunM07437; Sat, 17 Dec 2005 09:56:49 -0500 (EST) From: Bruce Momjian Message-Id: <200512171456.jBHEunM07437@candle.pha.pa.us> Subject: Re: Simple Join In-Reply-To: <7484.1134600423@sss.pgh.pa.us> To: Tom Lane Date: Sat, 17 Dec 2005 09:56:49 -0500 (EST) 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, score=0.157 required=5 tests=[AWL=0.157] X-Spam-Score: 0.157 X-Spam-Level: X-Archive-Number: 200512/425 X-Sequence-Number: 16246 Tom Lane wrote: > Kevin Brown writes: > > I'm running 8.1 installed from source on a Debian Sarge server. I have a > > simple query that I believe I've placed the indexes correctly for, and I > > still end up with a seq scan. It makes sense, kinda, but it should be able > > to use the index to gather the right values. > > I continue to marvel at how many people think that if it's not using an > index it must ipso facto be a bad plan ... > > That plan looks perfectly fine to me. You could try forcing some other > choices by fooling with the planner enable switches (eg set > enable_seqscan = off) but I doubt you'll find much improvement. There > are too many rows being pulled from ordered_products to make an index > nestloop a good idea. We do have an FAQ item: 4.6) Why are my queries slow? Why don't they use my indexes? -- 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 Sat Dec 17 12:43:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EFCBF9DCACF for ; Sat, 17 Dec 2005 12:43:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49408-06 for ; Sat, 17 Dec 2005 12:43:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by postgresql.org (Postfix) with ESMTP id 7B2249DCA43 for ; Sat, 17 Dec 2005 12:43:31 -0400 (AST) Received: from candle.pha.pa.us ([71.225.87.206]) by comcast.net (sccrmhc12) with ESMTP id <20051217164315012007iihde>; Sat, 17 Dec 2005 16:43:30 +0000 Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBHGhFA04982; Sat, 17 Dec 2005 11:43:15 -0500 (EST) From: Bruce Momjian Message-Id: <200512171643.jBHGhFA04982@candle.pha.pa.us> Subject: Re: Should Oracle outperform PostgreSQL on a complex In-Reply-To: <1134810953.2964.117.camel@localhost.localdomain> To: Simon Riggs Date: Sat, 17 Dec 2005 11:43:15 -0500 (EST) CC: =?ISO-8859-1?Q?P=E5l_Stenslet?= , 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, score=0.133 required=5 tests=[AWL=0.133] X-Spam-Score: 0.133 X-Spam-Level: X-Archive-Number: 200512/426 X-Sequence-Number: 16247 OK, so while our bitmap scan allows multiple indexes to be joined to get to heap rows, a star joins allows multiple dimensions _tables_ to be joined to index into a larger main fact table --- interesting. Added to TODO: * Allow star join optimizations While our bitmap scan allows multiple indexes to be joined to get to heap rows, a star joins allows multiple dimension _tables_ to be joined to index into a larger main fact table. The join is usually performed by either creating a cartesian product of all the dimmension tables and doing a single join on that product or using subselects to create bitmaps of each dimmension table match and merge the bitmaps to perform the join on the fact table. --------------------------------------------------------------------------- Simon Riggs wrote: > On Fri, 2005-12-16 at 23:28 -0500, Bruce Momjian wrote: > > How are star joins different from what we do now? > > Various ways of doing them, but all use plans that you wouldn't have > come up with via normal join planning. > > Methods: > 1. join all N small tables together in a cartesian product, then join to > main Large table once (rather than N times) > 2. transform joins into subselects, then return subselect rows via an > index bitmap. Joins are performed via a bitmap addition process. > > You can fake (1) yourself with a temporary table, and the basics for (2) > are now in place also. > > The characteristics of these joins make them suitable for large Data > Warehouses with Fact-Dimension style designs. > > Many RDBMS have this, but we need to be careful of patent claims. I'm > sure there's a way through that, but I'm not looking for it yet. Anybody > else wishing to assist with a detailed analysis would be much > appreciated. > > 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 Sat Dec 17 14:13:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3A0199DC8D9 for ; Sat, 17 Dec 2005 14:13:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24841-01 for ; Sat, 17 Dec 2005 14:13:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C38489DC88F for ; Sat, 17 Dec 2005 14:13:48 -0400 (AST) 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 jBHIDgxJ008628; Sat, 17 Dec 2005 13:13:42 -0500 (EST) To: Simon Riggs cc: Bruce Momjian , =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <1134810953.2964.117.camel@localhost.localdomain> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> Comments: In-reply-to Simon Riggs message dated "Sat, 17 Dec 2005 09:15:53 +0000" Date: Sat, 17 Dec 2005 13:13:42 -0500 Message-ID: <8627.1134843222@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200512/427 X-Sequence-Number: 16248 Simon Riggs writes: > On Fri, 2005-12-16 at 23:28 -0500, Bruce Momjian wrote: >> How are star joins different from what we do now? > Methods: > 1. join all N small tables together in a cartesian product, then join to > main Large table once (rather than N times) Of course, the reason the current planner does not think of this is that it does not consider clauseless joins unless there is no alternative. However, I submit that it wouldn't pick such a plan anyway, and should not, because the idea is utterly stupid. The plan you currently get for this sort of scenario is typically a nest of hash joins: QUERY PLAN ------------------------------------------------------------------------ Hash Join (cost=2.25..4652.25 rows=102400 width=16) Hash Cond: ("outer".f1 = "inner".f1) -> Hash Join (cost=1.12..3115.12 rows=102400 width=12) Hash Cond: ("outer".f2 = "inner".f1) -> Seq Scan on fact (cost=0.00..1578.00 rows=102400 width=8) -> Hash (cost=1.10..1.10 rows=10 width=4) -> Seq Scan on d2 (cost=0.00..1.10 rows=10 width=4) -> Hash (cost=1.10..1.10 rows=10 width=4) -> Seq Scan on d1 (cost=0.00..1.10 rows=10 width=4) (9 rows) This involves only one scan of the fact table. As each row is pulled up through the nest of hash joins, we hash one dimension key and join to one small table at each level. This is at worst the same amount of work as hashing all the keys at once and probing a single cartesian-product hashtable, probably less work (fewer wasted key-comparisons). And definitely less memory. You do have to keep your eye on the ball that you don't waste a lot of overhead propagating the row up through multiple join levels, but we got rid of most of the problem there in 8.1 via the introduction of "virtual tuple slots". If this isn't fast enough yet, it'd make more sense to invest effort in further cutting the executor's join overhead (which of course benefits *all* plan types) than in trying to make the planner choose a star join. > 2. transform joins into subselects, then return subselect rows via an > index bitmap. Joins are performed via a bitmap addition process. This one might be interesting but it's not clear what you are talking about. "Bitmap addition"? regards, tom lane From pgsql-performance-owner@postgresql.org Sat Dec 17 14:35:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3226C9DCA43 for ; Sat, 17 Dec 2005 14:35:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28655-01 for ; Sat, 17 Dec 2005 14:35:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C44AD9DC992 for ; Sat, 17 Dec 2005 14:35:15 -0400 (AST) 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 jBHIZCuO008934; Sat, 17 Dec 2005 13:35:12 -0500 (EST) To: Bruce Momjian cc: Simon Riggs , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <200512171643.jBHGhFA04982@candle.pha.pa.us> References: <200512171643.jBHGhFA04982@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Sat, 17 Dec 2005 11:43:15 -0500" Date: Sat, 17 Dec 2005 13:35:12 -0500 Message-ID: <8933.1134844512@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200512/428 X-Sequence-Number: 16249 Bruce Momjian writes: > Added to TODO: > * Allow star join optimizations See my response to Simon for reasons why this doesn't seem like a particularly good TODO item. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Dec 17 14:47:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F1D849DCAC0 for ; Sat, 17 Dec 2005 14:47:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28253-05 for ; Sat, 17 Dec 2005 14:47:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 13DF69DC88F for ; Sat, 17 Dec 2005 14:47:09 -0400 (AST) 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 jBHIl7ET009011; Sat, 17 Dec 2005 13:47:07 -0500 (EST) To: Simon Riggs , Bruce Momjian , =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <8627.1134843222@sss.pgh.pa.us> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 17 Dec 2005 13:13:42 -0500" Date: Sat, 17 Dec 2005 13:47:07 -0500 Message-ID: <9010.1134845227@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200512/429 X-Sequence-Number: 16250 I wrote: > However, I submit that it wouldn't pick such a plan anyway, and should > not, because the idea is utterly stupid. BTW, some experimentation suggests that in fact a star join is already slower than the "regular" plan in 8.1. You can force a star-join plan to be generated like this: regression=# set join_collapse_limit TO 1; SET regression=# explain select * from fact,d1 cross join d2 where fact.f1=d1.f1 and fact.f2=d2.f1; QUERY PLAN --------------------------------------------------------------------------- Hash Join (cost=4.71..8238.71 rows=102400 width=16) Hash Cond: (("outer".f1 = "inner".f1) AND ("outer".f2 = "inner".f1)) -> Seq Scan on fact (cost=0.00..1578.00 rows=102400 width=8) -> Hash (cost=4.21..4.21 rows=100 width=8) -> Nested Loop (cost=1.11..4.21 rows=100 width=8) -> Seq Scan on d1 (cost=0.00..1.10 rows=10 width=4) -> Materialize (cost=1.11..1.21 rows=10 width=4) -> Seq Scan on d2 (cost=0.00..1.10 rows=10 width=4) (8 rows) and at least in the one test case I tried, this runs slower than the nested-hash plan. EXPLAIN ANALYZE misleadingly makes it look faster, but that's just because of the excessive per-plan-node ANALYZE overhead. Try doing something like \timing select count(*) from fact, ... to get realistic numbers. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Dec 17 15:04:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 551689DC88F for ; Sat, 17 Dec 2005 15:04:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28116-09 for ; Sat, 17 Dec 2005 15:04:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sccrmhc14.comcast.net (sccrmhc14.comcast.net [63.240.77.84]) by postgresql.org (Postfix) with ESMTP id 80DE69DCC06 for ; Sat, 17 Dec 2005 15:04:14 -0400 (AST) Received: from candle.pha.pa.us (unknown[71.225.87.206](misconfigured sender)) by comcast.net (sccrmhc14) with ESMTP id <200512171903540140031r68e>; Sat, 17 Dec 2005 19:04:14 +0000 Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBHJ3sH02565; Sat, 17 Dec 2005 14:03:54 -0500 (EST) From: Bruce Momjian Message-Id: <200512171903.jBHJ3sH02565@candle.pha.pa.us> Subject: Re: Should Oracle outperform PostgreSQL on a complex In-Reply-To: <8933.1134844512@sss.pgh.pa.us> To: Tom Lane Date: Sat, 17 Dec 2005 14:03:54 -0500 (EST) CC: Simon Riggs , =?ISO-8859-1?Q?P=E5l_Stenslet?= , 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, score=0.116 required=5 tests=[AWL=0.116] X-Spam-Score: 0.116 X-Spam-Level: X-Archive-Number: 200512/430 X-Sequence-Number: 16251 Tom Lane wrote: > Bruce Momjian writes: > > Added to TODO: > > * Allow star join optimizations > > See my response to Simon for reasons why this doesn't seem like a > particularly good TODO item. Yes, TODO removed. I thought we were waiting for bitmap joins before trying star joins. I did not realize they might never be a win. -- 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 Sat Dec 17 15:05:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9E0ED9DCC0E for ; Sat, 17 Dec 2005 15:05:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31719-02 for ; Sat, 17 Dec 2005 15:05:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id 24DEF9DCC1C for ; Sat, 17 Dec 2005 15:05:34 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Sat, 17 Dec 2005 14:05:28 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 17 Dec 2005 14:05:28 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Sat, 17 Dec 2005 19:05:27 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sat, 17 Dec 2005 11:05:27 -0800 Subject: Re: Should Oracle outperform PostgreSQL on a complex From: "Luke Lonergan" To: "Tom Lane" , "Simon Riggs" , "Bruce Momjian" , "P=?ISO-8859-1?B?5Q==?=l Stenslet" , pgsql-performance@postgresql.org cc: "Ayush Parashar" Message-ID: Thread-Topic: [PERFORM] Should Oracle outperform PostgreSQL on a complex Thread-Index: AcYDOmXNpqrVm3U8Q+q7MIqnCPtJCwAAnFkk In-Reply-To: <9010.1134845227@sss.pgh.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 17 Dec 2005 19:05:28.0115 (UTC) FILETIME=[D7DD1830:01C6033C] X-WSS-ID: 6FBABEF22345170332-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/431 X-Sequence-Number: 16252 Tom, On 12/17/05 10:47 AM, "Tom Lane" wrote: > BTW, some experimentation suggests that in fact a star join is already > slower than the "regular" plan in 8.1. You can force a star-join plan > to be generated like this: Cool! We've got Paal's test case in the queue to run, it's taking us some time to get to it, possibly by next week we should be able to run some of these cases: 1) 8.1.1 btree with bitmap scan 2) 8.1.1 on-disk bitmap with direct AND operations 3) (2) with forced star transformation (materialize) We'll also be trying the same things with the CVS tip of Bizgres MPP, probably over X-mas. We should be able to handily beat Oracle's 3 second number. - Luke From pgsql-performance-owner@postgresql.org Wed Dec 21 01:02:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 83C579DC88F for ; Sat, 17 Dec 2005 21:09:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69133-01 for ; Sat, 17 Dec 2005 21:09:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id C70DD9DC849 for ; Sat, 17 Dec 2005 21:08:57 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0CB14308DA; Sun, 18 Dec 2005 02:09:01 +0100 (MET) From: "Ben Trewern" X-Newsgroups: pgsql.performance Subject: Speed of different procedural language Date: Sun, 18 Dec 2005 01:10:21 -0000 Organization: Hub.Org Networking Services Lines: 14 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/523 X-Sequence-Number: 16344 I have a few small functions which I need to write. They will be hopefully quick running but will happen on almost every delete, insert and update on my database (for audit purposes). I know I should be writing these in C but that's a bit beyond me. I was going to try PL/Python or PL/Perl or even PL/Ruby. Has anyone any idea which language is fastest, or is the data access going to swamp the overhead of small functions? Thanks, Ben From pgsql-performance-owner@postgresql.org Sat Dec 17 22:02:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BA64E9DC9E3 for ; Sat, 17 Dec 2005 22:02:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73292-08 for ; Sat, 17 Dec 2005 22:02:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 3BA779DC9AA for ; Sat, 17 Dec 2005 22:02:47 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRO005M88CRT6@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Sun, 18 Dec 2005 15:02:51 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-134.dsl.clear.net.nz [218.101.29.134]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id BCF75B9FAC6; Sun, 18 Dec 2005 15:02:50 +1300 (NZDT) Date: Sun, 18 Dec 2005 15:02:48 +1300 From: Mark Kirkwood Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <8627.1134843222@sss.pgh.pa.us> To: Tom Lane Cc: Simon Riggs , Bruce Momjian , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Message-id: <43A4C348.7050703@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.975 required=5 tests=[AWL=-0.357, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.975 X-Spam-Level: X-Archive-Number: 200512/432 X-Sequence-Number: 16253 Tom Lane wrote: > Simon Riggs writes: > >>On Fri, 2005-12-16 at 23:28 -0500, Bruce Momjian wrote: >> >>>How are star joins different from what we do now? > > >>Methods: >>1. join all N small tables together in a cartesian product, then join to >>main Large table once (rather than N times) > > > Of course, the reason the current planner does not think of this is that > it does not consider clauseless joins unless there is no alternative. > > However, I submit that it wouldn't pick such a plan anyway, and should > not, because the idea is utterly stupid. The plan you currently get for > this sort of scenario is typically a nest of hash joins: > > QUERY PLAN > ------------------------------------------------------------------------ > Hash Join (cost=2.25..4652.25 rows=102400 width=16) > Hash Cond: ("outer".f1 = "inner".f1) > -> Hash Join (cost=1.12..3115.12 rows=102400 width=12) > Hash Cond: ("outer".f2 = "inner".f1) > -> Seq Scan on fact (cost=0.00..1578.00 rows=102400 width=8) > -> Hash (cost=1.10..1.10 rows=10 width=4) > -> Seq Scan on d2 (cost=0.00..1.10 rows=10 width=4) > -> Hash (cost=1.10..1.10 rows=10 width=4) > -> Seq Scan on d1 (cost=0.00..1.10 rows=10 width=4) > (9 rows) > > This involves only one scan of the fact table. As each row is pulled up > through the nest of hash joins, we hash one dimension key and join to > one small table at each level. This is at worst the same amount of work > as hashing all the keys at once and probing a single cartesian-product > hashtable, probably less work (fewer wasted key-comparisons). And > definitely less memory. You do have to keep your eye on the ball that > you don't waste a lot of overhead propagating the row up through > multiple join levels, but we got rid of most of the problem there in > 8.1 via the introduction of "virtual tuple slots". If this isn't fast > enough yet, it'd make more sense to invest effort in further cutting the > executor's join overhead (which of course benefits *all* plan types) > than in trying to make the planner choose a star join. > > >>2. transform joins into subselects, then return subselect rows via an >>index bitmap. Joins are performed via a bitmap addition process. > > > This one might be interesting but it's not clear what you are talking > about. "Bitmap addition"? Yeah - the quoted method of "make a cartesian product of the dimensions and then join to the fact all at once" is not actually used (as written) in many implementations - probably for the reasons you are pointing out. I found these two papers whilst browsing: http://www.cs.brown.edu/courses/cs227/Papers/Indexing/O'NeilGraefe.pdf http://www.dama.upc.edu/downloads/jaguilar-2005-4.pdf They seem to be describing a more subtle method making use of join indexes and bitmapped indexes. If I understand it correctly, the idea is to successively build up a list (hash / bitmap) of fact RIDS that will satisfy the query, and when complete actually perform the join and construct tuples. The goal being similar in intent to the star join method (i.e. access the fact table as little and as "late" as possible), but avoiding the cost of actually constructing the dimension cartesian product. cheers Mark From pgsql-performance-owner@postgresql.org Sat Dec 17 22:11:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7B5319DC8A0 for ; Sat, 17 Dec 2005 22:11:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73294-09 for ; Sat, 17 Dec 2005 22:11:18 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.192]) by postgresql.org (Postfix) with ESMTP id DF3739DC88F for ; Sat, 17 Dec 2005 22:11:12 -0400 (AST) Received: by nproxy.gmail.com with SMTP id i2so297537nfe for ; Sat, 17 Dec 2005 18:11:17 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Rz0nXueE8QjiNgl7qCO7dbdmDniX63jEkIRaA90+W8d8eUuhZc2U+Luyv9i2FM7HPHKcvv1WtNZafNsUiSVyltD9XrboUI8yXtBRYKNLGpcbkqrSgqYOh82C4L7OgfCnauWnM4SjJrPq0f656GN0pKwN/wWgndW1Dls6Waz8e/c= Received: by 10.48.240.13 with SMTP id n13mr194874nfh; Sat, 17 Dec 2005 18:11:16 -0800 (PST) Received: by 10.48.164.6 with HTTP; Sat, 17 Dec 2005 18:11:16 -0800 (PST) Message-ID: <45b42ce40512171811r293e254ex94a4e69910f80466@mail.gmail.com> Date: Sun, 18 Dec 2005 02:11:16 +0000 From: Harry Jackson To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL performance question. In-Reply-To: <43A0CEAA.6060800@familyhealth.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline References: <45b42ce40512141751i6829eec0q6d088b1ec5bc27b4@mail.gmail.com> <43A0CEAA.6060800@familyhealth.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.09 required=5 tests=[AWL=0.090] X-Spam-Score: 0.09 X-Spam-Level: X-Archive-Number: 200512/433 X-Sequence-Number: 16254 T24gMTIvMTUvMDUsIENocmlzdG9waGVyIEtpbmdzLUx5bm5lIDxjaHJpc2tsQGZhbWlseWhlYWx0 aC5jb20uYXU+IHdyb3RlOgo+IFBvc3RncmVTUUwgOC4xLjEgc2hvdWxkIGdpdmUgeW91IGdyZWF0 ZXIgcGVyZm9ybWFuY2UuLi4KCkluZGVlZCBpdCBoYXMuCgpJIGFtIHNlZWluZyBhIDI1JSBpbmNy ZWFzZSBpbiBvbmUgcGFydGljdWxhciBzZWxlY3Qgc3RhdGVtZW50LiBUaGlzCmluY3JlYXNlcyB0 byAzMiUgd2l0aAoKc2V0IGVuYWJsZV9iaXRtYXBzY2FuIHRvIG9mZjsKCkkgYWxzbyByYW4gYSB0 ZXN0IHNjcmlwdCBmdWxsIG9mIGNvbW1vbiBTUUwgdGhhdCB0aGUgYXBwbGljYXRpb24gcnVucy4K SSBhZGRlZCBzb21lIGV4dHJhIFNRTCB0byBidXJzdCB0aGUgY2FjaGUgYSBiaXQgYW5kIEkgaGF2 ZSBtYW5hZ2VkIHRvCmdldCBhbiBhdmVyYWdlIDE0JSBpbmNyZWFzZS4KCkkgaGF2ZSBub3Qgc3Rh cnRlZCB0d2Vha2luZyB0aGluZ3MgdGhhdCBtdWNoIHlldCB0byB0YWtlIGFkdmFudGFnZSBvZgp0 aGUgbmV3IHBhcmFtZXRlcnMgc28gSSBtYXkgeWV0IHNlZSBtb3JlIG9mIGFuIGluY3JlYXNlIGJ1 dCBpbml0aWFsCmluZGljYXRpb25zIGFyZSB0aGF0IHRoZSBjaGFuZ2VzIGZyb20gNy40LjcgdG8g OC4xLjEgYXJlIHNpZ25pZmljYW50LgoKVGhlIG9uZSB0aGluZyB0aGF0IG1heSBiZSBza2V3aW5n IHRoZXNlIHJlc3VsdHMgaXMgdGhhdCB0aGlzIHdhcwpjb21waWxlZCBhbmQgaW5zdGFsbGVkIGZy b20gc291cmNlIHdpdGgKCi4vY29uZmlndXJlIENGTEFHUz0nLU8yJyAtLXdpdGgtb3BlbnNzbCAt LWVuYWJsZS10aHJlYWQtc2FmZXR5CgpJIGFtIG5vdCBzdXJlIHdoYXQgdGhlIGRlZmF1bHQgRGVi aWFuIGJpbmFyeSBmb3IgNy40LjcgaXMgY29tcGlsZWQKd2l0aCBzbyB0aGlzIG1heSBoYXZlIGhh ZCBzb21lIGFmZmVjdC4KCi0tCkhhcnJ5Cmh0dHA6Ly93d3cuaGphY2tzb24ub3JnCmh0dHA6Ly93 d3cudWtsdWcuY28udWsK From pgsql-performance-owner@postgresql.org Sat Dec 17 22:18:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AB4B89DCC7F for ; Sat, 17 Dec 2005 22:18:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79674-02 for ; Sat, 17 Dec 2005 22:18:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 0CA799DCD75 for ; Sat, 17 Dec 2005 22:18:38 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Eno8H-0000gf-MY for pgsql-performance@postgresql.org; Sun, 18 Dec 2005 03:18:41 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Eno8G-0004Fa-00 for ; Sun, 18 Dec 2005 03:18:40 +0100 Date: Sun, 18 Dec 2005 03:18:40 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL performance question. [OT] Message-ID: <20051218021840.GA16308@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <45b42ce40512141751i6829eec0q6d088b1ec5bc27b4@mail.gmail.com> <43A0CEAA.6060800@familyhealth.com.au> <45b42ce40512171811r293e254ex94a4e69910f80466@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <45b42ce40512171811r293e254ex94a4e69910f80466@mail.gmail.com> X-Operating-System: Linux 2.6.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/434 X-Sequence-Number: 16255 On Sun, Dec 18, 2005 at 02:11:16AM +0000, Harry Jackson wrote: > The one thing that may be skewing these results is that this was > compiled and installed from source with > > ./configure CFLAGS='-O2' --with-openssl --enable-thread-safety > > I am not sure what the default Debian binary for 7.4.7 is compiled > with so this may have had some affect. This isn't a performance note, but you might be interested in hearing that there are being maintained official backports of 8.0 and 8.1 for Debian sarge (by Martin Pitt, the same person who maintains both the sarge and sid versions). Take a look at http://people.debian.org/~mpitt/packages/sarge-backports/ It might be more comfortable in the long run than maintaining your own source installation, although YMMV. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Sun Dec 18 00:07:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7E2FD9DCC30 for ; Sun, 18 Dec 2005 00:07:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95429-08 for ; Sun, 18 Dec 2005 00:07:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 8EC619DCC49 for ; Sun, 18 Dec 2005 00:07:46 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRO00AQIE4X99@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Sun, 18 Dec 2005 17:07:45 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-134.dsl.clear.net.nz [218.101.29.134]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 42337140927B; Sun, 18 Dec 2005 17:07:44 +1300 (NZDT) Date: Sun, 18 Dec 2005 17:07:41 +1300 From: Mark Kirkwood Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <8627.1134843222@sss.pgh.pa.us> To: Tom Lane Cc: Simon Riggs , Bruce Momjian , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Message-id: <43A4E08D.2050708@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.977 required=5 tests=[AWL=-0.355, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.977 X-Spam-Level: X-Archive-Number: 200512/435 X-Sequence-Number: 16256 Tom Lane wrote: >>2. transform joins into subselects, then return subselect rows via an >>index bitmap. Joins are performed via a bitmap addition process. Looks like 8.1 pretty much does this right now: First the basic star: EXPLAIN ANALYZE SELECT d0.dmth, d1.dat, count(f.fval ) FROM dim0 AS d0, dim1 AS d1, fact0 AS f WHERE d0.d0key = f.d0key AND d1.d1key = f.d1key AND d0.dyr BETWEEN 2010 AND 2015 AND d1.dattyp BETWEEN '10th measure type' AND '14th measure type' GROUP BY d0.dmth, d1.dat ; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=334842.41..334846.53 rows=329 width=37) (actual time=144317.960..144318.814 rows=120 loops=1) -> Hash Join (cost=145.72..334636.91 rows=27400 width=37) (actual time=1586.363..142831.025 rows=201600 loops=1) Hash Cond: ("outer".d0key = "inner".d0key) -> Hash Join (cost=89.72..333279.41 rows=137001 width=37) (actual time=1467.322..135585.317 rows=1000000 loops=1) Hash Cond: ("outer".d1key = "inner".d1key) -> Seq Scan on fact0 f (cost=0.00..281819.45 rows=10000045 width=12) (actual time=120.881..70364.473 rows=10000000 loops=1) -> Hash (cost=89.38..89.38 rows=137 width=33) (actual time=24.822..24.822 rows=660 loops=1) -> Index Scan using dim1_dattyp on dim1 d1 (cost=0.00..89.38 rows=137 width=33) (actual time=0.502..19.374 rows=660 loops=1) Index Cond: (((dattyp)::text >= '10th measure type'::text) AND ((dattyp)::text <= '14th measure type'::text)) -> Hash (cost=51.00..51.00 rows=2000 width=8) (actual time=31.620..31.620 rows=2016 loops=1) -> Index Scan using dim0_dyr on dim0 d0 (cost=0.00..51.00 rows=2000 width=8) (actual time=0.379..17.377 rows=2016 loops=1) Index Cond: ((dyr >= 2010) AND (dyr <= 2015)) Total runtime: 144320.588 ms (13 rows) Now apply the star transformation: EXPLAIN ANALYZE SELECT d0.dmth, d1.dat, count(f.fval ) FROM dim0 AS d0, dim1 AS d1, fact0 AS f WHERE d0.d0key = f.d0key AND d1.d1key = f.d1key AND d0.dyr BETWEEN 2010 AND 2015 AND d1.dattyp BETWEEN '10th measure type' AND '14th measure type' AND f.d0key IN (SELECT cd0.d0key FROM dim0 cd0 WHERE cd0.dyr BETWEEN 2010 AND 2015) AND f.d1key IN (SELECT cd1.d1key FROM dim1 cd1 WHERE cd1.dattyp BETWEEN '10th measure type' AND '14th measure type') GROUP BY d0.dmth, d1.dat ; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=129230.89..129231.83 rows=75 width=37) (actual time=39798.192..39799.015 rows=120 loops=1) -> Nested Loop IN Join (cost=149.44..129230.33 rows=75 width=37) (actual time=269.919..38125.520 rows=201600 loops=1) -> Hash Join (cost=147.43..128171.03 rows=375 width=45) (actual time=269.516..27342.866 rows=201600 loops=1) Hash Cond: ("outer".d0key = "inner".d0key) -> Nested Loop (cost=91.43..128096.03 rows=2000 width=37) (actual time=152.084..19869.365 rows=1000000 loops=1) -> Hash Join (cost=91.43..181.52 rows=2 width=37) (actual time=29.931..46.339 rows=660 loops=1) Hash Cond: ("outer".d1key = "inner".d1key) -> Index Scan using dim1_dattyp on dim1 d1 (cost=0.00..89.38 rows=137 width=33) (actual time=0.516..7.683 rows=660 loops=1) Index Cond: (((dattyp)::text >= '10th measure type'::text) AND ((dattyp)::text <= '14th measure type'::text)) -> Hash (cost=91.09..91.09 rows=137 width=4) (actual time=29.238..29.238 rows=660 loops=1) -> HashAggregate (cost=89.72..91.09 rows=137 width=4) (actual time=20.940..24.900 rows=660 loops=1) -> Index Scan using dim1_dattyp on dim1 cd1 (cost=0.00..89.38 rows=137 width=4) (actual time=0.042..14.841 rows=660 loops=1) Index Cond: (((dattyp)::text >= '10th measure type'::text) AND ((dattyp)::text <= '14th measure type'::text)) -> Index Scan using fact0_d1key on fact0 f (cost=0.00..62707.26 rows=100000 width=12) (actual time=0.205..12.691 rows=1515 loops=660) Index Cond: ("outer".d1key = f.d1key) -> Hash (cost=51.00..51.00 rows=2000 width=8) (actual time=31.264..31.264 rows=2016 loops=1) -> Index Scan using dim0_dyr on dim0 d0 (cost=0.00..51.00 rows=2000 width=8) (actual time=0.339..16.885 rows=2016 loops=1) Index Cond: ((dyr >= 2010) AND (dyr <= 2015)) -> Bitmap Heap Scan on dim0 cd0 (cost=2.00..2.81 rows=1 width=4) (actual time=0.031..0.031 rows=1 loops=201600) Recheck Cond: ("outer".d0key = cd0.d0key) Filter: ((dyr >= 2010) AND (dyr <= 2015)) -> Bitmap Index Scan on dim0_d0key (cost=0.00..2.00 rows=1 width=0) (actual time=0.015..0.015 rows=1 loops=201600) Index Cond: ("outer".d0key = cd0.d0key) Total runtime: 39800.294 ms (24 rows) The real run times are more like 24s and 9s, but you get the idea. Cheers Mark From pgsql-performance-owner@postgresql.org Sun Dec 18 01:12:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5F9999DC9E0 for ; Sun, 18 Dec 2005 01:12:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15928-03 for ; Sun, 18 Dec 2005 01:12:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 7F8EE9DC9D7 for ; Sun, 18 Dec 2005 01:12:02 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9C2803094A; Sun, 18 Dec 2005 06:11:59 +0100 (MET) From: James Klo X-Newsgroups: pgsql.performance Subject: make bulk deletes faster? Date: Sat, 17 Dec 2005 21:10:40 -0800 Organization: Hub.Org Networking Services Lines: 146 Message-ID: X-Complaints-To: usenet@news.hub.org User-Agent: MT-NewsWatcher/3.4 (PPC Mac OS X) To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/436 X-Sequence-Number: 16257 I have the following table: CREATE TABLE timeblock ( timeblockid int8 NOT NULL, starttime timestamp, endtime timestamp, duration int4, blocktypeid int8, domain_id int8, create_date timestamp, revision_date timestamp, scheduleid int8, CONSTRAINT timeblock_pkey PRIMARY KEY (timeblockid), CONSTRAINT fk25629e03312570b FOREIGN KEY (blocktypeid) REFERENCES blocktype (blocktypeid) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk25629e09be84177 FOREIGN KEY (domain_id) REFERENCES wa_common_domain (domain_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH OIDS; CREATE INDEX timeblock_blocktype_idx ON timeblock USING btree (blocktypeid); CREATE INDEX timeblock_date_idx ON timeblock USING btree (starttime, endtime); CREATE INDEX timeblockepoch_idx ON timeblock USING btree (date_trunc('minute'::text, starttime), (date_part('epoch'::text, date_trunc('minute'::text, starttime)) * 1000::double precision), date_trunc('minute'::text, endtime), (date_part('epoch'::text, date_trunc('minute'::text, endtime)) * 1000::double precision)); CREATE INDEX timeblockhourmin_idx ON timeblock USING btree (date_part('hour'::text, starttime), date_part('minute'::text, starttime), date_part('hour'::text, endtime), date_part('minute'::text, endtime)); CREATE INDEX timeblockid_idx ON timeblock USING btree (timeblockid); There are also indexes on wa_common_domain and blocktype on pkeys. explain analyze delete from timeblock where timeblockid = 666666 Index Scan using timeblockid_idx on timeblock (cost=0.00..5.28 rows=1 width=6) (actual time=0.022..0.022 rows=0 loops=1) Index Cond: (timeblockid = 666666) Total runtime: 0.069 ms I need to routinely move data from the timeblock table to an archive table with the same schema named timeblock_archive. I really need this to happen as quickly as possible, as the archive operation appears to really tax the db server... I'd like some suggestions on how to get the deletes to happen faster, as while deleting individually appears to extremely fast, when I go to delete lots of rows the operation takes an extremely long time to complete (5000 rows takes about 3 minutes, 1000000 rows takes almost close to 4 hours or more depending upon server load; wall time btw). i've tried several different approaches doing the delete and I can't seem to make it much faster... anyone have any ideas? The approaches I've taken both use a temp table to define the set that needs to be deleted. Here's what I've tried: Attempt 1: ---------- delete from timeblock where timeblockid in (select timeblockid from timeblock_tmp) Attempt 2: ---------- num_to_delete := (select count(1) from tmp_timeblock); RAISE DEBUG 'archiveDailyData(%): need to delete from timeblock [% rows]', timestart, num_to_delete; cur_offset := 0; while cur_offset < num_to_delete loop delete from timeblock where timeblockid in (select timeblockid from tmp_timeblock limit 100 offset cur_offset); get diagnostics num_affected = ROW_COUNT; RAISE DEBUG 'archiveDailyData(%): delete from timeblock [% rows] cur_offset = %', timestart, num_affected, cur_offset; cur_offset := cur_offset + 100; end loop; Attempt 3: ---------- num_to_delete := (select count(1) from tmp_timeblock); cur_offset := num_to_delete; RAISE DEBUG 'archiveDailyData(%): need to delete from timeblock [% rows]', timestart, num_to_delete; open del_cursor for select timeblockid from tmp_timeblock; loop fetch del_cursor into del_pkey; if not found then exit; else delete from timeblock where timeblockid = del_pkey; get diagnostics num_affected = ROW_COUNT; cur_offset := cur_offset - num_affected; if cur_offset % 1000 = 0 then RAISE DEBUG 'archiveDailyData(%): delete from timeblock [% left]', timestart, cur_offset; end if; end if; end loop; close del_cursor; I've considered using min(starttime) and max(starttime) from the temp table and doing: delete from timeblock where starttime between min and max; however, I'm concerned about leaving orphan data, deleting too much data running into foreign key conflicts, etc. dropping the indexes on timeblock could be bad, as this table recieves has a high volume on reads, inserts & updates. Any one have any suggestions? Thanks, Jim K From pgsql-performance-owner@postgresql.org Sun Dec 18 02:50:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2ABF39DCC88 for ; Sun, 18 Dec 2005 02:50:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30231-02 for ; Sun, 18 Dec 2005 02:50:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id BD0209DCC49 for ; Sun, 18 Dec 2005 02:50:42 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EnsNO-00063M-00; Sun, 18 Dec 2005 01:50:34 -0500 To: Tom Lane Cc: Simon Riggs , Bruce Momjian ,=?iso-8859-1?q??= =?iso-8859-1?q? P�l Stenslet?= , pgsql-performance@postgresql.org Subject: Re: Should Oracle outperform PostgreSQL on a complex References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> In-Reply-To: <8627.1134843222@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 18 Dec 2005 01:50:33 -0500 Message-ID: <8764pmc30m.fsf@stark.xeocode.com> Lines: 94 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E5 hex) in message header 'Cc': Cc: ...1?q??=\n =?iso-8859-1?q?\t P\345l Stenslet?= writes: > Simon Riggs writes: > > On Fri, 2005-12-16 at 23:28 -0500, Bruce Momjian wrote: > >> How are star joins different from what we do now? > > > Methods: > > 1. join all N small tables together in a cartesian product, then join to > > main Large table once (rather than N times) > > Of course, the reason the current planner does not think of this is that > it does not consider clauseless joins unless there is no alternative. > > However, I submit that it wouldn't pick such a plan anyway, and should > not, because the idea is utterly stupid. The plan you currently get for > this sort of scenario is typically a nest of hash joins: > > QUERY PLAN > ------------------------------------------------------------------------ > Hash Join (cost=2.25..4652.25 rows=102400 width=16) > Hash Cond: ("outer".f1 = "inner".f1) > -> Hash Join (cost=1.12..3115.12 rows=102400 width=12) > Hash Cond: ("outer".f2 = "inner".f1) > -> Seq Scan on fact (cost=0.00..1578.00 rows=102400 width=8) > -> Hash (cost=1.10..1.10 rows=10 width=4) > -> Seq Scan on d2 (cost=0.00..1.10 rows=10 width=4) > -> Hash (cost=1.10..1.10 rows=10 width=4) > -> Seq Scan on d1 (cost=0.00..1.10 rows=10 width=4) > (9 rows) I realize DSS systems often expect to run queries using sequential scans but perhaps the point of this particular plan is to exploit indexes? (I think particularly bitmap indexes but ...) So in this case, you would expect an index scan of d1 to pull out just the records that d1 says should be included, and an index scan of d2 to pull out just the records that d2 says should be included, then finally a nested loop index lookup of f1 for the primary keys that show up in both the d1 scan and the d2 scan. So in the following it would be nice if the index scan on f didn't have to appear until *after* all the hashes were checked for the dimenions, not after only one of them. This would be even nicer if instead of hashes a bitmap data structure could be built and bitmap operations used to do the joins, since no other columns from these dimension tables need to be preserved to be included in the select list. It would be even better if there were an on-disk representation of these bitmap data structures but I don't see how to do that with MVCC at all. slo=> explain select * from fact as f where fact_id in (select fact_id from d d1 where dim_id = 4) and fact_id in (select fact_id from d d2 where dim_id = 29) and fact_id in (select fact_id from d d3 where dim_id = 57); QUERY PLAN ------------------------------------------------------------------------------------------------ Hash IN Join (cost=15.77..21.86 rows=1 width=110) Hash Cond: ("outer".fact_id = "inner".fact_id) -> Hash IN Join (cost=10.51..16.59 rows=1 width=118) Hash Cond: ("outer".fact_id = "inner".fact_id) -> Nested Loop (cost=5.26..11.31 rows=2 width=114) -> HashAggregate (cost=5.26..5.26 rows=2 width=4) -> Index Scan using di on d d2 (cost=0.00..5.25 rows=3 width=4) Index Cond: (dim_id = 29) -> Index Scan using fact_pkey on fact f (cost=0.00..3.01 rows=1 width=110) Index Cond: (f.fact_id = "outer".fact_id) -> Hash (cost=5.25..5.25 rows=3 width=4) -> Index Scan using di on d d1 (cost=0.00..5.25 rows=3 width=4) Index Cond: (dim_id = 4) -> Hash (cost=5.25..5.25 rows=3 width=4) -> Index Scan using di on d d3 (cost=0.00..5.25 rows=3 width=4) Index Cond: (dim_id = 57) (16 rows) > > 2. transform joins into subselects, then return subselect rows via an > > index bitmap. Joins are performed via a bitmap addition process. > > This one might be interesting but it's not clear what you are talking > about. "Bitmap addition"? Well "transform joins into subselects" is a red herring. Joins and subselects are two ways of spelling special cases of the same thing and internally they ought to go through the same codepaths. They don't in Postgres but judging by the plans it produces I believe they do at least in a lot of cases in Oracle. That's sort of the whole point of the phrase "star join". What the user really wants is a single table joined to a bunch of small tables. There's no way to write that in SQL due to the limitations of the language but a bunch of subqueries expresses precisely the same concept (albeit with another set of language limitations which luckily don't impact this particular application). -- greg From pgsql-performance-owner@postgresql.org Sun Dec 18 06:27:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AD4589DCC84 for ; Sun, 18 Dec 2005 06:27:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60230-06 for ; Sun, 18 Dec 2005 06:27:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 9495B9DCC88 for ; Sun, 18 Dec 2005 06:27:49 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id 3FCCA26B6BF; Sun, 18 Dec 2005 10:27:49 +0000 (GMT) Subject: Re: Should Oracle outperform PostgreSQL on a complex From: Simon Riggs To: Mark Kirkwood Cc: Tom Lane , Bruce Momjian , =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org In-Reply-To: <43A4C348.7050703@paradise.net.nz> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> <43A4C348.7050703@paradise.net.nz> Content-Type: text/plain Date: Sun, 18 Dec 2005 10:27:50 +0000 Message-Id: <1134901670.2964.140.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.022 required=5 tests=[AWL=0.022] X-Spam-Score: 0.022 X-Spam-Level: X-Archive-Number: 200512/438 X-Sequence-Number: 16259 On Sun, 2005-12-18 at 15:02 +1300, Mark Kirkwood wrote: > Yeah - the quoted method of "make a cartesian product of the dimensions > and then join to the fact all at once" is not actually used (as written) > in many implementations But it is used in some, which is why I mentioned it. I gave two implementations, that is just (1) > - probably for the reasons you are pointing out. > I found these two papers whilst browsing: > > > http://www.cs.brown.edu/courses/cs227/Papers/Indexing/O'NeilGraefe.pdf > http://www.dama.upc.edu/downloads/jaguilar-2005-4.pdf > > > They seem to be describing a more subtle method making use of join > indexes and bitmapped indexes. Which is the option (2) I described. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sun Dec 18 09:48:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 810639DC809 for ; Sun, 18 Dec 2005 09:48:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92720-07 for ; Sun, 18 Dec 2005 09:48:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 52B239DC800 for ; Sun, 18 Dec 2005 09:48:50 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id 17C1E26B1A9; Sun, 18 Dec 2005 13:48:50 +0000 (GMT) Subject: Re: Should Oracle outperform PostgreSQL on a complex From: Simon Riggs To: Tom Lane Cc: Bruce Momjian , =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org In-Reply-To: <8627.1134843222@sss.pgh.pa.us> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> Content-Type: text/plain Date: Sun, 18 Dec 2005 13:48:52 +0000 Message-Id: <1134913732.2964.164.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/439 X-Sequence-Number: 16260 On Sat, 2005-12-17 at 13:13 -0500, Tom Lane wrote: > Simon Riggs writes: > > On Fri, 2005-12-16 at 23:28 -0500, Bruce Momjian wrote: > >> How are star joins different from what we do now? > > > Methods: > > 1. join all N small tables together in a cartesian product, then join to > > main Large table once (rather than N times) > > Of course, the reason the current planner does not think of this is that > it does not consider clauseless joins unless there is no alternative. Understood > The plan you currently get for > this sort of scenario is typically a nest of hash joins: > > QUERY PLAN > ------------------------------------------------------------------------ > Hash Join (cost=2.25..4652.25 rows=102400 width=16) > Hash Cond: ("outer".f1 = "inner".f1) > -> Hash Join (cost=1.12..3115.12 rows=102400 width=12) > Hash Cond: ("outer".f2 = "inner".f1) > -> Seq Scan on fact (cost=0.00..1578.00 rows=102400 width=8) > -> Hash (cost=1.10..1.10 rows=10 width=4) > -> Seq Scan on d2 (cost=0.00..1.10 rows=10 width=4) > -> Hash (cost=1.10..1.10 rows=10 width=4) > -> Seq Scan on d1 (cost=0.00..1.10 rows=10 width=4) > (9 rows) > > This involves only one scan of the fact table. As each row is pulled up > through the nest of hash joins, we hash one dimension key and join to > one small table at each level. Understood > This is at worst the same amount of work > as hashing all the keys at once and probing a single cartesian-product > hashtable, probably less work (fewer wasted key-comparisons). And > definitely less memory. You do have to keep your eye on the ball that > you don't waste a lot of overhead propagating the row up through > multiple join levels, but we got rid of most of the problem there in > 8.1 via the introduction of "virtual tuple slots". If this isn't fast > enough yet, it'd make more sense to invest effort in further cutting the > executor's join overhead (which of course benefits *all* plan types) > than in trying to make the planner choose a star join. That join type is used when an index-organised table is available, so that a SeqScan of the larger table can be avoided. I'd say the plan would make sense if the columns of the cartesian product match a multi-column index on the larger table that would not ever be used unless sufficient columns are restricted in each lookup. That way you are able to avoid the SeqScan that occurs for the multiple nested Hash Join case. (Clearly, normal selectivity rules apply on the use of the index in this way). So I think that plan type still can be effective in some circumstances. Mind you: building an N-way index on a large table isn't such a good idea, unless you can partition the tables and still use a join. Which is why I've not centred on this case as being important before now. My understanding: Teradata and DB2 use this. This may be covered by patents. > > 2. transform joins into subselects, then return subselect rows via an > > index bitmap. Joins are performed via a bitmap addition process. > > This one might be interesting but it's not clear what you are talking > about. "Bitmap addition"? Ref: "Re: [HACKERS] slow IN() clause for many cases" Required Transforms: join -> IN (subselect) -> = ANY(ARRAY(subselect)) ending with the ability to use an bitmap index scan (which clearly requires a run-time, not a plan-time evaluation - though the distinction is minor if you go straight from plan->execute as is the case with most Data Warehouse queries). If you do this for all joins, you can then solve the problem with a Bitmap And step, which is what I meant by "addition". If you have need columns in the result set from the smaller tables you can get them by joining the result set back to the smaller tables again. My understanding: Oracle uses this. This may be covered by patents. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sun Dec 18 12:30:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A3BC69DC847 for ; Sun, 18 Dec 2005 12:30:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32663-02 for ; Sun, 18 Dec 2005 12:29:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.151]) by postgresql.org (Postfix) with ESMTP id DDB3F9DC833 for ; Sun, 18 Dec 2005 12:29:58 -0400 (AST) Received: from lifebook.aspen (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc11) with ESMTP id <2005121816295801300c6pcbe>; Sun, 18 Dec 2005 16:29:58 +0000 Content-Disposition: inline From: Juan Casero To: pgsql-performance@postgresql.org Subject: PostgreSQL and Ultrasparc T1 Date: Sun, 18 Dec 2005 11:35:15 -0500 User-Agent: KMail/1.8.2 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200512181135.15202.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.319 required=5 tests=[DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 2.319 X-Spam-Level: ** X-Archive-Number: 200512/440 X-Sequence-Number: 16261 Hi - Can anyone tell me how well PostgreSQL 8.x performs on the new Sun Ultrasparc T1 processor and architecture on Solaris 10? I have a custom built retail sales reporting that I developed using PostgreSQL 7.48 and PHP on a Fedora Core 3 intel box. I want to scale this application upwards to handle a database that might grow to a 100 GB. Our company is green mission conscious now so I was hoping I could use that to convince management to consider a Sun Ultrasparc T1 or T2 system provided that if I can get the best performance out of it on PostgreSQL. So will newer versions of PostgreSQL (8.1.x) be able to take of advantage of the multiple cores on a T1 or T2? I cannot change the database and this will be a hard sell unless I can convince them that the performance advantages are too good to pass up. The company is moving in the Win32 direction and so I have to provide rock solid reasons for why I want to use Solaris Sparc on a T1 or T2 server for this database application instead of Windows on SQL Server. Thanks, Juan ------------------------------------------------------- From pgsql-performance-owner@postgresql.org Sun Dec 18 13:12:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ABB649DC847 for ; Sun, 18 Dec 2005 13:12:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70383-05 for ; Sun, 18 Dec 2005 13:12:43 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by postgresql.org (Postfix) with ESMTP id 142F09DC833 for ; Sun, 18 Dec 2005 13:12:41 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so894702wri for ; Sun, 18 Dec 2005 09:12:41 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EjVMWUuno5Hx0f75RFl5qPPqh398NnWk322LHYVkfRL8gBvH2+zTMW/ZK6hqo+9jCBQsKUWjNA6VQ0WXgNfE5Qr7rmKO9Ns+LMpfa7LjvGSTXFk01afy3ZXbnUVKHNaWxiFCcKWVLa4TmimchIoY4wf3Hw9392xG6FsJHBFMSyM= Received: by 10.54.127.9 with SMTP id z9mr232237wrc; Sun, 18 Dec 2005 09:12:41 -0800 (PST) Received: by 10.54.120.18 with HTTP; Sun, 18 Dec 2005 09:12:41 -0800 (PST) Message-ID: <59d991c40512180912lf6d8455ydefb8aac54e8ac73@mail.gmail.com> Date: Sun, 18 Dec 2005 12:12:41 -0500 From: Christopher Petrilli To: Juan Casero Subject: Re: PostgreSQL and Ultrasparc T1 Cc: pgsql-performance@postgresql.org In-Reply-To: <200512181135.15202.caseroj@comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512181135.15202.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/441 X-Sequence-Number: 16262 On 12/18/05, Juan Casero wrote: > Can anyone tell me how well PostgreSQL 8.x performs on the new Sun Ultras= parc > T1 processor and architecture on Solaris 10? I have a custom built reta= il > sales reporting that I developed using PostgreSQL 7.48 and PHP on a Fedor= a > Core 3 intel box. I want to scale this application upwards to handle a > database that might grow to a 100 GB. Our company is green mission consc= ious > now so I was hoping I could use that to convince management to consider a= Sun > Ultrasparc T1 or T2 system provided that if I can get the best performanc= e > out of it on PostgreSQL. So will newer versions of PostgreSQL (8.1.x) be > able to take of advantage of the multiple cores on a T1 or T2? I canno= t > change the database and this will be a hard sell unless I can convince th= em > that the performance advantages are too good to pass up. The company is > moving in the Win32 direction and so I have to provide rock solid reasons= for > why I want to use Solaris Sparc on a T1 or T2 server for this database > application instead of Windows on SQL Server. I do not know that anyone outside pilot orgs have received their orders for the new T1 machines, so real world experience will not be available yet. The big question is whether or not it manages the processors only for threads (in which case Postgresql won't benefit much) or for processes as well. PostgreSQL takes a "process-parallel" approach to parallelism, not thread-level. There are lost of historical reasons, but, that's just hte way it is for now. Chris -- | Christopher Petrilli | petrilli@gmail.com From pgsql-performance-owner@postgresql.org Sun Dec 18 13:54:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 984E09DC846 for ; Sun, 18 Dec 2005 13:54:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83644-07 for ; Sun, 18 Dec 2005 13:54:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id BCD1B9DC851 for ; Sun, 18 Dec 2005 13:53:52 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id 3AF3426BF76; Sun, 18 Dec 2005 17:53:25 +0000 (GMT) Subject: Re: Should Oracle outperform PostgreSQL on a complex From: Simon Riggs To: Mark Kirkwood Cc: Tom Lane , Bruce Momjian , =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org In-Reply-To: <43A4E08D.2050708@paradise.net.nz> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> <43A4E08D.2050708@paradise.net.nz> Content-Type: text/plain Date: Sun, 18 Dec 2005 17:53:27 +0000 Message-Id: <1134928407.2964.177.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.023 required=5 tests=[AWL=0.023] X-Spam-Score: 0.023 X-Spam-Level: X-Archive-Number: 200512/442 X-Sequence-Number: 16263 On Sun, 2005-12-18 at 17:07 +1300, Mark Kirkwood wrote: > Tom Lane wrote: > > >>2. transform joins into subselects, then return subselect rows via an > >>index bitmap. Joins are performed via a bitmap addition process. > > Looks like 8.1 pretty much does this right now: Good analysis. 8.1 doesn't do: - the transforms sufficiently well (you just performed them manually) - doesn't AND together multiple bitmaps to assist with N-way joins Those aren't criticisms, just observations. Pal's original example was a 9-dimension join, so I think PostgreSQL does very well on making that run in 30 seconds. That's a complex example and I think upholds just how good things are right now. Anyway, back to the starting point: IMHO there is an additional optimisation that can be performed to somehow speed up Single large table-many small table joins. And we have some clues as to how we might do that. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sun Dec 18 18:04:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 67EE59DC893 for ; Sun, 18 Dec 2005 18:04:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14786-01 for ; Sun, 18 Dec 2005 18:04:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 0F01B9DC800 for ; Sun, 18 Dec 2005 18:04:37 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRP005CFRZQKL@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 11:04:38 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-79.dsl.clear.net.nz [218.101.29.79]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 0C73B6BF41B; Mon, 19 Dec 2005 11:04:37 +1300 (NZDT) Date: Mon, 19 Dec 2005 11:04:37 +1300 From: Mark Kirkwood Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <1134928407.2964.177.camel@localhost.localdomain> To: Simon Riggs Cc: Tom Lane , Bruce Momjian , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Message-id: <43A5DCF5.8010604@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> <43A4E08D.2050708@paradise.net.nz> <1134928407.2964.177.camel@localhost.localdomain> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.336 required=5 tests=[AWL=0.336] X-Spam-Score: 0.336 X-Spam-Level: X-Archive-Number: 200512/443 X-Sequence-Number: 16264 Simon Riggs wrote: > On Sun, 2005-12-18 at 17:07 +1300, Mark Kirkwood wrote: > >>Tom Lane wrote: >> >> >>>>2. transform joins into subselects, then return subselect rows via an >>>>index bitmap. Joins are performed via a bitmap addition process. >> >>Looks like 8.1 pretty much does this right now: > > > Good analysis. > > 8.1 doesn't do: > - the transforms sufficiently well (you just performed them manually) Absolutely - I was intending to note that very point, but it got lost somewhere between brain and fingers :-) > - doesn't AND together multiple bitmaps to assist with N-way joins > Ah yes - I had overlooked that, good point! Cheers Mark From pgsql-performance-owner@postgresql.org Sun Dec 18 18:10:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 875869DC89B for ; Sun, 18 Dec 2005 18:10:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13342-09 for ; Sun, 18 Dec 2005 18:10:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id B23A99DC800 for ; Sun, 18 Dec 2005 18:10:01 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRP005NBS8RK7@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 11:10:03 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-79.dsl.clear.net.nz [218.101.29.79]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 52036558E0; Mon, 19 Dec 2005 11:10:02 +1300 (NZDT) Date: Mon, 19 Dec 2005 11:10:01 +1300 From: Mark Kirkwood Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <1134901670.2964.140.camel@localhost.localdomain> To: Simon Riggs Cc: Tom Lane , Bruce Momjian , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Message-id: <43A5DE39.6080901@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> <43A4C348.7050703@paradise.net.nz> <1134901670.2964.140.camel@localhost.localdomain> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.319 required=5 tests=[AWL=0.319] X-Spam-Score: 0.319 X-Spam-Level: X-Archive-Number: 200512/444 X-Sequence-Number: 16265 Simon Riggs wrote: > On Sun, 2005-12-18 at 15:02 +1300, Mark Kirkwood wrote: > > >>Yeah - the quoted method of "make a cartesian product of the dimensions >>and then join to the fact all at once" is not actually used (as written) >>in many implementations > > > But it is used in some, which is why I mentioned it. > > I gave two implementations, that is just (1) > > Sorry Simon, didn't mean to imply you shouldn't have mentioned it - was merely opining about its effectiveness.... >>- probably for the reasons you are pointing out. >>I found these two papers whilst browsing: >> >> >>http://www.cs.brown.edu/courses/cs227/Papers/Indexing/O'NeilGraefe.pdf >>http://www.dama.upc.edu/downloads/jaguilar-2005-4.pdf >> >> >>They seem to be describing a more subtle method making use of join >>indexes and bitmapped indexes. > > > Which is the option (2) I described. > Ok - I misunderstood you on this one, and thought you were describing the "star transformation" - upon re-reading, I see that yes, it's more or less a description of the O'Neil Graefe method. best wishes Mark From pgsql-performance-owner@postgresql.org Sun Dec 18 18:13:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D9AB19DC87D for ; Sun, 18 Dec 2005 18:13:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16550-04 for ; Sun, 18 Dec 2005 18:13:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id E02DC9DC814 for ; Sun, 18 Dec 2005 18:13:54 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRP0051ISF8KT@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 11:13:57 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-79.dsl.clear.net.nz [218.101.29.79]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id D605B964F50; Mon, 19 Dec 2005 11:13:55 +1300 (NZDT) Date: Mon, 19 Dec 2005 11:13:55 +1300 From: Mark Kirkwood Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <1134913732.2964.164.camel@localhost.localdomain> To: Simon Riggs Cc: Tom Lane , Bruce Momjian , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Message-id: <43A5DF23.5010504@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> <1134913732.2964.164.camel@localhost.localdomain> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.304 required=5 tests=[AWL=0.304] X-Spam-Score: 0.304 X-Spam-Level: X-Archive-Number: 200512/445 X-Sequence-Number: 16266 Simon Riggs wrote: > On Sat, 2005-12-17 at 13:13 -0500, Tom Lane wrote: > >>Simon Riggs writes: >> >>>On Fri, 2005-12-16 at 23:28 -0500, Bruce Momjian wrote: >>> >>>>How are star joins different from what we do now? >> >>>Methods: >>>1. join all N small tables together in a cartesian product, then join to >>>main Large table once (rather than N times) >> >>Of course, the reason the current planner does not think of this is that >>it does not consider clauseless joins unless there is no alternative. > > > Understood > > >> The plan you currently get for >>this sort of scenario is typically a nest of hash joins: >> >> QUERY PLAN >>------------------------------------------------------------------------ >> Hash Join (cost=2.25..4652.25 rows=102400 width=16) >> Hash Cond: ("outer".f1 = "inner".f1) >> -> Hash Join (cost=1.12..3115.12 rows=102400 width=12) >> Hash Cond: ("outer".f2 = "inner".f1) >> -> Seq Scan on fact (cost=0.00..1578.00 rows=102400 width=8) >> -> Hash (cost=1.10..1.10 rows=10 width=4) >> -> Seq Scan on d2 (cost=0.00..1.10 rows=10 width=4) >> -> Hash (cost=1.10..1.10 rows=10 width=4) >> -> Seq Scan on d1 (cost=0.00..1.10 rows=10 width=4) >>(9 rows) >> >>This involves only one scan of the fact table. As each row is pulled up >>through the nest of hash joins, we hash one dimension key and join to >>one small table at each level. > > > Understood > > >>This is at worst the same amount of work >>as hashing all the keys at once and probing a single cartesian-product >>hashtable, probably less work (fewer wasted key-comparisons). And >>definitely less memory. You do have to keep your eye on the ball that >>you don't waste a lot of overhead propagating the row up through >>multiple join levels, but we got rid of most of the problem there in >>8.1 via the introduction of "virtual tuple slots". If this isn't fast >>enough yet, it'd make more sense to invest effort in further cutting the >>executor's join overhead (which of course benefits *all* plan types) >>than in trying to make the planner choose a star join. > > > That join type is used when an index-organised table is available, so > that a SeqScan of the larger table can be avoided. > > I'd say the plan would make sense if the columns of the cartesian > product match a multi-column index on the larger table that would not > ever be used unless sufficient columns are restricted in each lookup. > That way you are able to avoid the SeqScan that occurs for the multiple > nested Hash Join case. (Clearly, normal selectivity rules apply on the > use of the index in this way). > > So I think that plan type still can be effective in some circumstances. > Mind you: building an N-way index on a large table isn't such a good > idea, unless you can partition the tables and still use a join. Which is > why I've not centred on this case as being important before now. > > My understanding: Teradata and DB2 use this. > FWIW - I think DB2 uses the successive fact RID buildup (i.e method 2), unfortunately I haven't got a working copy of DB2 in front of me to test. Cheers Mark From pgsql-performance-owner@postgresql.org Sun Dec 18 18:21:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 42E8A9DC8A5 for ; Sun, 18 Dec 2005 18:21:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17399-02 for ; Sun, 18 Dec 2005 18:21:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id B6B609DC89A for ; Sun, 18 Dec 2005 18:21:04 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id 6E31426C364; Sun, 18 Dec 2005 22:21:01 +0000 (GMT) Subject: Re: Should Oracle outperform PostgreSQL on a complex From: Simon Riggs To: Mark Kirkwood Cc: Tom Lane , Bruce Momjian , =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org In-Reply-To: <43A5DE39.6080901@paradise.net.nz> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> <43A4C348.7050703@paradise.net.nz> <1134901670.2964.140.camel@localhost.localdomain> <43A5DE39.6080901@paradise.net.nz> Content-Type: text/plain Date: Sun, 18 Dec 2005 22:21:04 +0000 Message-Id: <1134944464.2964.218.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/446 X-Sequence-Number: 16267 On Mon, 2005-12-19 at 11:10 +1300, Mark Kirkwood wrote: > >>I found these two papers whilst browsing: > >> > >> > >>http://www.cs.brown.edu/courses/cs227/Papers/Indexing/O'NeilGraefe.pdf > >>http://www.dama.upc.edu/downloads/jaguilar-2005-4.pdf > >> > >> > >>They seem to be describing a more subtle method making use of join > >>indexes and bitmapped indexes. > > > > > > Which is the option (2) I described. > > > > Ok - I misunderstood you on this one, and thought you were describing > the "star transformation" - upon re-reading, I see that yes, it's more > or less a description of the O'Neil Graefe method. Papers look interesting; I'd not seen them. My knowledge of this is mostly practical. O'Neil and Graefe seem to be talking about using join indexes, which is probably method (3)... oh lordy. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sun Dec 18 18:28:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EB1AF9DCD7C for ; Sun, 18 Dec 2005 18:28:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19530-01-2 for ; Sun, 18 Dec 2005 18:28:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 3C6CF9DCD75 for ; Sun, 18 Dec 2005 18:28:37 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id 7DB0026C387; Sun, 18 Dec 2005 22:28:34 +0000 (GMT) Subject: Re: Should Oracle outperform PostgreSQL on a complex From: Simon Riggs To: Mark Kirkwood Cc: Tom Lane , Bruce Momjian , =?ISO-8859-1?Q?P=E5l?= Stenslet , pgsql-performance@postgresql.org In-Reply-To: <43A5DF23.5010504@paradise.net.nz> References: <200512170428.jBH4S2W23715@candle.pha.pa.us> <1134810953.2964.117.camel@localhost.localdomain> <8627.1134843222@sss.pgh.pa.us> <1134913732.2964.164.camel@localhost.localdomain> <43A5DF23.5010504@paradise.net.nz> Content-Type: text/plain Date: Sun, 18 Dec 2005 22:28:37 +0000 Message-Id: <1134944917.2964.226.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/447 X-Sequence-Number: 16268 On Mon, 2005-12-19 at 11:13 +1300, Mark Kirkwood wrote: > > My understanding: Teradata and DB2 use this. > > FWIW - I think DB2 uses the successive fact RID buildup (i.e method 2), > unfortunately I think you're right; I was thinking about that point too because DB2 doesn't have index-organised tables (well, sort of: MDC). I was confused because IBM seem to have a patent on (1), even though it seems exactly like the original NCR/Teradata implementation, which predates the patent filing by many years. Wierd. It's a minefield of patents.... > I haven't got a working copy of DB2 in front of me to test. True, not all copies work :-) Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sun Dec 18 22:36:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2B6F79DC81F for ; Sun, 18 Dec 2005 22:36:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69908-07 for ; Sun, 18 Dec 2005 22:36:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id E0A1C9DC859 for ; Sun, 18 Dec 2005 22:36:16 -0400 (AST) 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 jBJ2aGhv093308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 18 Dec 2005 19:36:19 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBJ2aGwY089762; Sun, 18 Dec 2005 19:36:16 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBJ2aGwU089761; Sun, 18 Dec 2005 19:36:16 -0700 (MST) (envelope-from mfuhr) Date: Sun, 18 Dec 2005 19:36:16 -0700 From: Michael Fuhr To: James Klo Cc: pgsql-performance@postgresql.org Subject: Re: make bulk deletes faster? Message-ID: <20051219023616.GA89670@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, score=0.029 required=5 tests=[AWL=0.029] X-Spam-Score: 0.029 X-Spam-Level: X-Archive-Number: 200512/448 X-Sequence-Number: 16269 On Sat, Dec 17, 2005 at 09:10:40PM -0800, James Klo wrote: > I'd like some suggestions on how to get the deletes to happen faster, as > while deleting individually appears to extremely fast, when I go to > delete lots of rows the operation takes an extremely long time to > complete (5000 rows takes about 3 minutes, 1000000 rows takes almost > close to 4 hours or more depending upon server load; wall time btw). Those times do seem excessive -- do any other tables have foreign key references to the table you're deleting from? If so, do those tables have indexes on the referring columns? Does this table or any referring table have triggers? Also, are you regularly vacuuming and analyzing your tables? Have you examined pg_locks to see if an unacquired lock might be slowing things down? -- Michael Fuhr From pgsql-performance-owner@postgresql.org Mon Dec 19 02:25:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 534A09DCDF1 for ; Mon, 19 Dec 2005 02:25:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61793-03 for ; Mon, 19 Dec 2005 02:25:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id BE0759DC878 for ; Mon, 19 Dec 2005 02:25:21 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C60464.FB4EA2FE" Subject: Re: PostgreSQL and Ultrasparc T1 Date: Mon, 19 Dec 2005 00:25:18 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL and Ultrasparc T1 Thread-Index: AcYD8HXki3mAumlvSXOVD+AsvgbWdAAc4o1I From: "Scott Marlowe" To: "Juan Casero" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.008, HTML_MESSAGE=0.001] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200512/449 X-Sequence-Number: 16270 This is a multi-part message in MIME format. ------_=_NextPart_001_01C60464.FB4EA2FE Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable From: pgsql-performance-owner@postgresql.org on behalf of Juan Casero QUOTE: Hi - Can anyone tell me how well PostgreSQL 8.x performs on the new Sun = Ultrasparc T1 processor and architecture on Solaris 10? I have a custom built = retail sales reporting that I developed using PostgreSQL 7.48 and PHP on a = Fedora Core 3 intel box. I want to scale this application upwards to handle a database that might grow to a 100 GB. Our company is green mission = conscious now so I was hoping I could use that to convince management to consider = a Sun Ultrasparc T1 or T2 system provided that if I can get the best = performance out of it on PostgreSQL.=20 ENDQUOTE: Well, generally, AMD 64 bit is going to be a better value for your = dollar, and run faster than most Sparc based machines. Also, PostgreSQL is generally faster under either BSD or Linux than = under Solaris on the same box. This might or might not hold as you = crank up the numbers of CPUs. PostgreSQL runs one process for connection. So, to use extra CPUs, you = really need to have >1 connection running against the database. =20 Mostly, databases tend to be either I/O bound, until you give them a lot = of I/O, then they'll be CPU bound. After that lots of memory, THEN more CPUs. Two CPUs is always useful, = as one can be servicing the OS and another the database. But unless = you're gonna have lots of users hooked up, more than 2 to 4 CPUs is = usually a waste. So, I'd recommend a dual core or dual dual core (i.e. 4 cores) AMD64 = system with 2 or more gigs ram, and at least a pair of fast drives in a = mirror with a hardare RAID controller with battery backed cache. If = you'll be trundling through all 100 gigs of your data set regularly, = then get all the memory you can put in a machine at a reasonable cost = before buying lots of CPUs. But without knowing what you're gonna be doing we can't really make = solid recommendations... ------_=_NextPart_001_01C60464.FB4EA2FE Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] PostgreSQL and Ultrasparc T1

From: pgsql-performance-owner@postgresql.org on behalf = of Juan Casero

QUOTE:

Hi -


Can anyone tell me how well PostgreSQL 8.x performs on the new Sun = Ultrasparc
T1 processor and architecture on Solaris 10?   I have a custom = built retail
sales reporting that I developed using PostgreSQL 7.48 and PHP on a = Fedora
Core 3 intel box.  I want to scale this application upwards to = handle a
database that might grow to a 100 GB.  Our company is green mission = conscious
now so I was hoping I could use that to convince management to consider = a Sun
Ultrasparc T1 or T2 system provided that if I can get the best = performance
out of it on PostgreSQL.

ENDQUOTE:

Well, generally, AMD 64 bit is going to be a better value for your = dollar, and run faster than most Sparc based machines.

Also, PostgreSQL is generally faster under either BSD or Linux than = under Solaris on the same box.  This might or might not hold as you = crank up the numbers of CPUs.

PostgreSQL runs one process for connection.  So, to use extra CPUs, = you really need to have >1 connection running against the = database. 

Mostly, databases tend to be either I/O bound, until you give them a lot = of I/O, then they'll be CPU bound.

After that lots of memory, THEN more CPUs.  Two CPUs is always = useful, as one can be servicing the OS and another the database.  = But unless you're gonna have lots of users hooked up, more than 2 to 4 = CPUs is usually a waste.

So, I'd recommend a dual core or dual dual core (i.e. 4 cores) AMD64 = system with 2 or more gigs ram, and at least a pair of fast drives in a = mirror with a hardare RAID controller with battery backed cache.  = If you'll be trundling through all 100 gigs of your data set regularly, = then get all the memory you can put in a machine at a reasonable cost = before buying lots of CPUs.

But without knowing what you're gonna be doing we can't really make = solid recommendations...

------_=_NextPart_001_01C60464.FB4EA2FE-- From pgsql-performance-owner@postgresql.org Mon Dec 19 03:21:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6610F9DC852 for ; Mon, 19 Dec 2005 03:21:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71998-08 for ; Mon, 19 Dec 2005 03:21:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id DDEC79DC878 for ; Mon, 19 Dec 2005 03:21:18 -0400 (AST) Received: from 172.16.1.24 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Mon, 19 Dec 2005 02:21:08 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Dec 2005 02:21:07 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Mon, 19 Dec 2005 07:21:07 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sun, 18 Dec 2005 23:21:07 -0800 Subject: Re: PostgreSQL and Ultrasparc T1 From: "Luke Lonergan" To: "Juan Casero" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] PostgreSQL and Ultrasparc T1 Thread-Index: AcYD8GoURvloCvVWR5ygX3dh8AWKMAAfF0FW In-Reply-To: <200512181135.15202.caseroj@comcast.net> MIME-Version: 1.0 X-OriginalArrivalTime: 19 Dec 2005 07:21:07.0844 (UTC) FILETIME=[C79AFC40:01C6046C] X-WSS-ID: 6FB880EE15W36025-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.268 required=5 tests=[AWL=0.015, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.268 X-Spam-Level: * X-Archive-Number: 200512/450 X-Sequence-Number: 16271 Juan, On 12/18/05 8:35 AM, "Juan Casero" wrote: > Can anyone tell me how well PostgreSQL 8.x performs on the new Sun Ultrasparc > T1 processor and architecture on Solaris 10? I have a custom built retail > sales reporting that I developed using PostgreSQL 7.48 and PHP on a Fedora > Core 3 intel box. I want to scale this application upwards to handle a > database that might grow to a 100 GB. Our company is green mission conscious > now so I was hoping I could use that to convince management to consider a Sun > Ultrasparc T1 or T2 system provided that if I can get the best performance > out of it on PostgreSQL. So will newer versions of PostgreSQL (8.1.x) be > able to take of advantage of the multiple cores on a T1 or T2? I cannot > change the database and this will be a hard sell unless I can convince them > that the performance advantages are too good to pass up. The company is > moving in the Win32 direction and so I have to provide rock solid reasons for > why I want to use Solaris Sparc on a T1 or T2 server for this database > application instead of Windows on SQL Server. The Niagara CPUs are heavily multi-threaded and will require a lot of parallelism to be exposed to them in order to be effective. Until Sun makes niagara-based machines with lots of I/O channels, there won't be much I/O parallelism available to match the CPU parallelism. Bizgres MPP will use the process and I/O parallelism of these big SMP machines and the version based on Postgres 8.1 will be out in February. - Luke From pgsql-performance-owner@postgresql.org Mon Dec 19 04:18:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 162789DC800 for ; Mon, 19 Dec 2005 04:18:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82356-10 for ; Mon, 19 Dec 2005 04:18:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 86B829DC80F for ; Mon, 19 Dec 2005 04:18:25 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id EED4733A61; Mon, 19 Dec 2005 09:18:24 +0100 (MET) From: James Klo X-Newsgroups: pgsql.performance Subject: Re: make bulk deletes faster? Date: Mon, 19 Dec 2005 00:17:06 -0800 Organization: Hub.Org Networking Services Lines: 40 Message-ID: References: <20051219023616.GA89670@winnie.fuhr.org> X-Complaints-To: usenet@news.hub.org User-Agent: MT-NewsWatcher/3.4 (PPC Mac OS X) To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/451 X-Sequence-Number: 16272 In article <20051219023616.GA89670@winnie.fuhr.org>, mike@fuhr.org (Michael Fuhr) wrote: > On Sat, Dec 17, 2005 at 09:10:40PM -0800, James Klo wrote: > > I'd like some suggestions on how to get the deletes to happen faster, as > > while deleting individually appears to extremely fast, when I go to > > delete lots of rows the operation takes an extremely long time to > > complete (5000 rows takes about 3 minutes, 1000000 rows takes almost > > close to 4 hours or more depending upon server load; wall time btw). > > Those times do seem excessive -- do any other tables have foreign > key references to the table you're deleting from? If so, do those > tables have indexes on the referring columns? Does this table or > any referring table have triggers? Also, are you regularly vacuuming > and analyzing your tables? Have you examined pg_locks to see if > an unacquired lock might be slowing things down? As the table was originally created using Hibernate, yes, there are several key references, however I've already added indexes those tables on referring keys. There are no triggers, we were running pg_autovaccum, but found that it wasn't completing. I believe we disabled, and are now running a cron every 4 hours. My archiving method, is also running analyze - as I figure after a mass deletes, it would probably keep query speeds from degrading.) I've looked at pg_locks, but not sure I understand quite how to use it to determine if there are unacquired locks. I do know that we occasionally get some warnings from C3P0 that states it detects a deadlock, and allocates emergency threads. BTW, If I didn't mention, we are using PG 8.1 on Red Hat Enterprise, 4GB RAM, 4 dual-core CPUs, think its RAID5 (looks like what I would consider typical Linux partitioning /, /tmp, /usr, /var, /boot, /home). After trolling the archives, and doing a bit of sleuthing on the DB, I'm lead to believe that this is more or less a default install of PG 8.1. As I'm relatively new to PG, I'm not sure how it should be configured for our setup. I would suspect that this could probably effect the speed of deletes (and queries as well). Thanks for any help you can provide. From pgsql-performance-owner@postgresql.org Mon Dec 19 06:39:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4866A9DC9B6 for ; Mon, 19 Dec 2005 06:39:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09005-02 for ; Mon, 19 Dec 2005 06:39:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail5.dslextreme.com (mail5.dslextreme.com [66.51.199.81]) by postgresql.org (Postfix) with SMTP id 4ABE59DC98E for ; Mon, 19 Dec 2005 06:39:30 -0400 (AST) Received: (qmail 10477 invoked from network); 19 Dec 2005 10:38:50 -0000 Received: from unknown (HELO [10.1.1.1]) (mitchskin@66.245.216.230) by mail5.dslextreme.com with SMTP; Mon, 19 Dec 2005 02:38:50 -0800 Subject: Re: make bulk deletes faster? From: Mitch Skinner To: James Klo Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Date: Mon, 19 Dec 2005 02:39:31 -0800 Message-Id: <1134988771.3208.81.camel@firebolt> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.04 required=5 tests=[AWL=0.040] X-Spam-Score: 0.04 X-Spam-Level: X-Archive-Number: 200512/452 X-Sequence-Number: 16273 On Sat, 2005-12-17 at 21:10 -0800, James Klo wrote: > I need to routinely move data from the timeblock table to an archive > table with the same schema named timeblock_archive. I really need this > to happen as quickly as possible, as the archive operation appears to > really tax the db server... Have you considered partitioning? http://www.postgresql.org/docs/8.1/interactive/ddl-partitioning.html If you can partition your timeblock table so that you archive an entire partition at a time, then you can delete the archived rows by just dropping (or truncating) that partition. AFAIK there's no way to "re-parent" a partition (e.g., from the timeblock table to the timeblock_archive table). If your app is particularly cooperative you might be able to use partitioning to avoid moving data around entirely. If table accesses are always qualified by something you can use as a partitioning key, then partitioning can give you the speed benefits of a small table without the effort of keeping it cleared out. Another good read, if you haven't yet, is http://powerpostgresql.com/Downloads/annotated_conf_80.html especially the "Memory", "Checkpoints", and maybe "WAL options" sections. If you're doing large deletes then you may need to increase your free space map settings--if a VACUUM VERBOSE finishes by saying that you need more FSM pages, then the table may have gotten bloated over time (which can be fixed with a configuration change and a VACUUM FULL, though this will lock everything else out of the table while it's running). Mitch From pgsql-performance-owner@postgresql.org Mon Dec 19 10:36:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 880449DC981 for ; Mon, 19 Dec 2005 10:36:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51367-02 for ; Mon, 19 Dec 2005 10:36:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-3.sun.com (brmea-mail-3.Sun.COM [192.18.98.34]) by postgresql.org (Postfix) with ESMTP id A5E9D9DC98D for ; Mon, 19 Dec 2005 10:36:05 -0400 (AST) Received: from fe-amer-05.sun.com ([192.18.108.179]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id jBJEa93F009322 for ; Mon, 19 Dec 2005 07:36:09 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IRR00A011440B00@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 07:36:09 -0700 (MST) Received: from [192.168.1.2] ([66.30.240.129]) by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IRR00CG71W8G3C0@mail-amer.sun.com>; Mon, 19 Dec 2005 07:36:09 -0700 (MST) Date: Mon, 19 Dec 2005 09:27:12 -0500 From: "Jignesh K. Shah" Subject: Re: PostgreSQL and Ultrasparc T1 In-reply-to: To: Luke Lonergan Cc: Juan Casero , pgsql-performance@postgresql.org Message-id: <43A6C340.8000500@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en References: User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/453 X-Sequence-Number: 16274 Sun Fire T2000 has 3 PCI-E and 1PCI-X slot free when shipped. Using dual fiber channel 2G adapters you can get about 200MB x 8 = 1600MB/sec IO bandwidth. Plus when 4G HBAs are supported that will double up. Now I think generally that's good enough for 1TB raw data or 2-3 TB Database size. Of course typically the database size in PostgreSQL space will be in the 100-500GB range so a Sun Fire T2000 can be a good fit with enough area to grow at a very reasonable price. Of course like someone mentioned if all you have is 1 connection using postgresql which cannot spawn helper processes/threads, this will be limited by the single thread performance which is about 1.2Ghz compared on Sun Fire T2000 to AMD64 (Sun Fire X4200) which pretty much has similar IO Bandwidth, same size chassis, but the individual AMD64 cores runs at about 2.4Ghz (I believe) and max you can get is 4 cores but you also have to do a little trade off in terms of power consumption in lei of faster single thread performance. So Choices are available with both architecture. .However if you have a webserver driving a postgreSQL backend, then UltraSPARC T1 might be a better option if you suddenly wants to do 100s of db connections. The SunFire T2000 gives you 8 cores with 32 threads in all running on the system. With PostgreSQL 8.1 fix for SMP Bufferpool performance and with ZFS now available in Solaris Express release, it would be interesting to see how the combination of PostgreSQL 8.1 and ZFS works on Solaris since ZFS is one of the perfect file systems for PostgreSQL where it wants all complexities (like block allocation, fragmentation, etc) to the underlying file systems and not re-implement its own infrastructure. If somebody is already conducting their own tests, do let me know. As soon as I get some free cycles, I want to run ZFS with PostgreSQL using Solaris Express. If you have some preferred workloads do let me know. Regards, Jignesh Luke Lonergan wrote: >Juan, > >On 12/18/05 8:35 AM, "Juan Casero" wrote: > > > >>Can anyone tell me how well PostgreSQL 8.x performs on the new Sun Ultrasparc >>T1 processor and architecture on Solaris 10? I have a custom built retail >>sales reporting that I developed using PostgreSQL 7.48 and PHP on a Fedora >>Core 3 intel box. I want to scale this application upwards to handle a >>database that might grow to a 100 GB. Our company is green mission conscious >>now so I was hoping I could use that to convince management to consider a Sun >>Ultrasparc T1 or T2 system provided that if I can get the best performance >>out of it on PostgreSQL. So will newer versions of PostgreSQL (8.1.x) be >>able to take of advantage of the multiple cores on a T1 or T2? I cannot >>change the database and this will be a hard sell unless I can convince them >>that the performance advantages are too good to pass up. The company is >>moving in the Win32 direction and so I have to provide rock solid reasons for >>why I want to use Solaris Sparc on a T1 or T2 server for this database >>application instead of Windows on SQL Server. >> >> > >The Niagara CPUs are heavily multi-threaded and will require a lot of >parallelism to be exposed to them in order to be effective. > >Until Sun makes niagara-based machines with lots of I/O channels, there >won't be much I/O parallelism available to match the CPU parallelism. > >Bizgres MPP will use the process and I/O parallelism of these big SMP >machines and the version based on Postgres 8.1 will be out in February. > >- Luke > > > >---------------------------(end of broadcast)--------------------------- >TIP 5: don't forget to increase your free space map settings > > From pgsql-performance-owner@postgresql.org Mon Dec 19 10:47:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 85DBA9DC810 for ; Mon, 19 Dec 2005 10:47:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52716-02 for ; Mon, 19 Dec 2005 10:47:31 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.193]) by postgresql.org (Postfix) with ESMTP id EE2E89DC80C for ; Mon, 19 Dec 2005 10:47:23 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 14so1939141nzn for ; Mon, 19 Dec 2005 06:47:28 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=t1J5P6h3RM+Uikkpc23aLMDIubpM81FGVEdoj0mwtKXgQJeSGg6en1v6tMXX9ZXNDJBSX+GyOcp0wHO6ZDLO6hv28OeqOPb2OSO6M8mpJDeN9FOhbdvOd8MXb7f8lfPIG9Evjm7QrBwbNA3r8unL+rOdE82UmBbz5wGCHqVsHkg= Received: by 10.65.183.7 with SMTP id k7mr3027082qbp; Mon, 19 Dec 2005 06:47:27 -0800 (PST) Received: by 10.65.235.12 with HTTP; Mon, 19 Dec 2005 06:47:27 -0800 (PST) Message-ID: <8c8854360512190647q349c1ff2s63b05b218495bd04@mail.gmail.com> Date: Mon, 19 Dec 2005 22:47:27 +0800 From: Ang Chin Han To: James Klo Subject: Re: make bulk deletes faster? 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/454 X-Sequence-Number: 16275 On 12/18/05, James Klo wrote: > explain analyze delete from timeblock where timeblockid =3D 666666 > > Index Scan using timeblockid_idx on timeblock (cost=3D0.00..5.28 rows=3D= 1 > width=3D6) (actual time=3D0.022..0.022 rows=3D0 loops=3D1) > Index Cond: (timeblockid =3D 666666) > Total runtime: 0.069 ms ... snip ... > Here's what I've tried: > > Attempt 1: > ---------- > delete from timeblock where timeblockid in (select timeblockid from > timeblock_tmp) The DELETE in Attempt 1 contains a join, so if this is the way you're mainly specifying which rows to delete, you'll have to take into account how efficient the join of timeblock and timeblock_tmp is. What does EXPLAIN ANALYZE select * from timeblock where timeblockid in (select timeblockid from timeblock_tmp) or EXPLAIN ANALYZE delete from timeblock where timeblockid in (select timeblockid from timeblock_tmp) say? You *should* at least get a "Hash IN join" for the outer loop, and just one Seq scan on timeblock_tmp. Otherwise, consider increasing your sort_mem (postgresql 7.x) or work_mem (postgresql 8.x) settings. Another alternative is to reduce the amount of rows being archive at one go to fit in the amount of sort_mem or work_mem that allows the "Hash IN Join" plan. See http://www.postgresql.org/docs/8.1/static/runtime-config-resource.html#GUC-= WORK-MEM On the other hand, PostgreSQL 8.1's partitioning sounds like a better long term solution that you might want to look into. From pgsql-performance-owner@postgresql.org Mon Dec 19 11:21:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8C05B9DC9A1 for ; Mon, 19 Dec 2005 11:21:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56617-06 for ; Mon, 19 Dec 2005 11:21:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id 3CAF19DC990 for ; Mon, 19 Dec 2005 11:21:10 -0400 (AST) 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: PostgreSQL and Ultrasparc T1 Date: Mon, 19 Dec 2005 10:21:09 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F0E@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL and Ultrasparc T1 Thread-Index: AcYEqayZ2I1SKcofSPaPll6zyn3Q7gABPZ/g From: "Anjan Dave" To: "Jignesh K. Shah" , "Luke Lonergan" Cc: "Juan Casero" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.144 required=5 tests=[AWL=0.144] X-Spam-Score: 0.144 X-Spam-Level: X-Archive-Number: 200512/455 X-Sequence-Number: 16276 8 HBAs at 200MB/sec would require a pretty significant Storage Processor backend unless cost is not a factor. Once you achieve that, there's a question of sharing/balancing I/O requirements of various other applications/databases on that same shared backend storage... Anjan -----Original Message----- From: Jignesh K. Shah [mailto:J.K.Shah@Sun.COM]=20 Sent: Monday, December 19, 2005 9:27 AM To: Luke Lonergan Cc: Juan Casero; pgsql-performance@postgresql.org Subject: Re: [PERFORM] PostgreSQL and Ultrasparc T1 Sun Fire T2000 has 3 PCI-E and 1PCI-X slot free when shipped. Using=20 dual fiber channel 2G adapters you can get about 200MB x 8 =3D = 1600MB/sec=20 IO bandwidth. Plus when 4G HBAs are supported that will double up. Now I think generally that's good enough for 1TB raw data or 2-3 TB Database=20 size. Of course typically the database size in PostgreSQL space will be=20 in the 100-500GB range so a Sun Fire T2000 can be a good fit with enough area to grow at a very reasonable price. Of course like someone mentioned if all you have is 1 connection using=20 postgresql which cannot spawn helper processes/threads, this will be=20 limited by the single thread performance which is about 1.2Ghz compared=20 on Sun Fire T2000 to AMD64 (Sun Fire X4200) which pretty much has=20 similar IO Bandwidth, same size chassis, but the individual AMD64 cores runs at about 2.4Ghz (I believe) and max you can get is 4 cores but you also have to do a little trade off in terms of power consumption in lei=20 of faster single thread performance. So Choices are available with both=20 architecture. .However if you have a webserver driving a postgreSQL=20 backend, then UltraSPARC T1 might be a better option if you suddenly=20 wants to do 100s of db connections. The SunFire T2000 gives you 8 cores=20 with 32 threads in all running on the system.=20 With PostgreSQL 8.1 fix for SMP Bufferpool performance and with ZFS now=20 available in Solaris Express release, it would be interesting to see how the combination of PostgreSQL 8.1 and ZFS works on Solaris since ZFS is=20 one of the perfect file systems for PostgreSQL where it wants all=20 complexities (like block allocation, fragmentation, etc) to the=20 underlying file systems and not re-implement its own infrastructure. If somebody is already conducting their own tests, do let me know. As=20 soon as I get some free cycles, I want to run ZFS with PostgreSQL using=20 Solaris Express. If you have some preferred workloads do let me know. Regards, Jignesh Luke Lonergan wrote: >Juan, > >On 12/18/05 8:35 AM, "Juan Casero" wrote: > > =20 > >>Can anyone tell me how well PostgreSQL 8.x performs on the new Sun Ultrasparc >>T1 processor and architecture on Solaris 10? I have a custom built retail >>sales reporting that I developed using PostgreSQL 7.48 and PHP on a Fedora >>Core 3 intel box. I want to scale this application upwards to handle a >>database that might grow to a 100 GB. Our company is green mission conscious >>now so I was hoping I could use that to convince management to consider a Sun >>Ultrasparc T1 or T2 system provided that if I can get the best performance >>out of it on PostgreSQL. So will newer versions of PostgreSQL (8.1.x) be >>able to take of advantage of the multiple cores on a T1 or T2? I cannot >>change the database and this will be a hard sell unless I can convince them >>that the performance advantages are too good to pass up. The company is >>moving in the Win32 direction and so I have to provide rock solid reasons for >>why I want to use Solaris Sparc on a T1 or T2 server for this database >>application instead of Windows on SQL Server. >> =20 >> > >The Niagara CPUs are heavily multi-threaded and will require a lot of >parallelism to be exposed to them in order to be effective. > >Until Sun makes niagara-based machines with lots of I/O channels, there >won't be much I/O parallelism available to match the CPU parallelism. > >Bizgres MPP will use the process and I/O parallelism of these big SMP >machines and the version based on Postgres 8.1 will be out in February. > >- Luke =20 > > > >---------------------------(end of broadcast)--------------------------- >TIP 5: don't forget to increase your free space map settings > =20 > ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Mon Dec 19 13:30:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B42A09DCA0E for ; Mon, 19 Dec 2005 13:30:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89206-02 for ; Mon, 19 Dec 2005 13:30:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id D302C9DC9B6 for ; Mon, 19 Dec 2005 13:30:50 -0400 (AST) Received: from 172.16.1.25 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 19 Dec 2005 12:30:32 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Dec 2005 12:30:21 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Mon, 19 Dec 2005 17:30:21 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 19 Dec 2005 09:30:21 -0800 Subject: Re: PostgreSQL and Ultrasparc T1 From: "Luke Lonergan" To: "Jignesh Shah" cc: "Juan Casero" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] PostgreSQL and Ultrasparc T1 Thread-Index: AcYEqZJcUl+4Uc8oQMyb/mPXUad0hAAGFCct In-Reply-To: <43A6C340.8000500@sun.com> MIME-Version: 1.0 X-OriginalArrivalTime: 19 Dec 2005 17:30:21.0705 (UTC) FILETIME=[E3678790:01C604C1] X-WSS-ID: 6FB831A03ZO7214769-06-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/456 X-Sequence-Number: 16277 Jignesh, On 12/19/05 6:27 AM, "Jignesh K. Shah" wrote: > Sun Fire T2000 has 3 PCI-E and 1PCI-X slot free when shipped. Using > dual fiber channel 2G adapters you can get about 200MB x 8 = 1600MB/sec > IO bandwidth. Plus when 4G HBAs are supported that will double up. Now I > think generally that's good enough for 1TB raw data or 2-3 TB Database > size. Of course typically the database size in PostgreSQL space will be > in the 100-500GB range so a Sun Fire T2000 can be a good fit with enough > area to grow at a very reasonable price. The free PCI slots don't indicate the I/O speed of the machine, otherwise I'll just go back 4 years and use a Xeon machine. Can you educate us a bit on the T-2000, like where can we find a technical publication that can answer the following: Are all of the PCI-E and PCI-X independent, mastering channels? Are they connected via a crossbar or is it using the JBus? Is the usable memory bandwidth available to the HBAs and CPU double the 1,600MB/s, or 3,200MB/s? > Of course like someone mentioned if all you have is 1 connection using > postgresql which cannot spawn helper processes/threads, this will be > limited by the single thread performance which is about 1.2Ghz compared > on Sun Fire T2000 to AMD64 (Sun Fire X4200) which pretty much has > similar IO Bandwidth, same size chassis, but the individual AMD64 cores > runs at about 2.4Ghz (I believe) and max you can get is 4 cores but you > also have to do a little trade off in terms of power consumption in lei > of faster single thread performance. So Choices are available with both > architecture. .However if you have a webserver driving a postgreSQL > backend, then UltraSPARC T1 might be a better option if you suddenly > wants to do 100s of db connections. The SunFire T2000 gives you 8 cores > with 32 threads in all running on the system. So - OLTP / webserver, that makes sense. - Luke From pgsql-performance-owner@postgresql.org Mon Dec 19 13:33:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C26239DC810 for ; Mon, 19 Dec 2005 13:33:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89341-06 for ; Mon, 19 Dec 2005 13:33:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.clickdiario.com (mail.clickdiario.com [70.85.167.114]) by postgresql.org (Postfix) with ESMTP id DEBD49DC801 for ; Mon, 19 Dec 2005 13:33:27 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.clickdiario.com (Postfix) with ESMTP id C1AB410005 for ; Mon, 19 Dec 2005 11:43:15 -0600 (CST) Received: from mail.clickdiario.com ([127.0.0.1]) by localhost (mail.clickdiario.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09624-09 for ; Mon, 19 Dec 2005 11:43:15 -0600 (CST) Received: by mail.clickdiario.com (Postfix, from userid 5001) id 8B19D10065; Mon, 19 Dec 2005 11:43:15 -0600 (CST) Received: from cristian1 (unknown [216.230.131.226]) by mail.clickdiario.com (Postfix) with ESMTP id 747DD10005 for ; Mon, 19 Dec 2005 11:43:14 -0600 (CST) From: "Cristian Prieto" To: Subject: Any way to optimize GROUP BY queries? Date: Mon, 19 Dec 2005 11:30:25 -0600 Message-ID: <00d701c604c1$e6945d80$6500a8c0@gt.ClickDiario.local> MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_000_00D8_01C6048F.9BF9ED80" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcYEweXMWgpfo11xRACuPBLHW4LiZg== X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at example.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.406 required=5 tests=[AWL=0.405, HTML_MESSAGE=0.001] X-Spam-Score: 0.406 X-Spam-Level: X-Archive-Number: 200512/457 X-Sequence-Number: 16278 This is a multi-part message in MIME format. ------=_NextPart_000_00D8_01C6048F.9BF9ED80 Content-Type: multipart/alternative; boundary="----=_NextPart_001_00D9_01C6048F.9BF9ED80" ------=_NextPart_001_00D9_01C6048F.9BF9ED80 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I have the following table: CREATE TABLE mytmp ( Adv integer, Pub integer, Web integer, Tiempo timestamp, Num integer, Country varchar(2) ); CREATE INDEX idx_mytmp ON mytmp(adv, pub, web); And with 16M rows this query: SELECT adv, pub, web, country, date_trunc('hour', tiempo), sum(num) FROM mytmp GROUP BY adv, pub, web, country, date_trunc('hour', tiempo) I've tried to create index in different columns but it seems that the group by clause doesn't use the index in any way. Is around there any stuff to accelerate the group by kind of clauses? Thanks a lot. ------=_NextPart_001_00D9_01C6048F.9BF9ED80 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I have the following = table:

 

CREATE TABLE mytmp (

         =    Adv integer,

         =    Pub integer,

         =    Web integer,

         =    Tiempo timestamp,

         =    Num integer,

         =    Country varchar(2)

);

 

CREATE INDEX idx_mytmp ON mytmp(adv, pub, = web);

 

And with 16M rows this = query:

 

SELECT adv, pub, web, country, = date_trunc(‘hour’, tiempo), sum(num)

FROM mytmp GROUP BY adv, pub, web, country, = date_trunc(‘hour’, tiempo)

 

I’ve tried to create index in different columns = but it seems that the group by clause doesn’t use the index in any = way.

 

Is around there any stuff to accelerate the group by = kind of clauses?

 

Thanks a lot…

 

 

 

------=_NextPart_001_00D9_01C6048F.9BF9ED80-- ------=_NextPart_000_00D8_01C6048F.9BF9ED80 Content-Type: image/gif; name="image001.gif" Content-Transfer-Encoding: base64 Content-ID: R0lGODlhkAGHAPcAAP6yIFVVVfOVmZmZmdbW1vHx8f/x1fjCxXd3dzMzM//17v0BCOnp6aqqqq4S FNPS0iIiIv/04HWRj//68Ht7fP/v0OTk5Pn5+VxcXOEJFa3R0IiIiBEREaelpNzc3M0oLbq6upKS ktkQFulHUP+fo/T09MzMzIWFhf+uLfvh48bGxv/y2bKwsPbCxERERP/25WxsbP/+/B5UUfnS1P3x 8d7o53E1Mv8QGfwJEg8yLeIwNllVVO38/P+ws6CgoMnJyeMYJL6+visrK//89mlpab28u//47OHh 4np3d/7+/v/9+eQoMkNaV4GBgTs7PP38/J2dnbW1tY2NjcDCwv/03md6ef/uz+gmJhwcHf/5705O Tvb29v1nbOxmbevs7KKioq2trdjY2P64MO51fP/ZkAAAAJWVloaDgomJjepWXnR0dPeytmRhYAsL Dd7e3ri4uPz7+//z3GBgXw4OEf/46aenqBYWGElJSnBwcG5ub+4MExsZFeEECikmJP/uzf6nAP9m AP+ZAP/MAGZmZu7u7k5KSf/tzP+4iP/TgP96Iv/pwPCEiv/r3f+jZv+PREFBQf+FM/69QP/Cmf9w Ef/gzP/Wu29sa/+ZVZGOjv/Mqv6tEN3d3f/en/+td/7IYOc3Qf/pv/69P5yZmf/eoP7DUP/Yj/7O cP7Tf/7Nb//jr97e3f7IX//ksLGwr/WkqPSip8jHx4qKiru7u/7CT2RgX+1FTYeHh//788/P0f6s D91YXxwXFs/Pz8r//zYzMMp7gCAfHu+FhYSBfz8pKf3u7nV+frq3uPb19dPT1VBQUU9FRFhYWD4+ QO3r6zo2Nvfy8ZqanJaWk3VubWJiY9/f4OXf39Xg3kdFQNh0eLuEhslbYHJydC0tLkpKTf9dYdaS krq6uLe3uP/d3v3MzO7u7ayrqx4eIP9tcfASGKCgn9LJx87OzUZHR4ODhISEgZCQkGZmaP8oL4R3 dfAzN19rbv78/FGGheTk47Xk48O4uNDQ0LGurf+0uJmwrv+9vf///yH5BAAAAAAALAAAAACQAYcA AAj/AAUJFOinoMGDCBMqXMiwocOHECNKnEixosWLGDNq3MhxYoUVKyK8MHLrn8mTKFOqXMmypcmB Al3KnEmzps2bOHPq3Mmzp8+fQIMKVRlDya0sdF5QWVHBioEIRpQMrQlT0NSrWLNq3cq1q9evNGNM eGGgwtMsYKuCXcu2rdu3cOPOFBuhQoUIQ7qqlcu3r9+/gAOnvBXHjwEjW/cKXsy4sePHOY2UfRED q2LImDNr3ixXLFPKUy9zHk26tOmft5giFir6tOvXsGNPMLAiL9DWJwkgSMD7BAGVJxL4WLlb1j8M CX709ME7waPhKYNDZ/koQYHY2LMHfuHnxW2YLJk3/28+3aR04gmMI1fOU3xz4yjPt6x+Xbv9+2+H rDBgmyfuH72ZVIB8NBUXFHMh/MPcCTnRh9+DEHoVQ12r7YTbbgmiZME/BSRABAaPhCCcgrwRUYCI vPmA3G8F7JYAAkSMWF0I1RGxIUoIkniCLAmc8AgRIkLnQ3Uvbogcb7/5oEVv9UXo5JM7GXGXf+Cp tOSNKXXYW5AWjIcAisKteNx4Kf5DZHMIpOQeb7LwyBsYQf4T3HhaFHBkAgSsmUCdUPbpJ01DGGBA ZTnhduVKWv4WpxZaWGDjPwauCMaevxGw5HDVMcicFmo2pwUY//DI6T9cOgdfjJha1+UjxhWA6p+w xv+aUgxx8FdolSlhiKhzJsV54ovXRYpnjr3KiOc/BPCKYwIZmsRjmqQKlyyZL5ppXbIYnPSsrNzG OmEF/VGFK0puMmheeh0+UuxwCMiCLaTpjUnApFpUeqm1lSp7ErHOVhutD13Wa9J09K3a6qvdJuzn C+DehBuJ1PqQ7rpu8sapsL/dSR6+yOo7MLPk+hvnnJ6a5CCYFjep8MoRMhyuTA+HGiNvCLCobJzi YfAbxia5SMSr1eWr7rLNhiryiAoS+ai19SnJJMtQRxiDy+IOFPXVWGcXwaA0xZz112A7RqsBXY8b 9tloLxaDAVTM5HXacMfN1hAVVMjS23LnrXdWUr7/nBLeewcuuE9buwQ4SpuUAd9Jm0BgEgQb4LQB BGWUkcAALkGwySAusCRL5yxtEDnkM5E++Olgre3d3Wbv1PhOG8RrdAMtae7S5y2Jjvrugt3S8EoP D1J5vC4Ib4LmJnBQRgCyVF7GP4NgvkkClW/w/OculMGBcZu4QAj1LkBACOg8Vj7I45sMcD70wxuH +wAQmPCP9WVAMEjk0f8zffXPbxAABxvI3/6Wp5LylWF9/wjA8DYRKhdkDwLlSwADeYe6F6yAdVZT ySASQIh/DIAD/8je6DYXOZO8DnqYs58HKxcq7ZnABAnwYAM20DkaJlB/ZcDc90aoPuhx0IMg/NwA /34IPxN8rwz4S+H5BsBC63Uufyr8HgJxqMME4O+Hg3Bc8zQnPMwFAFoUHNza7HYS3JShgyhxQQk1 JwsIYE5/jkMhj07CxFDFzyTPG0ADEJCmANzvfBsA40k018MzpqR5Pwwh7f6xQznG0CR1tKEjT0II EJ4kkCoxpEkSYII2MrABj+xhGE8nJUKhxIxoPIkL4GO77p3vhNGbIySvB7p/PG96xytD9taHyZQQ 8nya1Jbl0OiCRTYylo9c4fxKiExKWtIkvURJMDmJuwZCcoqj3JvqVIKbDXbwgyFk5SaY10Y4mgSK S2RhNW0JTdkNUX6JqyIPz+dNIDawiB6M3xGT+P8PFTKxf8xMYZqkiLgcMtKK0PMe9LRIPtCJMpuC m0AFTPmS1plEgZYzzirRJwvlSS+OAqQeEml5kudBUqSc1BblDog+UWI0XrjrKOboZz9+DtB6yzwn 5mBYuQA4qwwMbKP5TEKIlwa1odeE6OkMsLoyWlSpUA2jRP/21KhaFXWHOWVVr8rVvZFFqxnsqlgH pwQr9OdwY01r1uIQAaeGVa1whdtUK/rWuNoVbDGoAFr+gda7+jVWcVgdCgY72L8aFmtZINs/AsFY xh72sSyLgR+k0ljHQvay3cpqZQOB2c7Gigpt3axnR9snySy2sqRNrdQMcdrGqva1+PHDLUQL29r/ YqdutLWtbk+zghfkdrfA5UwEIvDb4BoXMnRYQXGPy9zFGEG5qG2udBczASssd7rYjcsQDHHd7HqX LUrgbnS/S962xEC8ri2veteCXsuu971caS9n4UvfrMi3vvidyn3zy9+f7FclLzRJgP8x4ALLj8AH NrCAE8zgBTsYwQ9WMIQnLOEKN5jCF7ZwhDPMYQH39y///bCIbxLiEZtYJiU+sYpVkuIVu/gfLX5x 4ASwhtjEWMZ5ewYQbpABbxzANTfGcdzgsIQboOMGONDDCFSigjuEAyhbmEY7eoKMKLCkxdmrXBw1 +EaaEEJ8BHZe5HJ5x/lVTqHR1JbyUkrmA0PT/6eULDNKlKdLM4t5hbXM5fZkDAcd3CAYrrjCAkSw kjks4yTU6Mky7NCTaKjhyt3t5wRXkr+aDADOsUMJ6SZnx000EoYpqaRxOPePy3kwmZvgwKQhhc0w p1LNaBxALU3dgGeu+Ak6WEAK/sEDAfBhJQnIg4A4IAWetAMLPZlCHSA9XpXYjsAihXOloblllQSg hAhAYPJOwkkElFCUHHh1A+B8QmjOuoQmaQCYU6LulaiRjrV89xBl/IQlLOAX+OjFOH6tEm7A4CQU QAZPbMForNz42aaGHj27PBPZoZQQ65x2At8o55QEsKRlWCT9FPpl7TEcUlp2M/xSKWvGOW9xLv/O 9Tc08A9/ELrf//7HE7ZgkiPY3CQWQEYJTPKDINwDJUeYwj/esWULBGEKSUAJLqawjpPcI+kEYA+z 07sS2zXPedpDoU1UnRIXtKuW0x4EAjeqkiG++oOEqCQDvQ6pNDXv1ZdMphtRUnJGzt2TMra3Nnjw DxK8PCX+NkkY5vBkW3DAyv/4QjIY8I88UCAdx/oHA+7whSAwwxkCXkY6YpEtk9QhAOUgAgVMkgcI qGAAcxD41N3r7KAm8yQSlwlQ2R2A43H7wJLcJMqd1cotr7IB68OdBE1C9lBbEn4pqfs6XfBxE6vj AwsQgElIkIGVBN4kbTADhzjAeGQxKBZOMAn/M+5gkmQI+x8ceKQQ3PE4NPwDDhxINAP28IZ/SGEO vPiHHLzQkoNPkHTjkyaxlznyk236g1CbFke5hz6H9GylFjkdRQjJIz/v5kehEm4nAUod5EB293F1 J2oXuGomVgPy4AAO0ALT93coIQQx9w9t0AGP82j/wALg8A9C8A69MgcmwQH89w/J4DgqMAdhYBKx gGyt8EwBwA7/YAZzcAEz4X8CFm06FUKAVG0pkQC0c0QERGCUc0f0o2WMZGsXiHWbQGbwsXEmRD17 1jwMJDyWw0CZlny11FEe52LHUAVV4AALUGN9p4InwYIn0QZfYBLvwGgXEAtOyAHLAAt1AA+M/8YA z6QGwDB0HOCE/6ACIAQDQnASaoBssWCFqzdfXOFtPDFuQrYY0kAPTKCHPTB9C2ASSWAB1OCEgIh9 g/gPJaCDJdAE+sMBaMAA+kAN/McCbXASTWAOcqKDJoEMOrgM4WcSTcBoUmAHSYdikTYUsqQTxXSK gSEMO8AEEvAJCyAOJtEDIgAG/dAA+VANT/AP1+eCt4h+A7AF0PAPgyd0KPEGxWgSFIBsG6CM/4AL xSgHyUQB0lhw1ths3Jg2UHANysAgXHAD2SAB9sAENrAP1tAMcPCHLVgG8WgLfbAOHvAPFzAHXTYA x1AAADkNyOYDHEAOJtEKOhgLCEkE3DA/1P/4hNe4kFdjDM7gC77ADsWQAzkgAxIwBdigByvhDDLo gq1wEuQwB6O3SYdmEniQiPDRB5voBXZQBCaxDJwSBs/kBHjwD59IE0HGk1BDAELQBxDQB+aQA8Pg ALpwDvGwADigEknAAcwQiGV5ElJ5ElHQlf8ABcX2D+3gOAwwB5aUB8kgeVigDybhBAwCBdywkRjA ASqgkwqpllhjAbuABRwADBTAf7WAA6iJDujABSphARRgBjRHABQwAO1oEkGAJTNIBO0wAJb4D7aA BCDwA1JQH2ZAAdsQBCdRAhTQBBQwhP9QB01QBzTnEmnpmQmjBnsgCjt3EvNwAzogAMTAFbX/qRXV aZ0PYgWhEApWICvlaZ46MQYjMAIzgBUp0AIoyBOK8Ad/oAjseV3/VGdAQXYY9Txa+EZ0mFLZyDhq +EZuOEXbdlCV83H7wwEMemYo8WXyo4XopjcjkAEZ8GNXsQge2hP5uZ/92Zke1Go9kWonwQGLlFAh CIKkhn5wJ2/hpoHf86IJZ4DJ82o2Sgga+IAnYYCs1otuljcd+qEqQQw01hMiWn34qZ/8qRKpUAp7 5RVVeqVeYQiA0KVduhIPdVFntkqcZgJlcKTFY3FwRgizt4MH5m2maE4J9KJhOEiTNj3wgQBwRi7r VqccpTk5mm7rZkM9GjhJCqIo0QUeep86//GkJCqlVKqfnvAVoCCp7OWlX1p2zvNEHJQ8ipNAu7Gh LEGK/9AAzoM5JpWiKHFx0COqJ2F70GQ5AjY8bpY9goQSsOqGoNNxFPo41SM4h6oSaeChfNioIxql JpoSo2CpXrGsf0AKl4qpYDpFmpQ8xvFle+oSAfBxb5eqD2V20OSqXHikjYSF8/N6x7N743quG5gm fNRCRfVK5ro3wZoSNDAG0scTjoqsU5oSZGAKEwAW/xqwYMGl0lp21IpG1hpmGCgTzKcSnMR1kFJC eNczrto48FFpn/NlJSVp4ZoSGEt88FFOwxdOqcqqHOqhiDoU+1oToHAKoYAKnPAPJdqvOP+RBevp FRFQCqdwCqWQsy1hBaAACkB7ZZgKCNOKEt7kqbLwZXuUrSxxP2EoPxsQbqTWUUHlgFqHOBCUgbbz br1qQwjQOSHLOF1rbsR3PhYYge82Pc23MjOwCF3QBYswnypRrziRAgIwBmmwCMV6Ei37DzRgn4yK Ep6gn4grBqwAqTiRCgCAuKuQBemJCleRBaiAuIhLClp6Eo6LuQCQCv13tEmLEhjlQLJggf0UOQaV pijxritUP9cqUphDh87DQCmloFiHOW4IZwfKQBqatgMUoSF0Zh00odwjUre6MjQwrB7avCuBt4B7 rCvxpM2rpCjRsjTwCRkABK+gEqaQuJH/8LhiwLgoUaKIsBKcgLn6Ob5/EAkrkZ6cwAma8AcA0FYp oZ/nmxLsq75/IAabe7n8+weTuhIG66VeEac6UUm6pb0Z8AmLsAja+7wqqxKBixJj4KFLMAaLMKwr +w/7mr3ba7coEQGIO7Mmkb7kexLmqxIkjL9WYAVkML/tuxL6GQmI674qgb8pgQgBfMMogcI9TAYE LLpdUUlwZxNpplqv4KFdgBLde7cTnBIVbBIp4KGfQAMnMQMibBKOCsJAsMUnQQb6SbkoMQspbBIr vMP6eQo/XMM0rJ8AWxdvnL8mkQU9jLlAK8M9rAmbC2NE7J40ob1LQBPQy8XSe70eumsu//GkM6C9 X8wSpKCfoJASKGyzaKzDKWHDf7C5bpzD9CsTmHzJd4zJizvKfzAKLPbHgCwTHpoGhBzFiAylKcG8 M/GkQOChYIwSmjzJKFGpyVq+oXwSmqwSoTDDngytLhHMYmzK+cvDzJzKB7vKrJwBTTwThezBh3wS SVrLTMzELbHLlHzGNBvMJjHM+mvM9/sHdMwSwVzKo9zMpqzO0GzA0iwTS9DAr2y9sbwSF5wBitwS jpqkY8ASzlwKKbEK4pzGKBHJf2C/JtHCOJzO6zzHIxzPrGASzjzKQpwSBZyp9dwS/fzEJpHL/3DN U/wPB9DKKEED/2zI1QfCGSDSKFEB+v+ZC1cKxJY8zvLsr/q5CmXcyRINyjt9EgzdwwBwEhl9xw59 Eh2NtB/dEilwy9T8Cq+gqBKsz9EryymRpCNAY4sABB38wfcc0yuhybmACqeA0Iib0wp9EhMgw6FQ CqVQzECNEuTsyRP91ndcAUhtygPM0ar81CoxA1JdvVfdwdis1SvNwNUb1tJL2LisEhOwv/qpCcvM 1ndNs3osqXV9Eplt10N9EhVA2ZVts6StvmJAsIAdzbiqPKCjO1rhhrp0pKnbejBqEw5oOjmRql9D A4swAkAABGkg09oMy1ntEq+QBvc8AouAxfucxR76yCkxAYhgw2LgCcOFCIiw1KI80Sf/EQGeIAaa EAmorN2ojNdC7d0mMQqkAADjTQaq/Q++3MMAa7SsfRLX9j3GAdtX8T0uMEEIEEy1I4I1obU8wduC 7RVZcNr9Swbcvdr0nCuCpDsbZKZoBAEzlEW/ykhZVrIGdUlQ+2YAFD1HJD4n51JjahwjhUQMqFNx GIEgB7tpyD+8t+EJtEDz8z/imuAzkQWHq76RwNdPGNiqpFDLJHabFDnIZz2dOneDAC3I5250ekl1 Fj11x4A9tLTKo+I59GUd5IAkvmdsJ2sddDwM5E8sFE9cqLtY5DhOJM0M8AA9AQqn/ddDft+rCmbW g0CZNnexg0YN0DlYVzm0fVFTjrYo/9Q46GY7haSwe/bhGwXmM/Xfs5dlYpaNkQRGpjhNJrCA7tkB hYATVsAJaf24/BvRaEnkrZsme05JSISBf55ugn7EKuE/KwHblZZFWA5Mjq7iqmQcks5IlrM+2xgy dNQ/mu5TnM7fgAzqNsEJpj7KD06dRA6CX3TkiaRAJcTkEujkoLMbLOHfE1S1hIDrAyA6auexWd6p W85OIuuxU8g+EzREDIR2/ZROt9Srx6O7CqXrzP7poT4TEcDgp44TTQ2mw9NBuhM78mPv86PhLM7h OG5LH0cIsu0CVBtQ+7M+jL4+pbtRqRrptVtp3dO6WgYfN2VS8LPhRYXj/26ezi4TVv+w2e9s8KpO E0j+sTzOGAzQfW0R8y2RBdEez+pN7XhOE4kzaS+/832xCTsg524B9AQdz5hb9KF79EwfGw9QCFD/ 8wHfEjRvyqZg81if9XHxACXAAK3QAZvJEirQAR1A4AzAAoXAApNWAmh/Eg9w93mPEiUgCx3QCj6P OD3fASgH9HE++CVK9fp51CR282YPF4XQATvABmxQCJagEiWABJhvCYWACSlRBJ5vCaJwEqpQ9yZR AoWwAychCqyPODtQCEgQ+zCYEkiACbH/+iYR805vCduJ0YyPuX1s9BEe+X1RCFxvEpiQ/CiB+1C/ 9bWv98x/EmxwBiZRBLEP9ZZg/cn/uQO+r/yF0PYnwfkdwACqgBLO3vu/D/zBL87E79HGzxefL/1e mZyFUPoncQa6bxJbDxAP/g0cKKrQQExndnT4x6BQEYL/WBTaFJENkoj/kOzIOLADxR2WSnRE9Mfk SZQpTyrq2JKgIUAxY7qkWdPmTZw5de7k2dPnT6BBhQ79V4jhwAdGIyalhcQpElqFRhJMKnBpIVj/ 2LA4g3HiVIQHIyIRS9Bpy487lHYcpdJtSp4wZQIiCpRRon+JDrk8tNelo0qMAFWyKZhwXcSJFS9m fHPtv6RHkRay9PSpqqtWI+4QtamQqon/zpzJSLZ02YFnO35MSLFjhLexxcSdS7cx/867NvvSBHzb 92/gwes+jnwVIkGwVAtpJojJEgs2/1Q9fJjxY3Ik0cdiXH2wRMiWkWK7HUV7bstJmf5RAqRe8CFI Ay/F/9fIESAF/w7h/yeJPsFDJgFkkr1ya0SSfxi5DxBHGNFvr0Ygye+SmBzpLREHK0kkpkMc+ceR RgChBMN/NOSwowAH9IsRSGK6ZKBDGtkQsBmFs/HGxoh7bCDwCGKDo8w6KoIyTAZigw2pMkqqFYI8 K3I7tMSCpRBROqpgvJQA6EkumVpqpJF/OpkEzEMuEYwRBQZ0cJIREYRkEgQv8WsgSRKhZD07DUQw ETDre7GvLweKUAFKBCQMQ8EQDP/Rw/v2QhQQBNuMqM47R7yTz38UgIRMBjVlU4FE1MNxVFKB0lGy gYa0RBYVyDpOOUuYjKiEQqr7BxPKWsJVlAda2WGH5DTizrqyzliuIzKwPKmCLWtrKZNJNA3wH0jc PCQTSOTMBK9OHEmzzDQdJMgRUQnSs5L/AASkz3/4W2+SQxk5pBOC7PvQLwznJSiTF8ctdyB0CVJg Ev08DJPe+hAsdWGGb0LiVVUe7ugBsijLqiNReoxIFCQYGAgWidFCcgdMgv1HlCqFHLYEJJ7MqKTx NGHFJy5nQm/aRCSJVr9sD5HkEjnXA6RMRgg02N+Mzk0XxnUJcrfQePUVlNHD8kX/+B9+IyI3o4AH GvhBGP06sGGyyzabVEUAeCsSZml21sumxexXMEDQHPDOvCCllsCMKMWTEj3z6rORP2OUsD4JCx0s L0YSrY/BD6tuHE48FabTzr/zoldTMv3aLeGzQxd9dMVGIUXtP8TwhCWgarato0zaw1r2gSChz3aC OuFP9/w+7HM/FRPEa2wWK3RwN/jupJDBCzPccGiqByKxzhP1w0u/mPher0VA+v3887FJF3988kd1 vXz001d/ffaJOr99+OOXf37y36f/fvzz178x+/f3/38ABrAj/RNgAQ14QPYREIELZGADG+Y6P0RQ ghOkYAUteEEMZlCDG+RgBz34FUEQhlCEIyRhCU14QhSmUIUfNERAAAA7 ------=_NextPart_000_00D8_01C6048F.9BF9ED80-- From pgsql-performance-owner@postgresql.org Mon Dec 19 15:10:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B598A9DC9C4 for ; Mon, 19 Dec 2005 15:10:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23764-03 for ; Mon, 19 Dec 2005 15:10:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 994679DC9CF for ; Mon, 19 Dec 2005 15:10:51 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 1DFB133A61; Mon, 19 Dec 2005 20:10:52 +0100 (MET) From: James Klo X-Newsgroups: pgsql.performance Subject: Re: make bulk deletes faster? Date: Mon, 19 Dec 2005 11:10:50 -0800 Organization: Hub.Org Networking Services Lines: 43 Message-ID: References: <1134988771.3208.81.camel@firebolt> 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.7 (Windows/20050923) X-Accept-Language: en-us, en In-Reply-To: <1134988771.3208.81.camel@firebolt> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/458 X-Sequence-Number: 16279 Mitch Skinner wrote: > Have you considered partitioning? > > http://www.postgresql.org/docs/8.1/interactive/ddl-partitioning.html > > If you can partition your timeblock table so that you archive an entire > partition at a time, then you can delete the archived rows by just > dropping (or truncating) that partition. AFAIK there's no way to > "re-parent" a partition (e.g., from the timeblock table to the > timeblock_archive table). > > If your app is particularly cooperative you might be able to use > partitioning to avoid moving data around entirely. If table accesses > are always qualified by something you can use as a partitioning key, > then partitioning can give you the speed benefits of a small table > without the effort of keeping it cleared out. Yes, I've considered partitioning as a long term change. I was thinking about this for other reasons - mainly performance. If I go the partitioning route, would I need to even perform archival? The larger problem that I need to solve is really twofold: 1. Need to keep reads on timeblocks that are from the current day through the following seven days very fast, especially current day reads. 2. Need to be able to maintain the timeblocks for reporting purposes, for at least a year (potentially more). This could probably better handled performing aggregate analysis, but this isn't on my current radar. > Another good read, if you haven't yet, is > http://powerpostgresql.com/Downloads/annotated_conf_80.html > especially the "Memory", "Checkpoints", and maybe "WAL options" > sections. If you're doing large deletes then you may need to increase > your free space map settings--if a VACUUM VERBOSE finishes by saying > that you need more FSM pages, then the table may have gotten bloated > over time (which can be fixed with a configuration change and a VACUUM > FULL, though this will lock everything else out of the table while it's > running). > Thanks, I will look into this as well. From pgsql-performance-owner@postgresql.org Mon Dec 19 15:30:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E54DF9DC810 for ; Mon, 19 Dec 2005 15:30:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32493-02 for ; Mon, 19 Dec 2005 15:30:01 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by postgresql.org (Postfix) with ESMTP id E392C9DC801 for ; Mon, 19 Dec 2005 15:29:58 -0400 (AST) Received: from fe-amer-09.sun.com ([192.18.108.183]) by brmea-mail-4.sun.com (8.12.10/8.12.9) with ESMTP id jBJJTxD7020058 for ; Mon, 19 Dec 2005 12:29:59 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IRR00901FGVV500@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 12:29:59 -0700 (MST) Received: from sun.com ([129.147.156.99]) by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTP id <0IRR00LL1FHY6IKB@mail-amer.sun.com>; Mon, 19 Dec 2005 12:29:58 -0700 (MST) Received: from [192.18.108.178] (Forwarded-For: [129.148.9.42]) by bedge1-mail1.central.sun.com (mshttpd); Mon, 19 Dec 2005 14:29:58 -0500 Date: Mon, 19 Dec 2005 14:29:58 -0500 From: Jignesh Shah Subject: Re: PostgreSQL and Ultrasparc T1 In-reply-to: To: Luke Lonergan Cc: Juan Casero , pgsql-performance@postgresql.org Message-id: MIME-version: 1.0 X-Mailer: Sun Java(tm) System Messenger Express 6.2-4.02 (built Sep 9 2005) Content-type: text/plain; charset=us-ascii Content-language: en Content-transfer-encoding: 7BIT Content-disposition: inline X-Accept-Language: en References: <43A6C340.8000500@sun.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/459 X-Sequence-Number: 16280 Hi Luke, I have gone to the max with 4 fibers on Sun Fire T2000. But I am not sure about the answers that you asked. Let me see if I can get answers for them. I am going to try to max out the IO on these systems with 8 fibers as soon as I get additional storage so stay tuned for that. By the way you don't have to wait for my tests. Just get a trial server and try it on your own. If you don't like it return it. https://www.sun.com/emrkt/trycoolthreads/contactme.html Check out Jonathan's blog for more details http://blogs.sun.com/jonathan However if you do try it with PostgreSQL, do let me know also with your experience. Regards, Jignesh ----- Original Message ----- From: Luke Lonergan Date: Monday, December 19, 2005 12:31 pm Subject: Re: [PERFORM] PostgreSQL and Ultrasparc T1 To: Jignesh Shah Cc: Juan Casero , pgsql-performance@postgresql.org > Jignesh, > > > On 12/19/05 6:27 AM, "Jignesh K. Shah" wrote: > > > Sun Fire T2000 has 3 PCI-E and 1PCI-X slot free when shipped. Using > > dual fiber channel 2G adapters you can get about 200MB x 8 = > 1600MB/sec> IO bandwidth. Plus when 4G HBAs are supported that will > double up. Now I > > think generally that's good enough for 1TB raw data or 2-3 TB > Database> size. Of course typically the database size in PostgreSQL > space will be > > in the 100-500GB range so a Sun Fire T2000 can be a good fit with > enough> area to grow at a very reasonable price. > > The free PCI slots don't indicate the I/O speed of the machine, > otherwiseI'll just go back 4 years and use a Xeon machine. > > Can you educate us a bit on the T-2000, like where can we find a > technicalpublication that can answer the following: > > Are all of the PCI-E and PCI-X independent, mastering channels? > Are they > connected via a crossbar or is it using the JBus? Is the usable > memorybandwidth available to the HBAs and CPU double the 1,600MB/s, > or 3,200MB/s? > > > Of course like someone mentioned if all you have is 1 connection > using> postgresql which cannot spawn helper processes/threads, this > will be > > limited by the single thread performance which is about 1.2Ghz > compared> on Sun Fire T2000 to AMD64 (Sun Fire X4200) which pretty > much has > > similar IO Bandwidth, same size chassis, but the individual > AMD64 cores > > runs at about 2.4Ghz (I believe) and max you can get is 4 cores > but you > > also have to do a little trade off in terms of power consumption > in lei > > of faster single thread performance. So Choices are available > with both > > architecture. .However if you have a webserver driving a postgreSQL > > backend, then UltraSPARC T1 might be a better option if you suddenly > > wants to do 100s of db connections. The SunFire T2000 gives you 8 > cores> with 32 threads in all running on the system. > > So - OLTP / webserver, that makes sense. > > - Luke > > > From pgsql-performance-owner@postgresql.org Mon Dec 19 15:37:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2CF3E9DC87C for ; Mon, 19 Dec 2005 15:37:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32991-03 for ; Mon, 19 Dec 2005 15:37:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id 8204A9DC86C for ; Mon, 19 Dec 2005 15:37:29 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Mon, 19 Dec 2005 14:37:17 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Dec 2005 14:37:16 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Mon, 19 Dec 2005 19:37:15 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 19 Dec 2005 11:37:15 -0800 Subject: Re: PostgreSQL and Ultrasparc T1 From: "Luke Lonergan" To: "Jignesh Shah" cc: "Juan Casero" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] PostgreSQL and Ultrasparc T1 Thread-Index: AcYE0p2CGNZIrp6bTj6milivLBHEqwAAP/G2 In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 19 Dec 2005 19:37:16.0047 (UTC) FILETIME=[9DE7E9F0:01C604D3] X-WSS-ID: 6FB9D466330217046-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200512/460 X-Sequence-Number: 16281 Jignesh, On 12/19/05 11:29 AM, "Jignesh Shah" wrote: > I have gone to the max with 4 fibers on Sun Fire T2000. But I am not sure > about the answers that you asked. Let me see if I can get answers for them. I > am going to try to max out the IO on these systems with 8 fibers as soon as I > get additional storage so stay tuned for that. Cool - how close did you get to 800MB/s? > By the way you don't have to wait for my tests. Just get a trial server and > try it on your own. If you don't like it return it. > > https://www.sun.com/emrkt/trycoolthreads/contactme.html Done - I'll certainly test Postgres / Bizgres on it - you know me ;-) > However if you do try it with PostgreSQL, do let me know also with your > experience. See above. The Niagara is UltraSparc III compatible - so the GCC compiler should emit good code for it, right? - Luke From pgsql-performance-owner@postgresql.org Mon Dec 19 16:04:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CD0E39DC810 for ; Mon, 19 Dec 2005 16:04:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37587-05 for ; Mon, 19 Dec 2005 16:04:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id 4F74E9DC9C1 for ; Mon, 19 Dec 2005 16:04:28 -0400 (AST) 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_01C604D7.68C9CCA5" Subject: separate drives for WAL or pgdata files Date: Mon, 19 Dec 2005 15:04:24 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F10@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: separate drives for WAL or pgdata files Thread-Index: AcYE12h/vzgJ1ICSQMe7Nr2fuNarDw== From: "Anjan Dave" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.38 required=5 tests=[AWL=-0.100, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.38 X-Spam-Level: X-Archive-Number: 200512/461 X-Sequence-Number: 16282 This is a multi-part message in MIME format. ------_=_NextPart_001_01C604D7.68C9CCA5 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 I am not sure if there's an obvious answer to this...If there's a choice of an external RAID10 (Fiber Channel 6 or 8 15Krpm drives) enabled drives, what is more beneficial to store on it, the WAL, or the Database files? One of the other would go on the local RAID10 (4 drives, 15Krpm) along with the OS. =20 This is a very busy database with high concurrent connections, random reads and writes. Checkpoint segments are 300 and interval is 6 mins. Database size is less than 50GB. =20 It has become a bit more confusing because I am trying to allot shared storage across several hosts, and want to be careful not to overload one of the 2 storage processors. =20 What should I check/monitor if more information is needed to determine this? =20 Appreciate some suggestions. =20 Thanks, Anjan =20 =20 =20 This email message and any included attachments constitute confidential and privileged information intended exclusively for the listed addressee(s). If you are not the intended recipient, please notify Vantage by immediately telephoning 215-579-8390, extension 1158. In addition, please reply to this message confirming your receipt of the same in error. A copy of your email reply can also be sent to mailto:support@vantage.com . Please do not disclose, copy, distribute or take any action in reliance on the contents of this information. Kindly destroy all copies of this message and any attachments. Any other use of this email is prohibited. Thank you for your cooperation. For more information about Vantage, please visit our website at http://www.vantage.com. =20 ------_=_NextPart_001_01C604D7.68C9CCA5 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

I am not sure if there’s an obvious answer to = this…If there’s a choice of an external RAID10 (Fiber Channel 6 or 8 = 15Krpm drives) enabled drives, what is more beneficial to store on it, the WAL, = or the Database files? One of the other would go on the local RAID10 (4 drives, 15Krpm) along with the OS.

 

This is a very busy database with high concurrent connections, random reads and writes. Checkpoint segments are 300 and = interval is 6 mins. Database size is less than 50GB.

 

It has become a bit more confusing because I am = trying to allot shared storage across several hosts, and want to be careful not to overload one of the 2 storage processors.

 

What should I check/monitor if more information is = needed to determine this?

 

Appreciate some = suggestions.

 

Thanks,
Anjan

 

 
 
This email message and any included attachments constitute =
confidential and privileged information intended exclusively for the =
listed addressee(s). If you are not the intended recipient, please =
notify Vantage by immediately telephoning 215-579-8390, extension =
1158.  In addition, please reply to this message confirming your =
receipt of the same in error.  A copy of your email reply can also =
be sent to mailto:support@vantage.com.  Please do not disclose, copy, =
distribute or take any action in reliance on the contents of this =
information.  Kindly destroy all copies of this message and any =
attachments.  Any other use of this email is prohibited.  =
Thank you for your cooperation.  For more information about =
Vantage, please visit our website at http://www.vantage.com.

 

------_=_NextPart_001_01C604D7.68C9CCA5-- From pgsql-performance-owner@postgresql.org Mon Dec 19 16:21:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AB97B9DC801 for ; Mon, 19 Dec 2005 16:21:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39305-05 for ; Mon, 19 Dec 2005 16:21:16 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-3.sun.com (brmea-mail-3.Sun.COM [192.18.98.34]) by postgresql.org (Postfix) with ESMTP id 99A0B9DC810 for ; Mon, 19 Dec 2005 16:21:13 -0400 (AST) Received: from fe-amer-09.sun.com ([192.18.108.183]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id jBJKLB3F022752 for ; Mon, 19 Dec 2005 13:21:11 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IRR00001HSQD200@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 13:21:11 -0700 (MST) Received: from sun.com ([129.147.156.99]) by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTP id <0IRR00LYPHV66IUB@mail-amer.sun.com>; Mon, 19 Dec 2005 13:21:06 -0700 (MST) Received: from [192.18.108.178] (Forwarded-For: [129.148.9.42]) by bedge1-mail1.central.sun.com (mshttpd); Mon, 19 Dec 2005 15:21:06 -0500 Date: Mon, 19 Dec 2005 15:21:06 -0500 From: Jignesh Shah Subject: Re: PostgreSQL and Ultrasparc T1 In-reply-to: To: Luke Lonergan Cc: Juan Casero , pgsql-performance@postgresql.org Message-id: MIME-version: 1.0 X-Mailer: Sun Java(tm) System Messenger Express 6.2-4.02 (built Sep 9 2005) Content-type: text/plain; charset=us-ascii Content-language: en Content-transfer-encoding: 7BIT Content-disposition: inline X-Accept-Language: en References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.120, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200512/462 X-Sequence-Number: 16283 Hi Luke, I got about 720 MB/sec to 730 MB/sec with plain dd tests on my current storage configuration (8 LUNS on 4 fibers) which slowed me down (10K rpm 146 GB disks FC) with 4 LUNS going through a longer pass to the disks (via a controller master array to slave JBODs to provide ) . extended device statistics r/s w/s Mr/s Mw/s wait actv wsvc_t asvc_t %w %b device 0.8 14.0 0.0 0.0 0.0 0.3 0.0 17.8 0 4 c3t0d0 91.4 0.0 91.4 0.0 0.0 1.0 0.0 10.5 0 96 c0t40d0 96.0 0.0 96.0 0.0 0.0 1.0 0.0 10.0 0 96 c5t40d1 95.8 0.0 95.8 0.0 0.0 1.0 0.0 10.0 0 96 c0t40d1 96.8 0.0 96.8 0.0 0.0 1.0 0.0 9.9 0 96 c5t40d0 84.6 0.0 84.6 0.0 0.0 1.0 0.0 11.4 0 96 c4t46d1 85.6 0.0 85.6 0.0 0.0 1.0 0.0 11.2 0 96 c4t46d0 85.2 0.0 85.2 0.0 0.0 1.0 0.0 11.3 0 96 c2t46d1 85.4 0.0 85.4 0.0 0.0 1.0 0.0 11.3 0 96 c2t46d0 I can probably bump it up a bit with fine storage tuning (LUN) but there is no limitation on the Sun Fire T2000 to bottleneck on anything plus dd tests are not the best throughput measurement tool. Yes UltraSPARC T1 supports the SPARC V9 architecture and can support all the SPARC binaries already generated or newly generated using gcc or Sun Studio 11 which is also free. http://developers.sun.com/prodtech/cc/downloads/sun_studio/ Regards, Jignesh ----- Original Message ----- From: Luke Lonergan Date: Monday, December 19, 2005 2:38 pm Subject: Re: [PERFORM] PostgreSQL and Ultrasparc T1 To: Jignesh Shah Cc: Juan Casero , pgsql-performance@postgresql.org > Jignesh, > > On 12/19/05 11:29 AM, "Jignesh Shah" wrote: > > > I have gone to the max with 4 fibers on Sun Fire T2000. But I am > not sure > > about the answers that you asked. Let me see if I can get answers > for them. I > > am going to try to max out the IO on these systems with 8 fibers > as soon as I > > get additional storage so stay tuned for that. > > Cool - how close did you get to 800MB/s? > > > By the way you don't have to wait for my tests. Just get a trial > server and > > try it on your own. If you don't like it return it. > > > > https://www.sun.com/emrkt/trycoolthreads/contactme.html > > Done - I'll certainly test Postgres / Bizgres on it - you know me ;-) > > > However if you do try it with PostgreSQL, do let me know also > with your > > experience. > > See above. > > The Niagara is UltraSparc III compatible - so the GCC compiler > should emit > good code for it, right? > > - Luke > > > > ---------------------------(end of broadcast)----------------------- > ---- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Mon Dec 19 16:23:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7F7AF9DC9DA for ; Mon, 19 Dec 2005 16:23:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43371-02 for ; Mon, 19 Dec 2005 16:23:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35510.mail.mud.yahoo.com (web35510.mail.mud.yahoo.com [66.163.179.134]) by postgresql.org (Postfix) with SMTP id 235529DC9DB for ; Mon, 19 Dec 2005 16:22:59 -0400 (AST) Received: (qmail 30742 invoked by uid 60001); 19 Dec 2005 20:22:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=3YcfUsHqrGjrYvZKjya86Byn1lv+6vgO6pAAcCMXtw/61QEJ4dQBg6dmtL4pt08YZyanvdbu/bs2JNXvPvdDB3Z9gyWfp3HN8NyOmRZav/3fXdXVkm400IiuYQki2BdpVDi8Lcmwghb4O5q65GcQVpAl+PonCB+Lo5XjtTvq8nE= ; Message-ID: <20051219202258.30740.qmail@web35510.mail.mud.yahoo.com> Received: from [201.2.221.147] by web35510.mail.mud.yahoo.com via HTTP; Mon, 19 Dec 2005 20:22:58 GMT Date: Mon, 19 Dec 2005 20:22:58 +0000 (GMT) From: Carlos Benkendorf Subject: Is the optimizer choice right? To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-222280443-1135023778=:30675" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.24 required=5 tests=[AWL=0.239, HTML_MESSAGE=0.001] X-Spam-Score: 0.24 X-Spam-Level: X-Archive-Number: 200512/463 X-Sequence-Number: 16284 --0-222280443-1135023778=:30675 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, We�re running 8.03 and I�m trying to understand why the following SELECT doesn�t use iarchave05 index. If you disable seqscan then iarchave05 index is used and the total runtime is about 50% less than when iarchave05 index is not used. Why is the optimizer not using iarchave05 index? select * from iparq.arript where (anocalc = 2005 and rtrim(inscimob) = rtrim('010100101480010000') and codvencto2 = 1 and parcela2 >= 0) or (anocalc = 2005 and rtrim(inscimob) = rtrim('010100101480010000') and codvencto2 > 1) or (anocalc = 2005 and rtrim(inscimob) > rtrim('010100101480010000')) or (anocalc > 2005) order by anocalc, inscimob, codvencto2, parcela2; Explain analyze with set enable_seqscan and enable_nestloop to on; QUERY PLAN   -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=231852.08..232139.96 rows=115153 width=896) (actual time=38313.953..38998.019 rows=167601 loops=1) Sort Key: anocalc, inscimob, codvencto2, parcela2 -> Seq Scan on arript (cost=0.00..170201.44 rows=115153 width=896) (actual time=56.979..13364.748 rows=167601 loops=1) Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric)) Total runtime: 39247.521 ms (5 rows) Sort (cost=232243.19..232531.55 rows=115346 width=896) (actual time=46590.246..47225.910 rows=167601 loops=1) Sort Key: anocalc, inscimob, codvencto2, parcela2 -> Seq Scan on arript (cost=0.00..170486.86 rows=115346 width=896) (actual time=54.573..13737.535 rows=167601 loops=1) Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric)) Total runtime: 47479.861 ms (5 rows) Sort (cost=232281.07..232569.48 rows=115365 width=896) (actual time=40856.792..41658.379 rows=167601 loops=1) Sort Key: anocalc, inscimob, codvencto2, parcela2 -> Seq Scan on arript (cost=0.00..170515.00 rows=115365 width=896) (actual time=58.584..13529.589 rows=167601 loops=1) Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric)) Total runtime: 41909.792 ms (5 rows) Explain analyze with set enable_seqscan and enable_nestloop to off; ; QUERY PLAN   Index Scan using iarchave05 on arript (cost=0.00..238964.80 rows=115255 width=896) (actual time=13408.139..19814.848 rows=167601 loops=1) Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric)) Total runtime: 20110.892 ms (3 rows) Index Scan using iarchave05 on arript (cost=0.00..239091.81 rows=115320 width=896) (actual time=14238.672..21598.862 rows=167601 loops=1) Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric)) Total runtime: 21967.840 ms (3 rows) Index Scan using iarchave05 on arript (cost=0.00..239115.06 rows=115331 width=896) (actual time=13863.863..20504.503 rows=167601 loops=1) Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric)) Total runtime: 20768.244 ms (3 rows) Table definition: Table "iparq.arript" Column | Type | Modifiers -------------------+-----------------------+----------- anocalc | numeric(4,0) | not null cadastro | numeric(8,0) | not null codvencto | numeric(2,0) | not null parcela | numeric(2,0) | not null inscimob | character varying(18) | not null codvencto2 | numeric(2,0) | not null parcela2 | numeric(2,0) | not null codpropr | numeric(10,0) | not null dtaven | numeric(8,0) | not null ... ... ... Indexes: "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela) "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela) "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2) "iarchave03" btree (codpropr, dtaven) "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2) Thanks in advance! Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-222280443-1135023778=:30675 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi,
 
We�re running 8.03 and I�m trying to understand why the following SELECT doesn�t use iarchave05 index.
 
If you disable seqscan then iarchave05 index is used and the total runtime is about 50% less than when iarchave05 index is not used.
 
Why is the optimizer not using iarchave05 index?

 select * from iparq.arript
 where
 (anocalc = 2005
 and rtrim(inscimob) = rtrim('010100101480010000')
 and codvencto2 = 1
 and parcela2 >= 0)
 or
 (anocalc = 2005
 and rtrim(inscimob) = rtrim('010100101480010000')
 and codvencto2 > 1)
 or
 (anocalc = 2005
 and rtrim(inscimob) > rtrim('010100101480010000'))
 or
 (anocalc > 2005)
 order by
 anocalc,
 inscimob,
 codvencto2,
 parcela2;

Explain analyze with  set enable_seqscan and enable_nestloop to on;
                                                                                                                                                                   &nbs p;                                  QUERY PLAN                                                                                                                                                                    & nbsp;&nb sp; 
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=231852.08..232139.96 rows=115153 width=896) (actual time=38313.953..38998.019 rows=167601 loops=1)
   Sort Key: anocalc, inscimob, codvencto2, parcela2
   ->  Seq Scan on arript  (cost=0.00..170201.44 rows=115153 width=896) (actual time=56.979..13364.748 rows=167601 loops=1)
         Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric))
 Total runtime: 39247.521 ms
(5 rows)
 Sort  (cost=232243.19..232531.55 rows=115346 width=896) (actual time=46590.246..47225.910 rows=167601 loops=1)
   Sort Key: anocalc, inscimob, codvencto2, parcela2
   ->  Seq Scan on arript  (cost=0.00..170486.86 rows=115346 width=896) (actual time=54.573..13737.535 rows=167601 loops=1)
         Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::nu meric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric))
 Total runtime: 47479.861 ms
(5 rows)

 Sort  (cost=232281.07..232569.48 rows=115365 width=896) (actual time=40856.792..41658.379 rows=167601 loops=1)
   Sort Key: anocalc, inscimob, codvencto2, parcela2
   ->  Seq Scan on arript  (cost=0.00..170515.00 rows=115365 width=896) (actual time=58.584..13529.589 rows=167601 loops=1)
         Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric))
 Total runtime: 41909.7 92 ms
(5 rows)
Explain analyze with  set enable_seqscan and enable_nestloop to off;
                                                                                                                                                                   &nb sp;  ;                             QUERY PLAN                                                                                                                                                                    & nbsp;&nb sp;    
 Index Scan using iarchave05 on arript  (cost=0.00..238964.80 rows=115255 width=896) (actual time=13408.139..19814.848 rows=167601 loops=1)
   Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric))
 Total runtime: 20110.892 ms
(3 rows)

 Index Scan using iarchave05 on arript  (cost=0.00..239091.81 rows=115320 width=896) (actual time=14238.672..21598.862 rows=167601 loops=1)
   Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric))
 Total runtime: 21967.840 ms
(3 rows)

 Index Scan using iarchave05 on arript  (cost=0.00..239115.06 rows=115331 width=896) (actual time=13863.863..20504.503 rows=167601 loops=1)
   Filter: (((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 = 1::numeric) AND (parcela2 >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) = '010100101480010000'::text) AND (codvencto2 > 1::numeric)) OR ((anocalc = 2005::numeric) AND (rtrim((inscimob)::text) > '010100101480010000'::text)) OR (anocalc > 2005::numeric))
 Total runtime: 20768.244 ms
(3 rows)
Table definition:
                 Table "iparq.arript"
      Column       |         Type          | Modifiers
-------------------+-----------------------+-----------
 anocalc           | numeric(4,0)          | not null
 cadastro          | numeric(8,0)          | not null
 codvencto         | numeric(2,0)          | not null
 parcela           | numeric(2,0)        &nbs p; | not null
 inscimob          | character varying(18) | not null
 codvencto2        | numeric(2,0)          | not null
 parcela2          | numeric(2,0)          | not null
 codpropr          | numeric(10,0)         | not null
 dtaven            | numeric(8,0)          | not null
...
...
...
Indexes:
    "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela)
    "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela)
    "iarchave02" btree (inscimob, anocalc , codvencto2, parcela2)
    "iarchave03" btree (codpropr, dtaven)
    "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2)
 
Thanks in advance!
 
Benkendorf


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-222280443-1135023778=:30675-- From pgsql-performance-owner@postgresql.org Mon Dec 19 16:47:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 546BD9DC82E for ; Mon, 19 Dec 2005 16:47:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44043-06-2 for ; Mon, 19 Dec 2005 16:47:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id 31D469DC9E9 for ; Mon, 19 Dec 2005 16:47:39 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EoRux-0000KR-00; Mon, 19 Dec 2005 15:47:35 -0500 To: "Cristian Prieto" Cc: Subject: Re: Any way to optimize GROUP BY queries? References: <00d701c604c1$e6945d80$6500a8c0@gt.ClickDiario.local> In-Reply-To: <00d701c604c1$e6945d80$6500a8c0@gt.ClickDiario.local> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 19 Dec 2005 15:47:35 -0500 Message-ID: <87wti0ak60.fsf@stark.xeocode.com> Lines: 25 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200512/464 X-Sequence-Number: 16285 "Cristian Prieto" writes: > SELECT adv, pub, web, country, date_trunc('hour', tiempo), sum(num) > FROM mytmp GROUP BY adv, pub, web, country, date_trunc('hour', tiempo) > > I've tried to create index in different columns but it seems that the group > by clause doesn't use the index in any way. If you had an index on < adv,pub,web,country,date_trunc('hour',tiemp) > then it would be capable of using the index however it would choose not to unless you forced it to. Using the index would be slower. > Is around there any stuff to accelerate the group by kind of clauses? Increase your work_mem (or sort_mem in older postgres versions), you can do this for the server as a whole or just for this one session and set it back after this one query. You can increase it up until it starts causing swapping at which point it would be counter productive. If increasing work_mem doesn't allow a hash aggregate or at least an in-memory sort to handle it then putting the pgsql_tmp directory on a separate spindle might help if you have any available. -- greg From pgsql-performance-owner@postgresql.org Mon Dec 19 16:54:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4B8919DC801 for ; Mon, 19 Dec 2005 16:54:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49821-05 for ; Mon, 19 Dec 2005 16:54:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id 27FDE9DC810 for ; Mon, 19 Dec 2005 16:54:36 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EoS1d-0000QO-00; Mon, 19 Dec 2005 15:54:29 -0500 To: Carlos Benkendorf Cc: pgsql-performance@postgresql.org Subject: Re: Is the optimizer choice right? References: <20051219202258.30740.qmail@web35510.mail.mud.yahoo.com> In-Reply-To: <20051219202258.30740.qmail@web35510.mail.mud.yahoo.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 19 Dec 2005 15:54:29 -0500 Message-ID: <87r788ajui.fsf@stark.xeocode.com> Lines: 29 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 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, score=0.076 required=5 tests=[AWL=0.076] X-Spam-Score: 0.076 X-Spam-Level: X-Archive-Number: 200512/465 X-Sequence-Number: 16286 Carlos Benkendorf writes: > Hi, > > We�re running 8.03 and I�m trying to understand why the following SELECT doesn�t use iarchave05 index. > > If you disable seqscan then iarchave05 index is used and the total runtime > is about 50% less than when iarchave05 index is not used. > > Why is the optimizer not using iarchave05 index? The optimizer is calculating that the index scan would require more i/o than the sequential scan and be slower. The only reason it isn't is because most of the data is cached from your previous tests. If this test accurately represents the production situation and most of this data is in fact routinely cached then you might consider lowering the random_page_cost to represent this. The value of 4 is reasonable for actual i/o but if most of the data is cached then you effectively are getting something closer to 1. Try 2 or 1.5 or so. Note that the sequential scan has to scan the entire table. The index scan has to scan the entire table *and* the entire index, and in a pretty random order. If the table didn't fit entirely in RAM it would end up reading the entire table several times over. -- greg From pgsql-performance-owner@postgresql.org Mon Dec 19 20:31:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 822549DC9E9 for ; Mon, 19 Dec 2005 20:31:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38190-05 for ; Mon, 19 Dec 2005 20:31:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.151]) by postgresql.org (Postfix) with ESMTP id 2FB2A9DC86C for ; Mon, 19 Dec 2005 20:31:31 -0400 (AST) Received: from [192.168.1.21] (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc11) with ESMTP id <2005122000263001300c8q2ke>; Tue, 20 Dec 2005 00:26:31 +0000 From: Juan Casero To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Ultrasparc T1 Date: Mon, 19 Dec 2005 19:32:25 -0500 User-Agent: KMail/1.8.2 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512191932.25699.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.671 required=5 tests=[AWL=-0.648, DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 1.671 X-Spam-Level: * X-Archive-Number: 200512/466 X-Sequence-Number: 16287 Ok. That is what I wanted to know. Right now this database is a PostgreSQL 7.4.8 system. I am using it in a sort of DSS role. I have weekly summaries of the sales for our division going back three years. I have a PHP based webapp that I wrote to give the managers access to this data. The webapp lets them make selections for reports and then it submits a parameterized query to the database for execution. The returned data rows are displayed and formatted in their web browser. My largest sales table is about 13 million rows along with all the indexes it takes up about 20 gigabytes. I need to scale this application up to nearly 100 gigabytes to handle daily sales summaries. Once we start looking at daily sales figures our database size could grow ten to twenty times. I use postgresql because it gives me the kind of enterprise database features I need to program the complex logic for the queries. I also need the transaction isolation facilities it provides so I can optimize the queries in plpgsql without worrying about multiple users temp tables colliding with each other. Additionally, I hope to rewrite the front end application in JSP so maybe I could use the multithreaded features of the Java to exploit a multicore multi-cpu system. There are almost no writes to the database tables. The bulk of the application is just executing parameterized queries and returning huge amounts of data. I know bizgres is supposed to be better at this but I want to stay away from anything that is beta. I cannot afford for this thing to go wrong. My reasoning for looking at the T1000/2000 was simply the large number of cores. I know postgresql uses a super server that forks copies of itself to handle incoming requests on port 5432. But I figured the number of cores on the T1000/2000 processors would be utilized by the forked copies of the postgresql server. From the comments I have seen so far it does not look like this is the case. We had originally sized up a dual processor dual core AMD opteron system from HP for this but I thought I could get more bang for the buck on a T1000/2000. It now seems I may have been wrong. I am stronger in Linux than Solaris so I am not upset I am just trying to find the best hardware for the anticipated needs of this application. Thanks, Juan On Monday 19 December 2005 01:25, Scott Marlowe wrote: > From: pgsql-performance-owner@postgresql.org on behalf of Juan Casero > > QUOTE: > > Hi - > > > Can anyone tell me how well PostgreSQL 8.x performs on the new Sun > Ultrasparc T1 processor and architecture on Solaris 10? I have a custom > built retail sales reporting that I developed using PostgreSQL 7.48 and PHP > on a Fedora Core 3 intel box. I want to scale this application upwards to > handle a database that might grow to a 100 GB. Our company is green > mission conscious now so I was hoping I could use that to convince > management to consider a Sun Ultrasparc T1 or T2 system provided that if I > can get the best performance out of it on PostgreSQL. > > ENDQUOTE: > > Well, generally, AMD 64 bit is going to be a better value for your dollar, > and run faster than most Sparc based machines. > > Also, PostgreSQL is generally faster under either BSD or Linux than under > Solaris on the same box. This might or might not hold as you crank up the > numbers of CPUs. > > PostgreSQL runs one process for connection. So, to use extra CPUs, you > really need to have >1 connection running against the database. > > Mostly, databases tend to be either I/O bound, until you give them a lot of > I/O, then they'll be CPU bound. > > After that lots of memory, THEN more CPUs. Two CPUs is always useful, as > one can be servicing the OS and another the database. But unless you're > gonna have lots of users hooked up, more than 2 to 4 CPUs is usually a > waste. > > So, I'd recommend a dual core or dual dual core (i.e. 4 cores) AMD64 system > with 2 or more gigs ram, and at least a pair of fast drives in a mirror > with a hardare RAID controller with battery backed cache. If you'll be > trundling through all 100 gigs of your data set regularly, then get all the > memory you can put in a machine at a reasonable cost before buying lots of > CPUs. > > But without knowing what you're gonna be doing we can't really make solid > recommendations... From pgsql-performance-owner@postgresql.org Mon Dec 19 20:41:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2716C9DC9C5 for ; Mon, 19 Dec 2005 20:41:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41670-05 for ; Mon, 19 Dec 2005 20:41:14 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D20DB9DC9FF for ; Mon, 19 Dec 2005 20:41:09 -0400 (AST) Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) by svr4.postgresql.org (Postfix) with ESMTP id AAEF55AF06A for ; Tue, 20 Dec 2005 00:41:13 +0000 (GMT) Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net [64.4.232.33]) (authenticated bits=0) by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id jBK0f9t9008099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 19 Dec 2005 15:41:10 -0900 Message-ID: <43A75325.7070006@aptalaska.net> Date: Mon, 19 Dec 2005 15:41:09 -0900 From: Matthew Schumacher User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: SAN/NAS options References: <20051216221909.GU53809@pervasive.com> In-Reply-To: <20051216221909.GU53809@pervasive.com> X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Bayes: Learn: ham X-Scanned-By: MIMEDefang 2.53 on 64.186.96.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/467 X-Sequence-Number: 16288 Jim C. Nasby wrote: > On Wed, Dec 14, 2005 at 01:56:10AM -0500, Charles Sprickman wrote: > You'll note that I'm being somewhat driven by my OS of choice, FreeBSD. > >>Unlike Solaris or other commercial offerings, there is no nice volume >>management available. While I'd love to keep managing a dozen or so >>FreeBSD boxes, I could be persuaded to go to Solaris x86 if the volume >>management really shines and Postgres performs well on it. > > > Have you looked at vinum? It might not qualify as a true volume manager, > but it's still pretty handy. I am looking very closely at purchasing a SANRAD Vswitch 2000, a Nexsan SATABoy with SATA disks, and the Qlogic iscsi controller cards. Nexsan claims up to 370MB/s sustained per controller and 44,500 IOPS but I'm not sure if that is good or bad. It's certainly faster than the LSI megaraid controller I'm using now with a raid 1 mirror. The sanrad box looks like it saves money in that you don't have to by controller cards for everything, but for I/O intensive servers such as the database server, I would end up buying an iscsi controller card anyway. At this point I'm not sure what the best solution is. I like the idea of having logical disks available though iscsi because of how flexible it is, but I really don't want to spend $20k (10 for the nexsan and 10 for the sanrad) and end up with poor performance. On other advantage to iscsi is that I can go completely diskless on my servers and boot from iscsi which means that I don't have to have spare disks for each host, now I just have spare disks for the nexsan chassis. So the question becomes: has anyone put postgres on an iscsi san, and if so how did it perform? schu From pgsql-performance-owner@postgresql.org Mon Dec 19 21:25:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BAB989DCA09 for ; Mon, 19 Dec 2005 21:25:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44443-09 for ; Mon, 19 Dec 2005 21:25:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id CA1A59DC813 for ; Mon, 19 Dec 2005 21:24:58 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Subject: Re: SAN/NAS options Date: Mon, 19 Dec 2005 20:24:59 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F12@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] SAN/NAS options Thread-Index: AcYE/jBPvcyplJRsQXO3dbmKurrkrgAAsZ+E From: "Anjan Dave" To: "Matthew Schumacher" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.154 required=5 tests=[AWL=0.154] X-Spam-Score: 0.154 X-Spam-Level: X-Archive-Number: 200512/468 X-Sequence-Number: 16289 VXN1YWxseSBtYW51ZmFjdHVyZXIncyBjbGFpbXMgYXJlIHRlc3RlZCBpbiAnaWRlYWwnIGNvbmRp dGlvbnMsIGl0IG1heSBub3QgdHJhbnNsYXRlIHdlbGwgb24gYmFuZHdpZHRoIHNlZW4gb24gdGhl IGhvc3Qgc2lkZS4gQSAyR2JwcyBGaWJlciBDaGFubmVsIGNvbm5lY3Rpb24gd291bGQgKGlkZWFs bHkpIGdpdmUgeW91IGFib3V0IDI1ME1CL3NlYyBwZXIgSEJBLiBOb3Qgc3VyZSBob3cgaXQgdHJh bnNsYXRlcyBmb3IgR2lnRSBjb25zaWRlcmluZyBzY3NpIHByb3RvY29sIG92ZXJoZWFkcywgYnV0 IHlvdSBtYXkgd2FudCB0byBjb25maXJtIGZyb20gdGhlbSBob3cgdGhleSBhY2hpZXZlZCAzNzBN Qi9zZWMgKGh3byBtYW55IGlTQ1NJIGNvbnRyb2xsZXJzLCB3aGF0IGZpbGUgc3lzdGVtLCBob3cg bWFueSBkcml2ZXMsIHdoYXQgUkFJRCB0eXBlLCBibG9jayBzaXplLCBzdHJpcCBzaXplLCBjYWNo ZSBzZXR0aW5ncywgZXRjKSwgYW5kIHdoZXRoZXIgaXQgd2FzIHBoeXNpY2FsIEkvTyBvciBjYWNo ZWQuIEluIG90aGVyIHdvcmRzLCBpZiBzb21lb25lIGhhcyBhbnkgYmVuY2htYXJrIG51bWJlcnMs IHRoYXQgd291bGQgYmUgaGVscGZ1bC4NCiANClJlZ2FyZGluZyBkaXNrbGVzcyBpc2NzaSBib290 cyBmb3IgZnV0dXJlIHNlcnZlcnMsIHJlbWVtYmVyIHRoYXQgaXQncyBhIHNoYXJlZCBzdG9yYWdl LCBpZiB5b3UgaGF2ZSBhIGJ1c3kgc2VydmVyIGF0dGFjaGVkIHRvIHlvdXIgTmV4c2FuLCB5b3Ug bWF5IGhhdmUgdG8gdGhpbmsgdHdpY2Ugb24gc2hhcmluZyB0aGUgcGVyZm9ybWFuY2UgKHRocm91 Z2hwdXQgYW5kIElPUFMgb2YgdGhlIHN0b3JhZ2UgY29udHJvbGxlcikgd2l0aG91dCBpbXBhY3Rp bmcgdGhlIGV4aXN0aW5nIGhvc3RzLCB1bmxlc3MgeW91IGFyZSB6aXppbmcgaXQgbm93Lg0KIA0K QW5kIHlvdSB3YW50IHRvIGhhdmUgYSBwcmV0dHkgY2xlYW4gR2lnRSBuZXR3b3JrLCBtb3JlIG9y IGxlc3MgZGVkaWNhdGVkIHRvIHRoaXMgYmxvY2sgdHJhZmZpYy4NCiANCkxhcmdlIGludGVybmFs IHN0b3JhZ2Ugd2l0aCBtb3JlIG1lbW9yeSBhbmQgQU1EIENQVXMgaXMgYW4gb3B0aW9uIGFzIEx1 a2UgaGFkIG9yaWdpbmFsbHkgc3VnZ2VzdGVkLiBDaGVjayBvdXQgQXBwcm8gYXMgd2VsbC4NCiAN CkknZCBhbHNvIGJlIGN1cmlvdXMgdG8ga25vdyBpZiBzb21lb25lIGhhcyBiZWVuIHVzaW5nIHRo aXMgKFNBVEEvaVNDU0kvU0FTKSBzb2x1dGlvbiBhbmQgd2hhdCBhcmUgc29tZSBJL08gbnVtYmVy cyBvYnNlcnZlZC4NCiANClRoYW5rcywNCkFuamFuDQoNCgktLS0tLU9yaWdpbmFsIE1lc3NhZ2Ut LS0tLSANCglGcm9tOiBNYXR0aGV3IFNjaHVtYWNoZXIgW21haWx0bzptYXR0LnNAYXB0YWxhc2th Lm5ldF0gDQoJU2VudDogTW9uIDEyLzE5LzIwMDUgNzo0MSBQTSANCglUbzogcGdzcWwtcGVyZm9y bWFuY2VAcG9zdGdyZXNxbC5vcmcgDQoJQ2M6IA0KCVN1YmplY3Q6IFJlOiBbUEVSRk9STV0gU0FO L05BUyBvcHRpb25zDQoJDQoJDQoNCglKaW0gQy4gTmFzYnkgd3JvdGU6IA0KCT4gT24gV2VkLCBE ZWMgMTQsIDIwMDUgYXQgMDE6NTY6MTBBTSAtMDUwMCwgQ2hhcmxlcyBTcHJpY2ttYW4gd3JvdGU6 IA0KCT4gIFlvdSdsbCBub3RlIHRoYXQgSSdtIGJlaW5nIHNvbWV3aGF0IGRyaXZlbiBieSBteSBP UyBvZiBjaG9pY2UsIEZyZWVCU0QuIA0KCT4gDQoJPj5Vbmxpa2UgU29sYXJpcyBvciBvdGhlciBj b21tZXJjaWFsIG9mZmVyaW5ncywgdGhlcmUgaXMgbm8gbmljZSB2b2x1bWUgDQoJPj5tYW5hZ2Vt ZW50IGF2YWlsYWJsZS4gIFdoaWxlIEknZCBsb3ZlIHRvIGtlZXAgbWFuYWdpbmcgYSBkb3plbiBv ciBzbyANCgk+PkZyZWVCU0QgYm94ZXMsIEkgY291bGQgYmUgcGVyc3VhZGVkIHRvIGdvIHRvIFNv bGFyaXMgeDg2IGlmIHRoZSB2b2x1bWUgDQoJPj5tYW5hZ2VtZW50IHJlYWxseSBzaGluZXMgYW5k IFBvc3RncmVzIHBlcmZvcm1zIHdlbGwgb24gaXQuIA0KCT4gDQoJPiANCgk+IEhhdmUgeW91IGxv b2tlZCBhdCB2aW51bT8gSXQgbWlnaHQgbm90IHF1YWxpZnkgYXMgYSB0cnVlIHZvbHVtZSBtYW5h Z2VyLCANCgk+IGJ1dCBpdCdzIHN0aWxsIHByZXR0eSBoYW5keS4gDQoNCglJIGFtIGxvb2tpbmcg dmVyeSBjbG9zZWx5IGF0IHB1cmNoYXNpbmcgYSBTQU5SQUQgVnN3aXRjaCAyMDAwLCBhIE5leHNh biANCglTQVRBQm95IHdpdGggU0FUQSBkaXNrcywgYW5kIHRoZSBRbG9naWMgaXNjc2kgY29udHJv bGxlciBjYXJkcy4gDQoNCglOZXhzYW4gY2xhaW1zIHVwIHRvIDM3ME1CL3Mgc3VzdGFpbmVkIHBl ciBjb250cm9sbGVyIGFuZCA0NCw1MDAgSU9QUyBidXQgDQoJSSdtIG5vdCBzdXJlIGlmIHRoYXQg aXMgZ29vZCBvciBiYWQuICBJdCdzIGNlcnRhaW5seSBmYXN0ZXIgdGhhbiB0aGUgTFNJIA0KCW1l Z2FyYWlkIGNvbnRyb2xsZXIgSSdtIHVzaW5nIG5vdyB3aXRoIGEgcmFpZCAxIG1pcnJvci4gDQoN CglUaGUgc2FucmFkIGJveCBsb29rcyBsaWtlIGl0IHNhdmVzIG1vbmV5IGluIHRoYXQgeW91IGRv bid0IGhhdmUgdG8gYnkgDQoJY29udHJvbGxlciBjYXJkcyBmb3IgZXZlcnl0aGluZywgYnV0IGZv ciBJL08gaW50ZW5zaXZlIHNlcnZlcnMgc3VjaCBhcyANCgl0aGUgZGF0YWJhc2Ugc2VydmVyLCBJ IHdvdWxkIGVuZCB1cCBidXlpbmcgYW4gaXNjc2kgY29udHJvbGxlciBjYXJkIGFueXdheS4gDQoN CglBdCB0aGlzIHBvaW50IEknbSBub3Qgc3VyZSB3aGF0IHRoZSBiZXN0IHNvbHV0aW9uIGlzLiAg SSBsaWtlIHRoZSBpZGVhIA0KCW9mIGhhdmluZyBsb2dpY2FsIGRpc2tzIGF2YWlsYWJsZSB0aG91 Z2ggaXNjc2kgYmVjYXVzZSBvZiBob3cgZmxleGlibGUgDQoJaXQgaXMsIGJ1dCBJIHJlYWxseSBk b24ndCB3YW50IHRvIHNwZW5kICQyMGsgKDEwIGZvciB0aGUgbmV4c2FuIGFuZCAxMCANCglmb3Ig dGhlIHNhbnJhZCkgYW5kIGVuZCB1cCB3aXRoIHBvb3IgcGVyZm9ybWFuY2UuIA0KDQoJT24gb3Ro ZXIgYWR2YW50YWdlIHRvIGlzY3NpIGlzIHRoYXQgSSBjYW4gZ28gY29tcGxldGVseSBkaXNrbGVz cyBvbiBteSANCglzZXJ2ZXJzIGFuZCBib290IGZyb20gaXNjc2kgd2hpY2ggbWVhbnMgdGhhdCBJ IGRvbid0IGhhdmUgdG8gaGF2ZSBzcGFyZSANCglkaXNrcyBmb3IgZWFjaCBob3N0LCBub3cgSSBq dXN0IGhhdmUgc3BhcmUgZGlza3MgZm9yIHRoZSBuZXhzYW4gY2hhc3Npcy4gDQoNCglTbyB0aGUg cXVlc3Rpb24gYmVjb21lczogaGFzIGFueW9uZSBwdXQgcG9zdGdyZXMgb24gYW4gaXNjc2kgc2Fu LCBhbmQgaWYgDQoJc28gaG93IGRpZCBpdCBwZXJmb3JtPyANCg0KCXNjaHUgDQoNCg0KDQoJLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBvZiBicm9hZGNhc3QpLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tIA0KCVRJUCA0OiBIYXZlIHlvdSBzZWFyY2hlZCBvdXIgbGlzdCBhcmNoaXZl cz8gDQoNCgkgICAgICAgICAgICAgICBodHRwOi8vYXJjaGl2ZXMucG9zdGdyZXNxbC5vcmcgDQoN Cg== From pgsql-performance-owner@postgresql.org Mon Dec 19 21:35:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 759B39DCA1E for ; Mon, 19 Dec 2005 21:35:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51218-01-7 for ; Mon, 19 Dec 2005 21:35:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id A274C9DCA15 for ; Mon, 19 Dec 2005 21:34:32 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Mon, 19 Dec 2005 20:34:32 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Dec 2005 20:34:32 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 20 Dec 2005 01:34:31 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 19 Dec 2005 17:34:31 -0800 Subject: Re: PostgreSQL and Ultrasparc T1 From: "Luke Lonergan" To: "Jignesh Shah" cc: "Juan Casero" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] PostgreSQL and Ultrasparc T1 Thread-Index: AcYE2cfZIe1w3tZWSUitym8yVww/KwAK75Iu In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 20 Dec 2005 01:34:32.0372 (UTC) FILETIME=[86F38740:01C60505] X-WSS-ID: 6FB980222347239357-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.266 required=5 tests=[AWL=0.013, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.266 X-Spam-Level: * X-Archive-Number: 200512/469 X-Sequence-Number: 16290 Jignesh, On 12/19/05 12:21 PM, "Jignesh Shah" wrote: > I got about 720 MB/sec to 730 MB/sec with plain dd tests on my current > storage configuration (8 LUNS on 4 fibers) which slowed me down (10K rpm 146 > GB disks FC) with 4 LUNS going through a longer pass to the disks (via a > controller master array to slave JBODs to provide ) . > > extended device statistics > r/s w/s Mr/s Mw/s wait actv wsvc_t asvc_t %w %b device > 0.8 14.0 0.0 0.0 0.0 0.3 0.0 17.8 0 4 c3t0d0 > 91.4 0.0 91.4 0.0 0.0 1.0 0.0 10.5 0 96 c0t40d0 > 96.0 0.0 96.0 0.0 0.0 1.0 0.0 10.0 0 96 c5t40d1 > 95.8 0.0 95.8 0.0 0.0 1.0 0.0 10.0 0 96 c0t40d1 Can you please explain these columns? R/s, is that millions of pages or extents or something? How do I translate this to 730 million bytes per second? - Luke From pgsql-performance-owner@postgresql.org Mon Dec 19 21:37:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A11149DC81E for ; Mon, 19 Dec 2005 21:37:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51252-03 for ; Mon, 19 Dec 2005 21:37:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id 44E5E9DC813 for ; Mon, 19 Dec 2005 21:37:39 -0400 (AST) Received: from 172.16.1.148 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 19 Dec 2005 20:37:36 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Dec 2005 20:37:36 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 20 Dec 2005 01:37:35 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 19 Dec 2005 17:37:35 -0800 Subject: Re: PostgreSQL and Ultrasparc T1 From: "Luke Lonergan" To: "Jignesh Shah" cc: "Juan Casero" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] PostgreSQL and Ultrasparc T1 Thread-Index: AcYE2cfZIe1w3tZWSUitym8yVww/KwALCv06 In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 20 Dec 2005 01:37:36.0012 (UTC) FILETIME=[F468C4C0:01C60505] X-WSS-ID: 6FB9BFEA3ZO7532483-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.265 required=5 tests=[AWL=0.012, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.265 X-Spam-Level: * X-Archive-Number: 200512/470 X-Sequence-Number: 16291 Jignesh, On 12/19/05 12:21 PM, "Jignesh Shah" wrote: > extended device statistics > r/s w/s Mr/s Mw/s wait actv wsvc_t asvc_t %w %b device > 0.8 14.0 0.0 0.0 0.0 0.3 0.0 17.8 0 4 c3t0d0 > 91.4 0.0 91.4 0.0 0.0 1.0 0.0 10.5 0 96 c0t40d0 > 96.0 0.0 96.0 0.0 0.0 1.0 0.0 10.0 0 96 c5t40d1 > 95.8 0.0 95.8 0.0 0.0 1.0 0.0 10.0 0 96 c0t40d1 > 96.8 0.0 96.8 0.0 0.0 1.0 0.0 9.9 0 96 c5t40d0 > 84.6 0.0 84.6 0.0 0.0 1.0 0.0 11.4 0 96 c4t46d1 > 85.6 0.0 85.6 0.0 0.0 1.0 0.0 11.2 0 96 c4t46d0 > 85.2 0.0 85.2 0.0 0.0 1.0 0.0 11.3 0 96 c2t46d1 > 85.4 0.0 85.4 0.0 0.0 1.0 0.0 11.3 0 96 c2t46d0 Doh! Forget my last message, each of these is a single drive. Wacky layout though - it looks like c0,c2,c3,c4,c5 - is that 5 controllers there? Also - what are the RAID options on this unit? To get optimal performance on an 8 core unit, would we want to map 1 active process to each of these drives? Can the CPU run all 8 threads simultaneously? - Luke From pgsql-performance-owner@postgresql.org Mon Dec 19 22:08:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E18789DC81E for ; Mon, 19 Dec 2005 22:08:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52066-07 for ; Mon, 19 Dec 2005 22:08:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id 6EC329DC813 for ; Mon, 19 Dec 2005 22:08:21 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Subject: Re: High context switches occurring Date: Mon, 19 Dec 2005 21:08:22 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcX6vxaHOg4SBI2AQImTW5l6K1748gAhSzHwAnE5m2Y= From: "Anjan Dave" To: "Anjan Dave" , "Tom Lane" Cc: "Vivek Khera" , "Postgresql Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.389 required=5 tests=[AWL=-0.090, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.389 X-Spam-Level: X-Archive-Number: 200512/471 X-Sequence-Number: 16292 UmUtcmFuIGl0IDMgdGltZXMgb24gZWFjaCBob3N0IC0gDQogDQpTdW46DQotYmFzaC0zLjAwJCB0 aW1lIHBnYmVuY2ggLXMgMTAgLWMgMTAgLXQgMzAwMCBwZ2JlbmNoDQpzdGFydGluZyB2YWN1dW0u Li5lbmQuDQp0cmFuc2FjdGlvbiB0eXBlOiBUUEMtQiAoc29ydCBvZikNCnNjYWxpbmcgZmFjdG9y OiAxDQpudW1iZXIgb2YgY2xpZW50czogMTANCm51bWJlciBvZiB0cmFuc2FjdGlvbnMgcGVyIGNs aWVudDogMzAwMA0KbnVtYmVyIG9mIHRyYW5zYWN0aW9ucyBhY3R1YWxseSBwcm9jZXNzZWQ6IDMw MDAwLzMwMDAwDQp0cHMgPSA4MjcuODEwNzc4IChpbmNsdWRpbmcgY29ubmVjdGlvbnMgZXN0YWJs aXNoaW5nKQ0KdHBzID0gODI4LjQxMDgwMSAoZXhjbHVkaW5nIGNvbm5lY3Rpb25zIGVzdGFibGlz aGluZykNCnJlYWwgICAgMG0zNi41NzlzDQp1c2VyICAgIDBtMS4yMjJzDQpzeXMgICAgIDBtMy40 MjJzDQoNCkludGVsOg0KLWJhc2gtMy4wMCQgdGltZSBwZ2JlbmNoIC1zIDEwIC1jIDEwIC10IDMw MDAgcGdiZW5jaA0Kc3RhcnRpbmcgdmFjdXVtLi4uZW5kLg0KdHJhbnNhY3Rpb24gdHlwZTogVFBD LUIgKHNvcnQgb2YpDQpzY2FsaW5nIGZhY3RvcjogMQ0KbnVtYmVyIG9mIGNsaWVudHM6IDEwDQpu dW1iZXIgb2YgdHJhbnNhY3Rpb25zIHBlciBjbGllbnQ6IDMwMDANCm51bWJlciBvZiB0cmFuc2Fj dGlvbnMgYWN0dWFsbHkgcHJvY2Vzc2VkOiAzMDAwMC8zMDAwMA0KdHBzID0gNTk3LjA2NzUwMyAo aW5jbHVkaW5nIGNvbm5lY3Rpb25zIGVzdGFibGlzaGluZykNCnRwcyA9IDU5Ny42MDYxNjkgKGV4 Y2x1ZGluZyBjb25uZWN0aW9ucyBlc3RhYmxpc2hpbmcpDQpyZWFsICAgIDBtNTAuMzgwcw0KdXNl ciAgICAwbTIuNjIxcw0Kc3lzICAgICAwbTcuODE4cw0KDQpUaGFua3MsDQpBbmphbg0KIA0KDQoJ LS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0gDQoJRnJvbTogQW5qYW4gRGF2ZSANCglTZW50OiBX ZWQgMTIvNy8yMDA1IDEwOjU0IEFNIA0KCVRvOiBUb20gTGFuZSANCglDYzogVml2ZWsgS2hlcmE7 IFBvc3RncmVzcWwgUGVyZm9ybWFuY2UgDQoJU3ViamVjdDogUmU6IFtQRVJGT1JNXSBIaWdoIGNv bnRleHQgc3dpdGNoZXMgb2NjdXJyaW5nIA0KCQ0KCQ0KDQoJVGhhbmtzIGZvciB5b3VyIGlucHV0 cywgVG9tLiBJIHdhcyBnb2luZyBhZnRlciBoaWdoIGNvbmN1cnJlbnQgY2xpZW50cywgDQoJYnV0 IHNob3VsZCBoYXZlIHJlYWQgdGhpcyBjYXJlZnVsbHkgLSANCg0KCS1zIHNjYWxpbmdfZmFjdG9y IA0KCSAgICAgICAgICAgICAgICB0aGlzIHNob3VsZCBiZSB1c2VkIHdpdGggLWkgKGluaXRpYWxp emUpIG9wdGlvbi4gDQoJICAgICAgICAgICAgICAgIG51bWJlciBvZiB0dXBsZXMgZ2VuZXJhdGVk IHdpbGwgYmUgbXVsdGlwbGUgb2YgdGhlIA0KCSAgICAgICAgICAgICAgICBzY2FsaW5nIGZhY3Rv ci4gRm9yIGV4YW1wbGUsIC1zIDEwMCB3aWxsIGltcGx5IDEwTSANCgkgICAgICAgICAgICAgICAg KDEwLDAwMCwwMDApIHR1cGxlcyBpbiB0aGUgYWNjb3VudHMgdGFibGUuIA0KCSAgICAgICAgICAg ICAgICBkZWZhdWx0IGlzIDEuICBOT1RFOiBzY2FsaW5nIGZhY3RvciBzaG91bGQgYmUgYXQgbGVh c3QgDQoJICAgICAgICAgICAgICAgIGFzIGxhcmdlIGFzIHRoZSBsYXJnZXN0IG51bWJlciBvZiBj bGllbnRzIHlvdSBpbnRlbmQgDQoJICAgICAgICAgICAgICAgIHRvIHRlc3Q7IGVsc2UgeW91J2xs IG1vc3RseSBiZSBtZWFzdXJpbmcgdXBkYXRlIA0KCWNvbnRlbnRpb24uIA0KDQoJSSdsbCByZXJ1 biB0aGUgdGVzdHMuIA0KDQoJVGhhbmtzLCANCglBbmphbiANCg0KDQoJLS0tLS1PcmlnaW5hbCBN ZXNzYWdlLS0tLS0gDQoJRnJvbTogVG9tIExhbmUgW21haWx0bzp0Z2xAc3NzLnBnaC5wYS51c10g DQoJU2VudDogVHVlc2RheSwgRGVjZW1iZXIgMDYsIDIwMDUgNjo0NSBQTSANCglUbzogQW5qYW4g RGF2ZSANCglDYzogVml2ZWsgS2hlcmE7IFBvc3RncmVzcWwgUGVyZm9ybWFuY2UgDQoJU3ViamVj dDogUmU6IFtQRVJGT1JNXSBIaWdoIGNvbnRleHQgc3dpdGNoZXMgb2NjdXJyaW5nIA0KDQoJIkFu amFuIERhdmUiIDxhZGF2ZUB2YW50YWdlLmNvbT4gd3JpdGVzOiANCgk+IC1iYXNoLTMuMDAkIHRp bWUgcGdiZW5jaCAtYyAxMDAwIC10IDMwIHBnYmVuY2ggDQoJPiBzdGFydGluZyB2YWN1dW0uLi5l bmQuIA0KCT4gdHJhbnNhY3Rpb24gdHlwZTogVFBDLUIgKHNvcnQgb2YpIA0KCT4gc2NhbGluZyBm YWN0b3I6IDEgDQoJPiBudW1iZXIgb2YgY2xpZW50czogMTAwMCANCgk+IG51bWJlciBvZiB0cmFu c2FjdGlvbnMgcGVyIGNsaWVudDogMzAgDQoJPiBudW1iZXIgb2YgdHJhbnNhY3Rpb25zIGFjdHVh bGx5IHByb2Nlc3NlZDogMzAwMDAvMzAwMDAgDQoJPiB0cHMgPSA0NS44NzEyMzQgKGluY2x1ZGlu ZyBjb25uZWN0aW9ucyBlc3RhYmxpc2hpbmcpIA0KCT4gdHBzID0gNDYuMDkyNjI5IChleGNsdWRp bmcgY29ubmVjdGlvbnMgZXN0YWJsaXNoaW5nKSANCg0KCUkgY2FuIGhhcmRseSB0aGluayBvZiBh IHdvcnNlIHdheSB0byBydW4gcGdiZW5jaCA6LSguICBUaGVzZSBudW1iZXJzIGFyZSANCglhYm91 dCBtZWFuaW5nbGVzcywgZm9yIHR3byByZWFzb25zOiANCg0KCTEuIFlvdSBkb24ndCB3YW50IG51 bWJlciBvZiBjbGllbnRzICgtYykgbXVjaCBoaWdoZXIgdGhhbiBzY2FsaW5nIGZhY3RvciANCgko LXMgaW4gdGhlIGluaXRpYWxpemF0aW9uIHN0ZXApLiAgVGhlIG51bWJlciBvZiByb3dzIGluIHRo ZSAiYnJhbmNoZXMiIA0KCXRhYmxlIHdpbGwgZXF1YWwgLXMsIGFuZCBzaW5jZSBldmVyeSB0cmFu c2FjdGlvbiB1cGRhdGVzIG9uZSANCglyYW5kb21seS1jaG9zZW4gImJyYW5jaGVzIiByb3csIHlv dSB3aWxsIGJlIG1lYXN1cmluZyBtb3N0bHkgcm93LXVwZGF0ZSANCgljb250ZW50aW9uIG92ZXJo ZWFkIGlmIHRoZXJlJ3MgbW9yZSBjb25jdXJyZW50IHRyYW5zYWN0aW9ucyB0aGFuIHRoZXJlIA0K CWFyZSByb3dzLiAgSW4gdGhlIGNhc2UgLXMgMSwgd2hpY2ggaXMgd2hhdCB5b3UndmUgZ290IGhl cmUsIHRoZXJlIGlzIG5vIA0KCWFjdHVhbCBjb25jdXJyZW5jeSBhdCBhbGwgLS0tIGFsbCB0aGUg dHJhbnNhY3Rpb25zIHN0YWNrIHVwIG9uIHRoZSANCglzaW5nbGUgYnJhbmNoZXMgcm93LiANCg0K CTIuIFJ1bm5pbmcgYSBzbWFsbCBudW1iZXIgb2YgdHJhbnNhY3Rpb25zIHBlciBjbGllbnQgbWVh bnMgdGhhdCANCglzdGFydHVwL3NodXRkb3duIHRyYW5zaWVudHMgb3ZlcndoZWxtIHRoZSBzdGVh ZHktc3RhdGUgZGF0YS4gIFlvdSBzaG91bGQgDQoJcHJvYmFibHkgcnVuIGF0IGxlYXN0IGEgdGhv dXNhbmQgdHJhbnNhY3Rpb25zIHBlciBjbGllbnQgaWYgeW91IHdhbnQgDQoJcmVwZWF0YWJsZSBu dW1iZXJzLiANCg0KCVRyeSBzb21ldGhpbmcgbGlrZSAiLXMgMTAgLWMgMTAgLXQgMzAwMCIgdG8g Z2V0IG51bWJlcnMgcmVmbGVjdGluZyB0ZXN0IA0KCWNvbmRpdGlvbnMgbW9yZSBsaWtlIHdoYXQg dGhlIFRQQyBjb3VuY2lsIGhhZCBpbiBtaW5kIHdoZW4gdGhleSBkZXNpZ25lZCANCgl0aGlzIGJl bmNobWFyay4gIEkgdGVuZCB0byByZXBlYXQgc3VjaCBhIHRlc3QgMyB0aW1lcyB0byBzZWUgaWYg dGhlIA0KCW51bWJlcnMgYXJlIHJlcGVhdGFibGUsIGFuZCBxdW90ZSB0aGUgbWlkZGxlIFRQUyBu dW1iZXIgYXMgbG9uZyBhcyANCgl0aGV5J3JlIG5vdCB0b28gZmFyIGFwYXJ0LiANCg0KCSAgICAg ICAgICAgICAgICAgICAgICAgIHJlZ2FyZHMsIHRvbSBsYW5lIA0KDQoNCgktLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0oZW5kIG9mIGJyb2FkY2FzdCktLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0gDQoJVElQIDU6IGRvbid0IGZvcmdldCB0byBpbmNyZWFzZSB5b3VyIGZyZWUgc3BhY2UgbWFw IHNldHRpbmdzIA0KDQo= From pgsql-performance-owner@postgresql.org Tue Dec 20 02:00:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 09FC79DC82B for ; Tue, 20 Dec 2005 02:00:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08053-03 for ; Tue, 20 Dec 2005 02:00:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 5ADEE9DC822 for ; Tue, 20 Dec 2005 02:00:19 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 78B7B1AC3E9; Mon, 19 Dec 2005 19:21:59 -0800 (PST) Date: Mon, 19 Dec 2005 19:20:56 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Anjan Dave Cc: pgsql-performance@postgresql.org Subject: Re: separate drives for WAL or pgdata files In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F10@vt-pe2550-001.vantage.vantage.com> Message-ID: References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F10@vt-pe2550-001.vantage.vantage.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/475 X-Sequence-Number: 16296 On Mon, 19 Dec 2005, Anjan Dave wrote: > I am not sure if there's an obvious answer to this...If there's a choice > of an external RAID10 (Fiber Channel 6 or 8 15Krpm drives) enabled > drives, what is more beneficial to store on it, the WAL, or the Database > files? One of the other would go on the local RAID10 (4 drives, 15Krpm) > along with the OS. the WAL is small compared to the data, and it's mostly sequential access, so it doesn't need many spindles, it just needs them more-or-less dedicated to the WAL and not distracted by other things. the data is large (by comparison), and is accessed randomly, so the more spindles that you can throw at it the better. In your place I would consider making the server's internal drives into two raid1 pairs (one for the OS, one for the WAL), and then going with raid10 on the external drives for your data > This is a very busy database with high concurrent connections, random > reads and writes. Checkpoint segments are 300 and interval is 6 mins. > Database size is less than 50GB. this is getting dangerously close to being able to fit in ram. I saw an article over the weekend that Samsung is starting to produce 8G DIMM's, that can go 8 to a controller (instead of 4 per as is currently done), when motherboards come out that support this you can have 64G of ram per opteron socket. it will be pricy, but the performance.... in the meantime you can already go 4G/slot * 4 slots/socket and get 64G on a 4-socket system. it won't be cheap, but the performance will blow away any disk-based system. for persistant storage you can replicate from your ram-based system to a disk-based system, and as long as your replication messages hit disk quickly you can allow the disk-based version to lag behind in it's updates during your peak periods (as long as it is able to catch up with the writes overnight), and as the disk-based version won't have to do the seeks for the reads it will be considerably faster then if it was doing all the work (especially if you have good, large battery-backed disk caches to go with those drives to consolodate the writes) > It has become a bit more confusing because I am trying to allot shared > storage across several hosts, and want to be careful not to overload one > of the 2 storage processors. there's danger here, if you share spindles with other apps you run the risk of slowing down your database significantly. you may be better off with fewer, but dedicated drives rather then more, but shared drives. David Lang From pgsql-performance-owner@postgresql.org Tue Dec 20 02:33:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 563499DC8DB for ; Tue, 20 Dec 2005 02:33:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07524-08 for ; Tue, 20 Dec 2005 02:33:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 3507C9DC8E1 for ; Tue, 20 Dec 2005 02:33:42 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 451781AC3EA; Mon, 19 Dec 2005 19:49:18 -0800 (PST) Date: Mon, 19 Dec 2005 19:48:15 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Anjan Dave Cc: pgsql-performance@postgresql.org Subject: Re: separate drives for WAL or pgdata files In-Reply-To: Message-ID: References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F10@vt-pe2550-001.vantage.vantage.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, score=0.012 required=5 tests=[AWL=0.012] X-Spam-Score: 0.012 X-Spam-Level: X-Archive-Number: 200512/476 X-Sequence-Number: 16297 On Mon, 19 Dec 2005, David Lang wrote: > this is getting dangerously close to being able to fit in ram. I saw an > article over the weekend that Samsung is starting to produce 8G DIMM's, that > can go 8 to a controller (instead of 4 per as is currently done), when > motherboards come out that support this you can have 64G of ram per opteron > socket. it will be pricy, but the performance.... a message on another mailing list got me to thinking, there is the horas project that is aiming to put togeather 16 socket Opteron systems within a year (they claim sooner, but I'm being pessimistic ;-), combine this with these 8G dimms and you can have a SINGLE system with 1TB of ram on it (right at the limits of the Opteron's 40 bit external memory addressing) _wow_ and the thing it that it won't take much change in the software stack to deal with this. Linux is already running on machines with 1TB of ram (and 512 CPU's) so it will run very well. Postgres probably needs some attention to it's locks, but it is getting that attention now (and it will get more with the Sun Niagra chips being able to run 8 processes simultaniously) just think of the possibilities (if you have the money to afford the super machine :-) David Lang From pgsql-performance-owner@postgresql.org Tue Dec 20 00:10:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B5DB79DCA3F for ; Tue, 20 Dec 2005 00:10:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89615-04 for ; Tue, 20 Dec 2005 00:10:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) by postgresql.org (Postfix) with ESMTP id 65CF99DCA3B for ; Tue, 20 Dec 2005 00:10:35 -0400 (AST) Received: from lifebook.aspen (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc14) with ESMTP id <20051220041034014008m90ne>; Tue, 20 Dec 2005 04:10:34 +0000 From: Juan Casero To: pgsql-performance@postgresql.org Subject: Re: High context switches occurring Date: Mon, 19 Dec 2005 23:16:36 -0500 User-Agent: KMail/1.8.2 References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.com> In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@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: <200512192316.36322.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.565 required=5 tests=[AWL=0.565] X-Spam-Score: 0.565 X-Spam-Level: X-Archive-Number: 200512/472 X-Sequence-Number: 16293 Guys - Help me out here as I try to understand this benchmark. What is the Sun hardware and operating system we are talking about here and what is the intel hardware and operating system? What was the Sun version of PostgreSQL compiled with? Gcc on Solaris (assuming sparc) or Sun studio? What was PostgreSQL compiled with on intel? Gcc on linux? Thanks, Juan On Monday 19 December 2005 21:08, Anjan Dave wrote: > Re-ran it 3 times on each host - > > Sun: > -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 > number of transactions per client: 3000 > number of transactions actually processed: 30000/30000 > tps = 827.810778 (including connections establishing) > tps = 828.410801 (excluding connections establishing) > real 0m36.579s > user 0m1.222s > sys 0m3.422s > > Intel: > -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 > number of transactions per client: 3000 > number of transactions actually processed: 30000/30000 > tps = 597.067503 (including connections establishing) > tps = 597.606169 (excluding connections establishing) > real 0m50.380s > user 0m2.621s > sys 0m7.818s > > Thanks, > Anjan > > > -----Original Message----- > From: Anjan Dave > Sent: Wed 12/7/2005 10:54 AM > To: Tom Lane > Cc: Vivek Khera; Postgresql Performance > Subject: Re: [PERFORM] High context switches occurring > > > > Thanks for your inputs, Tom. I was going after high concurrent clients, > but should have read this carefully - > > -s scaling_factor > this should be used with -i (initialize) option. > number of tuples generated will be multiple of the > scaling factor. For example, -s 100 will imply 10M > (10,000,000) tuples in the accounts table. > default is 1. NOTE: scaling factor should be at least > as large as the largest number of clients you intend > to test; else you'll mostly be measuring update > contention. > > I'll rerun the tests. > > Thanks, > Anjan > > > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Tuesday, December 06, 2005 6:45 PM > To: Anjan Dave > Cc: Vivek Khera; Postgresql Performance > Subject: Re: [PERFORM] High context switches occurring > > "Anjan Dave" writes: > > -bash-3.00$ time pgbench -c 1000 -t 30 pgbench > > starting vacuum...end. > > transaction type: TPC-B (sort of) > > scaling factor: 1 > > number of clients: 1000 > > number of transactions per client: 30 > > number of transactions actually processed: 30000/30000 > > tps = 45.871234 (including connections establishing) > > tps = 46.092629 (excluding connections establishing) > > I can hardly think of a worse way to run pgbench :-(. These numbers are > about meaningless, for two reasons: > > 1. You don't want number of clients (-c) much higher than scaling factor > (-s in the initialization step). The number of rows in the "branches" > table will equal -s, and since every transaction updates one > randomly-chosen "branches" row, you will be measuring mostly row-update > contention overhead if there's more concurrent transactions than there > are rows. In the case -s 1, which is what you've got here, there is no > actual concurrency at all --- all the transactions stack up on the > single branches row. > > 2. Running a small number of transactions per client means that > startup/shutdown transients overwhelm the steady-state data. You should > probably run at least a thousand transactions per client if you want > repeatable numbers. > > Try something like "-s 10 -c 10 -t 3000" to get numbers reflecting test > conditions more like what the TPC council had in mind when they designed > this benchmark. I tend to repeat such a test 3 times to see if the > numbers are repeatable, and quote the middle TPS number as long as > they're not too far apart. > > regards, tom lane > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly From pgsql-performance-owner@postgresql.org Tue Dec 20 00:28:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A56289DC8A0 for ; Tue, 20 Dec 2005 00:28:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93307-04 for ; Tue, 20 Dec 2005 00:28:21 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by postgresql.org (Postfix) with ESMTP id 9DDAB9DC89D for ; Tue, 20 Dec 2005 00:28:20 -0400 (AST) Received: from fe-amer-09.sun.com ([192.18.108.183]) by brmea-mail-4.sun.com (8.12.10/8.12.9) with ESMTP id jBK4SHD7014751 for ; Mon, 19 Dec 2005 21:28:19 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IRS00D014B0FN00@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 21:28:17 -0700 (MST) Received: from [192.168.1.2] ([66.30.240.129]) by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IRS00L0K4F56I3E@mail-amer.sun.com>; Mon, 19 Dec 2005 21:28:17 -0700 (MST) Date: Mon, 19 Dec 2005 23:19:25 -0500 From: "Jignesh K. Shah" Subject: Re: PostgreSQL and Ultrasparc T1 In-reply-to: <200512191932.25699.caseroj@comcast.net> To: Juan Casero Cc: pgsql-performance@postgresql.org Message-id: <43A7864D.1090400@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en References: <200512191932.25699.caseroj@comcast.net> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.120, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200512/473 X-Sequence-Number: 16294 I guess it depends on what you term as your metric for measurement. If it is just one query execution time .. It may not be the best on UltraSPARC T1. But if you have more than 8 complex queries running simultaneously, UltraSPARC T1 can do well compared comparatively provided the application can scale also along with it. The best way to approach is to figure out your peak workload, find an accurate way to measure the "true" metric and then design a benchmark for it and run it on both servers. Regards, Jignesh Juan Casero wrote: >Ok. That is what I wanted to know. Right now this database is a PostgreSQL >7.4.8 system. I am using it in a sort of DSS role. I have weekly summaries >of the sales for our division going back three years. I have a PHP based >webapp that I wrote to give the managers access to this data. The webapp >lets them make selections for reports and then it submits a parameterized >query to the database for execution. The returned data rows are displayed >and formatted in their web browser. My largest sales table is about 13 >million rows along with all the indexes it takes up about 20 gigabytes. I >need to scale this application up to nearly 100 gigabytes to handle daily >sales summaries. Once we start looking at daily sales figures our database >size could grow ten to twenty times. I use postgresql because it gives me >the kind of enterprise database features I need to program the complex logic >for the queries. I also need the transaction isolation facilities it >provides so I can optimize the queries in plpgsql without worrying about >multiple users temp tables colliding with each other. Additionally, I hope >to rewrite the front end application in JSP so maybe I could use the >multithreaded features of the Java to exploit a multicore multi-cpu system. >There are almost no writes to the database tables. The bulk of the >application is just executing parameterized queries and returning huge >amounts of data. I know bizgres is supposed to be better at this but I want >to stay away from anything that is beta. I cannot afford for this thing to >go wrong. My reasoning for looking at the T1000/2000 was simply the large >number of cores. I know postgresql uses a super server that forks copies of >itself to handle incoming requests on port 5432. But I figured the number of >cores on the T1000/2000 processors would be utilized by the forked copies of >the postgresql server. From the comments I have seen so far it does not look >like this is the case. We had originally sized up a dual processor dual core >AMD opteron system from HP for this but I thought I could get more bang for >the buck on a T1000/2000. It now seems I may have been wrong. I am stronger >in Linux than Solaris so I am not upset I am just trying to find the best >hardware for the anticipated needs of this application. > >Thanks, >Juan > >On Monday 19 December 2005 01:25, Scott Marlowe wrote: > > >>From: pgsql-performance-owner@postgresql.org on behalf of Juan Casero >> >>QUOTE: >> >>Hi - >> >> >>Can anyone tell me how well PostgreSQL 8.x performs on the new Sun >>Ultrasparc T1 processor and architecture on Solaris 10? I have a custom >>built retail sales reporting that I developed using PostgreSQL 7.48 and PHP >>on a Fedora Core 3 intel box. I want to scale this application upwards to >>handle a database that might grow to a 100 GB. Our company is green >>mission conscious now so I was hoping I could use that to convince >>management to consider a Sun Ultrasparc T1 or T2 system provided that if I >>can get the best performance out of it on PostgreSQL. >> >>ENDQUOTE: >> >>Well, generally, AMD 64 bit is going to be a better value for your dollar, >>and run faster than most Sparc based machines. >> >>Also, PostgreSQL is generally faster under either BSD or Linux than under >>Solaris on the same box. This might or might not hold as you crank up the >>numbers of CPUs. >> >>PostgreSQL runs one process for connection. So, to use extra CPUs, you >>really need to have >1 connection running against the database. >> >>Mostly, databases tend to be either I/O bound, until you give them a lot of >>I/O, then they'll be CPU bound. >> >>After that lots of memory, THEN more CPUs. Two CPUs is always useful, as >>one can be servicing the OS and another the database. But unless you're >>gonna have lots of users hooked up, more than 2 to 4 CPUs is usually a >>waste. >> >>So, I'd recommend a dual core or dual dual core (i.e. 4 cores) AMD64 system >>with 2 or more gigs ram, and at least a pair of fast drives in a mirror >>with a hardare RAID controller with battery backed cache. If you'll be >>trundling through all 100 gigs of your data set regularly, then get all the >>memory you can put in a machine at a reasonable cost before buying lots of >>CPUs. >> >>But without knowing what you're gonna be doing we can't really make solid >>recommendations... >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > > From pgsql-performance-owner@postgresql.org Tue Dec 20 01:26:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AEED49DC816 for ; Tue, 20 Dec 2005 01:26:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01220-07 for ; Tue, 20 Dec 2005 01:26:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by postgresql.org (Postfix) with ESMTP id 9BB629DC85A for ; Tue, 20 Dec 2005 01:26:40 -0400 (AST) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id jBK5QT85029257; Tue, 20 Dec 2005 08:26:30 +0300 (MSK) Date: Tue, 20 Dec 2005 08:26:29 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Anjan Dave cc: Tom Lane , Vivek Khera , Postgresql Performance Subject: Re: High context switches occurring In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.com> Message-ID: References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.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, score=0.346 required=5 tests=[AWL=-0.133, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.346 X-Spam-Level: X-Archive-Number: 200512/474 X-Sequence-Number: 16295 Hi there, I see a very low performance and high context switches on our dual itanium2 slackware box (Linux ptah 2.6.14 #1 SMP) with 8Gb of RAM, running 8.1_STABLE. Any tips here ? postgres@ptah:~/cvs/8.1/pgsql/contrib/pgbench$ time pgbench -s 10 -c 10 -t 3000 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1 number of clients: 10 number of transactions per client: 3000 number of transactions actually processed: 30000/30000 tps = 163.817425 (including connections establishing) tps = 163.830558 (excluding connections establishing) real 3m3.374s user 0m1.888s sys 0m2.472s output from vmstat 2 2 1 0 4185104 197904 3213888 0 0 0 1456 673 6852 25 1 45 29 6 0 0 4184880 197904 3213888 0 0 0 1456 673 6317 28 2 49 21 0 1 0 4184656 197904 3213888 0 0 0 1464 671 7049 25 2 42 31 3 0 0 4184432 197904 3213888 0 0 0 1436 671 7073 25 1 44 29 0 1 0 4184432 197904 3213888 0 0 0 1460 671 7014 28 1 42 29 0 1 0 4184096 197920 3213872 0 0 0 1440 670 7065 25 2 42 31 0 1 0 4183872 197920 3213872 0 0 0 1444 671 6718 26 2 44 28 0 1 0 4183648 197920 3213872 0 0 0 1468 670 6525 15 3 50 33 0 1 0 4184352 197920 3213872 0 0 0 1584 676 6476 12 2 50 36 0 1 0 4193232 197920 3213872 0 0 0 1424 671 5848 12 1 50 37 0 0 0 4195536 197920 3213872 0 0 0 20 509 104 0 0 99 1 0 0 0 4195536 197920 3213872 0 0 0 1680 573 25 0 0 99 1 0 0 0 4195536 197920 3213872 0 0 0 0 504 22 0 0 100 processor : 1 vendor : GenuineIntel arch : IA-64 family : Itanium 2 model : 2 revision : 2 archrev : 0 features : branchlong cpu number : 0 cpu regs : 4 cpu MHz : 1600.010490 itc MHz : 1600.010490 BogoMIPS : 2392.06 siblings : 1 On Mon, 19 Dec 2005, Anjan Dave wrote: > Re-ran it 3 times on each host - > > Sun: > -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 > number of transactions per client: 3000 > number of transactions actually processed: 30000/30000 > tps = 827.810778 (including connections establishing) > tps = 828.410801 (excluding connections establishing) > real 0m36.579s > user 0m1.222s > sys 0m3.422s > > Intel: > -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 > number of transactions per client: 3000 > number of transactions actually processed: 30000/30000 > tps = 597.067503 (including connections establishing) > tps = 597.606169 (excluding connections establishing) > real 0m50.380s > user 0m2.621s > sys 0m7.818s > > Thanks, > Anjan > > > -----Original Message----- > From: Anjan Dave > Sent: Wed 12/7/2005 10:54 AM > To: Tom Lane > Cc: Vivek Khera; Postgresql Performance > Subject: Re: [PERFORM] High context switches occurring > > > > Thanks for your inputs, Tom. I was going after high concurrent clients, > but should have read this carefully - > > -s scaling_factor > this should be used with -i (initialize) option. > number of tuples generated will be multiple of the > scaling factor. For example, -s 100 will imply 10M > (10,000,000) tuples in the accounts table. > default is 1. NOTE: scaling factor should be at least > as large as the largest number of clients you intend > to test; else you'll mostly be measuring update > contention. > > I'll rerun the tests. > > Thanks, > Anjan > > > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Tuesday, December 06, 2005 6:45 PM > To: Anjan Dave > Cc: Vivek Khera; Postgresql Performance > Subject: Re: [PERFORM] High context switches occurring > > "Anjan Dave" writes: > > -bash-3.00$ time pgbench -c 1000 -t 30 pgbench > > starting vacuum...end. > > transaction type: TPC-B (sort of) > > scaling factor: 1 > > number of clients: 1000 > > number of transactions per client: 30 > > number of transactions actually processed: 30000/30000 > > tps = 45.871234 (including connections establishing) > > tps = 46.092629 (excluding connections establishing) > > I can hardly think of a worse way to run pgbench :-(. These numbers are > about meaningless, for two reasons: > > 1. You don't want number of clients (-c) much higher than scaling factor > (-s in the initialization step). The number of rows in the "branches" > table will equal -s, and since every transaction updates one > randomly-chosen "branches" row, you will be measuring mostly row-update > contention overhead if there's more concurrent transactions than there > are rows. In the case -s 1, which is what you've got here, there is no > actual concurrency at all --- all the transactions stack up on the > single branches row. > > 2. Running a small number of transactions per client means that > startup/shutdown transients overwhelm the steady-state data. You should > probably run at least a thousand transactions per client if you want > repeatable numbers. > > Try something like "-s 10 -c 10 -t 3000" to get numbers reflecting test > conditions more like what the TPC council had in mind when they designed > this benchmark. I tend to repeat such a test 3 times to see if the > numbers are repeatable, and quote the middle TPS number as long as > they're not too far apart. > > regards, tom lane > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83 From pgsql-performance-owner@postgresql.org Tue Dec 20 02:53:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 83ED69DC831 for ; Tue, 20 Dec 2005 02:53:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19399-01 for ; Tue, 20 Dec 2005 02:53:38 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by postgresql.org (Postfix) with ESMTP id 3A3F79DC822 for ; Tue, 20 Dec 2005 02:53:35 -0400 (AST) Received: from fe-amer-05.sun.com ([192.18.108.179]) by brmea-mail-4.sun.com (8.12.10/8.12.9) with ESMTP id jBK6rWD7018844 for ; Mon, 19 Dec 2005 23:53:36 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IRS00101ATYGJ00@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Mon, 19 Dec 2005 23:53:32 -0700 (MST) Received: from [129.150.32.102] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IRS00CJ9B57G2N0@mail-amer.sun.com>; Mon, 19 Dec 2005 23:53:31 -0700 (MST) Date: Tue, 20 Dec 2005 01:44:39 -0500 From: "Jignesh K. Shah" Subject: Re: High context switches occurring In-reply-to: To: Oleg Bartunov Cc: Anjan Dave , Tom Lane , Vivek Khera , Postgresql Performance Message-id: <43A7A857.4060308@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.com> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/477 X-Sequence-Number: 16298 It basically says pg_xlog is the bottleneck and move it to the disk with the best response time that you can afford. :-) Increasing checkpoint_segments doesn't seem to help much. Playing with wal_sync_method might change the behavior. For proof .. On Solaris, the /tmp is like a RAM Drive...Of course DO NOT TRY ON PRODUCTION. -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 10 number of clients: 10 number of transactions per client: 3000 number of transactions actually processed: 30000/30000 tps = 356.578050 (including connections establishing) tps = 356.733043 (excluding connections establishing) real 1m24.396s user 0m2.550s sys 0m3.404s -bash-3.00$ mv pg_xlog /tmp -bash-3.00$ ln -s /tmp/pg_xlog pg_xlog -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 10 number of clients: 10 number of transactions per client: 3000 number of transactions actually processed: 30000/30000 tps = 2413.661323 (including connections establishing) tps = 2420.754581 (excluding connections establishing) real 0m12.617s user 0m2.229s sys 0m2.950s -bash-3.00$ rm pg_xlog -bash-3.00$ mv /tmp/pg_xlog pg_xlog -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 10 number of clients: 10 number of transactions per client: 3000 number of transactions actually processed: 30000/30000 tps = 350.227682 (including connections establishing) tps = 350.382825 (excluding connections establishing) real 1m27.595s user 0m2.537s sys 0m3.386s -bash-3.00$ Regards, Jignesh Oleg Bartunov wrote: > Hi there, > > I see a very low performance and high context switches on our > dual itanium2 slackware box (Linux ptah 2.6.14 #1 SMP) > with 8Gb of RAM, running 8.1_STABLE. Any tips here ? > > postgres@ptah:~/cvs/8.1/pgsql/contrib/pgbench$ time pgbench -s 10 -c > 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 > number of transactions per client: 3000 > number of transactions actually processed: 30000/30000 > tps = 163.817425 (including connections establishing) > tps = 163.830558 (excluding connections establishing) > > real 3m3.374s > user 0m1.888s > sys 0m2.472s > > output from vmstat 2 > > 2 1 0 4185104 197904 3213888 0 0 0 1456 673 6852 > 25 1 45 29 > 6 0 0 4184880 197904 3213888 0 0 0 1456 673 6317 > 28 2 49 21 > 0 1 0 4184656 197904 3213888 0 0 0 1464 671 7049 > 25 2 42 31 > 3 0 0 4184432 197904 3213888 0 0 0 1436 671 7073 > 25 1 44 29 > 0 1 0 4184432 197904 3213888 0 0 0 1460 671 7014 > 28 1 42 29 > 0 1 0 4184096 197920 3213872 0 0 0 1440 670 7065 > 25 2 42 31 > 0 1 0 4183872 197920 3213872 0 0 0 1444 671 6718 > 26 2 44 28 > 0 1 0 4183648 197920 3213872 0 0 0 1468 670 6525 > 15 3 50 33 > 0 1 0 4184352 197920 3213872 0 0 0 1584 676 6476 > 12 2 50 36 > 0 1 0 4193232 197920 3213872 0 0 0 1424 671 5848 > 12 1 50 37 > 0 0 0 4195536 197920 3213872 0 0 0 20 509 104 > 0 0 99 1 > 0 0 0 4195536 197920 3213872 0 0 0 1680 573 25 > 0 0 99 1 > 0 0 0 4195536 197920 3213872 0 0 0 0 504 22 > 0 0 100 > > processor : 1 > vendor : GenuineIntel > arch : IA-64 > family : Itanium 2 > model : 2 > revision : 2 > archrev : 0 > features : branchlong > cpu number : 0 > cpu regs : 4 > cpu MHz : 1600.010490 > itc MHz : 1600.010490 > BogoMIPS : 2392.06 > siblings : 1 > > > > On Mon, 19 Dec 2005, Anjan Dave wrote: > > >> Re-ran it 3 times on each host - >> >> Sun: >> -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench >> starting vacuum...end. >> transaction type: TPC-B (sort of) >> scaling factor: 1 >> number of clients: 10 >> number of transactions per client: 3000 >> number of transactions actually processed: 30000/30000 >> tps = 827.810778 (including connections establishing) >> tps = 828.410801 (excluding connections establishing) >> real 0m36.579s >> user 0m1.222s >> sys 0m3.422s >> >> Intel: >> -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench >> starting vacuum...end. >> transaction type: TPC-B (sort of) >> scaling factor: 1 >> number of clients: 10 >> number of transactions per client: 3000 >> number of transactions actually processed: 30000/30000 >> tps = 597.067503 (including connections establishing) >> tps = 597.606169 (excluding connections establishing) >> real 0m50.380s >> user 0m2.621s >> sys 0m7.818s >> >> Thanks, >> Anjan >> >> >> -----Original Message----- >> From: Anjan Dave >> Sent: Wed 12/7/2005 10:54 AM >> To: Tom Lane >> Cc: Vivek Khera; Postgresql Performance >> Subject: Re: [PERFORM] High context switches occurring >> >> >> >> Thanks for your inputs, Tom. I was going after high concurrent >> clients, >> but should have read this carefully - >> >> -s scaling_factor >> this should be used with -i (initialize) option. >> number of tuples generated will be multiple of the >> scaling factor. For example, -s 100 will imply 10M >> (10,000,000) tuples in the accounts table. >> default is 1. NOTE: scaling factor should be at >> least >> as large as the largest number of clients you intend >> to test; else you'll mostly be measuring update >> contention. >> >> I'll rerun the tests. >> >> Thanks, >> Anjan >> >> >> -----Original Message----- >> From: Tom Lane [mailto:tgl@sss.pgh.pa.us] >> Sent: Tuesday, December 06, 2005 6:45 PM >> To: Anjan Dave >> Cc: Vivek Khera; Postgresql Performance >> Subject: Re: [PERFORM] High context switches occurring >> >> "Anjan Dave" writes: >> > -bash-3.00$ time pgbench -c 1000 -t 30 pgbench >> > starting vacuum...end. >> > transaction type: TPC-B (sort of) >> > scaling factor: 1 >> > number of clients: 1000 >> > number of transactions per client: 30 >> > number of transactions actually processed: 30000/30000 >> > tps = 45.871234 (including connections establishing) >> > tps = 46.092629 (excluding connections establishing) >> >> I can hardly think of a worse way to run pgbench :-(. These >> numbers are >> about meaningless, for two reasons: >> >> 1. You don't want number of clients (-c) much higher than scaling >> factor >> (-s in the initialization step). The number of rows in the >> "branches" >> table will equal -s, and since every transaction updates one >> randomly-chosen "branches" row, you will be measuring mostly >> row-update >> contention overhead if there's more concurrent transactions than >> there >> are rows. In the case -s 1, which is what you've got here, there >> is no >> actual concurrency at all --- all the transactions stack up on the >> single branches row. >> >> 2. Running a small number of transactions per client means that >> startup/shutdown transients overwhelm the steady-state data. You >> should >> probably run at least a thousand transactions per client if you want >> repeatable numbers. >> >> Try something like "-s 10 -c 10 -t 3000" to get numbers >> reflecting test >> conditions more like what the TPC council had in mind when they >> designed >> this benchmark. I tend to repeat such a test 3 times to see if the >> numbers are repeatable, and quote the middle TPS number as long as >> they're not too far apart. >> >> regards, tom lane >> >> >> ---------------------------(end of >> broadcast)--------------------------- >> TIP 5: don't forget to increase your free space map settings >> >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 1: if posting/reading through Usenet, please send an appropriate >> subscribe-nomail command to majordomo@postgresql.org so that your >> message can get through to the mailing list cleanly >> > > Regards, > Oleg > _____________________________________________________________ > Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), > Sternberg Astronomical Institute, Moscow University, Russia > Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ > phone: +007(495)939-16-83, +007(495)939-23-83 > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Tue Dec 20 06:41:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A19389DC82A for ; Tue, 20 Dec 2005 06:41:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50955-04 for ; Tue, 20 Dec 2005 06:41:53 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 2EDB89DC81A for ; Tue, 20 Dec 2005 06:41:49 -0400 (AST) Received: from mail.logix-tt.com (serval.logix-tt.com [213.239.221.42]) by svr4.postgresql.org (Postfix) with ESMTP id CB6D45AF190 for ; Tue, 20 Dec 2005 10:41:50 +0000 (GMT) Received: from kingfisher.intern.logix-tt.com (K8ed2.k.pppool.de [85.75.142.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 4825F24400F; Tue, 20 Dec 2005 11:48:00 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id CD541D6CAE; Tue, 20 Dec 2005 11:40:53 +0100 (CET) Message-ID: <43A7DFB5.3030408@logix-tt.com> Date: Tue, 20 Dec 2005 11:40:53 +0100 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance List Subject: Read only transactions - Commit or Rollback X-Enigmail-Version: 0.93.0.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/478 X-Sequence-Number: 16299 Hello, We have a database containing PostGIS MAP data, it is accessed mainly via JDBC. There are multiple simultaneous read-only connections taken from the JBoss connection pooling, and there usually are no active writers. We use connection.setReadOnly(true). Now my question is what is best performance-wise, if it does make any difference at all: Having autocommit on or off? (I presume "off") Using commit or rollback? Committing / rolling back occasionally (e. G. when returning the connection to the pool) or not at all (until the pool closes the connection)? Thanks, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Tue Dec 20 06:55:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 99FDE9DC822 for ; Tue, 20 Dec 2005 06:55:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53915-01 for ; Tue, 20 Dec 2005 06:55:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by postgresql.org (Postfix) with ESMTP id F27EF9DC82A for ; Tue, 20 Dec 2005 06:55:22 -0400 (AST) Received: from [80.142.122.154] (helo=swtexchange2.technology.de) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1Eof9P3Cvu-0008Fw; Tue, 20 Dec 2005 11:55:24 +0100 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: Read only transactions - Commit or Rollback X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0 Date: Tue, 20 Dec 2005 11:55:23 +0100 Message-ID: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Read only transactions - Commit or Rollback Thread-Index: AcYFUoaXI+mBaL21RFKFfjxKOlBi3QAAQnnA From: =?iso-8859-1?Q?N=F6rder-Tuitje=2C_Marcus?= To: "Markus Schaber" , "PostgreSQL Performance List" X-Provags-ID: kundenserver.de abuse@kundenserver.de login:24478085a861b01e05bdc3b8f80dc176 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.129 required=5 tests=[AWL=0.129] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200512/479 X-Sequence-Number: 16300 afaik, this should be completely neglectable. starting a transaction implies write access. if there is none, You do = not need to think about transactions, because there are none. postgres needs to schedule the writing transactions with the reading = ones, anyway. But I am not that performance profession anyway ;-) regards, Marcus -----Urspr=FCngliche Nachricht----- Von: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]Im Auftrag von Markus Schaber Gesendet: Dienstag, 20. Dezember 2005 11:41 An: PostgreSQL Performance List Betreff: [PERFORM] Read only transactions - Commit or Rollback Hello, We have a database containing PostGIS MAP data, it is accessed mainly via JDBC. There are multiple simultaneous read-only connections taken from the JBoss connection pooling, and there usually are no active writers. We use connection.setReadOnly(true). Now my question is what is best performance-wise, if it does make any difference at all: Having autocommit on or off? (I presume "off") Using commit or rollback? Committing / rolling back occasionally (e. G. when returning the connection to the pool) or not at all (until the pool closes the connection)? Thanks, Markus --=20 Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org = www.nosoftwarepatents.org ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend From pgsql-performance-owner@postgresql.org Tue Dec 20 07:36:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 216129DC82D for ; Tue, 20 Dec 2005 07:36:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59284-01 for ; Tue, 20 Dec 2005 07:36:44 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) by postgresql.org (Postfix) with ESMTP id EAF519DC822 for ; Tue, 20 Dec 2005 07:36:39 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 14so2185645nzn for ; Tue, 20 Dec 2005 03:36:43 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=h7/ZNMFn0QSxnQ74LW4Ej5F2VLWyXwia2DNEiPDizdJ7XjnBNsh7G8XhcxRyb0uDcMqUkxdJ2UmRNsAyFDQFBOz1daeHc0J2dksS2CIKTaKs+oTi72z232sf18onJxY7ra0JKj/VdIy2ZdBcW+ggdhFjqIU4QUwDFcI8kZCMDOY= Received: by 10.36.91.14 with SMTP id o14mr6798524nzb; Tue, 20 Dec 2005 03:36:42 -0800 (PST) Received: by 10.36.252.36 with HTTP; Tue, 20 Dec 2005 03:36:42 -0800 (PST) Message-ID: Date: Tue, 20 Dec 2005 19:36:42 +0800 From: William Lai To: pgsql-performance@postgresql.org Subject: unsubscribe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/480 X-Sequence-Number: 16301 dW5zdWJzY3JpYmUK From pgsql-performance-owner@postgresql.org Tue Dec 20 07:40:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 13EAF9DC9ED for ; Tue, 20 Dec 2005 07:40:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57624-06 for ; Tue, 20 Dec 2005 07:40:59 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 34EFA9DC9CB for ; Tue, 20 Dec 2005 07:40:55 -0400 (AST) Received: from p0f.net (p0f.net [193.77.154.190]) by svr4.postgresql.org (Postfix) with ESMTP id 473A65AF0B4 for ; Tue, 20 Dec 2005 11:40:58 +0000 (GMT) Received: from [10.10.190.53] ([193.77.165.58]) (authenticated bits=0) by p0f.net (8.13.3/8.13.3) with ESMTP id jBKBCdIa009017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 20 Dec 2005 12:12:41 +0100 Message-ID: <43A7EDD5.1080400@p0f.net> Date: Tue, 20 Dec 2005 12:41:09 +0100 From: Grega Bremec Organization: P0F User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> In-Reply-To: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.713 required=5 tests=[RCVD_IN_NJABL_DUL=1.713] X-Spam-Score: 1.713 X-Spam-Level: * X-Archive-Number: 200512/481 X-Sequence-Number: 16302 -----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 N�rder-Tuitje wrote: |> We have a database containing PostGIS MAP data, it is accessed |> mainly via JDBC. There are multiple simultaneous read-only |> connections taken from the JBoss connection pooling, and there |> usually are no active writers. We use connection.setReadOnly(true). |> |> Now my question is what is best performance-wise, if it does make |> any difference at all: |> |> Having autocommit on or off? (I presume "off") |> |> Using commit or rollback? |> |> Committing / rolling back occasionally (e. G. when returning the |> connection to the pool) or not at all (until the pool closes the |> connection)? |> | afaik, this should be completely neglectable. | | starting a transaction implies write access. if there is none, You do | not need to think about transactions, because there are none. | | postgres needs to schedule the writing transactions with the reading | ones, anyway. | | But I am not that performance profession anyway ;-) Hello, Marcus, N�rder, list. What about isolation? For several dependent calculations, MVCC doesn't happen a bit with autocommit turned on, right? Cheers, - -- ~ Grega Bremec ~ gregab at p0f dot net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFDp+2afu4IwuB3+XoRA6j3AJ0Ri0/NrJtHg4xBNcFsVFFW0XvCoQCfereo aX6ThZIlPL0RhETJK9IcqtU= =xalw -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Tue Dec 20 07:54:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7318E9DCA48 for ; Tue, 20 Dec 2005 07:54:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60578-05 for ; Tue, 20 Dec 2005 07:54:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by postgresql.org (Postfix) with ESMTP id 2607F9DCA57 for ; Tue, 20 Dec 2005 07:54:05 -0400 (AST) Received: from [80.142.122.154] (helo=swtexchange2.technology.de) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis), id 0ML29c-1Eog4E3hvn-0002w8; Tue, 20 Dec 2005 12:54:07 +0100 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Subject: Re: Read only transactions - Commit or Rollback X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0 Date: Tue, 20 Dec 2005 12:54:06 +0100 Message-ID: <16F953410A0F1346848DCB476A989CFE34E1@swtexchange2.technology.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Read only transactions - Commit or Rollback Thread-Index: AcYFWurlsNPG2/SxSquINMkgQEoVNwAAEMHA From: =?iso-8859-2?Q?N=F6rder-Tuitje=2C_Marcus?= To: "Grega Bremec" , "PostgreSQL Performance List" X-Provags-ID: kundenserver.de abuse@kundenserver.de login:24478085a861b01e05bdc3b8f80dc176 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.043 required=5 tests=[AWL=0.043] X-Spam-Score: 0.043 X-Spam-Level: X-Archive-Number: 200512/482 X-Sequence-Number: 16303 Mmmm, good question. MVCC blocks reading processes when data is modified. using autocommit = implies that each modification statement is an atomic operation. on a massive readonly table, where no data is altered, MVCC shouldn't = have any effect (but this is only an assumption) basing on http://en.wikipedia.org/wiki/Mvcc using rowlevel locks with write access should make most of the mostly = available to reading-only sessions, but this is an assumption only, too. maybe the community knows a little more ;-) regards, marcus -----Urspr=FCngliche Nachricht----- Von: pgsql-performance-owner@postgresql.org = [mailto:pgsql-performance-owner@postgresql.org]Im Auftrag von Grega = Bremec Gesendet: Dienstag, 20. Dezember 2005 12:41 An: PostgreSQL Performance List Betreff: Re: [PERFORM] Read only transactions - Commit or Rollback -----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 N=F6rder-Tuitje wrote: |> We have a database containing PostGIS MAP data, it is accessed |> mainly via JDBC. There are multiple simultaneous read-only |> connections taken from the JBoss connection pooling, and there |> usually are no active writers. We use connection.setReadOnly(true). |> |> Now my question is what is best performance-wise, if it does make |> any difference at all: |> |> Having autocommit on or off? (I presume "off") |> |> Using commit or rollback? |> |> Committing / rolling back occasionally (e. G. when returning the |> connection to the pool) or not at all (until the pool closes the |> connection)? |> | afaik, this should be completely neglectable. | | starting a transaction implies write access. if there is none, You do | not need to think about transactions, because there are none. | | postgres needs to schedule the writing transactions with the reading | ones, anyway. | | But I am not that performance profession anyway ;-) Hello, Marcus, N=F6rder, list. What about isolation? For several dependent calculations, MVCC doesn't happen a bit with autocommit turned on, right? Cheers, - -- ~ Grega Bremec ~ gregab at p0f dot net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFDp+2afu4IwuB3+XoRA6j3AJ0Ri0/NrJtHg4xBNcFsVFFW0XvCoQCfereo aX6ThZIlPL0RhETJK9IcqtU=3D =3Dxalw -----END PGP SIGNATURE----- ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Tue Dec 20 08:04:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 763469DC81A for ; Tue, 20 Dec 2005 08:04:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60071-07 for ; Tue, 20 Dec 2005 08:04:10 -0400 (AST) X-Greylist: delayed 01:22:20.244344 by SQLgrey- Received: from mail.logix-tt.com (serval.logix-tt.com [213.239.221.42]) by postgresql.org (Postfix) with ESMTP id 20C179DC82A for ; Tue, 20 Dec 2005 08:04:06 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (K8ed2.k.pppool.de [85.75.142.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 6F55324400F for ; Tue, 20 Dec 2005 13:10:23 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 4F8DED6D0D for ; Tue, 20 Dec 2005 13:03:16 +0100 (CET) Message-ID: <43A7F303.8040804@logix-tt.com> Date: Tue, 20 Dec 2005 13:03:15 +0100 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> In-Reply-To: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> X-Enigmail-Version: 0.93.0.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/483 X-Sequence-Number: 16304 Hi, Marcus, N�rder-Tuitje wrote: > afaik, this should be completely neglectable. > > starting a transaction implies write access. if there is none, You do > not need to think about transactions, because there are none. Hmm, I always thought that the transaction will be opened at the first statement, because there _could_ be a parallel writing transaction started later. > postgres needs to schedule the writing transactions with the reading > ones, anyway. As I said, there usually are no writing transactions on the same database. Btw, there's another setting that might make a difference: Having ACID-Level SERIALIZABLE or READ COMMITED? Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Tue Dec 20 08:05:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 54FB49DC82D for ; Tue, 20 Dec 2005 08:05:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62245-03 for ; Tue, 20 Dec 2005 08:05:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 22AFC9DC81A for ; Tue, 20 Dec 2005 08:05:31 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id EFD3733A61; Tue, 20 Dec 2005 13:05:31 +0100 (MET) From: Michael Riess X-Newsgroups: pgsql.performance Subject: Re: Read only transactions - Commit or Rollback Date: Tue, 20 Dec 2005 13:05:30 +0100 Organization: Hub.Org Networking Services Lines: 19 Message-ID: References: <43A7DFB5.3030408@logix-tt.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: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <43A7DFB5.3030408@logix-tt.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/484 X-Sequence-Number: 16305 Markus Schaber schrieb: > Hello, > > We have a database containing PostGIS MAP data, it is accessed mainly > via JDBC. There are multiple simultaneous read-only connections taken > from the JBoss connection pooling, and there usually are no active > writers. We use connection.setReadOnly(true). > > Now my question is what is best performance-wise, if it does make any > difference at all: > > Having autocommit on or off? (I presume "off") If you are using large ResultSets, it is interesting to know that Statement.setFetchSize() does not do anything as long as you have autocommit on. So you might want to always disable autocommit and set a reasonable fetch size with large results, or otherwise have serious memory problems in Java/JDBC. From pgsql-performance-owner@postgresql.org Tue Dec 20 08:27:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 142249DC81A for ; Tue, 20 Dec 2005 08:27:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66227-04 for ; Tue, 20 Dec 2005 08:27:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp2.rz.uni-karlsruhe.de (smtp2.rz.uni-karlsruhe.de [129.13.185.218]) by postgresql.org (Postfix) with ESMTP id 380A29DC82A for ; Tue, 20 Dec 2005 08:27:06 -0400 (AST) Received: from rzstud1.stud.uni-karlsruhe.de (rzstud1.stud.uni-karlsruhe.de [193.196.41.33]) by smtp2.rz.uni-karlsruhe.de with esmtp (Exim 4.43 #1) id 1EogaB-0006Fj-Tz; Tue, 20 Dec 2005 13:27:08 +0100 Received: from uwi7 by rzstud1.stud.uni-karlsruhe.de with local (Exim 3.36 #1) id 1EogaD-0006zD-00; Tue, 20 Dec 2005 13:27:09 +0100 From: Andreas Seltenreich To: Markus Schaber Cc: PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> <43A7F303.8040804@logix-tt.com> Mail-Followup-To: Markus Schaber , PostgreSQL Performance List , andreas+pg@gate450.dyndns.org X-PGP-Key: 0x2C006B340F8C8C1B X-Face: $:F<87a[gD1?#R6S3j21cr1&C&7bd63GHC.tSdskUb}hhwG(ci*=D5kJ<_N+p9q(7-, PnG. Et.Yh (Markus Schaber's message of "Tue, 20 Dec 2005 13:03:15 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) Message-ID: <87mziwj6na.fsf@gate450.dyndns.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, score=0.077 required=5 tests=[AWL=0.077] X-Spam-Score: 0.077 X-Spam-Level: X-Archive-Number: 200512/485 X-Sequence-Number: 16306 Markus Schaber writes: > As I said, there usually are no writing transactions on the same database. > > Btw, there's another setting that might make a difference: > > Having ACID-Level SERIALIZABLE or READ COMMITED? Well, if nonrepeatable or phantom reads would pose a problem because of those occasional writes, you wouldn't be considering autocommit for performance reasons either, would you? regards, Andreas -- From pgsql-performance-owner@postgresql.org Tue Dec 20 08:32:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5C8B59DCA65 for ; Tue, 20 Dec 2005 08:32:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67126-05 for ; Tue, 20 Dec 2005 08:32:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (serval.logix-tt.com [213.239.221.42]) by postgresql.org (Postfix) with ESMTP id 94B509DC82A for ; Tue, 20 Dec 2005 08:32:46 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (K8ed2.k.pppool.de [85.75.142.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 1C81F24400F; Tue, 20 Dec 2005 13:39:04 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 9733FD6D09; Tue, 20 Dec 2005 13:31:55 +0100 (CET) Message-ID: <43A7F9B9.3010906@logix-tt.com> Date: Tue, 20 Dec 2005 13:31:53 +0100 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> <43A7F303.8040804@logix-tt.com> <87mziwj6na.fsf@gate450.dyndns.org> In-Reply-To: <87mziwj6na.fsf@gate450.dyndns.org> X-Enigmail-Version: 0.93.0.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, score=0.04 required=5 tests=[AWL=0.040] X-Spam-Score: 0.04 X-Spam-Level: X-Archive-Number: 200512/486 X-Sequence-Number: 16307 Hello, Andreas, Andreas Seltenreich wrote: >>Btw, there's another setting that might make a difference: >>Having ACID-Level SERIALIZABLE or READ COMMITED? > > Well, if nonrepeatable or phantom reads would pose a problem because > of those occasional writes, you wouldn't be considering autocommit for > performance reasons either, would you? Yes, the question is purely performance-wise. We don't care about any read/write conflicts in this special case. Some time ago, I had some tests with large bulk insertions, and it turned out that SERIALIZABLE seemed to be 30% faster, which surprised us. That's why I ask this questions, and mainly because we currently cannot perform a large bunch of benchmarking. Thanks, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Tue Dec 20 09:06:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1EFF89DCA61 for ; Tue, 20 Dec 2005 09:06:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70830-10 for ; Tue, 20 Dec 2005 09:06:20 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.204]) by postgresql.org (Postfix) with ESMTP id 6C0569DCA5B for ; Tue, 20 Dec 2005 09:06:15 -0400 (AST) Received: by nproxy.gmail.com with SMTP id m18so424114nfc for ; Tue, 20 Dec 2005 05:06:16 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Wr2nAnL6ocWs3U0CD/GKDHKnUcxYWmVIEkq9CGGsKsJjIh99+KXqPboBCcTm7/RZzCI8avgC1JnlbfAf2f77zkBPrImvQIbELZnoy4RIdIzKkiuJfrHS9dJV4ADAPYAkEWLBEVpPt/r7NgS7WwQbe2iEjGwhYMsF6Alr1Znhx8g= Received: by 10.48.30.9 with SMTP id d9mr311431nfd; Tue, 20 Dec 2005 05:06:15 -0800 (PST) Received: by 10.48.255.10 with HTTP; Tue, 20 Dec 2005 05:06:14 -0800 (PST) Message-ID: Date: Tue, 20 Dec 2005 14:06:15 +0100 From: Nicolas Barbier To: =?ISO-8859-1?Q?N=F6rder-Tuitje=2C_Marcus?= Subject: Re: Read only transactions - Commit or Rollback Cc: PostgreSQL Performance List In-Reply-To: <16F953410A0F1346848DCB476A989CFE34E1@swtexchange2.technology.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <16F953410A0F1346848DCB476A989CFE34E1@swtexchange2.technology.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/487 X-Sequence-Number: 16308 On 12/20/05, N=F6rder-Tuitje, Marcus wrote: > MVCC blocks reading processes when data is modified. That is incorrect. The main difference between 2PL and MVCC is that readers are never blocked under MVCC. greetings, Nicolas -- Nicolas Barbier http://www.gnu.org/philosophy/no-word-attachments.html From pgsql-performance-owner@postgresql.org Tue Dec 20 09:26:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 26B829DCA21 for ; Tue, 20 Dec 2005 09:26:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73941-09 for ; Tue, 20 Dec 2005 09:26:09 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 56ADE9DC89E for ; Tue, 20 Dec 2005 09:26:03 -0400 (AST) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by svr4.postgresql.org (Postfix) with ESMTP id 9D8555AF080 for ; Tue, 20 Dec 2005 13:26:07 +0000 (GMT) Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id 5ADADD24423; Tue, 20 Dec 2005 08:26:04 -0500 (EST) Received: from frontend2.messagingengine.com ([10.202.2.151]) by frontend1.internal (MEProxy); Tue, 20 Dec 2005 08:26:04 -0500 X-Sasl-enc: b6+kA2bbCqnxPAJ+KlePLL3/ye/utufdHO43yWqcwkx9 1135085163 Received: from [149.182.235.91] (unknown [129.230.248.1]) by frontend2.messagingengine.com (Postfix) with ESMTP id 63CCF5713C0; Tue, 20 Dec 2005 08:26:01 -0500 (EST) Message-ID: <43A80668.1040604@diroussel.xsmail.com> Date: Tue, 20 Dec 2005 13:26:00 +0000 From: David Roussel User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Lang Cc: pgsql-performance@postgresql.org Subject: Re: filesystem performance with lots of files References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------050108030207020608010007" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/488 X-Sequence-Number: 16309 This is a multi-part message in MIME format. --------------050108030207020608010007 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit David Lang wrote: > > ext3 has an option to make searching directories faster (htree), but > enabling it kills performance when you create files. And this doesn't > help with large files. > The ReiserFS white paper talks about the data structure he uses to store directories (some kind of tree), and he says it's quick to both read and write. Don't forget if you find ls slow, that could just be ls, since it's ls, not the fs, that sorts this files into alphabetical order. > how long would it take to do a tar-ftp-untar cycle with no smarts Note that you can do the taring, zipping, copying and untaring concurrentlt. I can't remember the exactl netcat command line options, but it goes something like this Box1: tar czvf - myfiles/* | netcat myserver:12345 Box2: netcat -listen 12345 | tar xzvf - Not only do you gain from doing it all concurrently, but not writing a temp file means that disk seeks a reduced too if you have a one spindle machine. Also condsider just copying files onto a network mount. May not be as fast as the above, but will be faster than rsync, which has high CPU usage and thus not a good choice on a LAN. Hmm, sorry this is not directly postgres anymore... David --------------050108030207020608010007 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit David Lang wrote:

  ext3 has an option to make searching directories faster (htree), but enabling it kills performance when you create files. And this doesn't help with large files.

The ReiserFS white paper talks about the data structure he uses to store directories (some kind of tree), and he says it's quick to both read and write.  Don't forget if you find ls slow, that could just be ls, since it's ls, not the fs, that sorts this files into alphabetical order.

> how long would it take to do a tar-ftp-untar cycle with no smarts

Note that you can do the taring, zipping, copying and untaring concurrentlt.  I can't remember the exactl netcat command line options, but it goes something like this

Box1:
tar czvf - myfiles/* | netcat myserver:12345

Box2:
netcat -listen 12345 | tar xzvf -

Not only do you gain from doing it all concurrently, but not writing a temp file means that disk seeks a reduced too if you have a one spindle machine.

Also condsider just copying files onto a network mount.  May not be as fast as the above, but will be faster than rsync, which has high CPU usage and thus not a good choice on a LAN.

Hmm, sorry this is not directly postgres anymore...

David
--------------050108030207020608010007-- From pgsql-performance-owner@postgresql.org Tue Dec 20 10:41:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E6B4A9DCA5B for ; Tue, 20 Dec 2005 10:41:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90320-04 for ; Tue, 20 Dec 2005 10:41:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 89F4C9DCA7F for ; Tue, 20 Dec 2005 10:41:26 -0400 (AST) 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 jBKEfUOQ028872; Tue, 20 Dec 2005 09:41:30 -0500 (EST) To: Oleg Bartunov cc: Anjan Dave , Vivek Khera , Postgresql Performance Subject: Re: High context switches occurring In-reply-to: References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.com> Comments: In-reply-to Oleg Bartunov message dated "Tue, 20 Dec 2005 08:26:29 +0300" Date: Tue, 20 Dec 2005 09:41:30 -0500 Message-ID: <28871.1135089690@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.018 required=5 tests=[AWL=0.018] X-Spam-Score: 0.018 X-Spam-Level: X-Archive-Number: 200512/489 X-Sequence-Number: 16310 Oleg Bartunov writes: > I see a very low performance and high context switches on our > dual itanium2 slackware box (Linux ptah 2.6.14 #1 SMP) > with 8Gb of RAM, running 8.1_STABLE. Any tips here ? > postgres@ptah:~/cvs/8.1/pgsql/contrib/pgbench$ time pgbench -s 10 -c 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 You can't expect any different with more clients than scaling factor :-(. Note that -s is only effective when supplied with -i; it's basically ignored during an actual test run. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 20 11:00:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3169B9DCA5B for ; Tue, 20 Dec 2005 11:00:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93099-10 for ; Tue, 20 Dec 2005 11:00:40 -0400 (AST) X-Greylist: delayed 01:34:32.186547 by SQLgrey- Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by postgresql.org (Postfix) with ESMTP id 6CD0D9DCA55 for ; Tue, 20 Dec 2005 11:00:33 -0400 (AST) Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id 328BDD24972; Tue, 20 Dec 2005 10:00:36 -0500 (EST) Received: from frontend2.messagingengine.com ([10.202.2.151]) by frontend1.internal (MEProxy); Tue, 20 Dec 2005 10:00:36 -0500 X-Sasl-enc: WmzwR+sU3FEm+epDz/88uIEkxTUKfKEhy7rhznKmBdnt 1135090835 Received: from [149.182.235.91] (unknown [129.230.248.1]) by frontend2.messagingengine.com (Postfix) with ESMTP id 34DAE5714A4; Tue, 20 Dec 2005 10:00:30 -0500 (EST) Message-ID: <43A81C8E.6010602@diroussel.xsmail.com> Date: Tue, 20 Dec 2005 15:00:30 +0000 From: David Roussel User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: andy@areyoulocal.co.uk CC: pgsql-performance@postgresql.org Subject: Re: 2 phase commit: performance implications? References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------010008000500000505060002" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.120, HTML_MESSAGE=0.001] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200512/490 X-Sequence-Number: 16311 This is a multi-part message in MIME format. --------------010008000500000505060002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >The only issue is to ensure that a query near a boundary between two >adjacent areas behaves as though there was no partitioning. To do this, I'm >looking into using 8.1's new 2PC to allow me to selectively copy data >inserted near a boundary into the adjacent neighbouring databases, so that >this data will appear in boundary searches carried out by the neighbours. > Why not just query adjacent databases, rather than copying the data around? If you really wanted to do this, do you need 2pc? Once data has been uploaded to the database for region A, then asynchronously copy the data to B, C, D and E later, using a queue. If you try to commit to all at once, then if one fails, then none has the data. All depends on what type of data you are dealing with, how important is consistency, i.e. will it cost you money if the data is inconsistent between nodes. Generally queuing is your friend. You can use 2pc to ensure your queues work correctly if you like. David --------------010008000500000505060002 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
The only issue is to ensure that a query near a boundary between two
adjacent areas behaves as though there was no partitioning. To do this, I'm
looking into using  8.1's new 2PC to allow me to selectively copy data
inserted near a boundary into the adjacent neighbouring databases, so that
this data will appear in boundary searches carried out by the neighbours.
Why not just query adjacent databases, rather than copying the data around?

If you really wanted to do this, do you need 2pc?  Once data has been uploaded to the database for region A, then asynchronously copy the data to B, C, D and E later, using a queue.  If you try to commit to all at once, then if one fails, then none has the data.

All depends on what type of data you are dealing with, how important is consistency, i.e. will it cost you money if the data is inconsistent between nodes.

Generally queuing is your friend.  You can use 2pc to ensure your queues work correctly if you like.

David
--------------010008000500000505060002-- From pgsql-performance-owner@postgresql.org Tue Dec 20 11:01:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9F0209DCA86 for ; Tue, 20 Dec 2005 11:01:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94291-07 for ; Tue, 20 Dec 2005 11:01:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by postgresql.org (Postfix) with ESMTP id 082039DCA87 for ; Tue, 20 Dec 2005 11:01:52 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jBKF1SJg025094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Dec 2005 10:01:29 -0500 (EST) X-Source: non-mednet 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 jBKF0iuW016126; Tue, 20 Dec 2005 10:00:44 -0500 (EST) Message-ID: <43A81CE0.7060805@rentec.com> Date: Tue, 20 Dec 2005 10:01:52 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.6a1 (X11/20051214) MIME-Version: 1.0 To: "Jignesh K. Shah" CC: Juan Casero , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Ultrasparc T1 References: <200512191932.25699.caseroj@comcast.net> <43A7864D.1090400@sun.com> In-Reply-To: <43A7864D.1090400@sun.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jBKF1SJg025094 at Tue Dec 20 10:01:29 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/491 X-Sequence-Number: 16312 Jignesh K. Shah wrote: > I guess it depends on what you term as your metric for measurement. > If it is just one query execution time .. It may not be the best on > UltraSPARC T1. > But if you have more than 8 complex queries running simultaneously, > UltraSPARC T1 can do well compared comparatively provided the > application can scale also along with it. I just want to clarify one issue here. It's my understanding that the 8-core, 4 hardware thread (known as strands) system is seen as a 32 cpu system by Solaris. So, one could have up to 32 postgresql processes running in parallel on the current systems (assuming the application can scale). -- Alan From pgsql-performance-owner@postgresql.org Tue Dec 20 11:10:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D27519DCA21 for ; Tue, 20 Dec 2005 11:10:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97982-06 for ; Tue, 20 Dec 2005 11:10:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id E539F9DCA61 for ; Tue, 20 Dec 2005 11:10:22 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 1440B1AC3E9; Tue, 20 Dec 2005 07:09:28 -0800 (PST) Date: Tue, 20 Dec 2005 07:08:21 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Alan Stange Cc: "Jignesh K. Shah" , Juan Casero , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Ultrasparc T1 In-Reply-To: <43A81CE0.7060805@rentec.com> Message-ID: References: <200512191932.25699.caseroj@comcast.net> <43A7864D.1090400@sun.com> <43A81CE0.7060805@rentec.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, score=0.022 required=5 tests=[AWL=0.022] X-Spam-Score: 0.022 X-Spam-Level: X-Archive-Number: 200512/492 X-Sequence-Number: 16313 On Tue, 20 Dec 2005, Alan Stange wrote: > Jignesh K. Shah wrote: >> I guess it depends on what you term as your metric for measurement. >> If it is just one query execution time .. It may not be the best on >> UltraSPARC T1. >> But if you have more than 8 complex queries running simultaneously, >> UltraSPARC T1 can do well compared comparatively provided the application >> can scale also along with it. > > I just want to clarify one issue here. It's my understanding that the > 8-core, 4 hardware thread (known as strands) system is seen as a 32 cpu > system by Solaris. > So, one could have up to 32 postgresql processes running in parallel on the > current systems (assuming the application can scale). note that like hyperthreading, the strands aren't full processors, their efficiancy depends on how much other threads shareing the core stall waiting for external things. David Lang From pgsql-performance-owner@postgresql.org Tue Dec 20 11:14:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D04AE9DCA67 for ; Tue, 20 Dec 2005 11:14:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99827-02 for ; Tue, 20 Dec 2005 11:14:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by postgresql.org (Postfix) with ESMTP id EBAF89DCA61 for ; Tue, 20 Dec 2005 11:14:47 -0400 (AST) 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 jBKFEJXo025498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Dec 2005 10:14:20 -0500 (EST) X-Source: non-mednet 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 jBKFEWBO000162; Tue, 20 Dec 2005 10:14:32 -0500 (EST) Message-ID: <43A81FE4.7070308@rentec.com> Date: Tue, 20 Dec 2005 10:14:44 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.6a1 (X11/20051214) MIME-Version: 1.0 To: David Lang CC: "Jignesh K. Shah" , Juan Casero , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Ultrasparc T1 References: <200512191932.25699.caseroj@comcast.net> <43A7864D.1090400@sun.com> <43A81CE0.7060805@rentec.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jBKFEJXo025498 at Tue Dec 20 10:14:20 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/493 X-Sequence-Number: 16314 David Lang wrote: > On Tue, 20 Dec 2005, Alan Stange wrote: > >> Jignesh K. Shah wrote: >>> I guess it depends on what you term as your metric for measurement. >>> If it is just one query execution time .. It may not be the best on >>> UltraSPARC T1. >>> But if you have more than 8 complex queries running simultaneously, >>> UltraSPARC T1 can do well compared comparatively provided the >>> application can scale also along with it. >> >> I just want to clarify one issue here. It's my understanding that >> the 8-core, 4 hardware thread (known as strands) system is seen as a >> 32 cpu system by Solaris. So, one could have up to 32 postgresql >> processes running in parallel on the current systems (assuming the >> application can scale). > > note that like hyperthreading, the strands aren't full processors, > their efficiancy depends on how much other threads shareing the core > stall waiting for external things. Exactly. From pgsql-performance-owner@postgresql.org Tue Dec 20 11:18:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 007249DCA86 for ; Tue, 20 Dec 2005 11:18:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00330-03-6 for ; Tue, 20 Dec 2005 11:18:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by postgresql.org (Postfix) with ESMTP id 853079DCBA4 for ; Tue, 20 Dec 2005 11:18:24 -0400 (AST) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id jBKFIKaK021350; Tue, 20 Dec 2005 18:18:20 +0300 (MSK) Date: Tue, 20 Dec 2005 18:18:20 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Tom Lane cc: Anjan Dave , Vivek Khera , Postgresql Performance Subject: Re: High context switches occurring In-Reply-To: <28871.1135089690@sss.pgh.pa.us> Message-ID: References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.com> <28871.1135089690@sss.pgh.pa.us> 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, score=0.353 required=5 tests=[AWL=-0.126, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.353 X-Spam-Level: X-Archive-Number: 200512/494 X-Sequence-Number: 16315 On Tue, 20 Dec 2005, Tom Lane wrote: > Oleg Bartunov writes: >> I see a very low performance and high context switches on our >> dual itanium2 slackware box (Linux ptah 2.6.14 #1 SMP) >> with 8Gb of RAM, running 8.1_STABLE. Any tips here ? > >> postgres@ptah:~/cvs/8.1/pgsql/contrib/pgbench$ time pgbench -s 10 -c 10 -t 3000 pgbench >> starting vacuum...end. >> transaction type: TPC-B (sort of) >> scaling factor: 1 >> number of clients: 10 > > You can't expect any different with more clients than scaling factor :-(. Argh :) I copy'n pasted from previous message. I still wondering with very poor performance of my server. Moving pgdata to RAID6 helped - about 600 tps. Then, I moved pg_xlog to separate disk and got strange error messages postgres@ptah:~$ time pgbench -c 10 -t 3000 pgbench starting vacuum...end. Client 0 aborted in state 8: ERROR: integer out of range Client 7 aborted in state 8: ERROR: integer out of range dropdb,createdb helped, but performance is about 160 tps. Low-end AMD64 with SATA disks gives me ~400 tps in spite of disks on itanium2 faster ( 80MB/sec ) than on AMD64 (60MB/sec). Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83 From pgsql-performance-owner@postgresql.org Tue Dec 20 11:24:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1B56C9DC93C for ; Tue, 20 Dec 2005 11:24:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00481-06 for ; Tue, 20 Dec 2005 11:24:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id E97D29DC89E for ; Tue, 20 Dec 2005 11:24:22 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 60B931AC3E9; Tue, 20 Dec 2005 07:23:28 -0800 (PST) Date: Tue, 20 Dec 2005 07:22:24 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Alan Stange Cc: "Jignesh K. Shah" , Juan Casero , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Ultrasparc T1 In-Reply-To: <43A8206A.1090906@rentec.com> Message-ID: References: <200512191932.25699.caseroj@comcast.net> <43A7864D.1090400@sun.com> <43A81CE0.7060805@rentec.com> <43A8206A.1090906@rentec.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, score=0.03 required=5 tests=[AWL=0.030] X-Spam-Score: 0.03 X-Spam-Level: X-Archive-Number: 200512/495 X-Sequence-Number: 16316 On Tue, 20 Dec 2005, Alan Stange wrote: > David Lang wrote: >> On Tue, 20 Dec 2005, Alan Stange wrote: >> >>> Jignesh K. Shah wrote: >>>> I guess it depends on what you term as your metric for measurement. >>>> If it is just one query execution time .. It may not be the best on >>>> UltraSPARC T1. >>>> But if you have more than 8 complex queries running simultaneously, >>>> UltraSPARC T1 can do well compared comparatively provided the application >>>> can scale also along with it. >>> >>> I just want to clarify one issue here. It's my understanding that the >>> 8-core, 4 hardware thread (known as strands) system is seen as a 32 cpu >>> system by Solaris. So, one could have up to 32 postgresql processes >>> running in parallel on the current systems (assuming the application can >>> scale). >> >> note that like hyperthreading, the strands aren't full processors, their >> efficiancy depends on how much other threads shareing the core stall >> waiting for external things. > Exactly. Until we have a machine in hand (and substantial technical > documentation) we won't know all the limitations. by the way, when you do get your hands on it I would be interested to hear how Linux compares to Solaris on the same hardware. given how new the hardware is it's also likly that linux won't identify the hardware properly (either seeing it as 32 true processors or just as 8 without being able to use the strands), so the intitial tests may not reflect the Linux performance in a release or two. David Lang From pgsql-performance-owner@postgresql.org Tue Dec 20 11:28:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2FEBA9DC816 for ; Tue, 20 Dec 2005 11:28:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02462-03 for ; Tue, 20 Dec 2005 11:28:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C94B39DC82D for ; Tue, 20 Dec 2005 11:27:58 -0400 (AST) 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 jBKFS3X9029466; Tue, 20 Dec 2005 10:28:03 -0500 (EST) To: Oleg Bartunov cc: Anjan Dave , Vivek Khera , Postgresql Performance Subject: Re: High context switches occurring In-reply-to: References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F14@vt-pe2550-001.vantage.vantage.com> <28871.1135089690@sss.pgh.pa.us> Comments: In-reply-to Oleg Bartunov message dated "Tue, 20 Dec 2005 18:18:20 +0300" Date: Tue, 20 Dec 2005 10:28:03 -0500 Message-ID: <29465.1135092483@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.021 required=5 tests=[AWL=0.021] X-Spam-Score: 0.021 X-Spam-Level: X-Archive-Number: 200512/496 X-Sequence-Number: 16317 Oleg Bartunov writes: > I still wondering with very poor performance of my server. Moving > pgdata to RAID6 helped - about 600 tps. Then, I moved pg_xlog to separate > disk and got strange error messages > postgres@ptah:~$ time pgbench -c 10 -t 3000 pgbench > starting vacuum...end. > Client 0 aborted in state 8: ERROR: integer out of range > Client 7 aborted in state 8: ERROR: integer out of range I've seen that too, after re-using an existing pgbench database enough times. I think that the way the test script is written, the adjustments to the branch balances are always in the same direction, and so eventually the fields overflow. It's irrelevant to performance though. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 20 11:48:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 03CB39DC9A0 for ; Tue, 20 Dec 2005 11:48:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05894-02 for ; Tue, 20 Dec 2005 11:48:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EAEC49DC819 for ; Tue, 20 Dec 2005 11:48:05 -0400 (AST) 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 jBKFm80H029673; Tue, 20 Dec 2005 10:48:08 -0500 (EST) To: Markus Schaber cc: PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback In-reply-to: <43A7F9B9.3010906@logix-tt.com> References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> <43A7F303.8040804@logix-tt.com> <87mziwj6na.fsf@gate450.dyndns.org> <43A7F9B9.3010906@logix-tt.com> Comments: In-reply-to Markus Schaber message dated "Tue, 20 Dec 2005 13:31:53 +0100" Date: Tue, 20 Dec 2005 10:48:08 -0500 Message-ID: <29672.1135093688@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.021 required=5 tests=[AWL=0.021] X-Spam-Score: 0.021 X-Spam-Level: X-Archive-Number: 200512/497 X-Sequence-Number: 16318 Markus Schaber writes: > Some time ago, I had some tests with large bulk insertions, and it > turned out that SERIALIZABLE seemed to be 30% faster, which surprised us. That surprises me too --- can you provide details on the test case so other people can reproduce it? AFAIR the only performance difference between SERIALIZABLE and READ COMMITTED is the frequency with which transaction status snapshots are taken; your report suggests you were spending 30% of the time in GetSnapshotData, which is a lot higher than I've ever seen in a profile. As to the original question, a transaction that hasn't modified the database does not bother to write either a commit or abort record to pg_xlog. I think you'd be very hard pressed to measure any speed difference between saying COMMIT and saying ROLLBACK after a read-only transaction. It'd be worth your while to let transactions run longer to minimize their startup/shutdown overhead, but there's a point of diminishing returns --- you don't want client code leaving transactions open for hours, because of the negative side-effects of holding locks that long (eg, VACUUM can't reclaim dead rows). regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 20 12:02:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F21F69DC98E for ; Tue, 20 Dec 2005 12:02:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06306-08 for ; Tue, 20 Dec 2005 12:02:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id D42799DC973 for ; Tue, 20 Dec 2005 12:02:34 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Eojwb-0005iT-00; Tue, 20 Dec 2005 11:02:29 -0500 To: Tom Lane Cc: Markus Schaber , PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> <43A7F303.8040804@logix-tt.com> <87mziwj6na.fsf@gate450.dyndns.org> <43A7F9B9.3010906@logix-tt.com> <29672.1135093688@sss.pgh.pa.us> In-Reply-To: <29672.1135093688@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 20 Dec 2005 11:02:29 -0500 Message-ID: <87irtjah9m.fsf@stark.xeocode.com> Lines: 13 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.078 required=5 tests=[AWL=0.078] X-Spam-Score: 0.078 X-Spam-Level: X-Archive-Number: 200512/498 X-Sequence-Number: 16319 Tom Lane writes: > That surprises me too --- can you provide details on the test case so > other people can reproduce it? AFAIR the only performance difference > between SERIALIZABLE and READ COMMITTED is the frequency with which > transaction status snapshots are taken; your report suggests you were > spending 30% of the time in GetSnapshotData, which is a lot higher than > I've ever seen in a profile. Perhaps it reduced the amount of i/o concurrent vacuums were doing? -- greg From pgsql-performance-owner@postgresql.org Tue Dec 20 12:08:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D89659DC819 for ; Tue, 20 Dec 2005 12:08:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08205-06 for ; Tue, 20 Dec 2005 12:08:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (serval.logix-tt.com [213.239.221.42]) by postgresql.org (Postfix) with ESMTP id 308969DC816 for ; Tue, 20 Dec 2005 12:07:59 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (K8ed2.k.pppool.de [85.75.142.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 4CC7D24400F; Tue, 20 Dec 2005 17:14:11 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 6B4BFD6D5F; Tue, 20 Dec 2005 17:07:02 +0100 (CET) Message-ID: <43A82C24.4030306@logix-tt.com> Date: Tue, 20 Dec 2005 17:07:00 +0100 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> <43A7F303.8040804@logix-tt.com> <87mziwj6na.fsf@gate450.dyndns.org> <43A7F9B9.3010906@logix-tt.com> <29672.1135093688@sss.pgh.pa.us> In-Reply-To: <29672.1135093688@sss.pgh.pa.us> X-Enigmail-Version: 0.93.0.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, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/499 X-Sequence-Number: 16320 Hi, Tom, Tom Lane wrote: >>Some time ago, I had some tests with large bulk insertions, and it >>turned out that SERIALIZABLE seemed to be 30% faster, which surprised us. > > That surprises me too --- can you provide details on the test case so > other people can reproduce it? AFAIR the only performance difference > between SERIALIZABLE and READ COMMITTED is the frequency with which > transaction status snapshots are taken; your report suggests you were > spending 30% of the time in GetSnapshotData, which is a lot higher than > I've ever seen in a profile. It was in my previous Job two years ago, so I don't have access to the exact code, and my memory is foggy. It was PostGIS 0.8 and PostgreSQL 7.4. AFAIR, it was inserting into a table with about 6 columns and some indices, some columns having database-provided values (now() and a SERIAL column), where the other columns (a PostGIS Point, a long, a foreign key into another table) were set via the aplication. We tried different insertion methods (INSERT, prepared statements, a pgjdbc patch to allow COPY support), different bunch sizes and different number of parallel connections to get the highest overall insert speed. However, the project never went productive the way it was designed initially. As you write about transaction snapshots: It may be that the PostgreSQL config was not optimized well enough, and the hard disk was rather slow. > As to the original question, a transaction that hasn't modified the > database does not bother to write either a commit or abort record to > pg_xlog. I think you'd be very hard pressed to measure any speed > difference between saying COMMIT and saying ROLLBACK after a read-only > transaction. It'd be worth your while to let transactions run longer > to minimize their startup/shutdown overhead, but there's a point of > diminishing returns --- you don't want client code leaving transactions > open for hours, because of the negative side-effects of holding locks > that long (eg, VACUUM can't reclaim dead rows). Okay, so I'll stick with my current behaviour (Autocommit off and ROLLBACK after each bunch of work). Thanks, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Tue Dec 20 12:17:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D62EA9DC9A0 for ; Tue, 20 Dec 2005 12:17:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09686-07 for ; Tue, 20 Dec 2005 12:17:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EE3329DC862 for ; Tue, 20 Dec 2005 12:17:02 -0400 (AST) 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 jBKGGqwI000126; Tue, 20 Dec 2005 11:16:52 -0500 (EST) To: Greg Stark cc: Markus Schaber , PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback In-reply-to: <87irtjah9m.fsf@stark.xeocode.com> References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> <43A7F303.8040804@logix-tt.com> <87mziwj6na.fsf@gate450.dyndns.org> <43A7F9B9.3010906@logix-tt.com> <29672.1135093688@sss.pgh.pa.us> <87irtjah9m.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "20 Dec 2005 11:02:29 -0500" Date: Tue, 20 Dec 2005 11:16:52 -0500 Message-ID: <125.1135095412@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.022 required=5 tests=[AWL=0.022] X-Spam-Score: 0.022 X-Spam-Level: X-Archive-Number: 200512/500 X-Sequence-Number: 16321 Greg Stark writes: > Tom Lane writes: >> That surprises me too --- can you provide details on the test case so >> other people can reproduce it? AFAIR the only performance difference >> between SERIALIZABLE and READ COMMITTED is the frequency with which >> transaction status snapshots are taken; your report suggests you were >> spending 30% of the time in GetSnapshotData, which is a lot higher than >> I've ever seen in a profile. > Perhaps it reduced the amount of i/o concurrent vacuums were doing? Can't see how it would do that. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 20 12:51:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B39C49DC816; Tue, 20 Dec 2005 12:51:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12242-09; Tue, 20 Dec 2005 12:51:24 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id AF02A9DC819; Tue, 20 Dec 2005 12:51:22 -0400 (AST) Received: from bos-gate5.raytheon.com (bos-gate5.raytheon.com [199.46.198.234]) by svr4.postgresql.org (Postfix) with ESMTP id EF61C5AF862; Tue, 20 Dec 2005 16:51:21 +0000 (GMT) Received: from dmoute00.directory.ray.com ([147.25.130.120]) by bos-gate5.raytheon.com (8.12.10/8.12.10) with ESMTP id jBKGpHiE007847; Tue, 20 Dec 2005 11:51:17 -0500 (EST) Received: from dmsmtpe00.directory.ray.com (localhost [127.0.0.1]) by dmoute00.directory.ray.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jBKGpBU1024259 sender Richard_D_Levine@raytheon.com; Tue, 20 Dec 2005 16:51:11 GMT Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com [151.168.70.34]) by dmsmtpe00.directory.ray.com (8.12.11/8.12.11) with ESMTP id jBKGoqxH015765 sender Richard_D_Levine@raytheon.com; Tue, 20 Dec 2005 16:50:52 GMT In-Reply-To: <43A7864D.1090400@sun.com> Subject: Re: PostgreSQL and Ultrasparc T1 To: "Jignesh K. Shah" Cc: Juan Casero , 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: Tue, 20 Dec 2005 11:50:51 -0500 X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, 2004) at 12/20/2005 11:50:52 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.55 required=5 tests=[NO_REAL_NAME=0.55] X-Spam-Score: 0.55 X-Spam-Level: X-Archive-Number: 200512/501 X-Sequence-Number: 16322 Jignesh, Juan says the following below: "I figured the number of cores on the T1000/2000 processors would be utilized by the forked copies of the postgresql server. From the comments I have seen so far it does not look like this is the case." I think this needs to be refuted. Doesn't Solaris switch processes as well as threads (LWPs, whatever) equally well amongst cores? I realize the process context switch is more expensive than the thread switch, but Solaris will utilize all cores as processes or threads become ready to run, correct? BTW, it's great to see folks with your email address on the list. I feel it points to a brighter future for all involved. Thanks, Rick "Jignesh K. Shah" To Sent by: Juan Casero pgsql-performance cc -owner@postgresql pgsql-performance@postgresql.org .org Subject Re: [PERFORM] PostgreSQL and Ultrasparc T1 12/19/2005 11:19 PM I guess it depends on what you term as your metric for measurement. If it is just one query execution time .. It may not be the best on UltraSPARC T1. But if you have more than 8 complex queries running simultaneously, UltraSPARC T1 can do well compared comparatively provided the application can scale also along with it. The best way to approach is to figure out your peak workload, find an accurate way to measure the "true" metric and then design a benchmark for it and run it on both servers. Regards, Jignesh Juan Casero wrote: >Ok. That is what I wanted to know. Right now this database is a PostgreSQL >7.4.8 system. I am using it in a sort of DSS role. I have weekly summaries >of the sales for our division going back three years. I have a PHP based >webapp that I wrote to give the managers access to this data. The webapp >lets them make selections for reports and then it submits a parameterized >query to the database for execution. The returned data rows are displayed >and formatted in their web browser. My largest sales table is about 13 >million rows along with all the indexes it takes up about 20 gigabytes. I >need to scale this application up to nearly 100 gigabytes to handle daily >sales summaries. Once we start looking at daily sales figures our database >size could grow ten to twenty times. I use postgresql because it gives me >the kind of enterprise database features I need to program the complex logic >for the queries. I also need the transaction isolation facilities it >provides so I can optimize the queries in plpgsql without worrying about >multiple users temp tables colliding with each other. Additionally, I hope >to rewrite the front end application in JSP so maybe I could use the >multithreaded features of the Java to exploit a multicore multi-cpu system. >There are almost no writes to the database tables. The bulk of the >application is just executing parameterized queries and returning huge >amounts of data. I know bizgres is supposed to be better at this but I want >to stay away from anything that is beta. I cannot afford for this thing to >go wrong. My reasoning for looking at the T1000/2000 was simply the large >number of cores. I know postgresql uses a super server that forks copies of >itself to handle incoming requests on port 5432. But I figured the number of >cores on the T1000/2000 processors would be utilized by the forked copies of >the postgresql server. From the comments I have seen so far it does not look >like this is the case. We had originally sized up a dual processor dual core >AMD opteron system from HP for this but I thought I could get more bang for >the buck on a T1000/2000. It now seems I may have been wrong. I am stronger >in Linux than Solaris so I am not upset I am just trying to find the best >hardware for the anticipated needs of this application. > >Thanks, >Juan > >On Monday 19 December 2005 01:25, Scott Marlowe wrote: > > >>From: pgsql-performance-owner@postgresql.org on behalf of Juan Casero >> >>QUOTE: >> >>Hi - >> >> >>Can anyone tell me how well PostgreSQL 8.x performs on the new Sun >>Ultrasparc T1 processor and architecture on Solaris 10? I have a custom >>built retail sales reporting that I developed using PostgreSQL 7.48 and PHP >>on a Fedora Core 3 intel box. I want to scale this application upwards to >>handle a database that might grow to a 100 GB. Our company is green >>mission conscious now so I was hoping I could use that to convince >>management to consider a Sun Ultrasparc T1 or T2 system provided that if I >>can get the best performance out of it on PostgreSQL. >> >>ENDQUOTE: >> >>Well, generally, AMD 64 bit is going to be a better value for your dollar, >>and run faster than most Sparc based machines. >> >>Also, PostgreSQL is generally faster under either BSD or Linux than under >>Solaris on the same box. This might or might not hold as you crank up the >>numbers of CPUs. >> >>PostgreSQL runs one process for connection. So, to use extra CPUs, you >>really need to have >1 connection running against the database. >> >>Mostly, databases tend to be either I/O bound, until you give them a lot of >>I/O, then they'll be CPU bound. >> >>After that lots of memory, THEN more CPUs. Two CPUs is always useful, as >>one can be servicing the OS and another the database. But unless you're >>gonna have lots of users hooked up, more than 2 to 4 CPUs is usually a >>waste. >> >>So, I'd recommend a dual core or dual dual core (i.e. 4 cores) AMD64 system >>with 2 or more gigs ram, and at least a pair of fast drives in a mirror >>with a hardare RAID controller with battery backed cache. If you'll be >>trundling through all 100 gigs of your data set regularly, then get all the >>memory you can put in a machine at a reasonable cost before buying lots of >>CPUs. >> >>But without knowing what you're gonna be doing we can't really make solid >>recommendations... >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > > ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly From pgsql-performance-owner@postgresql.org Tue Dec 20 13:25:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7B4509DCA61; Tue, 20 Dec 2005 13:25:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18463-07; Tue, 20 Dec 2005 13:24:58 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by postgresql.org (Postfix) with ESMTP id 6BAC79DC819; Tue, 20 Dec 2005 13:24:57 -0400 (AST) Received: from fe-amer-06.sun.com ([192.18.108.180]) by brmea-mail-4.sun.com (8.12.10/8.12.9) with ESMTP id jBKHOuD7017728; Tue, 20 Dec 2005 10:24:56 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IRT009014CI7G00@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) ; Tue, 20 Dec 2005 10:24:56 -0700 (MST) Received: from [129.148.168.2] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IRT006534DIW9G3@mail-amer.sun.com>; Tue, 20 Dec 2005 10:24:56 -0700 (MST) Date: Tue, 20 Dec 2005 12:20:55 -0500 From: "Jignesh K. Shah" Subject: Re: PostgreSQL and Ultrasparc T1 In-reply-to: To: Richard_D_Levine@raytheon.com Cc: Juan Casero , pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org Message-id: <43A83D77.4030205@sun.com> Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en References: User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050322) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.120, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200512/502 X-Sequence-Number: 16323 But yes All LWPs (processes and threads) are switched across virtual CPUS . There is intelligence built in Solaris to understand which strands are executing on which cores and it will balance out the cores too so if there are only 8 threads running they will essentially run on separate cores rather than 2 cores with 8 threads. The biggest limitation is application scaling. pgbench shows that with more processes trying to bottleneck on same files will probably not perform better unless you tune your storage/file system. Those are the issues which we typically try to solve with community partners (vendors, open source) since that gives the biggest benefits. Best example to verify in such multi-processes environment, do you see greater than 60% avg CPU utilization in your dual/quad config Xeons/Itaniums, then Sun Fire T2000 will help you a lot. However if you are stuck below 50% (for dual) or 25% (for quad) which means you are pretty much stuck at 1 CPU performance and/or probably have more IO related contention then it won't help you with these systems. I hope you get the idea on when a workload will perform better on Sun Fire T2000 without burning hands. I will try to test some more with PostgreSQL on these systems to kind of highlight what can work or what will not work. Is pgbench the workload that you prefer? (It already has issues with pg_xlog so my guess is it probably won't scale much) If you have other workload informations let me know. Thanks. Regards, Jignesh Richard_D_Levine@raytheon.com wrote: >Jignesh, > >Juan says the following below: > >"I figured the number of cores on the T1000/2000 processors would be >utilized by the forked copies of the postgresql server. From the comments >I have seen so far it does not look like this is the case." > >I think this needs to be refuted. Doesn't Solaris switch processes as well >as threads (LWPs, whatever) equally well amongst cores? I realize the >process context switch is more expensive than the thread switch, but >Solaris will utilize all cores as processes or threads become ready to run, >correct? > >BTW, it's great to see folks with your email address on the list. I feel >it points to a brighter future for all involved. > >Thanks, > >Rick > > > > "Jignesh K. Shah" > > To > Sent by: Juan Casero > pgsql-performance cc > -owner@postgresql pgsql-performance@postgresql.org > .org Subject > Re: [PERFORM] PostgreSQL and > Ultrasparc T1 > 12/19/2005 11:19 > PM > > > > > > > > >I guess it depends on what you term as your metric for measurement. >If it is just one query execution time .. It may not be the best on >UltraSPARC T1. >But if you have more than 8 complex queries running simultaneously, >UltraSPARC T1 can do well compared comparatively provided the >application can scale also along with it. > >The best way to approach is to figure out your peak workload, find an >accurate way to measure the "true" metric and then design a benchmark >for it and run it on both servers. > >Regards, >Jignesh > > >Juan Casero wrote: > > > >>Ok. That is what I wanted to know. Right now this database is a >> >> >PostgreSQL > > >>7.4.8 system. I am using it in a sort of DSS role. I have weekly >> >> >summaries > > >>of the sales for our division going back three years. I have a PHP based >>webapp that I wrote to give the managers access to this data. The webapp >>lets them make selections for reports and then it submits a parameterized >>query to the database for execution. The returned data rows are displayed >> >> > > > >>and formatted in their web browser. My largest sales table is about 13 >>million rows along with all the indexes it takes up about 20 gigabytes. I >> >> > > > >>need to scale this application up to nearly 100 gigabytes to handle daily >>sales summaries. Once we start looking at daily sales figures our >> >> >database > > >>size could grow ten to twenty times. I use postgresql because it gives me >> >> > > > >>the kind of enterprise database features I need to program the complex >> >> >logic > > >>for the queries. I also need the transaction isolation facilities it >>provides so I can optimize the queries in plpgsql without worrying about >>multiple users temp tables colliding with each other. Additionally, I >> >> >hope > > >>to rewrite the front end application in JSP so maybe I could use the >>multithreaded features of the Java to exploit a multicore multi-cpu >> >> >system. > > >>There are almost no writes to the database tables. The bulk of the >>application is just executing parameterized queries and returning huge >>amounts of data. I know bizgres is supposed to be better at this but I >> >> >want > > >>to stay away from anything that is beta. I cannot afford for this thing >> >> >to > > >>go wrong. My reasoning for looking at the T1000/2000 was simply the large >> >> > > > >>number of cores. I know postgresql uses a super server that forks copies >> >> >of > > >>itself to handle incoming requests on port 5432. But I figured the number >> >> >of > > >>cores on the T1000/2000 processors would be utilized by the forked copies >> >> >of > > >>the postgresql server. From the comments I have seen so far it does not >> >> >look > > >>like this is the case. We had originally sized up a dual processor dual >> >> >core > > >>AMD opteron system from HP for this but I thought I could get more bang >> >> >for > > >>the buck on a T1000/2000. It now seems I may have been wrong. I am >> >> >stronger > > >>in Linux than Solaris so I am not upset I am just trying to find the best >>hardware for the anticipated needs of this application. >> >>Thanks, >>Juan >> >>On Monday 19 December 2005 01:25, Scott Marlowe wrote: >> >> >> >> >>>From: pgsql-performance-owner@postgresql.org on behalf of Juan Casero >>> >>>QUOTE: >>> >>>Hi - >>> >>> >>>Can anyone tell me how well PostgreSQL 8.x performs on the new Sun >>>Ultrasparc T1 processor and architecture on Solaris 10? I have a custom >>>built retail sales reporting that I developed using PostgreSQL 7.48 and >>> >>> >PHP > > >>>on a Fedora Core 3 intel box. I want to scale this application upwards >>> >>> >to > > >>>handle a database that might grow to a 100 GB. Our company is green >>>mission conscious now so I was hoping I could use that to convince >>>management to consider a Sun Ultrasparc T1 or T2 system provided that if >>> >>> >I > > >>>can get the best performance out of it on PostgreSQL. >>> >>>ENDQUOTE: >>> >>>Well, generally, AMD 64 bit is going to be a better value for your >>> >>> >dollar, > > >>>and run faster than most Sparc based machines. >>> >>>Also, PostgreSQL is generally faster under either BSD or Linux than under >>>Solaris on the same box. This might or might not hold as you crank up >>> >>> >the > > >>>numbers of CPUs. >>> >>>PostgreSQL runs one process for connection. So, to use extra CPUs, you >>>really need to have >1 connection running against the database. >>> >>>Mostly, databases tend to be either I/O bound, until you give them a lot >>> >>> >of > > >>>I/O, then they'll be CPU bound. >>> >>>After that lots of memory, THEN more CPUs. Two CPUs is always useful, as >>>one can be servicing the OS and another the database. But unless you're >>>gonna have lots of users hooked up, more than 2 to 4 CPUs is usually a >>>waste. >>> >>>So, I'd recommend a dual core or dual dual core (i.e. 4 cores) AMD64 >>> >>> >system > > >>>with 2 or more gigs ram, and at least a pair of fast drives in a mirror >>>with a hardare RAID controller with battery backed cache. If you'll be >>>trundling through all 100 gigs of your data set regularly, then get all >>> >>> >the > > >>>memory you can put in a machine at a reasonable cost before buying lots >>> >>> >of > > >>>CPUs. >>> >>>But without knowing what you're gonna be doing we can't really make solid >>>recommendations... >>> >>> >>> >>> >>---------------------------(end of broadcast)--------------------------- >>TIP 4: Have you searched our list archives? >> >> http://archives.postgresql.org >> >> >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > > > From pgsql-performance-owner@postgresql.org Tue Dec 20 14:26:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ADEB39DC8AC for ; Tue, 20 Dec 2005 14:26:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31024-01 for ; Tue, 20 Dec 2005 14:26:21 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 21C559DC812 for ; Tue, 20 Dec 2005 14:26:20 -0400 (AST) Received: from mail.ritek.hu (82-131-192-50.vnet.hu [82.131.192.50]) by svr4.postgresql.org (Postfix) with ESMTP id 9E9005AF09C for ; Tue, 20 Dec 2005 18:26:20 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.ritek.hu (Postfix) with ESMTP id A5F1019C147 for ; Tue, 20 Dec 2005 19:26:14 +0100 (CET) Received: from mail.ritek.hu ([127.0.0.1]) by localhost (mail.ritek.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25662-10 for ; Tue, 20 Dec 2005 19:26:13 +0100 (CET) Received: from [10.1.2.11] (unknown [10.1.2.11]) by mail.ritek.hu (Postfix) with ESMTP id 4F4C819C143 for ; Tue, 20 Dec 2005 19:26:13 +0100 (CET) Message-ID: <43A84D03.7090002@ritek.hu> Date: Tue, 20 Dec 2005 19:27:15 +0100 From: Antal Attila User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: hu-hu, hu, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: What's the best hardver for PostgreSQL 8.1? Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ritek.hu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/503 X-Sequence-Number: 16324 Hi! What do you suggest for the next problem? We have complex databases with some 100million rows (2-3million new records per month). Our current servers are working on low resposibility in these days, so we have to buy new hardver for database server. Some weeks ago we started to work with PostgreSQL8.1, which solved the problem for some months. There are some massive, hard query execution, which are too slow (5-10 or more minutes). The parallel processing is infrequent (rarely max. 4-5 parallel query execution). So we need high performance in query execution with medium parallel processability. What's your opinion what productions could help us? What is the best or only better choice? The budget line is about 30 000$ - 40 000$. Regards, Atesz From pgsql-performance-owner@postgresql.org Tue Dec 20 14:56:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 044EA9DC81C for ; Tue, 20 Dec 2005 14:56:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33632-02 for ; Tue, 20 Dec 2005 14:56:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 7E36E9DC819 for ; Tue, 20 Dec 2005 14:56:17 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 65F6C3982E; Tue, 20 Dec 2005 12:56:18 -0600 (CST) Date: Tue, 20 Dec 2005 12:56:18 -0600 From: "Jim C. Nasby" To: Jaime Casanova Cc: Mark Kirkwood , "Craig A. James" , pgsql-performance@postgresql.org Subject: Re: Overriding the optimizer Message-ID: <20051220185618.GE28771@pervasive.com> References: <1134629567.14248.27.camel@firebolt> <200512150148.16125.blargity@gmail.com> <1134644526.14248.60.camel@firebolt> <43A1C40D.8040006@paradise.net.nz> <43A1F6DB.3080805@modgraph-usa.com> <43A226E7.7040508@paradise.net.nz> <43A22BE3.6020103@modgraph-usa.com> <43A231AA.9070708@paradise.net.nz> <20051216224512.GX53809@pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.035 required=5 tests=[AWL=0.035] X-Spam-Score: 0.035 X-Spam-Level: X-Archive-Number: 200512/504 X-Sequence-Number: 16325 On Sat, Dec 17, 2005 at 07:31:40AM -0500, Jaime Casanova wrote: > > > Yeah it would - an implementation I have seen that I like is where the > > > developer can supply the *entire* execution plan with a query. This is > > > complex enough to make casual use unlikely :-), but provides the ability > > > to try out other plans, and also fix that vital query that must run > > > today..... > > > > Being able to specify an exact plan would also provide for query plan > > stability; something that is critically important in certain > > applications. If you have to meet a specific response time requirement > > for a query, you can't afford to have the optimizer suddenly decide that > > some other plan might be faster when in fact it's much slower. > > Plan stability doesn't mean time response stability... > The plan that today is almost instantaneous tomorrow can take hours... Sure, if your underlying data changes that much, but that's often not going to happen in production systems (especially OLTP where this is most important). Of course if you have a proposal for ensuring that a query always finishes in X amount of time, rather than always using the same plan, I'd love to hear it. ;) -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 15:16:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3ABE89DCB0D for ; Tue, 20 Dec 2005 15:16:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35626-06 for ; Tue, 20 Dec 2005 15:16:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 7919E9DCAA5 for ; Tue, 20 Dec 2005 15:16:17 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 3A3AC3982A; Tue, 20 Dec 2005 13:16:18 -0600 (CST) Date: Tue, 20 Dec 2005 13:16:18 -0600 From: "Jim C. Nasby" To: James Klo Cc: pgsql-performance@postgresql.org Subject: Re: make bulk deletes faster? Message-ID: <20051220191618.GF28771@pervasive.com> References: <1134988771.3208.81.camel@firebolt> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.037 required=5 tests=[AWL=0.037] X-Spam-Score: 0.037 X-Spam-Level: X-Archive-Number: 200512/505 X-Sequence-Number: 16326 On Mon, Dec 19, 2005 at 11:10:50AM -0800, James Klo wrote: > Yes, I've considered partitioning as a long term change. I was thinking > about this for other reasons - mainly performance. If I go the > partitioning route, would I need to even perform archival? No. The idea is that you have your table split up into date ranges (perhaps each week gets it's own table). IE: table_2005w01, table_2005w02, etc. You can do this with either inheritence or individual tables and a UNION ALL view. In your case, inheritence is probably the better way to go. Now, if you have everything broken down by weeks and you typically only need to access 7 days worth of data, then generally you will only be reading from two tables, so those two tables should stay in memory, and indexes on them will be smaller. If desired, you can also play tricks on the older tables surch as vacuum full or cluster to further reduce space usage and improve performance. > The larger problem that I need to solve is really twofold: > > 1. Need to keep reads on timeblocks that are from the current day > through the following seven days very fast, especially current day reads. > > 2. Need to be able to maintain the timeblocks for reporting purposes, > for at least a year (potentially more). This could probably better > handled performing aggregate analysis, but this isn't on my current radar. I've written an RRD-like implementation in SQL that might interest you; it's at http://rrs.decibel.org (though the svn web access appears to be down right now...) -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 15:22:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9E1F29DCABC; Tue, 20 Dec 2005 15:22:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36840-07; Tue, 20 Dec 2005 15:22:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C1E939DCAA5; Tue, 20 Dec 2005 15:22:35 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 481BE3982A; Tue, 20 Dec 2005 13:22:36 -0600 (CST) Date: Tue, 20 Dec 2005 13:22:36 -0600 From: "Jim C. Nasby" To: "Jignesh K. Shah" Cc: Richard_D_Levine@raytheon.com, Juan Casero , pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org Subject: Re: PostgreSQL and Ultrasparc T1 Message-ID: <20051220192236.GG28771@pervasive.com> References: <43A83D77.4030205@sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43A83D77.4030205@sun.com> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.038 required=5 tests=[AWL=0.038] X-Spam-Score: 0.038 X-Spam-Level: X-Archive-Number: 200512/506 X-Sequence-Number: 16327 On Tue, Dec 20, 2005 at 12:20:55PM -0500, Jignesh K. Shah wrote: > Is pgbench the workload that you prefer? (It already has issues with > pg_xlog so my guess is it probably won't scale much) > If you have other workload informations let me know. From what the user described, dbt3 would probably be the best benchmark to use. Note that they're basically read-only, which is absolutely not what pgbench does. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 15:34:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0D4F39DC81C for ; Tue, 20 Dec 2005 15:34:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45820-03 for ; Tue, 20 Dec 2005 15:34:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id CF7CA9DC812 for ; Tue, 20 Dec 2005 15:34:55 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id DFFC23982A; Tue, 20 Dec 2005 13:34:56 -0600 (CST) Date: Tue, 20 Dec 2005 13:34:56 -0600 From: "Jim C. Nasby" To: Juan Casero Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Ultrasparc T1 Message-ID: <20051220193456.GI28771@pervasive.com> References: <200512181135.15202.caseroj@comcast.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200512181135.15202.caseroj@comcast.net> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.039 required=5 tests=[AWL=0.039] X-Spam-Score: 0.039 X-Spam-Level: X-Archive-Number: 200512/507 X-Sequence-Number: 16328 On Sun, Dec 18, 2005 at 11:35:15AM -0500, Juan Casero wrote: > Can anyone tell me how well PostgreSQL 8.x performs on the new Sun Ultrasparc > T1 processor and architecture on Solaris 10? I have a custom built retail > sales reporting that I developed using PostgreSQL 7.48 and PHP on a Fedora People have seen some pretty big gains going from 7.4 to 8.1. I recently migrated http://stats.distributed.net and the daily processing (basically OLAP) times were cut in half. As someone else mentioned, IO is probably going to be your biggest consideration, unless you have a lot of queries running at once. Probably your best bang for the buck will be from an Opteron-based server with a good number of internal drives. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 15:47:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 001AE9DCA94 for ; Tue, 20 Dec 2005 15:47:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45834-09 for ; Tue, 20 Dec 2005 15:47:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D77CE9DCA85 for ; Tue, 20 Dec 2005 15:47:10 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 774C63982A; Tue, 20 Dec 2005 13:47:10 -0600 (CST) Date: Tue, 20 Dec 2005 13:47:10 -0600 From: "Jim C. Nasby" To: Greg Stark Cc: Cristian Prieto , pgsql-performance@postgresql.org Subject: Re: Any way to optimize GROUP BY queries? Message-ID: <20051220194710.GJ28771@pervasive.com> References: <00d701c604c1$e6945d80$6500a8c0@gt.ClickDiario.local> <87wti0ak60.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wti0ak60.fsf@stark.xeocode.com> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.04 required=5 tests=[AWL=0.040] X-Spam-Score: 0.04 X-Spam-Level: X-Archive-Number: 200512/508 X-Sequence-Number: 16329 On Mon, Dec 19, 2005 at 03:47:35PM -0500, Greg Stark wrote: > Increase your work_mem (or sort_mem in older postgres versions), you can do > this for the server as a whole or just for this one session and set it back > after this one query. You can increase it up until it starts causing swapping > at which point it would be counter productive. Just remember that work_memory is per-operation, so it's easy to push the box into swapping if the workload increases. You didn't say how much memory you have, but I'd be careful if work_memory * max_connections gets very much larger than your total memory. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 15:50:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E7B489DC823 for ; Tue, 20 Dec 2005 15:50:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47087-05 for ; Tue, 20 Dec 2005 15:50:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by postgresql.org (Postfix) with ESMTP id 3E8BA9DC81C for ; Tue, 20 Dec 2005 15:50:03 -0400 (AST) 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: High context switches occurring Date: Tue, 20 Dec 2005 14:50:03 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F16@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcYFG2n+uUjMrxz7SByD3BP5/VWSJAAghESw From: "Anjan Dave" To: "Juan Casero" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.399 required=5 tests=[AWL=-0.080, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.399 X-Spam-Level: X-Archive-Number: 200512/509 X-Sequence-Number: 16330 Sun hardware is a 4 CPU (8 cores) v40z, Dell is 6850 Quad XEON (8 cores), both have 16GB RAM, and 2 internal drives, one drive has OS + data and second drive has pg_xlog. RedHat AS4.0 U2 64-bit on both servers, PG8.1, 64bit RPMs. Thanks, Anjan -----Original Message----- From: Juan Casero [mailto:caseroj@comcast.net]=20 Sent: Monday, December 19, 2005 11:17 PM To: pgsql-performance@postgresql.org Subject: Re: [PERFORM] High context switches occurring Guys - Help me out here as I try to understand this benchmark. What is the Sun hardware and operating system we are talking about here and what is the intel=20 hardware and operating system? What was the Sun version of PostgreSQL=20 compiled with? Gcc on Solaris (assuming sparc) or Sun studio? What was PostgreSQL compiled with on intel? Gcc on linux? Thanks, Juan On Monday 19 December 2005 21:08, Anjan Dave wrote: > Re-ran it 3 times on each host - > > Sun: > -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 > number of transactions per client: 3000 > number of transactions actually processed: 30000/30000 > tps =3D 827.810778 (including connections establishing) > tps =3D 828.410801 (excluding connections establishing) > real 0m36.579s > user 0m1.222s > sys 0m3.422s > > Intel: > -bash-3.00$ time pgbench -s 10 -c 10 -t 3000 pgbench > starting vacuum...end. > transaction type: TPC-B (sort of) > scaling factor: 1 > number of clients: 10 > number of transactions per client: 3000 > number of transactions actually processed: 30000/30000 > tps =3D 597.067503 (including connections establishing) > tps =3D 597.606169 (excluding connections establishing) > real 0m50.380s > user 0m2.621s > sys 0m7.818s > > Thanks, > Anjan > > > -----Original Message----- > From: Anjan Dave > Sent: Wed 12/7/2005 10:54 AM > To: Tom Lane > Cc: Vivek Khera; Postgresql Performance > Subject: Re: [PERFORM] High context switches occurring > > > > Thanks for your inputs, Tom. I was going after high concurrent clients, > but should have read this carefully - > > -s scaling_factor > this should be used with -i (initialize) option. > number of tuples generated will be multiple of the > scaling factor. For example, -s 100 will imply 10M > (10,000,000) tuples in the accounts table. > default is 1. NOTE: scaling factor should be at least > as large as the largest number of clients you intend > to test; else you'll mostly be measuring update > contention. > > I'll rerun the tests. > > Thanks, > Anjan > > > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Tuesday, December 06, 2005 6:45 PM > To: Anjan Dave > Cc: Vivek Khera; Postgresql Performance > Subject: Re: [PERFORM] High context switches occurring > > "Anjan Dave" writes: > > -bash-3.00$ time pgbench -c 1000 -t 30 pgbench > > starting vacuum...end. > > transaction type: TPC-B (sort of) > > scaling factor: 1 > > number of clients: 1000 > > number of transactions per client: 30 > > number of transactions actually processed: 30000/30000 > > tps =3D 45.871234 (including connections establishing) > > tps =3D 46.092629 (excluding connections establishing) > > I can hardly think of a worse way to run pgbench :-(. These numbers are > about meaningless, for two reasons: > > 1. You don't want number of clients (-c) much higher than scaling factor > (-s in the initialization step). The number of rows in the "branches" > table will equal -s, and since every transaction updates one > randomly-chosen "branches" row, you will be measuring mostly row-update > contention overhead if there's more concurrent transactions than there > are rows. In the case -s 1, which is what you've got here, there is no > actual concurrency at all --- all the transactions stack up on the > single branches row. > > 2. Running a small number of transactions per client means that > startup/shutdown transients overwhelm the steady-state data. You should > probably run at least a thousand transactions per client if you want > repeatable numbers. > > Try something like "-s 10 -c 10 -t 3000" to get numbers reflecting test > conditions more like what the TPC council had in mind when they designed > this benchmark. I tend to repeat such a test 3 times to see if the > numbers are repeatable, and quote the middle TPS number as long as > they're not too far apart. > > regards, tom lane > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Dec 20 15:52:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5762E9DC9E8 for ; Tue, 20 Dec 2005 15:52:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54400-01 for ; Tue, 20 Dec 2005 15:52:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 6D2B19DC81C for ; Tue, 20 Dec 2005 15:52:21 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 9736939830; Tue, 20 Dec 2005 13:52:20 -0600 (CST) Date: Tue, 20 Dec 2005 13:52:20 -0600 From: "Jim C. Nasby" To: David Lang Cc: Anjan Dave , pgsql-performance@postgresql.org Subject: Re: separate drives for WAL or pgdata files Message-ID: <20051220195220.GK28771@pervasive.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098F10@vt-pe2550-001.vantage.vantage.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.041 required=5 tests=[AWL=0.041] X-Spam-Score: 0.041 X-Spam-Level: X-Archive-Number: 200512/510 X-Sequence-Number: 16331 On Mon, Dec 19, 2005 at 07:20:56PM -0800, David Lang wrote: > for persistant storage you can replicate from your ram-based system to a > disk-based system, and as long as your replication messages hit disk > quickly you can allow the disk-based version to lag behind in it's updates > during your peak periods (as long as it is able to catch up with the > writes overnight), and as the disk-based version won't have to do the > seeks for the reads it will be considerably faster then if it was doing > all the work (especially if you have good, large battery-backed disk > caches to go with those drives to consolodate the writes) Huh? Unless you're doing a hell of a lot of writing just run a normal instance and make sure you have enough bandwidth to the drives with pg_xlog on it. Make sure those drives are using a battery-backed raid controller too. You'll also need to tune things to make sure that checkpoints never have much (if any) work to do when the occur, but you should be able to set that up with proper bg_writer tuning. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 15:59:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8FDD39DC823 for ; Tue, 20 Dec 2005 15:59:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53514-05 for ; Tue, 20 Dec 2005 15:59:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 64A4D9DC81C for ; Tue, 20 Dec 2005 15:59:50 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id CB8FB3982A; Tue, 20 Dec 2005 13:59:51 -0600 (CST) Date: Tue, 20 Dec 2005 13:59:51 -0600 From: "Jim C. Nasby" To: David Roussel Cc: David Lang , pgsql-performance@postgresql.org Subject: Re: filesystem performance with lots of files Message-ID: <20051220195951.GL28771@pervasive.com> References: <43A80668.1040604@diroussel.xsmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43A80668.1040604@diroussel.xsmail.com> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.042 required=5 tests=[AWL=0.042] X-Spam-Score: 0.042 X-Spam-Level: X-Archive-Number: 200512/511 X-Sequence-Number: 16332 On Tue, Dec 20, 2005 at 01:26:00PM +0000, David Roussel wrote: > Note that you can do the taring, zipping, copying and untaring > concurrentlt. I can't remember the exactl netcat command line options, > but it goes something like this > > Box1: > tar czvf - myfiles/* | netcat myserver:12345 > > Box2: > netcat -listen 12345 | tar xzvf - You can also use ssh... something like tar -cf - blah/* | ssh machine tar -xf - -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 16:06:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 057BA9DC9E8 for ; Tue, 20 Dec 2005 16:06:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56485-03 for ; Tue, 20 Dec 2005 16:06:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (unknown [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 4CD5E9DC9B1 for ; Tue, 20 Dec 2005 16:06:09 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id C0BF13982E; Tue, 20 Dec 2005 14:06:09 -0600 (CST) Date: Tue, 20 Dec 2005 14:06:09 -0600 From: "Jim C. Nasby" To: Antal Attila Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Message-ID: <20051220200609.GM28771@pervasive.com> References: <43A84D03.7090002@ritek.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43A84D03.7090002@ritek.hu> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.043 required=5 tests=[AWL=0.043] X-Spam-Score: 0.043 X-Spam-Level: X-Archive-Number: 200512/512 X-Sequence-Number: 16333 On Tue, Dec 20, 2005 at 07:27:15PM +0100, Antal Attila wrote: > We have complex databases with some 100million rows (2-3million new How much space does that equate to? > records per month). Our current servers are working on low resposibility > in these days, so we have to buy new hardver for database server. Some > weeks ago we started to work with PostgreSQL8.1, which solved the > problem for some months. > There are some massive, hard query execution, which are too slow (5-10 > or more minutes). The parallel processing is infrequent (rarely max. 4-5 > parallel query execution). > So we need high performance in query execution with medium parallel > processability. > What's your opinion what productions could help us? What is the best or > only better choice? > The budget line is about 30 000$ - 40 000$. Have you optimized the queries? Items that generally have the biggest impact on performance in decreasing order: 1. System architecture 2. Database design 3. (for long-running/problem queries) Query plans 4. Disk I/O 5. Memory 6. CPU So, I'd make sure that the queries have been optimized (and that includes tuning postgresql.conf) before assuming you need more hardware. Based on what you've told us (very little parallelization), then your biggest priority is probably either disk IO or memory (or both). Without knowing the size of your database/working set it's difficult to provide more specific advice. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Dec 20 17:08:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 25ED59DCB0D for ; Tue, 20 Dec 2005 17:08:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67635-04 for ; Tue, 20 Dec 2005 17:08:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id CFAB49DCA85 for ; Tue, 20 Dec 2005 17:08:20 -0400 (AST) Received: from [192.168.1.6] (unknown [192.168.1.6]) by yertle.kcilink.com (Postfix) with ESMTP id 39656B80F for ; Tue, 20 Dec 2005 16:08:22 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <43A84D03.7090002@ritek.hu> References: <43A84D03.7090002@ritek.hu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Tue, 20 Dec 2005 16:08:20 -0500 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/513 X-Sequence-Number: 16334 On Dec 20, 2005, at 1:27 PM, Antal Attila wrote: > The budget line is about 30 000$ - 40 000$. Like Jim said, without more specifics it is hard to give more specific recommendations, but I'm architecting something like this for my current app which needs ~100GB disk space. I made room to grow in my configuration: dual opteron 2.2GHz 4GB RAM LSI MegaRAID 320-2X 14-disk SCSI U320 enclosure with 15k RPM drives, 7 connected to each channel on the RAID. 1 pair in RAID1 mirror for OS + pg_xlog rest in RAID10 with each mirrored pair coming from opposite SCSI channels for data I run FreeBSD but whatever you prefer should be sufficient if it is not windows. I don't know how prices are in Hungary, but around here something like this with 36GB drives comes to around $11,000 or $12,000. The place I concentrate on is the disk I/O bandwidth which is why I prefer Opteron over Intel XEON. From pgsql-performance-owner@postgresql.org Tue Dec 20 17:48:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 228799DCB38 for ; Tue, 20 Dec 2005 17:48:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73822-07 for ; Tue, 20 Dec 2005 17:48:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C67839DCB0B for ; Tue, 20 Dec 2005 17:48:00 -0400 (AST) 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 jBKLilJM006543; Tue, 20 Dec 2005 16:44:47 -0500 (EST) To: "Jim C. Nasby" cc: Greg Stark , Cristian Prieto , pgsql-performance@postgresql.org Subject: Re: Any way to optimize GROUP BY queries? In-reply-to: <20051220194710.GJ28771@pervasive.com> References: <00d701c604c1$e6945d80$6500a8c0@gt.ClickDiario.local> <87wti0ak60.fsf@stark.xeocode.com> <20051220194710.GJ28771@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Tue, 20 Dec 2005 13:47:10 -0600" Date: Tue, 20 Dec 2005 16:44:47 -0500 Message-ID: <6542.1135115087@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/514 X-Sequence-Number: 16335 "Jim C. Nasby" writes: > On Mon, Dec 19, 2005 at 03:47:35PM -0500, Greg Stark wrote: >> Increase your work_mem (or sort_mem in older postgres versions), you can do >> this for the server as a whole or just for this one session and set it back >> after this one query. You can increase it up until it starts causing swapping >> at which point it would be counter productive. > Just remember that work_memory is per-operation, so it's easy to push > the box into swapping if the workload increases. You didn't say how much > memory you have, but I'd be careful if work_memory * max_connections > gets very much larger than your total memory. It's considered good practice to have a relatively small default work_mem setting (in postgresql.conf), and then let individual sessions push up the value locally with "SET work_mem" if they are going to execute queries that need it. This works well as long as you only have one or a few such "heavy" sessions at a time. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 20 20:43:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D9F499DCB65 for ; Tue, 20 Dec 2005 20:43:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96023-08 for ; Tue, 20 Dec 2005 20:43:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.154]) by postgresql.org (Postfix) with ESMTP id 781A89DCB67 for ; Tue, 20 Dec 2005 20:43:29 -0400 (AST) Received: from [192.168.1.21] (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc14) with ESMTP id <20051221004331014008mgdre>; Wed, 21 Dec 2005 00:43:32 +0000 From: Juan Casero To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Tue, 20 Dec 2005 19:50:47 -0500 User-Agent: KMail/1.8.2 References: <43A84D03.7090002@ritek.hu> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512201950.47671.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.626 required=5 tests=[AWL=-0.693, DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 1.626 X-Spam-Level: * X-Archive-Number: 200512/515 X-Sequence-Number: 16336 Can you elaborate on the reasons the opteron is better than the Xeon when it comes to disk io? I have a PostgreSQL 7.4.8 box running a DSS. One of our tables is about 13 million rows. I had a number of queries against this table that used innner joins on 5 or 6 tables including the 13 million row one. The performance was atrocious. The database itself is about 20 gigs but I want it to scale to 100 gigs. I tuned postgresql as best I could and gave the server huge amounts of memory for caching as well. I also tweaked the cost parameters for a sequential scan vs an index scan of the query optimizer and used the query explain mechanism to get some idea of what the optimizer was doing and where I should index the tables. When I added the sixth table to the inner join the query performance took a nose dive. Admittedly this system is a single PIII 1000Mhz with 1.2 gigs of ram and no raid. I do have two Ultra 160 scsi drives with the database tables mount point on a partition on one physical drive and pg_xlog mount point on another partition of the second drive. I have been trying to get my employer to spring for new hardware ($8k to $10k) which I had planned to be a dual - dual core opteron system from HP. Until they agree to spend the money I resorted to writing a plpgsql functions to handle the queries. Inside plpgsql I can break the query apart into seperate stages each of which runs much faster. I can use temporary tables to store intermediate results without worrying about temp table collisions with different users thanks to transaction isolation. I am convinced we need new hardware to scale this application *but* I agree with the consensus voiced here that it is more important to optimize the query first before going out to buy new hardware. I was able to do things with PostgreSQL on this cheap server that I could never imagine doing with SQL server or even oracle on such a low end box. My OS is Fedora Core 3 but I wonder if anyone has tested and benchmarked PostgreSQL on the new Sun x64 servers running Solaris 10 x86. Thanks, Juan On Tuesday 20 December 2005 16:08, Vivek Khera wrote: > On Dec 20, 2005, at 1:27 PM, Antal Attila wrote: > > The budget line is about 30 000$ - 40 000$. > > Like Jim said, without more specifics it is hard to give more > specific recommendations, but I'm architecting something like this > for my current app which needs ~100GB disk space. I made room to > grow in my configuration: > > dual opteron 2.2GHz > 4GB RAM > LSI MegaRAID 320-2X > 14-disk SCSI U320 enclosure with 15k RPM drives, 7 connected to each > channel on the RAID. > 1 pair in RAID1 mirror for OS + pg_xlog > rest in RAID10 with each mirrored pair coming from opposite SCSI > channels for data > > I run FreeBSD but whatever you prefer should be sufficient if it is > not windows. > > I don't know how prices are in Hungary, but around here something > like this with 36GB drives comes to around $11,000 or $12,000. > > The place I concentrate on is the disk I/O bandwidth which is why I > prefer Opteron over Intel XEON. > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match From pgsql-performance-owner@postgresql.org Tue Dec 20 22:50:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D940B9DC835 for ; Tue, 20 Dec 2005 22:50:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20939-01 for ; Tue, 20 Dec 2005 22:50:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 595BC9DC81B for ; Tue, 20 Dec 2005 22:47:16 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 3054A1AC3E9; Tue, 20 Dec 2005 18:47:38 -0800 (PST) Date: Tue, 20 Dec 2005 18:46:31 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Juan Casero Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <200512201950.47671.caseroj@comcast.net> Message-ID: References: <43A84D03.7090002@ritek.hu> <200512201950.47671.caseroj@comcast.net> 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, score=0.037 required=5 tests=[AWL=0.037] X-Spam-Score: 0.037 X-Spam-Level: X-Archive-Number: 200512/516 X-Sequence-Number: 16337 On Tue, 20 Dec 2005, Juan Casero wrote: > Date: Tue, 20 Dec 2005 19:50:47 -0500 > From: Juan Casero > To: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] What's the best hardver for PostgreSQL 8.1? > > Can you elaborate on the reasons the opteron is better than the Xeon when it > comes to disk io? the opteron is cheaper so you have more money to spend on disks :-) also when you go into multi-cpu systems the front-side-bus design of the Xeon's can easily become your system bottleneck so that you can't take advantage of all the CPU's becouse they stall waiting for memory accesses, Opteron systems have a memory bus per socket so the more CPU's you have the more memory bandwidth you have. > The database itself is about 20 gigs > but I want it to scale to 100 gigs. how large is the working set? in your tests you ran into swapping on your 1.2G system, buying a dual opteron with 16gigs of ram will allow you to work with much larger sets of data, and you can go beyond that if needed. David Lang From pgsql-performance-owner@postgresql.org Wed Dec 21 01:58:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C44B99DC8A9 for ; Wed, 21 Dec 2005 01:58:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55439-04 for ; Wed, 21 Dec 2005 01:58:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.bway.net (xena.bway.net [216.220.96.26]) by postgresql.org (Postfix) with ESMTP id 45D549DC81E for ; Wed, 21 Dec 2005 01:58:29 -0400 (AST) Received: (qmail 53758 invoked by uid 0); 21 Dec 2005 05:58:29 -0000 Received: from unknown (HELO white.nat.fasttrackmonkey.com) (spork@bway.net@216.220.116.154) by smtp.bway.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 21 Dec 2005 05:58:29 -0000 Date: Wed, 21 Dec 2005 00:58:54 -0500 (EST) From: Charles Sprickman To: pgsql-performance@postgresql.org Subject: Re: SAN/NAS options 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, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/525 X-Sequence-Number: 16346 On Wed, 14 Dec 2005, Charles Sprickman wrote: [big snip] The list server seems to be regurgitating old stuff, and in doing so it reminded me to thank everyone for their input. I was kind of waiting to see if anyone who was very pro-NAS/SAN was going to pipe up, but it looks like most people are content with per-host storage. You've given me a lot to go on... Now I'm going to have to do some research as to real-world RAID controller performance. It's vexing (to say the least) that most vendors don't supply any raw throughput or TPS stats on this stuff... Anyhow, thanks again. You'll probably see me back here in the coming months as I try to shake some mysql info out of my brain as our pgsql DBA gets me up to speed on pgsql and what specifically he's doing to stress things. Charles > I hope this isn't too far off topic for this list. Postgres is the main > application that I'm looking to accomodate. Anything else I can do with > whatever solution we find is just gravy... > > Thanks! > > Charles > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Wed Dec 21 02:55:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CAE369DC813 for ; Wed, 21 Dec 2005 02:55:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82934-02 for ; Wed, 21 Dec 2005 02:55:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 355FB9DC80C for ; Wed, 21 Dec 2005 02:55:24 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRU00AHA5WC15@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 19:55:24 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-211.dsl.clear.net.nz [218.101.28.211]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id F08471525DDD; Wed, 21 Dec 2005 19:55:23 +1300 (NZDT) Date: Wed, 21 Dec 2005 19:55:20 +1300 From: Mark Kirkwood Subject: Re: Simple Join In-reply-to: <43A0AB0A.3000403@paradise.net.nz> To: Kevin Brown Cc: pgsql-performance@postgresql.org Message-id: <43A8FC58.1020609@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512141603.52583.blargity@gmail.com> <43A0AB0A.3000403@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.341 required=5 tests=[AWL=0.341] X-Spam-Score: 0.341 X-Spam-Level: X-Archive-Number: 200512/526 X-Sequence-Number: 16347 Mark Kirkwood wrote: > Kevin Brown wrote: > >> I'll just start by warning that I'm new-ish to postgresql. >> >> I'm running 8.1 installed from source on a Debian Sarge server. I >> have a simple query that I believe I've placed the indexes correctly >> for, and I still end up with a seq scan. It makes sense, kinda, but >> it should be able to use the index to gather the right values. I do >> have a production set of data inserted into the tables, so this is >> running realistically: >> >> dli=# explain analyze SELECT ordered_products.product_id >> dli-# FROM to_ship, ordered_products >> dli-# WHERE to_ship.ordered_product_id = ordered_products.id AND >> dli-# ordered_products.paid = TRUE AND >> dli-# ordered_products.suspended_sub = FALSE; > > > You scan 600000 rows from to_ship to get about 25000 - so some way to > cut this down would help. > > Try out an explicit INNER JOIN which includes the filter info for paid > and suspended_sub in the join condition (you may need indexes on each of > id, paid and suspended_sub, so that the 8.1 optimizer can use a bitmap > scan): > > > SELECT ordered_products.product_id > FROM to_ship INNER JOIN ordered_products > ON (to_ship.ordered_product_id = ordered_products.id > AND ordered_products.paid = TRUE AND > ordered_products.suspended_sub = FALSE); It has been a quiet day today, so I took another look at this. If the selectivity of clauses : paid = TRUE suspended_sub = FALSE is fairly high, then rewriting as a subquery might help: SELECT o.product_id FROM ordered_products o WHERE o.paid = TRUE AND o.suspended_sub = FALSE AND EXISTS ( SELECT 1 FROM to_ship s WHERE s.ordered_product_id = o.id ); However it depends on you not needing anything from to_ship in the SELECT list... Cheers Mark From pgsql-performance-owner@postgresql.org Wed Dec 21 05:05:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 692D69DC9B3 for ; Wed, 21 Dec 2005 05:05:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72753-05 for ; Wed, 21 Dec 2005 05:05:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from alatxa.lapeixera.org (unknown [212.31.60.122]) by postgresql.org (Postfix) with ESMTP id 1A6449DC813 for ; Wed, 21 Dec 2005 05:05:13 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by alatxa.lapeixera.org (Postfix) with ESMTP id E766073CD2 for ; Wed, 21 Dec 2005 10:04:58 +0100 (CET) Received: from alatxa.lapeixera.org ([127.0.0.1]) by localhost (alatxa [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06323-01 for ; Wed, 21 Dec 2005 10:04:48 +0100 (CET) Received: from [10.2.2.28] (unknown [10.2.2.28]) by alatxa.lapeixera.org (Postfix) with ESMTP id 0957373C8E for ; Wed, 21 Dec 2005 10:04:48 +0100 (CET) Message-ID: <43A91ABE.9070000@endepro.com> Date: Wed, 21 Dec 2005 10:05:02 +0100 From: Josep Maria Pinyol Fontseca Organization: Endepro User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: ca MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Windows performance again Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at lapeixera.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/527 X-Sequence-Number: 16348 Hello, We have the next scenario: Linux box with postgresql 7.2.1-1 (client) Windows XP with postgresql 8.1.1 (server) Windows XP with postgresql 8.1.1 (client) All connected in 10Mb LAN In server box, we have a table with 65000 rows and usign "psql" we have these results: Linux box with psql version 7.2.1 versus Windows XP server: select * from ; -> 7 seconds aprox. to obtain a results. Network utilization: 100% Windows XP client box with psql version 8.1.1 versus Windows XP server: select * from
; -> 60 seconds aprox. to obtain a results!!!!!!!!!!!! Network utilization: 3% Windows XP server box with psql version 8.1.1 versus Windows XP server: select * from
; -> <1 seconds aprox. to obtain a results. Network utilization: 0% Is a really problem, because we are migrating a old server to 8.0 version in a windows box, and our application works really slow.... Thanks in advance, Josep Maria -- Josep Maria Pinyol i Fontseca Responsable �rea de programaci� ENDEPRO - Enginyeria de programari Passeig Anselm Clav�, 19 Bx. 08263 Call�s (Barcelona) Tel. +34 936930018 - Mob. +34 600310755 - Fax. +34 938361994 jmpinyol@endepro.com - http://www.endepro.com Aquest missatge i els documents en el seu cas adjunts, es dirigeixen exclusivament al seu destinatari i poden contenir informaci� reservada i/o CONFIDENCIAL, us del qual no est� autoritzat ni la divulgaci� del mateix, prohibit per la legislaci� vigent (Llei 32/2002 SSI-CE). Si ha rebut aquest missatge per error, li demanem que ens ho comuniqui immediatament per la mateixa via o b� per tel�fon (+34936930018) i procedeixi a la seva destrucci�. Aquest e-mail no podr� considerar-se SPAM. Este mensaje, y los documentos en su caso anexos, se dirigen exclusivamente a su destinatario y pueden contener informaci�n reservada y/o CONFIDENCIAL cuyo uso no autorizado o divulgaci�n est� prohibida por la legislaci�n vigente (Ley 32/2002 SSI-CE). Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma v�a o por tel�fono (+34936930018) y proceda a su destrucci�n. Este e-mail no podr� considerarse SPAM. This message and the enclosed documents are directed exclusively to its receiver and can contain reserved and/or confidential information, from which use isn�t allowed its divulgation, forbidden by the current legislation (Law 32/2002 SSI-CE). If you have received this message by mistake, we kindly ask you to communicate it to us right away by the same way or by phone (+34936930018) and destruct it. This e-mail can�t be considered as SPAM. From pgsql-performance-owner@postgresql.org Wed Dec 21 06:04:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 375C59DC80C for ; Wed, 21 Dec 2005 06:04:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90971-05 for ; Wed, 21 Dec 2005 06:04:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id CB7AF9DC823 for ; Wed, 21 Dec 2005 06:04:34 -0400 (AST) 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 EE941424FDC; Wed, 21 Dec 2005 09:58:43 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 0B3D515EA4; Wed, 21 Dec 2005 09:58:49 +0000 (GMT) Message-ID: <43A92758.6060709@archonet.com> Date: Wed, 21 Dec 2005 09:58:48 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Josep Maria Pinyol Fontseca Cc: pgsql-performance@postgresql.org Subject: Re: Windows performance again References: <43A91ABE.9070000@endepro.com> In-Reply-To: <43A91ABE.9070000@endepro.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.016 required=5 tests=[AWL=0.016] X-Spam-Score: 0.016 X-Spam-Level: X-Archive-Number: 200512/528 X-Sequence-Number: 16349 Josep Maria Pinyol Fontseca wrote: > > Linux box with psql version 7.2.1 versus Windows XP server: > > select * from
; -> 7 seconds aprox. to obtain a results. > Network utilization: 100% > > Windows XP client box with psql version 8.1.1 versus Windows XP server: > > select * from
; -> 60 seconds aprox. to obtain a results!!!!!!!!!!!! > Network utilization: 3% > > Windows XP server box with psql version 8.1.1 versus Windows XP server: > > select * from
; -> <1 seconds aprox. to obtain a results. > Network utilization: 0% It's *got* to be the network configuration on the client machine. I'd be tempted to install ethereal on the linux box and watch for the difference between the two networked sessions. I'm guessing it might be something to do with TCP/IP window/buffer sizes and delays on ACKs - this certainly used to be an issue on older MS systems, but I must admit I thought they'd fixed it for XP. If not that, could some firewall/security system be slowing network traffic? -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Dec 21 06:17:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 52D449DCAB8 for ; Wed, 21 Dec 2005 06:17:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92387-05 for ; Wed, 21 Dec 2005 06:17:35 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4A3F69DC9B3 for ; Wed, 21 Dec 2005 06:17:30 -0400 (AST) Received: from mail.advfn.com (mail.advfn.com [212.161.99.149]) by svr4.postgresql.org (Postfix) with ESMTP id D5AE25AF8C1 for ; Wed, 21 Dec 2005 10:17:32 +0000 (GMT) Received: from [192.168.0.155] (gw.advfn.com [213.86.19.101]) by mail.advfn.com (Postfix) with ESMTP id 5DD50FDAAE; Wed, 21 Dec 2005 10:17:29 +0000 (GMT) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <65701295-1601-43C7-8308-257170E29A9C@advfn.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: SAN/NAS options Date: Wed, 21 Dec 2005 10:17:27 +0000 To: Charles Sprickman X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-0.1 required=5 tests=[RCVD_IN_BSP_OTHER=-0.1] X-Spam-Score: -0.1 X-Spam-Level: X-Archive-Number: 200512/529 X-Sequence-Number: 16350 > >> I hope this isn't too far off topic for this list. Postgres is >> the main application that I'm looking to accomodate. Anything >> else I can do with whatever solution we find is just gravy... > You've given me a lot to go on... Now I'm going to have to do some > research as to real-world RAID controller performance. It's vexing > (to say the least) that most vendors don't supply any raw > throughput or TPS stats on this stuff... One word of advice. Stay away from Dell kit. The PERC 4 controllers they use don't implement RAID 10 properly. It's RAID 1 + JBOD array. It also has generally dismal IOPS performance too. You might get away with running software RAID, either in conjunction with, or entirely avoiding the card. From pgsql-performance-owner@postgresql.org Wed Dec 21 06:37:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 848C59DC80C for ; Wed, 21 Dec 2005 06:37:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95385-06 for ; Wed, 21 Dec 2005 06:37:49 -0400 (AST) X-Greylist: delayed 16:11:26.629355 by SQLgrey- Received: from mail.ritek.hu (82-131-192-50.vnet.hu [82.131.192.50]) by postgresql.org (Postfix) with ESMTP id 45C679DC84B for ; Wed, 21 Dec 2005 06:37:44 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.ritek.hu (Postfix) with ESMTP id 1BBF219C152 for ; Wed, 21 Dec 2005 11:37:44 +0100 (CET) Received: from mail.ritek.hu ([127.0.0.1]) by localhost (mail.ritek.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05819-10 for ; Wed, 21 Dec 2005 11:37:41 +0100 (CET) Received: from [10.1.2.11] (unknown [10.1.2.11]) by mail.ritek.hu (Postfix) with ESMTP id BD4E419C137 for ; Wed, 21 Dec 2005 11:37:41 +0100 (CET) Message-ID: <43A930B3.1020807@ritek.hu> Date: Wed, 21 Dec 2005 11:38:43 +0100 From: Antal Attila User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: hu-hu, hu, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? References: <43A84D03.7090002@ritek.hu> <20051220200609.GM28771@pervasive.com> In-Reply-To: <20051220200609.GM28771@pervasive.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ritek.hu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/530 X-Sequence-Number: 16351 Jim C. Nasby wrote: >How much space does that equate to? > > >Have you optimized the queries? > >Items that generally have the biggest impact on performance in >decreasing order: >1. System architecture >2. Database design >3. (for long-running/problem queries) Query plans >4. Disk I/O >5. Memory >6. CPU > >So, I'd make sure that the queries have been optimized (and that >includes tuning postgresql.conf) before assuming you need more hardware. > >Based on what you've told us (very little parallelization), then your >biggest priority is probably either disk IO or memory (or both). Without >knowing the size of your database/working set it's difficult to provide >more specific advice. > > Hi! We have 3 Compaq Proliant ML530 servers with dual Xeon 2.8GHz processors, 3 GB DDR RAM, Ultra Wide SCSI RAID5 10000rpm and 1000Gbit ethernet. We partitioned our databases among these machines, but there are cross refrences among the machines theoretically. Now the size of datas is about 100-110GB. We've used these servers for 3 years with Debian Linux. We have already optimized the given queries and the postgresql.conf. We tried more tricks and ideas and we read and asked on mailing lists. We cannot do anything, we should buy new server for the databases, because we develop our system for newer services, so the size will grow along. After that we need better responsiblility and shorter execution time for the big queries (These queries are too complicated to discuss here, and more times we optimized with plpgsql stored procedures.). The PostgreSQL 8.1 solved more paralellization and overload problem, the average load is decreased significantly on our servers. But the big queries aren't fast enough. We think the hardver is the limit. Generally 2 parallel guery running in working hours, after we make backups at night. Regards, Atesz From pgsql-performance-owner@postgresql.org Wed Dec 21 06:47:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F190E9DCBD7 for ; Wed, 21 Dec 2005 06:47:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96555-06 for ; Wed, 21 Dec 2005 06:47:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id CF9FB9DC823 for ; Wed, 21 Dec 2005 06:47:01 -0400 (AST) Received: from 172.16.1.148 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Wed, 21 Dec 2005 05:46:55 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Dec 2005 05:46:55 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Wed, 21 Dec 2005 10:46:55 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 21 Dec 2005 02:46:54 -0800 Subject: Re: SAN/NAS options From: "Luke Lonergan" To: "Charles Sprickman" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] SAN/NAS options Thread-Index: AcYF86fodjs1b5MoSXC3BC9Dh7/IbgAKDNoN In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 21 Dec 2005 10:46:55.0634 (UTC) FILETIME=[DC49B720:01C6061B] X-WSS-ID: 6FB7ED153301229369-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.278 required=5 tests=[AWL=0.025, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.278 X-Spam-Level: * X-Archive-Number: 200512/531 X-Sequence-Number: 16352 Charles, On 12/20/05 9:58 PM, "Charles Sprickman" wrote: > You've given me a lot to go on... Now I'm going to have to do some > research as to real-world RAID controller performance. It's vexing (to > say the least) that most vendors don't supply any raw throughput or TPS > stats on this stuff... Take a look at this: http://www.wlug.org.nz/HarddiskBenchmarks > Anyhow, thanks again. You'll probably see me back here in the coming > months as I try to shake some mysql info out of my brain as our pgsql DBA > gets me up to speed on pgsql and what specifically he's doing to stress > things. Cool! BTW - based on the above benchmark page, I just immediately ordered 2 x of the Areca 1220 SATA controllers ( http://www.areca.com.tw/products/html/pcie-sata.htm) so that we can compare them to the 3Ware 9550SX that we've been using. The 3Ware controllers have been super fast on sequential access, but I'm concerned about their random IOPs. The Areca's aren't as popular, and there's consequently less volume of them, but people who use them rave about them. - Luke From pgsql-performance-owner@postgresql.org Wed Dec 21 07:06:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 38A7F9DCBD3 for ; Wed, 21 Dec 2005 07:06:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02182-07 for ; Wed, 21 Dec 2005 07:06:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 76E599DCBC7 for ; Wed, 21 Dec 2005 07:06:46 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Ep1nz-0004LC-7Q for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 12:06:47 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Ep1nz-0004Y1-00 for ; Wed, 21 Dec 2005 12:06:47 +0100 Date: Wed, 21 Dec 2005 12:06:47 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language Message-ID: <20051221110647.GA17360@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.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200512/532 X-Sequence-Number: 16353 On Sun, Dec 18, 2005 at 01:10:21AM -0000, Ben Trewern wrote: > I know I should be writing these in C but that's a bit beyond me. I was > going to try PL/Python or PL/Perl or even PL/Ruby. Has anyone any idea > which language is fastest, or is the data access going to swamp the overhead > of small functions? I'm not sure if it's what you ask for, but there _is_ a clear difference between the procedural languages -- I've had a 10x speed increase from rewriting PL/PgSQL stuff into PL/Perl, for instance. I'm not sure which ones would be faster, though -- I believe Ruby is slower than Perl or Python generally, but I don't know how it all works out in a PL/* setting. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-general-owner@postgresql.org Wed Dec 21 07:25:59 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 73BCB9DC820; Wed, 21 Dec 2005 07:25:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38035-01; Wed, 21 Dec 2005 07:26:00 -0400 (AST) X-Greylist: delayed 00:15:21.300719 by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.unicite.fr.netcentrex.net (mailer.fr.netcentrex.net [62.161.167.249]) by postgresql.org (Postfix) with ESMTP id A5E0E9DC80C; Wed, 21 Dec 2005 07:25:53 -0400 (AST) Received: from akira ([192.168.101.228]) by mailer.unicite.fr.netcentrex.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id Y7YLGJ07; Wed, 21 Dec 2005 12:10:34 +0100 From: "Alban Medici \(NetCentrex\)" To: , , Subject: Re: [PERFORM] need help Date: Wed, 21 Dec 2005 12:10:33 +0100 Organization: NetCentrex 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 In-reply-to: <439551D0.5070904@wildenhain.de> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcX6QtxBWcxHbcD6SaCfuFqV0+6GQgL3BwHQ Message-Id: <20051221112553.A5E0E9DC80C@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.927 required=5 tests=[MSGID_FROM_MTA_ID=0.927] X-Spam-Score: 0.927 X-Spam-Level: X-Archive-Number: 200512/1015 X-Sequence-Number: 88578 Try to execute your query (in psql) with prefixing by EXPLAIN ANALYZE = and send us the result db=3D# EXPLAIN ANALYZE UPDATE s_apotik SET stock =3D 100 WHERE = obat_id=3D'A'; regards -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tino = Wildenhain Sent: mardi 6 d=E9cembre 2005 09:55 To: Jenny Cc: pgsql-general@postgresql.org; pgsql-sql@postgresql.org; pgsql-performance@postgresql.org Subject: Re: [PERFORM] [GENERAL] need help Jenny schrieb: > I'm running PostgreSQL 8.0.3 on i686-pc-linux-gnu (Fedora Core 2).=20 > I've been dealing with Psql for over than 2 years now, but I've never=20 > had this case before. >=20 > I have a table that has about 20 rows in it. >=20 > Table "public.s_apotik" > Column | Type | Modifiers > -------------------+------------------------------+------------------ > obat_id | character varying(10) | not null > stock | numeric | not null > s_min | numeric | not null > s_jual | numeric |=20 > s_r_jual | numeric |=20 > s_order | numeric |=20 > s_r_order | numeric |=20 > s_bs | numeric |=20 > last_receive | timestamp without time zone | > Indexes: > "s_apotik_pkey" PRIMARY KEY, btree(obat_id) > =20 > When I try to UPDATE one of the row, nothing happens for a very long = time. > First, I run it on PgAdminIII, I can see the miliseconds are growing=20 > as I waited. Then I stop the query, because the time needed for it is=20 > unbelievably wrong. >=20 > Then I try to run the query from the psql shell. For example, the=20 > table has obat_id : A, B, C, D. > db=3D# UPDATE s_apotik SET stock =3D 100 WHERE obat_id=3D'A'; (.... = nothing=20 > happens.. I press the Ctrl-C to stop it. This is what comes out > :) > Cancel request sent > ERROR: canceling query due to user request >=20 > (If I try another obat_id) > db=3D# UPDATE s_apotik SET stock =3D 100 WHERE obat_id=3D'B'; (Less = than a=20 > second, this is what comes out :) UPDATE 1 >=20 > I can't do anything to that row. I can't DELETE it. Can't DROP the = table.=20 > I want this data out of my database. > What should I do? It's like there's a falsely pointed index here. > Any help would be very much appreciated. >=20 1) lets hope you do regulary backups - and actually tested restore. 1a) if not, do it right now 2) reindex the table 3) try again to modify Q: are there any foreign keys involved? If so, reindex those tables too, just in case. did you vacuum regulary? HTH Tino ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Wed Dec 21 08:10:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C600A9DC820 for ; Wed, 21 Dec 2005 08:10:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67419-07 for ; Wed, 21 Dec 2005 08:10:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asmtp-out1.blueyonder.co.uk (asmtp-out1.blueyonder.co.uk [195.188.213.60]) by postgresql.org (Postfix) with ESMTP id ABC559DC804 for ; Wed, 21 Dec 2005 08:10:50 -0400 (AST) Received: from [82.44.78.202] (helo=Eve) by asmtp-out1.blueyonder.co.uk with esmtp (Exim 4.52) id 1Ep2o1-0006qD-3w; Wed, 21 Dec 2005 12:10:53 +0000 Reply-To: From: "Andy Ballingall" To: "'David Roussel'" Cc: Subject: Re: 2 phase commit: performance implications? Date: Wed, 21 Dec 2005 12:10:53 -0000 Organization: Areyoulocal Ltd. 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.5510 In-Reply-To: <43A81C8E.6010602@diroussel.xsmail.com> Thread-Index: AcYFdkuksrhPeCRjTSeM16Kaxa3smgAqgfaQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-Id: <20051221121050.ABC559DC804@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.464 required=5 tests=[AWL=-0.464, MSGID_FROM_MTA_ID=0.927] X-Spam-Score: 0.464 X-Spam-Level: X-Archive-Number: 200512/534 X-Sequence-Number: 16355 >Why not just query adjacent databases, rather than copying the data = around? The reasons I didn't choose this way were: 1) I didn't think there's a way to write a query that can act on the = data in two Databases as though it was all in one, and I didn't want to get into = merging multiple database query results on the Application side. I'd rather just have all the needed data sitting in a single database so that I can = perform whatever query I like without complication. 2) Most database accesses are reads, and I didn't want a big network overhead for these, especially since I'm aiming for each database to be entirely RAM resident. >If you really wanted to do this, do you need 2pc?=A0 Once data has been uploaded to the database for region A, then asynchronously copy the data = to B, C, D and E later, using a queue.=A0=20 I've always assumed that my data needed to be consistent. I guess there = are some circumstances where it isn't really a problem, but each would need = to be carefully evaluated. The easy answer is to say 'yes, it must be consistent'. >If you try to commit to all at once, then if one fails, then none has = the data. Yes, I'd prefer things to be that way in any event. Regards, Andy From pgsql-performance-owner@postgresql.org Wed Dec 21 10:48:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0E7299DCABD for ; Wed, 21 Dec 2005 10:48:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31427-06 for ; Wed, 21 Dec 2005 10:48:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id 600E49DC9B3 for ; Wed, 21 Dec 2005 10:48:31 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Ep5GR-0005TZ-00; Wed, 21 Dec 2005 09:48:24 -0500 To: Richard Huxton Cc: Josep Maria Pinyol Fontseca , pgsql-performance@postgresql.org Subject: Re: Windows performance again References: <43A91ABE.9070000@endepro.com> <43A92758.6060709@archonet.com> In-Reply-To: <43A92758.6060709@archonet.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 21 Dec 2005 09:48:23 -0500 Message-ID: <874q52a4lk.fsf@stark.xeocode.com> Lines: 12 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200512/535 X-Sequence-Number: 16356 Richard Huxton writes: > Josep Maria Pinyol Fontseca wrote: > > Windows XP client box with psql version 8.1.1 versus Windows XP server: > > select * from
; -> 60 seconds aprox. to obtain a results!!!!!!!!!!!! > > Network utilization: 3% The 60 seconds sounds suspiciously like a DNS problem. -- greg From pgsql-performance-owner@postgresql.org Wed Dec 21 12:10:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 877CA9DC809 for ; Wed, 21 Dec 2005 12:10:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67063-05 for ; Wed, 21 Dec 2005 12:10:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id DDC7F9DC807 for ; Wed, 21 Dec 2005 12:10:40 -0400 (AST) 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 jBLGAXBX013701; Wed, 21 Dec 2005 11:10:33 -0500 (EST) To: Richard Huxton cc: Josep Maria Pinyol Fontseca , pgsql-performance@postgresql.org Subject: Re: Windows performance again In-reply-to: <43A92758.6060709@archonet.com> References: <43A91ABE.9070000@endepro.com> <43A92758.6060709@archonet.com> Comments: In-reply-to Richard Huxton message dated "Wed, 21 Dec 2005 09:58:48 +0000" Date: Wed, 21 Dec 2005 11:10:33 -0500 Message-ID: <13700.1135181433@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/536 X-Sequence-Number: 16357 Richard Huxton writes: > Josep Maria Pinyol Fontseca wrote: >> Network utilization: 0% > It's *got* to be the network configuration on the client machine. We've seen gripes of this sort before --- check the list archives for possible fixes. I seem to recall something about a "QoS patch", as well as suggestions to get rid of third-party packages that might be interfering with the TCP stack. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 21 14:02:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A30089DC84A for ; Wed, 21 Dec 2005 14:02:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89244-01 for ; Wed, 21 Dec 2005 14:02:52 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by postgresql.org (Postfix) with ESMTP id E449E9DC828 for ; Wed, 21 Dec 2005 14:02:50 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so189883wra for ; Wed, 21 Dec 2005 10:02:50 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=eiaLcXDfyD2RQ3FPkSvuh14fh9RYDKm3kYd6wpMJ4CSOOglL8Et/3uWaUFcNtR92IBXoWDKNKyhBTRD0MlsvFXKqw28fgMWzTr2by30lE+VN+rKe6KSpzKGNe51kY9jwWRozydsjbpG9CKb9sIbJ+PuSdBQylD4iwDBTQPQKqZs= Received: by 10.65.153.4 with SMTP id f4mr625909qbo; Wed, 21 Dec 2005 10:02:50 -0800 (PST) Received: from ?192.168.3.4? ( [81.182.248.121]) by mx.gmail.com with ESMTP id e17sm361814qba.2005.12.21.10.02.48; Wed, 21 Dec 2005 10:02:49 -0800 (PST) Message-ID: <43A998D4.4070300@gmail.com> Date: Wed, 21 Dec 2005 19:03:00 +0100 From: =?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Subject: Wrong index used when ORDER BY LIMIT 1 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/537 X-Sequence-Number: 16358 Dear Gurus, Version: 7.4.6 I use a query on a heavily indexed table which picks a wrong index unexpectedly. Since this query is used in response to certain user interactions thousands of times in succession (with different constants), 500ms is not affordable for us. I can easily work around this, but I'd like to understand the root of the problem. Basically, there are two relevant indexes: - muvelet_vonalkod_muvelet btree (muvelet, ..., idopont) - muvelet_vonalkod_pk3 btree (idopont, ...) Query is: SELECT idopont WHERE muvelet = x ORDER BY idopont LIMIT 1. I expected the planner to choose the index on muvelet, then sort by idopont. Instead, it took the other index. I think there is heavy correlation since muvelet references to a sequenced pkey and idopont is a timestamp (both increase with passing time). May that be a cause? See full table description and explain analyze results at end of the email. TIA, -- G. ---- table : Table "public.muvelet_vonalkod" Column | Type | Modifiers ------------+--------------------------+----------------------------------- az | integer | not null def. nextval('...') olvaso_nev | character varying | not null vonalkod | character varying | not null mozgasnem | integer | not null idopont | timestamp with time zone | not null muvelet | integer | minoseg | integer | not null cikk | integer | muszakhely | integer | muszakkod | integer | muszaknap | date | repre | boolean | not null default false hiba | integer | not null default 0 Indexes: "muvelet_vonalkod_pkey" primary key, btree (az) "muvelet_vonalkod_pk2" unique, btree (olvaso_nev, idopont) "muvelet_vonalkod_muvelet" btree (muvelet, mozgasnem, vonalkod, olvaso_nev, idopont) "muvelet_vonalkod_pk3" btree (idopont, olvaso_nev) "muvelet_vonalkod_vonalkod" btree (vonalkod, mozgasnem, olvaso_nev, idopont) Foreign-key constraints: "$1" FOREIGN KEY (mozgasnem) REFERENCES mozgasnem(az) "$2" FOREIGN KEY (muvelet) REFERENCES muvelet(az) "$3" FOREIGN KEY (minoseg) REFERENCES minoseg(az) "$4" FOREIGN KEY (cikk) REFERENCES cikk(az) "$5" FOREIGN KEY (muszakhely) REFERENCES hely(az) "$6" FOREIGN KEY (muszakkod) REFERENCES muszakkod(az) "muvelet_vonalkod_muszak_fk" FOREIGN KEY (muszakhely, muszaknap, muszakkod) REFERENCES muszak(hely, nap, muszakkod) Triggers: muvelet_vonalkod_aiud AFTER INSERT OR DELETE OR UPDATE ON muvelet_vonalkod FOR EACH ROW EXECUTE PROCEDURE muvelet_vonalkod_aiud() muvelet_vonalkod_biu BEFORE INSERT OR UPDATE ON muvelet_vonalkod FOR EACH ROW EXECUTE PROCEDURE muvelet_vonalkod_biu() muvelet_vonalkod_noty AFTER INSERT OR DELETE OR UPDATE ON muvelet_vonalkod FOR EACH ROW EXECUTE PROCEDURE muvelet_vonalkod_noty() -- original query, limit # explain analyze select idopont from muvelet_vonalkod where muvelet=6859 order by idopont limit 1; QUERY PLAN ---------------------------------------------------------------------------- Limit (cost=0.00..25.71 rows=1 width=8) (actual time=579.528..579.529 rows=1 loops=1) -> Index Scan using muvelet_vonalkod_pk3 on muvelet_vonalkod (cost=0.00..8304.42 rows=323 width=8) (actual time=579.522..579.522 rows=1 loops=1) Filter: (muvelet = 6859) Total runtime: 579.606 ms (4 rows) -- however, if I omit the limit clause: # explain analyze select idopont from muvelet_vonalkod where muvelet=6859 order by idopont; QUERY PLAN --------------------------------------------------------------------------- Sort (cost=405.41..405.73 rows=323 width=8) (actual time=1.295..1.395 rows=360 loops=1) Sort Key: idopont -> Index Scan using muvelet_vonalkod_muvelet on muvelet_vonalkod (cost=0.00..400.03 rows=323 width=8) (actual time=0.049..0.855 rows=360 loops=1) Index Cond: (muvelet = 6859) Total runtime: 1.566 ms (5 rows) -- workaround 1: the planner is hard to trick... # explain analyze select idopont from (select idopont from muvelet_vonalkod where muvelet=6859) foo order by idopont limit 1; QUERY PLAN --------------------------------------------------------------------------- Limit (cost=0.00..25.71 rows=1 width=8) (actual time=584.403..584.404 rows=1 loops=1) -> Index Scan using muvelet_vonalkod_pk3 on muvelet_vonalkod (cost=0.00..8304.42 rows=323 width=8) (actual time=584.397..584.397 rows=1 loops=1) Filter: (muvelet = 6859) Total runtime: 584.482 ms (4 rows) -- workaround 2: quite ugly but seems to work (at least for this -- one test case): # explain analyze select idopont from (select idopont from muvelet_vonalkod where muvelet=6859 order by idopont) foo order by idopont limit 1; QUERY PLAN --------------------------------------------------------------------------- Limit (cost=405.41..405.42 rows=1 width=8) (actual time=1.754..1.755 rows=1 loops=1) -> Subquery Scan foo (cost=405.41..407.35 rows=323 width=8) (actual time=1.751..1.751 rows=1 loops=1) -> Sort (cost=405.41..405.73 rows=323 width=8) (actual time=1.746..1.746 rows=1 loops=1) Sort Key: idopont -> Index Scan using muvelet_vonalkod_muvelet on muvelet_vonalkod (cost=0.00..400.03 rows=323 width=8) (actual time=0.377..1.359 rows=360 loops=1) Index Cond: (muvelet = 6859) Total runtime: 1.853 ms (7 rows) From pgsql-performance-owner@postgresql.org Wed Dec 21 14:16:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BE1569DC9A2 for ; Wed, 21 Dec 2005 14:16:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85041-09 for ; Wed, 21 Dec 2005 14:16:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35508.mail.mud.yahoo.com (web35508.mail.mud.yahoo.com [66.163.179.132]) by postgresql.org (Postfix) with SMTP id B4D459DC84A for ; Wed, 21 Dec 2005 14:16:01 -0400 (AST) Received: (qmail 45241 invoked by uid 60001); 21 Dec 2005 18:16:01 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=yOM+EgGq/TAypYsMmiLNNd5kg2Sj9Dq0rTMBr4GB6Ca5yEg9JqXuPP4xjbozikl8ERY709cHQ2wmvY+Nm3uAruCbggi+jUHMX+FojOVFI7ylAksoUJ764xxXg2HevFlqizBoIvQHjgsg8GE7OxPa9GJTeosGB1SZIlay5H7ulpY= ; Message-ID: <20051221181601.45239.qmail@web35508.mail.mud.yahoo.com> Received: from [201.3.198.4] by web35508.mail.mud.yahoo.com via HTTP; Wed, 21 Dec 2005 18:16:01 GMT Date: Wed, 21 Dec 2005 18:16:01 +0000 (GMT) From: Carlos Benkendorf Subject: ORDER BY costs To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-150303133-1135188961=:45028" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.42 required=5 tests=[AWL=-0.060, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.42 X-Spam-Level: X-Archive-Number: 200512/538 X-Sequence-Number: 16359 --0-150303133-1135188961=:45028 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, We�ve a SELECT that even without ORDER BY is returning the rows in the order that we liked but when we add the ORDER BY clause the runtime and costs are much bigger. We have to use ORDER BY otherwise in some future postgresql version probably it will not return in the correct order anymore. But if we use ORDER BY it�s too much expensive... is there a way to have the same costs and runtime but with the ORDER BY clause? Why is not the planner using the access plan builded for the "without order by" select even if we use the order by clause? The results are both the same... Postgresql version: 8.0.3 Without order by: explain analyze SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO = 00 and PARCELA >= 00 ) or (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO > 00 ) or (ANOCALC = 2005 and CADASTRO > 19 ) or (ANOCALC > 2005 ); Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..122255.35 rows=146602 width=897) (actual time=9.303..1609.987 rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: 1712.456 ms (3 rows) With order by: explain analyze SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO = 00 and PARCELA >= 00 ) or (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO > 00 ) or (ANOCALC = 2005 and CADASTRO > 19 ) or (ANOCALC > 2005 ) order by ANOCALC asc, CADASTRO asc, CODVENCTO asc, PARCELA asc; Sort (cost=201296.59..201663.10 rows=146602 width=897) (actual time=9752.555..10342.363 rows=167710 loops=1) Sort Key: anocalc, cadastro, codvencto, parcela -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..122255.35 rows=146602 width=897) (actual time=0.402..1425.085 rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: 10568.290 ms (5 rows) Table definition: Table "iparq.arript" Column | Type | Modifiers -------------------+-----------------------+----------- anocalc | numeric(4,0) | not null cadastro | numeric(8,0) | not null codvencto | numeric(2,0) | not null parcela | numeric(2,0) | not null inscimob | character varying(18) | not null codvencto2 | numeric(2,0) | not null parcela2 | numeric(2,0) | not null codpropr | numeric(10,0) | not null dtaven | numeric(8,0) | not null anocalc2 | numeric(4,0) | ... ... Indexes: "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela) "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela) "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2) "iarchave03" btree (codpropr, dtaven) "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2) Best regards and thank you very much in advance, Carlos Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-150303133-1135188961=:45028 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi,
 
We�ve a SELECT that even without ORDER BY is returning the rows in the order that we liked but when we add the ORDER BY clause the runtime and costs are much bigger.
 
We have to use ORDER BY otherwise in some future postgresql version probably it will not return in the correct order anymore.
 
But if we use ORDER BY it�s too much expensive... is there a way to have the same costs and runtime but with the ORDER BY clause?
 
Why is not the planner using the access plan builded for the "without order by" select  even if we use the order by clause? The results are both the same...
 
Postgresql version: 8.0.3
 
Without order by:
explain analyze
SELECT * FROM iparq.ARRIPT
where
(ANOCALC =  2005
and CADASTRO =  19
and CODVENCTO =  00
a nd PARCELA >=  00 )
or
(ANOCALC =  2005
and CADASTRO =  19
and CODVENCTO >  00 )
or
(ANOCALC =  2005
and CADASTRO >  19 )
or
(ANOCALC >  2005 );
 Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..122255.35 rows=146602 width=897) (actual time=9.303..1609.987 rows=167710 loops=1)
   Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
 Total runtime: 1712.456 ms
(3 rows)
 
 
With order by:
explain analyze
SELECT * FROM iparq.ARRIPT
where
(ANOCALC =  2005
and CADASTRO =  19
and COD VENCTO =  00
and PARCELA >=  00 )
or
(ANOCALC =  2005
and CADASTRO =  19
and CODVENCTO >  00 )
or
(ANOCALC =  2005
and CADASTRO >  19 )
or
(ANOCALC >  2005 )
order by ANOCALC asc, CADASTRO asc, CODVENCTO asc, PARCELA asc;
 Sort  (cost=201296.59..201663.10 rows=146602 width=897) (actual time=9752.555..10342.363 rows=167710 loops=1)
   Sort Key: anocalc, cadastro, codvencto, parcela
   ->  Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..122255.35 rows=146602 width=897) (actual time=0.402..1425.085 rows=167710 loops=1)
         Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
 Total runtime: 10568.290 ms
(5 rows)

Table definition:
                 Table "iparq.arript"
      Column       |         Type          | Modifiers
-------------------+-----------------------+-----------
 anocalc           | numeric(4,0)          | not null
 cadastro          | numeric(8,0)          | not null
 codvencto         | numeric(2,0)          | not null
 parcela           | numeric(2,0)          | not null
 inscimob          | character varying(18) | not null
 codvencto2        | numeric(2,0)          | not null
 parcela2          | numeric(2,0)          | not null
 codpropr          | numeric(10,0)         | not null
 dtaven            | numeric(8,0)          | not null
 anocalc2          | numeric(4,0)          |
...
...
Indexes:
    "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela)
    "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela)
    "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2)
    "iarchave03" btree (codpropr, dtaven)
    "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2)
 
Best regards and thank you very much in advance,
 
Carlos Benkendorf


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-150303133-1135188961=:45028-- From pgsql-performance-owner@postgresql.org Wed Dec 21 14:40:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0AF829DC84B for ; Wed, 21 Dec 2005 14:40:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94877-02 for ; Wed, 21 Dec 2005 14:40:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id D79569DC828 for ; Wed, 21 Dec 2005 14:40:13 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Windows performance again Date: Wed, 21 Dec 2005 13:40:09 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DDBA4@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Windows performance again Thread-Index: AcYGSSrNZldUs6qCRKOah9XkbFeJaQABD0Jg From: "Merlin Moncure" To: "Tom Lane" Cc: , "Richard Huxton" , "Josep Maria Pinyol Fontseca" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200512/539 X-Sequence-Number: 16360 > > It's *got* to be the network configuration on the client machine. >=20 > We've seen gripes of this sort before --- check the list archives for > possible fixes. I seem to recall something about a "QoS patch", as > well as suggestions to get rid of third-party packages that might be > interfering with the TCP stack. I personally checked out the last report from a poster who got the issue on win2k but not on winxp. I ran his exact dump into my 2k server with no problems. This is definitely some type of local issue. Josep: does your table have any large ( > 1k ) fields in it? Merlin From pgsql-performance-owner@postgresql.org Wed Dec 21 14:51:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 009339DCC16 for ; Wed, 21 Dec 2005 14:51:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95235-07 for ; Wed, 21 Dec 2005 14:51:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id B9EF59DCC4D for ; Wed, 21 Dec 2005 14:51:06 -0400 (AST) 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 jBLIp29k097113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Dec 2005 11:51:05 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBLIp2rh056644; Wed, 21 Dec 2005 11:51:02 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBLIp2wu056643; Wed, 21 Dec 2005 11:51:02 -0700 (MST) (envelope-from mfuhr) Date: Wed, 21 Dec 2005 11:51:02 -0700 From: Michael Fuhr To: Sz?cs =?iso-8859-1?Q?G=E1bor?= Cc: "pgsql-performance@postgresql.org" Subject: Re: Wrong index used when ORDER BY LIMIT 1 Message-ID: <20051221185101.GA56524@winnie.fuhr.org> References: <43A998D4.4070300@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43A998D4.4070300@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.031 required=5 tests=[AWL=0.031] X-Spam-Score: 0.031 X-Spam-Level: X-Archive-Number: 200512/540 X-Sequence-Number: 16361 On Wed, Dec 21, 2005 at 07:03:00PM +0100, Sz?cs Gbor wrote: > Version: 7.4.6 [...] > Query is: > SELECT idopont WHERE muvelet = x ORDER BY idopont LIMIT 1. > > I expected the planner to choose the index on muvelet, then sort by idopont. > Instead, it took the other index. I think the planner is guessing that since you're ordering on idopont, scanning the idopont index will find the first matching row faster than using the muvelet index would. In many cases that's a good bet, but in this case the guess is wrong and you end up with a suboptimal plan. I just ran some tests with 8.1.1 and it chose the better plan for a query similar to what you're doing. One of the developers could probably explain why; maybe it's because of the changes that allow better use of multicolumn indexes. Try 8.1.1 if you can and see if you get better results. > -- workaround 2: quite ugly but seems to work (at least for this > -- one test case): > # explain analyze > select idopont from > (select idopont from muvelet_vonalkod > where muvelet=6859 order by idopont) foo > order by idopont limit 1; Another workaround is to use OFFSET 0 in the subquery. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Wed Dec 21 15:34:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 436659DCBDF for ; Wed, 21 Dec 2005 15:34:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04276-05 for ; Wed, 21 Dec 2005 15:34:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 4BBD99DCBF5 for ; Wed, 21 Dec 2005 15:34:21 -0400 (AST) 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 jBLJYJhR015422; Wed, 21 Dec 2005 14:34:20 -0500 (EST) To: =?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= cc: "pgsql-performance@postgresql.org" Subject: Re: Wrong index used when ORDER BY LIMIT 1 In-reply-to: <43A998D4.4070300@gmail.com> References: <43A998D4.4070300@gmail.com> Comments: In-reply-to =?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= message dated "Wed, 21 Dec 2005 19:03:00 +0100" Date: Wed, 21 Dec 2005 14:34:19 -0500 Message-ID: <15421.1135193659@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.029 required=5 tests=[AWL=0.029] X-Spam-Score: 0.029 X-Spam-Level: X-Archive-Number: 200512/541 X-Sequence-Number: 16362 =?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= writes: > Query is: > SELECT idopont WHERE muvelet = x ORDER BY idopont LIMIT 1. Much the best solution for this would be to have an index on (muvelet, idopont) --- perhaps you can reorder the columns of "muvelet_vonalkod_muvelet" instead of making a whole new index --- and then say SELECT idopont WHERE muvelet = x ORDER BY muvelet, idopont LIMIT 1 PG 8.1 can apply such an index to your original query, but older versions will need the help of the modified ORDER BY to recognize that the index is usable. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 21 15:39:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0621E9DC84B for ; Wed, 21 Dec 2005 15:39:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06265-06 for ; Wed, 21 Dec 2005 15:39:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A7B0F9DC84A for ; Wed, 21 Dec 2005 15:39:34 -0400 (AST) 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 jBLJdZ8M015456; Wed, 21 Dec 2005 14:39:35 -0500 (EST) To: Carlos Benkendorf cc: pgsql-performance@postgresql.org Subject: Re: ORDER BY costs In-reply-to: <20051221181601.45239.qmail@web35508.mail.mud.yahoo.com> References: <20051221181601.45239.qmail@web35508.mail.mud.yahoo.com> Comments: In-reply-to Carlos Benkendorf message dated "Wed, 21 Dec 2005 18:16:01 +0000" Date: Wed, 21 Dec 2005 14:39:35 -0500 Message-ID: <15455.1135193975@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.029 required=5 tests=[AWL=0.029] X-Spam-Score: 0.029 X-Spam-Level: X-Archive-Number: 200512/542 X-Sequence-Number: 16363 Carlos Benkendorf writes: > Table "iparq.arript" > Column | Type | Modifiers > -------------------+-----------------------+----------- > anocalc | numeric(4,0) | not null > cadastro | numeric(8,0) | not null > codvencto | numeric(2,0) | not null > parcela | numeric(2,0) | not null > inscimob | character varying(18) | not null > codvencto2 | numeric(2,0) | not null > parcela2 | numeric(2,0) | not null > codpropr | numeric(10,0) | not null > dtaven | numeric(8,0) | not null > anocalc2 | numeric(4,0) | I suspect you'd find a significant performance improvement from changing the NUMERIC columns to int or bigint as needed. Numeric comparisons are pretty slow. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Dec 21 16:43:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DA7C59DC85D for ; Wed, 21 Dec 2005 16:43:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15449-05 for ; Wed, 21 Dec 2005 16:43:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 5F2909DC84A for ; Wed, 21 Dec 2005 16:43:46 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Speed of different procedural language Date: Wed, 21 Dec 2005 15:43:43 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DDBA8@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Speed of different procedural language Thread-Index: AcYGHrZV9eFmrHg+QvaGjDI/DCIdOgATrqVg From: "Merlin Moncure" To: "Steinar H. Gunderson" Cc: , "Trewern, Ben" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200512/543 X-Sequence-Number: 16364 > On Sun, Dec 18, 2005 at 01:10:21AM -0000, Ben Trewern wrote: > > I know I should be writing these in C but that's a bit beyond me. I was > > going to try PL/Python or PL/Perl or even PL/Ruby. Has anyone any idea > > which language is fastest, or is the data access going to swamp the > overhead > > of small functions? >=20 > I'm not sure if it's what you ask for, but there _is_ a clear difference > between the procedural languages -- I've had a 10x speed increase from > rewriting PL/PgSQL stuff into PL/Perl, for instance. I'm not sure which > ones > would be faster, though -- I believe Ruby is slower than Perl or Python > generally, but I don't know how it all works out in a PL/* setting. So far, I use plpgsql for everything...queries being first class and all...I don't have any performance problems with it. I have cut the occasional C routine, but for flexibility not for speed. PL/Perl routines cannot directly execute each other, meaning you can't pass high level objects between them like refcursors. YMMV Since most database apps are bound by the server one way or another I would imagine you should be choosing a language on reasons other than performance.=20 Maybe Ben you could provide an example of what you are trying to do that is not fast enough? Merlin=20 From pgsql-performance-owner@postgresql.org Wed Dec 21 17:24:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D0E169DC84B for ; Wed, 21 Dec 2005 17:24:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20239-09 for ; Wed, 21 Dec 2005 17:24:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 6D89C9DC84A for ; Wed, 21 Dec 2005 17:24:44 -0400 (AST) 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 jBLLOhiE097231 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 21 Dec 2005 14:24:45 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBLLOgB4059943 for ; Wed, 21 Dec 2005 14:24:42 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBLLOg7p059942 for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 14:24:42 -0700 (MST) (envelope-from mfuhr) Date: Wed, 21 Dec 2005 14:24:42 -0700 From: Michael Fuhr To: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language Message-ID: <20051221212442.GA59736@winnie.fuhr.org> References: <20051221110647.GA17360@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051221110647.GA17360@uio.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200512/544 X-Sequence-Number: 16365 On Wed, Dec 21, 2005 at 12:06:47PM +0100, Steinar H. Gunderson wrote: > On Sun, Dec 18, 2005 at 01:10:21AM -0000, Ben Trewern wrote: > > I know I should be writing these in C but that's a bit beyond me. I was > > going to try PL/Python or PL/Perl or even PL/Ruby. Has anyone any idea > > which language is fastest, or is the data access going to swamp the overhead > > of small functions? > > I'm not sure if it's what you ask for, but there _is_ a clear difference > between the procedural languages -- I've had a 10x speed increase from > rewriting PL/PgSQL stuff into PL/Perl, for instance. The difference is clear only in specific cases; just because you saw a 10x increase in some cases doesn't mean you can expect that kind of increase, or indeed any increase, in others. I've seen PL/pgSQL beat all other PL/* challengers handily many times, especially when the function does a lot of querying and looping through large result sets. I tend to use PL/pgSQL except in cases where PL/pgSQL can't do what I want or the job would be much easier in another language (e.g., string manipulation, for which I'd use PL/Perl or PL/Ruby). Even then I might use the other language only to write small functions that a PL/pgSQL function could call. As Merlin suggested, maybe Ben could tell us what he wants to do that he thinks should be written in C or a language other than PL/pgSQL. Without knowing what problem is to be solved it's near impossible to recommend an appropriate tool. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Wed Dec 21 17:38:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EA3979DCC17 for ; Wed, 21 Dec 2005 17:38:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22928-09 for ; Wed, 21 Dec 2005 17:38:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id D2BBF9DCC09 for ; Wed, 21 Dec 2005 17:38:08 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EpBez-0007f6-Rf for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 22:38:10 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EpBf0-00075y-00 for ; Wed, 21 Dec 2005 22:38:10 +0100 Date: Wed, 21 Dec 2005 22:38:10 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language Message-ID: <20051221213810.GA27113@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20051221110647.GA17360@uio.no> <20051221212442.GA59736@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20051221212442.GA59736@winnie.fuhr.org> X-Operating-System: Linux 2.6.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200512/545 X-Sequence-Number: 16366 On Wed, Dec 21, 2005 at 02:24:42PM -0700, Michael Fuhr wrote: > The difference is clear only in specific cases; just because you > saw a 10x increase in some cases doesn't mean you can expect that > kind of increase, or indeed any increase, in others. I've seen > PL/pgSQL beat all other PL/* challengers handily many times, > especially when the function does a lot of querying and looping > through large result sets. That's funny, my biggest problems with PL/PgSQL have been (among others) exactly with large result sets... Anyhow, the general idea is: It _does_ matter which one you use, so you'd better test if it matters to you :-) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Dec 21 18:10:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1B52B9DC84B for ; Wed, 21 Dec 2005 18:10:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31216-02 for ; Wed, 21 Dec 2005 18:10:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 737119DC84A for ; Wed, 21 Dec 2005 18:10:30 -0400 (AST) 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 jBLMAT2V097274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 21 Dec 2005 15:10:32 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBLMATk7060302 for ; Wed, 21 Dec 2005 15:10:29 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBLMAShI060301 for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 15:10:28 -0700 (MST) (envelope-from mfuhr) Date: Wed, 21 Dec 2005 15:10:28 -0700 From: Michael Fuhr To: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language Message-ID: <20051221221028.GA60176@winnie.fuhr.org> References: <20051221110647.GA17360@uio.no> <20051221212442.GA59736@winnie.fuhr.org> <20051221213810.GA27113@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051221213810.GA27113@uio.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200512/546 X-Sequence-Number: 16367 On Wed, Dec 21, 2005 at 10:38:10PM +0100, Steinar H. Gunderson wrote: > On Wed, Dec 21, 2005 at 02:24:42PM -0700, Michael Fuhr wrote: > > The difference is clear only in specific cases; just because you > > saw a 10x increase in some cases doesn't mean you can expect that > > kind of increase, or indeed any increase, in others. I've seen > > PL/pgSQL beat all other PL/* challengers handily many times, > > especially when the function does a lot of querying and looping > > through large result sets. > > That's funny, my biggest problems with PL/PgSQL have been (among others) > exactly with large result sets... Out of curiosity, do you have a simple test case? I'd be interested in seeing what you're doing in PL/pgSQL that's contradicting what I'm seeing. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Wed Dec 21 19:57:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 705559DC84A for ; Wed, 21 Dec 2005 19:57:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46689-06 for ; Wed, 21 Dec 2005 19:58:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 92B259DC85D for ; Wed, 21 Dec 2005 19:57:56 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B70163093C; Thu, 22 Dec 2005 00:57:59 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Wed, 21 Dec 2005 15:57:56 -0800 Organization: Hub.Org Networking Services Lines: 9 Message-ID: References: <43A84D03.7090002@ritek.hu> <200512201950.47671.caseroj@comcast.net> 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.7 (X11/20050923) X-Accept-Language: en-us, en In-Reply-To: <200512201950.47671.caseroj@comcast.net> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/547 X-Sequence-Number: 16368 Juan Casero wrote: > Can you elaborate on the reasons the opteron is better than the Xeon when it > comes to disk io? I have a PostgreSQL 7.4.8 box running a DSS. One of our Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that block and then the CPU must do extra work in copying the memory to > 4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in the background. From pgsql-performance-owner@postgresql.org Wed Dec 21 20:35:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 69E2A9DCC5B for ; Wed, 21 Dec 2005 20:35:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55932-02 for ; Wed, 21 Dec 2005 20:35:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35513.mail.mud.yahoo.com (web35513.mail.mud.yahoo.com [66.163.179.137]) by postgresql.org (Postfix) with SMTP id 06D569DCC57 for ; Wed, 21 Dec 2005 20:34:57 -0400 (AST) Received: (qmail 98885 invoked by uid 60001); 22 Dec 2005 00:35:01 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=D53F19SI2w/T9xcCS2fh0lFcFTHZJCjD5VagiSjKn0nqoMLq5o2wvxC5Kv6Ki3fOQfF0nqvfLMJkNGzzGJMoBISiVuqh7eD1D2zzhvQjpg+5bWt+Sxw9TyVCbE+JnCb6RPRdf2E2+sxBLJpq8gjDWtcmiXkgjMMAUuuTZyDlesc= ; Message-ID: <20051222003501.98879.qmail@web35513.mail.mud.yahoo.com> Received: from [200.101.229.54] by web35513.mail.mud.yahoo.com via HTTP; Thu, 22 Dec 2005 00:35:00 GMT Date: Thu, 22 Dec 2005 00:35:00 +0000 (GMT) From: Carlos Benkendorf Subject: Re: ORDER BY costs To: Tom Lane , pgsql-performance@postgresql.org In-Reply-To: <15455.1135193975@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1250591123-1135211700=:98678" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.48 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.48 X-Spam-Level: X-Archive-Number: 200512/548 X-Sequence-Number: 16369 --0-1250591123-1135211700=:98678 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I restored the table in another database and repeated the analyze again with original column definitions (numeric): With order by: Sort (cost=212634.30..213032.73 rows=159374 width=897) (actual time=9286.817..9865.030 rows=167710 loops=1) Sort Key: anocalc, cadastro, codvencto, parcela -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..126604.64 rows=159374 width=897) (actual time=0.152..1062.664 rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: 10086.884 ms (5 rows) Without order by: Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..126604.64 rows=159374 width=897) (actual time=0.154..809.566 rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: 894.218 ms (3 rows) Then I recreated the table and changed the primary key column type definitions to smallint, integer and bigint. CREATE TABLE arript ( anocalc smallint NOT NULL, cadastro integer NOT NULL, codvencto smallint NOT NULL, parcela smallint NOT NULL, inscimob character varying(18) NOT NULL, codvencto2 smallint NOT NULL, parcela2 smallint NOT NULL, codpropr bigint NOT NULL, dtaven integer NOT NULL, anocalc2 smallint, dtabase integer, vvt numeric(14,2), vvp numeric(14,2), ... ... Now the new analyze: With order by: Sort (cost=180430.98..180775.10 rows=137649 width=826) (actual time=4461.524..5000.707 rows=167710 loops=1) Sort Key: anocalc, cadastro, codvencto, parcela -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..111126.93 rows=137649 width=826) (actual time=0.142..763.255 rows=167710 loops=1) Index Cond: (((anocalc = 2005) AND (cadastro = 19) AND (codvencto = 0) AND (parcela >= 0)) OR ((anocalc = 2005) AND (cadastro = 19) AND (codvencto > 0)) OR ((anocalc = 2005) AND (cadastro > 19)) OR (anocalc > 2005)) Total runtime: 5222.729 ms (5 rows) Without order by: Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..111126.93 rows=137649 width=826) (actual time=0.135..505.250 rows=167710 loops=1) Index Cond: (((anocalc = 2005) AND (cadastro = 19) AND (codvencto = 0) AND (parcela >= 0)) OR ((anocalc = 2005) AND (cadastro = 19) AND (codvencto > 0)) OR ((anocalc = 2005) AND (cadastro > 19)) OR (anocalc > 2005)) Total runtime: 589.528 ms (3 rows) Total runtime summary: Primary key columns defined with integer/smallint/bigint and select with order by: 5222.729 ms Primary key columns defined with integer/smallint/bigint and select without order by: 589.528 ms Primary key columns defined with numeric and select with order by: 10086.884 ms Primary key columns defined with numeric and select without order by: 894.218 ms Using order by and integer/smallint/bigint (5222.729) is almost half total runtime of select over numeric columns (10086.884) but is still 6 x more from the numbers of the original select (without order by and number columns=894.218). Is there something more that could be done? Planner cost constants? Thanks very much in advance! Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-1250591123-1135211700=:98678 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
I restored the table in another database and repeated the analyze again with original column definitions (numeric):
 
With order by:
Sort  (cost=212634.30..213032.73 rows=159374 width=897) (actual time=9286.817..9865.030 rows=167710 loops=1)
   Sort Key: anocalc, cadastro, codvencto, parcela
   ->  Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..126604.64 rows=159374 width=897) (actual time=0.152..1062.664 rows=167710 loops=1)
         Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
 Total runtime: 10086.884 ms
(5 rows)
 
Without order by:
 Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..126604.64 rows=159374 width=897) (actual time=0.154..809.566 rows=167710 loops=1)
   Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
 Total runtime: 894.218 ms
(3 rows)


Then I recreated the table and changed the primary key column type definitions to smallint, integer and bigint.
 
CREATE TABLE arript (
    anocalc smallint     NOT NULL,
    cadastro integer      NOT NULL,
    codvencto smallint     NOT NULL,
    parcela smallint     NOT NULL,
    inscimob character varying(18) NOT NULL,
    codvencto2 smallint     NOT NULL,
    parcela2 smallint     NOT NULL,
    codpropr bigint        NOT NULL,
    dtaven integer      NOT NULL,
    anocalc2 smallint,
    dtabase integer,
    vvt numeric(14,2),
    vvp numeric(14,2),
...
...
 
Now the new analyze:
 
With order by:
 Sort  (cost=180430.98..180775.10 rows=137649 width=826) (actual time=4461.524..5000.707 rows=167710 loops=1)
   Sort Key: anocalc, cadastro, codvencto, parcela
   ->&n bsp; Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..111126.93 rows=137649 width=826) (actual time=0.142..763.255 rows=167710 loops=1)
         Index Cond: (((anocalc = 2005) AND (cadastro = 19) AND (codvencto = 0) AND (parcela >= 0)) OR ((anocalc = 2005) AND (cadastro = 19) AND (codvencto > 0)) OR ((anocalc = 2005) AND (cadastro > 19)) OR (anocalc > 2005))
 Total runtime: 5222.729 ms
(5 rows)
 
 
Without order by:
 Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..111126.93 rows=137649 width=826) (actual time=0.135..505.250 rows=167710 loops=1)
   Index Cond: (((anocalc = 2005) AND (cadastro = 19) AND (codvencto = 0) AND (parcela >= 0)) OR ((anocalc = 2005) AND (cadastro = 19) AND (codvencto > 0)) OR ((anocalc = 2005) AND (cadastro > 19)) OR (anocalc > 2005))
 Total runtime: 589.528 ms
(3 rows)
Total runtime summary:
Primary key columns defined with integer/smallint/bigint and select with order by: 5222.729 ms
Primary key columns defined with integer/smallint/bigint and select without order by: 589.528 ms
Primary key columns defined with numeric and select with order by: 10086.884 ms
Primary key columns defined with numeric and select without order by: 894.218 ms
 
Using order by and integer/smallint/bigint (5222.729) is almost half total runtime of select over numeric columns (10086.884) but is still 6 x more from the numbers of the original select (without order by and number columns=894.218).
 
Is there something more that could be done? Planner cost constants?
 
Thanks very much in advance!< /DIV>
 
Benkendorf
 
 


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-1250591123-1135211700=:98678-- From pgsql-performance-owner@postgresql.org Wed Dec 21 21:08:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6FA369DC84A for ; Wed, 21 Dec 2005 21:08:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59083-05 for ; Wed, 21 Dec 2005 21:08:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id B0B649DCB82 for ; Wed, 21 Dec 2005 21:08:20 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EpEwR-0005gB-8f for pgsql-performance@postgresql.org; Thu, 22 Dec 2005 02:08:23 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EpEwR-0001dq-00 for ; Thu, 22 Dec 2005 02:08:23 +0100 Date: Thu, 22 Dec 2005 02:08:23 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language Message-ID: <20051222010823.GA6103@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20051221110647.GA17360@uio.no> <20051221212442.GA59736@winnie.fuhr.org> <20051221213810.GA27113@uio.no> <20051221221028.GA60176@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20051221221028.GA60176@winnie.fuhr.org> X-Operating-System: Linux 2.6.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200512/549 X-Sequence-Number: 16370 On Wed, Dec 21, 2005 at 03:10:28PM -0700, Michael Fuhr wrote: >> That's funny, my biggest problems with PL/PgSQL have been (among others) >> exactly with large result sets... > Out of curiosity, do you have a simple test case? I'd be interested > in seeing what you're doing in PL/pgSQL that's contradicting what > I'm seeing. I'm not sure if I have the code anymore (it was under 7.4 or 8.0), but it was largely scanning through ~2 million rows once, noting differences from the previous rows as it went. In that case, I didn't benchmark against any of the other PL/* languages, but it was pretty clear that even on a pretty speedy Opteron, it was CPU bound, which it really shouldn't have been. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Dec 21 21:20:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 591409DCC75 for ; Wed, 21 Dec 2005 21:20:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60707-09 for ; Wed, 21 Dec 2005 21:20:19 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.202]) by postgresql.org (Postfix) with ESMTP id 9BD1D9DC84A for ; Wed, 21 Dec 2005 21:20:13 -0400 (AST) Received: by nproxy.gmail.com with SMTP id y38so111277nfb for ; Wed, 21 Dec 2005 17:20:17 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Vxd1qMPKngFZk6AUNfH2LcltoNyoSskHNQpbMXHYUwVcOdnhxHPqKadzR6+5sYrgL2UWTeTNO8I+7/Nf/5Ue0P93L6lbUmnVJhxvCLgBS0cmrN2ZiaQtTSC0VbdauOQDPonzgUUfxDVq0mhEFRGFCIZIlAuGVSx3MeYKSVZk2k4= Received: by 10.48.12.14 with SMTP id 14mr63762nfl; Wed, 21 Dec 2005 17:20:16 -0800 (PST) Received: by 10.48.164.6 with HTTP; Wed, 21 Dec 2005 17:20:16 -0800 (PST) Message-ID: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> Date: Thu, 22 Dec 2005 01:20:16 +0000 From: Harry Jackson To: pgsql-performance@postgresql.org Subject: CPU and RAM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.083 required=5 tests=[AWL=0.083] X-Spam-Score: 0.083 X-Spam-Level: X-Archive-Number: 200512/550 X-Sequence-Number: 16371 SSBhbSBjdXJyZW50bHkgdXNpbmcgYSBkdWFsIE9wdGVyb24gKDI0OCkgc2luZ2xlIGNvcmUgc3lz dGVtIChSQU0KUEMzMjAwKSBhbmQgZm9yIGEgY2hhbmdlIEkgYW0gZmluZGluZyB0aGF0IHRoZSBi b3R0bGVuZWNrIGlzIG5vdCBkaXNrCkkvTyBidXQgQ1BVL1JBTSAobm90IHN1cmUgd2hpY2gpLiBU aGUgcmVhc29uIGZvciB0aGlzIGlzIHRoYXQgdGhlIG1vc3QKZnJlcXVlbnRseSBhY2Nlc3NlZCB0 YWJsZXMvaW5kZXhlcyBhcmUgYWxsIGhlbGQgaW4gUkFNIGFuZCB3aGVuCnF1ZXJ5aW5nIHRoZSBk YXRhYmFzZSB0aGVyZSBpcyBhbG1vc3Qgbm8gZGlzayBhY3Rpdml0eSB3aGljaCBpcyBncmVhdCwK bW9zdCBvZiB0aGUgdGltZS4gSG93ZXZlciwgdGhlIGRhdGFiYXNlIGlzIGdyb3dpbmcgYW5kIHRo aXMgZGF0YWJhc2UKaXMgc3VwcG9ydGluZyBhbiBPTFRQIHN5c3RlbSB3aGVyZSB0aGUgcmV0cmll dmFsIG9mIHRoZSBkYXRhIGlzIGFuCm9yZGVyIG9mIG1hZ25pdHVkZSBtb3JlIGltcG9ydGFudCB0 aGFuIHRoZSBpbnNlcnRpb24gYW5kIGdlbmVyYWwKdXBrZWVwIG9mIHRoZSBkYXRhLiBJdCBzdXBw b3J0cyBhIHNlYXJjaCBlbmdpbmVbMF0gYW5kIGNvbnRhaW5zIGEKcmV2ZXJzZSBpbmRleCwgbGV4 aWNvbiBhbmQgdGhlIGFjdHVhbCBkYXRhIHRhYmxlIChjdXJyZW50bHkganVzdCB1bmRlcgoyR2Ig Zm9yIHRoZSB0aHJlZSB0YWJsZXMgYW5kIGFzc29jaWF0ZWQgaW5kZXhlcykuCgpBdCB0aGUgbW9t ZW50IGV2ZXJ5dGhpbmcgaXMgd29ya2luZyBPSyBidXQgSSBhbSBub3RpY2luZyBhbiBhbG1vc3QK bGluZWFyIGluY3JlYXNlIGluIHRpbWUgdG8gcmV0cmlldmUgZGF0YSBmcm9tIHRoZSBkYXRhYmFz ZSBhcyB0aGUgZGF0YQpzZXQgaW5jcmVhc2VzIGluIHNpemUuIENsdXN0ZXJpbmcga25vY2tzIHRo ZSBhY2Nlc3MgdGltZXMgZG93biBieSAyNSUKYnV0IGl0IGFsc28ga25vY2tzIHVzZXJzIG9mZiB0 aGUgd2Vic2l0ZSBhbmQgY2FuIHRha2UgdXAgdG8gMzAgbWludXRlcwp3aGljaCBpcyBoYXJkbHkg YW4gaWRlYWwgc2NlbmFyaW8uIEkgaGF2ZSBhbHNvIGNvbnNpZGVyZWQgcGFydGl0aW9uaW5nCnRo ZSB0YWJsZXMgdXAgdXNpbmcgZXh0ZW5kaWJsZSBoYXNoaW5nIGFuZCB0cmllcyB0byBhbGxvY2F0 ZSB0aGUgdGVybXMKaW4gdGhlIGluZGV4IHRvIHRoZSBjb3JyZWN0IHRhYmxlIGJ1dCBhZnRlciBz b21lIHRlc3RpbmcgSSBub3RpY2VkIG5vCm5vdGljZWFibGUgZ2FpbiB1c2luZyB0aGlzIG1ldGhv ZCB3aGljaCBzdXJwcmlzZWQgbWUgYSBiaXQuCgpUaGUgYWN0dWFsIHNpemUgb2YgdGhlIGRhdGFi YXNlIGlzIG5vdCB0aGF0IGJpZyAoNEdiKSBidXQgSSBhbQpleHBlY3RpbmcgdGhpcyB0byBpbmNy ZWFzZSB0byBhdCBsZWFzdCAyMEdiIG92ZXIgdGhlIG5leHQgeWVhciBvciBzby4KVGhpcyBtZWFu cyB0aGF0IHNlYXJjaCB0aW1lcyBhcmUgZ29pbmcgdG8ganVtcCBkcmFtYXRpY2FsbHkgd2hpY2gg YWxzbwptZWFucyB0aGUgc2l0ZSBiZWNvbWVzIGNvbXBsZXRlbHkgdW51c2FibGUuIFRoaXMgYWxz byBtZWFucyB0aGF0CmFsdGhvdWdoIGRpc2sgYWNjZXNzIGlzIGN1cnJlbnRseSBsb3cgSSBhbSBl dmVudHVhbGx5IGdvaW5nIHRvIHJ1biBvdXQKb2YgUkFNIGFuZCByZXF1aXJlIGEgZGVjZW50IGRp c2sgc3Vic3lzdGVtLgoKRG8gcGVvcGxlIGhhdmUgYW55IHJlY29tbWVuZGF0aW9ucyBhcyB0byB3 aGF0IGhhcmR3YXJlIHdvdWxkIGFsbGV2aWF0ZQpteSBjdXJyZW50IENQVS9SQU0gcHJvYmxlbSBi dXQgd2l0aCBhIG1pbmQgdG8gdGhlIGZ1dHVyZSB3b3VsZCBzdGlsbApiZSBhYmxlIHRvIGNvcGUg d2l0aCBoZWF2eSBkaXNrIGFjY2Vzcy4gTXkgYnVkZ2V0IGlzIGFib3V0IMKjMjMwMC8kNDAwMAp3 aGljaCBpcyBub3QgYSBsb3Qgb2YgbW9uZXkgd2hlbiB0YWxraW5nIGRhdGFiYXNlcyBzbyBzdWdn ZXN0aW9ucyBvZiBhClN1biBGaXJlIFQyMDAwIG9yIHNpbWlsYXIgc3lzdGVtcyB3aWxsIGJlIHRy ZWF0ZWQgd2l0aCB0aGUgdXRtb3N0CmRpc2RhaW4gOykgdW5sZXNzIHlvdSBhcmUgYWJvdXQgdG8g Z2l2ZSBtZSBvbmUgdG8ga2VlcC4KCi0tCkhhcnJ5Cmh0dHA6Ly93d3cuaGphY2tzb24ub3JnCmh0 dHA6Ly93d3cudWtsdWcuY28udWsKCgpCZWZvcmUgYW55b25lIGFza3MgSSBoYXZlIGNvbnNpZGVy ZWQgdXNpbmcgdHNlYXJjaDIuCg== From pgsql-performance-owner@postgresql.org Wed Dec 21 22:03:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 504E49DC84E for ; Wed, 21 Dec 2005 22:03:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66265-05 for ; Wed, 21 Dec 2005 22:03:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tomts20-srv.bellnexxia.net (tomts20-srv.bellnexxia.net [209.226.175.74]) by postgresql.org (Postfix) with ESMTP id 8745F9DCBAF for ; Wed, 21 Dec 2005 22:03:17 -0400 (AST) Received: from [192.168.1.99] ([64.229.117.133]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20051222020321.ETQF8316.tomts20-srv.bellnexxia.net@[192.168.1.99]> for ; Wed, 21 Dec 2005 21:03:21 -0500 Message-ID: <43AA0966.6090401@alteeve.com> Date: Wed, 21 Dec 2005 21:03:18 -0500 From: Madison Kelly User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: MySQL is faster than PgSQL but a large margin in my program... any ideas why? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [0] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200512/551 X-Sequence-Number: 16372 Hi all, On a user's request, I recently added MySQL support to my backup program which had been written for PostgreSQL exclusively until now. What surprises me is that MySQL is about 20%(ish) faster than PostgreSQL. Now, I love PostgreSQL and I want to continue recommending it as the database engine of choice but it is hard to ignore a performance difference like that. My program is a perl backup app that scans the content of a given mounted partition, 'stat's each file and then stores that data in the database. To maintain certain data (the backup, restore and display values for each file) I first read in all the data from a given table (one table per partition) into a hash, drop and re-create the table, then start (in PostgreSQL) a bulk 'COPY..' call through the 'psql' shell app. In MySQL there is no 'COPY...' equivalent so instead I generate a large 'INSERT INTO file_info_X (col1, col2, ... coln) VALUES (...), (blah) ... (blah);'. This doesn't support automatic quoting, obviously, so I manually quote my values before adding the value to the INSERT statement. I suspect this might be part of the performance difference? I take the total time needed to update a partition (load old data into hash + scan all files and prepare COPY/INSERT + commit new data) and devide by the number of seconds needed to get a score I call a 'U.Rate). On average on my Pentium3 1GHz laptop I get U.Rate of ~4/500. On MySQL though I usually get a U.Rate of ~7/800. If the performace difference comes from the 'COPY...' command being slower because of the automatic quoting can I somehow tell PostgreSQL that the data is pre-quoted? Could the performance difference be something else? If it would help I can provide code samples. I haven't done so yet because it's a little convoluded. ^_^; Thanks as always! Madison Where the big performance concern is when -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU; The Linux Experience, Back Up Main Project Page: http://tle-bu.org Community Forum: http://forum.tle-bu.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Wed Dec 21 22:13:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8F9629DCC8C for ; Wed, 21 Dec 2005 22:13:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66211-07 for ; Wed, 21 Dec 2005 22:13:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 084C09DCC97 for ; Wed, 21 Dec 2005 22:13:47 -0400 (AST) 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 jBM2Dm47097458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 21 Dec 2005 19:13:51 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBM2Dl29061848 for ; Wed, 21 Dec 2005 19:13:48 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBM2DlV2061847 for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 19:13:47 -0700 (MST) (envelope-from mfuhr) Date: Wed, 21 Dec 2005 19:13:46 -0700 From: Michael Fuhr To: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language Message-ID: <20051222021346.GA61585@winnie.fuhr.org> References: <20051221110647.GA17360@uio.no> <20051221212442.GA59736@winnie.fuhr.org> <20051221213810.GA27113@uio.no> <20051221221028.GA60176@winnie.fuhr.org> <20051222010823.GA6103@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051222010823.GA6103@uio.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.036 required=5 tests=[AWL=0.036] X-Spam-Score: 0.036 X-Spam-Level: X-Archive-Number: 200512/553 X-Sequence-Number: 16374 On Thu, Dec 22, 2005 at 02:08:23AM +0100, Steinar H. Gunderson wrote: > On Wed, Dec 21, 2005 at 03:10:28PM -0700, Michael Fuhr wrote: > >> That's funny, my biggest problems with PL/PgSQL have been (among others) > >> exactly with large result sets... > > Out of curiosity, do you have a simple test case? I'd be interested > > in seeing what you're doing in PL/pgSQL that's contradicting what > > I'm seeing. > > I'm not sure if I have the code anymore (it was under 7.4 or 8.0), but it was > largely scanning through ~2 million rows once, noting differences from the > previous rows as it went. > > In that case, I didn't benchmark against any of the other PL/* languages, but > it was pretty clear that even on a pretty speedy Opteron, it was CPU bound, > which it really shouldn't have been. Try looping through two million rows with PL/Perl or PL/Tcl and you'll probably see significantly worse performance than with PL/pgSQL -- so much worse that I'd be surprised to see those languages make up the difference with whatever processing they'd be doing for each row unless it was something they're particularly good at and PL/pgSQL is particularly bad at. In 8.1 PL/Perl has a couple of ways to fetch query results: spi_exec_query to fetch all the rows at once into a single data structure, and spi_query/spi_fetchrow to fetch the rows one at a time. In my tests with one million rows, spi_exec_query was around 8 times slower than a loop in PL/pgSQL, not to mention requiring a lot of memory. spi_query/spi_fetchrow was about 25 times slower but didn't require the amount of memory that spi_exec_query did. A PL/Tcl function that used spi_exec was about 10 times slower than PL/pgSQL, or only slightly slower than PL/Perl and spi_exec_query. If you didn't benchmark the two million row query, do you have an example that you did benchmark? I don't doubt that PL/Perl and other langauges can do some things faster than PL/pgSQL, but looping through large result sets doesn't seem to be one of them. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Wed Dec 21 22:13:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4A2D69DCC95 for ; Wed, 21 Dec 2005 22:13:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67879-10 for ; Wed, 21 Dec 2005 22:13:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ns.snowman.net (ns.snowman.net [66.92.160.21]) by postgresql.org (Postfix) with ESMTP id EB35D9DCC7B for ; Wed, 21 Dec 2005 22:13:26 -0400 (AST) Received: by ns.snowman.net (Postfix, from userid 1000) id 8820517AF9; Wed, 21 Dec 2005 21:14:18 -0500 (EST) Date: Wed, 21 Dec 2005 21:14:18 -0500 From: Stephen Frost To: Madison Kelly Cc: pgsql-performance@postgresql.org Subject: Re: MySQL is faster than PgSQL but a large margin in my program... any ideas why? Message-ID: <20051222021418.GB6026@ns.snowman.net> Mail-Followup-To: Madison Kelly , pgsql-performance@postgresql.org References: <43AA0966.6090401@alteeve.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zo8WNJAiJDhUkHLZ" Content-Disposition: inline In-Reply-To: <43AA0966.6090401@alteeve.com> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/2.4.24ns.3.0 (i686) X-Uptime: 21:10:57 up 193 days, 18:22, 10 users, load average: 0.11, 0.20, 0.13 User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.068 required=5 tests=[AWL=0.068] X-Spam-Score: 0.068 X-Spam-Level: X-Archive-Number: 200512/552 X-Sequence-Number: 16373 --zo8WNJAiJDhUkHLZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Madison Kelly (linux@alteeve.com) wrote: > If the performace difference comes from the 'COPY...' command being=20 > slower because of the automatic quoting can I somehow tell PostgreSQL=20 > that the data is pre-quoted? Could the performance difference be=20 > something else? I doubt the issue is with the COPY command being slower than INSERTs (I'd expect the opposite generally, actually...). What's the table type of the MySQL tables? Is it MyISAM or InnoDB (I think those are the main alternatives)? IIRC, MyISAM doesn't do ACID and isn't transaction safe, and has problems with data reliability (aiui, equivilant to doing 'fsync =3D false' for Postgres). InnoDB, again iirc, is transaction safe and whatnot, and more akin to the default PostgreSQL setup. I expect some others will comment along these lines too, if my response isn't entirely clear. :) Stephen --zo8WNJAiJDhUkHLZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFDqgv6rzgMPqB3kigRAmFvAJ9V3TT2/Ct5SJzRwvA4TfBfSCm5oQCeM6z7 Xf4XVaAlRT90DGAaYpvp+X4= =n6k0 -----END PGP SIGNATURE----- --zo8WNJAiJDhUkHLZ-- From pgsql-performance-owner@postgresql.org Wed Dec 21 22:52:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 939329DCC83 for ; Wed, 21 Dec 2005 22:52:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76213-04 for ; Wed, 21 Dec 2005 22:52:05 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.201]) by postgresql.org (Postfix) with ESMTP id 46E099DCC74 for ; Wed, 21 Dec 2005 22:51:59 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s14so196840wxc for ; Wed, 21 Dec 2005 18:52:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=FQnFHQKg+0ICvLzLZttpuHmQFR4VRVcmFxIqVJLFkokBpLfWh7I+LSkWvYpgUc8xg69+jiSD3OyO6epfqOfkgDgH27o0ABbvtpW9FyDpYn8Hk7OAImCWLQqMWddtlMjMMKiXd7CClskXzz9/igxt0cO/AtcAxIYK+4UEOlNQN1A= Received: by 10.70.21.18 with SMTP id 18mr1401637wxu; Wed, 21 Dec 2005 18:52:03 -0800 (PST) Received: from ?192.168.1.100? ( [67.44.112.218]) by mx.gmail.com with ESMTP id i16sm2184112wxd.2005.12.21.18.51.49; Wed, 21 Dec 2005 18:52:03 -0800 (PST) From: Kevin Brown To: Madison Kelly , pgsql-performance@postgresql.org Subject: Re: MySQL is faster than PgSQL but a large margin in my program... any ideas why? Date: Wed, 21 Dec 2005 20:44:53 -0600 User-Agent: KMail/1.8 References: <43AA0966.6090401@alteeve.com> <20051222021418.GB6026@ns.snowman.net> In-Reply-To: <20051222021418.GB6026@ns.snowman.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512212044.53501.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/554 X-Sequence-Number: 16375 On Wednesday 21 December 2005 20:14, Stephen Frost wrote: > * Madison Kelly (linux@alteeve.com) wrote: > > If the performace difference comes from the 'COPY...' command being > > slower because of the automatic quoting can I somehow tell PostgreSQL > > that the data is pre-quoted? Could the performance difference be > > something else? > > I doubt the issue is with the COPY command being slower than INSERTs > (I'd expect the opposite generally, actually...). What's the table type > of the MySQL tables? Is it MyISAM or InnoDB (I think those are the main > alternatives)? IIRC, MyISAM doesn't do ACID and isn't transaction safe, > and has problems with data reliability (aiui, equivilant to doing 'fsync > = false' for Postgres). InnoDB, again iirc, is transaction safe and > whatnot, and more akin to the default PostgreSQL setup. > > I expect some others will comment along these lines too, if my response > isn't entirely clear. :) Is fsync() on in your postgres config? If so, that's why you're slower. The default is to have it on for stability (writes are forced to disk). It is quite a bit slower than just allowing the write caches to do their job, but more stable. MySQL does not force writes to disk. From pgsql-performance-owner@postgresql.org Wed Dec 21 23:01:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4315E9DCC7A for ; Wed, 21 Dec 2005 23:01:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85469-02 for ; Wed, 21 Dec 2005 23:01:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.154]) by postgresql.org (Postfix) with ESMTP id A8D4F9DC9EC for ; Wed, 21 Dec 2005 23:01:34 -0400 (AST) Received: from [192.168.1.21] (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc14) with ESMTP id <20051222030138014008lrone>; Thu, 22 Dec 2005 03:01:38 +0000 From: Juan Casero To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Wed, 21 Dec 2005 22:09:48 -0500 User-Agent: KMail/1.8.2 References: <43A84D03.7090002@ritek.hu> <200512201950.47671.caseroj@comcast.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512212209.50234.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.487 required=5 tests=[AWL=0.487] X-Spam-Score: 0.487 X-Spam-Level: X-Archive-Number: 200512/555 X-Sequence-Number: 16376 I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz opterons, 2 Gigs of RAM and RAID 1. I would have liked a better server capable of RAID but that seems to be out of his budget right now. Ok so I assume I get this Sun box. Most likely I will go with Linux since it is a fair bet he doesn't want to pay for the Solaris 10 x86 license. Although I kind of like the idea of using Solaris 10 x86 for this. I will assume I need to install the x64 kernel that comes with say Fedora Core 4. Should I run the Postgresql 8.x binaries in 32 bit mode or 64 bit mode? My instinct tells me 64 bit mode is most efficient for our database size about 20 gigs right now but may grow to 100 gigs in a year or so. I just finished loading a 20 gig database on a dual 900 Mhz Ultrasparc III system with 2 gigs of ram and about 768 megs of shared memory available for the posgresql server running Solaris 10. The load has smoked a P4 3.2 Ghz system I am using also with 2 gigs of ram running postgresql 8.0.3. I mean I started the sparc load after the P4 load. The sparc load has finished already rebuilding the database from a pg_dump file but the P4 system is still going. The p4 has 1.3 Gigs of shared memory allocated to postgresql. How about them apples? Thanks, Juan On Wednesday 21 December 2005 18:57, William Yu wrote: > Juan Casero wrote: > > Can you elaborate on the reasons the opteron is better than the Xeon when > > it comes to disk io? I have a PostgreSQL 7.4.8 box running a DSS. One > > of our > > Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, > transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that > block and then the CPU must do extra work in copying the memory to > > 4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in the > background. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend From pgsql-performance-owner@postgresql.org Thu Dec 22 22:35:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7DE4D9DC807 for ; Thu, 22 Dec 2005 22:35:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11256-09 for ; Thu, 22 Dec 2005 22:35:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.151]) by postgresql.org (Postfix) with ESMTP id 3AE999DCBE5 for ; Thu, 22 Dec 2005 22:35:26 -0400 (AST) Received: from lifebook.aspen (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc11) with ESMTP id <2005122302353001300c5cc6e>; Fri, 23 Dec 2005 02:35:30 +0000 From: Juan Casero To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Wed, 21 Dec 2005 22:31:54 -0500 User-Agent: KMail/1.8.2 References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> In-Reply-To: <200512212209.50234.caseroj@comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512212231.55100.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.017 required=5 tests=[AWL=-1.183, DATE_IN_PAST_12_24=0.881, DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 2.017 X-Spam-Level: ** X-Archive-Number: 200512/573 X-Sequence-Number: 16394 Sorry folks. I had a couple of glasses of wine as I wrote this. Anyway I originally wanted the box to have more than two drives so I could do RAID 5 but that is going to cost too much. Also, contrary to my statement below it seems to me I should run the 32 bit postgresql server on the 64 bit kernel. Would you agree this will probably yield the best performance? I know it depends alot on the system but for now this database is about 20 gigabytes. Not too large right now but it may grow 5x in the next year. Thanks, Juan On Wednesday 21 December 2005 22:09, Juan Casero wrote: > I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz > opterons, 2 Gigs of RAM and RAID 1. I would have liked a better server > capable of RAID but that seems to be out of his budget right now. Ok so I > assume I get this Sun box. Most likely I will go with Linux since it is a > fair bet he doesn't want to pay for the Solaris 10 x86 license. Although I > kind of like the idea of using Solaris 10 x86 for this. I will assume I > need to install the x64 kernel that comes with say Fedora Core 4. Should I > run the Postgresql 8.x binaries in 32 bit mode or 64 bit mode? My > instinct tells me 64 bit mode is most efficient for our database size about > 20 gigs right now but may grow to 100 gigs in a year or so. I just > finished loading a 20 gig database on a dual 900 Mhz Ultrasparc III system > with 2 gigs of ram and about 768 megs of shared memory available for the > posgresql server running Solaris 10. The load has smoked a P4 3.2 Ghz > system I am using also with 2 gigs of ram running postgresql 8.0.3. I > mean I started the sparc load after the P4 load. The sparc load has > finished already rebuilding the database from a pg_dump file but the P4 > system is still going. The p4 has 1.3 Gigs of shared memory allocated to > postgresql. How about them apples? > > > Thanks, > Juan > > On Wednesday 21 December 2005 18:57, William Yu wrote: > > Juan Casero wrote: > > > Can you elaborate on the reasons the opteron is better than the Xeon > > > when it comes to disk io? I have a PostgreSQL 7.4.8 box running a > > > DSS. One of our > > > > Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, > > transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that > > block and then the CPU must do extra work in copying the memory to > > > 4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in the > > background. > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: explain analyze is your friend > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly From pgsql-performance-owner@postgresql.org Wed Dec 21 23:33:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D328A9DC9EE for ; Wed, 21 Dec 2005 23:33:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90670-07 for ; Wed, 21 Dec 2005 23:33:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id A178F9DC85D for ; Wed, 21 Dec 2005 23:33:18 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Wed, 21 Dec 2005 22:33:15 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Dec 2005 22:33:16 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: MySQL is faster than PgSQL but a large margin in Date: Wed, 21 Dec 2005 22:33:14 -0500 Message-ID: <3E37B936B592014B978C4415F90D662DE12012@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] MySQL is faster than PgSQL but a large margin in my program... any ideas why? Thread-Index: AcYGnANB6qQxzJvDSd6zN3bIYuz95QADG4by From: "Luke Lonergan" To: linux@alteeve.com, pgsql-performance@postgresql.org X-OriginalArrivalTime: 22 Dec 2005 03:33:16.0097 (UTC) FILETIME=[71D93310:01C606A8] X-WSS-ID: 6FB4C1F13301770094-01-01 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/556 X-Sequence-Number: 16377 V2hhdCB2ZXJzaW9uIG9mIHBvc3RncmVzPw0KDQpDb3B5IGhhcyBiZWVuIHN1YnN0YW50aWFsbHkg aW1wcm92ZWQgaW4gYml6Z3JlcyBhbmQgYWxzbyBpbiA4LjEuDQotIEx1a2UNCi0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tDQpTZW50IGZyb20gbXkgQmxhY2tCZXJyeSBXaXJlbGVzcyBEZXZpY2UN Cg0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KRnJvbTogcGdzcWwtcGVyZm9ybWFuY2Ut b3duZXJAcG9zdGdyZXNxbC5vcmcgPHBnc3FsLXBlcmZvcm1hbmNlLW93bmVyQHBvc3RncmVzcWwu b3JnPg0KVG86IHBnc3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnIDxwZ3NxbC1wZXJmb3Jt YW5jZUBwb3N0Z3Jlc3FsLm9yZz4NClNlbnQ6IFdlZCBEZWMgMjEgMjE6MDM6MTggMjAwNQ0KU3Vi amVjdDogW1BFUkZPUk1dIE15U1FMIGlzIGZhc3RlciB0aGFuIFBnU1FMIGJ1dCBhIGxhcmdlIG1h cmdpbiBpbiBteSBwcm9ncmFtLi4uIGFueSBpZGVhcyB3aHk/DQoNCkhpIGFsbCwNCg0KICAgT24g YSB1c2VyJ3MgcmVxdWVzdCwgSSByZWNlbnRseSBhZGRlZCBNeVNRTCBzdXBwb3J0IHRvIG15IGJh Y2t1cCANCnByb2dyYW0gd2hpY2ggaGFkIGJlZW4gd3JpdHRlbiBmb3IgUG9zdGdyZVNRTCBleGNs dXNpdmVseSB1bnRpbCBub3cuIA0KV2hhdCBzdXJwcmlzZXMgbWUgaXMgdGhhdCBNeVNRTCBpcyBh Ym91dCAyMCUoaXNoKSBmYXN0ZXIgdGhhbiBQb3N0Z3JlU1FMLg0KDQogICBOb3csIEkgbG92ZSBQ b3N0Z3JlU1FMIGFuZCBJIHdhbnQgdG8gY29udGludWUgcmVjb21tZW5kaW5nIGl0IGFzIHRoZSAN CmRhdGFiYXNlIGVuZ2luZSBvZiBjaG9pY2UgYnV0IGl0IGlzIGhhcmQgdG8gaWdub3JlIGEgcGVy Zm9ybWFuY2UgDQpkaWZmZXJlbmNlIGxpa2UgdGhhdC4NCg0KICAgTXkgcHJvZ3JhbSBpcyBhIHBl cmwgYmFja3VwIGFwcCB0aGF0IHNjYW5zIHRoZSBjb250ZW50IG9mIGEgZ2l2ZW4gDQptb3VudGVk IHBhcnRpdGlvbiwgJ3N0YXQncyBlYWNoIGZpbGUgYW5kIHRoZW4gc3RvcmVzIHRoYXQgZGF0YSBp biB0aGUgDQpkYXRhYmFzZS4gVG8gbWFpbnRhaW4gY2VydGFpbiBkYXRhICh0aGUgYmFja3VwLCBy ZXN0b3JlIGFuZCBkaXNwbGF5IA0KdmFsdWVzIGZvciBlYWNoIGZpbGUpIEkgZmlyc3QgcmVhZCBp biBhbGwgdGhlIGRhdGEgZnJvbSBhIGdpdmVuIHRhYmxlIA0KKG9uZSB0YWJsZSBwZXIgcGFydGl0 aW9uKSBpbnRvIGEgaGFzaCwgZHJvcCBhbmQgcmUtY3JlYXRlIHRoZSB0YWJsZSwgDQp0aGVuIHN0 YXJ0IChpbiBQb3N0Z3JlU1FMKSBhIGJ1bGsgJ0NPUFkuLicgY2FsbCB0aHJvdWdoIHRoZSAncHNx bCcgc2hlbGwgDQphcHAuDQoNCiAgIEluIE15U1FMIHRoZXJlIGlzIG5vICdDT1BZLi4uJyBlcXVp dmFsZW50IHNvIGluc3RlYWQgSSBnZW5lcmF0ZSBhIA0KbGFyZ2UgJ0lOU0VSVCBJTlRPIGZpbGVf aW5mb19YIChjb2wxLCBjb2wyLCAuLi4gY29sbikgVkFMVUVTICguLi4pLCANCihibGFoKSAuLi4g KGJsYWgpOycuIFRoaXMgZG9lc24ndCBzdXBwb3J0IGF1dG9tYXRpYyBxdW90aW5nLCBvYnZpb3Vz bHksIA0Kc28gSSBtYW51YWxseSBxdW90ZSBteSB2YWx1ZXMgYmVmb3JlIGFkZGluZyB0aGUgdmFs dWUgdG8gdGhlIElOU0VSVCANCnN0YXRlbWVudC4gSSBzdXNwZWN0IHRoaXMgbWlnaHQgYmUgcGFy dCBvZiB0aGUgcGVyZm9ybWFuY2UgZGlmZmVyZW5jZT8NCg0KICAgSSB0YWtlIHRoZSB0b3RhbCB0 aW1lIG5lZWRlZCB0byB1cGRhdGUgYSBwYXJ0aXRpb24gKGxvYWQgb2xkIGRhdGEgDQppbnRvIGhh c2ggKyBzY2FuIGFsbCBmaWxlcyBhbmQgcHJlcGFyZSBDT1BZL0lOU0VSVCArIGNvbW1pdCBuZXcg ZGF0YSkgDQphbmQgZGV2aWRlIGJ5IHRoZSBudW1iZXIgb2Ygc2Vjb25kcyBuZWVkZWQgdG8gZ2V0 IGEgc2NvcmUgSSBjYWxsIGEgDQonVS5SYXRlKS4gT24gYXZlcmFnZSBvbiBteSBQZW50aXVtMyAx R0h6IGxhcHRvcCBJIGdldCBVLlJhdGUgb2YgfjQvNTAwLiANCk9uIE15U1FMIHRob3VnaCBJIHVz dWFsbHkgZ2V0IGEgVS5SYXRlIG9mIH43LzgwMC4NCg0KICAgSWYgdGhlIHBlcmZvcm1hY2UgZGlm ZmVyZW5jZSBjb21lcyBmcm9tIHRoZSAnQ09QWS4uLicgY29tbWFuZCBiZWluZyANCnNsb3dlciBi ZWNhdXNlIG9mIHRoZSBhdXRvbWF0aWMgcXVvdGluZyBjYW4gSSBzb21laG93IHRlbGwgUG9zdGdy ZVNRTCANCnRoYXQgdGhlIGRhdGEgaXMgcHJlLXF1b3RlZD8gQ291bGQgdGhlIHBlcmZvcm1hbmNl IGRpZmZlcmVuY2UgYmUgDQpzb21ldGhpbmcgZWxzZT8NCg0KICAgSWYgaXQgd291bGQgaGVscCBJ IGNhbiBwcm92aWRlIGNvZGUgc2FtcGxlcy4gSSBoYXZlbid0IGRvbmUgc28geWV0IA0KYmVjYXVz ZSBpdCdzIGEgbGl0dGxlIGNvbnZvbHVkZWQuIF5fXjsNCg0KICAgVGhhbmtzIGFzIGFsd2F5cyEN Cg0KTWFkaXNvbg0KDQoNCldoZXJlIHRoZSBiaWcgcGVyZm9ybWFuY2UgY29uY2VybiBpcyB3aGVu DQoNCi0tIA0KLT0tPS09LT0tPS09LT0tPS09LT0tPS09LT0tPS09LT0tPS09LT0tPS09LQ0KICAg ICAgICAgICBNYWRpc29uIEtlbGx5IChEaWdpbWVyKQ0KICAgIFRMRS1CVTsgVGhlIExpbnV4IEV4 cGVyaWVuY2UsIEJhY2sgVXANCk1haW4gUHJvamVjdCBQYWdlOiAgaHR0cDovL3RsZS1idS5vcmcN CkNvbW11bml0eSBGb3J1bTogICAgaHR0cDovL2ZvcnVtLnRsZS1idS5vcmcNCi09LT0tPS09LT0t PS09LT0tPS09LT0tPS09LT0tPS09LT0tPS09LT0tPS0NCg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tKGVuZCBvZiBicm9hZGNhc3QpLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQpUSVAg MTogaWYgcG9zdGluZy9yZWFkaW5nIHRocm91Z2ggVXNlbmV0LCBwbGVhc2Ugc2VuZCBhbiBhcHBy b3ByaWF0ZQ0KICAgICAgIHN1YnNjcmliZS1ub21haWwgY29tbWFuZCB0byBtYWpvcmRvbW9AcG9z dGdyZXNxbC5vcmcgc28gdGhhdCB5b3VyDQogICAgICAgbWVzc2FnZSBjYW4gZ2V0IHRocm91Z2gg dG8gdGhlIG1haWxpbmcgbGlzdCBjbGVhbmx5DQoNCg== From pgsql-performance-owner@postgresql.org Wed Dec 21 23:34:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A9ACB9DCC8A for ; Wed, 21 Dec 2005 23:34:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92545-05 for ; Wed, 21 Dec 2005 23:34:06 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 20EA39DCC74 for ; Wed, 21 Dec 2005 23:33:59 -0400 (AST) Received: from mail.jobflash.com (mail.jobflash.com [64.62.211.41]) by svr4.postgresql.org (Postfix) with ESMTP id 9C92A5AF996 for ; Thu, 22 Dec 2005 03:34:04 +0000 (GMT) Received: from [192.168.1.64] (adsl-69-105-230-116.dsl.pltn13.pacbell.net [69.105.230.116]) by mail.jobflash.com (Postfix) with ESMTP id 148BA420CB; Wed, 21 Dec 2005 19:34:02 -0800 (PST) Message-ID: <43AA1EA8.40004@jobflash.com> Date: Wed, 21 Dec 2005 19:34:00 -0800 From: Tom Arthurs User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Juan Casero Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? References: <43A84D03.7090002@ritek.hu> <200512201950.47671.caseroj@comcast.net> <200512212209.50234.caseroj@comcast.net> In-Reply-To: <200512212209.50234.caseroj@comcast.net> Content-Type: multipart/alternative; boundary="------------010501090209070608040005" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/557 X-Sequence-Number: 16378 This is a multi-part message in MIME format. --------------010501090209070608040005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit AFAIK there are no licensing costs for solaris, unless you are talking about a software support agreement, which is not required. Juan Casero wrote: >I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz >opterons, 2 Gigs of RAM and RAID 1. I would have liked a better server >capable of RAID but that seems to be out of his budget right now. Ok so I >assume I get this Sun box. Most likely I will go with Linux since it is a >fair bet he doesn't want to pay for the Solaris 10 x86 license. Although I >kind of like the idea of using Solaris 10 x86 for this. I will assume I >need to install the x64 kernel that comes with say Fedora Core 4. Should I >run the Postgresql 8.x binaries in 32 bit mode or 64 bit mode? My instinct >tells me 64 bit mode is most efficient for our database size about 20 gigs >right now but may grow to 100 gigs in a year or so. I just finished loading >a 20 gig database on a dual 900 Mhz Ultrasparc III system with 2 gigs of ram >and about 768 megs of shared memory available for the posgresql server >running Solaris 10. The load has smoked a P4 3.2 Ghz system I am using also >with 2 gigs of ram running postgresql 8.0.3. I mean I started the sparc >load after the P4 load. The sparc load has finished already rebuilding the >database from a pg_dump file but the P4 system is still going. The p4 has >1.3 Gigs of shared memory allocated to postgresql. How about them apples? > > >Thanks, >Juan > >On Wednesday 21 December 2005 18:57, William Yu wrote: > > >>Juan Casero wrote: >> >> >>>Can you elaborate on the reasons the opteron is better than the Xeon when >>>it comes to disk io? I have a PostgreSQL 7.4.8 box running a DSS. One >>>of our >>> >>> >>Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, >>transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that >>block and then the CPU must do extra work in copying the memory to > >>4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in the >>background. >> >>---------------------------(end of broadcast)--------------------------- >>TIP 6: explain analyze is your friend >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > > > --------------010501090209070608040005 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit AFAIK there are no licensing costs for solaris, unless you are talking about a software support agreement, which is not required.

Juan Casero wrote:
I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz 
opterons, 2 Gigs of RAM and RAID 1.  I would have liked a better server 
capable of RAID but that seems to be out of his budget right now.  Ok so I 
assume I get this Sun box.  Most likely I will go with Linux since it is a 
fair bet he doesn't want to pay for the Solaris 10 x86 license.  Although I 
kind of like the idea of using Solaris 10 x86 for this.   I will assume I 
need to install the x64 kernel that comes with say Fedora Core 4.  Should I 
run the Postgresql 8.x binaries in 32 bit mode or 64 bit mode?   My instinct 
tells me 64 bit mode is most efficient for our database size about 20 gigs 
right now but may grow to 100 gigs in a year or so.  I just finished loading 
a 20 gig database on a dual 900 Mhz Ultrasparc III system with 2 gigs of ram 
and about 768 megs of shared memory available for the posgresql server 
running Solaris 10.  The load has smoked a P4 3.2 Ghz system I am using also 
with 2 gigs of ram running postgresql 8.0.3.   I mean I started the sparc 
load after the P4 load.  The sparc load has finished already rebuilding the 
database from a pg_dump file but the P4 system is still going.  The p4 has 
1.3 Gigs of shared memory allocated to postgresql.  How about them apples?


Thanks,
Juan

On Wednesday 21 December 2005 18:57, William Yu wrote:
  
Juan Casero wrote:
    
Can you elaborate on the reasons the opteron is better than the Xeon when
it comes to disk io?   I have a PostgreSQL 7.4.8 box running a DSS.   One
of our
      
Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode,
transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that
block and then the CPU must do extra work in copying the memory to >
4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in the
background.

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

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


  
--------------010501090209070608040005-- From pgsql-performance-owner@postgresql.org Wed Dec 21 23:45:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 316C49DCC25 for ; Wed, 21 Dec 2005 23:45:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95365-01 for ; Wed, 21 Dec 2005 23:45:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id B163F9DCC18 for ; Wed, 21 Dec 2005 23:45:08 -0400 (AST) 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 jBM3jB6b018611; Wed, 21 Dec 2005 22:45:11 -0500 (EST) To: Michael Fuhr cc: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language In-reply-to: <20051222021346.GA61585@winnie.fuhr.org> References: <20051221110647.GA17360@uio.no> <20051221212442.GA59736@winnie.fuhr.org> <20051221213810.GA27113@uio.no> <20051221221028.GA60176@winnie.fuhr.org> <20051222010823.GA6103@uio.no> <20051222021346.GA61585@winnie.fuhr.org> Comments: In-reply-to Michael Fuhr message dated "Wed, 21 Dec 2005 19:13:46 -0700" Date: Wed, 21 Dec 2005 22:45:11 -0500 Message-ID: <18610.1135223111@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.032 required=5 tests=[AWL=0.032] X-Spam-Score: 0.032 X-Spam-Level: X-Archive-Number: 200512/558 X-Sequence-Number: 16379 Michael Fuhr writes: > Try looping through two million rows with PL/Perl or PL/Tcl and > you'll probably see significantly worse performance than with > PL/pgSQL -- so much worse that I'd be surprised to see those languages > make up the difference with whatever processing they'd be doing for > each row unless it was something they're particularly good at and > PL/pgSQL is particularly bad at. I'd expect plpgsql to suck at purely computational tasks, compared to the other PLs, but to win at tasks involving database access. These are two sides of the same coin really --- plpgsql is tightly tied to the PG query execution engine, to the extent of using it even for simply adding 2 and 2, but that also gives it relatively low overhead for invoking a database query. Perl, Tcl, et al have their own computational engines and can easily beat the PG SQL engine for simple arithmetic and string-pushing. But they pay a high overhead for calling back into the database engine. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 22 00:01:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A16529DCBB0 for ; Thu, 22 Dec 2005 00:01:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94720-09 for ; Thu, 22 Dec 2005 00:01:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 53A0E9DCBE3 for ; Thu, 22 Dec 2005 00:01:17 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 7616631F57; Thu, 22 Dec 2005 05:01:16 +0100 (MET) From: Qingqing Zhou X-Newsgroups: pgsql.performance Subject: Re: CPU and RAM Date: Wed, 21 Dec 2005 23:01:12 -0500 Organization: Hub.Org Networking Services Lines: 20 Message-ID: References: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Complaints-To: usenet@news.hub.org To: Harry Jackson X-X-Sender: zhouqq@eon.cs In-Reply-To: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.138 required=5 tests=[AWL=0.138] X-Spam-Score: 0.138 X-Spam-Level: X-Archive-Number: 200512/559 X-Sequence-Number: 16380 On Thu, 22 Dec 2005, Harry Jackson wrote: > I am currently using a dual Opteron (248) single core system (RAM > PC3200) and for a change I am finding that the bottleneck is not disk > I/O but CPU/RAM (not sure which). The reason for this is that the most > frequently accessed tables/indexes are all held in RAM and when > querying the database there is almost no disk activity which is great, > most of the time. > > At the moment everything is working OK but I am noticing an almost > linear increase in time to retrieve data from the database as the data > set increases in size. Clustering knocks the access times down by 25% Let's find out what's going on first. Can you find out the most expensive query. Also, according to you what you said: (1) execution time is linear to data set size (2) no disk IO - so why cluster will improve 25%? Regards, Qingqing From pgsql-performance-owner@postgresql.org Thu Dec 22 00:17:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4FE1F9DC93F for ; Thu, 22 Dec 2005 00:17:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95564-09 for ; Thu, 22 Dec 2005 00:17:31 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by postgresql.org (Postfix) with ESMTP id 0CA079DC881 for ; Thu, 22 Dec 2005 00:17:29 -0400 (AST) Received: from fe-amer-06.sun.com ([192.18.108.180]) by brmea-mail-4.sun.com (8.12.10/8.12.9) with ESMTP id jBM4HTD7028421 for ; Wed, 21 Dec 2005 21:17:29 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IRV00K01RRA9000@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 21:17:29 -0700 (MST) Received: from [129.150.32.143] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IRV00BLYT94GD10@mail-amer.sun.com>; Wed, 21 Dec 2005 21:17:28 -0700 (MST) Date: Wed, 21 Dec 2005 23:07:47 -0500 From: "Jignesh K. Shah" Subject: Re: What's the best hardver for PostgreSQL 8.1? In-reply-to: <200512212209.50234.caseroj@comcast.net> To: Juan Casero Cc: pgsql-performance@postgresql.org Message-id: <43AA2693.3080005@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en References: <43A84D03.7090002@ritek.hu> <200512201950.47671.caseroj@comcast.net> <200512212209.50234.caseroj@comcast.net> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.120, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200512/560 X-Sequence-Number: 16381 Hi Juan, Solaris 10 license is for free.. Infact I believe you do receive the media with Sun Fire V20z. If you want support then there are various "pay" plans depending on the level of support. If not your license allows you Right to Use anyway for free. That said I haven't done much testing with 32/64 bit differences. However for long term purposes, 64-bit always seems to be the safe bet. As for your load performance, lot of it depends on your file system layout also. Regards, Jignesh Juan Casero wrote: >I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz >opterons, 2 Gigs of RAM and RAID 1. I would have liked a better server >capable of RAID but that seems to be out of his budget right now. Ok so I >assume I get this Sun box. Most likely I will go with Linux since it is a >fair bet he doesn't want to pay for the Solaris 10 x86 license. Although I >kind of like the idea of using Solaris 10 x86 for this. I will assume I >need to install the x64 kernel that comes with say Fedora Core 4. Should I >run the Postgresql 8.x binaries in 32 bit mode or 64 bit mode? My instinct >tells me 64 bit mode is most efficient for our database size about 20 gigs >right now but may grow to 100 gigs in a year or so. I just finished loading >a 20 gig database on a dual 900 Mhz Ultrasparc III system with 2 gigs of ram >and about 768 megs of shared memory available for the posgresql server >running Solaris 10. The load has smoked a P4 3.2 Ghz system I am using also >with 2 gigs of ram running postgresql 8.0.3. I mean I started the sparc >load after the P4 load. The sparc load has finished already rebuilding the >database from a pg_dump file but the P4 system is still going. The p4 has >1.3 Gigs of shared memory allocated to postgresql. How about them apples? > > >Thanks, >Juan > >On Wednesday 21 December 2005 18:57, William Yu wrote: > > >>Juan Casero wrote: >> >> >>>Can you elaborate on the reasons the opteron is better than the Xeon when >>>it comes to disk io? I have a PostgreSQL 7.4.8 box running a DSS. One >>>of our >>> >>> >>Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, >>transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that >>block and then the CPU must do extra work in copying the memory to > >>4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in the >>background. >> >>---------------------------(end of broadcast)--------------------------- >>TIP 6: explain analyze is your friend >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > From pgsql-performance-owner@postgresql.org Thu Dec 22 02:59:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0695A9DCBAF for ; Thu, 22 Dec 2005 02:59:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23918-05 for ; Thu, 22 Dec 2005 02:58:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tomts22-srv.bellnexxia.net (tomts22.bellnexxia.net [209.226.175.184]) by postgresql.org (Postfix) with ESMTP id 098E29DCAB5 for ; Thu, 22 Dec 2005 02:58:56 -0400 (AST) Received: from [192.168.1.99] ([64.229.117.133]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20051222065856.EAXX16473.tomts22-srv.bellnexxia.net@[192.168.1.99]>; Thu, 22 Dec 2005 01:58:56 -0500 Message-ID: <43AA4EAB.9080507@alteeve.com> Date: Thu, 22 Dec 2005 01:58:51 -0500 From: Madison Kelly User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stephen Frost CC: pgsql-performance@postgresql.org Subject: Re: MySQL is faster than PgSQL but a large margin in my References: <43AA0966.6090401@alteeve.com> <20051222021418.GB6026@ns.snowman.net> In-Reply-To: <20051222021418.GB6026@ns.snowman.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [0] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.1 required=5 tests=[AWL=0.100] X-Spam-Score: 0.1 X-Spam-Level: X-Archive-Number: 200512/561 X-Sequence-Number: 16382 Stephen Frost wrote: > * Madison Kelly (linux@alteeve.com) wrote: > >> If the performace difference comes from the 'COPY...' command being >>slower because of the automatic quoting can I somehow tell PostgreSQL >>that the data is pre-quoted? Could the performance difference be >>something else? > > > I doubt the issue is with the COPY command being slower than INSERTs > (I'd expect the opposite generally, actually...). What's the table type > of the MySQL tables? Is it MyISAM or InnoDB (I think those are the main > alternatives)? IIRC, MyISAM doesn't do ACID and isn't transaction safe, > and has problems with data reliability (aiui, equivilant to doing 'fsync > = false' for Postgres). InnoDB, again iirc, is transaction safe and > whatnot, and more akin to the default PostgreSQL setup. > > I expect some others will comment along these lines too, if my response > isn't entirely clear. :) > > Stephen Ah, that makes a lot of sense (I read about the 'fsync' issue before, now that you mention it). I am not too familiar with MySQL but IIRC MyISAM is their open-source DB and InnoDB is their commercial one, ne? If so, then I am running MyISAM. Here is the MySQL table. The main difference from the PostgreSQL table is that the 'varchar(255)' columns are 'text' columns in PostgreSQL. mysql> DESCRIBE file_info_1; +-----------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+--------------+------+-----+---------+-------+ | file_group_name | varchar(255) | YES | | NULL | | | file_group_uid | int(11) | | | 0 | | | file_mod_time | bigint(20) | | | 0 | | | file_name | varchar(255) | | | | | | file_parent_dir | varchar(255) | | MUL | | | | file_perm | int(11) | | | 0 | | | file_size | bigint(20) | | | 0 | | | file_type | char(1) | | | | | | file_user_name | varchar(255) | YES | | NULL | | | file_user_uid | int(11) | | | 0 | | | file_backup | char(1) | | MUL | i | | | file_display | char(1) | | | i | | | file_restore | char(1) | | | i | | +-----------------+--------------+------+-----+---------+-------+ I will try turning off 'fsync' on my test box to see how much of a performance gain I get and to see if it is close to what I am getting out of MySQL. If that does turn out to be the case though I will be able to comfortably continue recommending PostgreSQL from a stability point of view. Thanks!! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU; The Linux Experience, Back Up Main Project Page: http://tle-bu.org Community Forum: http://forum.tle-bu.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Thu Dec 22 03:02:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7479D9DC81D for ; Thu, 22 Dec 2005 03:02:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27767-01 for ; Thu, 22 Dec 2005 03:02:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tomts36-srv.bellnexxia.net (tomts36.bellnexxia.net [209.226.175.93]) by postgresql.org (Postfix) with ESMTP id 7B6419DCBA1 for ; Thu, 22 Dec 2005 03:02:51 -0400 (AST) Received: from [192.168.1.99] ([64.229.117.133]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20051222070251.CAIG5032.tomts36-srv.bellnexxia.net@[192.168.1.99]>; Thu, 22 Dec 2005 02:02:51 -0500 Message-ID: <43AA4F97.40201@alteeve.com> Date: Thu, 22 Dec 2005 02:02:47 -0500 From: Madison Kelly User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan CC: pgsql-performance@postgresql.org Subject: Re: MySQL is faster than PgSQL but a large margin in References: <3E37B936B592014B978C4415F90D662DE12012@MI8NYCMAIL06.Mi8.com> In-Reply-To: <3E37B936B592014B978C4415F90D662DE12012@MI8NYCMAIL06.Mi8.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [0] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.103 required=5 tests=[AWL=0.103] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200512/562 X-Sequence-Number: 16383 Luke Lonergan wrote: > What version of postgres? > > Copy has been substantially improved in bizgres and also in 8.1. > - Luke Currently 7.4 (what comes with Debian Sarge). I have run my program on 8.0 but not since I have added MySQL support. I should run the tests on the newer versions of both DBs (using v4.1 for MySQL which is also mature at this point). As others mentioned though, so far the most likely explanation is the 'fsync' being enabled on PostgreSQL. Thanks for the reply! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU; The Linux Experience, Back Up Main Project Page: http://tle-bu.org Community Forum: http://forum.tle-bu.org -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Thu Dec 22 03:08:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 05B289DC9F2 for ; Thu, 22 Dec 2005 03:08:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28535-03 for ; Thu, 22 Dec 2005 03:08:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id 084289DCCCE for ; Thu, 22 Dec 2005 03:08:06 -0400 (AST) Received: from 172.16.1.26 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Thu, 22 Dec 2005 02:07:50 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Dec 2005 02:07:24 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Thu, 22 Dec 2005 07:07:23 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 21 Dec 2005 23:07:22 -0800 Subject: Re: MySQL is faster than PgSQL but a large margin in From: "Luke Lonergan" To: "Madison Kelly" , "Stephen Frost" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] MySQL is faster than PgSQL but a large margin in my Thread-Index: AcYGxVa/D8+MMfkBQf2EHzkChoHvrAAAQPYs In-Reply-To: <43AA4EAB.9080507@alteeve.com> MIME-Version: 1.0 X-OriginalArrivalTime: 22 Dec 2005 07:07:24.0085 (UTC) FILETIME=[5BD89650:01C606C6] X-WSS-ID: 6FB48F263ZO9007050-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.287 required=5 tests=[AWL=0.034, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.287 X-Spam-Level: * X-Archive-Number: 200512/563 X-Sequence-Number: 16384 Madison, On 12/21/05 10:58 PM, "Madison Kelly" wrote: > Ah, that makes a lot of sense (I read about the 'fsync' issue before, > now that you mention it). I am not too familiar with MySQL but IIRC > MyISAM is their open-source DB and InnoDB is their commercial one, ne? > If so, then I am running MyISAM. You can run either storage method with MySQL, I expect the default is MyISAM. COPY performance with or without fsync was sped up recently nearly double in Postgresql. The Bizgres version (www.bizgres.org, www.greenplum.com) is the fastest, Postgres 8.1.1 is close, depending on how fast your disk I/O is (as I/O speed increases Bizgres gets faster). fsync isn't really an "issue" and I'd suggest you not run without it! We've found that "fdatasync" as the wal sync method is actually a bit faster than fsync if you want a bit better speed. So, I'd recommend you upgrade to either bizgres or Postgres 8.1.1 to get the maximum COPY speed. > Here is the MySQL table. The main difference from the PostgreSQL > table is that the 'varchar(255)' columns are 'text' columns in PostgreSQL. Shouldn't matter. > mysql> DESCRIBE file_info_1; > +-----------------+--------------+------+-----+---------+-------+ > | Field | Type | Null | Key | Default | Extra | > +-----------------+--------------+------+-----+---------+-------+ > | file_group_name | varchar(255) | YES | | NULL | | > | file_group_uid | int(11) | | | 0 | | > | file_mod_time | bigint(20) | | | 0 | | > | file_name | varchar(255) | | | | | > | file_parent_dir | varchar(255) | | MUL | | | > | file_perm | int(11) | | | 0 | | > | file_size | bigint(20) | | | 0 | | > | file_type | char(1) | | | | | > | file_user_name | varchar(255) | YES | | NULL | | > | file_user_uid | int(11) | | | 0 | | > | file_backup | char(1) | | MUL | i | | > | file_display | char(1) | | | i | | > | file_restore | char(1) | | | i | | > +-----------------+--------------+------+-----+---------+-------+ What's a bigint(20)? Are you using "numeric" in Postgresql? > I will try turning off 'fsync' on my test box to see how much of a > performance gain I get and to see if it is close to what I am getting > out of MySQL. If that does turn out to be the case though I will be able > to comfortably continue recommending PostgreSQL from a stability point > of view. Again - fsync is a small part of the performance - you will need to run either Postgres 8.1.1 or Bizgres to get good COPY speed. - Luke From pgsql-performance-owner@postgresql.org Thu Dec 22 03:10:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 43C559DCB93 for ; Thu, 22 Dec 2005 03:10:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29358-01 for ; Thu, 22 Dec 2005 03:10:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id C2FF99DCAB5 for ; Thu, 22 Dec 2005 03:10:50 -0400 (AST) Received: from 172.16.1.148 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Thu, 22 Dec 2005 02:10:46 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Dec 2005 02:10:45 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Thu, 22 Dec 2005 07:10:44 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 21 Dec 2005 23:10:43 -0800 Subject: Re: MySQL is faster than PgSQL but a large margin in From: "Luke Lonergan" To: "Madison Kelly" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] MySQL is faster than PgSQL but a large margin in Thread-Index: AcYGxcIo+KPvYc+RScyAAU8L5+Qj+gAARBBr In-Reply-To: <43AA4F97.40201@alteeve.com> MIME-Version: 1.0 X-OriginalArrivalTime: 22 Dec 2005 07:10:45.0304 (UTC) FILETIME=[D3C82B80:01C606C6] X-WSS-ID: 6FB48EFF3301884373-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.295 required=5 tests=[AWL=0.042, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.295 X-Spam-Level: * X-Archive-Number: 200512/564 X-Sequence-Number: 16385 Madison, On 12/21/05 11:02 PM, "Madison Kelly" wrote: > Currently 7.4 (what comes with Debian Sarge). I have run my program on > 8.0 but not since I have added MySQL support. I should run the tests on > the newer versions of both DBs (using v4.1 for MySQL which is also > mature at this point). Yes, this is *definitely* your problem. Upgrade to Postgres 8.1.1 or Bizgres 0_8_1 and your COPY speed could double without even changing fsync (depending on your disk speed). We typically get 12-14MB/s from Bizgres on Opteron CPUs and disk subsystems that can write at least 60MB/s. This means you can load 100GB in 2 hours. Note that indexes will also slow down loading. - Luke From pgsql-performance-owner@postgresql.org Thu Dec 22 05:20:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 032069DCCAA for ; Thu, 22 Dec 2005 05:20:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47590-04 for ; Thu, 22 Dec 2005 05:20:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 201ED9DCCB7 for ; Thu, 22 Dec 2005 05:20:23 -0400 (AST) 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 951D240BEEC; Thu, 22 Dec 2005 09:19:47 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 45C5E15EA4; Thu, 22 Dec 2005 09:19:52 +0000 (GMT) Message-ID: <43AA6FB7.7070905@archonet.com> Date: Thu, 22 Dec 2005 09:19:51 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Harry Jackson Cc: pgsql-performance@postgresql.org Subject: Re: CPU and RAM References: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> In-Reply-To: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200512/565 X-Sequence-Number: 16386 Harry Jackson wrote: > I am currently using a dual Opteron (248) single core system (RAM > PC3200) and for a change I am finding that the bottleneck is not disk > I/O but CPU/RAM (not sure which). Well that's the first thing to find out. What is "top" showing for CPU usage and which processes? -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Dec 22 08:59:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 974FE9DCC4D for ; Thu, 22 Dec 2005 08:59:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80770-04 for ; Thu, 22 Dec 2005 08:59:50 -0400 (AST) X-Greylist: delayed 00:07:13.421478 by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.196]) by postgresql.org (Postfix) with ESMTP id BAFF39DCC11 for ; Thu, 22 Dec 2005 08:59:44 -0400 (AST) Received: by uproxy.gmail.com with SMTP id s2so80572uge for ; Thu, 22 Dec 2005 04:59:48 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=SRNU64VTun6Th3mGzcTHex+JTfM4UQtonz7KWQyVzmz1J+r8+a2XoU4yNHdKUtNGVnciDOIpzcdDHnSPGVUz4MYmltu7ujLMrfJMoZIXo4g25Hl1VT6AIP7Veekr+5SM/jE1KGiKiIMPbBL2cDnMcNqkiHYpMcw+wfE5I0mBD5Q= Received: by 10.66.186.5 with SMTP id j5mr442601ugf; Thu, 22 Dec 2005 04:52:33 -0800 (PST) Received: from ?192.168.3.4? ( [81.182.248.121]) by mx.gmail.com with ESMTP id c1sm602027ugf.2005.12.22.04.52.33; Thu, 22 Dec 2005 04:52:33 -0800 (PST) Message-ID: <43AAA19C.5000909@gmail.com> Date: Thu, 22 Dec 2005 13:52:44 +0100 From: =?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Subject: Re: Wrong index used when ORDER BY LIMIT 1 References: <43A998D4.4070300@gmail.com> <15421.1135193659@sss.pgh.pa.us> In-Reply-To: <15421.1135193659@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/566 X-Sequence-Number: 16387 Dear Tom, On 2005.12.21. 20:34, Tom Lane wrote: > =?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= writes: >> Query is: >> SELECT idopont WHERE muvelet = x ORDER BY idopont LIMIT 1. > > Much the best solution for this would be to have an index on > (muvelet, idopont) > --- perhaps you can reorder the columns of "muvelet_vonalkod_muvelet" > instead of making a whole new index --- and then say > > SELECT idopont WHERE muvelet = x ORDER BY muvelet, idopont LIMIT 1 I was far too tired yesterday evening to produce such a clean solution but finally came to this conclusion this morning :) Even without the new index, it picks the index on muvelet, which decreases time to ~1.5ms. The new index takes it down to 0.1ms. However, this has a problem; namely, what if I don't (or can't) tell the exact int value in the WHERE clause? In general: will the following query: SELECT indexed_ts_field FROM table WHERE indexed_int_field IN (100,200) -- or even: indexed_int_field BETWEEN 100 AND 200 ORDER BY indexed_ts_field LIMIT n always pick the index on the timestamp field, or does it depend on something else, say the limit size n and the attributes' statistics? > PG 8.1 can apply such an index to your original query, but older > versions will need the help of the modified ORDER BY to recognize > that the index is usable. So the direct cause is that 7.x planners prefer ORDER BY to WHERE when picking indexes? But only when there is a LIMIT clause present? I'd like to know how much of our code should I review; if it's explicitly connected to LIMIT, I'd probably have to check far less code. -- G. From pgsql-performance-owner@postgresql.org Thu Dec 22 09:29:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A5E159DCA6E for ; Thu, 22 Dec 2005 09:29:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83738-07 for ; Thu, 22 Dec 2005 09:29:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id F39889DC815 for ; Thu, 22 Dec 2005 09:29:52 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Speed of different procedural language Date: Thu, 22 Dec 2005 08:29:53 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DDBAE@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Speed of different procedural language Thread-Index: AcYGqjRHzNTLoUy4TBa4XBCnXq24RAATgWTA From: "Merlin Moncure" To: "Trewern, Ben" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200512/567 X-Sequence-Number: 16388 Tom Lane wrote: > I'd expect plpgsql to suck at purely computational tasks, compared to > the other PLs, but to win at tasks involving database access. These There you go...pl/pgsql is pretty much required learning (it's not hard). For classic data processing tasks, it is without peer. I would generalize that a large majority of tasks fall under this category. pl/pgsql is quick, has a low memory profile, and you can cut sql directly in code instead of through a proxy object...I could go on and on about how useful and important that is. merlin From pgsql-performance-owner@postgresql.org Thu Dec 22 09:35:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3DD769DCC4D for ; Thu, 22 Dec 2005 09:35:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84348-04 for ; Thu, 22 Dec 2005 09:35:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (serval.logix-tt.com [213.239.221.42]) by postgresql.org (Postfix) with ESMTP id 3CFB59DCC3A for ; Thu, 22 Dec 2005 09:35:31 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (K9eae.k.pppool.de [85.75.158.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 6032824400F; Thu, 22 Dec 2005 14:41:49 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 58FEC85F5A; Thu, 22 Dec 2005 14:34:18 +0100 (CET) Message-ID: <43AAAB58.6050109@logix-tt.com> Date: Thu, 22 Dec 2005 14:34:16 +0100 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: MySQL is faster than PgSQL but a large margin in References: In-Reply-To: X-Enigmail-Version: 0.93.0.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, score=0.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200512/568 X-Sequence-Number: 16389 Hi, Madison, Hi, Luke, Luke Lonergan wrote: > Note that indexes will also slow down loading. For large loading bunches, it often makes sense to temporarily drop the indices before the load, and recreate them afterwards, at least, if you don't have normal users accessing the database concurrently. Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Thu Dec 22 10:06:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4C3E89DCBD4 for ; Thu, 22 Dec 2005 10:06:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91756-01 for ; Thu, 22 Dec 2005 10:06:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35501.mail.mud.yahoo.com (web35501.mail.mud.yahoo.com [66.163.179.125]) by postgresql.org (Postfix) with SMTP id B8BA79DC886 for ; Thu, 22 Dec 2005 10:06:19 -0400 (AST) Received: (qmail 81531 invoked by uid 60001); 22 Dec 2005 14:06:20 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=5mmjtG1wQl2mGkkvgqODnbO6TVkVQygf4A+fYgUG+XP4YRrKdj7HryD3yfdAxCfF/SZHmvcCQ+pZnwJzcRkmtdc4/JbH9Dzbq4PJOtPAF+7nWFg8EU9CVpjMIgEwHiTn60Xh7x58ge1fs8JcogibyVNe0wKkZ4f474G7k0JcFXk= ; Message-ID: <20051222140620.81529.qmail@web35501.mail.mud.yahoo.com> Received: from [201.3.235.213] by web35501.mail.mud.yahoo.com via HTTP; Thu, 22 Dec 2005 14:06:20 GMT Date: Thu, 22 Dec 2005 14:06:20 +0000 (GMT) From: Carlos Benkendorf Subject: Re: ORDER BY costs To: Tom Lane , pgsql-performance@postgresql.org In-Reply-To: <15455.1135193975@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-2008981442-1135260380=:76789" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.543 required=5 tests=[AWL=0.063, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.543 X-Spam-Level: X-Archive-Number: 200512/569 X-Sequence-Number: 16390 --0-2008981442-1135260380=:76789 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I�m not sure but I think the extra runtime of the select statement that has the ORDER BY clause is because the planner decided to sort the result set. Is the sort really necessary? Why not only scanning the primary key index pages and retrieving the rows like the select without the order by clause? Aren�t not the rows retrieved from the index in a odered form? Thanks in advance! Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-2008981442-1135260380=:76789 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
I�m not sure but I think the extra runtime of the select statement that has the ORDER BY clause is because the planner decided to sort the result set.
 
Is the sort really necessary? Why not only scanning the primary key index pages and retrieving the rows like the select without the order by clause?
 
Aren�t not the rows retrieved from the index in a odered form?
 
Thanks in advance!
 
Benkendorf
 
 
 


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-2008981442-1135260380=:76789-- From pgsql-performance-owner@postgresql.org Thu Dec 22 10:17:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5C8C59DCAAF for ; Thu, 22 Dec 2005 10:17:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90296-09 for ; Thu, 22 Dec 2005 10:17:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id E4E4B9DC886 for ; Thu, 22 Dec 2005 10:17:41 -0400 (AST) Received: (qmail 8120 invoked from network); 22 Dec 2005 14:17:46 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 22 Dec 2005 14:17:46 -0000 In-Reply-To: <200512151444.jBFEiNF25690@core.kontent.de> References: <200512151444.jBFEiNF25690@core.kontent.de> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <1380B56B-1419-4F4D-894B-979F075F18CF@fastcrypt.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: effizient query with jdbc Date: Thu, 22 Dec 2005 09:17:45 -0500 To: johannesbuehler@oderbruecke.de X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.129 required=5 tests=[AWL=0.129] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200512/570 X-Sequence-Number: 16391 The problem is you are getting the entire list back at once. You may want to try using a cursor. Dave On 15-Dec-05, at 9:44 AM, johannesbuehler@oderbruecke.de wrote: > Hi, > I have a java.util.List of values (10000) which i wanted to use for > a query in the where clause of an simple select statement. > iterating over the list and and use an prepared Statement is quite > slow. Is there a more efficient way to execute such a query. > > Thanks for any help. > Johannes > ..... > List ids = new ArrayList(); > > .... List is filled with 10000 values ... > > List uuids = new ArrayList(); > PreparedStatement pstat = db.prepareStatement("SELECT UUID FROM > MDM.KEYWORDS_INFO WHERE KEYWORDS_ID = ?"); > for (Iterator iter = ids.iterator(); iter.hasNext();) { > String id = (String) iter.next(); > pstat.setString(1, id); > rs = pstat.executeQuery(); > if (rs.next()) { > uuids.add(rs.getString(1)); > } > rs.close(); > } > ... > > > > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Thu Dec 22 11:31:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 42C479DCAC1 for ; Thu, 22 Dec 2005 11:31:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02681-05 for ; Thu, 22 Dec 2005 11:31:14 -0400 (AST) X-Greylist: delayed 00:06:40.281309 by SQLgrey- Received: from mail.zpfe.com (mail.zpfe.com [208.42.168.33]) by postgresql.org (Postfix) with SMTP id 85C7B9DC844 for ; Thu, 22 Dec 2005 11:31:06 -0400 (AST) Received: (qmail 7281 invoked from network); 22 Dec 2005 15:24:30 -0000 Received: from unknown (HELO revere.zpfe.com) (208.42.168.33) by mail.zpfe.com with SMTP; 22 Dec 2005 15:24:30 -0000 Message-Id: <6.2.3.4.0.20051222090735.05452aa8@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.4 Date: Thu, 22 Dec 2005 09:23:49 -0600 To: pgsql-performance@postgresql.org From: Steve Peterson Subject: Re: effizient query with jdbc In-Reply-To: <1380B56B-1419-4F4D-894B-979F075F18CF@fastcrypt.com> References: <200512151444.jBFEiNF25690@core.kontent.de> <1380B56B-1419-4F4D-894B-979F075F18CF@fastcrypt.com> Mime-Version: 1.0 Content-Type: text/plain; charset="0"; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/571 X-Sequence-Number: 16392 Is there a reason you can't rewrite your SELECT like: SELECT UUID FROM MDM.KEYWORDS_INFO WHERE KEYWORDS_ID IN (a, b, c, d) Even doing them 100 at a time will make a big difference; you should put as many in the list as pgsql supports. I'm assuming that there's an index over KEYWORDS_ID. Retrieving 10000 rows with 10000 statements is generally a Bad Idea. S At 08:17 AM 12/22/2005, Dave Cramer wrote: >The problem is you are getting the entire list back at once. > >You may want to try using a cursor. > >Dave >On 15-Dec-05, at 9:44 AM, johannesbuehler@oderbruecke.de wrote: > >>Hi, >>I have a java.util.List of values (10000) which i wanted to use for >>a query in the where clause of an simple select statement. >>iterating over the list and and use an prepared Statement is quite >>slow. Is there a more efficient way to execute such a query. >> >>Thanks for any help. >>Johannes >>..... >>List ids = new ArrayList(); >> >>.... List is filled with 10000 values ... >> >>List uuids = new ArrayList(); >>PreparedStatement pstat = db.prepareStatement("SELECT UUID FROM >>MDM.KEYWORDS_INFO WHERE KEYWORDS_ID = ?"); >>for (Iterator iter = ids.iterator(); iter.hasNext();) { >>String id = (String) iter.next(); >>pstat.setString(1, id); >>rs = pstat.executeQuery(); >>if (rs.next()) { >>uuids.add(rs.getString(1)); >>} >>rs.close(); >>} >>... >> >> >> >> >> >> >>---------------------------(end of >>broadcast)--------------------------- >>TIP 6: explain analyze is your friend > > >---------------------------(end of broadcast)--------------------------- >TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Thu Dec 22 12:23:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BB2C49DCCB7 for ; Thu, 22 Dec 2005 12:23:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09141-07 for ; Thu, 22 Dec 2005 12:23:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35502.mail.mud.yahoo.com (web35502.mail.mud.yahoo.com [66.163.179.126]) by postgresql.org (Postfix) with SMTP id 371159DCBD4 for ; Thu, 22 Dec 2005 12:23:38 -0400 (AST) Received: (qmail 8349 invoked by uid 60001); 22 Dec 2005 16:23:36 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=a3KDDqkE+epk0PtzTkuf37GSVJgrAUxcDwsFUggTx1ZKIDfRF/C0UAgEEtqMyxoPlVraU2ukZu8TlOwqfZuJ6FOjvH8Th4Se2t4subtpda5DTNeCcyHLYeqVo0DnkvnHQUtjzrvwKoZk5g7qM6mTD2qRhi8gfQKRgyGBi0IPcao= ; Message-ID: <20051222162336.8347.qmail@web35502.mail.mud.yahoo.com> Received: from [201.3.235.213] by web35502.mail.mud.yahoo.com via HTTP; Thu, 22 Dec 2005 16:23:36 GMT Date: Thu, 22 Dec 2005 16:23:36 +0000 (GMT) From: Carlos Benkendorf Subject: Re: ORDER BY costs To: Jan Dittmer , pgsql-performance@postgresql.org In-Reply-To: <43AA6879.6070601@sfhq.hn.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1876667760-1135268616=:8327" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.527 required=5 tests=[AWL=0.047, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.527 X-Spam-Level: X-Archive-Number: 200512/572 X-Sequence-Number: 16393 --0-1876667760-1135268616=:8327 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Jan Dittmer escreveu: What is your work_mem setting? I think the default is 1MB which is probably too low as your trying to sort roughly 150000*100Bytes = 15MB. Jan I think you would like to say 150000*896Bytes... Am I right? My default work_mem is 2048 and I changed to 200000... and pgsql_tmp directory is not used any more...but... Now the new numbers: Sort (cost=132929.22..133300.97 rows=148701 width=896) (actual time=3949.663..4029.618 rows=167710 loops=1) Sort Key: anocalc, cadastro, codvencto, parcela -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..120154.28 rows=148701 width=896) (actual time=0.166..829.260 rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: 4184.723 ms (5 rows) It is less than with work_mem set to 2000 but is it worthly? I�m afraind of swapping... are not those settings applied for all backends? Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-1876667760-1135268616=:8327 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

Jan Dittmer <jdittmer@sfhq.hn.org> escreveu:
What is your work_mem setting? I think the default is 1MB which is
probably too low as your trying to sort roughly 150000*100Bytes = 15MB.

Jan
I think you would like to say 150000*896Bytes... Am I right? My default work_mem is 2048 and I changed to 200000... and pgsql_tmp directory is not used any more...but...
 
Now the new numbers:
 
Sort  (cost=132929.22..133300.97 rows=148701 width=896) (actual time=3949.663..4029.618 rows=167710 loops=1)
   Sort Key: anocalc, cadastro, codvencto, parcela
   ->  Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..120154.28 rows=148701 width=896) (actual time=0.166..829.260 rows=1677 10 loops=1)
         Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
 Total runtime: 4184.723 ms
(5 rows)
 
It is less than with work_mem set to 2000 but is it worthly? I�m afraind of swapping... are not those settings applied for all backends?
 
Benkendorf
 
 


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-1876667760-1135268616=:8327-- From pgsql-performance-owner@postgresql.org Thu Dec 22 22:35:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EE1149DC837 for ; Thu, 22 Dec 2005 22:35:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13458-03 for ; Thu, 22 Dec 2005 22:35:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.151]) by postgresql.org (Postfix) with ESMTP id C9BEF9DCCD7 for ; Thu, 22 Dec 2005 22:35:27 -0400 (AST) Received: from lifebook.aspen (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc11) with ESMTP id <2005122302353001300c5cc7e>; Fri, 23 Dec 2005 02:35:30 +0000 From: Juan Casero To: pgsql-performance@postgresql.org Subject: Re: MySQL is faster than PgSQL but a large margin in Date: Thu, 22 Dec 2005 21:44:32 -0500 User-Agent: KMail/1.8.2 References: <43AAAB58.6050109@logix-tt.com> In-Reply-To: <43AAAB58.6050109@logix-tt.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512222144.32665.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.655 required=5 tests=[AWL=-0.664, DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 1.655 X-Spam-Level: * X-Archive-Number: 200512/574 X-Sequence-Number: 16395 Agreed. I have a 13 million row table that gets a 100,000 new records every week. There are six indexes on this table. Right about the time when it reached the 10 million row mark updating the table with new records started to take many hours if I left the indexes in place during the update. Indeed there was even some suspicion that the indexes were starting to get corrupted during the load. So I decided to fist drop the indexes when I needed to update the table. Now inserting 100,000 records into the table is nearly instantaneous although it does take me a couple of hours to build the indexes anew. This is still big improvement since at one time it was taking almost 12 hours to update the table with the indexes in place. Juan On Thursday 22 December 2005 08:34, Markus Schaber wrote: > Hi, Madison, > Hi, Luke, > > Luke Lonergan wrote: > > Note that indexes will also slow down loading. > > For large loading bunches, it often makes sense to temporarily drop the > indices before the load, and recreate them afterwards, at least, if you > don't have normal users accessing the database concurrently. > > Markus From pgsql-performance-owner@postgresql.org Thu Dec 22 23:16:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C578D9DCCD7 for ; Thu, 22 Dec 2005 23:16:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25389-01 for ; Thu, 22 Dec 2005 23:16:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id A2C159DC9BD for ; Thu, 22 Dec 2005 23:14:04 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id DA4231AC3E9; Thu, 22 Dec 2005 19:13:37 -0800 (PST) Date: Thu, 22 Dec 2005 19:12:30 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Juan Casero Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <200512212231.55100.caseroj@comcast.net> Message-ID: References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> 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, score=0.043 required=5 tests=[AWL=0.043] X-Spam-Score: 0.043 X-Spam-Level: X-Archive-Number: 200512/575 X-Sequence-Number: 16396 On Wed, 21 Dec 2005, Juan Casero wrote: > Date: Wed, 21 Dec 2005 22:31:54 -0500 > From: Juan Casero > To: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] What's the best hardver for PostgreSQL 8.1? > > Sorry folks. I had a couple of glasses of wine as I wrote this. Anyway I > originally wanted the box to have more than two drives so I could do RAID 5 > but that is going to cost too much. Also, contrary to my statement below it > seems to me I should run the 32 bit postgresql server on the 64 bit kernel. > Would you agree this will probably yield the best performance? you definantly need a 64 bit kernel to address as much ram as you will need. the question of 32 bit vs 64 bit postgres needs to be benchmarked, but my inclination is that you probably do want 64 bit for that as well. 64 bit binaries are slightly larger then 32 bit ones (less so on x86/AMD64 then on any other mixed platform though), but the 64 bit version also has access to twice as many registers as a 32 bit one, and the Opteron chips have some other features that become availabel in 64 bit mode (or more useful) like everything else this needs benchmarks to prove with your workload (I'm trying to get some started, but haven't had a chance yet) David Lang > I know it > depends alot on the system but for now this database is about 20 gigabytes. > Not too large right now but it may grow 5x in the next year. > > Thanks, > Juan > > On Wednesday 21 December 2005 22:09, Juan Casero wrote: >> I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz >> opterons, 2 Gigs of RAM and RAID 1. I would have liked a better server >> capable of RAID but that seems to be out of his budget right now. Ok so I >> assume I get this Sun box. Most likely I will go with Linux since it is a >> fair bet he doesn't want to pay for the Solaris 10 x86 license. Although I >> kind of like the idea of using Solaris 10 x86 for this. I will assume I >> need to install the x64 kernel that comes with say Fedora Core 4. Should I >> run the Postgresql 8.x binaries in 32 bit mode or 64 bit mode? My >> instinct tells me 64 bit mode is most efficient for our database size about >> 20 gigs right now but may grow to 100 gigs in a year or so. I just >> finished loading a 20 gig database on a dual 900 Mhz Ultrasparc III system >> with 2 gigs of ram and about 768 megs of shared memory available for the >> posgresql server running Solaris 10. The load has smoked a P4 3.2 Ghz >> system I am using also with 2 gigs of ram running postgresql 8.0.3. I >> mean I started the sparc load after the P4 load. The sparc load has >> finished already rebuilding the database from a pg_dump file but the P4 >> system is still going. The p4 has 1.3 Gigs of shared memory allocated to >> postgresql. How about them apples? >> >> >> Thanks, >> Juan >> >> On Wednesday 21 December 2005 18:57, William Yu wrote: >>> Juan Casero wrote: >>>> Can you elaborate on the reasons the opteron is better than the Xeon >>>> when it comes to disk io? I have a PostgreSQL 7.4.8 box running a >>>> DSS. One of our >>> >>> Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, >>> transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that >>> block and then the CPU must do extra work in copying the memory to > >>> 4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in the >>> background. >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 6: explain analyze is your friend >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 1: if posting/reading through Usenet, please send an appropriate >> subscribe-nomail command to majordomo@postgresql.org so that your >> message can get through to the mailing list cleanly > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Thu Dec 22 23:53:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 654629DCCF4 for ; Thu, 22 Dec 2005 23:53:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28509-06 for ; Thu, 22 Dec 2005 23:53:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id 5BC239DCCBB for ; Thu, 22 Dec 2005 23:52:58 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EpdzD-0001fh-00; Thu, 22 Dec 2005 22:52:55 -0500 To: Harry Jackson Cc: pgsql-performance@postgresql.org Subject: Re: CPU and RAM References: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> In-Reply-To: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 22 Dec 2005 22:52:54 -0500 Message-ID: <878xuc8o6h.fsf@stark.xeocode.com> Lines: 26 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.11 required=5 tests=[AWL=0.110] X-Spam-Score: 0.11 X-Spam-Level: X-Archive-Number: 200512/576 X-Sequence-Number: 16397 Harry Jackson writes: > At the moment everything is working OK but I am noticing an almost > linear increase in time to retrieve data from the database as the data > set increases in size. Clustering knocks the access times down by 25% > but it also knocks users off the website and can take up to 30 minutes > which is hardly an ideal scenario. If the whole database is in RAM I wouldn't expect clustering to have any effect. Either you're doing a lot of merge joins or a few other cases where clustering might be helping you, or the cluster is helping you keep more of the database in ram avoiding the occasional disk i/o. That said, I would agree with the others to not assume the plans for every query is ok. It's easy when the entire database fits in RAM to be fooled into thinking plans are ok because they're running quite fast but in fact have problems. In particular, if you have a query doing a sequential scan of some moderately large table (say a few thousand rows) then you may find the query executes reasonably fast when tested on its own but consumes enough cpu and memory bandwidth that when it's executed frequently in an OLTP setting it pegs the cpu at 100%. -- greg From pgsql-performance-owner@postgresql.org Fri Dec 23 00:00:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ADE709DC83E for ; Fri, 23 Dec 2005 00:00:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30141-05 for ; Fri, 23 Dec 2005 00:00:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.154]) by postgresql.org (Postfix) with ESMTP id 238D39DC807 for ; Fri, 23 Dec 2005 00:00:52 -0400 (AST) Received: from [192.168.1.21] (c-66-176-9-173.hsd1.fl.comcast.net[66.176.9.173]) by comcast.net (rwcrmhc14) with ESMTP id <20051223040051014008l6uje>; Fri, 23 Dec 2005 04:00:51 +0000 From: Juan Casero To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Thu, 22 Dec 2005 23:10:10 -0500 User-Agent: KMail/1.8.2 References: <43A84D03.7090002@ritek.hu> <200512212231.55100.caseroj@comcast.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512222310.10893.caseroj@comcast.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.688 required=5 tests=[AWL=-0.631, DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 1.688 X-Spam-Level: * X-Archive-Number: 200512/577 X-Sequence-Number: 16398 Ok thanks. I think I will go with 64 bit everything on the box. If I can get the Sun Fire V20Z then I will stick with Solaris 10 x86 and download the 64 bit PostgreSQL 8.1 binaries from blastwave.org. I develop the PHP code to my DSS system on my Windows XP laptop. Normally, I test the code on this laptop but let it hit the live database when I want to run some tests. Well just this afternoon I installed PostgreSQL 8.1.1 on my windows laptop and rebuilt the the entire live database instance on there from a pg_dump archive. I am blown away by the performance increase in PostgreSQL 8.1.x. Has anyone else had a chance to test it? All the queries I run against it are remarkably fast but more importantly I can see that the two cores of my Hyper Threaded P4 are being used. One of the questions I posted on this list was whether PostgreSQL could make use of the large number of cores available on the Ultrasparc T1000/T2000 cores. I am beginning to think that with PostgreSQL 8.1.x the buffer manager could indeed use all those cores. This could make running a DSS or OLTP on an Ultrasparc T1000/T2000 with PostgreSQL a much better bargain than on an intel system. Any thoughts? Thanks, Juan On Thursday 22 December 2005 22:12, David Lang wrote: > On Wed, 21 Dec 2005, Juan Casero wrote: > > Date: Wed, 21 Dec 2005 22:31:54 -0500 > > From: Juan Casero > > To: pgsql-performance@postgresql.org > > Subject: Re: [PERFORM] What's the best hardver for PostgreSQL 8.1? > > > > Sorry folks. I had a couple of glasses of wine as I wrote this. Anyway > > I originally wanted the box to have more than two drives so I could do > > RAID 5 but that is going to cost too much. Also, contrary to my > > statement below it seems to me I should run the 32 bit postgresql server > > on the 64 bit kernel. Would you agree this will probably yield the best > > performance? > > you definantly need a 64 bit kernel to address as much ram as you will > need. > > the question of 32 bit vs 64 bit postgres needs to be benchmarked, but my > inclination is that you probably do want 64 bit for that as well. > > 64 bit binaries are slightly larger then 32 bit ones (less so on x86/AMD64 > then on any other mixed platform though), but the 64 bit version also has > access to twice as many registers as a 32 bit one, and the Opteron chips > have some other features that become availabel in 64 bit mode (or more > useful) > > like everything else this needs benchmarks to prove with your workload > (I'm trying to get some started, but haven't had a chance yet) > > David Lang > > > I know it > > depends alot on the system but for now this database is about 20 > > gigabytes. Not too large right now but it may grow 5x in the next year. > > > > Thanks, > > Juan > > > > On Wednesday 21 December 2005 22:09, Juan Casero wrote: > >> I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz > >> opterons, 2 Gigs of RAM and RAID 1. I would have liked a better server > >> capable of RAID but that seems to be out of his budget right now. Ok so > >> I assume I get this Sun box. Most likely I will go with Linux since it > >> is a fair bet he doesn't want to pay for the Solaris 10 x86 license. > >> Although I kind of like the idea of using Solaris 10 x86 for this. I > >> will assume I need to install the x64 kernel that comes with say Fedora > >> Core 4. Should I run the Postgresql 8.x binaries in 32 bit mode or 64 > >> bit mode? My instinct tells me 64 bit mode is most efficient for our > >> database size about 20 gigs right now but may grow to 100 gigs in a year > >> or so. I just finished loading a 20 gig database on a dual 900 Mhz > >> Ultrasparc III system with 2 gigs of ram and about 768 megs of shared > >> memory available for the posgresql server running Solaris 10. The load > >> has smoked a P4 3.2 Ghz system I am using also with 2 gigs of ram > >> running postgresql 8.0.3. I mean I started the sparc load after the P4 > >> load. The sparc load has finished already rebuilding the database from > >> a pg_dump file but the P4 system is still going. The p4 has 1.3 Gigs of > >> shared memory allocated to postgresql. How about them apples? > >> > >> > >> Thanks, > >> Juan > >> > >> On Wednesday 21 December 2005 18:57, William Yu wrote: > >>> Juan Casero wrote: > >>>> Can you elaborate on the reasons the opteron is better than the Xeon > >>>> when it comes to disk io? I have a PostgreSQL 7.4.8 box running a > >>>> DSS. One of our > >>> > >>> Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, > >>> transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that > >>> block and then the CPU must do extra work in copying the memory to > > >>> 4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in > >>> the background. > >>> > >>> ---------------------------(end of > >>> broadcast)--------------------------- TIP 6: explain analyze is your > >>> friend > >> > >> ---------------------------(end of broadcast)--------------------------- > >> TIP 1: if posting/reading through Usenet, please send an appropriate > >> subscribe-nomail command to majordomo@postgresql.org so that your > >> message can get through to the mailing list cleanly > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 2: Don't 'kill -9' the postmaster > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Fri Dec 23 00:18:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C13F39DC83E for ; Fri, 23 Dec 2005 00:18:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30076-08 for ; Fri, 23 Dec 2005 00:18:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (unknown [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 660889DC9F0 for ; Fri, 23 Dec 2005 00:16:33 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 444A61AC3E9; Thu, 22 Dec 2005 20:16:01 -0800 (PST) Date: Thu, 22 Dec 2005 20:14:53 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Juan Casero Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <200512222310.10893.caseroj@comcast.net> Message-ID: References: <43A84D03.7090002@ritek.hu> <200512212231.55100.caseroj@comcast.net> <200512222310.10893.caseroj@comcast.net> 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, score=0.048 required=5 tests=[AWL=0.048] X-Spam-Score: 0.048 X-Spam-Level: X-Archive-Number: 200512/578 X-Sequence-Number: 16399 On Thu, 22 Dec 2005, Juan Casero wrote: > Ok thanks. I think I will go with 64 bit everything on the box. If I can get > the Sun Fire V20Z then I will stick with Solaris 10 x86 and download the 64 > bit PostgreSQL 8.1 binaries from blastwave.org. I develop the PHP code to > my DSS system on my Windows XP laptop. Normally, I test the code on this > laptop but let it hit the live database when I want to run some tests. Well > just this afternoon I installed PostgreSQL 8.1.1 on my windows laptop and > rebuilt the the entire live database instance on there from a pg_dump > archive. I am blown away by the performance increase in PostgreSQL 8.1.x. > Has anyone else had a chance to test it? All the queries I run against it > are remarkably fast but more importantly I can see that the two cores of my > Hyper Threaded P4 are being used. One of the questions I posted on this > list was whether PostgreSQL could make use of the large number of cores > available on the Ultrasparc T1000/T2000 cores. I am beginning to think that > with PostgreSQL 8.1.x the buffer manager could indeed use all those cores. > This could make running a DSS or OLTP on an Ultrasparc T1000/T2000 with > PostgreSQL a much better bargain than on an intel system. Any thoughts? if you have enough simultanious transactions, and your I/O systems (disk and memory interfaces) can keep up with your needs then postgres can use quite a few cores. there are some limits that will show up with more cores, but I don't think it's well known where they are (this will also be very dependant on your workload as well). there was the discussion within the last month or two that hit the postgres weekly news where more attention is being paied to the locking mechanisms used so this is an area under active development (note especially that some locking strategies that work well with multiple full cores can be crippling with virtual cores (Intel HT etc). but it boils down to the fact that there just isn't enough experiance with the new sun systems to know how well they will work. they could end up being fabulous speed demons, or dogs (and it could even be both, depending on your workload) David Lang > Thanks, > Juan > > On Thursday 22 December 2005 22:12, David Lang wrote: >> On Wed, 21 Dec 2005, Juan Casero wrote: >>> Date: Wed, 21 Dec 2005 22:31:54 -0500 >>> From: Juan Casero >>> To: pgsql-performance@postgresql.org >>> Subject: Re: [PERFORM] What's the best hardver for PostgreSQL 8.1? >>> >>> Sorry folks. I had a couple of glasses of wine as I wrote this. Anyway >>> I originally wanted the box to have more than two drives so I could do >>> RAID 5 but that is going to cost too much. Also, contrary to my >>> statement below it seems to me I should run the 32 bit postgresql server >>> on the 64 bit kernel. Would you agree this will probably yield the best >>> performance? >> >> you definantly need a 64 bit kernel to address as much ram as you will >> need. >> >> the question of 32 bit vs 64 bit postgres needs to be benchmarked, but my >> inclination is that you probably do want 64 bit for that as well. >> >> 64 bit binaries are slightly larger then 32 bit ones (less so on x86/AMD64 >> then on any other mixed platform though), but the 64 bit version also has >> access to twice as many registers as a 32 bit one, and the Opteron chips >> have some other features that become availabel in 64 bit mode (or more >> useful) >> >> like everything else this needs benchmarks to prove with your workload >> (I'm trying to get some started, but haven't had a chance yet) >> >> David Lang >> >>> I know it >>> depends alot on the system but for now this database is about 20 >>> gigabytes. Not too large right now but it may grow 5x in the next year. >>> >>> Thanks, >>> Juan >>> >>> On Wednesday 21 December 2005 22:09, Juan Casero wrote: >>>> I just sent my boss an email asking him for a Sun v20z with dual 2.2 Ghz >>>> opterons, 2 Gigs of RAM and RAID 1. I would have liked a better server >>>> capable of RAID but that seems to be out of his budget right now. Ok so >>>> I assume I get this Sun box. Most likely I will go with Linux since it >>>> is a fair bet he doesn't want to pay for the Solaris 10 x86 license. >>>> Although I kind of like the idea of using Solaris 10 x86 for this. I >>>> will assume I need to install the x64 kernel that comes with say Fedora >>>> Core 4. Should I run the Postgresql 8.x binaries in 32 bit mode or 64 >>>> bit mode? My instinct tells me 64 bit mode is most efficient for our >>>> database size about 20 gigs right now but may grow to 100 gigs in a year >>>> or so. I just finished loading a 20 gig database on a dual 900 Mhz >>>> Ultrasparc III system with 2 gigs of ram and about 768 megs of shared >>>> memory available for the posgresql server running Solaris 10. The load >>>> has smoked a P4 3.2 Ghz system I am using also with 2 gigs of ram >>>> running postgresql 8.0.3. I mean I started the sparc load after the P4 >>>> load. The sparc load has finished already rebuilding the database from >>>> a pg_dump file but the P4 system is still going. The p4 has 1.3 Gigs of >>>> shared memory allocated to postgresql. How about them apples? >>>> >>>> >>>> Thanks, >>>> Juan >>>> >>>> On Wednesday 21 December 2005 18:57, William Yu wrote: >>>>> Juan Casero wrote: >>>>>> Can you elaborate on the reasons the opteron is better than the Xeon >>>>>> when it comes to disk io? I have a PostgreSQL 7.4.8 box running a >>>>>> DSS. One of our >>>>> >>>>> Opterons have 64-bit IOMMU -- Xeons don't. That means in 64-bit mode, >>>>> transfers to > 4GB, the OS must allocated the memory < 4GB, DMA to that >>>>> block and then the CPU must do extra work in copying the memory to > >>>>> 4GB. Versus on the Opteron, it's done by the IO adaptor using DMA in >>>>> the background. >>>>> >>>>> ---------------------------(end of >>>>> broadcast)--------------------------- TIP 6: explain analyze is your >>>>> friend >>>> >>>> ---------------------------(end of broadcast)--------------------------- >>>> TIP 1: if posting/reading through Usenet, please send an appropriate >>>> subscribe-nomail command to majordomo@postgresql.org so that your >>>> message can get through to the mailing list cleanly >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 2: Don't 'kill -9' the postmaster >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 2: Don't 'kill -9' the postmaster > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Fri Dec 23 00:28:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 44F4C9DCBE5 for ; Fri, 23 Dec 2005 00:28:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31737-09 for ; Fri, 23 Dec 2005 00:28:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 8484C9DCBC3 for ; Fri, 23 Dec 2005 00:28:41 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 8356A33A68; Fri, 23 Dec 2005 05:28:40 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: CPU and RAM Date: Thu, 22 Dec 2005 23:29:42 -0500 Organization: Hub.Org Networking Services Lines: 24 Message-ID: References: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> <878xuc8o6h.fsf@stark.xeocode.com> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.133 required=5 tests=[AWL=0.133] X-Spam-Score: 0.133 X-Spam-Level: X-Archive-Number: 200512/579 X-Sequence-Number: 16400 "Greg Stark" wrote > > If the whole database is in RAM I wouldn't expect clustering to have any > effect. Either you're doing a lot of merge joins or a few other cases > where > clustering might be helping you, or the cluster is helping you keep more > of > the database in ram avoiding the occasional disk i/o. > Hi Greg, At first I think the same - notice that Tom has submitted a patch to scan a whole page in one run, so if Harry tests against the cvs tip, he could see the real benefits. For example, a index scan may touch 5000 tuples, which involves 5000 pairs of lock/unlock buffer, no matter how the tuples are distributed. After the patch, if the tuples belong to a few pages, then a significant number of lock/unlock are avoided. Regards, Qingqing From pgsql-performance-owner@postgresql.org Fri Dec 23 05:02:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 552EC9DC84E for ; Fri, 23 Dec 2005 05:02:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98594-09 for ; Fri, 23 Dec 2005 05:02:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gw7.hlebprom.ru (unknown [62.148.250.13]) by postgresql.org (Postfix) with ESMTP id 52F739DC810 for ; Fri, 23 Dec 2005 05:01:58 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by gw7.hlebprom.ru (Postfix) with ESMTP id C835AAB175 for ; Fri, 23 Dec 2005 14:02:16 +0500 (YEKT) Received: from gw7.hlebprom.ru ([127.0.0.1]) by localhost (gw7.hlebprom.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29665-08 for ; Fri, 23 Dec 2005 14:02:15 +0500 (YEKT) Received: from [10.0.0.2] (unknown [212.57.174.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by gw7.hlebprom.ru (Postfix) with ESMTP for ; Fri, 23 Dec 2005 14:02:15 +0500 (YEKT) Date: Fri, 23 Dec 2005 14:02:05 +0500 From: Anton Maksimenkov X-Mailer: The Bat! (v3.0) Professional Reply-To: Anton Maksimenkov X-Priority: 3 (Normal) Message-ID: <287988431.20051223140205@hlebprom.ru> To: pgsql-performance@postgresql.org Subject: DELETE, INSERT vs SELECT, UPDATE || INSERT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hlebprom.ru X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.275 required=5 tests=[AWL=0.275] X-Spam-Score: 0.275 X-Spam-Level: X-Archive-Number: 200512/580 X-Sequence-Number: 16401 Hi, all. While working on algorithm of my project I came to question. Let it be table like this (user+cookie pair is the primary key). INT user INT cookie INT count Periodically (with period 10 minutes) this PostgreSQL table updated with my information. The main problem that some of pairs (user, cookie) may be already exists in PostgreSQL and must be updated, some not exists and must be inserted. My first way was to DELETE row with (user, cookie) pair which I'm going to update then INSERT new. This guarantees that there will not be an error when (user, cookie) pair already exists in table. And currently it works by this way. But I think that it lead to highly fragmentation of table and it need to be VACUUMED and ANALYZED far more frequently... Second idea was to try to SELECT (user, cookie) pair and then UPDATE it if it exists or INSERT if not. I has thought that if UPDATE will rewrite same place in file with new count it may lead to more compact table (file not grow and information about actual rows in file will not changed). And, if actual file blocks containing (user, cookie) pair will not be moved to new place in file, table need to be ANALYZED less frequently. But if UPDATE will actually insert new row in file, marking as 'free to use' previous block in file which was contain previous version of row, then again, table need to be VACUUMED and ANALYZED far more frequently... And this second idea will be completely waste of time and code. Because write on C code which "DELETE and INSERT" is more portably than "SELECT than UPDATE if there are rows, or INSERT if there are not". So, can anyone explain me is the actual mechanism of UPDATE can save resources and tables from been highly fragmented? Or it gives same results and problems and "DELETE then INSERT" is the best way? -- engineer From pgsql-performance-owner@postgresql.org Fri Dec 23 08:34:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 034DE9DC805 for ; Fri, 23 Dec 2005 08:34:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62341-02 for ; Fri, 23 Dec 2005 08:34:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35507.mail.mud.yahoo.com (web35507.mail.mud.yahoo.com [66.163.179.131]) by postgresql.org (Postfix) with SMTP id 5535B9DC808 for ; Fri, 23 Dec 2005 08:34:36 -0400 (AST) Received: (qmail 69720 invoked by uid 60001); 23 Dec 2005 12:34:39 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=1DAlfeFGHxMxxGvUYYNwO9CFCQdfX4AFftfzuxz5+Q7msLLP4vlPwKzTvTp/gbbmwH+bSEoaIccPYrKXQyqKON+VEGdvP0VrelUrqhxjE2BIUxdWdv2qIbS1OnM4A+mFMNANJZQg94VcNqJJ4MSeMluRxGYKPnbhkC+zIm1INrs= ; Message-ID: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> Received: from [201.2.222.140] by web35507.mail.mud.yahoo.com via HTTP; Fri, 23 Dec 2005 12:34:39 GMT Date: Fri, 23 Dec 2005 12:34:39 +0000 (GMT) From: Carlos Benkendorf Subject: Order by behaviour To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-456538433-1135341279=:59996" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.432 required=5 tests=[AWL=-0.048, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.432 X-Spam-Level: X-Archive-Number: 200512/581 X-Sequence-Number: 16402 --0-456538433-1135341279=:59996 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, We have more than 200 customers running 8.0.3 and two weeks ago started migration project to 8.1.1.After the first migration to 8.1.1 we had to return back to 8.0.3 because some applications were not working right. Our user told me that records are not returning more in the correct order, so I started logging and saw that the select clause wasn�t not used with the ORDER BY clause. It seemed a simple problem to be solved. I asked the programmers that they should add the ORDER BY clause if they need the rows in a certain order and they told me they could not do it because it will cost too much and the response time is bigger than not using ORDER BY. I disagreed with them because there was an index with the same order needed for the order by. Before starting a figth we decided to explain analyze both select types and discover who was right. For my surprise the select with order by was really more expensive than the select without the order by. I will not bet any more...;-) For some implementation reason in 8.0.3 the query is returning the rows in the correct order even without the order by but in 8.1.1 probably the implementation changed and the rows are not returning in the correct order. We need the 8.1 for other reasons but this order by behavior stopped the migration project. Some friends of the list tried to help us and I did some configuration changes like increased work_mem and changed the primary columns from numeric types to smallint/integer/bigint but even so the runtime and costs are far from the ones from the selects without the ORDER BY clause. What I can not understand is why the planner is not using the same retrieving method with the order by clause as without the order by clause. All the rows are retrieved in the correct order in both methods but one is much cheaper (without order by) than the other (with order by). Should not the planner choice that one? Can someone explain me why the planner is not choosing the same method used with the selects without the order by clause instead of using a sort that is much more expensive? Without order by: explain analyze SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO = 00 and PARCELA >= 00 ) or (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO > 00 ) or (ANOCALC = 2005 and CADASTRO > 19 ) or (ANOCALC > 2005 ); Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..122255.35 rows=146602 width=897) (actual time=9.303..1609.987 rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: 1712.456 ms (3 rows) With order by: explain analyze SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO = 00 and PARCELA >= 00 ) or (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO > 00 ) or (ANOCALC = 2005 and CADASTRO > 19 ) or (ANOCALC > 2005 ) order by ANOCALC asc, CADASTRO asc, CODVENCTO asc, PARCELA asc; Sort (cost=201296.59..201663.10 rows=146602 width=897) (actual time=9752.555..10342.363 rows=167710 loops=1) Sort Key: anocalc, cadastro, codvencto, parcela -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..122255.35 rows=146602 width=897) (actual time=0.402..1425.085 rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: 10568.290 ms (5 rows) Table definition: Table "iparq.arript" Column | Type | Modifiers -------------------+-----------------------+----------- anocalc | numeric(4,0) | not null cadastro | numeric(8,0) | not null codvencto | numeric(2,0) | not null parcela | numeric(2,0) | not null inscimob | character varying(18) | not null codvencto2 | numeric(2,0) | not null parcela2 | numeric(2,0) | not null codpropr | numeric(10,0) | not null dtaven | numeric(8,0) | not null anocalc2 | numeric(4,0) | ... ... Indexes: "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela) "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela) "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2) "iarchave03" btree (codpropr, dtaven) "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2) Best regards and thank you very much in advance, Carlos Benkendorf --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-456538433-1135341279=:59996 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi,
 
We have more than 200 customers running 8.0.3 and two weeks ago started migration project to 8.1.1.After the first migration to 8.1.1 we had to return back to 8.0.3 because some applications were not working right.
 
Our user told me that records are not returning more in the correct order, so I started logging and saw that the select clause wasn�t not used with the ORDER BY clause. It seemed a simple problem to be solved.
 
I asked the programmers that they should add the ORDER BY clause if they need the rows in a certain order and they told me they could not do it because it will cost too much and the response time is bigger than not using ORDER BY. I disagreed with them because there was an index with the same order needed for the order by. Before starting a figth we decided to explain analyze both select types and discover who was right. For my surprise the sele ct with order by was really more expensive than the select without the order by. I will not bet any more...;-)
 
For some implementation reason in 8.0.3 the query is returning the rows in the correct order even without the order by but in 8.1.1 probably the implementation changed and the rows are not returning in the correct order.
 
We need the 8.1 for other reasons but this order by behavior stopped the migration project.
 
Some friends of the list tried to help us and I did some configuration changes like increased work_mem and changed the primary columns from numeric types to smallint/integer/bigint but even so the runtime and costs are far from the ones from the selects without the ORDER BY clause.
 
What I can not understand is why the planner is not using the same retrieving method with the order by clause as without the order by clause. All the rows are retriev ed in the correct order in both methods but one is much cheaper (without order by) than the other (with order by). Should not the planner choice that one?
 
Can someone explain me why the planner is not choosing the same method used with the selects without the order by clause instead of using a sort that is much more expensive?
 
Without order by:
explain analyze
SELECT * FROM iparq.ARRIPT
where
(ANOCALC =  2005
and CADASTRO =  19
and CODVENCTO =  00
and PARCELA >=  00 )
or
(ANOCALC =  2005
and CADASTRO =  19
and CODVENCTO >  00 )
or
(ANOCALC =  2005
and CADASTRO >  19 )
or
(ANOCALC >  2005 );
 Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..122255.35 rows=146602 width=897) (actual time=9.303..1609.987 rows=167710 loops=1)
   Index Cond: (((anocal c = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
 Total runtime: 1712.456 ms
(3 rows)
 
 
With order by:
explain analyze
SELECT * FROM iparq.ARRIPT
where
(ANOCALC =  2005
and CADASTRO =  19
and CODVENCTO =  00
and PARCELA >=  00 )
or
(ANOCALC =  2005
and CADASTRO =  19
and CODVENCTO >  00 )
or
(ANOCALC =  2005
and CADASTRO >  19 )
or
(ANOCALC >  2005 )
order by ANOCALC asc, CADASTRO asc, CODVENCTO asc, PARCELA asc;
 Sort  (cost=201296.59..201663.10 rows=146602 width=897) (actual time=9752.555..10342.363 rows=167710 loops=1)
   Sort Key: anocalc, cadastro, codven cto, parcela
   ->  Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript  (cost=0.00..122255.35 rows=146602 width=897) (actual time=0.402..1425.085 rows=167710 loops=1)
         Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
 Total runtime: 10568.290 ms
(5 rows)
 
Table definition:
                 Table "iparq.arript"
      Column       |         Type          | Modifiers
-------------------+-----------------------+-----------
 anocalc           | numeric(4,0)          | not null
 cadastro          | numeric(8,0)          | not null
 codvencto         | numeric(2,0)          | not null
 parcela           | numeric(2,0)          | not null
 inscimob          | character varying(18) | not null
 codvencto2        | numeric(2,0)          | not null
 parcela2          | numeric(2,0)          | not null
 codpropr          | numeric(10,0)         | not null
 dtaven            | numeric(8,0)          | not null
 anocalc2          | numeric(4,0)          |
...
...
Indexes:
    "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela)
    "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela)
    "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2)
    "iarchave03" btree (codpropr, dtaven)
    "iarcha ve05" btree (anocalc, inscimob, codvencto2, parcela2)
 
Best regards and thank you very much in advance,
 
Carlos Benkendorf
 


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-456538433-1135341279=:59996-- From pgsql-performance-owner@postgresql.org Fri Dec 23 08:51:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2FD8D9DC805 for ; Fri, 23 Dec 2005 08:51:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62952-09 for ; Fri, 23 Dec 2005 08:51:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id 9FE7D9DC80A for ; Fri, 23 Dec 2005 08:51:02 -0400 (AST) Received: from loki.icomedias.com ([10.192.17.128]) by relay.icomedias.com (8.13.4/8.13.4) with ESMTP id jBNCp5MI007072; Fri, 23 Dec 2005 13:51:05 +0100 From: Mario Weilguni To: pgsql-performance@postgresql.org Subject: Re: Order by behaviour Date: Fri, 23 Dec 2005 13:51:12 +0100 User-Agent: KMail/1.9 Cc: Carlos Benkendorf References: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> In-Reply-To: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200512231351.12424.mweilguni@sime.com> X-Scanned-By: MIMEDefang 2.54 on 10.192.64.200 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.103 required=5 tests=[AWL=0.103] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200512/582 X-Sequence-Number: 16403 I think whatever the reasons for the different query plans are (and if that= =20 can be fixed) - you CANNOT assume that data comes in sorted order when you = do=20 not use order by. Thats what every database does this way. So, use order by= ,=20 or you'll be in trouble sooner or later. Best regards, Mario Weilguni Am Freitag, 23. Dezember 2005 13:34 schrieb Carlos Benkendorf: > Hi, > > We have more than 200 customers running 8.0.3 and two weeks ago started > migration project to 8.1.1.After the first migration to 8.1.1 we had to > return back to 8.0.3 because some applications were not working right. > > Our user told me that records are not returning more in the correct > order, so I started logging and saw that the select clause wasn=B4t not u= sed > with the ORDER BY clause. It seemed a simple problem to be solved. > > I asked the programmers that they should add the ORDER BY clause if they > need the rows in a certain order and they told me they could not do it > because it will cost too much and the response time is bigger than not > using ORDER BY. I disagreed with them because there was an index with the > same order needed for the order by. Before starting a figth we decided to > explain analyze both select types and discover who was right. For my > surprise the select with order by was really more expensive than the sele= ct > without the order by. I will not bet any more...;-) > > For some implementation reason in 8.0.3 the query is returning the rows > in the correct order even without the order by but in 8.1.1 probably the > implementation changed and the rows are not returning in the correct orde= r. > > We need the 8.1 for other reasons but this order by behavior stopped the > migration project. > > Some friends of the list tried to help us and I did some configuration > changes like increased work_mem and changed the primary columns from > numeric types to smallint/integer/bigint but even so the runtime and costs > are far from the ones from the selects without the ORDER BY clause. > > What I can not understand is why the planner is not using the same > retrieving method with the order by clause as without the order by clause. > All the rows are retrieved in the correct order in both methods but one is > much cheaper (without order by) than the other (with order by). Should not > the planner choice that one? > > Can someone explain me why the planner is not choosing the same method > used with the selects without the order by clause instead of using a sort > that is much more expensive? > > Without order by: > explain analyze > SELECT * FROM iparq.ARRIPT > where > (ANOCALC =3D 2005 > and CADASTRO =3D 19 > and CODVENCTO =3D 00 > and PARCELA >=3D 00 ) > or > (ANOCALC =3D 2005 > and CADASTRO =3D 19 > and CODVENCTO > 00 ) > or > (ANOCALC =3D 2005 > and CADASTRO > 19 ) > or > (ANOCALC > 2005 ); > Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript=20 > (cost=3D0.00..122255.35 rows=3D146602 width=3D897) (actual time=3D9.303..= 1609.987 > rows=3D167710 loops=3D1) Index Cond: (((anocalc =3D 2005::numeric) AND (c= adastro > =3D 19::numeric) AND (codvencto =3D 0::numeric) AND (parcela >=3D 0::nume= ric)) OR > ((anocalc =3D 2005::numeric) AND (cadastro =3D 19::numeric) AND (codvenct= o > > 0::numeric)) OR ((anocalc =3D 2005::numeric) AND (cadastro > 19::numeric)= ) OR > (anocalc > 2005::numeric)) Total runtime: 1712.456 ms > (3 rows) > > > With order by: > explain analyze > SELECT * FROM iparq.ARRIPT > where > (ANOCALC =3D 2005 > and CADASTRO =3D 19 > and CODVENCTO =3D 00 > and PARCELA >=3D 00 ) > or > (ANOCALC =3D 2005 > and CADASTRO =3D 19 > and CODVENCTO > 00 ) > or > (ANOCALC =3D 2005 > and CADASTRO > 19 ) > or > (ANOCALC > 2005 ) > order by ANOCALC asc, CADASTRO asc, CODVENCTO asc, PARCELA asc; > Sort (cost=3D201296.59..201663.10 rows=3D146602 width=3D897) (actual > time=3D9752.555..10342.363 rows=3D167710 loops=3D1) Sort Key: anocalc, ca= dastro, > codvencto, parcela > -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on > arript (cost=3D0.00..122255.35 rows=3D146602 width=3D897) (actual > time=3D0.402..1425.085 rows=3D167710 loops=3D1) Index Cond: (((anocalc =3D > 2005::numeric) AND (cadastro =3D 19::numeric) AND (codvencto =3D 0::numer= ic) > AND (parcela >=3D 0::numeric)) OR ((anocalc =3D 2005::numeric) AND (cadas= tro =3D > 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc =3D 2005::numeric) > AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: > 10568.290 ms > (5 rows) > > Table definition: > Table "iparq.arript" > Column | Type | Modifiers > -------------------+-----------------------+----------- > anocalc | numeric(4,0) | not null > cadastro | numeric(8,0) | not null > codvencto | numeric(2,0) | not null > parcela | numeric(2,0) | not null > inscimob | character varying(18) | not null > codvencto2 | numeric(2,0) | not null > parcela2 | numeric(2,0) | not null > codpropr | numeric(10,0) | not null > dtaven | numeric(8,0) | not null > anocalc2 | numeric(4,0) | > ... > ... > Indexes: > "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela) > "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela) > "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2) > "iarchave03" btree (codpropr, dtaven) > "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2) > > Best regards and thank you very much in advance, > > Carlos Benkendorf > > > > --------------------------------- > Yahoo! doce lar. Fa=E7a do Yahoo! sua homepage. From pgsql-performance-owner@postgresql.org Fri Dec 23 09:32:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 037859DC9F0 for ; Fri, 23 Dec 2005 09:32:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70978-02 for ; Fri, 23 Dec 2005 09:32:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35507.mail.mud.yahoo.com (web35507.mail.mud.yahoo.com [66.163.179.131]) by postgresql.org (Postfix) with SMTP id 2900F9DC955 for ; Fri, 23 Dec 2005 09:32:31 -0400 (AST) Received: (qmail 88431 invoked by uid 60001); 23 Dec 2005 13:32:35 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Rn5Wa1ytC2HLZ8Cy8EfZ59ML7xHMDwF/xebt5/SR/ocTTWaHa7ZOawlj0AXITddieNh+s332pAsM+Yw/iHUU3a0PPypilq/2WT216ktNJDHCmW/azqj/oEJo1BRyELE9g0Hipcyc75QxP4PfST9/MPg7LU4JKpvKzOnLJEgOFZk= ; Message-ID: <20051223133235.88429.qmail@web35507.mail.mud.yahoo.com> Received: from [201.2.222.140] by web35507.mail.mud.yahoo.com via HTTP; Fri, 23 Dec 2005 13:32:35 GMT Date: Fri, 23 Dec 2005 13:32:35 +0000 (GMT) From: Carlos Benkendorf Subject: Re: Order by behaviour To: pgsql-performance@postgresql.org In-Reply-To: <200512231351.12424.mweilguni@sime.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-921445132-1135344755=:86862" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.918 required=5 tests=[AWL=-0.507, DNS_FROM_RFC_ABUSE=0.479, HTML_10_20=0.945, HTML_MESSAGE=0.001] X-Spam-Score: 0.918 X-Spam-Level: X-Archive-Number: 200512/583 X-Sequence-Number: 16404 --0-921445132-1135344755=:86862 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit We agree completely with you and that is what we are doing right now. But what I would like is really understand the reason for this behavior and be sure we can not do anything more to improve the runtimes. Benkendorf Mario Weilguni escreveu: I think whatever the reasons for the different query plans are (and if that can be fixed) - you CANNOT assume that data comes in sorted order when you do not use order by. Thats what every database does this way. So, use order by, or you'll be in trouble sooner or later. Best regards, Mario Weilguni Am Freitag, 23. Dezember 2005 13:34 schrieb Carlos Benkendorf: > Hi, > > We have more than 200 customers running 8.0.3 and two weeks ago started > migration project to 8.1.1.After the first migration to 8.1.1 we had to > return back to 8.0.3 because some applications were not working right. > > Our user told me that records are not returning more in the correct > order, so I started logging and saw that the select clause wasn�t not used > with the ORDER BY clause. It seemed a simple problem to be solved. > > I asked the programmers that they should add the ORDER BY clause if they > need the rows in a certain order and they told me they could not do it > because it will cost too much and the response time is bigger than not > using ORDER BY. I disagreed with them because there was an index with the > same order needed for the order by. Before starting a figth we decided to > explain analyze both select types and discover who was right. For my > surprise the select with order by was really more expensive than the select > without the order by. I will not bet any more...;-) > > For some implementation reason in 8.0.3 the query is returning the rows > in the correct order even without the order by but in 8.1.1 probably the > implementation changed and the rows are not returning in the correct order. > > We need the 8.1 for other reasons but this order by behavior stopped the > migration project. > > Some friends of the list tried to help us and I did some configuration > changes like increased work_mem and changed the primary columns from > numeric types to smallint/integer/bigint but even so the runtime and costs > are far from the ones from the selects without the ORDER BY clause. > > What I can not understand is why the planner is not using the same > retrieving method with the order by clause as without the order by clause. > All the rows are retrieved in the correct order in both methods but one is > much cheaper (without order by) than the other (with order by). Should not > the planner choice that one? > > Can someone explain me why the planner is not choosing the same method > used with the selects without the order by clause instead of using a sort > that is much more expensive? > > Without order by: > explain analyze > SELECT * FROM iparq.ARRIPT > where > (ANOCALC = 2005 > and CADASTRO = 19 > and CODVENCTO = 00 > and PARCELA >= 00 ) > or > (ANOCALC = 2005 > and CADASTRO = 19 > and CODVENCTO > 00 ) > or > (ANOCALC = 2005 > and CADASTRO > 19 ) > or > (ANOCALC > 2005 ); > Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript > (cost=0.00..122255.35 rows=146602 width=897) (actual time=9.303..1609.987 > rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro > = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR > ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR > (anocalc > 2005::numeric)) Total runtime: 1712.456 ms > (3 rows) > > > With order by: > explain analyze > SELECT * FROM iparq.ARRIPT > where > (ANOCALC = 2005 > and CADASTRO = 19 > and CODVENCTO = 00 > and PARCELA >= 00 ) > or > (ANOCALC = 2005 > and CADASTRO = 19 > and CODVENCTO > 00 ) > or > (ANOCALC = 2005 > and CADASTRO > 19 ) > or > (ANOCALC > 2005 ) > order by ANOCALC asc, CADASTRO asc, CODVENCTO asc, PARCELA asc; > Sort (cost=201296.59..201663.10 rows=146602 width=897) (actual > time=9752.555..10342.363 rows=167710 loops=1) Sort Key: anocalc, cadastro, > codvencto, parcela > -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on > arript (cost=0.00..122255.35 rows=146602 width=897) (actual > time=0.402..1425.085 rows=167710 loops=1) Index Cond: (((anocalc = > 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) > AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = > 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) > AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime: > 10568.290 ms > (5 rows) > > Table definition: > Table "iparq.arript" > Column | Type | Modifiers > -------------------+-----------------------+----------- > anocalc | numeric(4,0) | not null > cadastro | numeric(8,0) | not null > codvencto | numeric(2,0) | not null > parcela | numeric(2,0) | not null > inscimob | character varying(18) | not null > codvencto2 | numeric(2,0) | not null > parcela2 | numeric(2,0) | not null > codpropr | numeric(10,0) | not null > dtaven | numeric(8,0) | not null > anocalc2 | numeric(4,0) | > ... > ... > Indexes: > "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela) > "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela) > "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2) > "iarchave03" btree (codpropr, dtaven) > "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2) > > Best regards and thank you very much in advance, > > Carlos Benkendorf > > > > --------------------------------- > Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-921445132-1135344755=:86862 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
We agree completely with you and that is what we are doing right now.
 
But what I would like is really understand the reason for this behavior and be sure we can not do anything more to improve the runtimes.
 
Benkendorf


Mario Weilguni <mweilguni@sime.com> escreveu:
I think whatever the reasons for the different query plans are (and if that
can be fixed) - you CANNOT assume that data comes in sorted order when you do
not use order by. Thats what every database does this way. So, use order by,
or you'll be in trouble sooner or later.

Best regards,
Mario Weilguni


Am Freitag, 23. Dezember 2005 13:34 schrieb Carlos Benkendorf:
> Hi,
>
> We have more than 200 customers running 8.0.3 and two weeks ago started> migration project to 8.1.1.After the first migration to 8.1.1 we had to
> return back to 8.0.3 because some applications were not working right.
>
> Our user told me that records are not returning more in the correct
> order, so I started logging and saw that the select clause wasn�t not used
> with the ORDER BY clause. It seemed a simple problem to be solved.
>
> I asked the programmers that they should add the ORDER BY clause if they
> need the rows in a certain order and they told me they could not do it
> because it will cost too much and the response time is bigger than not
> using ORDER BY. I disagreed with them because there was an index with the
> same order needed for the order by. Before starting a figth we decided to
> explain analyze both select types and discover who was right. For my
> surprise the select with order by was really more expensive than the select
> without the orde r by. I will not bet any more...;-)
>
> For some implementation reason in 8.0.3 the query is returning the rows
> in the correct order even without the order by but in 8.1.1 probably the
> implementation changed and the rows are not returning in the correct order.
>
> We need the 8.1 for other reasons but this order by behavior stopped the
> migration project.
>
> Some friends of the list tried to help us and I did some configuration
> changes like increased work_mem and changed the primary columns from
> numeric types to smallint/integer/bigint but even so the runtime and costs
> are far from the ones from the selects without the ORDER BY clause.
>
> What I can not understand is why the planner is not using the same
> retrieving method with the order by clause as without the order by clause.
> All the rows are retrieved in the correct order in both methods but one is
> much cheaper (without order by) than the other (with order by). Should not
> the planner choice that one?
>
> Can someone explain me why the planner is not choosing the same method
> used with the selects without the order by clause instead of using a sort
> that is much more expensive?
>
> Without order by:
> explain analyze
> SELECT * FROM iparq.ARRIPT
> where
> (ANOCALC = 2005
> and CADASTRO = 19
> and CODVENCTO = 00
> and PARCELA >= 00 )
> or
> (ANOCALC = 2005
> and CADASTRO = 19
> and CODVENCTO > 00 )
> or
> (ANOCALC = 2005
> and CADASTRO > 19 )
> or
> (ANOCALC > 2005 );
> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript
> (cost=0.00..122255.35 rows=146602 width=897) (actual time=9.303..1609.987
> rows=167710 loops=1) Index Cond: (((anocalc = 2005::numeric) AND (cadastro
> = 19::numeric) AN D (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR
> ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto >
> 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR
> (anocalc > 2005::numeric)) Total runtime: 1712.456 ms
> (3 rows)
>
>
> With order by:
> explain analyze
> SELECT * FROM iparq.ARRIPT
> where
> (ANOCALC = 2005
> and CADASTRO = 19
> and CODVENCTO = 00
> and PARCELA >= 00 )
> or
> (ANOCALC = 2005
> and CADASTRO = 19
> and CODVENCTO > 00 )
> or
> (ANOCALC = 2005
> and CADASTRO > 19 )
> or
> (ANOCALC > 2005 )
> order by ANOCALC asc, CADASTRO asc, CODVENCTO asc, PARCELA asc;
> Sort (cost=201296.59..201663.10 rows=146602 width=897) (actual
> time=9752.555..10342.363 rows=167710 loops=1) Sort Key: anocalc, cadastro,
> codvencto, parcela
& gt; -> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on
> arript (cost=0.00..122255.35 rows=146602 width=897) (actual
> time=0.402..1425.085 rows=167710 loops=1) Index Cond: (((anocalc =
> 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric)
> AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro =
> 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric)
> AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric)) Total runtime:
> 10568.290 ms
> (5 rows)
>
> Table definition:
> Table "iparq.arript"
> Column | Type | Modifiers
> -------------------+-----------------------+-----------
> anocalc | numeric(4,0) | not null
> cadastro | numeric(8,0) | not null
> codvencto | numeric(2,0) | not null
> parcela | numeric(2,0) | not null
> inscimob | character varying(18) | not null
> codvenc to2 | numeric(2,0) | not null
> parcela2 | numeric(2,0) | not null
> codpropr | numeric(10,0) | not null
> dtaven | numeric(8,0) | not null
> anocalc2 | numeric(4,0) |
> ...
> ...
> Indexes:
> "pk_arript" PRIMARY KEY, btree (anocalc, cadastro, codvencto, parcela)
> "iarchave04" UNIQUE, btree (cadastro, anocalc, codvencto, parcela)
> "iarchave02" btree (inscimob, anocalc, codvencto2, parcela2)
> "iarchave03" btree (codpropr, dtaven)
> "iarchave05" btree (anocalc, inscimob, codvencto2, parcela2)
>
> Best regards and thank you very much in advance,
>
> Carlos Benkendorf
>
>
>
> ---------------------------------
> Yahoo! doce lar. Fa�a do Yahoo! sua homepage.


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-921445132-1135344755=:86862-- From pgsql-performance-owner@postgresql.org Fri Dec 23 09:34:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1F86C9DC827 for ; Fri, 23 Dec 2005 09:34:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70430-04 for ; Fri, 23 Dec 2005 09:34:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.pharmaline.de (mail.pharmaline.de [62.153.135.34]) by postgresql.org (Postfix) with ESMTP id 579C49DC818 for ; Fri, 23 Dec 2005 09:34:16 -0400 (AST) Received: from [192.168.2.121] (62.153.135.40) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.6); Fri, 23 Dec 2005 14:34:20 +0100 In-Reply-To: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> References: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-30-271355000; protocol="application/pkcs7-signature" Message-Id: <55DD6E49-BC80-443D-9F6E-573B6CEE961D@pharmaline.de> Cc: postgres performance list From: Guido Neitzer Subject: Re: Order by behaviour Date: Fri, 23 Dec 2005 14:34:20 +0100 To: Carlos Benkendorf X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/584 X-Sequence-Number: 16405 --Apple-Mail-30-271355000 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 23.12.2005, at 13:34 Uhr, Carlos Benkendorf wrote: > For some implementation reason in 8.0.3 the query is returning the > rows in the correct order even without the order by but in 8.1.1 > probably the implementation changed and the rows are not returning > in the correct order. You will never be sure to get rows in a specific order without an "order by". I don't know why PG is faster without ordering, perhaps others can help with that so you don't need a workaround like this: If you can't force PostgreSQL to perform better on the ordered query, what about retrieving only the primary keys for the rows you want unordered in a subquery and using an "where primaryKey in (...) order by ..." statement with ordering the five rows? Like this: select * from mytable where pk in (select pk from mytable where ...) order by ...; I don't know whether the query optimizer will flatten this query, but you can try it. cug -- PharmaLine Essen, GERMANY and Big Nerd Ranch Europe - PostgreSQL Training, Feb. 2006, Rome, Italy http://www.bignerdranch.com/classes/postgresql.shtml --Apple-Mail-30-271355000 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGUzCCAwww ggJ1oAMCAQICAw4DazANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwMjExMDkwNzMwWhcNMDYwMjExMDkwNzMwWjBpMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSowKAYJKoZIhvcNAQkBFhtndWlkby5uZWl0emVyQHBo YXJtYWxpbmUuZGUxGjAYBgkqhkiG9w0BCQEWC2N1Z0BtYWMuY29tMIIBIjANBgkqhkiG9w0BAQEF AAOCAQ8AMIIBCgKCAQEA5/WRLVRqtqJ+f/HOn9G513YNybt/lglgrEjo281eSXV0O1boJcCA7FuA B+Wc7BiltSkLc4nvJSegJh0RydSOKt3MywBg+N8BkgxcSWf9jYJ/JUx4uTBWAdd4Hk1+XPGHpYzQ Ric2AofRqhW8IQX/unprQ/BnAMiiuukaaGB8dqtoXDBI0RYlwHYuOTyrviEdU7jt4kgrBYu4TK01 qqKsxkr2Q7WhNT9p9w7Fu8rZF+VuJPwbZPIsfWuPZbN/7HRKoaKLG04UG1CmiqiN9JQl4tR81G4k 8WkSTPy0JruJHfOm584a1JposZwtwmcOo1l5iDJtnzSB4PvdFnFYVkJ9IQIDAQABo0UwQzAzBgNV HREELDAqgRtndWlkby5uZWl0emVyQHBoYXJtYWxpbmUuZGWBC2N1Z0BtYWMuY29tMAwGA1UdEwEB /wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAgg9T+k6d3YQITWeSYwDSPTAGN0z/BMVhrOlzF7cP4srd jU4L0RLiqFMz9D2tCMFV5P0z1FIxjSqXBpt7xkzSE8sYplMUMLBRMIV4sJbPAbdqGiB+MGLSzh7V N95dP7LwrRjFqury6j0RQ3OG6oqStCpfcMmWuAHT7gRNwjeAaQYwggM/MIICqKADAgECAgENMA0G CSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYD VQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0 aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29uYWwgRnJl ZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5jb20wHhcN MDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftOucqZWh5o wHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9xVsuvPAsH 5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAeZBlyYLf7 AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8v Y3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8EBAMCAQYw KQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3DQEBBQUA A4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9reFhYsPZ Ohl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAaWzVNd+NW IXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMc VGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZy ZWVtYWlsIElzc3VpbmcgQ0ECAw4DazAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMxCwYJKoZI hvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNTEyMjMxMzM0MjFaMCMGCSqGSIb3DQEJBDEWBBQRL3Aj bbsPhWFV4HM5LRXqIVuqAzB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQK ExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwg RnJlZW1haWwgSXNzdWluZyBDQQIDDgNrMHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw4DazANBgkqhkiG9w0BAQEFAASCAQBK77cz jp12BJSSSYXYcIU4vCu/N5cqM0EpRkJTRPUpNc+VMkL0CSyRKQ3u4cpAEaVPFbL4GC9R92m6aDAm QgO4dY4pvar+O4W6CMh5Anq0kq7+xC3JC14dopYE8lhXR+y9hC4cVZX7E2MLdrDYOVcnkExAyMUt KYT2c0B0KQ9CToZ32V3gkR/vR6vhvEvKdzlLvrrisVxIzcBbQTSs8L+GJK9zM2ABKEI2KiLB1iro iJIIy7mrXMNTNUmOMempSSUvMoVwRjS421uMI0OyBrMSDyQDIev1fILKP7i7YaaMSCPMKCx+puuQ G17ym9ClH0pyYR7dcQC7oykHyazCRMEiAAAAAAAA --Apple-Mail-30-271355000-- From pgsql-performance-owner@postgresql.org Fri Dec 23 10:37:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9248A9DC80B for ; Fri, 23 Dec 2005 10:37:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80516-05 for ; Fri, 23 Dec 2005 10:37:58 -0400 (AST) X-Greylist: delayed 00:06:38.375806 by SQLgrey- Received: from mxout2.iskon.hr (mxout2.iskon.hr [213.191.128.16]) by postgresql.org (Postfix) with SMTP id 9E0EF9DC805 for ; Fri, 23 Dec 2005 10:37:50 -0400 (AST) Received: (qmail 1327 invoked from network); 23 Dec 2005 15:31:15 +0100 X-Remote-IP: 213.191.142.123 Received: from unknown (HELO mx.iskon.hr) (213.191.142.123) by mxout2.iskon.hr with SMTP; 23 Dec 2005 15:31:15 +0100 Received: (qmail 16274 invoked from network); 23 Dec 2005 15:31:15 +0100 X-Remote-IP: 213.202.85.67 Received: from lns01-0320.dsl.iskon.hr (HELO sesback.localdomain.hr) (213.202.85.67) by mx.iskon.hr with SMTP; 23 Dec 2005 15:31:15 +0100 Received: from [192.168.101.7] (helo=[192.168.101.7]) by sesback.localdomain.hr with esmtp (Exim 4.34) id 1Epnwx-0002Qe-BI for pgsql-performance@postgresql.org; Fri, 23 Dec 2005 15:31:15 +0100 Message-ID: <43AC0A33.3060806@chipoteka.hr> Date: Fri, 23 Dec 2005 15:31:15 +0100 From: Kresimir Tonkovic User-Agent: Debian Thunderbird 1.0.2 (X11/20050817) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Order by behaviour References: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> In-Reply-To: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/586 X-Sequence-Number: 16407 Carlos Benkendorf wrote: > Hi, > =20 > We have more than 200 customers running 8.0.3 and two weeks ago=20 > started migration project to 8.1.1.After the first migration to 8.1.1=20 > we had to return back to 8.0.3 because some applications were not=20 > working right. > =20 > Our user told me that records are not returning more in the correct=20 > order, so I started logging and saw that the select clause wasn=C2=B4t = not=20 > used with the ORDER BY clause. It seemed a simple problem to be solved.= > =20 > I asked the programmers that they should add the ORDER BY clause if=20 > they need the rows in a certain order and they told me they could not=20 > do it because it will cost too much and the response time is bigger=20 > than not using ORDER BY. I disagreed with them because there was an=20 > index with the same order needed for the order by. Before starting a=20 > figth we decided to explain analyze both select types and discover who = > was right. For my surprise the sele ct with order by was really more=20 > expensive than the select without the order by. I will not bet any=20 > more...;-) > =20 > For some implementation reason in 8.0.3 the query is returning the=20 > rows in the correct order even without the order by but in 8.1.1=20 > probably the implementation changed and the rows are not returning in=20 > the correct order. > =20 > We need the 8.1 for other reasons but this order by behavior stopped=20 > the migration project. > =20 > Some friends of the list tried to help us and I did some configuration = > changes like increased work_mem and changed the primary columns from=20 > numeric types to smallint/integer/bigint but even so the runtime and=20 > costs are far from the ones from the selects without the ORDER BY claus= e. > =20 > What I can not understand is why the planner is not using the same=20 > retrieving method with the order by clause as without the order by=20 > clause. All the rows are retriev ed in the correct order in both=20 > methods but one is much cheaper (without order by) than the other=20 > (with order by). Should not the planner choice that one? > =20 > Can someone explain me why the planner is not choosing the same method = > used with the selects without the order by clause instead of using a=20 > sort that is much more expensive? Maybe your table in the old database is clustered on an index that=20 covers all ordered columns? Then, a sequential fetch of all rows would=20 probably return them ordered. But there still should be no guarantee for = this because postgres might first return the rows that are already in=20 memory. Just making wild guesses. --=20 Kre=C5=A1imir Tonkovi=C4=87 Z-el d.o.o. Industrijska cesta 28, 10360 Sesvete, Croatia Tel: +385 1 2022 758 Fax: +385 1 2022 741 Web: www.chipoteka.hr e-mail: z-el.tonkovic@chipoteka.hr From pgsql-performance-owner@postgresql.org Fri Dec 23 10:35:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CD2DB9DC805 for ; Fri, 23 Dec 2005 10:35:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79858-04 for ; Fri, 23 Dec 2005 10:35:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35514.mail.mud.yahoo.com (web35514.mail.mud.yahoo.com [66.163.179.138]) by postgresql.org (Postfix) with SMTP id C78A59DC827 for ; Fri, 23 Dec 2005 10:35:13 -0400 (AST) Received: (qmail 85772 invoked by uid 60001); 23 Dec 2005 14:35:18 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=sQ+mR6FuAdBdKVsraBjHlKkuQEdGjSHOxjLzgAdJPQziLeDe6/SEC3qdbLRGKZWWq/xiQcddEk0GhqT6T3MdS8us08u1D7eU84+9AzMjmmCcx4wDYT/Snn1DtJBxEd4pR4GXPqEhKVvH8gjrppSAT/Gyv9cm3ykN0k/uFrRYdC0= ; Message-ID: <20051223143518.85770.qmail@web35514.mail.mud.yahoo.com> Received: from [201.2.222.140] by web35514.mail.mud.yahoo.com via HTTP; Fri, 23 Dec 2005 14:35:18 GMT Date: Fri, 23 Dec 2005 14:35:18 +0000 (GMT) From: Carlos Benkendorf Subject: Re: Order by behaviour To: pgsql-performance@postgresql.org In-Reply-To: <55DD6E49-BC80-443D-9F6E-573B6CEE961D@pharmaline.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1919189698-1135348518=:85449" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.558 required=5 tests=[AWL=0.078, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.558 X-Spam-Level: X-Archive-Number: 200512/585 X-Sequence-Number: 16406 --0-1919189698-1135348518=:85449 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit >If you can't force PostgreSQL to perform better on the ordered query, >what about retrieving only the primary keys for the rows you want >unordered in a subquery and using an "where primaryKey in (...) order >by ..." statement with ordering the five rows? I appreciate your suggestion but I think I�m misunderstanding something, the select statement should return at about 150.000 rows, why 5 rows? Guido Neitzer escreveu: On 23.12.2005, at 13:34 Uhr, Carlos Benkendorf wrote: > For some implementation reason in 8.0.3 the query is returning the > rows in the correct order even without the order by but in 8.1.1 > probably the implementation changed and the rows are not returning > in the correct order. You will never be sure to get rows in a specific order without an "order by". I don't know why PG is faster without ordering, perhaps others can help with that so you don't need a workaround like this: If you can't force PostgreSQL to perform better on the ordered query, what about retrieving only the primary keys for the rows you want unordered in a subquery and using an "where primaryKey in (...) order by ..." statement with ordering the five rows? Like this: select * from mytable where pk in (select pk from mytable where ...) order by ...; I don't know whether the query optimizer will flatten this query, but you can try it. cug -- PharmaLine Essen, GERMANY and Big Nerd Ranch Europe - PostgreSQL Training, Feb. 2006, Rome, Italy http://www.bignerdranch.com/classes/postgresql.shtml --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-1919189698-1135348518=:85449 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
>If you can't force PostgreSQL to perform better on the ordered query,
>what about retrieving only the primary keys for the rows you want
>unordered in a subquery and using an "where primaryKey in (...) order
>by ..." statement with ordering the five rows?
 
I appreciate your suggestion but I think I�m misunderstanding something, the select statement should return at about 150.000 rows, why 5 rows?

Guido Neitzer <guido.neitzer@pharmaline.de> escreveu:
On 23.12.2005, at 13:34 Uhr, Carlos Benkendorf wrote:

> For some implementation reason in 8.0.3 the query is returning the
> rows in the correct order even without the order by but in 8.1.1
> probably the implementation changed and the rows are not returning
> in the correct order.

You will never be sure to get rows in a specific order without an
"order by".

I don't know why PG is faster without ordering, perhaps others can
help with that so you don't need a workaround like this:

If you can't force PostgreSQL to perform better on the ordered query,
what about retrieving only the primary keys for the rows you want
unordered in a subquery and using an "where primaryKey in (...) order
by ..." statement with ordering the five rows?
 


Like this:

select * from mytable where pk in (select pk from mytable where ...)
order by ...;

I don't know whether the query optimizer will flatten this query, but
you can try it.

cug


--
PharmaLine Essen, GERMANY and
Big Nerd Ranch Europe - PostgreSQL Training, Feb. 2006, Rome, Italy
http://www.bignerdranch.com/classes/postgresql.shtml




Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-1919189698-1135348518=:85449-- From pgsql-performance-owner@postgresql.org Fri Dec 23 11:03:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D01309DCC58 for ; Fri, 23 Dec 2005 11:03:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83735-07 for ; Fri, 23 Dec 2005 11:03:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.pharmaline.de (mail.pharmaline.de [62.153.135.34]) by postgresql.org (Postfix) with ESMTP id E19EC9DC886 for ; Fri, 23 Dec 2005 11:03:33 -0400 (AST) Received: from [192.168.2.121] (62.153.135.40) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.6); Fri, 23 Dec 2005 16:03:38 +0100 In-Reply-To: <20051223143518.85770.qmail@web35514.mail.mud.yahoo.com> References: <20051223143518.85770.qmail@web35514.mail.mud.yahoo.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-31-276711576; protocol="application/pkcs7-signature" Message-Id: <6DCB1862-4134-42D8-A82C-47FB212AC106@pharmaline.de> Cc: postgres performance list From: Guido Neitzer Subject: Re: Order by behaviour Date: Fri, 23 Dec 2005 16:03:36 +0100 To: Carlos Benkendorf X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200512/587 X-Sequence-Number: 16408 --Apple-Mail-31-276711576 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed On 23.12.2005, at 15:35 Uhr, Carlos Benkendorf wrote: > I appreciate your suggestion but I think I=B4m misunderstanding =20 > something, the select statement should return at about 150.000 =20 > rows, why 5 rows? I have looked at the wrong lines of the explain ... statement. Sorry, =20= my fault. With that many lines, I doubt that my workaround will do =20 anything good ... :-/ I was just a little bit to fast ... looking at =20 to many different "explain ..." (or similar) statements in the last =20 weeks. Sorry, my fault. Other idea: have you tried ordering the rows in memory? Is that =20 faster? =46rom now looking better at the explain result, it seems to =20 me, that the sorting takes most of the time: Sort (cost=3D201296.59..201663.10 rows=3D146602 width=3D897) (actual =20= time=3D9752.555..10342.363 rows=3D167710 loops=3D1) How large are the rows returned by your query? Do they fit completely =20= in the memory during the sort? If PostgreSQL starts switching to temp =20= files ... There was a discussion on that topic a few weeks ago ... Perhaps this may help: ------------------------------ work_mem (integer) Specifies the amount of memory to be used by internal sort =20 operations and hash tables before switching to temporary disk files. =20 The value is specified in kilobytes, and defaults to 1024 kilobytes =20 (1 MB). Note that for a complex query, several sort or hash =20 operations might be running in parallel; each one will be allowed to =20 use as much memory as this value specifies before it starts to put =20 data into temporary files. Also, several running sessions could be =20 doing such operations concurrently. So the total memory used could be =20= many times the value of work_mem; it is necessary to keep this fact =20 in mind when choosing the value. Sort operations are used for ORDER =20 BY, DISTINCT, and merge joins. Hash tables are used in hash joins, =20 hash-based aggregation, and hash-based processing of IN subqueries. ------------------------------ cug= --Apple-Mail-31-276711576 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGUzCCAwww ggJ1oAMCAQICAw4DazANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwMjExMDkwNzMwWhcNMDYwMjExMDkwNzMwWjBpMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSowKAYJKoZIhvcNAQkBFhtndWlkby5uZWl0emVyQHBo YXJtYWxpbmUuZGUxGjAYBgkqhkiG9w0BCQEWC2N1Z0BtYWMuY29tMIIBIjANBgkqhkiG9w0BAQEF AAOCAQ8AMIIBCgKCAQEA5/WRLVRqtqJ+f/HOn9G513YNybt/lglgrEjo281eSXV0O1boJcCA7FuA B+Wc7BiltSkLc4nvJSegJh0RydSOKt3MywBg+N8BkgxcSWf9jYJ/JUx4uTBWAdd4Hk1+XPGHpYzQ Ric2AofRqhW8IQX/unprQ/BnAMiiuukaaGB8dqtoXDBI0RYlwHYuOTyrviEdU7jt4kgrBYu4TK01 qqKsxkr2Q7WhNT9p9w7Fu8rZF+VuJPwbZPIsfWuPZbN/7HRKoaKLG04UG1CmiqiN9JQl4tR81G4k 8WkSTPy0JruJHfOm584a1JposZwtwmcOo1l5iDJtnzSB4PvdFnFYVkJ9IQIDAQABo0UwQzAzBgNV HREELDAqgRtndWlkby5uZWl0emVyQHBoYXJtYWxpbmUuZGWBC2N1Z0BtYWMuY29tMAwGA1UdEwEB /wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAgg9T+k6d3YQITWeSYwDSPTAGN0z/BMVhrOlzF7cP4srd jU4L0RLiqFMz9D2tCMFV5P0z1FIxjSqXBpt7xkzSE8sYplMUMLBRMIV4sJbPAbdqGiB+MGLSzh7V N95dP7LwrRjFqury6j0RQ3OG6oqStCpfcMmWuAHT7gRNwjeAaQYwggM/MIICqKADAgECAgENMA0G CSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYD VQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0 aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29uYWwgRnJl ZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5jb20wHhcN MDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftOucqZWh5o wHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9xVsuvPAsH 5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAeZBlyYLf7 AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8v Y3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8EBAMCAQYw KQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3DQEBBQUA A4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9reFhYsPZ Ohl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAaWzVNd+NW IXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMc VGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZy ZWVtYWlsIElzc3VpbmcgQ0ECAw4DazAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMxCwYJKoZI hvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNTEyMjMxNTAzMzhaMCMGCSqGSIb3DQEJBDEWBBSMg/av qodgZ5gxExvRHSL0XqdbvjB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQK ExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwg RnJlZW1haWwgSXNzdWluZyBDQQIDDgNrMHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw4DazANBgkqhkiG9w0BAQEFAASCAQA5Me2M np7DopWi+ZiCiBs+34xELIOdq6D2UZYAWzoP5kmOgwyFtXTnCNIPKVmaCElY8CzVEqLiiAsTTY+I WjDy73YUwqCl7oHjWES17obV176MkfVChqkhnTnLEqIc170yCQIgDCKCepoXH9gUwYArFHhKt7ff ayUytFH31uworftewVT8A7/xrP53r+hNzDqGfXIeEWqr7qGM8GdIQW+r5+DsWEcII1p/PTrRdAmO iIUvinTbVPekEvc6F89ZOxneu3DVH7rWuph5eYXZytCMLUG0+H5sPKmsnL/gWPIa5T3NOr9MQdzF zUYCXSCLh68OU0gsUX2A6yHTNH+qRRvlAAAAAAAA --Apple-Mail-31-276711576-- From pgsql-performance-owner@postgresql.org Fri Dec 23 11:30:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2408B9DC808 for ; Fri, 23 Dec 2005 11:30:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90164-02 for ; Fri, 23 Dec 2005 11:30:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5875A9DC805 for ; Fri, 23 Dec 2005 11:30:14 -0400 (AST) 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 jBNFU1JQ019922; Fri, 23 Dec 2005 10:30:01 -0500 (EST) To: Anton Maksimenkov cc: pgsql-performance@postgresql.org Subject: Re: DELETE, INSERT vs SELECT, UPDATE || INSERT In-reply-to: <287988431.20051223140205@hlebprom.ru> References: <287988431.20051223140205@hlebprom.ru> Comments: In-reply-to Anton Maksimenkov message dated "Fri, 23 Dec 2005 14:02:05 +0500" Date: Fri, 23 Dec 2005 10:30:00 -0500 Message-ID: <19921.1135351800@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.039 required=5 tests=[AWL=0.039] X-Spam-Score: 0.039 X-Spam-Level: X-Archive-Number: 200512/588 X-Sequence-Number: 16409 Anton Maksimenkov writes: > Second idea was to try to SELECT (user, cookie) pair and then UPDATE > it if it exists or INSERT if not. I has thought that if UPDATE will > rewrite same place in file with new count it may lead to more compact > table (file not grow and information about actual rows in file will > not changed). You're wasting your time, because Postgres doesn't work that way. UPDATE is really indistinguishable from DELETE+INSERT, and there will always be a dead row afterwards, because under MVCC rules both versions of the row have to be left in the table for some time after your transaction commits. See http://www.postgresql.org/docs/8.1/static/mvcc.html regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 23 11:54:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D0B959DCBD9 for ; Fri, 23 Dec 2005 11:54:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92549-06 for ; Fri, 23 Dec 2005 11:54:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id F0FC69DC841 for ; Fri, 23 Dec 2005 11:54:43 -0400 (AST) 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 jBNFsmB5020075; Fri, 23 Dec 2005 10:54:48 -0500 (EST) To: Carlos Benkendorf cc: pgsql-performance@postgresql.org Subject: Re: Order by behaviour In-reply-to: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> References: <20051223123439.69718.qmail@web35507.mail.mud.yahoo.com> Comments: In-reply-to Carlos Benkendorf message dated "Fri, 23 Dec 2005 12:34:39 +0000" Date: Fri, 23 Dec 2005 10:54:48 -0500 Message-ID: <20074.1135353288@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.039 required=5 tests=[AWL=0.039] X-Spam-Score: 0.039 X-Spam-Level: X-Archive-Number: 200512/589 X-Sequence-Number: 16410 Carlos Benkendorf writes: > For some implementation reason in 8.0.3 the query is returning the rows in the correct order even without the order by but in 8.1.1 probably the implementation changed and the rows are not returning in the correct order. It was pure luck that prior versions gave you the result you wanted --- as other people already noted, the ordering of results is never guaranteed unless you say ORDER BY. The way you phrased the query gave rise (before 8.1) to several independent index scans that just happened to yield non-overlapping, individually sorted, segments of the desired output, and so as long as the system executed those scans in the right order, you got your sorted result without explicitly asking for it. But the system wasn't aware that it was giving you any such thing, and certainly wasn't going out of its way to do so. In 8.1 we no longer generate that kind of plan --- OR'd index scans are handled via bitmap-scan plans now, which are generally a lot faster, but don't yield sorted output. You could probably kluge around it by switching to a UNION ALL query: SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO = 00 and PARCELA >= 00 ) UNION ALL SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO > 00 ) UNION ALL SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO > 19 ) UNION ALL SELECT * FROM iparq.ARRIPT where (ANOCALC > 2005 ); Again, the system has no idea that it's giving you data in any useful overall order, so this technique might also break someday, but it's good for the time being. Of course, all of these are ugly, klugy solutions. The correct way to solve your problem would be with a row comparison: SELECT * FROM iparq.ARRIPT where (ANOCALC, CADASTRO, CODVENCTO, PARCELA) >= (2005, 19, 00, 00) ORDER BY ANOCALC, CADASTRO, CODVENCTO, PARCELA; Postgres doesn't currently support this (we take the syntax but don't implement it per SQL spec, and don't understand the connection to an index anyway :-() ... but sooner or later it'll get fixed. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 23 12:16:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E31EF9DC808 for ; Fri, 23 Dec 2005 12:16:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97748-02 for ; Fri, 23 Dec 2005 12:16:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id ADB5D9DC805 for ; Fri, 23 Dec 2005 12:16:17 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 357C8B810 for ; Fri, 23 Dec 2005 11:16:16 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <200512222144.32665.caseroj@comcast.net> References: <43AAAB58.6050109@logix-tt.com> <200512222144.32665.caseroj@comcast.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: MySQL is faster than PgSQL but a large margin in Date: Fri, 23 Dec 2005 11:16:14 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200512/590 X-Sequence-Number: 16411 On Dec 22, 2005, at 9:44 PM, Juan Casero wrote: > Agreed. I have a 13 million row table that gets a 100,000 new > records every > week. There are six indexes on this table. Right about the time > when it i have some rather large tables that grow much faster than this (~1 million per day on a table with > 200m rows) and a few indexes. there is no such slowness I see. do you really need all those indexes? From pgsql-performance-owner@postgresql.org Fri Dec 23 12:23:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 39E749DC83E for ; Fri, 23 Dec 2005 12:23:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97866-07-2 for ; Fri, 23 Dec 2005 12:23:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id BA52B9DC818 for ; Fri, 23 Dec 2005 12:23:30 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 0DFFDB80F for ; Fri, 23 Dec 2005 11:23:30 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: References: <43A84D03.7090002@ritek.hu> <200512212231.55100.caseroj@comcast.net> <200512222310.10893.caseroj@comcast.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <71CFD284-4B9F-48AE-9747-B36D9F4434B6@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Fri, 23 Dec 2005 11:23:28 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.018 required=5 tests=[AWL=0.018] X-Spam-Score: 0.018 X-Spam-Level: X-Archive-Number: 200512/591 X-Sequence-Number: 16412 On Dec 22, 2005, at 11:14 PM, David Lang wrote: > but it boils down to the fact that there just isn't enough > experiance with the new sun systems to know how well they will > work. they could end up being fabulous speed demons, or dogs (and > it could even be both, depending on your workload) The v20z isn't the newest sun hardware anyhow... The X2100, X4100, and X4200 are. I've been trying to buy an X4100 for going on three weeks now but the local sun reseller is making it very hard. you'd think they'd actually want to go out of their way to make a sale but they seem to do the opposite. for those of you who say 'well, it is a small sale' my original request was for over $50k in equipment, and after a while decided that other equipment from other vendors who do care was sufficient, and only the opteron boxes needed to come from sun. add a zero return policy and you wonder how they expect to keep in business.... sorry, i had to vent. but once it does come in I'll be glad to post up some numbers :-) From pgsql-performance-owner@postgresql.org Fri Dec 23 18:15:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DB1309DCB8C for ; Fri, 23 Dec 2005 18:15:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47989-06 for ; Fri, 23 Dec 2005 18:15:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 357BA9DCB93 for ; Fri, 23 Dec 2005 18:15:45 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRZ00DRH1UA73@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 24 Dec 2005 11:15:46 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-241.dsl.clear.net.nz [218.101.29.241]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 09AF51186F65; Sat, 24 Dec 2005 11:15:45 +1300 (NZDT) Date: Sat, 24 Dec 2005 11:15:45 +1300 From: Mark Kirkwood Subject: Re: What's the best hardver for PostgreSQL 8.1? In-reply-to: <71CFD284-4B9F-48AE-9747-B36D9F4434B6@khera.org> To: Vivek Khera Cc: Postgresql Performance Message-id: <43AC7711.1040905@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <43A84D03.7090002@ritek.hu> <200512212231.55100.caseroj@comcast.net> <200512222310.10893.caseroj@comcast.net> <71CFD284-4B9F-48AE-9747-B36D9F4434B6@khera.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.344 required=5 tests=[AWL=0.344] X-Spam-Score: 0.344 X-Spam-Level: X-Archive-Number: 200512/592 X-Sequence-Number: 16413 Vivek Khera wrote: > and only the > opteron boxes needed to come from sun. add a zero return policy and you > wonder how they expect to keep in business.... > > sorry, i had to vent. > Just out of interest - why did the opterons need to come from Sun? From pgsql-performance-owner@postgresql.org Fri Dec 23 21:49:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B3A829DC869 for ; Fri, 23 Dec 2005 21:48:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79345-06 for ; Fri, 23 Dec 2005 21:49:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35504.mail.mud.yahoo.com (web35504.mail.mud.yahoo.com [66.163.179.128]) by postgresql.org (Postfix) with SMTP id CDEEB9DC832 for ; Fri, 23 Dec 2005 21:48:56 -0400 (AST) Received: (qmail 57709 invoked by uid 60001); 24 Dec 2005 01:49:00 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=CnhHO5gHSWJuDSOAgtww8YAg1wL6jAI5hbX5vVTzLXIVY7QIQrnHWePwlTcdvpPn9HdgOnSqAtGHxiSe1qMiGnYRfTZNWwWWR8LfPPdWe7Qv/bthsPIJub5TB1drTV9hkXD06JScEFm+0wvRTW+jFKlZNAQcDS7Ei7Ai7d2FKiM= ; Message-ID: <20051224014900.57703.qmail@web35504.mail.mud.yahoo.com> Received: from [201.14.172.40] by web35504.mail.mud.yahoo.com via HTTP; Sat, 24 Dec 2005 01:49:00 GMT Date: Sat, 24 Dec 2005 01:49:00 +0000 (GMT) From: Carlos Benkendorf Subject: Re: Order by behaviour To: pgsql-performance@postgresql.org In-Reply-To: <20074.1135353288@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-16810945-1135388940=:56834" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.36 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.36 X-Spam-Level: X-Archive-Number: 200512/593 X-Sequence-Number: 16414 --0-16810945-1135388940=:56834 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit YES.... it worked very nice.... Using UNION with 8.0.3: Append (cost=0.00..164840.70 rows=232632 width=892) (actual time=0.350..28529.895 rows=167711 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..2.91 rows=1 width=892) (actual time=0.098..0.098 rows=0 loops=1) -> Index Scan using pk_arript on arript (cost=0.00..2.90 rows=1 width=892) (actual time=0.094..0.094 rows=0 loops=1) Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) -> Subquery Scan "*SELECT* 2" (cost=0.00..14.00 rows=12 width=892) (actual time=0.249..0.425 rows=2 loops=1) -> Index Scan using pk_arript on arript (cost=0.00..13.88 rows=12 width=892) (actual time=0.041..0.053 rows=2 loops=1) Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) -> Subquery Scan "*SELECT* 3" (cost=0.00..55949.61 rows=68413 width=892) (actual time=0.216..12324.475 rows=72697 loops=1) -> Index Scan using pk_arript on arript (cost=0.00..55265.48 rows=68413 width=892) (actual time=0.033..429.152 rows=72697 loops=1) Index Cond: ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) -> Subquery Scan "*SELECT* 4" (cost=0.00..108874.19 rows=164206 width=892) (actual time=0.297..16054.064 rows=95012 loops=1) -> Index Scan using pk_arript on arript (cost=0.00..107232.13 rows=164206 width=892) (actual time=0.046..485.430 rows=95012 loops=1) Index Cond: (anocalc > 2005::numeric) Total runtime: 28621.053 ms (14 rows) NOT SO GOOD! But using with 8.1: Append (cost=0.00..117433.94 rows=171823 width=897) (actual time=0.126..697.004 rows=167710 loops=1) -> Index Scan using pk_arript on arript (cost=0.00..2.81 rows=1 width=897) (actual time=0.083..0.083 rows=0 loops=1) Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) -> Index Scan using pk_arript on arript (cost=0.00..12.05 rows=11 width=897) (actual time=0.039..0.050 rows=2 loops=1) Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) -> Index Scan using pk_arript on arript (cost=0.00..46950.74 rows=65125 width=897) (actual time=0.031..275.674 rows=72697 loops=1) Index Cond: ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) -> Index Scan using pk_arript on arript (cost=0.00..68750.11 rows=106686 width=897) (actual time=0.042..272.257 rows=95011 loops=1) Index Cond: (anocalc > 2005::numeric) Total runtime: 786.670 ms Using 8.1 and changing NUMERIC primary key columns to INTEGERs. Append (cost=0.00..107767.19 rows=159082 width=826) (actual time=0.091..487.802 rows=167710 loops=1) -> Index Scan using pk_arript on arript (cost=0.00..2.81 rows=1 width=826) (actual time=0.067..0.067 rows=0 loops=1) Index Cond: ((anocalc = 2005) AND (cadastro = 19) AND (codvencto = 0) AND (parcela >= 0)) -> Index Scan using pk_arript on arript (cost=0.00..11.21 rows=10 width=826) (actual time=0.020..0.026 rows=2 loops=1) Index Cond: ((anocalc = 2005) AND (cadastro = 19) AND (codvencto > 0)) -> Index Scan using pk_arript on arript (cost=0.00..44454.18 rows=62866 width=826) (actual time=0.012..157.058 rows=72697 loops=1) Index Cond: ((anocalc = 2005) AND (cadastro > 19)) -> Index Scan using pk_arript on arript (cost=0.00..61708.17 rows=96205 width=826) (actual time=0.044..183.768 rows=95011 loops=1) Index Cond: (anocalc > 2005) Total runtime: 571.221 ms (10 rows) It�s faster than our currently SELECT without ORDER BY (1712.456 ms)... it�s wonderful... We are aware about the risks of not using the ORDER BY clause .. but it�s a managed risk... Thank very much all the people who helped to solve this problem, especially Tom Lane! Thanks a lot! Benkendorf Tom Lane escreveu: Carlos Benkendorf writes: > For some implementation reason in 8.0.3 the query is returning the rows in the correct order even without the order by but in 8.1.1 probably the implementation changed and the rows are not returning in the correct order. It was pure luck that prior versions gave you the result you wanted --- as other people already noted, the ordering of results is never guaranteed unless you say ORDER BY. The way you phrased the query gave rise (before 8.1) to several independent index scans that just happened to yield non-overlapping, individually sorted, segments of the desired output, and so as long as the system executed those scans in the right order, you got your sorted result without explicitly asking for it. But the system wasn't aware that it was giving you any such thing, and certainly wasn't going out of its way to do so. In 8.1 we no longer generate that kind of plan --- OR'd index scans are handled via bitmap-scan plans now, which are generally a lot faster, but don't yield sorted output. You could probably kluge around it by switching to a UNION ALL query: SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO = 00 and PARCELA >= 00 ) UNION ALL SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO = 19 and CODVENCTO > 00 ) UNION ALL SELECT * FROM iparq.ARRIPT where (ANOCALC = 2005 and CADASTRO > 19 ) UNION ALL SELECT * FROM iparq.ARRIPT where (ANOCALC > 2005 ); Again, the system has no idea that it's giving you data in any useful overall order, so this technique might also break someday, but it's good for the time being. Of course, all of these are ugly, klugy solutions. The correct way to solve your problem would be with a row comparison: SELECT * FROM iparq.ARRIPT where (ANOCALC, CADASTRO, CODVENCTO, PARCELA) >= (2005, 19, 00, 00) ORDER BY ANOCALC, CADASTRO, CODVENCTO, PARCELA; Postgres doesn't currently support this (we take the syntax but don't implement it per SQL spec, and don't understand the connection to an index anyway :-() ... but sooner or later it'll get fixed. regards, tom lane --------------------------------- Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-16810945-1135388940=:56834 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
YES.... it worked very nice....
 
Using UNION with 8.0.3:
 
 Append  (cost=0.00..164840.70 rows=232632 width=892) (actual time=0.350..28529.895 rows=167711 loops=1)
   ->  Subquery Scan "*SELECT* 1"  (cost=0.00..2.91 rows=1 width=892) (actual time=0.098..0.098 rows=0 loops=1)
         ->  Index Scan using pk_arript on arript  (cost=0.00..2.90 rows=1 width=892) (actual time=0.094..0.094 rows=0 loops=1)
               Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric))
   ->  Subquery Scan "*SELECT* 2"  (cost=0.00..14.00 rows=12 width=892) (actual time=0.249..0.425 rows=2 loops=1)
         ->  Index Sca n using pk_arript on arript  (cost=0.00..13.88 rows=12 width=892) (actual time=0.041..0.053 rows=2 loops=1)
               Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric))
   ->  Subquery Scan "*SELECT* 3"  (cost=0.00..55949.61 rows=68413 width=892) (actual time=0.216..12324.475 rows=72697 loops=1)
         ->  Index Scan using pk_arript on arript  (cost=0.00..55265.48 rows=68413 width=892) (actual time=0.033..429.152 rows=72697 loops=1)
               Index Cond: ((anocalc = 2005::numeric) AND (cadastro > 19::numeric))
   ->  Subquery Scan "*SELECT* 4"  (cost=0.00..108874.19 rows=164206 width=892) (actual time=0.297..16054.064 rows=95012 loops=1)
         ->  Index Scan using pk_arript on arript  (cost=0.00..107232.13 rows=164206 width=892) (actual time=0.046..485.430 rows=95012 loops=1)
               Index Cond: (anocalc > 2005::numeric)
 Total runtime: 28621.053 ms
(14 rows)
 
NOT SO GOOD!
 
But using with 8.1:
 
 Append  (cost=0.00..117433.94 rows=171823 width=897) (actual time=0.126..697.004 rows=167710 loops=1)
   ->  Index Scan using pk_arript on arript  (cost=0.00..2.81 rows=1 width=897) (actual time=0.083..0.083 rows=0 loops=1)
         Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric))
   ->  Index Scan using pk_arript on arript  (cost=0.00..12.05 rows=11 width=897) (actual time=0.039..0.050 rows=2 loops=1)
         Index Cond: ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric))
   ->  Index Scan using pk_arript on arript  (cost=0.00..46950.74 rows=65125 width=897) (actual time=0.031..275.674 rows=72697 loops=1)
         Index Cond: ((anocalc = 2005::numeric) AND (cadastro > 19::numeric))
   ->  Index Scan using pk_arript on arript  (cost=0.00..68750.11 rows=106686 width=897) (actual time=0.042..272.257 rows=95011 loops=1)
         Index Cond: (anocalc > 2005::numeric)
 Total runtime: 786.670 ms
Using 8.1 and changing NUMERIC primary key columns to INTEGERs.
 
 Append  (cost=0.00..107767 .19 rows=159082 width=826) (actual time=0.091..487.802 rows=167710 loops=1)
   ->  Index Scan using pk_arript on arript  (cost=0.00..2.81 rows=1 width=826) (actual time=0.067..0.067 rows=0 loops=1)
         Index Cond: ((anocalc = 2005) AND (cadastro = 19) AND (codvencto = 0) AND (parcela >= 0))
   ->  Index Scan using pk_arript on arript  (cost=0.00..11.21 rows=10 width=826) (actual time=0.020..0.026 rows=2 loops=1)
         Index Cond: ((anocalc = 2005) AND (cadastro = 19) AND (codvencto > 0))
   ->  Index Scan using pk_arript on arript  (cost=0.00..44454.18 rows=62866 width=826) (actual time=0.012..157.058 rows=72697 loops=1)
         Index Cond: ((anocalc = 2005) AND (cadastro > 19))
   ->  Index Scan using pk_arript on arript  (cost=0.00..61708.17 rows=96205 width=826) (actual time=0.044..183.768 rows=95011 loops=1)
         Index Cond: (anocalc > 2005)
 Total runtime: 571.221 ms
(10 rows)
 
It�s faster than our currently SELECT without ORDER BY (1712.456 ms)... it�s wonderful...
 
We are aware about the risks of not using the ORDER BY clause .. but it�s a managed risk...
 
Thank very much all the people who helped to solve this problem, especially Tom Lane!
 
Thanks a lot!
 
Benkendorf

Tom Lane <tgl@sss.pgh.pa.us> escreveu:
Carlos Benkendorf writes:
> For some implementation reason in 8.0.3 the query is returni ng the rows in the correct order even without the order by but in 8.1.1 probably the implementation changed and the rows are not returning in the correct order.

It was pure luck that prior versions gave you the result you wanted ---
as other people already noted, the ordering of results is never
guaranteed unless you say ORDER BY. The way you phrased the query
gave rise (before 8.1) to several independent index scans that just
happened to yield non-overlapping, individually sorted, segments of
the desired output, and so as long as the system executed those scans
in the right order, you got your sorted result without explicitly asking
for it. But the system wasn't aware that it was giving you any such
thing, and certainly wasn't going out of its way to do so.

In 8.1 we no longer generate that kind of plan --- OR'd index scans are
handled via bitmap-scan plans now, which are generally a lot faster,
but don't yield sorted output.

You could probably kluge around it by switching to a UNION ALL query:

SELECT * FROM iparq.ARRIPT where
(ANOCALC = 2005
and CADASTRO = 19
and CODVENCTO = 00
and PARCELA >= 00 )
UNION ALL
SELECT * FROM iparq.ARRIPT where
(ANOCALC = 2005
and CADASTRO = 19
and CODVENCTO > 00 )
UNION ALL
SELECT * FROM iparq.ARRIPT where
(ANOCALC = 2005
and CADASTRO > 19 )
UNION ALL
SELECT * FROM iparq.ARRIPT where
(ANOCALC > 2005 );

Again, the system has no idea that it's giving you data in any
useful overall order, so this technique might also break someday,
but it's good for the time being.

Of course, all of these are ugly, klugy solutions. The correct way
to solve your problem would be with a row comparison:

SELECT * FROM iparq.ARRIPT
where
(ANOCALC, CADASTRO, CODVENCTO, PARCELA) >= (2005, 19, 00, 00)
ORDER BY ANOCALC, CADASTRO, CODVENCTO, PARCELA;

Postgres doesn't currently suppo rt this (we take the syntax but don't
implement it per SQL spec, and don't understand the connection to an
index anyway :-() ... but sooner or later it'll get fixed.

regards, tom lane


Yahoo! doce lar. Fa�a do Yahoo! sua homepage. --0-16810945-1135388940=:56834-- From pgsql-performance-owner@postgresql.org Sat Dec 24 00:00:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 52F3D9DCD25 for ; Sat, 24 Dec 2005 00:00:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25560-09 for ; Sat, 24 Dec 2005 00:00:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by postgresql.org (Postfix) with ESMTP id 12E909DCD24 for ; Sat, 24 Dec 2005 00:00:43 -0400 (AST) Received: from [192.168.1.6] (unknown [192.168.1.6]) by yertle.kcilink.com (Postfix) with ESMTP id 547CAB80F for ; Fri, 23 Dec 2005 23:00:42 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <43AC7711.1040905@paradise.net.nz> References: <43A84D03.7090002@ritek.hu> <200512212231.55100.caseroj@comcast.net> <200512222310.10893.caseroj@comcast.net> <71CFD284-4B9F-48AE-9747-B36D9F4434B6@khera.org> <43AC7711.1040905@paradise.net.nz> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Fri, 23 Dec 2005 23:00:40 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.026 required=5 tests=[AWL=0.026] X-Spam-Score: 0.026 X-Spam-Level: X-Archive-Number: 200512/594 X-Sequence-Number: 16415 On Dec 23, 2005, at 5:15 PM, Mark Kirkwood wrote: > Vivek Khera wrote: > >> and only the opteron boxes needed to come from sun. add a zero >> return policy and you wonder how they expect to keep in business.... >> sorry, i had to vent. >> > > Just out of interest - why did the opterons need to come from Sun? There are three tier-1 vendors selling opteron: IBM, Sun, and HP. HP's have historically had slow RAID configurations, and IBM tries to hide them and only offers really one model, a 1U unit. I've already been through buying opteron systems from the smaller vendors and it basically wasted a lot of my time due to what seems like quality control issues. So it could be Sun or IBM. IBM seems to make it harder to buy from them than Sun... From pgsql-performance-owner@postgresql.org Sat Dec 24 15:50:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1FDC99DC821 for ; Sat, 24 Dec 2005 15:50:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30776-06 for ; Sat, 24 Dec 2005 15:50:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by postgresql.org (Postfix) with ESMTP id 4E99E9DC800 for ; Sat, 24 Dec 2005 15:50:37 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jBOJob3v030793; Sat, 24 Dec 2005 13:50:37 -0600 Date: Sat, 24 Dec 2005 13:50:42 -0600 From: Frank Wiles To: Juan Casero Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Message-Id: <20051224135042.484c6e32.frank@wiles.org> In-Reply-To: <200512212231.55100.caseroj@comcast.net> References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/595 X-Sequence-Number: 16416 On Wed, 21 Dec 2005 22:31:54 -0500 Juan Casero wrote: > Sorry folks. I had a couple of glasses of wine as I wrote this. > Anyway I originally wanted the box to have more than two drives so I > could do RAID 5 but that is going to cost too much. Also, contrary > to my statement below it seems to me I should run the 32 bit > postgresql server on the 64 bit kernel. Would you agree this will > probably yield the best performance? I know it depends alot on the > system but for now this database is about 20 gigabytes. Not too large > right now but it may grow 5x in the next year. You definitely DO NOT want to do RAID 5 on a database server. That is probably the worst setup you could have, I've seen it have lower performance than just a single hard disk. RAID 1 and RAID 1+0 are optimal, but you want to stay far away from RAID 5. IMHO RAID 5 is only useful on near line backup servers or Samba file servers where space is more important than speed. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Sat Dec 24 17:31:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 529789DC9B0 for ; Sat, 24 Dec 2005 17:31:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42551-08-5 for ; Sat, 24 Dec 2005 17:31:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from elasmtp-kukur.atl.sa.earthlink.net (elasmtp-kukur.atl.sa.earthlink.net [209.86.89.65]) by postgresql.org (Postfix) with ESMTP id B87A29DC983 for ; Sat, 24 Dec 2005 17:31:31 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=rOyQzQS7j05VqVzZ7g6O8p74gXpwc3oU8E9iW8lo+4TEGOcCnQVF5ZQ2MFJx5Znx; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:Cc:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by elasmtp-kukur.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1EqGzE-0008S2-LL; Sat, 24 Dec 2005 16:31:32 -0500 Message-Id: <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Sat, 24 Dec 2005 16:31:30 -0500 To: Frank Wiles ,Juan Casero From: Ron Subject: Re: What's the best hardver for PostgreSQL 8.1? Cc: pgsql-performance@postgresql.org In-Reply-To: <20051224135042.484c6e32.frank@wiles.org> References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc04d586899b1296736dc84582965296f2350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.319 required=5 tests=[AWL=-0.160, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.319 X-Spam-Level: X-Archive-Number: 200512/596 X-Sequence-Number: 16417 At 02:50 PM 12/24/2005, Frank Wiles wrote: >On Wed, 21 Dec 2005 22:31:54 -0500 >Juan Casero wrote: > > > Sorry folks. I had a couple of glasses of wine as I wrote this. > > Anyway I originally wanted the box to have more than two drives so I > > could do RAID 5 but that is going to cost too much. Also, contrary > > to my statement below it seems to me I should run the 32 bit > > postgresql server on the 64 bit kernel. Would you agree this will > > probably yield the best performance? I know it depends alot on the > > system but for now this database is about 20 gigabytes. Not too large > > right now but it may grow 5x in the next year. > > You definitely DO NOT want to do RAID 5 on a database server. That > is probably the worst setup you could have, I've seen it have lower > performance than just a single hard disk. > > RAID 1 and RAID 1+0 are optimal, but you want to stay far away from > RAID 5. IMHO RAID 5 is only useful on near line backup servers or > Samba file servers where space is more important than speed. That's a bit misleading. RAID 5 excels when you want read speed but don't care as much about write speed. Writes are typical ~2/3 the speed of reads on a typical decent RAID 5 set up. Side Note: Some years ago Mylex had a family of fast (for the time) RAID 5 HW controllers that actually read and wrote at the same speed. IBM bought them to kill them and protect LSI Logic. Mylex X24's (?IIRC the model number correctly?) are still reasonable HW. So if you have tables that are read often and written to rarely or not at all, putting them on RAID 5 is optimal. In both data mining like and OLTP like apps there are usually at least some such tables. RAID 1 is good for stuff where speed doesn't matter and all you are looking for is an insurance policy. RAID 10 is the best way to get high performance on both reads and writes, but it has a significantly greater cost for the same amount of usable physical media. If you've got the budget or are dealing with small enough physical storage needs, by all means use RAID 10. OTOH, if you are dealing with large enterprise class apps like Sarbanes Oxley compliance, medical and/or insurance, etc, etc, the storage needs can get so large that RAID 10 for everything or even most things is not possible. Even if economically feasible. RAID levels are like any other tool. Each is useful in the proper circumstances. Happy holidays, Ron Peacetree From pgsql-performance-owner@postgresql.org Sat Dec 24 17:42:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3C3369DC871 for ; Sat, 24 Dec 2005 17:42:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46287-05 for ; Sat, 24 Dec 2005 17:42:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by postgresql.org (Postfix) with ESMTP id EB68E9DC821 for ; Sat, 24 Dec 2005 17:42:00 -0400 (AST) Received: from [192.168.1.100] (or-67-76-146-141.sta.sprint-hsd.net [67.76.146.141]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id jBOLYMHO030186; Sat, 24 Dec 2005 13:34:23 -0800 Message-ID: <43ADC0A8.20503@commandprompt.com> Date: Sat, 24 Dec 2005 13:42:00 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ron CC: Frank Wiles , Juan Casero , pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> In-Reply-To: <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Sat, 24 Dec 2005 13:34:23 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.036 required=5 tests=[AWL=0.036] X-Spam-Score: 0.036 X-Spam-Level: X-Archive-Number: 200512/597 X-Sequence-Number: 16418 > > If you've got the budget or are dealing with small enough physical > storage needs, by all means use RAID 10. OTOH, if you are dealing > with large enterprise class apps like Sarbanes Oxley compliance, > medical and/or insurance, etc, etc, the storage needs can get so large > that RAID 10 for everything or even most things is not possible. Even > if economically feasible. > > RAID levels are like any other tool. Each is useful in the proper > circumstances. > There is also RAID 50 which is quite nice. Joshua D. Drake > Happy holidays, > Ron Peacetree > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings -- The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 PostgreSQL Replication, Consulting, Custom Development, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: PLphp, PLperl - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Sat Dec 24 17:57:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 314409DC821 for ; Sat, 24 Dec 2005 17:57:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50071-02 for ; Sat, 24 Dec 2005 17:57:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id E140E9DC803 for ; Sat, 24 Dec 2005 17:55:17 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 72DB61AC3E9; Sat, 24 Dec 2005 13:55:31 -0800 (PST) Date: Sat, 24 Dec 2005 13:54:21 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Ron Cc: Frank Wiles , Juan Casero , pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> Message-ID: References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> 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, score=0.052 required=5 tests=[AWL=0.052] X-Spam-Score: 0.052 X-Spam-Level: X-Archive-Number: 200512/598 X-Sequence-Number: 16419 On Sat, 24 Dec 2005, Ron wrote: > At 02:50 PM 12/24/2005, Frank Wiles wrote: >> Juan Casero wrote: >> >> > Sorry folks. I had a couple of glasses of wine as I wrote this. >> > Anyway I originally wanted the box to have more than two drives so I >> > could do RAID 5 but that is going to cost too much. Also, contrary >> > to my statement below it seems to me I should run the 32 bit >> > postgresql server on the 64 bit kernel. Would you agree this will >> > probably yield the best performance? I know it depends alot on the >> > system but for now this database is about 20 gigabytes. Not too large >> > right now but it may grow 5x in the next year. >> >> You definitely DO NOT want to do RAID 5 on a database server. That >> is probably the worst setup you could have, I've seen it have lower >> performance than just a single hard disk. >> >> RAID 1 and RAID 1+0 are optimal, but you want to stay far away from >> RAID 5. IMHO RAID 5 is only useful on near line backup servers or >> Samba file servers where space is more important than speed. > That's a bit misleading. RAID 5 excels when you want read speed but don't > care as much about write speed. Writes are typical ~2/3 the speed of reads > on a typical decent RAID 5 set up. > > So if you have tables that are read often and written to rarely or not at > all, putting them on RAID 5 is optimal. In both data mining like and OLTP > like apps there are usually at least some such tables. raid 5 is bad for random writes as you state, but how does it do for sequential writes (for example data mining where you do a large import at one time, but seldom do other updates). I'm assuming a controller with a reasonable amount of battery-backed cache. David Lang From pgsql-performance-owner@postgresql.org Sat Dec 24 18:25:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 921949DC948 for ; Sat, 24 Dec 2005 18:25:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53742-01 for ; Sat, 24 Dec 2005 18:25:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth07.mail.atl.earthlink.net (smtpauth07.mail.atl.earthlink.net [209.86.89.67]) by postgresql.org (Postfix) with ESMTP id 1FD149DC874 for ; Sat, 24 Dec 2005 18:24:59 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=aruuIyJ/auGr5FBxOlr1lGjvjRv/Sk8yrxbm95XeTsGQRjqoxunussFay9msn3Ts; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth07.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EqHoy-0007OU-Mc; Sat, 24 Dec 2005 17:25:00 -0500 Message-Id: <6.2.5.6.0.20051224171301.01dd4e00@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Sat, 24 Dec 2005 17:24:58 -0500 To: "Joshua D. Drake" , pgsql-performance@postgresql.org From: Ron Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <43ADC0A8.20503@commandprompt.com> References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <43ADC0A8.20503@commandprompt.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcd6618f7f2ce86a2ccc454cf2980d9812350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.373 required=5 tests=[AWL=-0.106, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.373 X-Spam-Level: X-Archive-Number: 200512/599 X-Sequence-Number: 16420 At 04:42 PM 12/24/2005, Joshua D. Drake wrote: >>If you've got the budget or are dealing with small enough physical >>storage needs, by all means use RAID 10. OTOH, if you are dealing >>with large enterprise class apps like Sarbanes Oxley compliance, >>medical and/or insurance, etc, etc, the storage needs can get so >>large that RAID 10 for everything or even most things is not >>possible. Even if economically feasible. >> >>RAID levels are like any other tool. Each is useful in the proper >>circumstances. >There is also RAID 50 which is quite nice. The "quite nice" part that Joshua is referring to is that RAID 50 gets most of the write performance of RAID 10 w/o using nearly as many HD's as RAID 10. OTOH, there still is a significant increase in the number of HD's used, and that means MBTF's become more frequent but you are not getting protection levels you would with RAID 10. IME RAID 50 gets mixed reviews. My two biggest issues are a= Admin of RAID 50 is more complex than the other commonly used versions (1, 10, 5, and 6) b= Once a HD failure takes place, you suffer a _permenent_ performance drop, even after the automatic volume rebuild, until you take the entire RAID 50 array off line, reinitialize it, and rebuild it from scratch. IME "a" and "b" make RAID 50 inappropriate for any but the biggest and most dedicated of DB admin groups. YMMV, Ron From pgsql-performance-owner@postgresql.org Sat Dec 24 18:37:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EECFA9DC9B6 for ; Sat, 24 Dec 2005 18:37:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50247-07 for ; Sat, 24 Dec 2005 18:37:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 456999DC821 for ; Sat, 24 Dec 2005 18:36:58 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9720F33A69; Sat, 24 Dec 2005 23:37:00 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Sat, 24 Dec 2005 14:36:57 -0800 Organization: Hub.Org Networking Services Lines: 14 Message-ID: References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> 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.7 (X11/20050923) 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, score=0.03 required=5 tests=[AWL=0.030] X-Spam-Score: 0.03 X-Spam-Level: X-Archive-Number: 200512/600 X-Sequence-Number: 16421 David Lang wrote: > raid 5 is bad for random writes as you state, but how does it do for > sequential writes (for example data mining where you do a large import > at one time, but seldom do other updates). I'm assuming a controller > with a reasonable amount of battery-backed cache. Random write performance (small block that only writes to 1 drive): 1 write requires N-1 reads + N writes --> 1/2N-1 % Sequential write performance (write big enough block to use all N drives): N-1 Write requires N writes --> N-1/N % Assuming enough cache so all reads/writes are done in 1 transaction + onboard processor calcs RAID parity fast enough to not cause an extra delay. From pgsql-performance-owner@postgresql.org Sat Dec 24 18:45:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AEA5D9DC9B6 for ; Sat, 24 Dec 2005 18:45:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56893-03 for ; Sat, 24 Dec 2005 18:45:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth08.mail.atl.earthlink.net (smtpauth08.mail.atl.earthlink.net [209.86.89.68]) by postgresql.org (Postfix) with ESMTP id 9C8359DC9B0 for ; Sat, 24 Dec 2005 18:45:19 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=g3oH53x3Sc+dGXJoi40RMlusmhd9n579Q3lWJOWgs8kxqrvxcj8D8s0wmDm7uQRi; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth08.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EqI8f-00048n-Dd; Sat, 24 Dec 2005 17:45:21 -0500 Message-Id: <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Sat, 24 Dec 2005 17:45:20 -0500 To: David Lang ,pgsql-performance@postgresql.org From: Ron Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcf681434346b101292c259b2d162116d6350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.392 required=5 tests=[AWL=-0.087, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.392 X-Spam-Level: X-Archive-Number: 200512/601 X-Sequence-Number: 16422 At 04:54 PM 12/24/2005, David Lang wrote: >raid 5 is bad for random writes as you state, but how does it do for >sequential writes (for example data mining where you do a large >import at one time, but seldom do other updates). I'm assuming a >controller with a reasonable amount of battery-backed cache. The issue with RAID 5 writes centers on the need to recalculate checksums for the ECC blocks distributed across the array and then write the new ones to physical media. Caches help, and the bigger the cache the better, but once you are doing enough writes fast enough (and that doesn't take much even with a few GBs of cache) the recalculate-checksums-and-write-new-ones overhead will decrease the write speed of real data. Bear in mind that the HD's _raw_ write speed hasn't been decreased. Those HD's are pounding away as fast as they can for you. Your _effective_ or _data level_ write speed is what decreases due to overhead. Side Note: people often forget the other big reason to use RAID 10 over RAID 5. RAID 5 is always only 2 HD failures from data loss. RAID 10 can lose up to 1/2 the HD's in the array w/o data loss unless you get unlucky and lose both members of a RAID 1 set. This can be seen as an example of the classic space vs. time trade off in performance tuning. You can use 2x the HDs you need and implement RAID 10 for best performance and reliability or you can dedicate less HD's to RAID and implement RAID 5 for less (write) performance and lower reliability. TANSTAAFL. Ron Peacetree From pgsql-performance-owner@postgresql.org Sat Dec 24 18:53:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1EBAC9DC874 for ; Sat, 24 Dec 2005 18:53:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52863-09 for ; Sat, 24 Dec 2005 18:53:33 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D14419DC83A for ; Sat, 24 Dec 2005 18:53:29 -0400 (AST) Received: from mail.nederland.net (mail.nederland.net [83.137.20.15]) by svr4.postgresql.org (Postfix) with ESMTP id C52C45AFB51 for ; Sat, 24 Dec 2005 22:53:32 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by romeo.computel.nl (Postfix) with ESMTP id BF5961412E; Sat, 24 Dec 2005 23:53:30 +0100 (CET) Received: from mail.nederland.net ([127.0.0.1]) by localhost (romeo.computel.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01556-11; Sat, 24 Dec 2005 23:53:29 +0100 (CET) Received: from balefirehome (balefire.demon.nl [212.238.240.59]) by romeo.computel.nl (Postfix) with ESMTP id DF50514036; Sat, 24 Dec 2005 23:53:28 +0100 (CET) Message-ID: <001301c608dc$f9b2cdb0$64c8a8c0@balefirehome> From: "Sander Steffann" To: , "Ron" References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <43ADC0A8.20503@commandprompt.com> <6.2.5.6.0.20051224171301.01dd4e00@earthlink.net> Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Sat, 24 Dec 2005 23:54:19 +0100 Organization: Computel Standby BV MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/602 X-Sequence-Number: 16423 Hi, > b= Once a HD failure takes place, you suffer a _permenent_ performance > drop, even after the automatic volume rebuild, until you take the entire > RAID 50 array off line, reinitialize it, and rebuild it from scratch. Where did you get that crazy idea? When you have replaced the drive and the RAID is rebuilt, you have exactly the same situation as before the drive failed. Why would you get less performance? Sander. From pgsql-performance-owner@postgresql.org Sat Dec 24 21:52:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 14C7A9DC9DF for ; Sat, 24 Dec 2005 21:52:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78023-09 for ; Sat, 24 Dec 2005 21:52:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id B43669DC821 for ; Sat, 24 Dec 2005 21:52:01 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Sat, 24 Dec 2005 20:51:54 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 24 Dec 2005 20:51:54 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Sat, 24 Dec 2005 20:51:15 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] What's the best hardver for PostgreSQL 8.1? Thread-Index: AcYIw2mHy7KKU05HStqF4fcSnkQ8GgAMVMwQ From: "Luke Lonergan" To: "Frank Wiles" , "Juan Casero" cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 25 Dec 2005 01:51:54.0162 (UTC) FILETIME=[C7F8D120:01C608F5] X-WSS-ID: 6FB324B012G427389-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.016 required=5 tests=[AWL=0.016] X-Spam-Score: 0.016 X-Spam-Level: X-Archive-Number: 200512/603 X-Sequence-Number: 16424 Frank,=20 > You definitely DO NOT want to do RAID 5 on a database server. That > is probably the worst setup you could have, I've seen it have lower > performance than just a single hard disk.=20 I've seen that on RAID0 and RAID10 as well. This is more about the quality and modernity of the RAID controller than anything else at this point, although there are some theoretical advantages of RAID10 from a random seek standpoint even if the adapter CPU is infinitely fast at checksumming. We're using RAID5 in practice for OLAP / Data Warehousing systems very successfully using the newest RAID cards from 3Ware (9550SX). Note that host-based SCSI raid cards from LSI, Adaptec, Intel, Dell, HP and others have proven to have worse performance than a single disk drive in many cases, whether for RAID0 or RAID5. In most circumstances I've seen, people don't even notice until they write a message to a mailing list about "my query runs slowly on xxx dbms". In many cases, after they run a simple sequential transfer rate test using dd, they see that their RAID controller is the culprit. Recently, I helped a company named DeepData to improve their dbms performance, which was a combination of moving them to software RAID50 on Linux and getting them onto Bizgres. The disk subsystem sped up on the same hardware (minus the HW RAID card) by over a factor of 10. The downside is that SW RAID is a pain in the neck for management - you have to shut down the Linux host when a disk fails to replace it. - Luke From pgsql-performance-owner@postgresql.org Sat Dec 24 23:04:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 96BA19DC86B for ; Sat, 24 Dec 2005 23:04:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95520-02 for ; Sat, 24 Dec 2005 23:04:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id 100F09DC821 for ; Sat, 24 Dec 2005 23:04:10 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 821A91AC3E9; Sat, 24 Dec 2005 19:04:35 -0800 (PST) Date: Sat, 24 Dec 2005 19:03:20 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: Frank Wiles , Juan Casero , pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> Message-ID: References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.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, score=0.056 required=5 tests=[AWL=0.056] X-Spam-Score: 0.056 X-Spam-Level: X-Archive-Number: 200512/604 X-Sequence-Number: 16425 On Sat, 24 Dec 2005, Luke Lonergan wrote: > Recently, I helped a company named DeepData to improve their dbms > performance, which was a combination of moving them to software RAID50 > on Linux and getting them onto Bizgres. The disk subsystem sped up on > the same hardware (minus the HW RAID card) by over a factor of 10. The > downside is that SW RAID is a pain in the neck for management - you have > to shut down the Linux host when a disk fails to replace it. Luke, you should not need to shut down the linux host when a disk fails. you should be able to use mdadm to mark the drive as failed, then remove it from the system and replace it, then use mdadm to add the drive to the array. I'm fighting through a double disk failure on my system at home and when I hit a bad spot on a drive (failing it from the array) I can just re-add it without having to restart everything (if it's the second drive I will have to stop and restart the array, but that's becouse the entire array has failed at that point) now hot-swap may not be supported on all interface types, that may be what you have run into, but with SCSI or SATA you should be able to hot-swap with the right controller. David Lang From pgsql-performance-owner@postgresql.org Sat Dec 24 23:16:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2868F9DC821 for ; Sat, 24 Dec 2005 23:16:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97795-03 for ; Sat, 24 Dec 2005 23:16:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id E28309DC803 for ; Sat, 24 Dec 2005 23:16:14 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Sat, 24 Dec 2005 22:16:10 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 24 Dec 2005 22:16:10 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Sat, 24 Dec 2005 22:13:43 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] What's the best hardver for PostgreSQL 8.1? Thread-Index: AcYI/+ilBVfOUleGTniV+8uHSRr4cAAAU2Sh References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> From: "Luke Lonergan" To: "David Lang" cc: "Frank Wiles" , "Juan Casero" , pgsql-performance@postgresql.org X-OriginalArrivalTime: 25 Dec 2005 03:16:10.0076 (UTC) FILETIME=[8D8811C0:01C60901] X-WSS-ID: 6FB0D17032K820472-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/605 X-Sequence-Number: 16426 David, > now hot-swap may not be supported on all interface types, that may be = what=20 > you have run into, but with SCSI or SATA you should be able to = hot-swap=20 > with the right controller. That's actually the problem - Linux hot swap is virtually non-functional = for SCSI. You can write into the proper places in /proc, then remove = and rescan to get a new drive up, but I've found that the resulting OS = state is flaky. This is true of the latest 2.6 kernels and LSI and = Adaptec SCSI controllers. The problems I've seen are with Linux, not the controllers. - Luke From pgsql-performance-owner@postgresql.org Sat Dec 24 23:44:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 31D799DC89C for ; Sat, 24 Dec 2005 23:44:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01505-01 for ; Sat, 24 Dec 2005 23:43:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id F1EFF9DC86B for ; Sat, 24 Dec 2005 23:43:50 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 5FCD033A69; Sun, 25 Dec 2005 04:43:55 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Sat, 24 Dec 2005 19:43:52 -0800 Organization: Hub.Org Networking Services Lines: 20 Message-ID: References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.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.7 (X11/20050923) X-Accept-Language: en-us, en In-Reply-To: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.048 required=5 tests=[AWL=0.048] X-Spam-Score: 0.048 X-Spam-Level: X-Archive-Number: 200512/606 X-Sequence-Number: 16427 Luke Lonergan wrote: > Note that host-based SCSI raid cards from LSI, Adaptec, Intel, Dell, HP > and others have proven to have worse performance than a single disk > drive in many cases, whether for RAID0 or RAID5. In most circumstances This is my own experience. Running a LSI MegaRAID in pure passthrough mode + Linux software RAID10 is a ton faster than configuring the RAID via the LSI card. One of the things I've noticed is that the card does not seem to be able to parallel read on mirrors. While looking at iostat under Linux, I can see software RAID1 reading all drives and the MD number adding up to the sum of all drives. The ARECA SATA controller I just got though doesn't seem to exhibit these problems. Performance is a few % points above Linux software RAID at lower CPU usage. In fact, I'm getting better single-threaded bandwidth on a 4x7200RPM SATA config versus a 6x15K SCSI config on the LSI. The drives are bigger for the SATA drive (300GB) versus 36GB for the SCSI so that means the heads don't have to move any where as much and can stay on the fast portion of the disk. Haven't had a chance to test multi-user DB between the two setup though. From pgsql-performance-owner@postgresql.org Sun Dec 25 00:20:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 53D8A9DCCDA for ; Sun, 25 Dec 2005 00:20:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09692-04-7 for ; Sun, 25 Dec 2005 00:19:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by postgresql.org (Postfix) with ESMTP id 10DC29DCD68 for ; Sun, 25 Dec 2005 00:19:19 -0400 (AST) Received: from [192.168.1.100] (or-67-76-146-141.sta.sprint-hsd.net [67.76.146.141]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id jBP4BCWJ004753; Sat, 24 Dec 2005 20:11:18 -0800 Message-ID: <43AE1DAF.5070207@commandprompt.com> Date: Sat, 24 Dec 2005 20:18:55 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan CC: David Lang , Frank Wiles , Juan Casero , pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.com> In-Reply-To: <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Sat, 24 Dec 2005 20:11:19 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.038 required=5 tests=[AWL=0.038] X-Spam-Score: 0.038 X-Spam-Level: X-Archive-Number: 200512/607 X-Sequence-Number: 16428 Luke Lonergan wrote: >David, > > > >>now hot-swap may not be supported on all interface types, that may be what >>you have run into, but with SCSI or SATA you should be able to hot-swap >>with the right controller. >> >> > >That's actually the problem - Linux hot swap is virtually non-functional for SCSI. You can write into the proper places in /proc, then remove and rescan to get a new drive up, but I've found that the resulting OS state is flaky. This is true of the latest 2.6 kernels and LSI and Adaptec SCSI controllers. > >The problems I've seen are with Linux, not the controllers. > > Interesting, I have had zero problems with Linux and SATA with LSI controllers and hot plug. I wonder what the difference is. The LSI controller even though SATA just uses the scsi driver. Joshua D. Drake >- Luke > > > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster > > -- The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 PostgreSQL Replication, Consulting, Custom Development, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: PLphp, PLperl - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Sun Dec 25 08:15:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8EE8D9DC801 for ; Sun, 25 Dec 2005 08:15:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67165-09 for ; Sun, 25 Dec 2005 08:15:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id C83BC9DC8E1 for ; Sun, 25 Dec 2005 08:14:45 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 904361AC3E9; Sun, 25 Dec 2005 04:15:08 -0800 (PST) Date: Sun, 25 Dec 2005 04:13:57 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Luke Lonergan Cc: Frank Wiles , Juan Casero , pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.com> Message-ID: References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.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, score=0.053 required=5 tests=[AWL=0.053] X-Spam-Score: 0.053 X-Spam-Level: X-Archive-Number: 200512/608 X-Sequence-Number: 16429 On Sat, 24 Dec 2005, Luke Lonergan wrote: > David, > >> now hot-swap may not be supported on all interface types, that may be what >> you have run into, but with SCSI or SATA you should be able to hot-swap >> with the right controller. > > That's actually the problem - Linux hot swap is virtually non-functional for SCSI. You can write into the proper places in /proc, then remove and rescan to get a new drive up, but I've found that the resulting OS state is flaky. This is true of the latest 2.6 kernels and LSI and Adaptec SCSI controllers. > > The problems I've seen are with Linux, not the controllers. Thanks for the clarification, I knew that PATA didn't do hotswap, and I've seen discussions on the linux-kernel list about SATA hotswap being worked on, but I thought that scsi handled it. how recent a kernel have you had problems with? David Lang From pgsql-performance-owner@postgresql.org Sun Dec 25 08:29:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C9AD99DC9CB for ; Sun, 25 Dec 2005 08:29:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72316-08 for ; Sun, 25 Dec 2005 08:29:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id E75859DC95F for ; Sun, 25 Dec 2005 08:29:16 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EqV02-0005Bp-TQ for pgsql-performance@postgresql.org; Sun, 25 Dec 2005 13:29:19 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EqV04-0003PZ-00 for ; Sun, 25 Dec 2005 13:29:20 +0100 Date: Sun, 25 Dec 2005 13:29:19 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Message-ID: <20051225122919.GA13089@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux 2.6.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.053 required=5 tests=[AWL=0.053] X-Spam-Score: 0.053 X-Spam-Level: X-Archive-Number: 200512/609 X-Sequence-Number: 16430 On Sun, Dec 25, 2005 at 04:13:57AM -0800, David Lang wrote: > Thanks for the clarification, I knew that PATA didn't do hotswap, and I've > seen discussions on the linux-kernel list about SATA hotswap being worked > on, but I thought that scsi handled it. how recent a kernel have you had > problems with? Is has largely worked for us, even though it's a bit hackish -- you _must_ disconnect the drive properly in the kernel before ejecting it physically, though, or it will never reconnect. At least that's how it is with our Adaptec 19160. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Sun Dec 25 11:10:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7FAE39DC81A for ; Sun, 25 Dec 2005 11:10:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95866-03 for ; Sun, 25 Dec 2005 11:10:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 3C0759DC80C for ; Sun, 25 Dec 2005 11:10:01 -0400 (AST) Received: (qmail 18283 invoked by uid 500); 25 Dec 2005 15:15:43 -0000 Date: Sun, 25 Dec 2005 09:15:43 -0600 From: Bruno Wolff III To: Luke Lonergan Cc: David Lang , Frank Wiles , Juan Casero , pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? Message-ID: <20051225151543.GB11637@wolff.to> Mail-Followup-To: Bruno Wolff III , Luke Lonergan , David Lang , Frank Wiles , Juan Casero , pgsql-performance@postgresql.org References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3E37B936B592014B978C4415F90D662D01F47552@MI8NYCMAIL06.Mi8.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/610 X-Sequence-Number: 16431 On Sat, Dec 24, 2005 at 22:13:43 -0500, Luke Lonergan wrote: > David, > > > now hot-swap may not be supported on all interface types, that may be what > > you have run into, but with SCSI or SATA you should be able to hot-swap > > with the right controller. > > That's actually the problem - Linux hot swap is virtually non-functional for SCSI. You can write into the proper places in /proc, then remove and rescan to get a new drive up, but I've found that the resulting OS state is flaky. This is true of the latest 2.6 kernels and LSI and Adaptec SCSI controllers. > > The problems I've seen are with Linux, not the controllers. The other option is to keep hot spares available so that you can have a failure or two before you have to pull drives out. This might allow you to get to a maintenance window to swap out the bad drives. From pgsql-performance-owner@postgresql.org Sun Dec 25 13:38:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C52989DC848 for ; Sun, 25 Dec 2005 13:38:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15306-05 for ; Sun, 25 Dec 2005 13:38:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by postgresql.org (Postfix) with ESMTP id 8E0E19DC81A for ; Sun, 25 Dec 2005 13:38:13 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.72.158]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IS200084EB2PF90@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Sun, 25 Dec 2005 11:37:51 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 31FB46057D8 for ; Sun, 25 Dec 2005 12:37:56 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05779-01 for ; Sun, 25 Dec 2005 12:37:55 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id D46286001CA; Sun, 25 Dec 2005 12:37:55 -0500 (EST) Date: Sun, 25 Dec 2005 12:37:55 -0500 From: Michael Stone Subject: Re: What's the best hardver for PostgreSQL 8.1? In-reply-to: <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051225173755.GA6986@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200512/611 X-Sequence-Number: 16432 On Sat, Dec 24, 2005 at 05:45:20PM -0500, Ron wrote: >Caches help, and the bigger the cache the better, but once you are >doing enough writes fast enough (and that doesn't take much even with >a few GBs of cache) the recalculate-checksums-and-write-new-ones >overhead will decrease the write speed of real data. Bear in mind >that the HD's _raw_ write speed hasn't been decreased. Those HD's >are pounding away as fast as they can for you. Your _effective_ or >_data level_ write speed is what decreases due to overhead. You're overgeneralizing. Assuming a large cache and a sequential write, there's need be no penalty for raid 5. (For random writes you may need to read unrelated blocks in order to calculate parity, but for large sequential writes the parity blocks should all be read from cache.) A modern cpu can calculate parity for raid 5 on the order of gigabytes per second, and even crummy embedded processors can do hundreds of megabytes per second. You may have run into some lousy implementations, but you should be much more specific about what hardware you're talking about instead of making sweeping generalizations. >Side Note: people often forget the other big reason to use RAID 10 >over RAID 5. RAID 5 is always only 2 HD failures from data >loss. RAID 10 can lose up to 1/2 the HD's in the array w/o data loss >unless you get unlucky and lose both members of a RAID 1 set. IOW, your RAID 10 is only 2 HD failures from data loss also. If that's an issue you need to go with RAID 6 or add another disk to each mirror. Mike Stone From pgsql-performance-owner@postgresql.org Mon Dec 26 07:21:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 15DD69DDF57 for ; Mon, 26 Dec 2005 07:21:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25921-02-6 for ; Mon, 26 Dec 2005 06:21:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from server10.araisoft.com (unknown [72.9.228.195]) by postgresql.org (Postfix) with ESMTP id 535309DDD83 for ; Mon, 26 Dec 2005 05:22:28 -0400 (AST) Received: from localhost (unknown [127.0.0.1]) by server10.araisoft.com (Postfix) with ESMTP id 988A13D6200C for ; Mon, 26 Dec 2005 01:22:13 -0800 (PST) Received: from server10.araisoft.com ([127.0.0.1]) by localhost (server10.araisoft.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07257-03 for ; Mon, 26 Dec 2005 01:22:07 -0800 (PST) Received: from [192.168.1.103] (adsl-69-235-152-146.dsl.irvnca.pacbell.net [69.235.152.146]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server10.araisoft.com (Postfix) with ESMTP id C6FD93D62008 for ; Mon, 26 Dec 2005 01:22:06 -0800 (PST) Message-ID: <43AFB641.6070009@cs.ucr.edu> Date: Mon, 26 Dec 2005 01:22:09 -0800 From: Benjamin Arai User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> In-Reply-To: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> Content-Type: multipart/alternative; boundary="------------050301090903080409000002" X-Virus-Scanned: by amavisd-new at araisoft.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.127 required=5 tests=[AWL=-0.063, HTML_MESSAGE=0.001, MISSING_HEADERS=0.189] X-Spam-Score: 0.127 X-Spam-Level: X-Archive-Number: 200512/612 X-Sequence-Number: 16433 This is a multi-part message in MIME format. --------------050301090903080409000002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Have you done any benchmarking of the 9550SX against a software raid configuration? Luke Lonergan wrote: >Frank, > > > >> You definitely DO NOT want to do RAID 5 on a database server. That >> is probably the worst setup you could have, I've seen it have lower >> performance than just a single hard disk. >> >> > >I've seen that on RAID0 and RAID10 as well. > >This is more about the quality and modernity of the RAID controller than >anything else at this point, although there are some theoretical >advantages of RAID10 from a random seek standpoint even if the adapter >CPU is infinitely fast at checksumming. We're using RAID5 in practice >for OLAP / Data Warehousing systems very successfully using the newest >RAID cards from 3Ware (9550SX). > >Note that host-based SCSI raid cards from LSI, Adaptec, Intel, Dell, HP >and others have proven to have worse performance than a single disk >drive in many cases, whether for RAID0 or RAID5. In most circumstances >I've seen, people don't even notice until they write a message to a >mailing list about "my query runs slowly on xxx dbms". In many cases, >after they run a simple sequential transfer rate test using dd, they see >that their RAID controller is the culprit. > >Recently, I helped a company named DeepData to improve their dbms >performance, which was a combination of moving them to software RAID50 >on Linux and getting them onto Bizgres. The disk subsystem sped up on >the same hardware (minus the HW RAID card) by over a factor of 10. The >downside is that SW RAID is a pain in the neck for management - you have >to shut down the Linux host when a disk fails to replace it. > >- Luke > > >---------------------------(end of broadcast)--------------------------- >TIP 6: explain analyze is your friend > > -- *Benjamin Arai* barai@cs.ucr.edu http://www.benjaminarai.com --------------050301090903080409000002 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Have you done any benchmarking of the 9550SX against a software raid configuration? 

Luke Lonergan wrote:
Frank, 

  
  You definitely DO NOT want to do RAID 5 on a database server.  That
  is probably the worst setup you could have, I've seen it have lower
  performance than just a single hard disk. 
    

I've seen that on RAID0 and RAID10 as well.

This is more about the quality and modernity of the RAID controller than
anything else at this point, although there are some theoretical
advantages of RAID10 from a random seek standpoint even if the adapter
CPU is infinitely fast at checksumming.  We're using RAID5 in practice
for OLAP / Data Warehousing systems very successfully using the newest
RAID cards from 3Ware (9550SX).

Note that host-based SCSI raid cards from LSI, Adaptec, Intel, Dell, HP
and others have proven to have worse performance than a single disk
drive in many cases, whether for RAID0 or RAID5.  In most circumstances
I've seen, people don't even notice until they write a message to a
mailing list about "my query runs slowly on xxx dbms".  In many cases,
after they run a simple sequential transfer rate test using dd, they see
that their RAID controller is the culprit.

Recently, I helped a company named DeepData to improve their dbms
performance, which was a combination of moving them to software RAID50
on Linux and getting them onto Bizgres.  The disk subsystem sped up on
the same hardware (minus the HW RAID card) by over a factor of 10.  The
downside is that SW RAID is a pain in the neck for management - you have
to shut down the Linux host when a disk fails to replace it.

- Luke


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

--------------050301090903080409000002-- From pgsql-admin-owner@postgresql.org Mon Dec 26 07:34:31 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0DB729DDD32 for ; Mon, 26 Dec 2005 07:34:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29606-07 for ; Mon, 26 Dec 2005 06:34:31 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) by postgresql.org (Postfix) with ESMTP id 7C4259DDD31 for ; Mon, 26 Dec 2005 07:34:26 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1164439nzn for ; Mon, 26 Dec 2005 03:34:29 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=NWV2rM5tcgk8gCvTE+Eo6PW6BDJd13ROz2TYWVSV2eA+jGKO6OqP+QtClA2GzuhaW3QtlofyL33kWtltYR7eCLgj/L6OVecSdrA0bwbpnnRz64QmZzeDycgoEAVfqtw7Lt6swatiOXqGKBq/azB4qSj8yfkTkYW0tTcFk52kdLM= Received: by 10.36.148.14 with SMTP id v14mr3171877nzd; Mon, 26 Dec 2005 03:34:28 -0800 (PST) Received: by 10.36.72.7 with HTTP; Mon, 26 Dec 2005 03:34:28 -0800 (PST) Message-ID: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> Date: Mon, 26 Dec 2005 17:04:28 +0530 From: Gourish Singbal To: "pgsql-admin@postgresql.org" Subject: vacuuming template0 gave ERROR MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1121_24088814.1135596868818" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.186 required=5 tests=[AWL=0.185, HTML_MESSAGE=0.001] X-Spam-Score: 0.186 X-Spam-Level: X-Archive-Number: 200512/308 X-Sequence-Number: 20028 ------=_Part_1121_24088814.1135596868818 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Guys, Got the following ERROR when i was vacuuming the template0 database. postgresql server version is 7.4.5 and stats info in postgresql.conf is # - Query/Index Statistics Collector - stats_start_collector =3D true stats_command_string =3D true stats_block_level =3D true stats_row_level =3D tue #stats_reset_on_server_start =3D true =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D step 1 update pg_database set datallowconn=3DTRUE where datname=3D'template0'; step 2 vacuum analyze verbose ...... ..... INFO: vacuuming "pg_catalog.pg_statistic" ERROR: could not access status of transaction 1107341112 DETAIL: could not open file "/home/postgres/data/pg_clog/0420": No such file or directory step 3 postgres@test1:~> /usr/local/pgsql/bin/psql ecommerce -c 'SELECT datname, age(datfrozenxid) FROM pg_database'; datname | age -----------+------------ template0 | 1112108248 database1 | 1074511487 template1 | 1073987669 (3 rows) Files in the pg_clog are:- postgres@test1:~/data/pg_clog> ls -lart total 417 -rw------- 1 postgres postgres 262144 2005-12-26 02:09 0443 drwx------ 2 postgres postgres 96 2005-12-26 02:17 ./ drwx------ 6 postgres postgres 640 2005-12-26 03:22 ../ -rw------- 1 postgres postgres 163840 2005-12-26 03:23 0444 Problem: template0 is not getting vacuumed due to the above ERROR.. please let me know whats the solution. -- Best, Gourish Singbal ------=_Part_1121_24088814.1135596868818 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
 
Guys,
 
Got the following ERROR when i was vacuuming the template0 database. <= /div>
postgresql server version is 7.4.5 and stats info in postgresql.conf i= s

# - Query/Index Statistics Collector -

stats_start_collector =3D true
stats_command_string =3D true
stats= _block_level =3D true
stats_row_level =3D tue
#stats_reset_on_server_= start =3D true

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D

step 1

update pg_database set datallowconn=3DTRUE where datname=3D'template0';<= /p>

 
step 2
vacuum analyze verbose
......
.....
INFO:  vacuuming "pg_catalog.pg_statistic"
ERROR:&nb= sp; could not access status of transaction 1107341112
DETAIL:  coul= d not open file "/home/postgres/data/pg_clog/0420": No such file = or directory
 
step 3
postgres@test1:~> /usr/local/= pgsql/bin/psql ecommerce -c 'SELECT datname, age(datfrozenxid) FROM pg_data= base';
  datname  |    age
-----------+-----= -------
 template0 | 1112108248
 database1 | 1074511487
 template1 | 1073987669
(3 rows= )
 
Files in the pg_clog are:-
postgres@test1:~/data= /pg_clog> ls -lart
total 417
-rw-------  1 postgres postg= res 262144 2005-12-26 02:09 0443
drwx------  2 postgres postgres&nb= sp;    96 2005-12-26 02:17 ./
drwx------  6 postgres postgres    640 2005-12-26 0= 3:22 ../
-rw-------  1 postgres postgres 163840 2005-12-26 03:23 04= 44
 
Problem: template0 is not getting vacuumed due to the above ERROR.. pl= ease let me know whats the solution.
--
Best,
Gourish Singbal ------=_Part_1121_24088814.1135596868818-- From pgsql-performance-owner@postgresql.org Mon Dec 26 08:13:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2C1389DC859 for ; Mon, 26 Dec 2005 08:13:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49054-01 for ; Mon, 26 Dec 2005 07:13:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id B59A59DC831 for ; Mon, 26 Dec 2005 08:13:27 -0400 (AST) Received: from 172.16.1.24 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 26 Dec 2005 07:13:23 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 26 Dec 2005 07:13:23 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: What's the best hardver for PostgreSQL 8.1? Date: Mon, 26 Dec 2005 07:13:22 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01F47553@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] What's the best hardver for PostgreSQL 8.1? Thread-Index: AcYKDsss2lfZEomuSZWA35Qt1zOFngABf+Xk References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> <43AFB641.6070009@cs.ucr.edu> From: "Luke Lonergan" To: "Benjamin Arai" cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 26 Dec 2005 12:13:23.0477 (UTC) FILETIME=[C48C7C50:01C60A15] X-WSS-ID: 6FB101E912G1033791-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.038 required=5 tests=[AWL=0.038] X-Spam-Score: 0.038 X-Spam-Level: X-Archive-Number: 200512/613 X-Sequence-Number: 16434 Benjamin, > Have you done any benchmarking of the 9550SX against a software raid = configuration? =20 =20 Interesting - no, not on SATA, mostly because I've had awful luck with = Linux drivers and SATA. The popular manufacturers of SATA to PCI bridge = chipsets are Silicon Image and Highpoint, and I've not seen Linux work = with them at any reasonable performance yet. I've also had problems = with Adaptec's cards - I think they manufacture their own SATA to PCI = chipset as well. So far, I've only had good luck with the on-chipset = Intel SATA implementation. I think the problems I've had could be = entirely driver-related, but in the end it doesn't matter if you can't = find drivers that work for Linux. =20 The other problem is getting enough SATA connections for the number of = disks we want. I do have two new Areca SATA RAID cards and I'm going to = benchmark those against the 3Ware 9550SX with 2 x 8 =3D 16 disks on one = host. =20 I guess we could run the HW RAID controllers in JBOD mode to get a good = driver / chipset configuration for software RAID, but frankly I prefer = HW RAID if it performs well. So far the SATA host-based RAID is blowing = the doors off of every other HW RAID solution I've tested. =20 - Luke From pgsql-performance-owner@postgresql.org Mon Dec 26 08:32:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 115D79DCB75 for ; Mon, 26 Dec 2005 08:32:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51289-08 for ; Mon, 26 Dec 2005 07:32:46 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.194]) by postgresql.org (Postfix) with ESMTP id C40459DCB74 for ; Mon, 26 Dec 2005 08:32:41 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1173208nzn for ; Mon, 26 Dec 2005 04:32:45 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=AqZpbtTSDhbAnYqgQ174+GXZbBGtMmysc2bPcJD2kWmL0CYibdCg/GI73kT/Z/GS9R0X34QgBwuSROhsQZk6baCt+pjSHhGqWK6qV6QI72/6GkqKJPvOQpBUJU6pK2KTV7VDQwgSAIInJGaIHErYPnKgrYEYWDnIbSsCQgs44MU= Received: by 10.36.227.70 with SMTP id z70mr3230025nzg; Mon, 26 Dec 2005 04:32:45 -0800 (PST) Received: by 10.36.72.7 with HTTP; Mon, 26 Dec 2005 04:32:44 -0800 (PST) Message-ID: <674d1f8a0512260432g56e53734h1583e36b72faeec3@mail.gmail.com> Date: Mon, 26 Dec 2005 18:02:44 +0530 From: Gourish Singbal To: pgsql-performance@postgresql.org Subject: Fwd: vacuuming template0 gave ERROR In-Reply-To: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1290_12015338.1135600364977" References: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.16 required=5 tests=[AWL=0.159, HTML_MESSAGE=0.001] X-Spam-Score: 0.16 X-Spam-Level: X-Archive-Number: 200512/614 X-Sequence-Number: 16435 ------=_Part_1290_12015338.1135600364977 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ---------- Forwarded message ---------- From: Gourish Singbal Date: Dec 26, 2005 5:04 PM Subject: vacuuming template0 gave ERROR To: "pgsql-admin@postgresql.org" Guys, Got the following ERROR when i was vacuuming the template0 database. postgresql server version is 7.4.5 and stats info in postgresql.conf is # - Query/Index Statistics Collector - stats_start_collector =3D true stats_command_string =3D true stats_block_level =3D true stats_row_level =3D tue #stats_reset_on_server_start =3D true =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D step 1 update pg_database set datallowconn=3DTRUE where datname=3D'template0'; step 2 \c template0 vacuum analyze verbose ...... ..... INFO: vacuuming "pg_catalog.pg_statistic" ERROR: could not access status of transaction 1107341112 DETAIL: could not open file "/home/postgres/data/pg_clog/0420": No such file or directory step 3 postgres@test1:~> /usr/local/pgsql/bin/psql database1 -c 'SELECT datname, age(datfrozenxid) FROM pg_database'; datname | age -----------+------------ template0 | 1112108248 database1 | 1074511487 template1 | 1073987669 (3 rows) Files in the pg_clog are:- postgres@test1:~/data/pg_clog> ls -lart total 417 -rw------- 1 postgres postgres 262144 2005-12-26 02:09 0443 drwx------ 2 postgres postgres 96 2005-12-26 02:17 ./ drwx------ 6 postgres postgres 640 2005-12-26 03:22 ../ -rw------- 1 postgres postgres 163840 2005-12-26 03:23 0444 Problem: template0 is not getting vacuumed due to the above ERROR.. please let me know whats the solution. -- Best, Gourish Singbal -- Best, Gourish Singbal ------=_Part_1290_12015338.1135600364977 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

---------- Forwarded message ----------
From: Gourish Singbal <gourish@gmail.com>
Date: Dec 26, 2005 5= :04 PM
Subject: vacuuming template0 gave ERROR
To: "pgsql-admin@postgresql.org" <pgsql-admin@postgresql.org><= br>
 
Guys,
 
Got the following ERROR when i was vacuuming the template0 database. <= /div>
postgresql server version is 7.4.5 and stats info in postgresql.conf i= s

# - Query/Index Statistics Collector -

stats_start_collector =3D true
stats_command_string =3D true
stats= _block_level =3D true
stats_row_level =3D tue
#stats_reset_on_server_= start =3D true

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D

step 1

update pg_database set datallowconn=3DTRUE where datname=3D'template0';<= /p>

 
step 2
\c template0
vacuum analyze verbose
......
.....
INFO:  vacuuming "pg_catalog.pg_statistic"
ERROR:&nb= sp; could not access status of transaction 1107341112
DETAIL:  coul= d not open file "/home/postgres/data/pg_clog/0420": No such file = or directory=20
 
step 3
postgres@test1:~> /usr/local/= pgsql/bin/psql database1 -c 'SELECT datname, age(datfrozenxid) FROM pg= _database';
  datname  |    age
-----------+-----------= -
 template0 | 1112108248
 database1 | 1074511487
 = ;template1 | 1073987669
(3 rows)
 
Files in the pg_clog are:-
postgres@test1:~/data= /pg_clog> ls -lart
total 417
-rw-------  1 postgres postg= res 262144 2005-12-26 02:09 0443
drwx------  2 postgres postgres     96 2005-12= -26 02:17 ./
drwx------  6 postgres postgres    640= 2005-12-26 03:22 ../
-rw-------  1 postgres postgres 163840 2005-1= 2-26 03:23 0444
 
Problem: template0 is not getting vacuumed due to the above ERROR.. pl= ease let me know whats the solution.
--
Best,
Gourish Singbal

--
Best,
Gourish Singbal=20 ------=_Part_1290_12015338.1135600364977-- From pgsql-admin-owner@postgresql.org Mon Dec 26 12:02:58 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AB3D49DC82B for ; Mon, 26 Dec 2005 12:02:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86108-05 for ; Mon, 26 Dec 2005 11:02:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id CD2079DC80B for ; Mon, 26 Dec 2005 12:02:54 -0400 (AST) 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 jBQG2qYd009823; Mon, 26 Dec 2005 11:02:53 -0500 (EST) To: Gourish Singbal cc: "pgsql-admin@postgresql.org" Subject: Re: vacuuming template0 gave ERROR In-reply-to: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> References: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> Comments: In-reply-to Gourish Singbal message dated "Mon, 26 Dec 2005 17:04:28 +0530" Date: Mon, 26 Dec 2005 11:02:52 -0500 Message-ID: <9822.1135612972@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200512/312 X-Sequence-Number: 20032 Gourish Singbal writes: > Got the following ERROR when i was vacuuming the template0 database. Why were you doing that in the first place? template0 shouldn't ever be touched. > postgresql server version is 7.4.5 The underlying cause is likely related to this 7.4.6 bug fix: 2004-10-13 18:22 tgl * contrib/pgstattuple/pgstattuple.c, src/backend/access/heap/heapam.c, src/backend/utils/adt/ri_triggers.c (REL7_4_STABLE): Repair possible failure to update hint bits back to disk, per http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php. I plan a more permanent fix in HEAD, but for the back branches it seems best to just touch the places that actually have a problem. > INFO: vacuuming "pg_catalog.pg_statistic" > ERROR: could not access status of transaction 1107341112 > DETAIL: could not open file "/home/postgres/data/pg_clog/0420": No such > file or directory Fortunately for you, pg_statistic doesn't contain any irreplaceable data. So you could get out of this via TRUNCATE pg_statistic; VACUUM ANALYZE; -- rebuild contents of pg_statistic VACUUM FREEZE; -- make sure template0 needs no further vacuuming Then reset template0's datallowconn to false, and get rid of that code to override it. And then update to a more recent release ;-) (I don't recall exactly what rules 7.4 uses, but likely you'll find that you need to run a standalone backend with -O switch to perform TRUNCATE on a system catalog.) regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 26 13:38:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BF6A89DC8A9 for ; Mon, 26 Dec 2005 13:38:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95052-09 for ; Mon, 26 Dec 2005 13:38:38 -0400 (AST) X-Greylist: delayed 00:06:17.504207 by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.204]) by postgresql.org (Postfix) with ESMTP id 9288D9DC842 for ; Mon, 26 Dec 2005 13:38:37 -0400 (AST) Received: by uproxy.gmail.com with SMTP id s2so303257uge for ; Mon, 26 Dec 2005 09:38:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=TxgFhuudLKa3tgMem9GbvCLg/4mvo8HJcyhSTGPDFCbbAwBZXWzAcsg267179+JU5S8d9FlMZ11q4DbPwMwr7QmYZYPHtZzXUgPKKUhnaV//8eaGwn7GNXDZRcAWTU5Jxyh3U/+eEh13Tjf7JHK6G586z6eqY+ExFEEicXXF6/A= Received: by 10.67.27.1 with SMTP id e1mr1975898ugj; Mon, 26 Dec 2005 09:32:19 -0800 (PST) Received: by 10.67.22.1 with HTTP; Mon, 26 Dec 2005 09:32:19 -0800 (PST) Message-ID: <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> Date: Mon, 26 Dec 2005 12:32:19 -0500 From: Alex Turner To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <20051225173755.GA6986@mathom.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/615 X-Sequence-Number: 16436 It's irrelavent what controller, you still have to actualy write the parity blocks, which slows down your write speed because you have to write n+n/2 blocks. instead of just n blocks making the system write 50% more data. RAID 5 must write 50% more data to disk therefore it will always be slower. Alex. On 12/25/05, Michael Stone wrote: > On Sat, Dec 24, 2005 at 05:45:20PM -0500, Ron wrote: > >Caches help, and the bigger the cache the better, but once you are > >doing enough writes fast enough (and that doesn't take much even with > >a few GBs of cache) the recalculate-checksums-and-write-new-ones > >overhead will decrease the write speed of real data. Bear in mind > >that the HD's _raw_ write speed hasn't been decreased. Those HD's > >are pounding away as fast as they can for you. Your _effective_ or > >_data level_ write speed is what decreases due to overhead. > > You're overgeneralizing. Assuming a large cache and a sequential write, > there's need be no penalty for raid 5. (For random writes you may > need to read unrelated blocks in order to calculate parity, but for > large sequential writes the parity blocks should all be read from > cache.) A modern cpu can calculate parity for raid 5 on the order of > gigabytes per second, and even crummy embedded processors can do > hundreds of megabytes per second. You may have run into some lousy > implementations, but you should be much more specific about what > hardware you're talking about instead of making sweeping > generalizations. > > >Side Note: people often forget the other big reason to use RAID 10 > >over RAID 5. RAID 5 is always only 2 HD failures from data > >loss. RAID 10 can lose up to 1/2 the HD's in the array w/o data loss > >unless you get unlucky and lose both members of a RAID 1 set. > > IOW, your RAID 10 is only 2 HD failures from data loss also. If that's > an issue you need to go with RAID 6 or add another disk to each mirror. > > Mike Stone > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Mon Dec 26 14:13:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F3D249DC835 for ; Mon, 26 Dec 2005 14:13:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01424-07 for ; Mon, 26 Dec 2005 14:13:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id A351C9DC809 for ; Mon, 26 Dec 2005 14:12:09 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id C26421AC3E9; Mon, 26 Dec 2005 10:12:17 -0800 (PST) Date: Mon, 26 Dec 2005 10:11:00 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Alex Turner Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> Message-ID: References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@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, score=0.057 required=5 tests=[AWL=0.057] X-Spam-Score: 0.057 X-Spam-Level: X-Archive-Number: 200512/616 X-Sequence-Number: 16437 On Mon, 26 Dec 2005, Alex Turner wrote: > It's irrelavent what controller, you still have to actualy write the > parity blocks, which slows down your write speed because you have to > write n+n/2 blocks. instead of just n blocks making the system write > 50% more data. > > RAID 5 must write 50% more data to disk therefore it will always be slower. raid5 writes n+1 blocks not n+n/2 (unless n=2 for a 3-disk raid). you can have a 15+1 disk raid5 array for example however raid1 (and raid10) have to write 2*n blocks to disk. so if you are talking about pure I/O needed raid5 wins hands down. (the same 16 drives would be a 8+8 array) what slows down raid 5 is that to modify a block you have to read blocks from all your drives to re-calculate the parity. this interleaving of reads and writes when all you are logicly doing is writes can really hurt. (this is why I asked the question that got us off on this tangent, when doing new writes to an array you don't have to read the blocks as they are blank, assuming your cacheing is enough so that you can write blocksize*n before the system starts actually writing the data) David Lang > Alex. > > On 12/25/05, Michael Stone wrote: >> On Sat, Dec 24, 2005 at 05:45:20PM -0500, Ron wrote: >>> Caches help, and the bigger the cache the better, but once you are >>> doing enough writes fast enough (and that doesn't take much even with >>> a few GBs of cache) the recalculate-checksums-and-write-new-ones >>> overhead will decrease the write speed of real data. Bear in mind >>> that the HD's _raw_ write speed hasn't been decreased. Those HD's >>> are pounding away as fast as they can for you. Your _effective_ or >>> _data level_ write speed is what decreases due to overhead. >> >> You're overgeneralizing. Assuming a large cache and a sequential write, >> there's need be no penalty for raid 5. (For random writes you may >> need to read unrelated blocks in order to calculate parity, but for >> large sequential writes the parity blocks should all be read from >> cache.) A modern cpu can calculate parity for raid 5 on the order of >> gigabytes per second, and even crummy embedded processors can do >> hundreds of megabytes per second. You may have run into some lousy >> implementations, but you should be much more specific about what >> hardware you're talking about instead of making sweeping >> generalizations. >> >>> Side Note: people often forget the other big reason to use RAID 10 >>> over RAID 5. RAID 5 is always only 2 HD failures from data >>> loss. RAID 10 can lose up to 1/2 the HD's in the array w/o data loss >>> unless you get unlucky and lose both members of a RAID 1 set. >> >> IOW, your RAID 10 is only 2 HD failures from data loss also. If that's >> an issue you need to go with RAID 6 or add another disk to each mirror. >> >> Mike Stone >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 6: explain analyze is your friend >> > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Mon Dec 26 14:39:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7B3F19DC816 for ; Mon, 26 Dec 2005 14:39:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03554-10 for ; Mon, 26 Dec 2005 14:39:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from server10.araisoft.com (server10.araisoft.com [72.9.228.195]) by postgresql.org (Postfix) with ESMTP id 03B6F9DC809 for ; Mon, 26 Dec 2005 14:39:10 -0400 (AST) Received: from localhost (unknown [127.0.0.1]) by server10.araisoft.com (Postfix) with ESMTP id B11E73D6200C; Mon, 26 Dec 2005 10:22:09 -0800 (PST) Received: from server10.araisoft.com ([127.0.0.1]) by localhost (server10.araisoft.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08721-01; Mon, 26 Dec 2005 10:22:02 -0800 (PST) Received: from [192.168.1.103] (adsl-69-235-152-146.dsl.irvnca.pacbell.net [69.235.152.146]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server10.araisoft.com (Postfix) with ESMTP id 437C43D62008; Mon, 26 Dec 2005 10:22:01 -0800 (PST) Message-ID: <43B034B6.7070708@cs.ucr.edu> Date: Mon, 26 Dec 2005 10:21:42 -0800 From: Benjamin Arai User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> <43AFB641.6070009@cs.ucr.edu> <3E37B936B592014B978C4415F90D662D01F47553@MI8NYCMAIL06.Mi8.com> In-Reply-To: <3E37B936B592014B978C4415F90D662D01F47553@MI8NYCMAIL06.Mi8.com> Content-Type: multipart/alternative; boundary="------------000507000404040704030503" X-Virus-Scanned: by amavisd-new at araisoft.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.054 required=5 tests=[AWL=0.053, HTML_MESSAGE=0.001] X-Spam-Score: 0.054 X-Spam-Level: X-Archive-Number: 200512/617 X-Sequence-Number: 16438 This is a multi-part message in MIME format. --------------000507000404040704030503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Have you have any experience rebuilding arrays in linux using the 3Ware utilities? If so, did it work well? Luke Lonergan wrote: >Benjamin, > > > >>Have you done any benchmarking of the 9550SX against a software raid configuration? >> >> > > >Interesting - no, not on SATA, mostly because I've had awful luck with Linux drivers and SATA. The popular manufacturers of SATA to PCI bridge chipsets are Silicon Image and Highpoint, and I've not seen Linux work with them at any reasonable performance yet. I've also had problems with Adaptec's cards - I think they manufacture their own SATA to PCI chipset as well. So far, I've only had good luck with the on-chipset Intel SATA implementation. I think the problems I've had could be entirely driver-related, but in the end it doesn't matter if you can't find drivers that work for Linux. > >The other problem is getting enough SATA connections for the number of disks we want. I do have two new Areca SATA RAID cards and I'm going to benchmark those against the 3Ware 9550SX with 2 x 8 = 16 disks on one host. > >I guess we could run the HW RAID controllers in JBOD mode to get a good driver / chipset configuration for software RAID, but frankly I prefer HW RAID if it performs well. So far the SATA host-based RAID is blowing the doors off of every other HW RAID solution I've tested. > >- Luke > > > -- *Benjamin Arai* barai@cs.ucr.edu http://www.benjaminarai.com --------------000507000404040704030503 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Have you have any experience rebuilding arrays in linux using the 3Ware utilities?  If so, did it work well?

Luke Lonergan wrote:
Benjamin,

  
Have you done any benchmarking of the 9550SX against a software raid configuration?  
    

 
Interesting - no, not on SATA, mostly because I've had awful luck with Linux drivers and SATA.  The popular manufacturers of SATA to PCI bridge chipsets are Silicon Image and Highpoint, and I've not seen Linux work with them at any reasonable performance yet.  I've also had problems with Adaptec's cards - I think they manufacture their own SATA to PCI chipset as well.  So far, I've only had good luck with the on-chipset Intel SATA implementation.  I think the problems I've had could be entirely driver-related, but in the end it doesn't matter if you can't find drivers that work for Linux.
 
The other problem is getting enough SATA connections for the number of disks we want.  I do have two new Areca SATA RAID cards and I'm going to benchmark those against the 3Ware 9550SX with 2 x 8 = 16 disks on one host.
 
I guess we could run the HW RAID controllers in JBOD mode to get a good driver / chipset configuration for software RAID, but frankly I prefer HW RAID if it performs well.  So far the SATA host-based RAID is blowing the doors off of every other HW RAID solution I've tested.
 
- Luke

  

--------------000507000404040704030503-- From pgsql-performance-owner@postgresql.org Mon Dec 26 14:50:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C78D79DC816 for ; Mon, 26 Dec 2005 14:50:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09113-02 for ; Mon, 26 Dec 2005 14:50:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id 2FE0F9DC809 for ; Mon, 26 Dec 2005 14:50:40 -0400 (AST) Received: from 172.16.1.26 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Mon, 26 Dec 2005 13:50:36 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01HOST01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 26 Dec 2005 13:50:36 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 26 Dec 2005 18:50:35 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 26 Dec 2005 10:50:34 -0800 Subject: Re: What's the best hardver for PostgreSQL 8.1? From: "Luke Lonergan" To: "Benjamin Arai" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] What's the best hardver for PostgreSQL 8.1? Thread-Index: AcYKSVBWxlHzGlidTweIB31sFsrM+gAA/BOH In-Reply-To: <43B034B6.7070708@cs.ucr.edu> MIME-Version: 1.0 X-OriginalArrivalTime: 26 Dec 2005 18:50:36.0165 (UTC) FILETIME=[41F01350:01C60A4D] X-WSS-ID: 6FAEE4F632K1516294-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.301 required=5 tests=[AWL=0.048, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.301 X-Spam-Level: * X-Archive-Number: 200512/618 X-Sequence-Number: 16439 Benjamin, On 12/26/05 10:21 AM, "Benjamin Arai" wrote: > Have you have any experience rebuilding arrays in linux using the 3Ware > utilities? If so, did it work well? Sure we have - nowadays with disks failing as much as they do how could we not? ;-) 3Ware has some *nice* tools - including a web browser utility for managing the RAID. Rebuilds have been super easy - and the e-mail notification is fine. They even have some decent migration options. What they don't have are tools like snapshot backup, like EMC has, or SRDF or any of the enterprise SAN features. We don't need them because Bizgres MPP takes care of the need in software, but some people have become accustomed to the features for other uses. We're pretty happy with 3Ware, but their new 9550SX is, well, new. We managed to find a good enough combination of driver and firmware to make it work well on CentOs 4.1 and that's good enough for us, but there are definitely some issues with some combinations now. Lastly, you do have to set the block device readahead to 16MB to get performance. - Luke From pgsql-performance-owner@postgresql.org Mon Dec 26 17:03:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3463B9DC80E for ; Mon, 26 Dec 2005 17:03:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62444-07 for ; Mon, 26 Dec 2005 17:03:44 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 078D39DC809 for ; Mon, 26 Dec 2005 17:03:41 -0400 (AST) Received: from mail.apptechsys.com (mail.apptechsys.com [206.129.116.70]) by svr4.postgresql.org (Postfix) with ESMTP id DC11D5AF871 for ; Mon, 26 Dec 2005 21:03:42 +0000 (GMT) Received: by mail.apptechsys.com (Postfix, from userid 583) id E8DE77E50; Mon, 26 Dec 2005 13:03:40 -0800 (PST) Received: from [206.129.116.216] (unknown [206.129.116.216]) by mail.apptechsys.com (Postfix) with ESMTP id 0FAD27E4F for ; Mon, 26 Dec 2005 13:03:35 -0800 (PST) Message-ID: <43B05AA6.9020902@apptechsys.com> Date: Mon, 26 Dec 2005 13:03:34 -0800 From: David Scott User-Agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Performance hit on large row counts Content-Type: multipart/mixed; boundary="------------090600030104040201050907" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/619 X-Sequence-Number: 16440 This is a multi-part message in MIME format. --------------090600030104040201050907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit We are trying to ascertain if we are up against the limits of what postgres can accomplish without having the tables clustered. We would prefer not to have to cluster our tables because according to the documentation this is a one time operation and not maintained. Is there any other performance tweaks that can be done to avoid clustering? Is there any way to force the cluster maintenance (even with a performance hit on load)? We are aware that there is a minimum time that is required to resolve the index values against the table to ascertain that they are live rows, and we believe we are circumventing that time to some extent by taking advantage of the rows being in physical order with the cluster. So does this lead us to the conclusion that the differences in the query times is how long is takes us to check on disk whether or not these rows are live? Thanks for any help, thoughts, tips or suggestions. All of these commands are after a vacuum full analyze and the config file is attached. Different values were used for the queries so no caching would confuse our stats. The box is running gentoo with postgres 8.1.0, has raid 0, 9 gigs of ram, 2 hyperthreaded procs, x86_64. /Three tables with row counts:/ lookup1.count = 3,306,930 lookup2.count = 4,189,734 stuff.count = 3,423,994 /The first attempt (after index adjustments, no hits to cached results)/ explain analyze select col2, count(*) as cnt from stuff where col1 = 56984 group by col2 HashAggregate (cost=14605.68..14605.88 rows=16 width=4) (actual time=6980.752..6985.893 rows=6389 loops=1) -> Bitmap Heap Scan on stuff (cost=60.97..14571.44 rows=6848 width=4) (actual time=371.215..6965.742 rows=6389 loops=1) Recheck Cond: (col1 = 56984) -> Bitmap Index Scan on stuff_pair_idx (cost=0.00..60.97 rows=6848 width=0) (actual time=361.237..361.237 rows=6389 loops=1) Index Cond: (col1 = 56984) Total runtime: 6988.105 ms /After clustering:/ explain analyze select col2, count(*) as cnt from stuff where col1 = 3540634 group by col2; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=1399.62..1399.63 rows=1 width=4) (actual time=11.376..15.282 rows=5587 loops=1) -> Bitmap Heap Scan on stuff (cost=4.36..1397.68 rows=389 width=4) (actual time=1.029..4.538 rows=5587 loops=1) Recheck Cond: (col1 = 3540634) -> Bitmap Index Scan on stuff_col1_idx (cost=0.00..4.36 rows=389 width=0) (actual time=1.003..1.003 rows=5587 loops=1) Index Cond: (col1 = 3540634) Total runtime: 17.113 ms /Using this in the next layer of querying:/ explain analyze SELECT col1,col2, value AS val, coalesce(coalesce(lookup1.col3, lookup2.col3),0) AS dollars FROM (select col1, col2, value from stuff where col1 = 95350) stuff LEFT JOIN lookup1 ON (stuff.col2 = lookup1.pkey) LEFT JOIN lookup2 ON (stuff.col2 = lookup2.pkey); Nested Loop Left Join (cost=0.00..10325.15 rows=857 width=20) (actual time=84.223..9306.228 rows=2296 loops=1) -> Nested Loop Left Join (cost=0.00..5183.25 rows=857 width=16) (actual time=56.623..1710.655 rows=2296 loops=1) -> Index Scan using stuff_col1_idx on stuff (cost=0.00..21.57 rows=857 width=12) (actual time=40.531..57.160 rows=2296 loops=1) Index Cond: (col1 = 4528383) -> Index Scan using lookup2_pkey on lookup2 (cost=0.00..6.01 rows=1 width=8) (actual time=0.717..0.717 rows=0 loops=2296) Index Cond: ("outer".col2 = lookup2.pkey) -> Index Scan using lookup1_pkey on lookup1 (cost=0.00..5.99 rows=1 width=8) (actual time=3.304..3.305 rows=1 loops=2296) Index Cond: ("outer".col2 = lookup1.pkey) Total runtime: 9307.569 ms /After clustering the two left join tables (lookup1 and lookup2):/ explain analyze SELECT col1,col2, value AS val, coalesce(coalesce(lookup1.col3, lookup2.col3),0) AS dollars FROM (select col1, col2, value from stuff where col1 = 95350) stuff LEFT JOIN lookup1 ON (stuff.col2 = lookup1.pkey) LEFT JOIN lookup2 ON (stuff.col2 = lookup2.pkey); Nested Loop Left Join (cost=0.00..10325.15 rows=857 width=20) (actual time=24.444..84.114 rows=1727 loops=1) -> Nested Loop Left Join (cost=0.00..5163.47 rows=857 width=16) (actual time=24.392..62.787 rows=1727 loops=1) -> Index Scan using stuff_col1_idx on stuff (cost=0.00..21.57 rows=857 width=12) (actual time=24.332..27.455 rows=1727 loops=1) Index Cond: (col1 = 95350) -> Index Scan using lookup1_pkey on lookup1 (cost=0.00..5.99 rows=1 width=8) (actual time=0.018..0.018 rows=1 loops=1727) Index Cond: ("outer".col2 = lookup1.pkey) -> Index Scan using lookup2_pkey on lookup2 (cost=0.00..6.01 rows=1 width=8) (actual time=0.010..0.010 rows=0 loops=1727) Index Cond: ("outer".col2 = lookup2.pkey) Total runtime: 84.860 ms --------------090600030104040201050907 Content-Type: text/plain; name="postgresql.conf" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="postgresql.conf" # ----------------------------- # PostgreSQL configuration file # ----------------------------- # # This file consists of lines of the form: # # name = value # # (The '=' 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=on'. 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 = 'ConfigDir' # use data in another directory #hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file #ident_file = 'ConfigDir/pg_ident.conf # IDENT configuration file # If external_pid_file is not explicitly set, no extra pid file is written. #external_pid_file = '(none)' # write an extra pid file #--------------------------------------------------------------------------- # CONNECTIONS AND AUTHENTICATION #--------------------------------------------------------------------------- # - Connection Settings - listen_addresses = '*' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost', '*' = all #port = 5432 max_connections = 100 # note: increasing max_connections costs ~400 bytes of shared memory per # connection slot, plus lock space (see max_locks_per_transaction). You # might also need to raise shared_buffers to support more connections. superuser_reserved_connections = 3 #unix_socket_directory = '' #unix_socket_group = '' #unix_socket_permissions = 0777 # octal #bonjour_name = '' # defaults to the computer name # - Security & Authentication - #authentication_timeout = 60 # 1-600, in seconds #ssl = off #password_encryption = on #db_user_namespace = off # Kerberos #krb_server_keyfile = '' #krb_srvname = 'postgres' #krb_server_hostname = '' # empty string matches any keytab entry #krb_caseins_users = off # - TCP Keepalives - # see 'man 7 tcp' for details #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; # 0 selects the system default #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; # 0 selects the system default #tcp_keepalives_count = 0 # TCP_KEEPCNT; # 0 selects the system default #--------------------------------------------------------------------------- # RESOURCE USAGE (except WAL) #--------------------------------------------------------------------------- # - Memory - shared_buffers = 16384 # min 16 or max_connections*2, 8KB each temp_buffers = 10000 # min 100, 8KB each #max_prepared_transactions = 5 # can be 0 or more # note: increasing max_prepared_transactions costs ~600 bytes of shared memory # per transaction slot, plus lock space (see max_locks_per_transaction). work_mem = 2097152 # min 64, size in KB maintenance_work_mem = 4194304 # min 1024, size in KB #max_stack_depth = 2048 # min 100, size in KB # - Free Space Map - max_fsm_pages = 200000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 1000 # min 100, ~70 bytes each # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 #preload_libraries = '' # - Cost-Based Vacuum Delay - #vacuum_cost_delay = 0 # 0-1000 milliseconds #vacuum_cost_page_hit = 1 # 0-10000 credits #vacuum_cost_page_miss = 10 # 0-10000 credits #vacuum_cost_page_dirty = 20 # 0-10000 credits #vacuum_cost_limit = 200 # 0-10000 credits # - Background writer - #bgwriter_delay = 200 # 10-10000 milliseconds between rounds #bgwriter_lru_percent = 1.0 # 0-100% of LRU buffers scanned/round #bgwriter_lru_maxpages = 5 # 0-1000 buffers max written/round #bgwriter_all_percent = 0.333 # 0-100% of all buffers scanned/round #bgwriter_all_maxpages = 5 # 0-1000 buffers max written/round #--------------------------------------------------------------------------- # WRITE AHEAD LOG #--------------------------------------------------------------------------- # - Settings - fsync = off # turns forced synchronization on or off #wal_sync_method = fsync # the default is the first option # supported by the operating system: # open_datasync # fdatasync # fsync # fsync_writethrough # open_sync #full_page_writes = on # recover from partial page writes wal_buffers = 42 # min 4, 8KB each #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 # - Checkpoints - checkpoint_segments = 42 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 300 # range 30-3600, in seconds #checkpoint_warning = 30 # in seconds, 0 is off # - Archiving - #archive_command = '' # command to use to archive a logfile # segment #--------------------------------------------------------------------------- # QUERY TUNING #--------------------------------------------------------------------------- # - Planner Method Configuration - #enable_bitmapscan = on #enable_hashagg = on #enable_hashjoin = on #enable_indexscan = on #enable_mergejoin = on #enable_nestloop = on #enable_seqscan = on #enable_sort = on #enable_tidscan = on # - Planner Cost Constants - #effective_cache_size = 1000 # typically 8KB each #random_page_cost = 4 # units are one sequential page fetch # cost #cpu_tuple_cost = 0.01 # (same) #cpu_index_tuple_cost = 0.001 # (same) #cpu_operator_cost = 0.0025 # (same) # - Genetic Query Optimizer - #geqo = on #geqo_threshold = 12 #geqo_effort = 5 # range 1-10 #geqo_pool_size = 0 # selects default based on effort #geqo_generations = 0 # selects default based on effort #geqo_selection_bias = 2.0 # range 1.5-2.0 # - Other Planner Options - #default_statistics_target = 10 # range 1-1000 #constraint_exclusion = off #from_collapse_limit = 8 #join_collapse_limit = 8 # 1 disables collapsing of explicit # JOINs #--------------------------------------------------------------------------- # ERROR REPORTING AND LOGGING #--------------------------------------------------------------------------- # - Where to Log - #log_destination = 'stderr' # Valid values are combinations of # stderr, syslog and eventlog, # depending on platform. # This is used when logging to stderr: #redirect_stderr = off # Enable capturing of stderr into log # files # These are only used if redirect_stderr is on: #log_directory = 'pg_log' # Directory where log files are written # Can be absolute or relative to PGDATA #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern. # Can include strftime() escapes #log_truncate_on_rotation = off # If on, any existing log file of the same # name as the new log file will be # truncated rather than appended to. But # such truncation only occurs on # time-driven rotation, not on restarts # or size-driven rotation. Default is # off, meaning append to existing files # in all cases. #log_rotation_age = 1440 # Automatic rotation of logfiles will # happen after so many minutes. 0 to # disable. #log_rotation_size = 10240 # Automatic rotation of logfiles will # happen after so many kilobytes of log # output. 0 to disable. # These are relevant when logging to syslog: #syslog_facility = 'LOCAL0' #syslog_ident = 'postgres' # - When to Log - #client_min_messages = notice # Values, in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # log # notice # warning # error #log_min_messages = notice # Values, in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # log # fatal # panic #log_error_verbosity = default # terse, default, or verbose messages #log_min_error_statement = panic # Values in order of increasing severity: # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # panic(off) #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements # and their durations, in milliseconds. #silent_mode = off # DO NOT USE without syslog or # redirect_stderr # - What to Log - #debug_print_parse = off #debug_print_rewritten = off #debug_print_plan = off #debug_pretty_print = off #log_connections = off #log_disconnections = off #log_duration = off #log_line_prefix = '' # Special values: # %u = user name # %d = database name # %r = remote host and port # %h = remote host # %p = PID # %t = timestamp (no milliseconds) # %m = timestamp with milliseconds # %i = command tag # %c = session id # %l = session line number # %s = session start timestamp # %x = transaction id # %q = stop here in non-session # processes # %% = '%' # e.g. '<%u%%%d> ' #log_statement = 'none' # none, mod, ddl, all #log_hostname = off #--------------------------------------------------------------------------- # RUNTIME STATISTICS #--------------------------------------------------------------------------- # - Statistics Monitoring - #log_parser_stats = off #log_planner_stats = off #log_executor_stats = off #log_statement_stats = off # - Query/Index Statistics Collector - stats_start_collector = on #stats_command_string = off #stats_block_level = off stats_row_level = on #stats_reset_on_server_start = off #--------------------------------------------------------------------------- # AUTOVACUUM PARAMETERS #--------------------------------------------------------------------------- autovacuum = on # enable autovacuum subprocess? #autovacuum_naptime = 60 # time between autovacuum runs, in secs #autovacuum_vacuum_threshold = 1000 # min # of tuple updates before # vacuum #autovacuum_analyze_threshold = 500 # min # of tuple updates before # analyze #autovacuum_vacuum_scale_factor = 0.4 # fraction of rel size before # vacuum #autovacuum_analyze_scale_factor = 0.2 # fraction of rel size before # analyze #autovacuum_vacuum_cost_delay = -1 # default vacuum cost delay for # autovac, -1 means use # vacuum_cost_delay #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for # autovac, -1 means use # vacuum_cost_limit #--------------------------------------------------------------------------- # CLIENT CONNECTION DEFAULTS #--------------------------------------------------------------------------- # - Statement Behavior - #search_path = '$user,public' # schema names #default_tablespace = '' # a tablespace name, '' uses # the default #check_function_bodies = on #default_transaction_isolation = 'read committed' #default_transaction_read_only = off #statement_timeout = 0 # 0 is disabled, in milliseconds # - Locale and Formatting - #datestyle = 'iso, mdy' #timezone = unknown # actually, defaults to TZ # environment setting #australian_timezones = off #extra_float_digits = 0 # min -15, max 2 #client_encoding = sql_ascii # actually, defaults to database # encoding # These settings are initialized by initdb -- they might be changed lc_messages = 'C' # locale for system error message # strings lc_monetary = 'C' # locale for monetary formatting lc_numeric = 'C' # locale for number formatting lc_time = 'C' # locale for time formatting # - Other Defaults - #explain_pretty_print = on #dynamic_library_path = '$libdir' #--------------------------------------------------------------------------- # LOCK MANAGEMENT #--------------------------------------------------------------------------- #deadlock_timeout = 1000 # in milliseconds #max_locks_per_transaction = 64 # min 10 # note: each lock table slot uses ~220 bytes of shared memory, and there are # max_locks_per_transaction * (max_connections + max_prepared_transactions) # lock table slots. #--------------------------------------------------------------------------- # VERSION/PLATFORM COMPATIBILITY #--------------------------------------------------------------------------- # - Previous Postgres Versions - #add_missing_from = off #regex_flavor = advanced # advanced, extended, or basic #sql_inheritance = on #default_with_oids = off #escape_string_warning = off # - Other Platforms & Clients - #transform_null_equals = off #--------------------------------------------------------------------------- # CUSTOMIZED OPTIONS #--------------------------------------------------------------------------- #custom_variable_classes = '' # list of custom variable class names --------------090600030104040201050907-- From pgsql-performance-owner@postgresql.org Mon Dec 26 17:37:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AD8A09DC9E4 for ; Mon, 26 Dec 2005 17:37:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84003-07-2 for ; Mon, 26 Dec 2005 17:37:34 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id BE4D89DCA04 for ; Mon, 26 Dec 2005 17:37:30 -0400 (AST) Received: from geri.cc.fer.hr (geri.cc.fer.hr [161.53.72.121]) by svr4.postgresql.org (Postfix) with ESMTP id CA0D45AFD6A for ; Mon, 26 Dec 2005 21:37:32 +0000 (GMT) Received: from geri.cc.fer.hr (localhost.cc.fer.hr [127.0.0.1]) by geri.cc.fer.hr (8.13.4/8.13.1) with ESMTP id jBQLWDao087695 for ; Mon, 26 Dec 2005 22:32:13 +0100 (CET) (envelope-from ivoras@fer.hr) Received: from localhost (ivoras@localhost) by geri.cc.fer.hr (8.13.4/8.13.1/Submit) with ESMTP id jBQLWDXO087692 for ; Mon, 26 Dec 2005 22:32:13 +0100 (CET) (envelope-from ivoras@fer.hr) X-Authentication-Warning: geri.cc.fer.hr: ivoras owned process doing -bs Date: Mon, 26 Dec 2005 22:32:13 +0100 (CET) From: Ivan Voras To: pgsql-performance@postgresql.org Subject: Bitmap indexes etc. Message-ID: <20051226222915.G87624@geri.cc.fer.hr> 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/621 X-Sequence-Number: 16442 Hi! This is not actually a question about performance, but an inquiry to help me understand what is going on. Below this text are two EXPLAIN ANALYZE outputs, before and after VACUUM ANALYZE was run. I have several questions about the proposed plans (mostly the first one). There is only one table in the query, "layout", containing ~10k rows. In it, for each "page_id" there are several (1-10) rows (i.e. there are around 10000/5 unique page_id values). There's an index on "page_id" and I've upped statistics collection on it to 150 at table creation time because sometimes the planner didn't use the index at all. This is PostgreSQL 8.1.0. - what does "Bitmap Heap Scan" phase do? - what is "Recheck condition" and why is it needed? - why are proposed "width" fields in the plan different between the two plans? (actually, a nice explanation what exactly are those widths would also be nice :) ) - I thought "Bitmap Index Scan" was only used when there are two or more applicable indexes in the plan, so I don't understand why is it used now? cw2=> explain analyze select * from layout where page_id=10060; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Bitmap Heap Scan on layout (cost=2.15..64.21 rows=43 width=60) (actual time=0.043..0.053 rows=4 loops=1) Recheck Cond: (page_id = 10060) -> Bitmap Index Scan on layout_page_id (cost=0.00..2.15 rows=43 width=0) (actual time=0.034..0.034 rows=4 loops=1) Index Cond: (page_id = 10060) Total runtime: 0.112 ms (5 rows) cw2> VACUUM ANALYZE; cw2=> explain analyze select * from layout where page_id=10060; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- Index Scan using layout_page_id on layout (cost=0.00..12.14 rows=4 width=42) (actual time=0.014..0.025 rows=4 loops=1) Index Cond: (page_id = 10060) Total runtime: 0.076 ms (3 rows) -- Preserve wildlife -- pickle a squirrel today! From pgsql-performance-owner@postgresql.org Mon Dec 26 17:36:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D19A19DC9F8 for ; Mon, 26 Dec 2005 17:36:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85238-04 for ; Mon, 26 Dec 2005 17:36:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D635E9DC828 for ; Mon, 26 Dec 2005 17:36:29 -0400 (AST) 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 jBQLaUO2012357; Mon, 26 Dec 2005 16:36:30 -0500 (EST) To: David Scott cc: pgsql-performance@postgresql.org Subject: Re: Performance hit on large row counts In-reply-to: <43B05AA6.9020902@apptechsys.com> References: <43B05AA6.9020902@apptechsys.com> Comments: In-reply-to David Scott message dated "Mon, 26 Dec 2005 13:03:34 -0800" Date: Mon, 26 Dec 2005 16:36:30 -0500 Message-ID: <12356.1135632990@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.046 required=5 tests=[AWL=0.046] X-Spam-Score: 0.046 X-Spam-Level: X-Archive-Number: 200512/620 X-Sequence-Number: 16441 David Scott writes: > We are trying to ascertain if we are up against the limits of what > postgres can accomplish without having the tables clustered. ... > We are aware that there is a minimum time that is required to resolve > the index values against the table to ascertain that they are live rows, > and we believe we are circumventing that time to some extent by taking > advantage of the rows being in physical order with the cluster. So does > this lead us to the conclusion that the differences in the query times > is how long is takes us to check on disk whether or not these rows are live? Both of your initial examples are bitmap scans, which should be pretty insensitive to index correlation effects --- certainly the planner assumes so. What I'd want to know about is why the planner is picking different indexes for the queries. The CLUSTER may be affecting things in some other way, like by squeezing out dead tuples causing a reduction in the total table and index sizes. The join examples use plain indexscans, which *would* be affected by correlation ... but again, why are you getting a different scan plan for "stuff" than in the non-join case? It's not helping you that the rowcount estimates are so far off. I think the different plans might be explained by the noise in the rowcount estimates. You should try increasing the statistics targets on the columns you use in the WHERE conditions. I'm not at all sure I believe your premise that querying for a different key value excludes cache effects, btw. On modern hardware it's likely that CLUSTER would leave the *whole* of these tables sitting in kernel disk cache. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 26 17:57:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CA9F39DC81E for ; Mon, 26 Dec 2005 17:57:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04587-06 for ; Mon, 26 Dec 2005 17:57:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A2ED49DC80E for ; Mon, 26 Dec 2005 17:57:13 -0400 (AST) 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 jBQLvB6p012554; Mon, 26 Dec 2005 16:57:11 -0500 (EST) To: Ivan Voras cc: pgsql-performance@postgresql.org Subject: Re: Bitmap indexes etc. In-reply-to: <20051226222915.G87624@geri.cc.fer.hr> References: <20051226222915.G87624@geri.cc.fer.hr> Comments: In-reply-to Ivan Voras message dated "Mon, 26 Dec 2005 22:32:13 +0100" Date: Mon, 26 Dec 2005 16:57:11 -0500 Message-ID: <12553.1135634231@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200512/622 X-Sequence-Number: 16443 Ivan Voras writes: > This is PostgreSQL 8.1.0. > - what does "Bitmap Heap Scan" phase do? A plain indexscan fetches one tuple-pointer at a time from the index, and immediately visits that tuple in the table. A bitmap scan fetches all the tuple-pointers from the index in one go, sorts them using an in-memory "bitmap" data structure, and then visits the table tuples in physical tuple-location order. The bitmap scan improves locality of reference to the table at the cost of more bookkeeping overhead to manage the "bitmap" data structure --- and at the cost that the data is no longer retrieved in index order, which doesn't matter for your query but would matter if you said ORDER BY. > - what is "Recheck condition" and why is it needed? If the bitmap gets too large we convert it to "lossy" style, in which we only remember which pages contain matching tuples instead of remembering each tuple individually. When that happens, the table-visiting phase has to examine each tuple on the page and recheck the scan condition to see which tuples to return. > - why are proposed "width" fields in the plan different between the two > plans? Updated statistics about average column widths, presumably. > (actually, a nice explanation what exactly are those widths would also > be nice :) ) Sum of the average widths of the columns being fetched from the table. > - I thought "Bitmap Index Scan" was only used when there are two or more > applicable indexes in the plan, so I don't understand why is it used > now? True, we can combine multiple bitmaps via AND/OR operations to merge results from multiple indexes before visiting the table ... but it's still potentially worthwhile even for one index. A rule of thumb is that plain indexscan wins for fetching a small number of tuples, bitmap scan wins for a somewhat larger number of tuples, and seqscan wins if you're fetching a large percentage of the whole table. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 26 18:54:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 54E809DC80E for ; Mon, 26 Dec 2005 18:54:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25567-10 for ; Mon, 26 Dec 2005 18:54:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.192]) by postgresql.org (Postfix) with ESMTP id E10EE9DC861 for ; Mon, 26 Dec 2005 18:54:52 -0400 (AST) Received: by uproxy.gmail.com with SMTP id s2so319082uge for ; Mon, 26 Dec 2005 14:54:54 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MEM8yX2XmEjJmEna7d+eLZyTayrHWzahm+18j8CxZoPBx/Ogsxuv4M4q0AijvnN8Ixh3ukwp7phliQNAnLkFcFwpRiMzjlo3NCL3k0KXrNhHixaJ+Z4NELSHLOT2koIrskKxplkaOWyIlb8Xt4dRzjq2qc0vNJbWAhKtwT19J1c= Received: by 10.66.219.18 with SMTP id r18mr1171273ugg; Mon, 26 Dec 2005 14:54:54 -0800 (PST) Received: by 10.67.22.1 with HTTP; Mon, 26 Dec 2005 14:54:54 -0800 (PST) Message-ID: <33c6269f0512261454p3ac8a251w6071bc1cac0a7a8e@mail.gmail.com> Date: Mon, 26 Dec 2005 17:54:54 -0500 From: Alex Turner To: Benjamin Arai Subject: Re: What's the best hardver for PostgreSQL 8.1? Cc: Luke Lonergan , pgsql-performance@postgresql.org In-Reply-To: <43B034B6.7070708@cs.ucr.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01F1B59F@MI8NYCMAIL06.Mi8.com> <43AFB641.6070009@cs.ucr.edu> <3E37B936B592014B978C4415F90D662D01F47553@MI8NYCMAIL06.Mi8.com> <43B034B6.7070708@cs.ucr.edu> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/623 X-Sequence-Number: 16444 Yes - they work excellently. I have several medium and large servers running 3ware 9500S series cards with great success. We have rebuilding many failed RAID 10s over the course with no problems. Alex On 12/26/05, Benjamin Arai wrote: > Have you have any experience rebuilding arrays in linux using the 3Ware > utilities? If so, did it work well? > > > Luke Lonergan wrote: > Benjamin, > > > > Have you done any benchmarking of the 9550SX against a software raid > configuration? > > > Interesting - no, not on SATA, mostly because I've had awful luck with Li= nux > drivers and SATA. The popular manufacturers of SATA to PCI bridge chipset= s > are Silicon Image and Highpoint, and I've not seen Linux work with them a= t > any reasonable performance yet. I've also had problems with Adaptec's car= ds > - I think they manufacture their own SATA to PCI chipset as well. So far, > I've only had good luck with the on-chipset Intel SATA implementation. I > think the problems I've had could be entirely driver-related, but in the = end > it doesn't matter if you can't find drivers that work for Linux. > > The other problem is getting enough SATA connections for the number of di= sks > we want. I do have two new Areca SATA RAID cards and I'm going to benchma= rk > those against the 3Ware 9550SX with 2 x 8 =3D 16 disks on one host. > > I guess we could run the HW RAID controllers in JBOD mode to get a good > driver / chipset configuration for software RAID, but frankly I prefer HW > RAID if it performs well. So far the SATA host-based RAID is blowing the > doors off of every other HW RAID solution I've tested. > > - Luke > > > > > -- > Benjamin Arai > barai@cs.ucr.edu > http://www.benjaminarai.com From pgsql-performance-owner@postgresql.org Mon Dec 26 19:04:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B40CB9DC887 for ; Mon, 26 Dec 2005 19:04:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28156-08 for ; Mon, 26 Dec 2005 19:04:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.200]) by postgresql.org (Postfix) with ESMTP id 697709DC80E for ; Mon, 26 Dec 2005 19:04:38 -0400 (AST) Received: by uproxy.gmail.com with SMTP id s2so319366uge for ; Mon, 26 Dec 2005 15:04:40 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=TJJaW6N7Gpi1rfROAwz16rOALxBsBRzu2U2WFTL0Y52WymifbM5ftJuimv+Bv7b1ydemkYbMW1SiNPNj8acwUl5EmZhO6Bx0UipDNZzGie+9yU/yFDtGhsf4p02etxAQBpHAsUgRBLsUtKDKRzn1BraP+GzSeGHeG88DJq880cs= Received: by 10.66.186.5 with SMTP id j5mr2065540ugf; Mon, 26 Dec 2005 15:04:40 -0800 (PST) Received: by 10.67.22.1 with HTTP; Mon, 26 Dec 2005 15:04:40 -0800 (PST) Message-ID: <33c6269f0512261504n564c9198ka65bacbd1054f8fa@mail.gmail.com> Date: Mon, 26 Dec 2005 18:04:40 -0500 From: Alex Turner To: David Lang Subject: Re: What's the best hardver for PostgreSQL 8.1? 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: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/624 X-Sequence-Number: 16445 Yes, but those blocks in RAID 10 are largely irrelevant as they are to independant disks. In RAID 5 you have to write parity to an 'active' drive that is part of the stripe. (They are irrelevant unless of course you are maxing out your SCSI bus - yet another reason why SATA can be faster than SCSI, particularly in RAID 10, every channel is independant). Sorry - my math for RAID 5 was a bit off - I don't know why I was considering only a three dirve situation - which is the worst. It's n+1 you are right. still, for small arrays thats a big penalty.=20 Still, there is definately a penatly contrary to the assertion of the orignal poster. I agree totally that the read+parity-calc+write in the worst case is totaly bad, which is why I alway recommend people should _never ever_ use RAID 5. In this day and age of large capacity chassis, and large capacity SATA drives, RAID 5 is totally inapropriate IMHO for _any_ application least of all databases. In reality I have yet to benchmark a system where RAID 5 on the same number of drives with 8 drives or less in a single array beat a RAID 10 with the same number of drives. I would definately be interested in a SCSI card that could actualy achieve the theoretical performance of RAID 5 especially under Linux. With RAID 5 you get to watch you system crumble and fail when a drive fails and the array goes into a failed state. It's just not worth it. Alex. On 12/26/05, David Lang wrote: > On Mon, 26 Dec 2005, Alex Turner wrote: > > > It's irrelavent what controller, you still have to actualy write the > > parity blocks, which slows down your write speed because you have to > > write n+n/2 blocks. instead of just n blocks making the system write > > 50% more data. > > > > RAID 5 must write 50% more data to disk therefore it will always be slo= wer. > > raid5 writes n+1 blocks not n+n/2 (unless n=3D2 for a 3-disk raid). you c= an > have a 15+1 disk raid5 array for example > > however raid1 (and raid10) have to write 2*n blocks to disk. so if you ar= e > talking about pure I/O needed raid5 wins hands down. (the same 16 drives > would be a 8+8 array) > > what slows down raid 5 is that to modify a block you have to read blocks > from all your drives to re-calculate the parity. this interleaving of > reads and writes when all you are logicly doing is writes can really hurt= . > (this is why I asked the question that got us off on this tangent, when > doing new writes to an array you don't have to read the blocks as they ar= e > blank, assuming your cacheing is enough so that you can write blocksize*n > before the system starts actually writing the data) > > David Lang > > > Alex. > > > > On 12/25/05, Michael Stone wrote: > >> On Sat, Dec 24, 2005 at 05:45:20PM -0500, Ron wrote: > >>> Caches help, and the bigger the cache the better, but once you are > >>> doing enough writes fast enough (and that doesn't take much even with > >>> a few GBs of cache) the recalculate-checksums-and-write-new-ones > >>> overhead will decrease the write speed of real data. Bear in mind > >>> that the HD's _raw_ write speed hasn't been decreased. Those HD's > >>> are pounding away as fast as they can for you. Your _effective_ or > >>> _data level_ write speed is what decreases due to overhead. > >> > >> You're overgeneralizing. Assuming a large cache and a sequential write= , > >> there's need be no penalty for raid 5. (For random writes you may > >> need to read unrelated blocks in order to calculate parity, but for > >> large sequential writes the parity blocks should all be read from > >> cache.) A modern cpu can calculate parity for raid 5 on the order of > >> gigabytes per second, and even crummy embedded processors can do > >> hundreds of megabytes per second. You may have run into some lousy > >> implementations, but you should be much more specific about what > >> hardware you're talking about instead of making sweeping > >> generalizations. > >> > >>> Side Note: people often forget the other big reason to use RAID 10 > >>> over RAID 5. RAID 5 is always only 2 HD failures from data > >>> loss. RAID 10 can lose up to 1/2 the HD's in the array w/o data loss > >>> unless you get unlucky and lose both members of a RAID 1 set. > >> > >> IOW, your RAID 10 is only 2 HD failures from data loss also. If that's > >> an issue you need to go with RAID 6 or add another disk to each mirror= . > >> > >> Mike Stone > >> > >> ---------------------------(end of broadcast)-------------------------= -- > >> TIP 6: explain analyze is your friend > >> > > > > ---------------------------(end of broadcast)--------------------------= - > > TIP 4: Have you searched our list archives? > > > > http://archives.postgresql.org > > > From pgsql-performance-owner@postgresql.org Mon Dec 26 19:07:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1BF489DC9BF for ; Mon, 26 Dec 2005 19:07:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32059-02 for ; Mon, 26 Dec 2005 19:07:27 -0400 (AST) X-Greylist: delayed 02:03:42.915877 by SQLgrey- Received: from mail.apptechsys.com (mail.apptechsys.com [206.129.116.70]) by postgresql.org (Postfix) with ESMTP id D88429DC887 for ; Mon, 26 Dec 2005 19:07:22 -0400 (AST) Received: by mail.apptechsys.com (Postfix, from userid 583) id 726347E52; Mon, 26 Dec 2005 15:07:25 -0800 (PST) Received: from [206.129.116.216] (unknown [206.129.116.216]) by mail.apptechsys.com (Postfix) with ESMTP id BD6E27E50; Mon, 26 Dec 2005 15:07:23 -0800 (PST) Message-ID: <43B077AB.1000309@apptechsys.com> Date: Mon, 26 Dec 2005 15:07:23 -0800 From: David Scott User-Agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Performance hit on large row counts References: <43B05AA6.9020902@apptechsys.com> <12356.1135632990@sss.pgh.pa.us> In-Reply-To: <12356.1135632990@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, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/625 X-Sequence-Number: 16446 Tom Lane wrote: >The CLUSTER may be affecting things in some other way, like by squeezing out dead tuples causing a >reduction in the total table and index sizes. > > I didn't mention I was the only user with transactions open on the system during this. Would cluster eliminate more rows then vacuum full if the only open transaction is the one running the vacuum and it is a clean transaction? >You should try increasing the statistics targets on the columns you use >in the WHERE conditions. > > We set it to 500 and couldn't get it to repeat the plan where it was using the pair_idx, so that certainly helps. >I'm not at all sure I believe your premise that querying for a different >key value excludes cache effects, btw. On modern hardware it's likely >that CLUSTER would leave the *whole* of these tables sitting in kernel >disk cache. > > You are exactly right. After rebooting the entire box and running the query the query time was 15 seconds. Rebooting the box, running cluster on all three tables and then executing the query was 120 ms. Is calling cluster the only way to ensure that these tables get loaded into cache? Running select * appeared to cache some but not all. Thanks From pgsql-performance-owner@postgresql.org Mon Dec 26 19:30:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 79DA59DC99C for ; Mon, 26 Dec 2005 19:30:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34696-03 for ; Mon, 26 Dec 2005 19:30:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id E6FE79DC9BF for ; Mon, 26 Dec 2005 19:28:21 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id EAA911AC3E9; Mon, 26 Dec 2005 15:28:33 -0800 (PST) Date: Mon, 26 Dec 2005 15:27:18 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Alex Turner Cc: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <33c6269f0512261504n564c9198ka65bacbd1054f8fa@mail.gmail.com> Message-ID: References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> <33c6269f0512261504n564c9198ka65bacbd1054f8fa@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, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/626 X-Sequence-Number: 16447 On Mon, 26 Dec 2005, Alex Turner wrote: > > Yes, but those blocks in RAID 10 are largely irrelevant as they are to > independant disks. In RAID 5 you have to write parity to an 'active' > drive that is part of the stripe. (They are irrelevant unless of > course you are maxing out your SCSI bus - yet another reason why SATA > can be faster than SCSI, particularly in RAID 10, every channel is > independant). I don't understand your 'active' vs 'inactive' drive argument, in raid 1 or 1+0 all drives are active. with good components you need to worry about maxing out your PCI bus as much as any other one (this type of thing is where the hardware raid has a definante advantage since the card handles the extra I/O, not your system) > Sorry - my math for RAID 5 was a bit off - I don't know why I was > considering only a three dirve situation - which is the worst. It's > n+1 you are right. still, for small arrays thats a big penalty. > Still, there is definately a penatly contrary to the assertion of the > orignal poster. > > I agree totally that the read+parity-calc+write in the worst case is > totaly bad, which is why I alway recommend people should _never ever_ > use RAID 5. In this day and age of large capacity chassis, and large > capacity SATA drives, RAID 5 is totally inapropriate IMHO for _any_ > application least of all databases. > > In reality I have yet to benchmark a system where RAID 5 on the same > number of drives with 8 drives or less in a single array beat a RAID > 10 with the same number of drives. I would definately be interested > in a SCSI card that could actualy achieve the theoretical performance > of RAID 5 especially under Linux. but it's not a 'same number of drives' comparison you should be makeing. if you have a 8 drive RAID5 array you need to compare it with a 14 drive RAID1/10 array. > With RAID 5 you get to watch you system crumble and fail when a drive > fails and the array goes into a failed state. It's just not worth it. speed is worth money (and therefor number of drives) in some cases, but not in all cases. also the speed penalty when you have a raid drive fail varies based on your controller it's wrong to flatly rule out any RAID configuration, they all have their place and the important thing is to understand what the advantages and disadvantages are for each of them so you can know when to use each one. for example I have a situation I am looking at where RAID0 is looking appropriate for a database (a multi-TB array that gets completely reloaded every month or so as data expires and new data is loaded from the authoritative source, adding another 16 drives to get redundancy isn't reasonable) David Lang > Alex. > > > On 12/26/05, David Lang wrote: >> On Mon, 26 Dec 2005, Alex Turner wrote: >> >>> It's irrelavent what controller, you still have to actualy write the >>> parity blocks, which slows down your write speed because you have to >>> write n+n/2 blocks. instead of just n blocks making the system write >>> 50% more data. >>> >>> RAID 5 must write 50% more data to disk therefore it will always be slower. >> >> raid5 writes n+1 blocks not n+n/2 (unless n=2 for a 3-disk raid). you can >> have a 15+1 disk raid5 array for example >> >> however raid1 (and raid10) have to write 2*n blocks to disk. so if you are >> talking about pure I/O needed raid5 wins hands down. (the same 16 drives >> would be a 8+8 array) >> >> what slows down raid 5 is that to modify a block you have to read blocks >> from all your drives to re-calculate the parity. this interleaving of >> reads and writes when all you are logicly doing is writes can really hurt. >> (this is why I asked the question that got us off on this tangent, when >> doing new writes to an array you don't have to read the blocks as they are >> blank, assuming your cacheing is enough so that you can write blocksize*n >> before the system starts actually writing the data) >> >> David Lang >> >>> Alex. >>> >>> On 12/25/05, Michael Stone wrote: >>>> On Sat, Dec 24, 2005 at 05:45:20PM -0500, Ron wrote: >>>>> Caches help, and the bigger the cache the better, but once you are >>>>> doing enough writes fast enough (and that doesn't take much even with >>>>> a few GBs of cache) the recalculate-checksums-and-write-new-ones >>>>> overhead will decrease the write speed of real data. Bear in mind >>>>> that the HD's _raw_ write speed hasn't been decreased. Those HD's >>>>> are pounding away as fast as they can for you. Your _effective_ or >>>>> _data level_ write speed is what decreases due to overhead. >>>> >>>> You're overgeneralizing. Assuming a large cache and a sequential write, >>>> there's need be no penalty for raid 5. (For random writes you may >>>> need to read unrelated blocks in order to calculate parity, but for >>>> large sequential writes the parity blocks should all be read from >>>> cache.) A modern cpu can calculate parity for raid 5 on the order of >>>> gigabytes per second, and even crummy embedded processors can do >>>> hundreds of megabytes per second. You may have run into some lousy >>>> implementations, but you should be much more specific about what >>>> hardware you're talking about instead of making sweeping >>>> generalizations. >>>> >>>>> Side Note: people often forget the other big reason to use RAID 10 >>>>> over RAID 5. RAID 5 is always only 2 HD failures from data >>>>> loss. RAID 10 can lose up to 1/2 the HD's in the array w/o data loss >>>>> unless you get unlucky and lose both members of a RAID 1 set. >>>> >>>> IOW, your RAID 10 is only 2 HD failures from data loss also. If that's >>>> an issue you need to go with RAID 6 or add another disk to each mirror. >>>> >>>> Mike Stone >>>> >>>> ---------------------------(end of broadcast)--------------------------- >>>> TIP 6: explain analyze is your friend >>>> >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 4: Have you searched our list archives? >>> >>> http://archives.postgresql.org >>> >> > From pgsql-performance-owner@postgresql.org Mon Dec 26 19:52:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1AA6C9DC99C for ; Mon, 26 Dec 2005 19:52:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38190-02 for ; Mon, 26 Dec 2005 19:52:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 06B559DC9F1 for ; Mon, 26 Dec 2005 19:52:05 -0400 (AST) 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 jBQNq88f015619; Mon, 26 Dec 2005 18:52:08 -0500 (EST) To: David Scott cc: pgsql-performance@postgresql.org Subject: Re: Performance hit on large row counts In-reply-to: <43B077AB.1000309@apptechsys.com> References: <43B05AA6.9020902@apptechsys.com> <12356.1135632990@sss.pgh.pa.us> <43B077AB.1000309@apptechsys.com> Comments: In-reply-to David Scott message dated "Mon, 26 Dec 2005 15:07:23 -0800" Date: Mon, 26 Dec 2005 18:52:08 -0500 Message-ID: <15618.1135641128@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200512/627 X-Sequence-Number: 16448 David Scott writes: > I didn't mention I was the only user with transactions open on the > system during this. Would cluster eliminate more rows then vacuum full > if the only open transaction is the one running the vacuum and it is a > clean transaction? It wouldn't eliminate more rows, but it could nonetheless produce a smaller table. IIRC, VACUUM FULL stops shrinking as soon as it finds a row that there is no room for in lower-numbered table pages; so a large row near the end of the table could block squeezing-out of small amounts of free space in earlier pages of the table. I doubt this effect is significant most of the time, but in a table with widely varying row sizes it might be an issue. Also, CLUSTER can definitely produce smaller *indexes* than VACUUM FULL. VACUUM FULL operates at a serious disadvantage when it comes to indexes, because in order to move a tuple it has to actually make extra index entries. >> I'm not at all sure I believe your premise that querying for a different >> key value excludes cache effects, btw. On modern hardware it's likely >> that CLUSTER would leave the *whole* of these tables sitting in kernel >> disk cache. >> > You are exactly right. After rebooting the entire box and running > the query the query time was 15 seconds. Rebooting the box, running > cluster on all three tables and then executing the query was 120 ms. Is > calling cluster the only way to ensure that these tables get loaded into > cache? Running select * appeared to cache some but not all. Hm, I'd think that SELECT * or SELECT count(*) would cause all of a table to be cached. It wouldn't do anything about caching the indexes though, and that might explain your observations. regards, tom lane From pgsql-admin-owner@postgresql.org Tue Dec 27 03:05:53 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 57FA89DC9A8 for ; Tue, 27 Dec 2005 03:05:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92574-01-2 for ; Tue, 27 Dec 2005 03:05:48 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by postgresql.org (Postfix) with ESMTP id 56B2F9DCA64 for ; Tue, 27 Dec 2005 03:05:42 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1322493nzn for ; Mon, 26 Dec 2005 23:05:43 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=mXwrs4owIcNY2mEVxPzm5//RzIS7pDdjgGZWhif1Af4bAYNcwLBczhaWeu+a/5cwJrJch7eabj3I7iexd4rPxgvZaHtO/G2Fz/JaenOAVWUZX5cQt7nbdM47cBpYzoR4JMOGYJoXX/VAPDT832Pc7qGAR4uzf34ZSWxMgNV3nPk= Received: by 10.36.79.16 with SMTP id c16mr4013688nzb; Mon, 26 Dec 2005 23:05:43 -0800 (PST) Received: by 10.36.72.7 with HTTP; Mon, 26 Dec 2005 23:05:43 -0800 (PST) Message-ID: <674d1f8a0512262305g3e2bfb81t420482ea981b6e14@mail.gmail.com> Date: Tue, 27 Dec 2005 12:35:43 +0530 From: Gourish Singbal To: Tom Lane Subject: Re: vacuuming template0 gave ERROR Cc: "pgsql-admin@postgresql.org" In-Reply-To: <9822.1135612972@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5483_23357891.1135667143464" References: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> <9822.1135612972@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.149 required=5 tests=[AWL=0.148, HTML_MESSAGE=0.001] X-Spam-Score: 0.149 X-Spam-Level: X-Archive-Number: 200512/313 X-Sequence-Number: 20033 ------=_Part_5483_23357891.1135667143464 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Tom, I got the followign Erorr when i tried to trucate the table. /usr/local/pgsql/bin/postgres -D data -O -o standalone_log template0 2005-12-26 22:48:12 ERROR: expected one dependency record for TOAST table, found 0 2005-12-26 22:48:31 ERROR: could not access status of transaction 1107341112 DETAIL: could not open file "/home/postgres/data/pg_clog/0420": No such file or directory 2005-12-26 22:48:41 LOG: shutting down 2005-12-26 22:48:41 LOG: database system is shut down please suggest ?. On 12/26/05, Tom Lane wrote: > > Gourish Singbal writes: > > Got the following ERROR when i was vacuuming the template0 database. > > Why were you doing that in the first place? template0 shouldn't ever > be touched. > > > postgresql server version is 7.4.5 > > The underlying cause is likely related to this 7.4.6 bug fix: > > 2004-10-13 18:22 tgl > > * contrib/pgstattuple/pgstattuple.c, > src/backend/access/heap/heapam.c, > src/backend/utils/adt/ri_triggers.c (REL7_4_STABLE): Repair > possible failure to update hint bits back to disk, per > http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php. > I plan a more permanent fix in HEAD, but for the back branches it > seems best to just touch the places that actually have a problem. > > > > INFO: vacuuming "pg_catalog.pg_statistic" > > ERROR: could not access status of transaction 1107341112 > > DETAIL: could not open file "/home/postgres/data/pg_clog/0420": No suc= h > > file or directory > > Fortunately for you, pg_statistic doesn't contain any irreplaceable > data. So you could get out of this via > > TRUNCATE pg_statistic; > VACUUM ANALYZE; -- rebuild contents of pg_statistic > VACUUM FREEZE; -- make sure template0 needs no further vacuuming > > Then reset template0's datallowconn to false, and get rid of that code > to override it. And then update to a more recent release ;-) > > (I don't recall exactly what rules 7.4 uses, but likely you'll find that > you need to run a standalone backend with -O switch to perform > TRUNCATE on a system catalog.) > > regards, tom lane > -- Best, Gourish Singbal ------=_Part_5483_23357891.1135667143464 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
 
Tom,
I got the followign Erorr when i tried to trucate the table.
 /usr/local/pgsql/bin/postgres -D data -O -o standalone_log templ= ate0
 
2005-12-26 22:48:12 ERROR:  expected one dependency record for TO= AST table, found 0
2005-12-26 22:48:31 ERROR:  could not access sta= tus of transaction 1107341112
DETAIL:  could not open file "/h= ome/postgres/data/pg_clog/0420": No such file or directory
2005-12-26 22:48:41 LOG:  shutting down
2005-12-26 22:48:41 LOG= :  database system is shut down

please suggest ?.
 
On 12/26/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Gourish Singbal <gourish@gmail.com> writes:
> Got the = following ERROR when i was vacuuming the template0 database.

Why were you doing that in the first place?  template0 sh= ouldn't ever
be touched.

> postgresql server version is 7.4.5<= br>
The underlying cause is likely related to this 7.4.6 bug fix:
2004-10-13 18:22  tgl

       * contrib/pgstattuple/pgstattu= ple.c,
       src/backend/access/heap/heap= am.c,
       src/backend/utils/adt/ri_trig= gers.c (REL7_4_STABLE): Repair
       poss= ible failure to update hint bits back to disk, per
       http://archives.postgresql.org/= pgsql-hackers/2004-10/msg00464.php.
     &n= bsp; I plan a more permanent fix in HEAD, but for the back branches it
       seems best to just touch the place= s that actually have a problem.


> INFO:  vacuuming = "pg_catalog.pg_statistic"
> ERROR:  could not acc= ess status of transaction 1107341112
> DETAIL:  could not o= pen file "/home/postgres/data/pg_clog/0420": No such
> file or directory

Fortunately for you, pg_statistic doesn't= contain any irreplaceable
data.  So you could get out of this= via

       TRUNCATE pg_statistic;
=        VACUUM ANALYZE;  -- rebuild = contents of pg_statistic
       VACUUM FREEZE;   -- make= sure template0 needs no further vacuuming

Then reset template0's da= tallowconn to false, and get rid of that code
to override it.  = ;And then update to a more recent release ;-)

(I don't recall exactly what rules 7.4 uses, but likely you'll find tha= t
you need to run a standalone backend with -O switch to perform
TRUN= CATE on a system catalog.)

       = ;            &n= bsp;   regards, tom lane



--
Best,
Gourish Si= ngbal=20 ------=_Part_5483_23357891.1135667143464-- From pgsql-admin-owner@postgresql.org Tue Dec 27 03:16:24 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 480699DC81E for ; Tue, 27 Dec 2005 03:16:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91039-05 for ; Tue, 27 Dec 2005 03:16:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 0ACEF9DC80E for ; Tue, 27 Dec 2005 03:16:18 -0400 (AST) 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 jBR7GIoO020441; Tue, 27 Dec 2005 02:16:18 -0500 (EST) To: Gourish Singbal cc: "pgsql-admin@postgresql.org" Subject: Re: vacuuming template0 gave ERROR In-reply-to: <674d1f8a0512262305g3e2bfb81t420482ea981b6e14@mail.gmail.com> References: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> <9822.1135612972@sss.pgh.pa.us> <674d1f8a0512262305g3e2bfb81t420482ea981b6e14@mail.gmail.com> Comments: In-reply-to Gourish Singbal message dated "Tue, 27 Dec 2005 12:35:43 +0530" Date: Tue, 27 Dec 2005 02:16:18 -0500 Message-ID: <20440.1135667778@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200512/314 X-Sequence-Number: 20034 Gourish Singbal writes: > I got the followign Erorr when i tried to trucate the table. > /usr/local/pgsql/bin/postgres -D data -O -o standalone_log template0 > 2005-12-26 22:48:12 ERROR: expected one dependency record for TOAST table, > found 0 [ raised eyebrow... ] Probably time to pg_dump, initdb, reload. You seem to be suffering multiple problems. If you aren't aware of any catastrophe that would explain all these holes in your DB, then it's also time to start running some hardware diagnostics ... regards, tom lane From pgsql-admin-owner@postgresql.org Tue Dec 27 03:20:13 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 138BD9DC81E for ; Tue, 27 Dec 2005 03:20:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91009-07 for ; Tue, 27 Dec 2005 03:20:12 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.197]) by postgresql.org (Postfix) with ESMTP id 7FD569DC81B for ; Tue, 27 Dec 2005 03:20:10 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1324366nzn for ; Mon, 26 Dec 2005 23:20:11 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=esNnUAqMcnjV4WYMuWTYtUon3cBAOTrQEk5iEX6GfrwjiTiV6uu3M599txHcRFyN4jmfMSgRa416AdsqiWTcNlRTQmuMt8T7nlPCFW2S5dOr1NssL6g2GAjPhB7MAc88rcDj/hZggqqPPQmmdSKZKxY+4n4giObLGOsERorpetk= Received: by 10.36.67.9 with SMTP id p9mr4019688nza; Mon, 26 Dec 2005 23:20:11 -0800 (PST) Received: by 10.36.72.7 with HTTP; Mon, 26 Dec 2005 23:20:10 -0800 (PST) Message-ID: <674d1f8a0512262320x7151c4e5ka87b535599b891ee@mail.gmail.com> Date: Tue, 27 Dec 2005 12:50:10 +0530 From: Gourish Singbal To: "pgsql-admin@postgresql.org" Subject: Re: vacuuming template0 gave ERROR In-Reply-To: <20440.1135667778@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5535_1836333.1135668010908" References: <674d1f8a0512260334g3b72c635m7d46ab457a8f2694@mail.gmail.com> <9822.1135612972@sss.pgh.pa.us> <674d1f8a0512262305g3e2bfb81t420482ea981b6e14@mail.gmail.com> <20440.1135667778@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.142 required=5 tests=[AWL=0.141, HTML_MESSAGE=0.001] X-Spam-Score: 0.142 X-Spam-Level: X-Archive-Number: 200512/315 X-Sequence-Number: 20035 ------=_Part_5535_1836333.1135668010908 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks a million tom, But guess what we think alike, have taken the dump and am in to process of restoring it right now. thanks for the help. On 12/27/05, Tom Lane wrote: > > Gourish Singbal writes: > > I got the followign Erorr when i tried to trucate the table. > > /usr/local/pgsql/bin/postgres -D data -O -o standalone_log template0 > > > 2005-12-26 22:48:12 ERROR: expected one dependency record for TOAST > table, > > found 0 > > [ raised eyebrow... ] Probably time to pg_dump, initdb, reload. You > seem to be suffering multiple problems. If you aren't aware of any > catastrophe that would explain all these holes in your DB, then it's > also time to start running some hardware diagnostics ... > > regards, tom lane > -- Best, Gourish Singbal ------=_Part_5535_1836333.1135668010908 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
 
Thanks a million tom,
 
But guess what we think alike, have taken the dump and am in to proces= s of restoring it right now.
 
thanks for the help.

 
On 12/27/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Gourish Singbal <gourish@gmail.com> writes:
> I got th= e followign Erorr when i tried to trucate the table.
>  /usr/local/pgsql/bin/postgres -D data -O -o standalone_= log template0

> 2005-12-26 22:48:12 ERROR:  expected on= e dependency record for TOAST table,
> found 0

[ raised eyebro= w... ]  Probably time to pg_dump, initdb, reload.  You
seem to be suffering multiple problems.  If you aren't aware = of any
catastrophe that would explain all these holes in your DB, then i= t's
also time to start running some hardware diagnostics ...

&nbs= p;            &= nbsp;         regards, tom lane



--
Best,
Gourish Si= ngbal=20 ------=_Part_5535_1836333.1135668010908-- From pgsql-performance-owner@postgresql.org Tue Dec 27 03:24:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0AD3F9DC81B for ; Tue, 27 Dec 2005 03:24:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93371-06 for ; Tue, 27 Dec 2005 03:24:46 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by postgresql.org (Postfix) with ESMTP id 542249DC80E for ; Tue, 27 Dec 2005 03:24:44 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1324974nzn for ; Mon, 26 Dec 2005 23:24:45 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=goPMqHX0gGfdgj7mC+ZZOJCC0jBbI0oPiGmOJuL9zyAKh4ZAIv2PoyKsRsdi1vM6kumwmVan7FF/wT6b2qnH9CSkCq6ZIb7OeWAgk2rfXRbxjEhY6YAi8wa0kS3Nb4cBiEVjHPKfGtlTZirnxruxqYyszu2Zm1e2M0P7uQLXMDs= Received: by 10.36.22.17 with SMTP id 17mr4027157nzv; Mon, 26 Dec 2005 23:24:45 -0800 (PST) Received: by 10.36.19.19 with HTTP; Mon, 26 Dec 2005 23:24:45 -0800 (PST) Message-ID: <758d5e7f0512262324i4dccd6bbs87d80e59eb776a8@mail.gmail.com> Date: Tue, 27 Dec 2005 08:24:45 +0100 From: Dawid Kuroczko To: pgsql-performance@postgresql.org Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/628 X-Sequence-Number: 16449 On 12/26/05, David Lang wrote: > raid5 writes n+1 blocks not n+n/2 (unless n=3D2 for a 3-disk raid). you c= an > have a 15+1 disk raid5 array for example > > however raid1 (and raid10) have to write 2*n blocks to disk. so if you ar= e > talking about pure I/O needed raid5 wins hands down. (the same 16 drives > would be a 8+8 array) > > what slows down raid 5 is that to modify a block you have to read blocks > from all your drives to re-calculate the parity. this interleaving of > reads and writes when all you are logicly doing is writes can really hurt= . > (this is why I asked the question that got us off on this tangent, when > doing new writes to an array you don't have to read the blocks as they ar= e > blank, assuming your cacheing is enough so that you can write blocksize*n > before the system starts actually writing the data) Not exactly true. Let's assume you have a 4+1 RAID5 (drives A, B, C, D and E), and you want to update drive A. Let's assume the parity is stored in this particular write on drive E. One way to write it is: write A, read A, B, C, D, combine A+B+C+D and write it E. (4 reads + 2 writes) The other way to write it is: read oldA, read old parity oldE write newA, write E =3D oldE + (newA-oldA) -- calculate difference between new and old A, and apply it to old parity, then write (2 reads + 2 writes) The more drives you have, the smarter it is to use the second approach, unless of course A, B, C and D are available in the cache, which is the niciest situation. Regards, Dawid From pgsql-performance-owner@postgresql.org Tue Dec 27 09:25:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5311B9DC8A5 for ; Tue, 27 Dec 2005 09:25:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86710-10 for ; Tue, 27 Dec 2005 09:25:19 -0400 (AST) X-Greylist: delayed 15:47:44.937788 by SQLgrey- Received: from geri.cc.fer.hr (geri.cc.fer.hr [161.53.72.121]) by postgresql.org (Postfix) with ESMTP id 498F59DC859 for ; Tue, 27 Dec 2005 09:25:13 -0400 (AST) Received: from geri.cc.fer.hr (localhost.cc.fer.hr [127.0.0.1]) by geri.cc.fer.hr (8.13.4/8.13.1) with ESMTP id jBRDJut6005352; Tue, 27 Dec 2005 14:19:56 +0100 (CET) (envelope-from ivoras@fer.hr) Received: from localhost (ivoras@localhost) by geri.cc.fer.hr (8.13.4/8.13.1/Submit) with ESMTP id jBRDJtRE005349; Tue, 27 Dec 2005 14:19:55 +0100 (CET) (envelope-from ivoras@fer.hr) X-Authentication-Warning: geri.cc.fer.hr: ivoras owned process doing -bs Date: Tue, 27 Dec 2005 14:19:55 +0100 (CET) From: Ivan Voras To: Tom Lane cc: pgsql-performance@postgresql.org Subject: Re: Bitmap indexes etc. In-Reply-To: <12553.1135634231@sss.pgh.pa.us> Message-ID: <20051227141850.U5310@geri.cc.fer.hr> References: <20051226222915.G87624@geri.cc.fer.hr> <12553.1135634231@sss.pgh.pa.us> 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, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/629 X-Sequence-Number: 16450 On Mon, 26 Dec 2005, Tom Lane wrote: > ...snip... Thanks, it's a very good explanation! -- Preserve wildlife -- pickle a squirrel today! From pgsql-performance-owner@postgresql.org Tue Dec 27 09:35:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A0FF9DCA2D for ; Tue, 27 Dec 2005 09:35:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89912-06 for ; Tue, 27 Dec 2005 09:35:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by postgresql.org (Postfix) with ESMTP id 3A95A9DC859 for ; Tue, 27 Dec 2005 09:35:26 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.72.158]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IS500GIVSF5TOJN@vms040.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 27 Dec 2005 07:35:29 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id BFBC26057D8 for ; Tue, 27 Dec 2005 08:35:28 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05808-01 for ; Tue, 27 Dec 2005 08:35:27 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 371FC6001CA; Tue, 27 Dec 2005 08:35:27 -0500 (EST) Date: Tue, 27 Dec 2005 08:35:27 -0500 From: Michael Stone Subject: Re: What's the best hardver for PostgreSQL 8.1? In-reply-to: <33c6269f0512261504n564c9198ka65bacbd1054f8fa@mail.gmail.com> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051227133526.GA6811@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200512/630 X-Sequence-Number: 16451 On Mon, Dec 26, 2005 at 12:32:19PM -0500, Alex Turner wrote: >It's irrelavent what controller, you still have to actualy write the >parity blocks, which slows down your write speed because you have to >write n+n/2 blocks. instead of just n blocks making the system write >50% more data. > >RAID 5 must write 50% more data to disk therefore it will always be >slower. At this point you've drifted into complete nonsense mode. On Mon, Dec 26, 2005 at 10:11:00AM -0800, David Lang wrote: >what slows down raid 5 is that to modify a block you have to read blocks >from all your drives to re-calculate the parity. this interleaving of >reads and writes when all you are logicly doing is writes can really hurt. >(this is why I asked the question that got us off on this tangent, when >doing new writes to an array you don't have to read the blocks as they are >blank, assuming your cacheing is enough so that you can write blocksize*n >before the system starts actually writing the data) Correct; there's no reason for the controller to read anything back if your write will fill a complete stripe. That's why I said that there isn't a "RAID 5 penalty" assuming you've got a reasonably fast controller and you're doing large sequential writes (or have enough cache that random writes can be batched as large sequential writes). On Mon, Dec 26, 2005 at 06:04:40PM -0500, Alex Turner wrote: >Yes, but those blocks in RAID 10 are largely irrelevant as they are to >independant disks. In RAID 5 you have to write parity to an 'active' >drive that is part of the stripe. Once again, this doesn't make any sense. Can you explain which parts of a RAID 10 array are inactive? >I agree totally that the read+parity-calc+write in the worst case is >totaly bad, which is why I alway recommend people should _never ever_ >use RAID 5. In this day and age of large capacity chassis, and large >capacity SATA drives, RAID 5 is totally inapropriate IMHO for _any_ >application least of all databases. So I've got a 14 drive chassis full of 300G SATA disks and need at least 3.5TB of data storage. In your mind the only possible solution is to buy another 14 drive chassis? Must be nice to never have a budget. Must be a hard sell if you've bought decent enough hardware that your benchmarks can't demonstrate a difference between a RAID 5 and a RAID 10 configuration on that chassis except in degraded mode (and the customer doesn't want to pay double for degraded mode performance). >In reality I have yet to benchmark a system where RAID 5 on the same >number of drives with 8 drives or less in a single array beat a RAID >10 with the same number of drives. Well, those are frankly little arrays, probably on lousy controllers... Mike Stone From pgsql-performance-owner@postgresql.org Tue Dec 27 12:16:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 487D79DC81A for ; Tue, 27 Dec 2005 12:16:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45437-08 for ; Tue, 27 Dec 2005 12:16:12 -0400 (AST) X-Greylist: delayed 00:06:38.469761 by SQLgrey- Received: from correo4.acens.net (correo4.acens.net [217.116.0.38]) by postgresql.org (Postfix) with ESMTP id 071F79DC80C for ; Tue, 27 Dec 2005 12:16:10 -0400 (AST) Received: (qmail 26242 invoked from network); 27 Dec 2005 16:09:30 -0000 Received: from unknown (HELO albert.sedifa.com) ([83.175.220.10]) (envelope-sender ) by correo4.acens.net (qmail-ldap-1.03) with SMTP for ; 27 Dec 2005 16:09:30 -0000 From: Albert Cervera Areny Organization: Sedifa, S.L. To: pgsql-performance@postgresql.org Subject: Performance problems with 8.1.1 compared to 7.4.7 Date: Tue, 27 Dec 2005 17:09:28 +0100 User-Agent: KMail/1.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512271709.29185.albert@sedifa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/631 X-Sequence-Number: 16452 Hello, we have a PostgreSQL for datawarehousing. As we heard of so many enhancements for 8.0 and 8.1 versions we dicided to upgrade from 7.4 to 8.1. I must say that the COPY FROM processes are much faster now from 27 to 17 minutes. Some queries where slower, but the performance problems were solved by increasing work_mem to 8192. However, now we have a query that is much slower with 8.1 compared to 7.4. The query lasts 7minutes (all the times we try) with 8.1, keeping CPU usage at 93~97% while it lasts 25 seconds in 7.4 the first time going down to 4 seconds the following tries. We're not experts at all but we can't see anything strange with the differences of EXPLAIN in the queries. Below I paste the query and the EXPLAIN output. Does somebody have a clue of what could be the cause of this big difference in performance? Many thanks in advance. SELECT lpad(c.codigo,6,'0'), MIN(c.nombre), SUM( CASE WHEN ( res.hora_inicio >= time '00:00' AND res.hora_inicio < time '16:00' ) THEN (CASE WHEN res.importe_neto IS NOT NULL THEN res.importe_neto ELSE 0 END) ELSE 0 END ) AS p1, SUM( CASE WHEN ( res.hora_inicio >= time '00:00' AND res.hora_inicio < time '16:00' ) THEN (CASE WHEN res.cantidad_servida IS NOT NULL THEN res.cantidad_servida ELSE 0 END) ELSE 0 END ) AS p2, SUM( CASE WHEN ( res.hora_inicio >= time '16:00' AND res.hora_inicio < time '23:59' ) THEN (CASE WHEN res.importe_neto IS NOT NULL THEN res.importe_neto ELSE 0 END) ELSE 0 END ) AS p3 SUM( CASE WHEN ( res.hora_inicio >= time '16:00' AND res.hora_inicio < time '23:59' ) THEN (CASE WHEN res.cantidad_servida IS NOT NULL THEN res.cantidad_servida ELSE 0 END) ELSE 0 END ) AS p4 SUM(CASE WHEN res.importe_neto IS NOT NULL THEN res.importe_neto ELSE 0 END) AS total, SUM(CASE WHEN res.cantidad_servida IS NOT NULL THEN res.cantidad_servida ELSE 0 END) AS total_lineas FROM clientes c LEFT JOIN ( SELECT la.cliente as cliente, es.hora_inicio as hora_inicio, la.albaran as albaran, la.cantidad_servida as cantidad_servida, la.importe_neto as importe_neto FROM lineas_albaranes la LEFT JOIN escaner es ON la.albaran = es.albaran WHERE la.fecha_albaran = '20-12-2005' AND la.empresa = 1 AND la.indicador_factura = 'F' ) AS res ON c.codigo = res.cliente, provincias p WHERE p.codigo = c.provincia AND p.nombre='NAME' AND EXISTS(SELECT 1 FROM lineas_albaranes la WHERE la.cliente=c.codigo AND la.fecha_albaran > (date '20-12-2005' - interval '2 month') AND la.fecha_albaran <= '20-12-2005' AND la.empresa=1 AND la.indicador_factura='F') GROUP BY c.codigo ORDER BY nom; PostgreSQL 8.1.1: QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (cost=333769.99..333769.99 rows=2 width=61) Sort Key: min((c.nombre)::text) -> GroupAggregate (cost=37317.41..333769.98 rows=2 width=61) -> Nested Loop (cost=37317.41..333769.83 rows=2 width=61) Join Filter: ("inner".codigo = "outer".provincia) -> Merge Left Join (cost=37315.27..333758.58 rows=405 width=65) Merge Cond: ("outer".codigo = "inner".cliente) -> Index Scan using clientes_pkey on clientes c (cost=0.00..296442.28 rows=405 width=40) Filter: (subplan) SubPlan -> Bitmap Heap Scan on lineas_albaranes la (cost=138.99..365.53 rows=1 width=0) Recheck Cond: ((cliente = $0) AND ((indicador_factura)::text = 'F'::text)) Filter: ((fecha_albaran > '2005-10-20 00:00:00'::timestamp without time zone) AND (fecha_albaran <= '2005-12-20'::date)AND (empresa = 1)) -> BitmapAnd (cost=138.99..138.99 rows=57 width=0) -> Bitmap Index Scan on lineas_albaranes_cliente_idx (cost=0.00..65.87 rows=11392 width=0) Index Cond: (cliente = $0) -> Bitmap Index Scan on lineas_albaranes_indicador_factura_idx (cost=0.00..72.87 rows=11392 width=0) Index Cond: ((indicador_factura)::text = 'F'::text) -> Sort (cost=37315.27..37315.28 rows=1 width=29) Sort Key: la.cliente -> Nested Loop Left Join (cost=72.87..37315.26 rows=1 width=29) -> Bitmap Heap Scan on lineas_albaranes la (cost=72.87..37309.24 rows=1 width=25) Recheck Cond: ((indicador_factura)::text = 'F'::text) Filter: ((fecha_albaran = '2005-12-20'::date) AND (empresa = 1)) -> Bitmap Index Scan on lineas_albaranes_indicador_factura_idx (cost=0.00..72.87 rows=11392 width=0) Index Cond: ((indicador_factura)::text = 'F'::text) -> Index Scan using escaner_pkey on escaner es (cost=0.00..6.01 rows=1 width=12) Index Cond: ("outer".albaran = es.albaran) -> Materialize (cost=2.14..2.15 rows=1 width=4) -> Seq Scan on provincias p (cost=0.00..2.14 rows=1 width=4) Filter: ((nombre)::text = 'NAME'::text) (31 rows) PostgreSQL 7.4.7: QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=270300.14..270300.21 rows=29 width=61) Sort Key: min((c.nombre)::text) -> HashAggregate (cost=270298.20..270299.44 rows=29 width=61) -> Hash Join (cost=270222.84..270297.62 rows=29 width=61) Hash Cond: ("outer".provincia = "inner".codigo) -> Merge Left Join (cost=270220.70..270280.70 rows=2899 width=65) Merge Cond: ("outer".codigo = "inner".cliente) -> Sort (cost=10928.47..10929.48 rows=405 width=40) Sort Key: c.codigo -> Seq Scan on clientes c (cost=0.00..10910.93 rows=405 width=40) Filter: (subplan) SubPlan -> Index Scan using lineas_albaranes_cliente_idx on lineas_albaranes la (cost=0.00..51542.10 rows=3860 width=0) Index Cond: (cliente = $0) Filter: (((fecha_albaran)::timestamp without time zone > '2005-10-20 00:00:00'::timestamp without time zone) AND (fecha_albaran <= '2005-12-20'::date) AND (empresa = 1) AND ((indicador_factura)::text = 'F'::text)) -> Sort (cost=259292.23..259306.72 rows=5797 width=29) Sort Key: la.cliente -> Merge Right Join (cost=256176.76..258929.88 rows=5797 width=29) Merge Cond: ("outer".albaran = "inner".albaran) -> Index Scan using escaner_pkey on escaner es (cost=0.00..2582.64 rows=55604 width=12) -> Sort (cost=256176.76..256191.26 rows=5797 width=25) Sort Key: la.albaran -> Seq Scan on lineas_albaranes la (cost=0.00..255814.42 rows=5797 width=25) Filter: ((fecha_albaran = '2005-12-20'::date) AND (empresa = 1) AND ((indicador_factura)::text = 'F'::text)) -> Hash (cost=2.14..2.14 rows=2 width=4) -> Seq Scan on provincias p (cost=0.00..2.14 rows=2 width=4) Filter: ((nombre)::text = 'NAME'::text) (27 rows) From pgsql-performance-owner@postgresql.org Tue Dec 27 12:50:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 04FCE9DC81C for ; Tue, 27 Dec 2005 12:50:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52597-03 for ; Tue, 27 Dec 2005 12:50:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from elasmtp-kukur.atl.sa.earthlink.net (elasmtp-kukur.atl.sa.earthlink.net [209.86.89.65]) by postgresql.org (Postfix) with ESMTP id 5EA1F9DC993 for ; Tue, 27 Dec 2005 12:50:23 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=kVRYDAsT73AAGqxLoYtLM2s5ZNBoS8db3Vk2LNd9yr2pqoulW2pL+dXMVXekTkGf; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by elasmtp-kukur.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1ErI1m-0002Hu-6p; Tue, 27 Dec 2005 11:50:22 -0500 Message-Id: <6.2.5.6.0.20051227110304.01dc1000@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 27 Dec 2005 11:50:16 -0500 To: Michael Stone , pgsql-performance@postgresql.org From: Ron Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <20051227133526.GA6811@mathom.us> References: <43A84D03.7090002@ritek.hu> <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> <20051227133526.GA6811@mathom.us> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc5d2ace792d75549447177016bc369bfb350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.166 required=5 tests=[AWL=0.166] X-Spam-Score: 0.166 X-Spam-Level: X-Archive-Number: 200512/632 X-Sequence-Number: 16453 At 08:35 AM 12/27/2005, Michael Stone wrote: >On Mon, Dec 26, 2005 at 10:11:00AM -0800, David Lang wrote: >>what slows down raid 5 is that to modify a block you have to read >>blocks from all your drives to re-calculate the parity. this >>interleaving of reads and writes when all you are logicly doing is >>writes can really hurt. (this is why I asked the question that got >>us off on this tangent, when doing new writes to an array you don't >>have to read the blocks as they are blank, assuming your cacheing >>is enough so that you can write blocksize*n before the system >>starts actually writing the data) > >Correct; there's no reason for the controller to read anything back >if your write will fill a complete stripe. That's why I said that >there isn't a "RAID 5 penalty" assuming you've got a reasonably fast >controller and you're doing large sequential writes (or have enough >cache that random writes can be batched as large sequential writes). Sorry. A decade+ RWE in production with RAID 5 using controllers as bad as Adaptec and as good as Mylex, Chaparral, LSI Logic (including their Engino stuff), and Xyratex under 5 different OS's (Sun, Linux, M$, DEC, HP) on each of Oracle, SQL Server, DB2, mySQL, and pg shows that RAID 5 writes are slower than RAID 5 reads With the one notable exception of the Mylex controller that was so good IBM bought Mylex to put them out of business. Enough IO load, random or sequential, will cause the effect no matter how much cache you have or how fast the controller is. The even bigger problem that everyone is ignoring here is that large RAID 5's spend increasingly larger percentages of their time with 1 failed HD in them. The math of having that many HDs operating simultaneously 24x7 makes it inevitable. This means you are operating in degraded mode an increasingly larger percentage of the time under exactly the circumstance you least want to be. In addition, you are =one= HD failure from data loss on that array an increasingly larger percentage of the time under exactly the least circumstances you want to be. RAID 5 is not a silver bullet. > On Mon, Dec 26, 2005 at 06:04:40PM -0500, Alex Turner wrote: >>Yes, but those blocks in RAID 10 are largely irrelevant as they are >>to independant disks. In RAID 5 you have to write parity to an >>'active' drive that is part of the stripe. > >Once again, this doesn't make any sense. Can you explain which parts of >a RAID 10 array are inactive? > >>I agree totally that the read+parity-calc+write in the worst case >>is totaly bad, which is why I alway recommend people should _never >>ever_ use RAID 5. In this day and age of large capacity chassis, >>and large capacity SATA drives, RAID 5 is totally inapropriate IMHO >>for _any_ application least of all databases. I vote with Michael here. This is an extreme position to take that can't be followed under many circumstances ITRW. >So I've got a 14 drive chassis full of 300G SATA disks and need at >least 3.5TB of data storage. In your mind the only possible solution >is to buy another 14 drive chassis? Must be nice to never have a budget. I think you mean an infinite budget. That's even assuming it's possible to get the HD's you need. I've had arrays that used all the space I could give them in 160 HD cabinets. Two 160 HD cabinets was neither within the budget nor going to perform well. I =had= to use RAID 5. RAID 10 was just not usage efficient enough. >Must be a hard sell if you've bought decent enough hardware that >your benchmarks can't demonstrate a difference between a RAID 5 and >a RAID 10 configuration on that chassis except in degraded mode (and >the customer doesn't want to pay double for degraded mode performance) I have =never= had this situation. RAID 10 latency is better than RAID 5 latency. RAID 10 write speed under heavy enough load, of any type, is faster than RAID 5 write speed under the same circumstances. RAID 10 robustness is better as well. Problem is that sometimes budget limits or number of HDs needed limits mean you can't use RAID 10. >>In reality I have yet to benchmark a system where RAID 5 on the >>same number of drives with 8 drives or less in a single array beat >>a RAID 10 with the same number of drives. > >Well, those are frankly little arrays, probably on lousy controllers... Nah. Regardless of controller I can take any RAID 5 and any RAID 10 built on the same HW under the same OS running the same DBMS and =guarantee= there is an IO load above which it can be shown that the RAID 10 will do writes faster than the RAID 5. The only exception in my career thus far has been the aforementioned Mylex controller. OTOH, sometimes you have no choice but to "take the hit" and use RAID 5. cheers, Ron From pgsql-performance-owner@postgresql.org Tue Dec 27 13:13:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 289739DC80C for ; Tue, 27 Dec 2005 13:13:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54026-08 for ; Tue, 27 Dec 2005 13:13:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id EBF839DC81A for ; Tue, 27 Dec 2005 13:13:50 -0400 (AST) 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 jBRHDh9q005442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Dec 2005 10:13:46 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBRHDhD2070137; Tue, 27 Dec 2005 10:13:43 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBRHDhvu070136; Tue, 27 Dec 2005 10:13:43 -0700 (MST) (envelope-from mfuhr) Date: Tue, 27 Dec 2005 10:13:43 -0700 From: Michael Fuhr To: Albert Cervera Areny Cc: pgsql-performance@postgresql.org Subject: Re: Performance problems with 8.1.1 compared to 7.4.7 Message-ID: <20051227171343.GA70061@winnie.fuhr.org> References: <200512271709.29185.albert@sedifa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200512271709.29185.albert@sedifa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.044 required=5 tests=[AWL=0.044] X-Spam-Score: 0.044 X-Spam-Level: X-Archive-Number: 200512/633 X-Sequence-Number: 16454 On Tue, Dec 27, 2005 at 05:09:28PM +0100, Albert Cervera Areny wrote: > However, now we have a query that is much slower with 8.1 compared to 7.4. > The query lasts 7minutes (all the times we try) with 8.1, keeping CPU usage > at 93~97% while it lasts 25 seconds in 7.4 the first time going down to 4 > seconds the following tries. > We're not experts at all but we can't see anything strange with the > differences of EXPLAIN in the queries. Below I paste the query and the > EXPLAIN output. Could you post the EXPLAIN ANALYZE output of the query on both systems? That'll show how accurate the planner's estimates are. Have you run ANALYZE (or VACUUM ANALYZE) on the tables in both versions? The row count estimates in the 8.1.1 query differ from those in the 7.4.7 query. Are the two versions using the same data set? Are your configuration settings the same in both versions? You mentioned increasing work_mem, but what about others like effective_cache_size, random_page_cost, and shared_buffers? -- Michael Fuhr From pgsql-performance-owner@postgresql.org Tue Dec 27 13:52:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5278E9DC879 for ; Tue, 27 Dec 2005 13:52:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59592-08 for ; Tue, 27 Dec 2005 13:52:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 5184B9DC9F7 for ; Tue, 27 Dec 2005 13:51:59 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBRHpw307927; Tue, 27 Dec 2005 12:51:58 -0500 (EST) From: Bruce Momjian Message-Id: <200512271751.jBRHpw307927@candle.pha.pa.us> Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <6.2.5.6.0.20051227110304.01dc1000@earthlink.net> To: Ron Date: Tue, 27 Dec 2005 12:51:58 -0500 (EST) CC: Michael Stone , 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, score=0.124 required=5 tests=[AWL=0.124] X-Spam-Score: 0.124 X-Spam-Level: X-Archive-Number: 200512/634 X-Sequence-Number: 16455 Historically, I have heard that RAID5 is only faster than RAID10 if there are six or more drives. --------------------------------------------------------------------------- Ron wrote: > At 08:35 AM 12/27/2005, Michael Stone wrote: > >On Mon, Dec 26, 2005 at 10:11:00AM -0800, David Lang wrote: > >>what slows down raid 5 is that to modify a block you have to read > >>blocks from all your drives to re-calculate the parity. this > >>interleaving of reads and writes when all you are logicly doing is > >>writes can really hurt. (this is why I asked the question that got > >>us off on this tangent, when doing new writes to an array you don't > >>have to read the blocks as they are blank, assuming your cacheing > >>is enough so that you can write blocksize*n before the system > >>starts actually writing the data) > > > >Correct; there's no reason for the controller to read anything back > >if your write will fill a complete stripe. That's why I said that > >there isn't a "RAID 5 penalty" assuming you've got a reasonably fast > >controller and you're doing large sequential writes (or have enough > >cache that random writes can be batched as large sequential writes). > > Sorry. A decade+ RWE in production with RAID 5 using controllers as > bad as Adaptec and as good as Mylex, Chaparral, LSI Logic (including > their Engino stuff), and Xyratex under 5 different OS's (Sun, Linux, > M$, DEC, HP) on each of Oracle, SQL Server, DB2, mySQL, and pg shows > that RAID 5 writes are slower than RAID 5 reads > > With the one notable exception of the Mylex controller that was so > good IBM bought Mylex to put them out of business. > > Enough IO load, random or sequential, will cause the effect no matter > how much cache you have or how fast the controller is. > > The even bigger problem that everyone is ignoring here is that large > RAID 5's spend increasingly larger percentages of their time with 1 > failed HD in them. The math of having that many HDs operating > simultaneously 24x7 makes it inevitable. > > This means you are operating in degraded mode an increasingly larger > percentage of the time under exactly the circumstance you least want > to be. In addition, you are =one= HD failure from data loss on that > array an increasingly larger percentage of the time under exactly the > least circumstances you want to be. > > RAID 5 is not a silver bullet. > > > > On Mon, Dec 26, 2005 at 06:04:40PM -0500, Alex Turner wrote: > >>Yes, but those blocks in RAID 10 are largely irrelevant as they are > >>to independant disks. In RAID 5 you have to write parity to an > >>'active' drive that is part of the stripe. > > > >Once again, this doesn't make any sense. Can you explain which parts of > >a RAID 10 array are inactive? > > > >>I agree totally that the read+parity-calc+write in the worst case > >>is totaly bad, which is why I alway recommend people should _never > >>ever_ use RAID 5. In this day and age of large capacity chassis, > >>and large capacity SATA drives, RAID 5 is totally inapropriate IMHO > >>for _any_ application least of all databases. > I vote with Michael here. This is an extreme position to take that > can't be followed under many circumstances ITRW. > > > >So I've got a 14 drive chassis full of 300G SATA disks and need at > >least 3.5TB of data storage. In your mind the only possible solution > >is to buy another 14 drive chassis? Must be nice to never have a budget. > > I think you mean an infinite budget. That's even assuming it's > possible to get the HD's you need. I've had arrays that used all the > space I could give them in 160 HD cabinets. Two 160 HD cabinets was > neither within the budget nor going to perform well. I =had= to use > RAID 5. RAID 10 was just not usage efficient enough. > > > >Must be a hard sell if you've bought decent enough hardware that > >your benchmarks can't demonstrate a difference between a RAID 5 and > >a RAID 10 configuration on that chassis except in degraded mode (and > >the customer doesn't want to pay double for degraded mode performance) > > I have =never= had this situation. RAID 10 latency is better than > RAID 5 latency. RAID 10 write speed under heavy enough load, of any > type, is faster than RAID 5 write speed under the same > circumstances. RAID 10 robustness is better as well. > > Problem is that sometimes budget limits or number of HDs needed > limits mean you can't use RAID 10. > > > >>In reality I have yet to benchmark a system where RAID 5 on the > >>same number of drives with 8 drives or less in a single array beat > >>a RAID 10 with the same number of drives. > > > >Well, those are frankly little arrays, probably on lousy controllers... > Nah. Regardless of controller I can take any RAID 5 and any RAID 10 > built on the same HW under the same OS running the same DBMS and > =guarantee= there is an IO load above which it can be shown that the > RAID 10 will do writes faster than the RAID 5. The only exception in > my career thus far has been the aforementioned Mylex controller. > > OTOH, sometimes you have no choice but to "take the hit" and use RAID 5. > > > cheers, > Ron > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: 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 Tue Dec 27 14:02:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1B5CB9DC81A for ; Tue, 27 Dec 2005 14:02:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62373-05 for ; Tue, 27 Dec 2005 14:02:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from correo2.acens.net (correo2.acens.net [217.116.0.34]) by postgresql.org (Postfix) with ESMTP id 498CB9DC80C for ; Tue, 27 Dec 2005 14:02:19 -0400 (AST) Received: (qmail 5277 invoked from network); 27 Dec 2005 18:02:19 -0000 Received: from unknown (HELO albert.sedifa.com) ([83.175.220.10]) (envelope-sender ) by correo2.acens.net (qmail-ldap-1.03) with SMTP for ; 27 Dec 2005 18:02:19 -0000 From: Albert Cervera Areny Organization: Sedifa, S.L. To: pgsql-performance@postgresql.org Subject: Re: Performance problems with 8.1.1 compared to 7.4.7 Date: Tue, 27 Dec 2005 19:02:17 +0100 User-Agent: KMail/1.7.2 References: <200512271709.29185.albert@sedifa.com> <20051227171343.GA70061@winnie.fuhr.org> In-Reply-To: <20051227171343.GA70061@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200512271902.18023.albert@sedifa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/635 X-Sequence-Number: 16456 A Dimarts 27 Desembre 2005 18:13, Michael Fuhr va escriure: > On Tue, Dec 27, 2005 at 05:09:28PM +0100, Albert Cervera Areny wrote: > > However, now we have a query that is much slower with 8.1 compared to > > 7.4. The query lasts 7minutes (all the times we try) with 8.1, keeping > > CPU usage at 93~97% while it lasts 25 seconds in 7.4 the first time goi= ng > > down to 4 seconds the following tries. > > We're not experts at all but we can't see anything strange with the > > differences of EXPLAIN in the queries. Below I paste the query and the > > EXPLAIN output. > > Could you post the EXPLAIN ANALYZE output of the query on both > systems? That'll show how accurate the planner's estimates are. > > Have you run ANALYZE (or VACUUM ANALYZE) on the tables in both > versions? The row count estimates in the 8.1.1 query differ from > those in the 7.4.7 query. Are the two versions using the same data > set? > > Are your configuration settings the same in both versions? You > mentioned increasing work_mem, but what about others like > effective_cache_size, random_page_cost, and shared_buffers? Hey, thank you for your fast response, I found what the problem was. I thought the settings were the same but work_mem was still higher in 7.4,= =20 30Mb, so I increased 8.1 to 30Mb and it worked faster, down to 17 seconds t= he=20 first time, 2.5 seconds for the others.=20 Are there any "rules of thumb" to let a begginer give reasonable values to= =20 these parameters? Not only work_mem, but also random_page_cost, and so on.= =20 Are there any tests one can run to determine "good" values? Thanks a lot! =2D-=20 Albert Cervera Areny Dept. Inform=E0tica Sedifa, S.L. Av. Can Bordoll, 149 08202 - Sabadell (Barcelona) Tel. 93 715 51 11 =46ax. 93 715 51 12 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2E....................... AVISO LEGAL ............................ La presente comunicaci=F3n y sus anexos tiene como destinatario la persona a la que va dirigida, por lo que si usted lo recibe por error debe notificarlo al remitente y eliminarlo de su sistema, no pudiendo utilizarlo, total o parcialmente, para ning=FAn fin. Su contenido puede tener informaci=F3n confidencial o protegida legalmente y =FAnicamente expresa la opini=F3n del remitente. El uso del correo electr=F3nico v=EDa Internet no permite asegurar ni la confidencialidad de los mensajes ni su correcta recepci=F3n. En el caso de que el destinatario no consintiera la utilizaci=F3n del correo electr=F3nico, deber=E1 ponerlo en nuestro conocimiento inmediatamente. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2E.......................... DISCLAIMER ............................. This message and its attachments are intended exclusively for the named addressee. If you receive this message in error, please immediately delete it from your system and notify the sender. You may not use this message or any part of it for any purpose. The message may contain information that is confidential or protected by law, and any opinions expressed are those of the individual sender. Internet e-mail guarantees neither the confidentiality nor the proper receipt of the message sent. If the addressee of this message does not consent to the use of internet e-mail, please inform us inmmediately. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 From pgsql-performance-owner@postgresql.org Tue Dec 27 14:56:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 903889DC9C9 for ; Tue, 27 Dec 2005 14:56:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71126-01 for ; Tue, 27 Dec 2005 14:56:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by postgresql.org (Postfix) with ESMTP id BA38E9DC81A for ; Tue, 27 Dec 2005 14:56:49 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jBRIumMZ004565; Tue, 27 Dec 2005 12:56:48 -0600 Date: Tue, 27 Dec 2005 12:56:56 -0600 From: Frank Wiles To: Albert Cervera Areny Cc: pgsql-performance@postgresql.org Subject: Re: Performance problems with 8.1.1 compared to 7.4.7 Message-Id: <20051227125656.5d138645.frank@wiles.org> In-Reply-To: <200512271902.18023.albert@sedifa.com> References: <200512271709.29185.albert@sedifa.com> <20051227171343.GA70061@winnie.fuhr.org> <200512271902.18023.albert@sedifa.com> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/636 X-Sequence-Number: 16457 On Tue, 27 Dec 2005 19:02:17 +0100 Albert Cervera Areny wrote: > Are there any "rules of thumb" to let a begginer give reasonable > values to these parameters? Not only work_mem, but also > random_page_cost, and so on. Are there any tests one can run to > determine "good" values? > Hi Albert, There are several online sites that have information related to tuning parameters. Here is a list of a few of them: http://revsys.com/writings/postgresql-performance.html http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html http://www.powerpostgresql.com/Docs http://www.powerpostgresql.com/PerfList Hope these help! --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Tue Dec 27 15:05:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 162449DC9A6 for ; Tue, 27 Dec 2005 15:05:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71126-08 for ; Tue, 27 Dec 2005 15:05:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by postgresql.org (Postfix) with ESMTP id 528D89DC81A for ; Tue, 27 Dec 2005 15:05:21 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.72.158]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IS600LUB7OUAEE4@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 27 Dec 2005 13:05:18 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 19B546003E0 for ; Tue, 27 Dec 2005 14:05:17 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05809-01 for ; Tue, 27 Dec 2005 14:05:16 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id BC0D96001C0; Tue, 27 Dec 2005 14:05:16 -0500 (EST) Date: Tue, 27 Dec 2005 14:05:16 -0500 From: Michael Stone Subject: Re: What's the best hardver for PostgreSQL 8.1? In-reply-to: <6.2.5.6.0.20051227110304.01dc1000@earthlink.net> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051227190516.GB6811@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> <20051227133526.GA6811@mathom.us> <6.2.5.6.0.20051227110304.01dc1000@earthlink.net> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.053 required=5 tests=[AWL=0.053] X-Spam-Score: 0.053 X-Spam-Level: X-Archive-Number: 200512/637 X-Sequence-Number: 16458 On Tue, Dec 27, 2005 at 11:50:16AM -0500, Ron wrote: >Sorry. A decade+ RWE in production with RAID 5 using controllers as >bad as Adaptec and as good as Mylex, Chaparral, LSI Logic (including >their Engino stuff), and Xyratex under 5 different OS's (Sun, Linux, >M$, DEC, HP) on each of Oracle, SQL Server, DB2, mySQL, and pg shows >that RAID 5 writes are slower than RAID 5 reads What does that have to do with anything? That wasn't the question... >RAID 5 is not a silver bullet. Who said it was? Nothing is, not even RAID 10. The appropriate thing to do is to make decisions based on requirements, not to make sweeping statements that eliminate entire categories of solutions based on hand waving. Mike Stone From pgsql-performance-owner@postgresql.org Tue Dec 27 15:18:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 18DE49DC80C for ; Tue, 27 Dec 2005 15:18:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71906-06 for ; Tue, 27 Dec 2005 15:18:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id 0DFBA9DC9C9 for ; Tue, 27 Dec 2005 15:18:25 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Tue, 27 Dec 2005 14:18:21 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 27 Dec 2005 14:18:21 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 27 Dec 2005 19:18:20 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 27 Dec 2005 11:18:19 -0800 Subject: Re: What's the best hardver for PostgreSQL 8.1? From: "Luke Lonergan" To: "Bruce Momjian" , "Ron" cc: "Michael Stone" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] What's the best hardver for PostgreSQL 8.1? Thread-Index: AcYLDlYxGi/XaYB3RzyLteeUIiYGQAAC/VJ5 In-Reply-To: <200512271751.jBRHpw307927@candle.pha.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Dec 2005 19:18:21.0396 (UTC) FILETIME=[4CE7E940:01C60B1A] X-WSS-ID: 6FAF4CF73TO1794667-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.272 required=5 tests=[AWL=0.019, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.272 X-Spam-Level: * X-Archive-Number: 200512/638 X-Sequence-Number: 16459 Bruce, On 12/27/05 9:51 AM, "Bruce Momjian" wrote: > Historically, I have heard that RAID5 is only faster than RAID10 if > there are six or more drives. I think the real question here is "faster for what?" Also, just like the optimizer tunables for cpu/disk/memory speed relationships, the standing guidance for RAID has become outdated. Couple that with the predominance of really bad hardware RAID controllers and people not testing them or reporting their performance (HP, Adaptec, LSI, Dell) and we've got a mess. All we can really do is report success with various point solutions. RAID5 and RAID50 work fine for our customers who do OLAP type applications which are read-mostly. However, it only works well on good hardware and software, which at this time include the HW RAID controllers from 3Ware and reputedly Areca and SW using Linux SW RAID. I've heard that the external storage RAID controllers from EMC work well, and I'd suspect there are others, but none of the host-based SCSI HW RAID controllers I've tested work well on Linux. I say Linux, because I'm pretty sure that the HP smartarray controllers work well on Windows, but the Linux driver is so bad I'd say it doesn't work at all. WRT RAID10, it seems like throwing double the number of disks at the problems is something to be avoided if possible, though the random write performance may be important for OLTP. I think this assertion should be retested however in light of the increased speed of checksumming hardware and / or CPUs and faster, more effective drive electronics (write combining, write cache, etc). - Luke From pgsql-performance-owner@postgresql.org Tue Dec 27 15:24:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 646569DC80C for ; Tue, 27 Dec 2005 15:24:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74281-05 for ; Tue, 27 Dec 2005 15:24:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id 298489DC9C9 for ; Tue, 27 Dec 2005 15:24:23 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Tue, 27 Dec 2005 14:24:19 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 27 Dec 2005 14:24:18 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 27 Dec 2005 19:24:18 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 27 Dec 2005 11:24:17 -0800 Subject: Re: What's the best hardver for PostgreSQL 8.1? From: "Luke Lonergan" To: "Bruce Momjian" , "Ron" cc: "Michael Stone" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] What's the best hardver for PostgreSQL 8.1? Thread-Index: AcYLDlYxGi/XaYB3RzyLteeUIiYGQAADMqpa In-Reply-To: <200512271751.jBRHpw307927@candle.pha.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Dec 2005 19:24:18.0945 (UTC) FILETIME=[22058F10:01C60B1B] X-WSS-ID: 6FAF4B6812G1773291-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.28 required=5 tests=[AWL=0.027, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.28 X-Spam-Level: * X-Archive-Number: 200512/639 X-Sequence-Number: 16460 Bruce, On 12/27/05 9:51 AM, "Bruce Momjian" wrote: > Historically, I have heard that RAID5 is only faster than RAID10 if > there are six or more drives. Speaking of testing / proof, check this site out: http://www.wlug.org.nz/HarddiskBenchmarks I really like the idea - post your bonnie++ results so people can learn from your configurations. We've built a performance reporting site, but we can't seem to get it into shape for release. I'd really like to light a performance leaderboard / experiences site up somewhere... - Luke From pgsql-performance-owner@postgresql.org Tue Dec 27 15:57:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 741279DCA02 for ; Tue, 27 Dec 2005 15:57:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80835-01 for ; Tue, 27 Dec 2005 15:57:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by postgresql.org (Postfix) with ESMTP id 919499DCA42 for ; Tue, 27 Dec 2005 15:57:16 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=ndixv4POttR5bA48CFmbakRHeeGQGFc56aeU8hsZKPjg0J9a7Q9zB6FXArTp3Q2c; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1ErKwe-0005Oo-U2; Tue, 27 Dec 2005 14:57:17 -0500 Message-Id: <6.2.5.6.0.20051227144047.01dbe940@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 27 Dec 2005 14:57:13 -0500 To: Michael Stone , pgsql-performance@postgresql.org From: Ron Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <20051227190516.GB6811@mathom.us> References: <200512212209.50234.caseroj@comcast.net> <200512212231.55100.caseroj@comcast.net> <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> <20051227133526.GA6811@mathom.us> <6.2.5.6.0.20051227110304.01dc1000@earthlink.net> <20051227190516.GB6811@mathom.us> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc9afe83fe4214205cd2382b41ab71fcf1350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.16 required=5 tests=[AWL=0.160] X-Spam-Score: 0.16 X-Spam-Level: X-Archive-Number: 200512/640 X-Sequence-Number: 16461 At 02:05 PM 12/27/2005, Michael Stone wrote: >On Tue, Dec 27, 2005 at 11:50:16AM -0500, Ron wrote: >>Sorry. A decade+ RWE in production with RAID 5 using controllers >>as bad as Adaptec and as good as Mylex, Chaparral, LSI Logic >>(including their Engino stuff), and Xyratex under 5 different OS's >>(Sun, Linux, M$, DEC, HP) on each of Oracle, SQL Server, DB2, >>mySQL, and pg shows that RAID 5 writes are slower than RAID 5 reads > >What does that have to do with anything? That wasn't the question... Your quoted position is "there isn't a 'RAID 5 penalty' assuming you've got a reasonably fast controller and you're doing large sequential writes (or have enough cache that random writes can be batched as large sequential writes)." My experience across a wide range of HW, OSs, DBMS, and applications says you are wrong. Given enough IO, RAID 5 takes a bigger performance hit for writes than RAID 10 does. Enough IO, sequential or otherwise, will result in a situation where a RAID 10 array using the same number of HDs (and therefore of ~1/2 the usable capacity) will have better write performance than the equivalent RAID 5 built using the same number of HDs. There is a 'RAID 5 write penalty'. Said RAID 10 array will also be more robust than a RAID 5 built using the same number of HDs. OTOH, that does not make RAID 5 "bad". Nor are statements like "Never use RAID 5!" realistic or reasonable. Also, performance is not the only or even most important reason for choosing RAID 10 or RAID 50 over RAID 5. Robustness considerations can be more important than performance ones. cheers, Ron From pgsql-performance-owner@postgresql.org Tue Dec 27 17:15:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9BCAD9DC9A6 for ; Tue, 27 Dec 2005 17:15:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90548-06 for ; Tue, 27 Dec 2005 17:15:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by postgresql.org (Postfix) with ESMTP id 9DE329DC993 for ; Tue, 27 Dec 2005 17:15:24 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.72.158]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IS600GFBDPPWOV4@vms048.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 27 Dec 2005 15:15:26 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id DD4CC6003E0 for ; Tue, 27 Dec 2005 16:15:18 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05808-02 for ; Tue, 27 Dec 2005 16:15:18 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id B20F76001C0; Tue, 27 Dec 2005 16:15:18 -0500 (EST) Date: Tue, 27 Dec 2005 16:15:18 -0500 From: Michael Stone Subject: Re: What's the best hardver for PostgreSQL 8.1? In-reply-to: <6.2.5.6.0.20051227144047.01dbe940@earthlink.net> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051227211518.GC6811@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> <20051227133526.GA6811@mathom.us> <6.2.5.6.0.20051227110304.01dc1000@earthlink.net> <20051227190516.GB6811@mathom.us> <6.2.5.6.0.20051227144047.01dbe940@earthlink.net> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/641 X-Sequence-Number: 16462 On Tue, Dec 27, 2005 at 02:57:13PM -0500, Ron wrote: >Your quoted position is "there isn't a 'RAID 5 penalty' assuming >you've got a reasonably fast controller and you're doing large >sequential writes (or have enough cache that random writes can be >batched as large sequential writes)." And you said that RAID 5 writes are slower than reads. That's a completely different statement. The traditional meaning of "RAID 5 penalty" is the cost of reading a stripe to calculate parity if only a small part of the stripe changes. It has a special name because it can result in a condition that the performance is catastrophically worse than an optimal workload, or even the single-disk non-RAID case. It's still an issue, but might not be relevant for a particular workload. (Hence the recommendation to benchmark.) >My experience across a wide range of HW, OSs, DBMS, and applications >says you are wrong. Given enough IO, RAID 5 takes a bigger >performance hit for writes than RAID 10 does. I don't understand why you keep using the pejorative term "performance hit". Try describing the "performance characteristics" instead. Also, claims about performance claims based on experience are fairly useless. Either you have data to provide (in which case claiming vast experience is unnecessary) or you don't. >Said RAID 10 array will also be more robust than a RAID 5 built using >the same number of HDs. And a RAID 6 will be more robust than either. Basing reliability on "hopefully you wont have both disks in a mirror fail" is just silly. Either you need double disk failure protection or you don't. Mike Stone From pgsql-performance-owner@postgresql.org Tue Dec 27 18:47:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 958EC9DCA5E for ; Tue, 27 Dec 2005 18:47:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02589-04 for ; Tue, 27 Dec 2005 18:47:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth09.mail.atl.earthlink.net (smtpauth09.mail.atl.earthlink.net [209.86.89.69]) by postgresql.org (Postfix) with ESMTP id 3436D9DCA5A for ; Tue, 27 Dec 2005 18:47:54 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=F5z0bdtMxdZm9nUdsGvOFSlwlP0gxwKT28FzsbGCMGEe10GFF5TfG53Kev9nigVr; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth09.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1ErNbn-0003qP-S2; Tue, 27 Dec 2005 17:47:56 -0500 Message-Id: <6.2.5.6.0.20051227171742.01db4268@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 27 Dec 2005 17:47:52 -0500 To: Michael Stone , pgsql-performance@postgresql.org From: Ron Subject: Re: What's the best hardver for PostgreSQL 8.1? In-Reply-To: <20051227211518.GC6811@mathom.us> References: <20051224135042.484c6e32.frank@wiles.org> <6.2.5.6.0.20051224161551.01dc5d98@earthlink.net> <6.2.5.6.0.20051224172653.01dd4c08@earthlink.net> <20051225173755.GA6986@mathom.us> <33c6269f0512260932g38c9b7a4uc2aba00f72ff77@mail.gmail.com> <20051227133526.GA6811@mathom.us> <6.2.5.6.0.20051227110304.01dc1000@earthlink.net> <20051227190516.GB6811@mathom.us> <6.2.5.6.0.20051227144047.01dbe940@earthlink.net> <20051227211518.GC6811@mathom.us> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc773503ea060a119617a3fe1a053316ce350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.394 required=5 tests=[AWL=-0.085, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.394 X-Spam-Level: X-Archive-Number: 200512/642 X-Sequence-Number: 16463 At 04:15 PM 12/27/2005, Michael Stone wrote: >I don't understand why you keep using the pejorative term "performance >hit". Try describing the "performance characteristics" instead. pe=B7jor=B7a=B7tive ( P ) Pronunciation Key (p-j=F4r-tv, -jr-, pj-rtv,= pj-) adj. Tending to make or become worse. Disparaging; belittling. RAID 5 write performance is significantly enough=20 less than RAID 5 read performance as to be a=20 matter of professional note and concern. That's=20 not "disparaging or belittling" nor is it=20 "tending to make or become worse". It's=20 measurable fact that has an adverse impact on=20 capacity planning, budgeting, HW deployment, etc. If you consider calling a provable decrease in=20 performance while doing a certain task that has=20 such effects "a hit" or "bad" pejorative, you are=20 using a definition for the word that is different than the standard one. >Also, claims about performance claims based on experience are fairly= useless. >Either you have data to provide (in which case claiming vast experience >is unnecessary) or you don't. My experience _is_ the data provided. Isn't it=20 convenient for you that I don't have the records=20 for every job I've done in 20 years, nor do I=20 necessarily have the right to release some=20 specifics for some of what I do have. I've said=20 what I can as a service to the=20 community. Including to you. Your reaction=20 implies that I and others with perhaps equally or=20 more valuable experience to share shouldn't bother. "One of the major differences between Man and=20 Beast is that Man learns from others experience." It's also impressive that you evidently seem to=20 be implying that you do such records for your own=20 job experience _and_ that you have the legal=20 right to publish them. In which case, please=20 feel free to impress me further by doing so. >>Said RAID 10 array will also be more robust=20 >>than a RAID 5 built using the same number of HDs. > >And a RAID 6 will be more robust than either. Basing reliability on >"hopefully you wont have both disks in a mirror fail" is just silly. >Either you need double disk failure protection or you don't. That statement is incorrect and ignores both=20 probability and real world statistical failure patterns. The odds of a RAID 10 array of n HDs suffering a=20 failure that loses data are less than the odds of=20 it happening in a RAID 6 array of n HDs. You are=20 correct that RAID 6 is more robust than RAID 5. cheers, Ron From pgsql-performance-owner@postgresql.org Thu Dec 29 05:48:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0BC169DC804 for ; Thu, 29 Dec 2005 05:48:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86111-03 for ; Thu, 29 Dec 2005 05:48:28 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 10D819DC822 for ; Thu, 29 Dec 2005 05:48:25 -0400 (AST) Received: from mail.androme.com (mail.androme.com [62.58.96.145]) by svr4.postgresql.org (Postfix) with ESMTP id 308B05AF9E6 for ; Thu, 29 Dec 2005 09:48:26 +0000 (GMT) Received: from [192.168.10.56] ([192.168.10.56]) by mail.androme.com (8.12.10/8.12.10) with ESMTP id jBT9mLw5002400 for ; Thu, 29 Dec 2005 10:48:21 +0100 Message-ID: <43B3B0EA.6070406@andromeiberica.com> Date: Thu, 29 Dec 2005 10:48:26 +0100 From: Arnau Reply-To: arnaulist@andromeiberica.com User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: How import big amounts of data? 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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/643 X-Sequence-Number: 16464 Hi all, Which is the best way to import data to tables? I have to import 90000 rows into a column and doing it as inserts takes ages. Would be faster with copy? is there any other alternative to insert/copy? Cheers! From pgsql-performance-owner@postgresql.org Thu Dec 29 06:50:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7B7889DC817 for ; Thu, 29 Dec 2005 06:50:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93515-07 for ; Thu, 29 Dec 2005 06:50:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 9FCFE9DC804 for ; Thu, 29 Dec 2005 06:50:46 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1ErvMt-0004go-KU for pgsql-performance@postgresql.org; Thu, 29 Dec 2005 11:50:47 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1ErvMv-00077b-00 for ; Thu, 29 Dec 2005 11:50:49 +0100 Date: Thu, 29 Dec 2005 11:50:49 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: How import big amounts of data? Message-ID: <20051229105049.GB27287@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <43B3B0EA.6070406@andromeiberica.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <43B3B0EA.6070406@andromeiberica.com> X-Operating-System: Linux 2.6.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200512/644 X-Sequence-Number: 16465 On Thu, Dec 29, 2005 at 10:48:26AM +0100, Arnau wrote: > Which is the best way to import data to tables? I have to import > 90000 rows into a column and doing it as inserts takes ages. Would be > faster with copy? is there any other alternative to insert/copy? There are multiple reasons why your INSERT might be slow: - Are you using multiple transactions instead of batching them in all or a few transactions? (Usually, the per-transaction cost is a lot higher than the per-row insertion cost.) - Do you have a foreign key without a matching index in the other table? (In newer versions of PostgreSQL, EXPLAIN ANALYZE can help with this; do a single insert and see where it ends up doing work. Older won't show such things, though.) - Do you have an insertion trigger taking time? (Ditto wrt. EXPLAIN ANALYZE.) COPY will be faster than INSERT regardless, though (for more than a few rows, at least). /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Dec 29 07:39:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CF6669DC8A7 for ; Thu, 29 Dec 2005 07:39:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00985-05 for ; Thu, 29 Dec 2005 07:39:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from zigo.dhs.org (ua-83-227-204-174.cust.bredbandsbolaget.se [83.227.204.174]) by postgresql.org (Postfix) with ESMTP id B5EB69DC8DA for ; Thu, 29 Dec 2005 07:39:05 -0400 (AST) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id 4F7C58467; Thu, 29 Dec 2005 12:39:06 +0100 (CET) Date: Thu, 29 Dec 2005 12:39:06 +0100 (CET) From: Dennis Bjorklund To: Arnau Cc: pgsql-performance@postgresql.org Subject: Re: How import big amounts of data? In-Reply-To: <43B3B0EA.6070406@andromeiberica.com> 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, score=0.239 required=5 tests=[AWL=-0.239, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.239 X-Spam-Level: X-Archive-Number: 200512/645 X-Sequence-Number: 16466 On Thu, 29 Dec 2005, Arnau wrote: > Which is the best way to import data to tables? I have to import > 90000 rows into a column and doing it as inserts takes ages. Would be > faster with copy? is there any other alternative to insert/copy? Wrap the inserts inside a BEGIN/COMMIT block and it will be a lot faster. Copy is even faster, but for just 90000 rows I wouldn't bother. -- /Dennis Bj�rklund From pgsql-performance-owner@postgresql.org Thu Dec 29 10:20:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2C359DC818 for ; Thu, 29 Dec 2005 10:20:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31610-05 for ; Thu, 29 Dec 2005 10:20:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by postgresql.org (Postfix) with ESMTP id B09279DC80A for ; Thu, 29 Dec 2005 10:20:29 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=Ru3R44mpi7GI4CQbI54QDsLF1y6cqcjQBkn4rRqzPLPbDWH/uzjNRt2F8KpFBoN8; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1Erydt-0004xA-47; Thu, 29 Dec 2005 09:20:33 -0500 Message-Id: <6.2.5.6.0.20051229085429.01db84d8@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Thu, 29 Dec 2005 09:20:28 -0500 To: arnaulist@andromeiberica.com,pgsql-performance@postgresql.org From: Ron Subject: Re: How import big amounts of data? In-Reply-To: <43B3B0EA.6070406@andromeiberica.com> References: <43B3B0EA.6070406@andromeiberica.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc9dc06d8c468e3ca7901bed9711d99c1e350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.403 required=5 tests=[AWL=-0.076, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.403 X-Spam-Level: X-Archive-Number: 200512/646 X-Sequence-Number: 16467 At 04:48 AM 12/29/2005, Arnau wrote: >Hi all, > > Which is the best way to import data to tables? I have to import > 90000 rows into a column and doing it as inserts takes ages. Would > be faster with copy? is there any other alternative to insert/copy? Compared to some imports, 90K rows is not that large. Assuming you want the table(s) to be in some sorted order when you are done, the fastest way to import a large enough amount of data is: -put the new data into a temp table (works best if temp table fits into RAM) -merge the rows from the original table and the temp table into a new table -create the indexes you want on the new table -DROP the old table and its indexes -rename the new table and its indexes to replace the old ones. If you _don't_ care about having the table in some sorted order, -put the new data into a new table -COPY the old data to the new table -create the indexes you want on the new table -DROP the old table and its indexes -rename the new table and its indexes to replace the old ones Either of these procedures will also minimize your downtime while you are importing. If one doesn't want to go to all of the trouble of either of the above, at least DROP your indexes, do your INSERTs in batches, and rebuild your indexes. Doing 90K individual INSERTs should usually be avoided. cheers, Ron From pgsql-performance-owner@postgresql.org Thu Dec 29 10:41:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CE1DE9DC818 for ; Thu, 29 Dec 2005 10:41:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34801-02 for ; Thu, 29 Dec 2005 10:41:12 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id DA51E9DC817 for ; Thu, 29 Dec 2005 10:41:05 -0400 (AST) Received: from lou-bada.torma.org (lou-bada.torma.org [213.41.177.64]) by svr4.postgresql.org (Postfix) with ESMTP id CA8495AFEDA for ; Thu, 29 Dec 2005 14:41:10 +0000 (GMT) Received: from lara.torma.org (lara.lou-bada.torma.org [10.7.3.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lou-bada.torma.org (Postfix) with ESMTP id 74E315DB63 for ; Thu, 29 Dec 2005 15:41:07 +0100 (CET) From: Teemu Torma To: pgsql-performance@postgresql.org Subject: Re: How import big amounts of data? Date: Thu, 29 Dec 2005 15:41:05 +0100 User-Agent: KMail/1.9.1 References: <43B3B0EA.6070406@andromeiberica.com> In-Reply-To: <43B3B0EA.6070406@andromeiberica.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512291541.05739.teemu@torma.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/647 X-Sequence-Number: 16468 On Thursday 29 December 2005 10:48, Arnau wrote: > Which is the best way to import data to tables? I have to import > 90000 rows into a column and doing it as inserts takes ages. Would be > faster with copy? is there any other alternative to insert/copy? I am doing twice as big imports daily, and found the follwing method most efficient (other than using copy): - Use plpgsql function to do the actual insert (or update/insert if needed). - Inside a transaction, execute SELECT statements with maximum possible number of insert function calls in one go. This minimizes the number of round trips between the client and the server. Teemu From pgsql-performance-owner@postgresql.org Thu Dec 29 12:19:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 720939DC9F9 for ; Thu, 29 Dec 2005 12:19:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52709-01 for ; Thu, 29 Dec 2005 12:19:31 -0400 (AST) X-Greylist: delayed 06:31:10.216454 by SQLgrey- Received: from mail.androme.com (mail.androme.com [62.58.96.145]) by postgresql.org (Postfix) with ESMTP id 0F0069DC86F for ; Thu, 29 Dec 2005 12:19:30 -0400 (AST) Received: from [192.168.10.56] ([192.168.10.56]) by mail.androme.com (8.12.10/8.12.10) with ESMTP id jBTGJRw5005653; Thu, 29 Dec 2005 17:19:28 +0100 Message-ID: <43B40C8F.6010100@andromeiberica.com> Date: Thu, 29 Dec 2005 17:19:27 +0100 From: Arnau Reply-To: arnaulist@andromeiberica.com User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Teemu Torma CC: pgsql-performance@postgresql.org Subject: Re: How import big amounts of data? References: <43B3B0EA.6070406@andromeiberica.com> <200512291541.05739.teemu@torma.org> In-Reply-To: <200512291541.05739.teemu@torma.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, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/648 X-Sequence-Number: 16469 > > I am doing twice as big imports daily, and found the follwing method > most efficient (other than using copy): > > - Use plpgsql function to do the actual insert (or update/insert if > needed). > > - Inside a transaction, execute SELECT statements with maximum possible > number of insert function calls in one go. This minimizes the number > of round trips between the client and the server. Thanks Teemu! could you paste an example of one of those functions? ;-) An example of those SELECTS also would be great, I'm not sure I have completly understood what you mean. -- Arnau From pgsql-performance-owner@postgresql.org Thu Dec 29 13:05:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 161AB9DC9F0 for ; Thu, 29 Dec 2005 13:05:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57617-06 for ; Thu, 29 Dec 2005 13:05:48 -0400 (AST) X-Greylist: delayed 02:24:46.35502 by SQLgrey- Received: from lou-bada.torma.org (lou-bada.torma.org [213.41.177.64]) by postgresql.org (Postfix) with ESMTP id F22B19DC996 for ; Thu, 29 Dec 2005 13:05:47 -0400 (AST) Received: from lara.torma.org (lara.lou-bada.torma.org [10.7.3.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lou-bada.torma.org (Postfix) with ESMTP id 282235D5F8 for ; Thu, 29 Dec 2005 18:05:47 +0100 (CET) From: Teemu Torma To: pgsql-performance@postgresql.org Subject: Re: How import big amounts of data? User-Agent: KMail/1.9.1 References: <43B3B0EA.6070406@andromeiberica.com> <200512291541.05739.teemu@torma.org> <43B40C8F.6010100@andromeiberica.com> In-Reply-To: <43B40C8F.6010100@andromeiberica.com> MIME-Version: 1.0 Content-Disposition: inline X-Length: 1814 X-UID: 296 Date: Thu, 29 Dec 2005 18:05:45 +0100 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <200512291805.45684.teemu@torma.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/649 X-Sequence-Number: 16470 On Thursday 29 December 2005 17:19, Arnau wrote: > > - Use plpgsql function to do the actual insert (or update/insert if > > needed). > > > > - Inside a transaction, execute SELECT statements with maximum > > possible number of insert function calls in one go.  This minimizes > > the number of round trips between the client and the server. > > Thanks Teemu! could you paste an example of one of those functions? > ;-) An example of those SELECTS also would be great, I'm not sure I > have completly understood what you mean. An insert function like: CREATE OR REPLACE FUNCTION insert_values (the_value1 numeric, the_value2 numeric) RETURNS void LANGUAGE plpgsql VOLATILE AS $$ BEGIN INSERT INTO values (value1, value2) VALUES (the_value1, the_value2); RETURN; END; $$; Then execute queries like SELECT insert_values(1,2), insert_values(2,3), insert_values(3,4); with maximum number of insert_values calls as possible. I think the transaction (BEGIN/COMMIT) has little time benefit if you have at least hundreds of calls in one SELECT. Teemu From pgsql-performance-owner@postgresql.org Thu Dec 29 17:22:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BF3E59DC97C for ; Thu, 29 Dec 2005 17:22:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03099-02 for ; Thu, 29 Dec 2005 17:22:04 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 8652F9DC809 for ; Thu, 29 Dec 2005 17:22:00 -0400 (AST) Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net [71.128.90.172]) by svr4.postgresql.org (Postfix) with ESMTP id 5CCF15AF02D for ; Thu, 29 Dec 2005 21:22:02 +0000 (GMT) Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) by gghcwest.com (8.12.10/8.12.9) with ESMTP id jBTLLumd021359 for ; Thu, 29 Dec 2005 13:21:57 -0800 Received: from jwb by toonses.gghcwest.com with local (Exim 4.52) id 1Es5Dh-0000Xc-TJ for pgsql-performance@postgresql.org; Thu, 29 Dec 2005 13:21:57 -0800 Subject: Process executing COPY opens and reads every table on the system From: "Jeffrey W. Baker" To: pgperf Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 29 Dec 2005 13:21:57 -0800 Message-Id: <1135891317.1998.5.camel@toonses.gghcwest.com> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/650 X-Sequence-Number: 16471 I have an instance of PG 7.4 where I would really like to execute some schema changes, but every schema change is blocked waiting for a process doing a COPY. That query is: COPY drill.trades (manager, sec_id, ticker, bridge_tkr, date, "type", short, quantity, price, prin, net_money, factor) TO stdout; So it's only involved with a single table in a single schema. Unfortunately, what this process is doing is opening and reading every table in the database: # strace -e open,close -p 29859 Process 29859 attached - interrupt to quit open("/var/lib/postgres/data/base/7932340/2442094542", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.1", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205386", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205433", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205441", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.10", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.16", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/2298808676/2298808939.10", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.15", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205446", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205454", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429226532", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2442094542", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.4", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.8", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205386", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205441", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205446", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205454", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429226532", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2442094542", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205386", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205433", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205441", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414559657", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2426495316", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205446", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205454", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429226532", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2414561511", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2442094542", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205386", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.7", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205441", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429205446", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.1", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.10", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.2", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023238811.18", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2429226532", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/2298808676/2361517065", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2442094542", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.9", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.10", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.1", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.10", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.3", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.2", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/358185104.5", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/2298808676/2361517065", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.6", O_RDWR) = 49 close(49) = 0 open("/var/lib/postgres/data/base/7932340/2023517557.7", O_RDWR) = 49 close(49) = 0 Process 29859 detached Seems like a somewhat unusual behavior. As you can see it's opening some tables numerous times. Is there some way to avoid this? -jwb From pgsql-performance-owner@postgresql.org Thu Dec 29 18:09:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 710A29DC809 for ; Thu, 29 Dec 2005 18:09:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11538-02 for ; Thu, 29 Dec 2005 18:09:26 -0400 (AST) X-Greylist: delayed 00:47:22.988824 by SQLgrey- Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net [71.128.90.172]) by postgresql.org (Postfix) with ESMTP id 325FB9DC800 for ; Thu, 29 Dec 2005 18:09:21 -0400 (AST) Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) by gghcwest.com (8.12.10/8.12.9) with ESMTP id jBTM9Kmd032131 for ; Thu, 29 Dec 2005 14:09:21 -0800 Received: from jwb by toonses.gghcwest.com with local (Exim 4.52) id 1Es5xa-0000aZ-BI for pgsql-performance@postgresql.org; Thu, 29 Dec 2005 14:09:22 -0800 Subject: Invulnerable VACUUM process thrashing everything From: "Jeffrey W. Baker" To: pgperf Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 29 Dec 2005 14:09:22 -0800 Message-Id: <1135894162.2223.4.camel@toonses.gghcwest.com> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/651 X-Sequence-Number: 16472 A few WEEKS ago, the autovacuum on my instance of pg 7.4 unilaterally decided to VACUUM a table which has not been updated in over a year and is more than one terabyte on the disk. Because of the very high transaction load on this database, this VACUUM has been ruining performance for almost a month. Unfortunately is seems invulnerable to killing by signals: # ps ax | grep VACUUM 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM # kill -HUP 15308 # ps ax | grep VACUUM 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM # kill -INT 15308 # ps ax | grep VACUUM 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM # kill -PIPE 15308 # ps ax | grep VACUUM 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM o/~ But the cat came back, the very next day ... I assume that if I kill this with SIGKILL, that will bring down every other postgres process, so that should be avoided. But surely there is a way to interrupt this. If I had some reason to shut down the instance, I'd be screwed, it seems. -jwb From pgsql-performance-owner@postgresql.org Thu Dec 29 18:42:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E0E649DC9AD for ; Thu, 29 Dec 2005 18:42:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13020-06 for ; Thu, 29 Dec 2005 18:42:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by postgresql.org (Postfix) with ESMTP id BC5A09DC833 for ; Thu, 29 Dec 2005 18:42:53 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=WhrXh+lkeSd3d5GgcOjXXQgwrMvK0r8vM+1cd19FYEmu42t8BC6DxDvYNAfFYPU9; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.244.95] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1Es6U3-0005Cg-7R; Thu, 29 Dec 2005 17:42:55 -0500 Message-Id: <6.2.5.6.0.20051229173718.01dbfff0@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Thu, 29 Dec 2005 17:42:51 -0500 To: "Jeffrey W. Baker" , pgperf From: Ron Subject: Re: Invulnerable VACUUM process thrashing everything In-Reply-To: <1135894162.2223.4.camel@toonses.gghcwest.com> References: <1135894162.2223.4.camel@toonses.gghcwest.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc518200e96b37f39d8a0df2bed94bcda5350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.244.95 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.171 required=5 tests=[AWL=0.171] X-Spam-Score: 0.171 X-Spam-Level: X-Archive-Number: 200512/652 X-Sequence-Number: 16473 Ick. Can you get users and foreign connections off that machine, lock them out for some period, and renice the VACUUM? Shedding load and keeping it off while VACUUM runs high priority might allow it to finish in a reasonable amount of time. Or Shedding load and dropping the VACUUM priority might allow a kill signal to get through. Hope this helps, Ron At 05:09 PM 12/29/2005, Jeffrey W. Baker wrote: >A few WEEKS ago, the autovacuum on my instance of pg 7.4 unilaterally >decided to VACUUM a table which has not been updated in over a year and >is more than one terabyte on the disk. Because of the very high >transaction load on this database, this VACUUM has been ruining >performance for almost a month. Unfortunately is seems invulnerable to >killing by signals: > ># ps ax | grep VACUUM >15308 ? D 588:00 postgres: postgres skunk [local] VACUUM ># kill -HUP 15308 ># ps ax | grep VACUUM >15308 ? D 588:00 postgres: postgres skunk [local] VACUUM ># kill -INT 15308 ># ps ax | grep VACUUM >15308 ? D 588:00 postgres: postgres skunk [local] VACUUM ># kill -PIPE 15308 ># ps ax | grep VACUUM >15308 ? D 588:00 postgres: postgres skunk [local] VACUUM > >o/~ But the cat came back, the very next day ... > >I assume that if I kill this with SIGKILL, that will bring down every >other postgres process, so that should be avoided. But surely there is >a way to interrupt this. If I had some reason to shut down the >instance, I'd be screwed, it seems. From pgsql-performance-owner@postgresql.org Thu Dec 29 22:43:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5EBD49DC9BC for ; Thu, 29 Dec 2005 22:43:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54478-03 for ; Thu, 29 Dec 2005 22:44:01 -0400 (AST) X-Greylist: delayed 03:50:43.184215 by SQLgrey- Received: from queue03-winn.ispmail.ntl.com (queue03-winn.ispmail.ntl.com [81.103.221.57]) by postgresql.org (Postfix) with ESMTP id 3E2009DC9A5 for ; Thu, 29 Dec 2005 22:43:54 -0400 (AST) Received: from aamta12-winn.ispmail.ntl.com ([81.103.221.35]) by mta08-winn.ispmail.ntl.com with ESMTP id <20051229225312.JTQS17804.mta08-winn.ispmail.ntl.com@aamta12-winn.ispmail.ntl.com>; Thu, 29 Dec 2005 22:53:12 +0000 Received: from [192.168.99.15] (really [82.18.123.115]) by aamta12-winn.ispmail.ntl.com with ESMTP id <20051229225312.EUOH774.aamta12-winn.ispmail.ntl.com@[192.168.99.15]>; Thu, 29 Dec 2005 22:53:12 +0000 Message-ID: <43B468D7.2050806@garrett.co.uk> Date: Thu, 29 Dec 2005 22:53:11 +0000 From: Russ Garrett User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Jeffrey W. Baker" CC: pgperf Subject: Re: Invulnerable VACUUM process thrashing everything References: <1135894162.2223.4.camel@toonses.gghcwest.com> <6.2.5.6.0.20051229173718.01dbfff0@earthlink.net> In-Reply-To: <6.2.5.6.0.20051229173718.01dbfff0@earthlink.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, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/654 X-Sequence-Number: 16475 In my experience a kill -9 has never resulted in any data loss in this situation (it will cause postgres to detect that the process died, shut down, then recover), and most of the time it only causes a 5-10sec outage. I'd definitely hesitate to recommend it in a production context though, especially since I think there are some known race-condition bugs in 7.4. VACUUM *will* respond to a SIGTERM, but it doesn't check very often - I've often had to wait hours for it to determine that it's been killed, and my tables aren't anywhere near 1TB. Maybe this is a place where things could be improved... Incidentally, I have to kill -9 some of our MySQL instances quite regularly because they do odd things. Not something you want to be doing, especially when MySQL takes 30mins to recover. Russ Garrett Last.fm Ltd. russ@last.fm Ron wrote: > Ick. Can you get users and foreign connections off that machine, lock > them out for some period, and renice the VACUUM? > > Shedding load and keeping it off while VACUUM runs high priority might > allow it to finish in a reasonable amount of time. > Or > Shedding load and dropping the VACUUM priority might allow a kill > signal to get through. > > Hope this helps, > Ron > > > At 05:09 PM 12/29/2005, Jeffrey W. Baker wrote: > >> A few WEEKS ago, the autovacuum on my instance of pg 7.4 unilaterally >> decided to VACUUM a table which has not been updated in over a year and >> is more than one terabyte on the disk. Because of the very high >> transaction load on this database, this VACUUM has been ruining >> performance for almost a month. Unfortunately is seems invulnerable to >> killing by signals: >> >> # ps ax | grep VACUUM >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM >> # kill -HUP 15308 >> # ps ax | grep VACUUM >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM >> # kill -INT 15308 >> # ps ax | grep VACUUM >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM >> # kill -PIPE 15308 >> # ps ax | grep VACUUM >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM >> >> o/~ But the cat came back, the very next day ... >> >> I assume that if I kill this with SIGKILL, that will bring down every >> other postgres process, so that should be avoided. But surely there is >> a way to interrupt this. If I had some reason to shut down the >> instance, I'd be screwed, it seems. > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Thu Dec 29 22:16:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BC6C89DC9B5 for ; Thu, 29 Dec 2005 22:16:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48716-06 for ; Thu, 29 Dec 2005 22:16:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net [71.128.90.172]) by postgresql.org (Postfix) with ESMTP id 7FFA69DC98C for ; Thu, 29 Dec 2005 22:16:29 -0400 (AST) Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) by gghcwest.com (8.12.10/8.12.9) with ESMTP id jBU2Fxmd015302; Thu, 29 Dec 2005 18:16:00 -0800 Received: from jwb by toonses.gghcwest.com with local (Exim 4.52) id 1Es9oI-0000la-DN; Thu, 29 Dec 2005 18:16:02 -0800 Subject: Re: Invulnerable VACUUM process thrashing everything From: "Jeffrey W. Baker" To: Russ Garrett Cc: pgperf In-Reply-To: <43B468D7.2050806@garrett.co.uk> References: <1135894162.2223.4.camel@toonses.gghcwest.com> <6.2.5.6.0.20051229173718.01dbfff0@earthlink.net> <43B468D7.2050806@garrett.co.uk> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 29 Dec 2005 18:16:02 -0800 Message-Id: <1135908962.2908.3.camel@toonses.gghcwest.com> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.04 required=5 tests=[AWL=0.040] X-Spam-Score: 0.04 X-Spam-Level: X-Archive-Number: 200512/653 X-Sequence-Number: 16474 On Thu, 2005-12-29 at 22:53 +0000, Russ Garrett wrote: > In my experience a kill -9 has never resulted in any data loss in this > situation (it will cause postgres to detect that the process died, shut > down, then recover), and most of the time it only causes a 5-10sec > outage. I'd definitely hesitate to recommend it in a production context > though, especially since I think there are some known race-condition > bugs in 7.4. > > VACUUM *will* respond to a SIGTERM, but it doesn't check very often - > I've often had to wait hours for it to determine that it's been killed, > and my tables aren't anywhere near 1TB. Maybe this is a place where > things could be improved... FWIW, I murdered this process with SIGKILL, and the recovery was very short. > Incidentally, I have to kill -9 some of our MySQL instances quite > regularly because they do odd things. Not something you want to be > doing, especially when MySQL takes 30mins to recover. Agreed. After mysql shutdown with MyISAM, all tables must be checked and usually many need to be repaired. This takes a reallllllly long time. -jwb > Russ Garrett > Last.fm Ltd. > russ@last.fm > > Ron wrote: > > > Ick. Can you get users and foreign connections off that machine, lock > > them out for some period, and renice the VACUUM? > > > > Shedding load and keeping it off while VACUUM runs high priority might > > allow it to finish in a reasonable amount of time. > > Or > > Shedding load and dropping the VACUUM priority might allow a kill > > signal to get through. > > > > Hope this helps, > > Ron > > > > > > At 05:09 PM 12/29/2005, Jeffrey W. Baker wrote: > > > >> A few WEEKS ago, the autovacuum on my instance of pg 7.4 unilaterally > >> decided to VACUUM a table which has not been updated in over a year and > >> is more than one terabyte on the disk. Because of the very high > >> transaction load on this database, this VACUUM has been ruining > >> performance for almost a month. Unfortunately is seems invulnerable to > >> killing by signals: > >> > >> # ps ax | grep VACUUM > >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM > >> # kill -HUP 15308 > >> # ps ax | grep VACUUM > >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM > >> # kill -INT 15308 > >> # ps ax | grep VACUUM > >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM > >> # kill -PIPE 15308 > >> # ps ax | grep VACUUM > >> 15308 ? D 588:00 postgres: postgres skunk [local] VACUUM > >> > >> o/~ But the cat came back, the very next day ... > >> > >> I assume that if I kill this with SIGKILL, that will bring down every > >> other postgres process, so that should be avoided. But surely there is > >> a way to interrupt this. If I had some reason to shut down the > >> instance, I'd be screwed, it seems. > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 2: Don't 'kill -9' the postmaster > > > From pgsql-performance-owner@postgresql.org Thu Dec 29 23:03:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 45C449DC809 for ; Thu, 29 Dec 2005 23:03:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60871-03 for ; Thu, 29 Dec 2005 23:03:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 292F49DC841 for ; Thu, 29 Dec 2005 23:03:01 -0400 (AST) 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 jBU331uZ007578; Thu, 29 Dec 2005 22:03:01 -0500 (EST) To: Russ Garrett cc: "Jeffrey W. Baker" , pgperf Subject: Re: Invulnerable VACUUM process thrashing everything In-reply-to: <43B468D7.2050806@garrett.co.uk> References: <1135894162.2223.4.camel@toonses.gghcwest.com> <6.2.5.6.0.20051229173718.01dbfff0@earthlink.net> <43B468D7.2050806@garrett.co.uk> Comments: In-reply-to Russ Garrett message dated "Thu, 29 Dec 2005 22:53:11 +0000" Date: Thu, 29 Dec 2005 22:03:01 -0500 Message-ID: <7577.1135911781@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.054 required=5 tests=[AWL=0.054] X-Spam-Score: 0.054 X-Spam-Level: X-Archive-Number: 200512/655 X-Sequence-Number: 16476 Russ Garrett writes: > VACUUM *will* respond to a SIGTERM, but it doesn't check very often - > I've often had to wait hours for it to determine that it's been killed, > and my tables aren't anywhere near 1TB. Maybe this is a place where > things could be improved... Hmm, there are CHECK_FOR_INTERRUPTS calls in all the loops that seem significant to me. Is there anything odd about your database schema? Unusual index types or data types maybe? Also, what PG version are you using? If you notice a VACUUM not responding to SIGTERM promptly, it'd be useful to attach to the backend process with gdb and get a stack trace to find out what it's doing. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 30 02:59:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9ADED9DC804 for ; Fri, 30 Dec 2005 02:59:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92493-07 for ; Fri, 30 Dec 2005 02:59:29 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D23B49DC865 for ; Fri, 30 Dec 2005 02:59:27 -0400 (AST) Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) by svr4.postgresql.org (Postfix) with ESMTP id C7F295AF06D for ; Fri, 30 Dec 2005 06:59:28 +0000 (GMT) Received: from AKDXP (adsl-71-134-28-177.dsl.pltn13.pacbell.net [71.134.28.177]) by mail.jobflash.com (Postfix) with ESMTP id AB133420E4 for ; Thu, 29 Dec 2005 22:59:27 -0800 (PST) From: "Arup Dutta" To: Subject: unsubscribe Date: Thu, 29 Dec 2005 23:01:29 -0800 Message-ID: <081e01c60d0e$dbe06fa0$e4ffa8c0@AKDXP> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_081F_01C60CCB.CDBD2FA0" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcYNDtuY0PEDM+zAQASdT6fmv5kiCA== X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/656 X-Sequence-Number: 16477 This is a multi-part message in MIME format. ------=_NextPart_000_081F_01C60CCB.CDBD2FA0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit unsubscribe ------=_NextPart_000_081F_01C60CCB.CDBD2FA0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

unsubscribe

------=_NextPart_000_081F_01C60CCB.CDBD2FA0-- From pgsql-performance-owner@postgresql.org Fri Dec 30 04:38:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8DD469DC847 for ; Fri, 30 Dec 2005 04:38:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12843-03 for ; Fri, 30 Dec 2005 04:38:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.206]) by postgresql.org (Postfix) with ESMTP id BC1E29DC804 for ; Fri, 30 Dec 2005 04:38:08 -0400 (AST) Received: by nproxy.gmail.com with SMTP id p48so666167nfa for ; Fri, 30 Dec 2005 00:38:09 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=lmXQW5JCrSoI7A08w7kyuI+9bIvxXGgB0IN9lBGBstyhsnCGqYZbEGvlRIKMjFB+cxKRlFIiEGY73acF7sEflPl0eXW52PVnRbnf64W4nlsvHbU7LSNuJt7SzYHiUTwhh8bYaJp/x/d2ezH69P2sORlODgRUxyP3e0SnqLwJNeI= Received: by 10.48.215.17 with SMTP id n17mr417876nfg; Fri, 30 Dec 2005 00:38:09 -0800 (PST) Received: by 10.48.164.6 with HTTP; Fri, 30 Dec 2005 00:38:09 -0800 (PST) Message-ID: <45b42ce40512300038k7426786etfe6c3a6d0efffb39@mail.gmail.com> Date: Fri, 30 Dec 2005 08:38:09 +0000 From: Harry Jackson To: pgsql-performance@postgresql.org Subject: Re: CPU and RAM In-Reply-To: <87y82a5xgq.fsf@stark.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline References: <45b42ce40512211720t164ea389wa5bfd0cbae6c80e2@mail.gmail.com> <878xuc8o6h.fsf@stark.xeocode.com> <45b42ce40512240226u6918d965xbab48eaf72babbc2@mail.gmail.com> <87y82a5xgq.fsf@stark.xeocode.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.088 required=5 tests=[AWL=0.088] X-Spam-Score: 0.088 X-Spam-Level: X-Archive-Number: 200512/657 X-Sequence-Number: 16478 T24gMjQgRGVjIDIwMDUgMTA6MjU6MDkgLTA1MDAsIEdyZWcgU3RhcmsgPGdzc3RhcmtAbWl0LmVk dT4gd3JvdGU6Cj4KPiBIYXJyeSBKYWNrc29uIDxoYXJyeWphY2tzb25AZ21haWwuY29tPiB3cml0 ZXM6Cj4KPiA+IEkgYWx3YXlzIGxvb2sgYXQgdGhlIGV4cGxhaW4gcGxhbnMuCj4gPgo+ID4gPSMg ZXhwbGFpbiBzZWxlY3QgaXRlbV9pZCwgdGVybV9mcmVxdWVuY3kgZnJvbSByZXZlcnNlX2luZGV4 IHdoZXJlCj4gPiB0ZXJtX2lkID0gMjI3ODE7Cj4gPiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBRVUVSWSBQTEFOCj4gPiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLQo+ID4gIEJpdG1hcCBIZWFwIFNjYW4gb24gcmV2ZXJzZV9pbmRleCAgKGNv c3Q9ODg0LjU3Li44NDQ0My4zNSByb3dzPTE1MDQ0OCB3aWR0aD04KQo+ID4gICAgUmVjaGVjayBD b25kOiAodGVybV9pZCA9IDIyNzgxKQo+ID4gICAgLT4gIEJpdG1hcCBJbmRleCBTY2FuIG9uIHJl dmVyc2VfaW5kZXhfdGVybV9pZF9pZHgKPiA+IChjb3N0PTAuMDAuLjg4NC41NyByb3dzPTE1MDQ0 OCB3aWR0aD0wKQo+ID4gICAgICAgICAgSW5kZXggQ29uZDogKHRlcm1faWQgPSAyMjc4MSkKPiA+ ICg0IHJvd3MpCj4KPiBDYW4geW91IHNlbmQgRVhQTEFJTiBBTkFMWVpFIGZvciB0aGlzIHF1ZXJ5 IGZvciBhIHByb2JsZW1hdGljIHRlcm1faWQ/IEFyZSB5b3UKPiByZWFsbHkgcmV0cmlldmluZyAx NTBrIHJlY29yZHMgbGlrZSBpdCBleHBlY3RzPyBJbiBhbiBPTFRQIGVudmlyb25tZW50IHRoYXQn cwo+IGFuIGF3ZnVsIGxvdCBvZiByZWNvcmRzIHRvIGJlIHJldHJpZXZpbmcgYW5kIG1pZ2h0IGV4 cGxhaW4geW91ciBoaWdoIENQVSB1c2FnZQo+IGFsbCBvbiBpdHMgb3duLgoKVGhlIGFib3ZlIGlz IHdpdGggdGhlIHByb2JsZW1hdGljIHRlcm1faWQgOykKClRoZSBhYm92ZSBjb21lcyBpbiBhdCBh cm91bmQgMS80IG9mIGEgc2Vjb25kIHdoaWNoIGlzIGZpbmUgZm9yIG5vdyBidXQKd2lsbCBjYXVz ZSBtZSBzZXZlcmUgcHJvYmxlbXMgaW4gYSBmZXcgbW9udGhzIHdoZW4gdGhlIHNpemUgb2YgdGVo CmRhdGFiYXNlIHN3ZWxscy4KCj4gMjUwbXMgbWlnaHQgYmUgYXMgZ29vZCBhcyB5b3UnbGwgZ2V0 IGZvciAxNTBrIHJlY29yZHMuIEknbSBub3Qgc3VyZSBwcmVjYWNoaW5nCj4gdGhhdCBtYW55IHJl Y29yZHMgd2lsbCBoZWxwIHlvdS4gWW91J3JlIHN0aWxsIGdvaW5nIHRvIGhhdmUgdG8gcmVhZCB0 aGVtIGZyb20KPiBzb21ld2hlcmUuCgpUaGlzIGlzIHdoYXQgSSBhbSB0aGlua2luZy4gSSBoYXZl IHRyaWVkIHZhcmlvdXMgbWV0aG9kcyB0byByZWR1Y2UgdGhlCnRpbWUuIEkgZXZlbiB0cmllZCB0 byB1c2UgIm9yZGVyIGJ5IiB0aGVuIHJlZHVjZSB0aGUgYW1vdW50IG9mIGRhdGEgdG8KNTBLIHJl Y29yZHMgdG8gc2VlIGlmIHRoaXMgd291bGQgd29yayBidXQgaXQgY2FtZSBpbiBhdCBhcm91bmQg dGhlCnNhbWUgYW1vdW50IG9mIHRpbWUuIEl0IGlzIGZhc3RlciBpZiBJIHVzZSB0aGUgZm9sbG93 aW5nIHRob3VnaCBidXQKbm90IGJ5IG11Y2guCgo9IyBleHBsYWluIHNlbGVjdCAqIGZyb20gcmV2 ZXJzZV9pbmRleCB3aGVyZSB0ZXJtX2lkID0gMjI3ODEgb3JkZXIgYnkKdGVybV9mcmVxdWVuY3kg REVTQyBsaW1pdCAzMDAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBRVUVSWSBQTEFOCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiBMaW1pdCAgKGNvc3Q9NjczMzcuODcuLjY3NDEy Ljg3IHJvd3M9MzAwMDAgd2lkdGg9MTIpCiAgIC0+ICBTb3J0ICAoY29zdD02NzMzNy44Ny4uNjc1 NjUuMjYgcm93cz05MDk1NiB3aWR0aD0xMikKICAgICAgICAgU29ydCBLZXk6IHRlcm1fZnJlcXVl bmN5CiAgICAgICAgIC0+ICBJbmRleCBTY2FuIHVzaW5nIHJldmVyc2VfaW5kZXhfdGVybV9pZF9p ZHggb24KcmV2ZXJzZV9pbmRleCAgKGNvc3Q9MC4wMC4uNTk4NDYuMzMgcm93cz05MDk1NiB3aWR0 aD0xMikKICAgICAgICAgICAgICAgSW5kZXggQ29uZDogKHRlcm1faWQgPSAyMjc4MSkKKDUgcm93 cykKCkkgd2FzIGFjdHVhbGx5IHN1cHJpc2VkIGJ5IHRoaXMgYW5kIGl0IHNob3dzIHRoYXQgd2hh dGV2ZXIgcm91dGluZXMKUG9zdGdyZXNxbCBpcyB1c2luZyB0byBzb3J0IHRoZSBkYXRhIGl0cyBw cmV0dHkgYmxvb2R5IGZhc3QuIFRoZSB0b3RhbApzb3J0IHRpbWUgZm9yIDExMEsgcmVjb3JkcyBp cyBhYm91dCAxOTNtcy4gVGhlIGl0cyByZXRyaWV2YWwgYWZ0ZXIKdGhhdC4gV2hhdCBhbHNvIHN1 cHJpc2VkIG1lIGlzIHRoYXQgd2l0aG91dCB0aGUgc29ydAoKc2VsZWN0ICogZnJvbSByZXZlcnNl X2luZGV4IHdoZXJlIHRlcm1faWQgPSAyMjc4MTsKCmlzIHNsb3dlciB0aGFuCgpzZWxlY3QgaXRl bV9pZCwgdGVybV9mcmVxdWVuY3kgZnJvbSByZXZlcnNlX2luZGV4IHdoZXJlIHRlcm1faWQgPSAy Mjc4MTsKCmJ1dCB3aXRoIHRoZSBzb3J0IGFuZCBsaW1pdCBhZGRlZAoKc2VsZWN0ICogZnJvbSBy ZXZlcnNlX2luZGV4IHdoZXJlIHRlcm1faWQgPSAyMjc4MSBvcmRlciBieQp0ZXJtX2ZyZXF1ZW5j eSBERVNDIGxpbWl0IDMwMDAwOwoKaXMgZmFzdGVyIHRoYW4KCnNlbGVjdCBpdGVtX2lkLCB0ZXJt X2ZyZXF1ZW5jeSBmcm9tIHJldmVyc2VfaW5kZXggd2hlcmUgdGVybV9pZCA9CjIyNzgxIG9yZGVy IGJ5IHRlcm1fZnJlcXVlbmN5IERFU0MgbGltaXQgMzAwMDA7Cgo+IEkgZ3Vlc3MgY2x1c3Rlcmlu ZyBvbiB0ZXJtX2lkIG1pZ2h0IHNwZWVkIHRoaXMgdXAgYnkgcHV0dGluZyBhbGwgdGhlIHJlY29y ZHMKPiBiZWluZyByZXRyaWV2ZWQgdG9nZXRoZXIuIEl0IG1pZ2h0IGFsc28gbGV0IHRoZSBwbGFu bmVyIHVzZSBhIHBsYWluIGluZGV4IHNjYW4KPiBpbnN0ZWFkIG9mIGEgYml0bWFwIHNjYW4gYW5k IGdldCB0aGUgc2FtZSBiZW5lZml0LgoKWWVwLiBJIGNsdXN0ZXJlZCBvbiB0aGUgdGVybV9pZCBp bmRleCBhZ2FpbiBiZWZvcmUgcnVubmluZyB0aGUgYWJvdmUKZXhwbGFpbiBhbmQgdGhpcyB0aW1l IHdlIGhhdmUgYSBwbGFpbiBpbmRleCBzY2FuLgoKPiA+IFRoZSBuZXh0IHF1ZXJ5IGFic29sdXRl bHkgZmxpZXMgYnV0IGl0IHdvdWxkIGhhdmUgYmVlbiB0aGUgb25lIEkgd291bGQKPiA+IGhhdmUg ZXhwZWN0ZWQgdG8gYmUgYSBsb3Qgc2xvd2VyLgo+ID4gLi4uCj4gPiBUaGlzIGNvbWVzIGluIHVu ZGVyIDEwLjZtcyB3aGljaCBpcyBhc3RvdW5kaW5nIGFuZCBJIGFtIG1vcmUgdGhhbgo+ID4gaGFw cHkgd2l0aCB0aGUgcGVyZm9ybWFuY2UgdG8gYmUgaGFkIGZyb20gaXQuCj4KPiBPdXQgb2YgY3Vy aW9zaXR5IGl0IHdvdWxkIGJlIGludGVyZXN0aW5nIHRvIHNlZSB0aGUgRVhQTEFJTiBBTkFMWVpF IGZyb20gdGhpcwo+IHRvby4KCgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBRVUVSWSBQTEFOCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIEJpdG1hcCBIZWFwIFNjYW4gb24gaXRlbSBpICAoY29z dD04LjAxLi4xNi4xOCByb3dzPTQgd2lkdGg9NDc4KQogICBSZWNoZWNrIENvbmQ6ICgoaXRlbV9p ZCA9IDIwMDA2MjkzKSBPUiAoaXRlbV9pZCA9IDIwMDk3MDY1KSBPUgooaXRlbV9pZCA9IDIwMTAx MDE0KSBPUiAoaXRlbV9pZCA9IDIwMTAxMDE1KSkKICAgLT4gIEJpdG1hcE9yICAoY29zdD04LjAx Li44LjAxIHJvd3M9NCB3aWR0aD0wKQogICAgICAgICAtPiAgQml0bWFwIEluZGV4IFNjYW4gb24g aXRlbV9pdGVtX2lkX3BrICAoY29zdD0wLjAwLi4yLjAwCnJvd3M9MSB3aWR0aD0wKQogICAgICAg ICAgICAgICBJbmRleCBDb25kOiAoaXRlbV9pZCA9IDIwMDA2MjkzKQogICAgICAgICAtPiAgQml0 bWFwIEluZGV4IFNjYW4gb24gaXRlbV9pdGVtX2lkX3BrICAoY29zdD0wLjAwLi4yLjAwCnJvd3M9 MSB3aWR0aD0wKQogICAgICAgICAgICAgICBJbmRleCBDb25kOiAoaXRlbV9pZCA9IDIwMDk3MDY1 KQoKPHNuaXAgbG90cyBvZiBzaW5nbGUgaXRlbV9pZCBiaXRtYXAgaW5kZXggc2NhbnM+CgogICAg ICAgICAtPiAgQml0bWFwIEluZGV4IFNjYW4gb24gaXRlbV9pdGVtX2lkX3BrICAoY29zdD0wLjAw Li4yLjAwCnJvd3M9MSB3aWR0aD0wKQogICAgICAgICAgICAgICBJbmRleCBDb25kOiAoaXRlbV9p ZCA9IDIwMTAxMDE0KQogICAgICAgICAtPiAgQml0bWFwIEluZGV4IFNjYW4gb24gaXRlbV9pdGVt X2lkX3BrICAoY29zdD0wLjAwLi4yLjAwCnJvd3M9MSB3aWR0aD0wKQogICAgICAgICAgICAgICBJ bmRleCBDb25kOiAoaXRlbV9pZCA9IDIwMTAxMDE1KQoKCkFub3RoZXIgaW50ZXJldGluZyB0aGlu ZyBJIG5vdGljZWQgd2FzIHRoZSBzaXplIG9mIHRoZSB0YWJsZXMgYW5kCmluZGV4ZXMgYWZ0ZXIg dGhlIGNsdXN0ZXIgb3BlcmF0aW9uCgpCRUZPUkU6CiAgICAgICAgICByZWxuYW1lICAgICAgICAg IHwgICBieXRlcyAgIHwga2J5dGVzIHwgcmVsa2luZCB8IG1iCi0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLSstLS0tLS0tLS0tLSstLS0tLS0tLSstLS0tLS0tLS0rLS0tLS0KIHJldmVyc2VfaW5k ZXggICAgICAgICAgICAgfCA4ODQyOTM2MzIgfCA4NjM1NjggfCByICAgICAgIHwgODQzCiByZXZl cnNlX2luZGV4X3BrICAgICAgICAgIHwgNTQ4MTI2NzIwIHwgNTM1MjgwIHwgaSAgICAgICB8IDUy MgogcmV2ZXJzZV9pbmRleF90ZXJtX2lkX2lkeCB8IDQxNTI2MDY3MiB8IDQwNTUyOCB8IGkgICAg ICAgfCAzOTYKCkFGVEVSOgogcmV2ZXJzZV9pbmRleCAgICAgICAgICAgICB8IDYzNTk0NDk2MCB8 IDYyMTA0MCB8IHIgICAgICAgfCA2MDYKIHJldmVyc2VfaW5kZXhfcGsgICAgICAgICAgfCAzMjI2 MDA5NjAgfCAzMTUwNDAgfCBpICAgICAgIHwgMzA3CiByZXZlcnNlX2luZGV4X3Rlcm1faWRfaWR4 IHwgMjU3NjIyMDE2IHwgMjUxNTg0IHwgaSAgICAgICB8IDI0NQoKVGhpcyBkYXRhYmFzZSBoYXMg YXV0b3ZhY3V1bSBydW5uaW5nIGJ1dCBpdCBsb29rcyBsaWtlIHRoZXJlIGlzIGEgbG90Cm9mIHNw YWNlIGluIHBhZ2VzIG9uIGRpc2sgdGhhdCBpcyBub3QgYmVpbmcgdXNlZC4gSXMgdGhpcyBhIHRy YWRlIG9mZgp3aGVuIHVzaW5nIE1WQ0M/CgotLQpIYXJyeQpodHRwOi8vd3d3LnVrbHVnLmNvLnVr Cmh0dHA6Ly93d3cuaGphY2tzb24ub3JnCg==