From pgsql-performance-owner@postgresql.org Wed Mar 1 03:54:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D0C319DC88B for ; Wed, 1 Mar 2006 03: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 24781-06 for ; Wed, 1 Mar 2006 03:54:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [151.155.5.143]) by postgresql.org (Postfix) with ESMTP id D2B669DC831 for ; Wed, 1 Mar 2006 03:54:43 -0400 (AST) Received: from [172.16.1.180] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.6 $ on Linux; Tue, 28 Feb 2006 20:44:31 -0700 In-Reply-To: <1140790410.923941.261250@p10g2000cwp.googlegroups.com> References: <1140790410.923941.261250@p10g2000cwp.googlegroups.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: Michael Glaesemann Subject: Re: nested query on last n rows of huge table Date: Wed, 1 Mar 2006 12:44:25 +0900 To: "jcfischer" X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.099 required=5 tests=[AWL=-0.233, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.099 X-Spam-Level: * X-Archive-Number: 200603/2 X-Sequence-Number: 17439 On Feb 24, 2006, at 23:13 , jcfischer wrote: > Is there a way to limit the expensive query to only those last 1000 > (or > whatever) results? > > I have tried to nest SELECTS but my SQL-fu is to limited to get > anything through the SQL processor :-) The basics of a subquery are: SELECT FROM ( SELECT * FROM table ORDER eventtime DESC LIMIT 1000 ) as most_recent_1000 Don't know enough about the other parts, but hopefully this can get you started. :) Michael Glaesemann grzm myrealbox com From pgsql-performance-owner@postgresql.org Wed Mar 1 02:45:56 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A26229DCA22 for ; Wed, 1 Mar 2006 02:45: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 13557-04 for ; Wed, 1 Mar 2006 02:45:55 -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 504389DC9C9 for ; Wed, 1 Mar 2006 02:45:53 -0400 (AST) Received: (qmail 5234 invoked by uid 500); 1 Mar 2006 06:55:56 -0000 Date: Wed, 1 Mar 2006 00:55:56 -0600 From: Bruno Wolff III To: Nik Cc: pgsql-performance@postgresql.org Subject: Re: Large Table With Only a Few Rows Message-ID: <20060301065556.GA1137@wolff.to> Mail-Followup-To: Bruno Wolff III , Nik , pgsql-performance@postgresql.org References: <1141051682.534005.194130@v46g2000cwv.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1141051682.534005.194130@v46g2000cwv.googlegroups.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.099 required=5 tests=[AWL=0.099] X-Spam-Score: 0.099 X-Spam-Level: X-Archive-Number: 200603/1 X-Sequence-Number: 17438 On Mon, Feb 27, 2006 at 06:48:02 -0800, Nik wrote: > I have a table that has only a few records in it at the time, and they > get deleted every few seconds and new records are inserted. Table never > has more than 5-10 records in it. > > However, I noticed a deteriorating performance in deletes and inserts > on it. So I performed vacuum analyze on it three times (twice in a row, > and once two days later). In the statistics it says that the table size > is 863Mb, toast table size is 246Mb, and indexes size is 134Mb, even > though the table has only 5-10 rows in it it. I was wondering how can I > reclaim all this space and improve the performance? You can use VACUUM FULL to recover the space. You should be running normal VACUUMs on that table every minute or two, not once a day. From pgsql-performance-owner@postgresql.org Wed Mar 1 07:58:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A45F29DC867 for ; Wed, 1 Mar 2006 07:58: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 63491-09 for ; Wed, 1 Mar 2006 07:58:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (unknown [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id D03869DCB51 for ; Wed, 1 Mar 2006 07:58:16 -0400 (AST) Received: (qmail 32384 invoked from network); 1 Mar 2006 12:58:22 +0100 Received: from unknown (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 1 Mar 2006 12:58:22 +0100 To: pgsql-performance@postgresql.org Subject: Re: wal sync method References: <200602280114.k1S1EAQ17159@candle.pha.pa.us> <3867.1141170306@sss.pgh.pa.us> Message-ID: Date: Wed, 01 Mar 2006 12:58:21 +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: <3867.1141170306@sss.pgh.pa.us> User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/3 X-Sequence-Number: 17440 Hm, i seem to have mixed fwrite() (which buffers data in userspace) and write() (which apparently doesnt !) Sorry ! > PFC writes: >> Just a stupid question about the various fsync settings. >> There is fsync=off, but is there fsync=fflush ? >> fflush would mean only an OS crash could cause data loss, >> I think.it could be useful for some applications where you need a speed >> boost (like testing database import scripts...) without being as scary >> as >> fsync=off... > > I think you misunderstand. There aren't any scenarios where a PG crash > (without hardware/OS crash) risks data, because we always at least > write() data before commit. The only issue is how hard do we try to get > the OS+hardware to push that data down to disk. > > regards, tom lane From pgsql-performance-owner@postgresql.org Wed Mar 1 10:56:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 55A119DCD10 for ; Wed, 1 Mar 2006 10:56: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 97067-09 for ; Wed, 1 Mar 2006 10:56:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (unknown [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id DC5C89DCD1C for ; Wed, 1 Mar 2006 10:56:17 -0400 (AST) Received: (qmail 481 invoked from network); 1 Mar 2006 15:56:26 +0100 Received: from unknown (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 1 Mar 2006 15:56:26 +0100 Date: Wed, 01 Mar 2006 15:56:25 +0100 To: pgsql-performance@postgresql.org Subject: Bad plan on a view From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.106 required=5 tests=[AWL=0.106] X-Spam-Score: 0.106 X-Spam-Level: X-Archive-Number: 200603/4 X-Sequence-Number: 17441 I have a table with a few small numeric fields and several text fields, on pg. 8.1.2. The numeric fields are used for searching (category_id, price, etc). The text fields are just a description of the item, comments, email address, telephone, etc. So, in order to speed up requests which need a full table scan, I wanted to put the text fields in another table, and use a view to make it look like nothing happened. Also, the small table used for searching is a lot more likely to fit in RAM than the big table with all the text which is only used for display. However the query plan for the view is sometimes very bad (see below) Here is a simplification of my schema with only 2 columns : CREATE TABLE items ( id SERIAL PRIMARY KEY, price FLOAT NULL, category INTEGER NOT NULL, description TEXT ); CREATE TABLE items_data ( id SERIAL PRIMARY KEY, price FLOAT NULL, category INTEGER NOT NULL ); CREATE TABLE items_desc ( id INTEGER NOT NULL REFERENCES items_data(id) ON DELETE CASCADE, PRIMARY KEY (id ), description TEXT ); INSERT INTO items about 100K rows INSERT INTO items_data (id,price,category) SELECT id,price,category FROM items; INSERT INTO items_desc (id,description) SELECT id,description FROM items; alter table items_data ALTER price set statistics 100; alter table items_data ALTER category set statistics 100; VACUUM ANALYZE; CREATE VIEW items_view1 AS SELECT a.id, a.price, a.category, b.description FROM items_data a, items_desc b WHERE a.id=b.id; CREATE VIEW items_view2 AS SELECT a.id, a.price, a.category, b.description FROM items_data a LEFT JOIN items_desc b ON a.id=b.id; Now, an example query : ** From the plain table EXPLAIN ANALYZE SELECT * FROM items WHERE price IS NOT NULL AND category=1 ORDER BY price DESC LIMIT 10; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- Limit (cost=10308.21..10308.23 rows=10 width=229) (actual time=391.373..391.379 rows=10 loops=1) -> Sort (cost=10308.21..10409.37 rows=40466 width=229) (actual time=391.371..391.375 rows=10 loops=1) Sort Key: price -> Seq Scan on items (cost=0.00..4549.57 rows=40466 width=229) (actual time=0.652..91.125 rows=42845 loops=1) Filter: ((price IS NOT NULL) AND (category = 1)) Total runtime: 399.511 ms ** From the data only table (no descriptions) EXPLAIN ANALYZE SELECT * FROM items_data WHERE price IS NOT NULL AND category=1 ORDER BY price DESC LIMIT 10; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- Limit (cost=5250.92..5250.95 rows=10 width=16) (actual time=275.765..275.769 rows=10 loops=1) -> Sort (cost=5250.92..5357.83 rows=42763 width=16) (actual time=275.763..275.766 rows=10 loops=1) Sort Key: price -> Seq Scan on items_data (cost=0.00..1961.58 rows=42763 width=16) (actual time=0.411..57.610 rows=42845 loops=1) Filter: ((price IS NOT NULL) AND (category = 1)) Total runtime: 278.023 ms It is faster to access the smaller table. Note that I only added the description column in this example. With all the other columns like telephone, email, etc of my production table, which are used for display only and not for searching, it takes about 1.2 seconds, simply because the table is a lot larger (yes, it fits in RAM... for now). Now, let's check out the 2 views : the plans are exactly the same EXPLAIN ANALYZE SELECT * FROM items_view2 WHERE price IS NOT NULL AND category=1 ORDER BY price DESC LIMIT 10; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=13827.38..13827.41 rows=10 width=222) (actual time=584.704..584.712 rows=10 loops=1) -> Sort (cost=13827.38..13934.29 rows=42763 width=222) (actual time=584.703..584.709 rows=10 loops=1) Sort Key: a.price -> Merge Left Join (cost=0.00..7808.02 rows=42763 width=222) (actual time=1.708..285.663 rows=42845 loops=1) Merge Cond: ("outer".id = "inner".id) -> Index Scan using items_data_pkey on items_data a (cost=0.00..2439.74 rows=42763 width=16) (actual time=0.692..86.330 rows=42845 loops=1) Filter: ((price IS NOT NULL) AND (category = 1)) -> Index Scan using items_desc_pkey on items_desc b (cost=0.00..4585.83 rows=99166 width=210) (actual time=0.038..104.957 rows=99165 loops=1) Total runtime: 593.068 ms Wow. This is a lot slower because it does the big join BEFORE applying the sort. Here is the plain query generated by the view : SELECT a.id, a.price, a.category, b.description FROM items_data a LEFT JOIN items_desc b ON a.id=b.id WHERE price IS NOT NULL AND category=1 ORDER BY price DESC LIMIT 10; I would have expected the planner to rewrite it like this : EXPLAIN ANALYZE SELECT foo.*, b.description FROM (SELECT * FROM items_data a WHERE price IS NOT NULL AND category=1 ORDER BY price DESC LIMIT 10) AS foo LEFT JOIN items_desc b ON foo.id=b.id ORDER BY price DESC LIMIT 10; This query should be equivalent to the view with LEFT JOIN. I am aware it is not equivalent to the view with a simple join. QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=5250.92..5281.31 rows=10 width=222) (actual time=273.300..273.363 rows=10 loops=1) -> Nested Loop Left Join (cost=5250.92..5281.31 rows=10 width=222) (actual time=273.299..273.361 rows=10 loops=1) -> Limit (cost=5250.92..5250.95 rows=10 width=16) (actual time=273.267..273.269 rows=10 loops=1) -> Sort (cost=5250.92..5357.83 rows=42763 width=16) (actual time=273.266..273.267 rows=10 loops=1) Sort Key: a.price -> Seq Scan on items_data a (cost=0.00..1961.58 rows=42763 width=16) (actual time=0.423..67.149 rows=42845 loops=1) Filter: ((price IS NOT NULL) AND (category = 1)) -> Index Scan using items_desc_pkey on items_desc b (cost=0.00..3.01 rows=1 width=210) (actual time=0.006..0.007 rows=1 loops=10) Index Cond: ("outer".id = b.id) Total runtime: 275.608 ms The second form is faster, but more importantly, it does nearly its IO in the small table, and only fetches the needed 10 rows from the large table. Thus if the large table is not in disk cache, this is not so bad, which is the whole point of using a view to split this. With indexes, fast plans are picked, but they all perform the join before doing the sort+limit. Only if there is an index on the "ORDER BY" column, it is used. And bitmap index scan also comes in to save the day (I love bitmap index scan). However, I will have a lot of searchable columns, and ORDER BY options. Ideally I would like to create a few indexes for the common searches and order-by's. I would prefer not to create about 15 indexes on this table, because this will slow down updates. Besides, some of the ORDER BY's are expressions. A seq scan or an index scan of the small table, followed by a sort and limit, then joining to the other table, wouls be more logical. Suppose I create an index on price and on category : EXPLAIN ANALYZE SELECT * FROM items_view2 WHERE price IS NOT NULL AND category IN (4,32) ORDER BY price LIMIT 10; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.00..31.54 rows=10 width=224) (actual time=0.737..0.964 rows=10 loops=1) -> Nested Loop Left Join (cost=0.00..112594.96 rows=35700 width=224) (actual time=0.735..0.958 rows=10 loops=1) -> Index Scan using item_data_price on items_data a (cost=0.00..4566.76 rows=35700 width=16) (actual time=0.696..0.753 rows=10 loops=1) Filter: ((price IS NOT NULL) AND ((category = 4) OR (category = 32))) -> Index Scan using items_desc_pkey on items_desc b (cost=0.00..3.01 rows=1 width=212) (actual time=0.018..0.018 rows=1 loops=10) Index Cond: ("outer".id = b.id) Total runtime: 0.817 ms Now, with a subtly different order by : EXPLAIN ANALYZE SELECT * FROM items_view2 WHERE price IS NOT NULL AND category IN (4,32) ORDER BY price,category LIMIT 10; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=12931.79..12931.82 rows=10 width=224) (actual time=1121.426..1121.433 rows=10 loops=1) -> Sort (cost=12931.79..13021.04 rows=35700 width=224) (actual time=1121.424..1121.428 rows=10 loops=1) Sort Key: a.price, a.category -> Merge Left Join (cost=0.00..7967.65 rows=35700 width=224) (actual time=0.060..530.815 rows=36705 loops=1) Merge Cond: ("outer".id = "inner".id) -> Index Scan using items_data_pkey on items_data a (cost=0.00..2687.66 rows=35700 width=16) (actual time=0.051..116.995 rows=36705 loops=1) Filter: ((price IS NOT NULL) AND ((category = 4) OR (category = 32))) -> Index Scan using items_desc_pkey on items_desc b (cost=0.00..4585.83 rows=99166 width=212) (actual time=0.003..205.652 rows=95842 loops=1) Total runtime: 1128.972 ms ORDER BY price,category disables the use of index for sort, and thus a large join is performed. With the rewritten query : EXPLAIN ANALYZE SELECT foo.*, b.description FROM (SELECT * FROM items_data a WHERE price IS NOT NULL AND category IN (4,32) ORDER BY price,category DESC LIMIT 10) AS foo LEFT JOIN items_desc b ON foo.id=b.id ORDER BY price,category DESC LIMIT 10; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=4229.26..4259.64 rows=10 width=224) (actual time=222.353..222.410 rows=10 loops=1) -> Nested Loop Left Join (cost=4229.26..4259.64 rows=10 width=224) (actual time=222.352..222.405 rows=10 loops=1) -> Limit (cost=4229.26..4229.28 rows=10 width=16) (actual time=222.318..222.324 rows=10 loops=1) -> Sort (cost=4229.26..4318.51 rows=35700 width=16) (actual time=222.317..222.322 rows=10 loops=1) Sort Key: a.price, a.category -> Bitmap Heap Scan on items_data a (cost=239.56..1529.69 rows=35700 width=16) (actual time=6.926..34.018 rows=36705 loops=1) Recheck Cond: ((category = 4) OR (category = 32)) Filter: (price IS NOT NULL) -> BitmapOr (cost=239.56..239.56 rows=37875 width=0) (actual time=6.778..6.778 rows=0 loops=1) -> Bitmap Index Scan on item_data_cat (cost=0.00..229.61 rows=36460 width=0) (actual time=6.295..6.295 rows=36400 loops=1) Index Cond: (category = 4) -> Bitmap Index Scan on item_data_cat (cost=0.00..9.95 rows=1415 width=0) (actual time=0.482..0.482 rows=1340 loops=1) Index Cond: (category = 32) -> Index Scan using items_desc_pkey on items_desc b (cost=0.00..3.01 rows=1 width=212) (actual time=0.006..0.006 rows=1 loops=10) Index Cond: ("outer".id = b.id) Total runtime: 224.476 ms It is not very fast (the sort takes most of the time), but still is a lot faster ! Now, what should I do ?... From pgsql-performance-owner@postgresql.org Wed Mar 1 11:16:08 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0004E9DCC7F for ; Wed, 1 Mar 2006 11:16: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 05098-07 for ; Wed, 1 Mar 2006 11:16: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 C37AB9DCC2E for ; Wed, 1 Mar 2006 11:16: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 k21FG8V2010653; Wed, 1 Mar 2006 10:16:08 -0500 (EST) To: PFC cc: pgsql-performance@postgresql.org Subject: Re: Bad plan on a view In-reply-to: References: Comments: In-reply-to PFC message dated "Wed, 01 Mar 2006 15:56:25 +0100" Date: Wed, 01 Mar 2006 10:16:08 -0500 Message-ID: <10652.1141226168@sss.pgh.pa.us> From: Tom Lane 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: 200603/5 X-Sequence-Number: 17442 PFC writes: > So, in order to speed up requests which need a full table scan, I wanted > to put the text fields in another table, and use a view to make it look > like nothing happened. Also, the small table used for searching is a lot > more likely to fit in RAM than the big table with all the text which is > only used for display. Aren't you going to a lot of work to reinvent something that TOAST already does for you? (At least, in the cases where the text fields are wide enough that it really matters.) regards, tom lane From pgsql-hackers-owner@postgresql.org Wed Mar 1 12:31:55 2006 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 93E759DC80A; Wed, 1 Mar 2006 12:31: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 24315-05; Wed, 1 Mar 2006 12:31:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 033799DC828; Wed, 1 Mar 2006 12:31:51 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 01 Mar 2006 10:31:44 -0600 Message-Id: <44056AE5.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 01 Mar 2006 09:35:33 -0600 From: "Kevin Grittner" To: "Jim Nasby" Cc: ,, "Tom Lane" Subject: Re: [PERFORM] temporary indexes References: <44041B68.EE98.0025.0@wicourts.gov> <16076.1141146348@sss.pgh.pa.us> <440435BC.EE98.0025.0@wicourts.gov> <20060228210232.GW82012@pervasive.com> In-Reply-To: <20060228210232.GW82012@pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.085 required=5 tests=[AWL=0.085] X-Spam-Score: 0.085 X-Spam-Level: X-Archive-Number: 200603/15 X-Sequence-Number: 80413 >>> On Tue, Feb 28, 2006 at 3:02 pm, in message <20060228210232.GW82012@pervasive.com>, "Jim C. Nasby" wrote: > > Maybe it's just the way my twisted mind thinks, but I generally prefer > using a JOIN when possible... Definitely. But sometimes you don't want one row from a table for each qualifying row in another table, you want one row from the table if one or more qualifying rows exist in the other table. Those are the cases in question here. Don't suggest that I just let the duplicates happen and use DISTINCT, that is much more prone to logic errors in complex queries, and typically optimizes worse. -Kevin From pgsql-performance-owner@postgresql.org Wed Mar 1 11:43:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5B75C9DC97D for ; Wed, 1 Mar 2006 11:43: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 13851-04 for ; Wed, 1 Mar 2006 11:43:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (unknown [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id CC3869DC821 for ; Wed, 1 Mar 2006 11:43:45 -0400 (AST) Received: (qmail 651 invoked from network); 1 Mar 2006 16:43:54 +0100 Received: from unknown (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 1 Mar 2006 16:43:54 +0100 To: "Tom Lane" Cc: pgsql-performance@postgresql.org Subject: Re: Bad plan on a view References: <10652.1141226168@sss.pgh.pa.us> Message-ID: Date: Wed, 01 Mar 2006 16:43:53 +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: <10652.1141226168@sss.pgh.pa.us> User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/6 X-Sequence-Number: 17443 > Aren't you going to a lot of work to reinvent something that TOAST > already does for you? (At least, in the cases where the text fields > are wide enough that it really matters.) I know. But I have several text fields in the 20 to 200 characters, which is too small for toast, but large enough to make up about 90% of the table size, which makes it problematic RAM-wise, especially since it's gonna grow. Now, if I had 1 big text field, it would be TOASTed and I would be happy ;) From pgsql-performance-owner@postgresql.org Wed Mar 1 12:05:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 137B99DCD13 for ; Wed, 1 Mar 2006 12: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 16782-08 for ; Wed, 1 Mar 2006 12:04:57 -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 C3E049DCD06 for ; Wed, 1 Mar 2006 12:04:56 -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 1FETol-0004ht-00; Wed, 01 Mar 2006 11:04:47 -0500 To: Tom Lane Cc: PFC , pgsql-performance@postgresql.org Subject: Re: Bad plan on a view References: <10652.1141226168@sss.pgh.pa.us> In-Reply-To: <10652.1141226168@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 01 Mar 2006 11:04:47 -0500 Message-ID: <87r75mup5s.fsf@stark.xeocode.com> Lines: 38 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.13 required=5 tests=[AWL=0.130] X-Spam-Score: 0.13 X-Spam-Level: X-Archive-Number: 200603/7 X-Sequence-Number: 17444 Tom Lane writes: > PFC writes: > > So, in order to speed up requests which need a full table scan, I wanted > > to put the text fields in another table, and use a view to make it look > > like nothing happened. Also, the small table used for searching is a lot > > more likely to fit in RAM than the big table with all the text which is > > only used for display. > > Aren't you going to a lot of work to reinvent something that TOAST > already does for you? (At least, in the cases where the text fields > are wide enough that it really matters.) I think this is a fairly common data modelling trick actually. And it's not a terribly large amount of work either. While TOAST has a similar goal I don't think it has enough AI to completely replace this manual process. It suffers in a number of use cases: 1) When you have a large number of moderate sized text fields instead of a single very large text field. This is probably the case here. 2) When you know exactly which fields you'll be searching on and which you won't be. Often many speed-sensitive queries don't need to access the extended information at all. Instead of making the decision on a per-record basis you can *always* move the data to the other table saving even more space even in cases where you're gaining very little per record. In total across the entire scan you still gain a lot being able to scan just the dense integer fields. Also, is the optimizer capable of coming up with merge join type plans for TOAST tables when necessary? -- greg From pgsql-performance-owner@postgresql.org Wed Mar 1 12:49:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 56D909DC80A for ; Wed, 1 Mar 2006 12:49: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 30550-06 for ; Wed, 1 Mar 2006 12:49:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (unknown [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id DE1EF9DC828 for ; Wed, 1 Mar 2006 12:49:27 -0400 (AST) Received: (qmail 1015 invoked from network); 1 Mar 2006 17:49:31 +0100 Received: from unknown (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 1 Mar 2006 17:49:31 +0100 To: "Greg Stark" , "Tom Lane" Cc: pgsql-performance@postgresql.org Subject: Re: Bad plan on a view References: <10652.1141226168@sss.pgh.pa.us> <87r75mup5s.fsf@stark.xeocode.com> Message-ID: Date: Wed, 01 Mar 2006 17:49:30 +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: <87r75mup5s.fsf@stark.xeocode.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/9 X-Sequence-Number: 17446 > While TOAST has a similar goal I don't think it has enough AI to > completely > replace this manual process. It suffers in a number of use cases: > > 1) When you have a large number of moderate sized text fields instead of > a single very large text field. This is probably the case here. Exactly. > 2) When you know exactly which fields you'll be searching on and which > you won't be. Often many speed-sensitive queries don't need to access the > extended information at all. Also true. I only need the large fields to display the few rows which survive the LIMIT... Here's one of the same : Although the subselect has no influence on the WHERE condition, 97021 subselects are computed, and only 10 kept... This data also bloats the sort (if the subselect yields a large text field instead of an int, the sort time doubles). explain analyze select raw_annonce_id, price, rooms, surface, terrain, contact_telephones, description, (SELECT price FROM raw_annonces r WHERE r.id=raw_annonce_id) from annonces where price is not null order by price desc limit 10; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=459568.37..459568.40 rows=10 width=272) (actual time=1967.360..1967.368 rows=10 loops=1) -> Sort (cost=459568.37..459812.60 rows=97689 width=272) (actual time=1967.357..1967.361 rows=10 loops=1) Sort Key: price -> Seq Scan on annonces (cost=0.00..443102.59 rows=97689 width=272) (actual time=0.059..949.507 rows=97021 loops=1) Filter: (price IS NOT NULL) SubPlan -> Index Scan using raw_annonces_pkey on raw_annonces r (cost=0.00..4.46 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=97021) Index Cond: (id = $0) Total runtime: 1988.786 ms From pgsql-performance-owner@postgresql.org Wed Mar 1 14:31:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D1C389DC99B for ; Wed, 1 Mar 2006 14:31: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 57390-05 for ; Wed, 1 Mar 2006 14:31:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from bramble.mmrd.com (bramble.mmrd.com [65.217.53.66]) by postgresql.org (Postfix) with ESMTP id A21E49DC97D for ; Wed, 1 Mar 2006 14:31:56 -0400 (AST) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id k21JTWkB013094; Wed, 1 Mar 2006 14:29:33 -0500 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [10.225.10.110]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id k21IVsC08560; Wed, 1 Mar 2006 13:31:54 -0500 Received: from [10.225.105.30] (10.225.105.30 [10.225.105.30]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id TWDBNG48; Wed, 1 Mar 2006 13:31:52 -0500 Subject: Re: Looking for a tool to "*" pg tables as ERDs From: Robert Treat To: Ron Peacetree Cc: pgsql-performance@postgresql.org In-Reply-To: <17961438.1140712728036.JavaMail.root@elwamui-rustique.atl.sa.earthlink.net> References: <17961438.1140712728036.JavaMail.root@elwamui-rustique.atl.sa.earthlink.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 01 Mar 2006 13:31:44 -0500 Message-Id: <1141237914.4234.340.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.126 required=5 tests=[AWL=0.126] X-Spam-Score: 0.126 X-Spam-Level: X-Archive-Number: 200603/10 X-Sequence-Number: 17447 On Thu, 2006-02-23 at 11:38, Ron Peacetree wrote: > Where "*" == > {print | save to PDF | save to format | display on screen} > > Anyone know of one? > case studio can reverse engineer erd's from existing schema, and you can print out the schema, create html or rdf reports, or export the erd as a graphic. Downside is it can't do direct port to pdf (though you could get around that with OO i imagine), plus its windows only and commercial. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL From pgsql-performance-owner@postgresql.org Wed Mar 1 14:48:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DC0139DC9E4 for ; Wed, 1 Mar 2006 14:48: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 62944-07 for ; Wed, 1 Mar 2006 14:48:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id AB3329DC9AE for ; Wed, 1 Mar 2006 14:48:36 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 2AC3756457; Wed, 1 Mar 2006 12:48:37 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 1 Mar 2006 12:48:36 -0600 Date: Wed, 1 Mar 2006 12:48:36 -0600 From: "Jim C. Nasby" To: "Jeevanandam, Kathirvel (IE10)" Cc: Tino Wildenhain , pgsql-performance@postgresql.org Subject: Re: triggers, performance Was: Re: [GENERAL] rotate records Message-ID: <20060301184836.GH82012@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060301:jeevanandam.kathirvel@honeywell.com::wgj+A5WO90fWDFxU:00 00000000000000000000000002ri X-Hashcash: 1:20:060301:tino@wildenhain.de::xdd2v3a+CupWHUso:0000000000000000000 0000000000000000000000004LNS X-Hashcash: 1:20:060301:pgsql-performance@postgresql.org::0lO7U2oveDENgMC6:00000 0000000000000000000000002bAr X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/11 X-Sequence-Number: 17448 And what do those functions do? And do their options trigger other triggers? How about an EXPLAIN ANALYZE from a problem query, too. On Tue, Feb 28, 2006 at 11:24:34AM +0530, Jeevanandam, Kathirvel (IE10) wrote: > I am using triggers for all the events (insert,delete,update) please > find the details below. > > trg_delpointtable BEFORE DELETE ON pointtable FOR EACH ROW EXECUTE > PROCEDURE pp_delpointtable() > > trg_insdelpoints AFTER DELETE ON pointtable FOR EACH ROW EXECUTE > PROCEDURE pp_insdelpoints() > > trgins_pointtable AFTER INSERT ON pointtable FOR EACH ROW EXECUTE > PROCEDURE pp_inspointtable() > > trupd_pointtable AFTER UPDATE ON pointtable FOR EACH ROW EXECUTE > PROCEDURE pp_updpointtable() > > > Basically, this each trigger modifies the content of other dependent > tables. > > Best Regards, > Jeeva.K > > -----Original Message----- > From: Tino Wildenhain [mailto:tino@wildenhain.de] > Sent: Tuesday, February 28, 2006 10:34 AM > To: Jeevanandam, Kathirvel (IE10) > Cc: pgsql-general@postgresql.org > Subject: triggers, performance Was: Re: [GENERAL] rotate records > > Jeevanandam, Kathirvel (IE10) schrieb: > > Hi all, > > > > I am facing performance issues even with less than 3000 records, I am > > using Triggers/SPs in all the tables. What could be the problem. > > Any idea it is good to use triggers w.r.t performance? > > Much to general. What triggers? (what are they doing, when are > they invoked...?). Please provide much greater details with > your request or nobody can help. > > Regards > Tino > > PS: and try not to steal threads > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- 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 Wed Mar 1 14:51:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B17BD9DC863 for ; Wed, 1 Mar 2006 14:51: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 60495-08 for ; Wed, 1 Mar 2006 14:51:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 9838E9DC821 for ; Wed, 1 Mar 2006 14:51:15 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 66C4B56457; Wed, 1 Mar 2006 12:51:16 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 1 Mar 2006 12:51:15 -0600 Date: Wed, 1 Mar 2006 12:51:15 -0600 From: "Jim C. Nasby" To: PFC Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Bad plan on a view Message-ID: <20060301185115.GI82012@pervasive.com> References: <10652.1141226168@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060301:lists@peufeu.com::7m3m4r87TDDg+5Ij:008ad X-Hashcash: 1:20:060301:tgl@sss.pgh.pa.us::qS5wBHmN+o9xJzIt:00000000000000000000 0000000000000000000000005TTc X-Hashcash: 1:20:060301:pgsql-performance@postgresql.org::4JCczso0nwbxdKIU:00000 0000000000000000000000002GFt X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/12 X-Sequence-Number: 17449 On Wed, Mar 01, 2006 at 04:43:53PM +0100, PFC wrote: > > >Aren't you going to a lot of work to reinvent something that TOAST > >already does for you? (At least, in the cases where the text fields > >are wide enough that it really matters.) > > I know. But I have several text fields in the 20 to 200 characters, > which is too small for toast, but large enough to make up about 90% of the > table size, which makes it problematic RAM-wise, especially since it's > gonna grow. Now, if I had 1 big text field, it would be TOASTed and I > would be happy ;) Cases like this are why I really wish we had the ability to specify something other than BLKSZ/4 as when to trigger TOAST. In many cases the text field is seldom refered to, so getting it out of the main heap is a big win. -- 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-hackers-owner@postgresql.org Thu Mar 2 14:18:00 2006 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 373CC9DCA0A; Thu, 2 Mar 2006 14:18: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 28776-02; Thu, 2 Mar 2006 14:17:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- 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 A28169DCA4E; Thu, 2 Mar 2006 14:17:56 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k22IHnY08016; Thu, 2 Mar 2006 13:17:49 -0500 (EST) From: Bruce Momjian Message-Id: <200603021817.k22IHnY08016@candle.pha.pa.us> Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index behaviour) In-Reply-To: To: Dann Corbit Date: Thu, 2 Mar 2006 13:17:49 -0500 (EST) CC: Tom Lane , Ron , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.418 required=5 tests=[AWL=-0.082, RAZOR2_CHECK=0.5] X-Spam-Score: 0.418 X-Spam-Level: X-Archive-Number: 200603/132 X-Sequence-Number: 80530 Added to TODO: * Improve port/qsort() to handle sorts with 50% unique and 50% duplicate value [qsort] This involves choosing better pivot points for the quicksort. --------------------------------------------------------------------------- Dann Corbit wrote: > > > > -----Original Message----- > > From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers- > > owner@postgresql.org] On Behalf Of Tom Lane > > Sent: Wednesday, February 15, 2006 5:22 PM > > To: Ron > > Cc: pgsql-performance@postgresql.org; pgsql-hackers@postgresql.org > > Subject: Re: [HACKERS] qsort again (was Re: [PERFORM] Strange Create > Index > > behaviour) > > > > Ron writes: > > > How are we choosing our pivots? > > > > See qsort.c: it looks like median of nine equally spaced inputs (ie, > > the 1/8th points of the initial input array, plus the end points), > > implemented as two rounds of median-of-three choices. With half of > the > > data inputs zero, it's not too improbable for two out of the three > > samples to be zeroes in which case I think the med3 result will be > zero > > --- so choosing a pivot of zero is much more probable than one would > > like, and doing so in many levels of recursion causes the problem. > > Adding some randomness to the selection of the pivot is a known > technique to fix the oddball partitions problem. However, Bentley and > Sedgewick proved that every quick sort algorithm has some input set that > makes it go quadratic (hence the recent popularity of introspective > sort, which switches to heapsort if quadratic behavior is detected. The > C++ template I submitted was an example of introspective sort, but > PostgreSQL does not use C++ so it was not helpful). > > > I think. I'm not too sure if the code isn't just being sloppy about > the > > case where many data values are equal to the pivot --- there's a > special > > case there to switch to insertion sort, and maybe that's getting > invoked > > too soon. > > Here are some cases known to make qsort go quadratic: > 1. Data already sorted > 2. Data reverse sorted > 3. Data organ-pipe sorted or ramp > 4. Almost all data of the same value > > There are probably other cases. Randomizing the pivot helps some, as > does check for in-order or reverse order partitions. > > Imagine if 1/3 of the partitions fall into a category that causes > quadratic behavior (have one of the above formats and have more than > CUTOFF elements in them). > > It is doubtful that the switch to insertion sort is causing any sort of > problems. It is only going to be invoked on tiny sets, for which it has > a fixed cost that is probably less that qsort() function calls on sets > of the same size. > > >It'd be useful to get a line-level profile of the behavior of > > this code in the slow cases... > > I guess that my in-order or presorted tests [which often arise when > there are very few distinct values] may solve the bad partition > problems. Don't forget that the algorithm is called recursively. > > > regards, tom lane > > > > ---------------------------(end of > broadcast)--------------------------- > > TIP 3: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/docs/faq > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- Bruce Momjian http://candle.pha.pa.us SRA OSS, Inc. http://www.sraoss.com + If your life is a hard drive, Christ can be your backup. + From pgsql-hackers-owner@postgresql.org Thu Mar 2 14:50:30 2006 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E1DD79DCBDB for ; Thu, 2 Mar 2006 14:50: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 38811-07 for ; Thu, 2 Mar 2006 14:50:29 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.194]) by postgresql.org (Postfix) with ESMTP id 005BF9DCBB6 for ; Thu, 2 Mar 2006 14:50:24 -0400 (AST) Received: by nproxy.gmail.com with SMTP id l24so113594nfc for ; Thu, 02 Mar 2006 10:50: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:references; b=r6Erten03FkaEQ4xuLzRAX853aVNtBxCI9sUKJVvB35kSf8xfMF1tsv0DQE5t5n5ATd1yYejTDOAxvG5uncVtm2DhPdvluiw4fNJO2QtDRRoQiE1W19EWhEzbCOI8tJx2SdpvATrRs3MlzbZ8DwJCdiDCQkE9yh2FIhRlRehkOg= Received: by 10.48.238.20 with SMTP id l20mr785913nfh; Thu, 02 Mar 2006 10:50:24 -0800 (PST) Received: by 10.48.213.12 with HTTP; Thu, 2 Mar 2006 10:50:24 -0800 (PST) Message-ID: <36e682920603021050s4d8a6a02j3c0acf54f19e4881@mail.gmail.com> Date: Thu, 2 Mar 2006 13:50:24 -0500 From: "Jonah H. Harris" To: "Bruce Momjian" Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index behaviour) Cc: "Dann Corbit" , "Tom Lane" , Ron , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org In-Reply-To: <200603021817.k22IHnY08016@candle.pha.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4984_1958656.1141325424234" References: <200603021817.k22IHnY08016@candle.pha.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.46 required=5 tests=[AWL=-0.041, HTML_MESSAGE=0.001, RAZOR2_CHECK=0.5] X-Spam-Score: 0.46 X-Spam-Level: X-Archive-Number: 200603/135 X-Sequence-Number: 80533 ------=_Part_4984_1958656.1141325424234 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline My introsort is almost complete and its the fastest variant of quicksort I can find, I'll submit it to -patches in the next couple days as-well. On 3/2/06, Bruce Momjian wrote: > > > Added to TODO: > > * Improve port/qsort() to handle sorts with 50% unique and 50% > duplicate > value [qsort] > > This involves choosing better pivot points for the quicksort. > > > > -------------------------------------------------------------------------= -- > > Dann Corbit wrote: > > > > > > > -----Original Message----- > > > From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers- > > > owner@postgresql.org] On Behalf Of Tom Lane > > > Sent: Wednesday, February 15, 2006 5:22 PM > > > To: Ron > > > Cc: pgsql-performance@postgresql.org; pgsql-hackers@postgresql.org > > > Subject: Re: [HACKERS] qsort again (was Re: [PERFORM] Strange Create > > Index > > > behaviour) > > > > > > Ron writes: > > > > How are we choosing our pivots? > > > > > > See qsort.c: it looks like median of nine equally spaced inputs (ie, > > > the 1/8th points of the initial input array, plus the end points), > > > implemented as two rounds of median-of-three choices. With half of > > the > > > data inputs zero, it's not too improbable for two out of the three > > > samples to be zeroes in which case I think the med3 result will be > > zero > > > --- so choosing a pivot of zero is much more probable than one would > > > like, and doing so in many levels of recursion causes the problem. > > > > Adding some randomness to the selection of the pivot is a known > > technique to fix the oddball partitions problem. However, Bentley and > > Sedgewick proved that every quick sort algorithm has some input set tha= t > > makes it go quadratic (hence the recent popularity of introspective > > sort, which switches to heapsort if quadratic behavior is detected. Th= e > > C++ template I submitted was an example of introspective sort, but > > PostgreSQL does not use C++ so it was not helpful). > > > > > I think. I'm not too sure if the code isn't just being sloppy about > > the > > > case where many data values are equal to the pivot --- there's a > > special > > > case there to switch to insertion sort, and maybe that's getting > > invoked > > > too soon. > > > > Here are some cases known to make qsort go quadratic: > > 1. Data already sorted > > 2. Data reverse sorted > > 3. Data organ-pipe sorted or ramp > > 4. Almost all data of the same value > > > > There are probably other cases. Randomizing the pivot helps some, as > > does check for in-order or reverse order partitions. > > > > Imagine if 1/3 of the partitions fall into a category that causes > > quadratic behavior (have one of the above formats and have more than > > CUTOFF elements in them). > > > > It is doubtful that the switch to insertion sort is causing any sort of > > problems. It is only going to be invoked on tiny sets, for which it ha= s > > a fixed cost that is probably less that qsort() function calls on sets > > of the same size. > > > > >It'd be useful to get a line-level profile of the behavior of > > > this code in the slow cases... > > > > I guess that my in-order or presorted tests [which often arise when > > there are very few distinct values] may solve the bad partition > > problems. Don't forget that the algorithm is called recursively. > > > > > regards, tom lane > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > > TIP 3: Have you checked our extensive FAQ? > > > > > > http://www.postgresql.org/docs/faq > > > > ---------------------------(end of broadcast)--------------------------= - > > TIP 2: Don't 'kill -9' the postmaster > > > > -- > Bruce Momjian http://candle.pha.pa.us > SRA OSS, Inc. http://www.sraoss.com > > + If your life is a hard drive, Christ can be your backup. + > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- Jonah H. Harris, Database Internals Architect EnterpriseDB Corporation 732.331.1324 ------=_Part_4984_1958656.1141325424234 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline My introsort is almost complete and its the fastest variant of quicksort I can find, I'll submit it to -patches in the next couple days as-well.

On 3/2/06, Bruce Momjian <pgman@candle.pha.pa.us> wrote:

Added to TODO:

        *= Improve port/qsort() to handle sorts with 50% unique and 50% duplicate
=           value [qsort]
          This invo= lves choosing better pivot points for the quicksort.


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

Dann Corbit wrote:
>
>
> > -----Original Messa= ge-----
> > From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
> > owner@postgresql.org] On Behalf Of Tom Lane
> > Sent: Wedne= sday, February 15, 2006 5:22 PM
> > To: Ron
> > Cc: pgsql-performance@postgresql.org; pgsql-hackers@postgresql.org
> > Su= bject: Re: [HACKERS] qsort again (was Re: [PERFORM] Strange Create
> Index
> > behaviour)
> >
> > Ron <rjpeace@earthlink.net> writes= :
> > > How are we choosing our pivots?
> >
> &g= t; See=20 qsort.c: it looks like median of nine equally spaced inputs (ie,
> &g= t; the 1/8th points of the initial input array, plus the end points),
&g= t; > implemented as two rounds of median-of-three choices.  Wi= th half of
> the
> > data inputs zero, it's not too improbable for two= out of the three
> > samples to be zeroes in which case I think t= he med3 result will be
> zero
> > --- so choosing a pivot of= zero is much more probable than one would
> > like, and doing so in many levels of recursion causes the pro= blem.
>
> Adding some randomness to the selection of the pivot = is a known
> technique to fix the oddball partitions problem. &n= bsp;However, Bentley and
> Sedgewick proved that every quick sort algorithm has some input se= t that
> makes it go quadratic (hence the recent popularity of intros= pective
> sort, which switches to heapsort if quadratic behavior is d= etected.  The
> C++ template I submitted was an example of introspective sort, but=
> PostgreSQL does not use C++ so it was not helpful).
>
>= ; > I think.  I'm not too sure if the code isn't just being sl= oppy about
> the
> > case where many data values are equal to the pivo= t --- there's a
> special
> > case there to switch to insert= ion sort, and maybe that's getting
> invoked
> > too soon.
>
> Here are some cases known to make qsort go quadratic:
&= gt; 1. Data already sorted
> 2. Data reverse sorted
> 3. Data o= rgan-pipe sorted or ramp
> 4. Almost all data of the same value
>
> There are probably other cases.  Randomizing the piv= ot helps some, as
> does check for in-order or reverse order partitio= ns.
>
> Imagine if 1/3 of the partitions fall into a category t= hat causes
> quadratic behavior (have one of the above formats and have more th= an
> CUTOFF elements in them).
>
> It is doubtful that th= e switch to insertion sort is causing any sort of
> problems. &n= bsp;It is only going to be invoked on tiny sets, for which it has
> a fixed cost that is probably less that qsort() function calls on = sets
> of the same size.
>
> >It'd be useful to get a = line-level profile of the behavior of
> > this code in the slow ca= ses...
>
> I guess that my in-order or presorted tests [which often a= rise when
> there are very few distinct values] may solve the bad par= tition
> problems.  Don't forget that the algorithm is call= ed recursively.
>
> >            = ;         regards, tom lane
> >
> > ---------------------------(end= of
> broadcast)---------------------------
> > TIP 3: Have = you checked our extensive FAQ?
> >
> >            = ;    htt= p://www.postgresql.org/docs/faq
>
> -----------------------= ----(end of broadcast)---------------------------
> TIP 2: Don't 'kil= l -9' the postmaster
>

--
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, In= c.   http://www.sraoss.com<= br>
  + If your life is a hard drive, Christ can be your backu= p. +

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


--
Jonah H. Harris, Database Internals Architect EnterpriseDB Corporation
732.331.1324
------=_Part_4984_1958656.1141325424234-- From pgsql-performance-owner@postgresql.org Thu Mar 2 20:15:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DBE3B9DC816 for ; Thu, 2 Mar 2006 20:15: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 12841-09 for ; Thu, 2 Mar 2006 20:15:39 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 83A699DC84A for ; Thu, 2 Mar 2006 20:15:34 -0400 (AST) Received: from dc1.storediq.com (66-194-80-196.gen.twtelecom.net [66.194.80.196]) by svr4.postgresql.org (Postfix) with ESMTP id 591BB5AF874 for ; Fri, 3 Mar 2006 00:15:38 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C63E57.984AF45A" Subject: Like 'name%' is not using index Date: Thu, 2 Mar 2006 18:15:36 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Like 'name%' is not using index Thread-Index: AcY+V6gtzTJKKiApR/GSckkGXhmSVg== From: "Jozsef Szalay" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.283 required=5 tests=[AWL=0.282, HTML_MESSAGE=0.001] X-Spam-Score: 0.283 X-Spam-Level: X-Archive-Number: 200603/14 X-Sequence-Number: 17451 This is a multi-part message in MIME format. ------_=_NextPart_001_01C63E57.984AF45A Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, =20 I have to provide a pretty standard query that should return every row where the NAME attribute begins with a specific string. The type of the NAME column is varchar. I do have an index for this column. One would think that Postgres will use the index to look up the matches, but apparently that is not the case. It performs a full table scan. My query looks something like this: =20 SELECT * FROM table WHERE name LIKE 'smith%'; =20 Does anyone know a way to "force" the optimizer to utilize the index? Is there perhaps another way of doing this? =20 Thanks for the help! Jozsef ------_=_NextPart_001_01C63E57.984AF45A Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi all,

 

I have to provide a pretty standard query that should = return every row where the NAME attribute begins with a specific string. The = type of the NAME column is varchar. I do have an index for this column. One = would think that Postgres will use the index to look up the matches, but apparently = that is not the case. It performs a full table scan.  My query looks = something like this:

 

SELECT * FROM table WHERE name LIKE = ‘smith%’;

 

Does anyone know a way to “force” the = optimizer to utilize the index? Is there perhaps another way of doing = this?

 

Thanks for the help!

Jozsef

------_=_NextPart_001_01C63E57.984AF45A-- From pgsql-performance-owner@postgresql.org Thu Mar 2 21:28:43 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8726D9DCD7B for ; Thu, 2 Mar 2006 21:28: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 24660-02 for ; Thu, 2 Mar 2006 21:28:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-3.paradise.net.nz (bm-3a.paradise.net.nz [203.96.152.182]) by postgresql.org (Postfix) with ESMTP id E80B89DCD6F for ; Thu, 2 Mar 2006 21:28:39 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-3.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IVJ003PN2RUKK@linda-3.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 03 Mar 2006 14:28:42 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-68.dsl.clear.net.nz [218.101.29.68]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 2541831FE93; Fri, 03 Mar 2006 14:28:42 +1300 (NZDT) Date: Fri, 03 Mar 2006 14:28:40 +1300 From: Mark Kirkwood Subject: Re: Like 'name%' is not using index In-reply-to: To: Jozsef Szalay Cc: pgsql-performance@postgresql.org Message-id: <44079BC8.3030209@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 8BIT 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.183 required=5 tests=[AWL=0.183] X-Spam-Score: 0.183 X-Spam-Level: X-Archive-Number: 200603/15 X-Sequence-Number: 17452 Jozsef Szalay wrote: > Hi all, > > > > I have to provide a pretty standard query that should return every row > where the NAME attribute begins with a specific string. The type of the > NAME column is varchar. I do have an index for this column. One would > think that Postgres will use the index to look up the matches, but > apparently that is not the case. It performs a full table scan. My > query looks something like this: > > > > SELECT * FROM table WHERE name LIKE �smith%�; > > > > Does anyone know a way to �force� the optimizer to utilize the index? Is > there perhaps another way of doing this? > Can you provide an EXPLAIN ANALYZE for the query? This will give us a hint as to why the index has not been chosen. The other standard gotcha is that LIKE will not use an index if your cluster is initialized with locale != C. If it is, then you can try recreating the index using something like: CREATE INDEX table_name ON table (name varchar_pattern_ops); cheers Mark From pgsql-performance-owner@postgresql.org Thu Mar 2 22:48:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A15E9DCA54 for ; Thu, 2 Mar 2006 22: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 37045-05 for ; Thu, 2 Mar 2006 22:48:53 -0400 (AST) X-Greylist: delayed 02:33:14.710566 by SQLgrey- Received: from dc1.storediq.com (66-194-80-196.gen.twtelecom.net [66.194.80.196]) by postgresql.org (Postfix) with ESMTP id D28AD9DC93F for ; Thu, 2 Mar 2006 22:48:46 -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="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Like 'name%' is not using index Date: Thu, 2 Mar 2006 20:48:51 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Like 'name%' is not using index Thread-Index: AcY+YdCGHNklP86eRHiIcztOvtgzPwACvikQ From: "Jozsef Szalay" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.242 required=5 tests=[AWL=0.242] X-Spam-Score: 0.242 X-Spam-Level: X-Archive-Number: 200603/16 X-Sequence-Number: 17453 The var_char_pattern_ops operator group has made the difference.=20 Thanks for the help! Jozsef -----Original Message----- From: Mark Kirkwood [mailto:markir@paradise.net.nz]=20 Sent: Thursday, March 02, 2006 7:29 PM To: Jozsef Szalay Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Like 'name%' is not using index Jozsef Szalay wrote: > Hi all, >=20 > =20 >=20 > I have to provide a pretty standard query that should return every row > where the NAME attribute begins with a specific string. The type of the=20 > NAME column is varchar. I do have an index for this column. One would=20 > think that Postgres will use the index to look up the matches, but=20 > apparently that is not the case. It performs a full table scan. My=20 > query looks something like this: >=20 > =20 >=20 > SELECT * FROM table WHERE name LIKE 'smith%'; >=20 > =20 >=20 > Does anyone know a way to "force" the optimizer to utilize the index? Is=20 > there perhaps another way of doing this? >=20 Can you provide an EXPLAIN ANALYZE for the query? This will give us a=20 hint as to why the index has not been chosen. The other standard gotcha is that LIKE will not use an index if your=20 cluster is initialized with locale !=3D C. If it is, then you can try=20 recreating the index using something like: CREATE INDEX table_name ON table (name varchar_pattern_ops); cheers Mark From pgsql-performance-owner@postgresql.org Fri Mar 3 00:01:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A53849DCA94 for ; Fri, 3 Mar 2006 00: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 51228-02 for ; Fri, 3 Mar 2006 00:01:51 -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 C5D4F9DCA8C for ; Fri, 3 Mar 2006 00:01:50 -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 1FF1U3-0006Uf-00; Thu, 02 Mar 2006 23:01:39 -0500 To: "Jozsef Szalay" Cc: Subject: Re: Like 'name%' is not using index References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 02 Mar 2006 23:01:39 -0500 Message-ID: <877j7cuqfw.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.13 required=5 tests=[AWL=0.130] X-Spam-Score: 0.13 X-Spam-Level: X-Archive-Number: 200603/17 X-Sequence-Number: 17454 "Jozsef Szalay" writes: > One would > think that Postgres will use the index to look up the matches, but > apparently that is not the case. It performs a full table scan. My > query looks something like this: > > SELECT * FROM table WHERE name LIKE 'smith%'; There are two possible answers here: First, what does this output on your database? db=> show lc_collate; If it's not "C" then the index can't be used. You would have to make a second special-purpose index specifically for use with LIKE. Secondly, please send "explain analyze" output for your query. It will show if the optimizer is simply estimating that the index won't help enough to be faster than the full table scan. -- greg From pgsql-general-owner@postgresql.org Fri Mar 3 06:03:24 2006 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 D5ED09DC9D7 for ; Fri, 3 Mar 2006 06: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 16374-06 for ; Fri, 3 Mar 2006 06:03:25 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.203]) by postgresql.org (Postfix) with ESMTP id D179A9DC887 for ; Fri, 3 Mar 2006 06:03:21 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s18so411990wxc for ; Fri, 03 Mar 2006 02:03: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:in-reply-to:mime-version:content-type:references; b=BylVBjDmFS8zRApeZ8eV5XdXAV8MKHxGoxuufza3fza4xUtX7YPyb5SBlZc0pUW2X0YbQWIaH4Oqe/6UQ17a2guFsBz4kV8uKIdbvX+1npgLEeOuNsJOKcb6d3vo2PbfNotaUPU9E+O66it8mNs+koGgv01Z9lDyGpd+Uzf06+o= Received: by 10.70.88.17 with SMTP id l17mr4249922wxb; Fri, 03 Mar 2006 02:03:24 -0800 (PST) Received: by 10.70.37.15 with HTTP; Fri, 3 Mar 2006 02:03:24 -0800 (PST) Message-ID: <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> Date: Fri, 3 Mar 2006 11:03:24 +0100 From: "Paul Mackay" To: pgsql-general@postgresql.org Subject: Physical column size In-Reply-To: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21127_10052738.1141380204291" References: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.567 required=5 tests=[AWL=0.566, HTML_MESSAGE=0.001] X-Spam-Score: 0.567 X-Spam-Level: X-Archive-Number: 200603/111 X-Sequence-Number: 91976 ------=_Part_21127_10052738.1141380204291 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, I've created a table like this : CREATE TABLE tmp_A ( c "char", i int4 ); And another one CREATE TABLE tmp_B ( i int4, ii int4 ); I then inserted a bit more than 19 million rows in each table (exactly the same number of rows in each). The end result is that the physical size on disk used by table tmp_A is exactly the same as table tmp_B (as revealed by the pg_relation_size function) ! Given that a "char" field is supposed to be 1 byte in size and = a int4 4 bytes, shouldn't the tmp_A use a smaller disk space ? Or is it that any value, whatever the type, requires at least 4 bytes to be stored ? Thanks, Paul ------=_Part_21127_10052738.1141380204291 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,
I've created a table like this :
CREATE TABLE tmp_A (
c "char= ",
i int4
);

And another one
CREATE TABLE tmp_B (
= i int4,
ii int4
);

I then inserted a bit more than 19 million rows in= each table (exactly the same number of rows in each).=20

The end result is that the physical size on disk used by table tmp_= A is exactly the same as table tmp_B (as revealed by the pg_relation_size f= unction) ! Given that a "char" field is supposed to be 1 byte in = size and a int4 4 bytes, shouldn't the tmp_A use a smaller disk space ? Or = is it that any value, whatever the type, requires at least 4 bytes to be st= ored ?=20

Thanks,
= Paul
------=_Part_21127_10052738.1141380204291-- From pgsql-general-owner@postgresql.org Fri Mar 3 06:23:24 2006 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 241D79DCBD8 for ; Fri, 3 Mar 2006 06:23: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 20879-06 for ; Fri, 3 Mar 2006 06:23:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id DB4329DC9F6 for ; Fri, 3 Mar 2006 06:23:21 -0400 (AST) Received: from bell.credativ.de (p50895799.dip.t-dialin.net [80.137.87.153]) (using TLSv1 with cipher EXP1024-RC4-SHA (56/128 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id 3F5AFD75F2; Fri, 3 Mar 2006 11:23:23 +0100 (CET) From: Peter Eisentraut To: pgsql-general@postgresql.org Subject: Re: Physical column size Date: Fri, 3 Mar 2006 11:23:21 +0100 User-Agent: KMail/1.8.3 Cc: "Paul Mackay" References: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com> <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> In-Reply-To: <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200603031123.22453.peter_e@gmx.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.104 required=5 tests=[AWL=0.104] X-Spam-Score: 0.104 X-Spam-Level: X-Archive-Number: 200603/115 X-Sequence-Number: 91980 Am Freitag, 3. M�rz 2006 11:03 schrieb Paul Mackay: > I've created a table like this : > CREATE TABLE tmp_A ( > c "char", > i int4 > ); > > And another one > CREATE TABLE tmp_B ( > i int4, > ii int4 > ); > The end result is that the physical size on disk used by table tmp_A is > exactly the same as table tmp_B (as revealed by the pg_relation_size > function) ! An int4 field is required to be aligned at a 4-byte boundary internally, so there are 3 bytes wasted between tmp_A.c and tmp_A.i. If you switch the order of the fields you should see space savings. (Note, however, that the per-row overhead is about 32 bytes, so you'll probably only save about 10% overall, rather than the 37.5% that one might expect.) -- Peter Eisentraut http://developer.postgresql.org/~petere/ From pgsql-general-owner@postgresql.org Fri Mar 3 06:24:05 2006 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 F04AF9DCDE9 for ; Fri, 3 Mar 2006 06:24: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 20240-05 for ; Fri, 3 Mar 2006 06:24:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svana.org (svana.org [125.62.94.225]) by postgresql.org (Postfix) with ESMTP id 696F19DCDDD for ; Fri, 3 Mar 2006 06:23:58 -0400 (AST) Received: from kleptog by svana.org with local (Exim 4.50) id 1FF7S2-0004cD-Sy; Fri, 03 Mar 2006 21:23:58 +1100 Date: Fri, 3 Mar 2006 11:23:58 +0100 From: Martijn van Oosterhout To: Paul Mackay Cc: pgsql-general@postgresql.org Subject: Re: Physical column size Message-ID: <20060303102358.GA17615@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: Paul Mackay , pgsql-general@postgresql.org References: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com> <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> 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: User-Agent: Mutt/1.5.9i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kleptog@svana.org X-SA-Exim-Scanned: No (on svana.org); SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.123 required=5 tests=[AWL=0.123] X-Spam-Score: 0.123 X-Spam-Level: X-Archive-Number: 200603/116 X-Sequence-Number: 91981 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 03, 2006 at 11:03:24AM +0100, Paul Mackay wrote: > The end result is that the physical size on disk used by table tmp_A is > exactly the same as table tmp_B (as revealed by the pg_relation_size > function) ! Given that a "char" field is supposed to be 1 byte in size an= d a > int4 4 bytes, shouldn't the tmp_A use a smaller disk space ? Or is it that > any value, whatever the type, requires at least 4 bytes to be stored ? Alignment. An int4 value must start on a multiple of 4 offset, so you get three bytes of padding. If you put the int4, then the char it should work better. Although whole rows have alignment requirements too... 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. --Kj7319i9nmIyA2yE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFECBk+IB7bNG8LQkwRAslJAJoCnKxll9qL0qXuTkVhSWFbi9DkSACdFOM0 AQ+88oEq51dsSAiSPdmFcbc= =wXvW -----END PGP SIGNATURE----- --Kj7319i9nmIyA2yE-- From pgsql-general-owner@postgresql.org Fri Mar 3 06:27:05 2006 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 6B4039DC82A for ; Fri, 3 Mar 2006 06:27: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 20975-03 for ; Fri, 3 Mar 2006 06:27:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.hive.is (scania.ipf.is [85.197.192.147]) by postgresql.org (Postfix) with SMTP id D48359DCCEC for ; Fri, 3 Mar 2006 06:27:02 -0400 (AST) Received: (qmail 70750 invoked by uid 1010); 3 Mar 2006 10:27:19 -0000 Received: from 85.197.216.186 by scania.ipf.is (envelope-from , uid 1009) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1283. spamassassin: 3.1.0. perlscan: 1.25-st-qms. Clear:RC:1(85.197.216.186):SA:0(-4.1/4.0):. Processed in 0.677543 secs); 03 Mar 2006 10:27:19 -0000 X-Antivirus-HIVE-Mail-From: gnari@hive.is via scania.ipf.is X-Antivirus-HIVE: 1.25-st-qms (Clear:RC:1(85.197.216.186):SA:0(-4.1/4.0):. Processed in 0.677543 secs Process 70741) Received: from dsl-216-186.hive.is (HELO ?192.168.1.34?) (85.197.216.186) by mx1.hive.is with SMTP; 3 Mar 2006 10:27:18 -0000 Subject: Re: Physical column size From: Ragnar To: Paul Mackay Cc: pgsql-general@postgresql.org In-Reply-To: <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> References: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com> <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Date: Fri, 03 Mar 2006 10:27:59 +0000 Message-Id: <1141381679.18656.141.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 8bit 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: 200603/117 X-Sequence-Number: 91982 On f�s, 2006-03-03 at 11:03 +0100, Paul Mackay wrote: > Hi, > > I've created a table like this : > CREATE TABLE tmp_A ( > c "char", > i int4 > ); > > And another one > CREATE TABLE tmp_B ( > i int4, > ii int4 > ); > > I then inserted a bit more than 19 million rows in each table (exactly > the same number of rows in each). > > The end result is that the physical size on disk used by table tmp_A > is exactly the same as table tmp_B (as revealed by the > pg_relation_size function) ! Given that a "char" field is supposed to > be 1 byte in size and a int4 4 bytes, shouldn't the tmp_A use a > smaller disk space ? Or is it that any value, whatever the type, > requires at least 4 bytes to be stored ? the int4 needs to be aligned at 4 bytes boundaries, making wasted space after the char. this would probably be the same size: CREATE TABLE tmp_C ( c "char", cc "char", i int4 ); and this would be smaller: CREATE TABLE tmp_D ( c "char", cc "char", ccc "char", ); P.S.: I did not actually check to see if the "char" type needs to be aligned, by I assumed not. From pgsql-general-owner@postgresql.org Fri Mar 3 10:53:48 2006 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 C44889DC80A for ; Fri, 3 Mar 2006 10:53: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 65148-01 for ; Fri, 3 Mar 2006 10: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 2C3BD9DCB38 for ; Fri, 3 Mar 2006 10:53:45 -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 k23ErlRl000421; Fri, 3 Mar 2006 09:53:47 -0500 (EST) To: Peter Eisentraut cc: pgsql-general@postgresql.org, "Paul Mackay" Subject: Re: Physical column size In-reply-to: <200603031123.22453.peter_e@gmx.net> References: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com> <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> <200603031123.22453.peter_e@gmx.net> Comments: In-reply-to Peter Eisentraut message dated "Fri, 03 Mar 2006 11:23:21 +0100" Date: Fri, 03 Mar 2006 09:53:47 -0500 Message-ID: <420.1141397627@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/124 X-Sequence-Number: 91989 Peter Eisentraut writes: > An int4 field is required to be aligned at a 4-byte boundary internally, so > there are 3 bytes wasted between tmp_A.c and tmp_A.i. If you switch the > order of the fields you should see space savings. Probably not, because the row-as-a-whole has alignment requirements too. In this example you'll just move the pad bytes from one place to another. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 3 21:11:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C02109DCA0C for ; Fri, 3 Mar 2006 21:11: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 96704-01 for ; Fri, 3 Mar 2006 21:11:03 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id C608A9DC93F for ; Fri, 3 Mar 2006 21:10:57 -0400 (AST) Received: from ylpvm15.prodigy.net (ylpvm15-ext.prodigy.net [207.115.57.46]) by svr4.postgresql.org (Postfix) with ESMTP id 2A5025AF89A for ; Sat, 4 Mar 2006 01:11:02 +0000 (GMT) Received: from pimout3-ext.prodigy.net (pimout3-int.prodigy.net [207.115.4.218]) by ylpvm15.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id k241BJK7002777 for ; Fri, 3 Mar 2006 20:11:19 -0500 X-ORBL: [68.92.113.60] Received: from homer.d-oh.org (adsl-68-92-113-60.dsl.okcyok.swbell.net [68.92.113.60]) by pimout3-ext.prodigy.net (8.13.4 outbound domainkey aix/8.13.4) with SMTP id k241AsJv078352 for ; Fri, 3 Mar 2006 20:10:58 -0500 Received: (qmail 20275 invoked by uid 1013); 4 Mar 2006 01:10:53 -0000 Received: from alex@innovacomputing.com by homer by uid 64011 with qmail-scanner-1.20 (clamscan: 0.65. hbedv: 6.22.0.1/6.22.0.50. Clear:RC:1(192.168.0.100):. Processed in 2.282285 secs); 04 Mar 2006 01:10:53 -0000 Received: from unknown (HELO ?192.168.0.100?) (192.168.0.100) by homer.int.d-oh.org with SMTP; 4 Mar 2006 01:10:51 -0000 Message-ID: <4408E91C.90104@innovacomputing.com> Date: Fri, 03 Mar 2006 19:10:52 -0600 From: Alex Adriaanse User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Bad row estimates 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: 200603/18 X-Sequence-Number: 17455 Hello, I am doing some query optimizations for one of my clients who runs PostgreSQL 8.1.1, and am trying to cut down on the runtime of this particular query as it runs very frequently: SELECT count(*) FROM test_table_1 INNER JOIN test_table_2 ON (test_table_2.s_id = 13300613 AND test_table_1.id = test_table_2.n_id) WHERE now() BETWEEN test_table_1.start_ts AND test_table_1.end_ts AND test_table_1.id = test_table_1.g_id; The related tables are as follows: Table "public.test_table_1" Column | Type | Modifiers ----------+--------------------------+----------- id | numeric(20,0) | not null g_id | numeric(20,0) | start_ts | timestamp with time zone | end_ts | timestamp with time zone | Indexes: "test_table_1_pkey" PRIMARY KEY, btree (id) "test_table_1_ts_index" btree (start_ts, end_ts) Table "public.test_table_2" Column | Type | Modifiers --------+---------------+----------- s_id | numeric(20,0) | n_id | numeric(20,0) | Indexes: "test_table_2_n_id" btree (n_id) "test_table_2_s_id" btree (s_id) When I run the query it uses the following plan: Aggregate (cost=217.17..217.18 rows=1 width=0) (actual time=107.829..107.830 rows=1 loops=1) -> Nested Loop (cost=11.09..217.16 rows=1 width=0) (actual time=107.817..107.817 rows=0 loops=1) -> Index Scan using test_table_1_ts_index on test_table_1 (cost=0.01..204.05 rows=1 width=22) (actual time=3.677..4.388 rows=155 loops=1) Index Cond: ((now() >= start_ts) AND (now() <= end_ts)) Filter: (id = g_id) -> Bitmap Heap Scan on test_table_2 (cost=11.09..13.10 rows=1 width=12) (actual time=0.664..0.664 rows=0 loops=155) Recheck Cond: ((test_table_2.s_id = 13300613::numeric) AND ("outer".id = test_table_2.n_id)) -> BitmapAnd (cost=11.09..11.09 rows=1 width=0) (actual time=0.662..0.662 rows=0 loops=155) -> Bitmap Index Scan on test_table_2_s_id (cost=0.00..2.48 rows=136 width=0) (actual time=0.014..0.014 rows=1 loops=155) Index Cond: (s_id = 13300613::numeric) -> Bitmap Index Scan on test_table_2_n_id (cost=0.00..8.36 rows=959 width=0) (actual time=0.645..0.645 rows=891 loops=155) Index Cond: ("outer".id = test_table_2.n_id) Total runtime: 107.947 ms However, when I turn off enable_nestloop it runs as follows: Aggregate (cost=465.86..465.87 rows=1 width=0) (actual time=5.763..5.764 rows=1 loops=1) -> Merge Join (cost=465.16..465.86 rows=1 width=0) (actual time=5.752..5.752 rows=0 loops=1) Merge Cond: ("outer".id = "inner".n_id) -> Sort (cost=204.06..204.07 rows=1 width=22) (actual time=5.505..5.505 rows=1 loops=1) Sort Key: test_table_1.id -> Index Scan using test_table_1_ts_index on test_table_1 (cost=0.01..204.05 rows=1 width=22) (actual time=4.458..4.995 rows=155 loops=1) Index Cond: ((now() >= start_ts) AND (now() <= end_ts)) Filter: (id = g_id) -> Sort (cost=261.10..261.44 rows=136 width=12) (actual time=0.235..0.236 rows=1 loops=1) Sort Key: test_table_2.n_id -> Bitmap Heap Scan on test_table_2 (cost=2.48..256.28 rows=136 width=12) (actual time=0.218..0.219 rows=1 loops=1) Recheck Cond: (s_id = 13300613::numeric) -> Bitmap Index Scan on test_table_2_s_id (cost=0.00..2.48 rows=136 width=0) (actual time=0.168..0.168 rows=1 loops=1) Index Cond: (s_id = 13300613::numeric) Total runtime: 5.893 ms As you can see the total runtime drops from 108ms to 6ms, indicating that it is much better to use a Merge Join rather than a Nested Loop in this case. It looks like the planner chooses a Nested Loop because it incorrectly estimates the (now() BETWEEN test_table_1.start_ts AND test_table_1.end_ts AND test_table_1.id = test_table_1.g_id) condition to return 1 row, whereas in reality it returns 155 rows. I have set statistics for test_table_1.id and test_table_1.g_id to 1000, and have ANALYZEd both tables. This does not seem to make a bit of a difference -- it keeps thinking the criteria will only return 1 row. However, if I add a boolean column named "equal_ids" to test_table_1 with the value (test_table_1.id = test_table_1.g_id), and use that in the query instead of the equality it does make a much better row estimate. Essentially: ALTER TABLE test_table_1 ADD equal_ids BOOLEAN; UPDATE test_table_1 SET equal_ids = (id = g_id); VACUUM FULL test_table_1; ANALYZE VERBOSE test_table_1; INFO: analyzing "public.test_table_1" INFO: "test_table_1": scanned 83 of 83 pages, containing 8827 live rows and 0 dead rows; 8827 rows in sample, 8827 estimated total rows The plans listed above already reflect these changes. When I substitute "test_table_1.id = test_table_1.g_id" with "test_table_1.equal_ids" in the query I get the following plan: Aggregate (cost=469.76..469.77 rows=1 width=0) (actual time=5.711..5.712 rows=1 loops=1) -> Merge Join (cost=468.52..469.76 rows=2 width=0) (actual time=5.703..5.703 rows=0 loops=1) Merge Cond: ("outer".id = "inner".n_id) -> Sort (cost=207.42..207.69 rows=108 width=11) (actual time=5.462..5.462 rows=1 loops=1) Sort Key: test_table_1.id -> Index Scan using test_table_1_ts_index on test_table_1 (cost=0.01..203.77 rows=108 width=11) (actual time=4.547..4.984 rows=155 loops=1) Index Cond: ((now() >= start_ts) AND (now() <= end_ts)) Filter: equal_ids -> Sort (cost=261.10..261.44 rows=136 width=12) (actual time=0.231..0.232 rows=1 loops=1) Sort Key: test_table_2.n_id -> Bitmap Heap Scan on test_table_2 (cost=2.48..256.28 rows=136 width=12) (actual time=0.212..0.213 rows=1 loops=1) Recheck Cond: (s_id = 13300613::numeric) -> Bitmap Index Scan on test_table_2_s_id (cost=0.00..2.48 rows=136 width=0) (actual time=0.177..0.177 rows=1 loops=1) Index Cond: (s_id = 13300613::numeric) Total runtime: 5.830 ms The row estimate (108) is much better in this case. Here's some information on the data in these tables: SELECT count(*) FROM test_table_1; count ------- 8827 SELECT count(*) FROM test_table_2; count --------- 1149533 SELECT equal_ids, count(equal_ids) FROM test_table_1 GROUP BY equal_ids; equal_ids | count -----------+------- f | 281 t | 8546 SELECT equal_ids, count(equal_ids) FROM test_table_1 WHERE now() BETWEEN test_table_1.start_ts AND test_table_1.end_ts GROUP BY equal_ids; equal_ids | count -----------+------- t | 155 SELECT attname, null_frac, n_distinct FROM pg_stats WHERE tablename = 'test_table_1' AND attname IN ('id', 'g_id', 'equal_ids'); attname | null_frac | n_distinct -----------+-----------+------------ id | 0 | -1 g_id | 0 | -0.968166 equal_ids | 0 | 2 Any ideas on how I could go about getting PostgreSQL to use a Merge Join without having to resort to using the equal_ids column or disabling enable_nestloop? Let me know if you need any additional info. Thanks! Alex From pgsql-performance-owner@postgresql.org Sat Mar 4 03:01:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E68319DCD4E for ; Sat, 4 Mar 2006 03:01: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 68505-04 for ; Sat, 4 Mar 2006 03:01:51 -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 195319DCD15 for ; Sat, 4 Mar 2006 03:01: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 1FFQlj-0003eJ-00; Sat, 04 Mar 2006 02:01:35 -0500 To: Alex Adriaanse Cc: pgsql-performance@postgresql.org Subject: Re: Bad row estimates References: <4408E91C.90104@innovacomputing.com> In-Reply-To: <4408E91C.90104@innovacomputing.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 04 Mar 2006 02:01:35 -0500 Message-ID: <87wtfasng0.fsf@stark.xeocode.com> Lines: 42 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.129 required=5 tests=[AWL=0.129] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200603/19 X-Sequence-Number: 17456 Alex Adriaanse writes: > SELECT count(*) FROM test_table_1 > INNER JOIN test_table_2 ON > (test_table_2.s_id = 13300613 AND test_table_1.id = test_table_2.n_id) > WHERE now() BETWEEN test_table_1.start_ts AND test_table_1.end_ts > AND test_table_1.id = test_table_1.g_id; I don't know if this is the entire answer but this query is touching on two of Postgres's specific difficulties in analyzing statistics: The "now() BETWEEN test_table_1.start_ts AND test_table_1.end_ts can't be answered completely using a btree index. You could try using a GIST index here but I'm not clear how much it would help you (or how much work it would be). The "test_table_1.id = test_table_1.g_id" clause depends on intercolumn "correlation" which Postgres doesn't make any attempt at analyzing. That's why you've found that no matter how much you increase the statitics goal it can't come up with a better estimate. Actually the "now() between ..." clause also suffers from the inter-column dependency issue which is why the estimates for it are off as well. > However, if I add a boolean column named "equal_ids" to test_table_1 with > the value (test_table_1.id = test_table_1.g_id), and use that in the query > instead of the equality it does make a much better row estimate. One thing you could try is making an expression index on that expression. You don't need to actually have a redundant column bloating your table. In 8.1 I believe Postgres will even calculate statistics for these expression indexes. In fact you could go one step further and try a partial index like: CREATE INDEX eq_start ON test_table (start_ts) WHERE id = g_id The ideal combination might be to create a partial GIST index :) (I don't think the end_ts in the index is buying you much, despite its appearance in the Index Cond in the plan.) -- greg From pgsql-performance-owner@postgresql.org Sat Mar 4 04:15:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4630F9DCD15 for ; Sat, 4 Mar 2006 04:15: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 85273-01 for ; Sat, 4 Mar 2006 04:15:11 -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 741D89DCD4E for ; Sat, 4 Mar 2006 04:15:04 -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 1FFRup-00042y-00; Sat, 04 Mar 2006 03:15:03 -0500 To: Greg Stark Cc: Alex Adriaanse , pgsql-performance@postgresql.org Subject: Re: Bad row estimates References: <4408E91C.90104@innovacomputing.com> <87wtfasng0.fsf@stark.xeocode.com> In-Reply-To: <87wtfasng0.fsf@stark.xeocode.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 04 Mar 2006 03:15:02 -0500 Message-ID: <87r75isk1l.fsf@stark.xeocode.com> Lines: 16 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.129 required=5 tests=[AWL=0.129] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200603/20 X-Sequence-Number: 17457 Greg Stark writes: > The "now() BETWEEN test_table_1.start_ts AND test_table_1.end_ts can't be > answered completely using a btree index. You could try using a GIST index here > but I'm not clear how much it would help you (or how much work it would be). To add to my own comment you could also try creating two separate indexes on start_ts and end_ts. Postgres can combine the two indexes using a bitmap scan. It's not a complete solution like a GIST index would be though. It also doesn't help at all with the planner estimating how many records will actually match. -- greg From pgsql-performance-owner@postgresql.org Sat Mar 4 05:58:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BA71B9DC99E for ; Sat, 4 Mar 2006 05:58: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 01239-02 for ; Sat, 4 Mar 2006 05:58:09 -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 BDC629DC942 for ; Sat, 4 Mar 2006 05:58:04 -0400 (AST) Received: obelix 172.31.0.1 from 172.31.1.4 172.31.1.4 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 04 Mar 2006 10:58:03 +0100 Subject: How to query and index for customer with lastname and city From: Joost Kraaijeveld To: Pgsql-Performance Content-Type: multipart/alternative; boundary="=-tJT4+j40YrxwA9R+Imeb" Date: Sat, 04 Mar 2006 10:58:03 +0100 Message-Id: <1141466283.6729.17.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.086 required=5 tests=[AWL=0.084, HTML_MESSAGE=0.001, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.086 X-Spam-Level: X-Archive-Number: 200603/21 X-Sequence-Number: 17458 --=-tJT4+j40YrxwA9R+Imeb Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, I have two tables: Customer: objectid, lastname, fk_address Address: objectid, city I want to select all customers with a name >= some_name and living in a city >= some_city, all comparisons case insensitive Below is what I actually have. Given the fact that it takes forever to get a result (> 6 seconds) , there must be something wrong with my solution or my expectation. Can anyone tell what I should do to make this query go faster ( or convince me to wait for the result ;-()? SELECT customers.objectid FROM prototype.customers,prototype.addresses WHERE customers.contactAddress = addresses.objectId AND ( TRIM(UPPER(lastName)) >= TRIM(UPPER('some_name')) AND TRIM(UPPER(city)) >= TRIM(UPPER('some_city')) ) order by TRIM(UPPER(lastname)), TRIM(UPPER(city)) Explain analyze after a full alayse vacuum: Sort (cost=54710.68..54954.39 rows=97484 width=111) (actual time=7398.971..7680.405 rows=96041 loops=1) Sort Key: btrim(upper(customers.lastname)), btrim(upper(addresses.city)) -> Hash Join (cost=14341.12..46632.73 rows=97484 width=111) (actual time=1068.862..5472.788 rows=96041 loops=1) Hash Cond: ("outer".contactaddress = "inner".objectid) -> Seq Scan on customers (cost=0.00..24094.01 rows=227197 width=116) (actual time=0.018..1902.646 rows=223990 loops=1) Filter: (btrim(upper(lastname)) >= 'JANSEN'::text) -> Hash (cost=13944.94..13944.94 rows=158473 width=75) (actual time=1068.467..1068.467 rows=158003 loops=1) -> Bitmap Heap Scan on addresses (cost=1189.66..13944.94 rows=158473 width=75) (actual time=71.259..530.986 rows=158003 loops=1) Recheck Cond: (btrim(upper(city)) >= 'NIJMEGEN'::text) -> Bitmap Index Scan on prototype_addresses_trim_upper_city (cost=0.00..1189.66 rows=158473 width=0) (actual time=68.290..68.290 rows=158003 loops=1) Index Cond: (btrim(upper(city)) >= 'NIJMEGEN'::text) Total runtime: 7941.095 ms I have indices on : fki_customers_addresses customer.lastname (both lastname and trim(uppercase(lastname)) addresses.city (both city and trim(uppercase(city)) I -- 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 --=-tJT4+j40YrxwA9R+Imeb Content-Type: text/html; charset=utf-8 Hi,

I have two tables:

Customer: objectid, lastname, fk_address
Address: objectid, city

I want to select all customers with a name >= some_name and living in a city >= some_city, all comparisons case insensitive

Below is what I actually have. Given the fact that it takes forever to get a result (> 6 seconds) , there must be something wrong with my solution or my expectation. Can anyone tell what I should do to make this query go faster ( or convince me to wait for the result ;-()?


SELECT customers.objectid FROM prototype.customers,prototype.addresses
WHERE
customers.contactAddress = addresses.objectId
AND
(
TRIM(UPPER(lastName)) >= TRIM(UPPER('some_name'))
AND
TRIM(UPPER(city)) >= TRIM(UPPER('some_city'))

order by TRIM(UPPER(lastname)), TRIM(UPPER(city))

Explain analyze after a full alayse vacuum:

Sort  (cost=54710.68..54954.39 rows=97484 width=111) (actual time=7398.971..7680.405 rows=96041 loops=1)
  Sort Key: btrim(upper(customers.lastname)), btrim(upper(addresses.city))
  ->  Hash Join  (cost=14341.12..46632.73 rows=97484 width=111) (actual time=1068.862..5472.788 rows=96041 loops=1)
        Hash Cond: ("outer".contactaddress = "inner".objectid)
        ->  Seq Scan on customers  (cost=0.00..24094.01 rows=227197 width=116) (actual time=0.018..1902.646 rows=223990 loops=1)
              Filter: (btrim(upper(lastname)) >= 'JANSEN'::text)
        ->  Hash  (cost=13944.94..13944.94 rows=158473 width=75) (actual time=1068.467..1068.467 rows=158003 loops=1)
              ->  Bitmap Heap Scan on addresses  (cost=1189.66..13944.94 rows=158473 width=75) (actual time=71.259..530.986 rows=158003 loops=1)
                    Recheck Cond: (btrim(upper(city)) >= 'NIJMEGEN'::text)
                    ->  Bitmap Index Scan on prototype_addresses_trim_upper_city  (cost=0.00..1189.66 rows=158473 width=0) (actual time=68.290..68.290 rows=158003 loops=1)
                          Index Cond: (btrim(upper(city)) >= 'NIJMEGEN'::text)
Total runtime: 7941.095 ms


I have indices on :
fki_customers_addresses
customer.lastname (both lastname and trim(uppercase(lastname))
addresses.city (both city and trim(uppercase(city))

I


-- 
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

--=-tJT4+j40YrxwA9R+Imeb-- From pgsql-performance-owner@postgresql.org Sat Mar 4 09:49:43 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ED10E9DC9B9 for ; Sat, 4 Mar 2006 09:49: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 50167-08 for ; Sat, 4 Mar 2006 09:49:45 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from pproxy.gmail.com (pproxy.gmail.com [64.233.166.179]) by postgresql.org (Postfix) with ESMTP id EA0FD9DC9F8 for ; Sat, 4 Mar 2006 09:49:39 -0400 (AST) Received: by pproxy.gmail.com with SMTP id x31so469274pye for ; Sat, 04 Mar 2006 05:49:44 -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=lwxWf+yoghhiuOvC+QJx+JLtGRLQCYZ1htVpHsuDI+YD05+o+CMNajTg5vgdDZtTZR9ILUc1Khtb5Dp8vHdMDd6Dv0ZvyoRnMxik/5z9yM3B1Y5sDBQx02+QjXVy4z8vP84gJTD6W7hFzS7WFLHagjh72bI/diyQmczFNumzroE= Received: by 10.65.35.6 with SMTP id n6mr1925728qbj; Sat, 04 Mar 2006 05:49:44 -0800 (PST) Received: by 10.65.61.17 with HTTP; Sat, 4 Mar 2006 05:49:44 -0800 (PST) Message-ID: <9e4684ce0603040549n44e71c29jab72a45f5c440f9@mail.gmail.com> Date: Sat, 4 Mar 2006 14:49:44 +0100 From: "hubert depesz lubaczewski" To: "Joost Kraaijeveld" Subject: Re: How to query and index for customer with lastname and city Cc: Pgsql-Performance In-Reply-To: <1141466283.6729.17.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1141466283.6729.17.camel@localhost> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.883 required=5 tests=[AWL=-0.449, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.883 X-Spam-Level: X-Archive-Number: 200603/22 X-Sequence-Number: 17459 On 3/4/06, Joost Kraaijeveld wrote: > Below is what I actually have. Given the fact that it takes forever to g= et > a result (> 6 seconds) , there must be something wrong with my solution o= r > my expectation. Can anyone tell what I should do to make this query go > faster ( or convince me to wait for the result ;-()? > Explain analyze after a full alayse vacuum: > Sort (cost=3D54710.68..54954.39 rows=3D97484 width=3D111) (actual > time=3D7398.971..7680.405 rows=3D96041 loops=3D1) > Sort Key: btrim(upper(customers.lastname)), btrim(upper(addresses.city= )) > -> Hash Join (cost=3D14341.12..46632.73 rows=3D97484 width=3D111) (a= ctual > time=3D1068.862..5472.788 rows=3D96041 loops=3D1) > Hash Cond: ("outer".contactaddress =3D "inner".objectid) > -> Seq Scan on customers (cost=3D0.00..24094.01 rows=3D227197 > width=3D116) (actual time=3D0.018..1902.646 rows=3D223990 loops=3D1) > Filter: (btrim(upper(lastname)) >=3D 'JANSEN'::text) > -> Hash (cost=3D13944.94..13944.94 rows=3D158473 width=3D75) (= actual > time=3D1068.467..1068.467 rows=3D158003 loops=3D1) > -> Bitmap Heap Scan on addresses (cost=3D1189.66..13944.= 94 > rows=3D158473 width=3D75) (actual time=3D71.259..530.986 rows=3D158003 lo= ops=3D1) > Recheck Cond: (btrim(upper(city)) >=3D 'NIJMEGEN'::t= ext) > -> Bitmap Index Scan on > prototype_addresses_trim_upper_city (cost=3D0.00..1189.66 > rows=3D158473 width=3D0) (actual time=3D68.290..68.290 rows=3D158003 loop= s=3D1) > Index Cond: (btrim(upper(city)) >=3D > 'NIJMEGEN'::text) > Total runtime: 7941.095 ms explain clearly shows, that index is used for addresses scan, but it is not so for users. explain estimates that 227197 customers match the lastname criteria - which looks awfuly high. how many record do you have in the customers table? i would try to create index test on customers(contactAddress, trim(uppercase(lastname))); or with other ordring of fields. try this - create the index, make analyze of customers table, and recheck explain. then try the second index in the same manner. maybe this could of some help... depesz From pgsql-performance-owner@postgresql.org Sat Mar 4 10:18:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6CE139DC9F8 for ; Sat, 4 Mar 2006 10:18: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 53383-09 for ; Sat, 4 Mar 2006 10:18:27 -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 C81969DC9E7 for ; Sat, 4 Mar 2006 10:18:20 -0400 (AST) Received: obelix 172.31.0.1 from 172.31.1.4 172.31.1.4 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 04 Mar 2006 15:18:23 +0100 Subject: Re: How to query and index for customer with lastname From: Joost Kraaijeveld To: hubert depesz lubaczewski Cc: Pgsql-Performance In-Reply-To: <9e4684ce0603040549n44e71c29jab72a45f5c440f9@mail.gmail.com> References: <1141466283.6729.17.camel@localhost> <9e4684ce0603040549n44e71c29jab72a45f5c440f9@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 04 Mar 2006 15:18:23 +0100 Message-Id: <1141481903.10078.14.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.086 required=5 tests=[AWL=0.085, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.086 X-Spam-Level: X-Archive-Number: 200603/23 X-Sequence-Number: 17460 Hi Hubert, On Sat, 2006-03-04 at 14:49 +0100, hubert depesz lubaczewski wrote: > > Sort (cost=54710.68..54954.39 rows=97484 width=111) (actual > > time=7398.971..7680.405 rows=96041 loops=1) > > Sort Key: btrim(upper(customers.lastname)), btrim(upper(addresses.city)) > > -> Hash Join (cost=14341.12..46632.73 rows=97484 width=111) (actual time=1068.862..5472.788 rows=96041 loops=1) > > Hash Cond: ("outer".contactaddress = "inner".objectid) > > -> Seq Scan on customers (cost=0.00..24094.01 rows=227197 width=116) (actual time=0.018..1902.646 rows=223990 loops=1) > > Filter: (btrim(upper(lastname)) >= 'JANSEN'::text) > > -> Hash (cost=13944.94..13944.94 rows=158473 width=75) (actual time=1068.467..1068.467 rows=158003 loops=1) > > -> Bitmap Heap Scan on addresses (cost=1189.66..13944.94 rows=158473 width=75) (actual time=71.259..530.986 rows=158003 loops=1) > > Recheck Cond: (btrim(upper(city)) >= 'NIJMEGEN'::text) > > -> Bitmap Index Scan on prototype_addresses_trim_upper_city (cost=0.00..1189.66 rows=158473 width=0) (actual time=68.290..68.290 rows=158003 loops=1) > > Index Cond: (btrim(upper(city)) >=> 'NIJMEGEN'::text) > > Total runtime: 7941.095 ms > > explain clearly shows, that index is used for addresses scan, but it Yes, but I do not understand why I have both a "Bitmap Index Scan" and a "Bitmap Heap Scan" on (btrim(upper(city)) >=> 'NIJMEGEN'::text)? > is not so for users. > explain estimates that 227197 customers match the lastname criteria - > which looks awfuly high. > how many record do you have in the customers table? 368915 of which 222465 actually meet the condition. >From what I understand from the mailing list, PostgreSQL prefers a table scan whenever it expects that the number of records in the resultset will be ~ > 10 % of the total number of records in the table. Which explains the table scan for customers, but than again, it does not explain why it uses the index on addresses: it has 369337 addresses of which 158003 meet the condition > i would try to create index test on customers(contactAddress, > trim(uppercase(lastname))); > or with other ordring of fields. > > try this - create the index, make analyze of customers table, and > recheck explain. > then try the second index in the same manner. Makes no difference. -- 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 Sat Mar 4 10:23:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3D5A59DCC70 for ; Sat, 4 Mar 2006 10: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 56167-03 for ; Sat, 4 Mar 2006 10:23:10 -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 22D359DCC07 for ; Sat, 4 Mar 2006 10:23:03 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i11so1096947wra for ; Sat, 04 Mar 2006 06:23:08 -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=qFsAtkVwrX+3jwNqkPsI1kWxFoAJghZK8Vxo4FXzLK7bS5MvahCsaDZO5FsPOSG8nAlQ2a6G2QpHcTpAxjmDgHtywT8d1mXA6TkNV2MHb6cKrxR7LRoGOIZZZFy7Y/8qV4C/cpZS45lidxUH1/OnwqS1wZey8aNUD28rB0CR1uI= Received: by 10.65.212.3 with SMTP id o3mr1946493qbq; Sat, 04 Mar 2006 06:23:08 -0800 (PST) Received: by 10.65.61.17 with HTTP; Sat, 4 Mar 2006 06:23:08 -0800 (PST) Message-ID: <9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com> Date: Sat, 4 Mar 2006 15:23:08 +0100 From: "hubert depesz lubaczewski" To: "Joost Kraaijeveld" Subject: Re: How to query and index for customer with lastname and city Cc: Pgsql-Performance In-Reply-To: <1141481903.10078.14.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1141466283.6729.17.camel@localhost> <9e4684ce0603040549n44e71c29jab72a45f5c440f9@mail.gmail.com> <1141481903.10078.14.camel@localhost> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.241 required=5 tests=[AWL=0.241] X-Spam-Score: 0.241 X-Spam-Level: X-Archive-Number: 200603/24 X-Sequence-Number: 17461 On 3/4/06, Joost Kraaijeveld wrote: > > how many record do you have in the customers table? > 368915 of which 222465 actually meet the condition. > >From what I understand from the mailing list, PostgreSQL prefers a table > scan whenever it expects that the number of records in the resultset > will be ~ > 10 % of the total number of records in the table. Which > explains the table scan for customers, but than again, it does not > explain why it uses the index on addresses: it has 369337 addresses of > which 158003 meet the condition bitmap index scan is faster than sequential table scan. that's all. it was introduced in 8.1 as far as i remember. basically - i doubt if you can get better performace from query when the result row-count is that high. out of curiosity though - why do you need so many rows? it's not possible to view them, nor do anything meaningful with 200 thousand rows! depesz From pgsql-performance-owner@postgresql.org Sat Mar 4 11:46:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 69C8E9DCB87 for ; Sat, 4 Mar 2006 11:46: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 70693-03 for ; Sat, 4 Mar 2006 11:46:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 4F8539DCB6C for ; Sat, 4 Mar 2006 11:46:16 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 62E4B5647D; Sat, 4 Mar 2006 09:46:06 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Sat, 4 Mar 2006 09:46:05 -0600 Date: Sat, 4 Mar 2006 09:46:05 -0600 From: "Jim C. Nasby" To: Greg Stark Cc: Alex Adriaanse , pgsql-performance@postgresql.org Subject: Re: Bad row estimates Message-ID: <20060304154605.GC80721@pervasive.com> References: <4408E91C.90104@innovacomputing.com> <87wtfasng0.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wtfasng0.fsf@stark.xeocode.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060304:gsstark@mit.edu::y2TyZ+Z5TLA1gEOk:000V87 X-Hashcash: 1:20:060304:alex@innovacomputing.com::mhtySMQYjSE/M9Bu:0000000000000 00000000000000000000000093ym X-Hashcash: 1:20:060304:pgsql-performance@postgresql.org::ex9wm2xL/8A6lj2t:00000 0000000000000000000000006HGS X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/25 X-Sequence-Number: 17462 On Sat, Mar 04, 2006 at 02:01:35AM -0500, Greg Stark wrote: > Alex Adriaanse writes: > > > SELECT count(*) FROM test_table_1 > > INNER JOIN test_table_2 ON > > (test_table_2.s_id = 13300613 AND test_table_1.id = test_table_2.n_id) > > WHERE now() BETWEEN test_table_1.start_ts AND test_table_1.end_ts > > AND test_table_1.id = test_table_1.g_id; Something else that helps in cases like this is to place both an upper and lower boundary on one (or both) fields if possible. For example, if you know that start_ts and end_ts will always be within 1 hour of each other, adding the following will help: AND start_ts >= now()-'1 hour'::interval AND end_ts <= now()+'1 hour'::interval -- 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 Sat Mar 4 12:10:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7147B9DCB97 for ; Sat, 4 Mar 2006 12:10: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 76385-05 for ; Sat, 4 Mar 2006 12:10: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 136279DCADB for ; Sat, 4 Mar 2006 12:10:03 -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 k24G9xwq014851; Sat, 4 Mar 2006 11:09:59 -0500 (EST) To: Greg Stark cc: Alex Adriaanse , pgsql-performance@postgresql.org Subject: Re: Bad row estimates In-reply-to: <87wtfasng0.fsf@stark.xeocode.com> References: <4408E91C.90104@innovacomputing.com> <87wtfasng0.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "04 Mar 2006 02:01:35 -0500" Date: Sat, 04 Mar 2006 11:09:59 -0500 Message-ID: <14850.1141488599@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/26 X-Sequence-Number: 17463 Greg Stark writes: > (I don't think the end_ts in the index is buying you much, despite its > appearance in the Index Cond in the plan.) Well, it saves some trips to the heap, but the indexscan is still going to run from the beginning of the index to start_ts = now(), because btree has no idea that there's any correlation between the two index columns. If you could put some a-priori bound on the interval width, you could add a WHERE constraint "AND now() - max_width <= start_ts", which'd constrain the index scan and possibly also get you a better planner estimate. Otherwise I think you really need a special datatype for time intervals and a GIST or r-tree index on it :-(. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Mar 4 14:11:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A31BE9DCBD1 for ; Sat, 4 Mar 2006 14:11: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 16266-09 for ; Sat, 4 Mar 2006 14:11:21 -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 1BF449DCAC5 for ; Sat, 4 Mar 2006 14:11:16 -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 1FFbDl-0006sz-00; Sat, 04 Mar 2006 13:11:13 -0500 To: Tom Lane Cc: Greg Stark , Alex Adriaanse , pgsql-performance@postgresql.org Subject: Re: Bad row estimates References: <4408E91C.90104@innovacomputing.com> <87wtfasng0.fsf@stark.xeocode.com> <14850.1141488599@sss.pgh.pa.us> In-Reply-To: <14850.1141488599@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 04 Mar 2006 13:11:13 -0500 Message-ID: <87fylyrsfy.fsf@stark.xeocode.com> Lines: 28 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.129 required=5 tests=[AWL=0.129] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200603/27 X-Sequence-Number: 17464 Tom Lane writes: > Otherwise I think you really need a special datatype for time > intervals and a GIST or r-tree index on it :-(. You could actually take short cuts using expression indexes to do this. If it works out well then you might want to implement a real data type to avoid the overhead of the SQL conversion functions. Here's an example. If I were to do this for real I would look for a better datatype than the box datatype and I would wrap the whole conversion in an SQL function. But this will serve to demonstrate: stark=> create table interval_test (start_ts timestamp with time zone, end_ts timestamp with time zone); CREATE TABLE stark=> create index interval_idx on interval_test using gist (box(point(start_ts::abstime::integer, end_ts::abstime::integer) , point(start_ts::abstime::integer, end_ts::abstime::integer))); CREATE INDEX stark=> explain select * from interval_test where box(point(now()::abstime::integer,now()::abstime::integer),point(now()::abstime::integer,now()::abstime::integer)) ~ box(point(start_ts::abstime::integer, end_ts::abstime::integer) , point(start_ts::abstime::integer, end_ts::abstime::integer)); QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Index Scan using interval_idx on interval_test (cost=0.07..8.36 rows=2 width=16) Index Cond: (box(point((((now())::abstime)::integer)::double precision, (((now())::abstime)::integer)::double precision), point((((now())::abstime)::integer)::double precision, (((now())::abstime)::integer)::double precision)) ~ box(point((((start_ts)::abstime)::integer)::double precision, (((end_ts)::abstime)::integer)::double precision), point((((start_ts)::abstime)::integer)::double precision, (((end_ts)::abstime)::integer)::double precision))) (2 rows) -- greg From pgsql-performance-owner@postgresql.org Sat Mar 4 17:27:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2664D9DCDEC for ; Sat, 4 Mar 2006 17: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 52955-10 for ; Sat, 4 Mar 2006 17:27:39 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by postgresql.org (Postfix) with ESMTP id 716549DCD89 for ; Sat, 4 Mar 2006 17:27:36 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i13so1140490wra for ; Sat, 04 Mar 2006 13:27:38 -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=s7PdEW2RzIV2iaqyUnncr2NB9lDYsZYGZpJA5QSNp+agzPN7GJgkIEB00bQ0dFHkiUarLJ1445SkXyH2XJ4xZbXvYG4iw7Aqp0F0Zc7ap1dwhEBasurEwPCU22voe7I/9+W7jsdPfZOWHOf21qgCXhXlQmMU5TtmuFP9hN4xzWU= Received: by 10.54.135.19 with SMTP id i19mr487274wrd; Sat, 04 Mar 2006 13:27:38 -0800 (PST) Received: from ?10.0.2.2? ( [200.62.104.176]) by mx.gmail.com with ESMTP id g3sm3636038wra.2006.03.04.13.27.37; Sat, 04 Mar 2006 13:27:38 -0800 (PST) From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: How to query and index for customer with lastname and city Date: Sat, 4 Mar 2006 15:35:17 -0600 User-Agent: KMail/1.8.3 References: <1141466283.6729.17.camel@localhost> <1141481903.10078.14.camel@localhost> <9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com> In-Reply-To: <9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603041535.17882.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: 200603/28 X-Sequence-Number: 17465 On Saturday 04 March 2006 08:23, hubert depesz lubaczewski wrote: > On 3/4/06, Joost Kraaijeveld wrote: > > > how many record do you have in the customers table? > > > > 368915 of which 222465 actually meet the condition. > > > > >From what I understand from the mailing list, PostgreSQL prefers a table > > > > scan whenever it expects that the number of records in the resultset > > will be ~ > 10 % of the total number of records in the table. Which > > explains the table scan for customers, but than again, it does not > > explain why it uses the index on addresses: it has 369337 addresses of > > which 158003 meet the condition > > bitmap index scan is faster than sequential table scan. that's all. it > was introduced in 8.1 as far as i remember. > basically - i doubt if you can get better performace from query when > the result row-count is that high. > > out of curiosity though - why do you need so many rows? it's not > possible to view them, nor do anything meaningful with 200 thousand > rows! > > depesz If you're just displaying, use limit and offset to grab one page at a time. If you're manipulating it would be a good idea to do something in a stored procedure. From pgsql-performance-owner@postgresql.org Sun Mar 5 17:06:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 838109DCBFA for ; Sun, 5 Mar 2006 17:06: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 14378-07 for ; Sun, 5 Mar 2006 17:06:52 -0400 (AST) X-Greylist: delayed 00:06:40.186455 by SQLgrey- Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id 6CC3D9DCBB4 for ; Sun, 5 Mar 2006 17:06:46 -0400 (AST) Received: (qmail 9498 invoked from network); 5 Mar 2006 22:00:26 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 5 Mar 2006 22:00:26 +0100 Date: Sun, 05 Mar 2006 22:00:25 +0100 To: pgsql-performance@postgresql.org Subject: Planner enhancement suggestion. From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/29 X-Sequence-Number: 17466 Bitmap index scan is bliss. Many thanks to the postgres team ! Now searching in tables with a lot of fields and conditions is no longer a pain. And just a thought : SELECT * FROM table WHERE category IN (1,2,3) ORDER BY price LIMIT 10; Suppose you have an index on category, and another index on price. Depending on the stats postgres has about the values, you'll either get : 0- seq scan + sort 1- Plain or Bitmap Index scan using "category", then sort by "price" 2- Index scan on "price", Filter on "category IN (1,2,3)", no sort. 1 is efficient if the category is rare. Postgres knows this and uses this plan well. Without a LIMIT, option 1 should be preferred. 2 is efficient if the items in the categories 1,2,3 are cheap (close to the start of the index on price). However if the items in question are on the other side of the index, it will index-scan a large part of the table. This can be a big hit. Postgres has no stats about the correlation of "category" and "price", so it won't know when there is going to be a problem. Another option would be interesting. It has two steps : - Build a bitmap using the index on "category" (just like in case 1) so we know which pages on the table have relevant rows - Index scan on "price", but only looking in the heap for pages which are flagged in the bitmap, and then "Recheck Cond" on "category". In other words, do an index scan to get the rows in the right order, but don't bother to check the heap for pages where the bitmap says there are no rows. In the worst case, you still have to run through the entire index, but at least not through the entire table ! It can also speed up some merge joins. What do you think ? From pgsql-performance-owner@postgresql.org Mon Mar 6 05:05:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DAA0F9DCA1A for ; Mon, 6 Mar 2006 05:05: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 70840-03 for ; Mon, 6 Mar 2006 05:05: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 B4A949DC800 for ; Mon, 6 Mar 2006 05:05:43 -0400 (AST) Received: by zproxy.gmail.com with SMTP id x7so1161437nzc for ; Mon, 06 Mar 2006 01:05: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:mime-version:content-type:content-transfer-encoding:content-disposition; b=aN6E5ZlqVXw2TIKK+AUZ62lPwMRPjdHik79sR7VXyKWePqPfZi0kvbNMrtCpFtNrL8gkU49f78rMbzKr8pW4wZNyd8n091rFkpqGzMN1QRwR07nWmjZZPD9rw8KwcGN+PD0a9AdTghdkZ+2p7wukB8fMwG+s1CEESlXBdingbMg= Received: by 10.65.20.17 with SMTP id x17mr2411861qbi; Mon, 06 Mar 2006 01:05:45 -0800 (PST) Received: by 10.65.216.18 with HTTP; Mon, 6 Mar 2006 01:05:45 -0800 (PST) Message-ID: Date: Mon, 6 Mar 2006 10:05:45 +0100 From: "Claus Guttesen" To: "Postgresql Performance" Subject: t1000/t2000 sun-servers 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.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200603/30 X-Sequence-Number: 17467 Hi. Has anybody tried the new Sun "cool-thread" servers t1000/t2000 from Sun? I'd love to see benchmarks with Solaris 10 and pg 8.1. regards Claus From pgsql-performance-owner@postgresql.org Mon Mar 6 09:28:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 858AD9DCB94 for ; Mon, 6 Mar 2006 09:28: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 15628-08 for ; Mon, 6 Mar 2006 09:28:03 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by postgresql.org (Postfix) with ESMTP id 719029DCA22 for ; Mon, 6 Mar 2006 09:27:58 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i7so1364378wra for ; Mon, 06 Mar 2006 05:28:02 -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=hahOGNIM6kLDgVfMM+VVLKDpPBL7h7YgE1rC/Pp/bhO/P09UP3ZH8iXnOt4jRFWViMlKzQ+b/Z31Yp+LtGJipnXnJvGQ/EqgHP/QtQy/hQDp11JGLUhFHJ+2uTfivr9Qil3HdN8gvHjMyEcSkDyGkQqieIgRmlXiIuz7UWaiieU= Received: by 10.65.133.18 with SMTP id k18mr2582153qbn; Mon, 06 Mar 2006 05:28:02 -0800 (PST) Received: by 10.65.148.13 with HTTP; Mon, 6 Mar 2006 05:28:02 -0800 (PST) Message-ID: Date: Mon, 6 Mar 2006 05:28:02 -0800 From: "Nagita Karunaratne" To: pgsql-performance@postgresql.org Subject: Postgres on VPS - how much is enough? 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/31 X-Sequence-Number: 17468 How big a VPS would I need to run a Postgres DB. I need a Postgres database with about 15 tables that will run on a single virtual private server. The 15 tables will be spread over three tablespaces (5 tables per tablespace) and be accessed by three different applications running on different machines. One application will add about 500 orders per day Another will access this data to create and send about 500 emails per day A third will access this data to create an after-sales survey for at most 500 times per day. What type of VPS would I need to run a database with this type pf load? Is 128 MB ram enough? What percentage of a 2.8 GHz CPU would be required? It's been a long time since I used Postgres. Thanks for any help, Nagita From pgsql-performance-owner@postgresql.org Mon Mar 6 10:30:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9E64E9DCC81 for ; Mon, 6 Mar 2006 10:30: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 28591-01-3 for ; Mon, 6 Mar 2006 10:30:43 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.196]) by postgresql.org (Postfix) with ESMTP id 5EC499DCBB7 for ; Mon, 6 Mar 2006 10:30:37 -0400 (AST) Received: by nproxy.gmail.com with SMTP id m19so821219nfc for ; Mon, 06 Mar 2006 06:30: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=QwaGY6IPr6bZqsXW8Ns7btlMz5DiynvmVKK6nYl6PyI5VeTyAQXLR0RGm1MYziGoK187cFm1VDRZh5CAgnPOzQNEDFP2B8rkWbyookjzu1X9x4FLQGz32HHR/gv13YlScn/1lmNTPR9DUHoYYwKQ86S7qIPvrTToRM9oHJLjcQw= Received: by 10.48.232.9 with SMTP id e9mr2433141nfh; Mon, 06 Mar 2006 06:30:41 -0800 (PST) Received: by 10.49.17.5 with HTTP; Mon, 6 Mar 2006 06:30:41 -0800 (PST) Message-ID: Date: Mon, 6 Mar 2006 14:30:41 +0000 From: "Neil Saunders" To: "Claus Guttesen" Subject: Re: t1000/t2000 sun-servers Cc: "Postgresql Performance" 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.089 required=5 tests=[AWL=0.089] X-Spam-Score: 0.089 X-Spam-Level: X-Archive-Number: 200603/32 X-Sequence-Number: 17469 I may be able to organize a test on a T2000 if someone could give advice as to an appropriate test to run... Cheers, Neil On 3/6/06, Claus Guttesen wrote: > Hi. > > Has anybody tried the new Sun "cool-thread" servers t1000/t2000 from > Sun? I'd love to see benchmarks with Solaris 10 and pg 8.1. > > regards > Claus > > ---------------------------(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 Mon Mar 6 10:38:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 13D409DCC81 for ; Mon, 6 Mar 2006 10:38: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 29526-03 for ; Mon, 6 Mar 2006 10:38:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id B2F9D9DCC86 for ; Mon, 6 Mar 2006 10:37:59 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id 1830EA068D for ; Mon, 6 Mar 2006 09:38:03 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 876D91213B2 for ; Mon, 6 Mar 2006 09:38:02 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05245-09 for ; Mon, 6 Mar 2006 09:38:02 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 674751213AC for ; Mon, 6 Mar 2006 09:38:02 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Hanging queries and I/O exceptions User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Disposition: inline X-UID: 1739 Date: Mon, 6 Mar 2006 09:38:00 -0500 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200603060938.00751.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.072 required=5 tests=[AWL=0.072] X-Spam-Score: 0.072 X-Spam-Level: X-Archive-Number: 200603/33 X-Sequence-Number: 17470 Hello, While doing performance tests on Windows Server 2003 we observed to followi= ng=20 two problems. Environment: J2EE application running in JBoss application server, against= =20 pgsql 8.1 database. Load is caused by a smallish number of (very) complex=20 transactions, typically about 5-10 concurrently. The first one, which bothers me the most, is that after about 6-8 hours the= =20 application stops processing. No errors are reported, neither by the JDBC=20 driver nor by the server, but when I kill the application server, I see tha= t=20 all my connections hang in a SQL statements (which never seem to return): 2006-03-03 08:17:12 4504 6632560 LOG: duration: 45087000.000 ms statement= :=20 EXECUTE [PREPARE: SELECT objID FROM objects WHERE objID =3D $1 = =46OR=20 UPDATE] I think I can reliably reproduce this by loading the app, and waiting a cou= ple=20 of hours. The second problem is less predictable: JDBC exception: An I/O error occured while sending to the backend. org.postgresql.util.PSQLException: An I/O error occured while sending to th= e=20 backend. at=20 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:214) at=20 org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.= java:430) at=20 org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2S= tatement.java:346) at=20 org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2State= ment.java:250) In my server log, I have: 2006-03-02 12:31:02 5692 6436342 LOG: could not receive data from client: = A=20 non-blocking socket operation could not be completed immediately. At the time my box is fairly heavy loaded, but still responsive. Server and= =20 JBoss appserver live on the same dual 2Ghz Opteron. A quick Google told me that: 1. More people have seen this. 2. No solutions. 3. The server message appears to indicate an unhandled WSAEWOULDBLOCK winso= ck=20 error on recv(), which MSDN said is to be expected and should be retried. Is this a known bug? jan=20 =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Mon Mar 6 10:56:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 023839DCC4C for ; Mon, 6 Mar 2006 10:56: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 33221-01 for ; Mon, 6 Mar 2006 10:56:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.207]) by postgresql.org (Postfix) with ESMTP id 29A809DCA8F for ; Mon, 6 Mar 2006 10:55:55 -0400 (AST) Received: by xproxy.gmail.com with SMTP id t11so797525wxc for ; Mon, 06 Mar 2006 06:56:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JjOPMxIlGFLLRi5ZF6NC6uszmtuCTliUyezj1qJJjHNhDtA6edokbKlGUwsNcEYJcQNcrbhIUjhIaAXdFDOBiI11aDOYuzHu5jyiUXCOzoitOaJneS4ced9XJmcSE3YmPR5v5Fi4NxEP8/zJpVBJN8YQRzgP2hcKZ9zfuJMgsEA= Received: by 10.70.54.13 with SMTP id c13mr7387389wxa; Mon, 06 Mar 2006 06:56:00 -0800 (PST) Received: by 10.70.128.2 with HTTP; Mon, 6 Mar 2006 06:56:00 -0800 (PST) Message-ID: Date: Mon, 6 Mar 2006 08:56:00 -0600 From: "Matthew Nuzum" Reply-To: newz@bearfruit.org To: "Nagita Karunaratne" Subject: Re: Postgres on VPS - how much is enough? 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/34 X-Sequence-Number: 17471 On 3/6/06, Nagita Karunaratne wrote: > How big a VPS would I need to run a Postgres DB. > > One application will add about 500 orders per day > Another will access this data to create and send about 500 emails per da= y > A third will access this data to create an after-sales survey for at > most 500 times per day. > > What type of VPS would I need to run a database with this type pf load? > Is 128 MB ram enough? > What percentage of a 2.8 GHz CPU would be required? My problem with running PG inside of a VPS was that the VPS used a virtual filesystem... basically, a single file that had been formatted and loop mounted so that it looked like a regular hard drive. Unfortunately, it was very slow. The difference between my application and yours is that mine well more than filled the 1GB of RAM that I had allocated. If your data will fit comfortably into RAM then you may be fine. If you really want to know how it will work, try running it yourself. Two projects that make this really easy and free is the colinux project[1] which allows you to run a linux VPS in Windows and the linux-vserver project[2] which is free software that works on pretty much any linux OS. Try it out, tinker with the values and that way you won't have to guess when making your purchase decission. [1] http://www.colinux.org/ Coperative Linux [2] http://linux-vserver.org/ Linux-vserver project -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Mon Mar 6 11:23:24 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 541319DCA1D for ; Mon, 6 Mar 2006 11:23: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 35878-09 for ; Mon, 6 Mar 2006 11:23:28 -0400 (AST) X-Greylist: delayed 00:07:18.309957 by SQLgrey- Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [63.240.77.83]) by postgresql.org (Postfix) with ESMTP id 800D69DCA06 for ; Mon, 6 Mar 2006 11:23:20 -0400 (AST) Received: from [192.168.0.51] (c-24-8-249-24.hsd1.co.comcast.net[24.8.249.24]) by comcast.net (sccrmhc13) with ESMTP id <20060306151605013001ulfue>; Mon, 6 Mar 2006 15:16:06 +0000 Message-ID: <440C534C.3050300@drule.org> Date: Mon, 06 Mar 2006 08:20:44 -0700 From: Kevin User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Postgres on VPS - how much is enough? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/35 X-Sequence-Number: 17472 Nagita Karunaratne wrote: > How big a VPS would I need to run a Postgres DB. > > I need a Postgres database with about 15 tables that will run on a > single virtual private server. > > The 15 tables will be spread over three tablespaces (5 tables per > tablespace) and be accessed by three different applications running on > different machines. > > One application will add about 500 orders per day > Another will access this data to create and send about 500 emails per day > A third will access this data to create an after-sales survey for at > most 500 times per day. > > What type of VPS would I need to run a database with this type pf load? > Is 128 MB ram enough? > What percentage of a 2.8 GHz CPU would be required? > If the database is going to be larger then the allocated memory, disk I/O is very important. Not all VPS technologies are equal in this regard. (see link below) Like someone else suggested, the best way to know what VPS specs you need is to do your own tests/benchamarks. http://www.cl.cam.ac.uk/Research/SRG/netos/xen/performance.html -Kevin From pgsql-performance-owner@postgresql.org Mon Mar 6 11:29:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B51249DC83A for ; Mon, 6 Mar 2006 11:29: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 38449-04 for ; Mon, 6 Mar 2006 11:29:53 -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 B6E1B9DC81D for ; Mon, 6 Mar 2006 11:29:46 -0400 (AST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Can anyone explain this pgbench results? Date: Mon, 6 Mar 2006 16:29:49 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Can anyone explain this pgbench results? Thread-Index: AcZBMs5xk+eU/7AzRiepVZHgMpuyjQ== From: "Joost Kraaijeveld" To: "Pgsql-Performance (E-mail)" 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: 200603/36 X-Sequence-Number: 17473 Hi, Below are some results of running pgbench, run on a machine that is = doing nothing else than running PostgreSQL woth pgbench. The strange = thing is that the results are *constantly alternating* hight (750-850 = transactions)and low (50-80 transactions), no matter how many test I = run. If I wait a long time (> 5 minutes) after running the test, I = always get a hight score, followed by a low one, followed by a high one, = low one etc.=20 I was expecting a low(ish) score the first run (because the tables are = not loaded in the cache yet), followed by continues high(ish) scores, = but not an alternating pattern. I also did not expect so much = difference, given the hardware I have (Dual Opteron, 4GB memory , 3Ware = SATA RAID5 with 5 disks, seerate swap and pg_log disks). Anyone any idea? Results of pgbench: postgres@panoramix:/usr/lib/postgresql/8.1/bin$ ./pgbench -c 10 -t 150 = test starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 100 number of clients: 10 number of transactions per client: 150 number of transactions actually processed: 1500/1500 tps =3D 50.651705 (including connections establishing) tps =3D 50.736338 (excluding connections establishing) postgres@panoramix:/usr/lib/postgresql/8.1/bin$ ./pgbench -c 10 -t 150 = test starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 100 number of clients: 10 number of transactions per client: 150 number of transactions actually processed: 1500/1500 tps =3D 816.972995 (including connections establishing) tps =3D 836.951755 (excluding connections establishing) postgres@panoramix:/usr/lib/postgresql/8.1/bin$ ./pgbench -c 10 -t 150 = test starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 100 number of clients: 10 number of transactions per client: 150 number of transactions actually processed: 1500/1500 tps =3D 42.924294 (including connections establishing) tps =3D 42.986747 (excluding connections establishing) postgres@panoramix:/usr/lib/postgresql/8.1/bin$ ./pgbench -c 10 -t 150 = test starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 100 number of clients: 10 number of transactions per client: 150 number of transactions actually processed: 1500/1500 tps =3D 730.651970 (including connections establishing) tps =3D 748.538852 (excluding connections establishing) 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=20 From pgsql-performance-owner@postgresql.org Mon Mar 6 12:52:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6689C9DC83A for ; Mon, 6 Mar 2006 12:52: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 53531-03 for ; Mon, 6 Mar 2006 12:52:49 -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 4947F9DC860 for ; Mon, 6 Mar 2006 12:52:48 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i12so1425147wra for ; Mon, 06 Mar 2006 08:52:44 -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=hZvM4pn6ssRCFA24qGj0jvca+ZAeUuXpBaEJiPBnS1IiatonKqawxOj+Fl+H7Fz51r9Y+Z+iOaog1h9BtaowdK1UZW8YW8Ah3UWykL2UXLCxw4NivWpQR61YUDiPwjYTJEeOLVCjjLFR6atf3VchGnsbH44JMBr6P59CyB/6VeI= Received: by 10.65.147.13 with SMTP id z13mr1737896qbn; Mon, 06 Mar 2006 08:52:44 -0800 (PST) Received: by 10.65.148.13 with HTTP; Mon, 6 Mar 2006 08:52:44 -0800 (PST) Message-ID: Date: Mon, 6 Mar 2006 08:52:44 -0800 From: "Nagita Karunaratne" To: pgsql-performance@postgresql.org Subject: Re: Postgres on VPS - how much is enough? 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/37 X-Sequence-Number: 17474 Thanks for the replies, From personal experience, would you run Postgres on a linux machine (NOT a vps) with 512MB of ram? Assumining I can keep all my data in memory. Thanks, Nagita > My problem with running PG inside of a VPS was that the VPS used a > virtual filesystem... basically, a single file that had been formatted > and loop mounted so that it looked like a regular hard drive. > Unfortunately, it was very slow. The difference between my application > and yours is that mine well more than filled the 1GB of RAM that I had > allocated. If your data will fit comfortably into RAM then you may be > fine. > From pgsql-performance-owner@postgresql.org Mon Mar 6 13:14:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 78CC69DC899 for ; Mon, 6 Mar 2006 13:14: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 56957-05 for ; Mon, 6 Mar 2006 13:14:50 -0400 (AST) Received: from hub.org (hub.org [200.46.204.220]) by postgresql.org (Postfix) with ESMTP id 49D839DC83A for ; Mon, 6 Mar 2006 13:14:49 -0400 (AST) Received: from localhost (unknown [200.46.204.144]) by hub.org (Postfix) with ESMTP id D7FCB62C982 for ; Mon, 6 Mar 2006 13:14:49 -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 56262-06; Mon, 6 Mar 2006 13:14:47 -0400 (AST) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 47FE962C967; Mon, 6 Mar 2006 13:14:47 -0400 (AST) Received: by ganymede.hub.org (Postfix, from userid 1000) id 013AA3ACB0; Mon, 6 Mar 2006 13:14:45 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id B0E2F3AC48; Mon, 6 Mar 2006 13:14:45 -0400 (AST) Date: Mon, 6 Mar 2006 13:14:45 -0400 (AST) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: newz@bearfruit.org cc: Nagita Karunaratne , pgsql-performance@postgresql.org Subject: Re: Postgres on VPS - how much is enough? In-Reply-To: Message-ID: <20060306131355.A1227@ganymede.hub.org> References: 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.485 required=5 tests=[AWL=0.006, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.485 X-Spam-Level: X-Archive-Number: 200603/38 X-Sequence-Number: 17475 On Mon, 6 Mar 2006, Matthew Nuzum wrote: > On 3/6/06, Nagita Karunaratne wrote: >> How big a VPS would I need to run a Postgres DB. >> > >> One application will add about 500 orders per day >> Another will access this data to create and send about 500 emails per day >> A third will access this data to create an after-sales survey for at >> most 500 times per day. >> >> What type of VPS would I need to run a database with this type pf load? >> Is 128 MB ram enough? >> What percentage of a 2.8 GHz CPU would be required? > > My problem with running PG inside of a VPS was that the VPS used a > virtual filesystem... basically, a single file that had been formatted > and loop mounted so that it looked like a regular hard drive. > Unfortunately, it was very slow. The difference between my application > and yours is that mine well more than filled the 1GB of RAM that I had > allocated. If your data will fit comfortably into RAM then you may be > fine. We host VPSs here (http://www.hub.org) and don't use the 'single file, virtual file system' to put them into ... it must depend on where you host? ---- 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 Mon Mar 6 13:47:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 565989DCCF0 for ; Mon, 6 Mar 2006 13:47: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 65148-03 for ; Mon, 6 Mar 2006 13:47: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 E65A39DCCB1 for ; Mon, 6 Mar 2006 13:47: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 k26HlhBV085206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Mar 2006 10:47: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 k26HlhSB013878; Mon, 6 Mar 2006 10:47: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 k26HlgV1013877; Mon, 6 Mar 2006 10:47:42 -0700 (MST) (envelope-from mfuhr) Date: Mon, 6 Mar 2006 10:47:42 -0700 From: Michael Fuhr To: Joost Kraaijeveld Cc: "Pgsql-Performance (E-mail)" Subject: Re: Can anyone explain this pgbench results? Message-ID: <20060306174742.GA13788@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.122 required=5 tests=[AWL=0.122] X-Spam-Score: 0.122 X-Spam-Level: X-Archive-Number: 200603/39 X-Sequence-Number: 17476 On Mon, Mar 06, 2006 at 04:29:49PM +0100, Joost Kraaijeveld wrote: > Below are some results of running pgbench, run on a machine that > is doing nothing else than running PostgreSQL woth pgbench. The > strange thing is that the results are *constantly alternating* hight > (750-850 transactions)and low (50-80 transactions), no matter how > many test I run. If I wait a long time (> 5 minutes) after running > the test, I always get a hight score, followed by a low one, followed > by a high one, low one etc. The default checkpoint_timeout is 300 seconds (5 minutes). Is it coincidence that the "long time" between fast results is about the same? What's your setting? Are your test results more consistent if you execute CHECKPOINT between them? -- Michael Fuhr From pgsql-performance-owner@postgresql.org Mon Mar 6 14:46:10 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 873CB9DCCF0 for ; Mon, 6 Mar 2006 14:46: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 78834-04 for ; Mon, 6 Mar 2006 14:46:08 -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 862979DCBE1 for ; Mon, 6 Mar 2006 14:46:05 -0400 (AST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: Can anyone explain this pgbench results? Date: Mon, 6 Mar 2006 19:46:05 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can anyone explain this pgbench results? Thread-Index: AcZBRibUFf2iPhWTR12ol05GWGHHqgABZ6Tw From: "Joost Kraaijeveld" To: "Michael Fuhr" Cc: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.084 required=5 tests=[AWL=0.084] X-Spam-Score: 0.084 X-Spam-Level: X-Archive-Number: 200603/40 X-Sequence-Number: 17477 Hi Michael, Thanls for your response. Michael Fuhr wrote: > On Mon, Mar 06, 2006 at 04:29:49PM +0100, Joost Kraaijeveld wrote: >> Below are some results of running pgbench, run on a machine that >> is doing nothing else than running PostgreSQL woth pgbench. The >> strange thing is that the results are *constantly alternating* hight >> (750-850 transactions)and low (50-80 transactions), no matter how >> many test I run. If I wait a long time (> 5 minutes) after running >> the test, I always get a hight score, followed by a low one, followed >> by a high one, low one etc. >=20 > The default checkpoint_timeout is 300 seconds (5 minutes). Is it > coincidence that the "long time" between fast results is about the > same?=20 I have not measured the "long wait time". But I can run multiple test in = 3 minutes: the fast test lasts 3 sec, the long one 40 secs (see below). = During the tests there is not much activity on the partition where the = logfiles are (other controller and disk than the database and swap) postgres@panoramix:/usr/lib/postgresql/8.1/bin$ time ./pgbench -c 10 -t = 150 test starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 100 number of clients: 10 number of transactions per client: 150 number of transactions actually processed: 1500/1500 tps =3D 531.067258 (including connections establishing) tps =3D 541.694790 (excluding connections establishing) real 0m2.892s user 0m0.105s sys 0m0.145s postgres@panoramix:/usr/lib/postgresql/8.1/bin$ time ./pgbench -c 10 -t = 150 test starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 100 number of clients: 10 number of transactions per client: 150 number of transactions actually processed: 1500/1500 tps =3D 37.064000 (including connections establishing) tps =3D 37.114023 (excluding connections establishing) real 0m40.531s user 0m0.088s sys 0m0.132s >What's your setting? =20 Default. > Are your test results more consistent > if you execute CHECKPOINT between them? Could you tell me how I could do that? 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 Mon Mar 6 16:27:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 145209DC9FD for ; Mon, 6 Mar 2006 14:46: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 77960-07 for ; Mon, 6 Mar 2006 14:46:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from host130.twnc.com (host130.twnc.com [216.16.237.130]) by postgresql.org (Postfix) with ESMTP id BDD959DC98C for ; Mon, 6 Mar 2006 14:46:37 -0400 (AST) 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: Sequencial scan instead of using index Date: Mon, 6 Mar 2006 13:46:47 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Sequencial scan instead of using index Thread-Index: AcZBL+V/3Fe0/uYwSM+jxlxjuEUG9QAHlLQQ From: "Harry Hehl" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.168 required=5 tests=[AWL=0.168] X-Spam-Score: 0.168 X-Spam-Level: X-Archive-Number: 200603/45 X-Sequence-Number: 17482 There seems to be many posts on this issue but I not yet found an answer = to the seq scan issue. I am having an issue with a joins. I am using 8.0.3 on FC4=20 Query: select * from ommemberrelation where srcobj=3D'somevalue' and = dstobj in (select objectid from omfilesysentry where = name=3D'dir15_file80'); Columns srcobj, dstobj & name are all indexed. I ran test adding records to ommemberrelation and omfilesysentry up to = 32K in each to simulate and measured query times. The graph is O(n=B2) = like. i.e sequencial scan =20 The columns in the where clauses are indexed, and yes I did VACUUM = ANALYZE FULL. I even tried backup restore of the entire db. No = difference.=20 Turning sequencial scan off results in a O(n log n) like graph,=20 Explain analyze confirms sequencial scan. A majority (70ms) of the 91ms = query is as a result of -> Seq Scan on ommemberrelation Timing is on. = QUERY PLAN = =20 -------------------------------------------------------------------------= -------------------------------------------------------------------------= ------------------------------------ Nested Loop IN Join (cost=3D486.19..101533.99 rows=3D33989 = width=3D177) (actual time=3D5.493..90.682 rows=3D1 loops=3D1) Join Filter: ("outer".dstobj =3D "inner".objectid) -> Seq Scan on ommemberrelation (cost=3D0.00..2394.72 rows=3D33989 = width=3D177) (actual time=3D0.078..70.887 rows=3D100 loops=3D1) Filter: (srcobj =3D = '3197a4e6-abf1-11da-a0f9-000fb05ab829'::text) -> Materialize (cost=3D486.19..487.48 rows=3D129 width=3D16) = (actual time=3D0.004..0.101 rows=3D26 loops=3D100) -> Append (cost=3D0.00..486.06 rows=3D129 width=3D16) (actual = time=3D0.063..1.419 rows=3D26 loops=3D1) -> Index Scan using omfilesysentry_name_idx on = omfilesysentry (cost=3D0.00..8.30 rows=3D2 width=3D16) (actual = time=3D0.019..0.019 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Index Scan using omfile_name_idx on omfile = omfilesysentry (cost=3D0.00..393.85 rows=3D101 width=3D16) (actual = time=3D0.033..0.291 rows=3D26 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Seq Scan on omdirectory omfilesysentry = (cost=3D0.00..24.77 rows=3D11 width=3D16) (actual time=3D0.831..0.831 = rows=3D0 loops=3D1) Filter: (name =3D 'dir15_file80'::text) -> Index Scan using omfilesequence_name_idx on = omfilesequence omfilesysentry (cost=3D0.00..8.30 rows=3D2 width=3D16) = (actual time=3D0.014..0.014 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Index Scan using omclipfile_name_idx on omclipfile = omfilesysentry (cost=3D0.00..8.30 rows=3D2 width=3D16) (actual = time=3D0.008..0.008 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Index Scan using omimagefile_name_idx on omimagefile = omfilesysentry (cost=3D0.00..8.30 rows=3D2 width=3D16) (actual = time=3D0.008..0.008 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Index Scan using omcollection_name_idx on = omcollection omfilesysentry (cost=3D0.00..8.30 rows=3D2 width=3D16) = (actual time=3D0.008..0.008 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Index Scan using omhomedirectory_name_idx on = omhomedirectory omfilesysentry (cost=3D0.00..8.30 rows=3D2 width=3D16) = (actual time=3D0.007..0.007 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Seq Scan on omrootdirectory omfilesysentry = (cost=3D0.00..1.05 rows=3D1 width=3D16) (actual time=3D0.013..0.013 = rows=3D0 loops=3D1) Filter: (name =3D 'dir15_file80'::text) -> Index Scan using omwarehousedirectory_name_idx on = omwarehousedirectory omfilesysentry (cost=3D0.00..8.30 rows=3D2 = width=3D16) (actual time=3D0.007..0.007 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) -> Index Scan using omtask_name_idx on omtask = omfilesysentry (cost=3D0.00..8.30 rows=3D2 width=3D16) (actual = time=3D0.009..0.009 rows=3D0 loops=3D1) Index Cond: (name =3D 'dir15_file80'::text) Total = runtime: 91.019 ms (29 rows) So why is the planner not using the index? Everything I have read = indicates sequencial scanning should be left on and the planner should = do the right thing.=20 This is a quote from 1 web site: "These options are pretty much only for use in query testing; frequently = one sets "enable_seqscan =3D false" in order to determine if the planner = is unnecessarily discarding an index, for example. However, it would = require very unusual circumstances to change any of them to false in the = .conf file." So how do I determine why the planner is unnecessarily discarding the = index?=20 Thanks From pgsql-performance-owner@postgresql.org Mon Mar 6 15:45:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 119FB9DCBC2 for ; Mon, 6 Mar 2006 15:45: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 89485-08 for ; Mon, 6 Mar 2006 15:45:27 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.192]) by postgresql.org (Postfix) with ESMTP id A97BA9DCA67 for ; Mon, 6 Mar 2006 15:45:24 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i31so848654wxd for ; Mon, 06 Mar 2006 11:45:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UIg3IQLFGLhp2eibaZbjaPjEe0sEg7Rblr4Q8jcrDej2hUMFmOYXrslo/ds8P9dPsLUDWecuTkJqiUOIINpZuFoLesdCeMvHj2LIwhDJFvgkK37s+3WJjnJpOi6ieD7py8GTgvhUOJEdbvP8eMf5F+I4mFjrXmtj45v9tOG4o6s= Received: by 10.70.112.5 with SMTP id k5mr138516wxc; Mon, 06 Mar 2006 11:45:25 -0800 (PST) Received: by 10.70.128.2 with HTTP; Mon, 6 Mar 2006 11:45:25 -0800 (PST) Message-ID: Date: Mon, 6 Mar 2006 13:45:25 -0600 From: "Matthew Nuzum" Reply-To: newz@bearfruit.org To: "Marc G. Fournier" , "Nagita Karunaratne" Subject: Re: Postgres on VPS - how much is enough? Cc: pgsql-performance@postgresql.org In-Reply-To: <20060306131355.A1227@ganymede.hub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060306131355.A1227@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.229 required=5 tests=[AWL=0.229] X-Spam-Score: 0.229 X-Spam-Level: X-Archive-Number: 200603/41 X-Sequence-Number: 17478 On 3/6/06, Marc G. Fournier wrote: > On Mon, 6 Mar 2006, Matthew Nuzum wrote: > > My problem with running PG inside of a VPS was that the VPS used a > > virtual filesystem... basically, a single file that had been formatted > > and loop mounted so that it looked like a regular hard drive. > > Unfortunately, it was very slow. The difference between my application > > and yours is that mine well more than filled the 1GB of RAM that I had > > allocated. If your data will fit comfortably into RAM then you may be > > fine. > > We host VPSs here (http://www.hub.org) and don't use the 'single file, > virtual file system' to put them into ... it must depend on where you > host? That's true... I hope I didn't imply that I am anti-vps, I run my own servers and one of them is dedicated to doing VPS for different applications. I think they're wonderful. On 3/6/06, Nagita Karunaratne wrote: > From personal experience, would you run Postgres on a linux machine > (NOT a vps) with 512MB of ram? > > Assumining I can keep all my data in memory. Nagita, It all depends on performance... I have one postgres database that runs on a Pentium 350MHz with 128MB of RAM. It does 1 insert per minute 24 hours per day. Because the load is so low, I can get away with minimal hardware. If your application has a lot of inserts/updates then disk speed is important and can vary greatly from one VPS to another. If your application is not time-critical than this may be a moot point anyw= ay. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Mon Mar 6 15:58:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 974469DC9B3 for ; Mon, 6 Mar 2006 15:58: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 93672-02 for ; Mon, 6 Mar 2006 15:58:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by postgresql.org (Postfix) with ESMTP id DB25D9DCD1F for ; Mon, 6 Mar 2006 15:58:39 -0400 (AST) Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id AB45ED39FA2 for ; Mon, 6 Mar 2006 14:58:39 -0500 (EST) Received: from web2.messagingengine.com ([10.202.2.211]) by frontend1.internal (MEProxy); Mon, 06 Mar 2006 14:58:39 -0500 Received: by web2.messagingengine.com (Postfix, from userid 99) id 8903CE275; Mon, 6 Mar 2006 14:58:32 -0500 (EST) Message-Id: <1141675112.28202.255960101@webmail.messagingengine.com> X-Sasl-Enc: BBFRs4kYvz3uGnFRnGpPh8kbYzL2HQFzFx0/ZWW20JNl 1141675112 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 5022 (F2.73; T1.15; A1.64; B3.05; Q3.03) References: <20060306131355.A1227@ganymede.hub.org> Subject: Postgres and Ingres R3 / SAN In-Reply-To: Date: Mon, 06 Mar 2006 14:58:32 -0500 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.21 required=5 tests=[AWL=0.210] X-Spam-Score: 0.21 X-Spam-Level: X-Archive-Number: 200603/42 X-Sequence-Number: 17479 Clustering solutions for PostgreSQL are currently pretty limited. Slony could be a good option in the future, but it currently only supports Master-Slave replication (not true clustering) and in my experience is a pain to set up and administer. Bizgres MPP has a lot of promise, especially for data warehouses, but it currently doesn't have the best OLTP database performance. So, I had a couple of questions: 1) I have heard bad things from people on this list regarding SANs - but is there a better alternative for a high performance database cluster? (both for redundancy and performance) I've heard internal storage touted before, but then you have to do something like master-master replication to get horizontal scalability and write performance will suffer. 2) Has anyone on this list had experience using Ingres R3 in a clustered environment? I am considering using Ingres R3's built-in clustering support with a SAN, but am interested to know other people's experiences before we start toying with this possibility. Any experience with the Ingres support from Computer Associates? Good/bad? Jeremy From pgsql-performance-owner@postgresql.org Mon Mar 6 16:11:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 48C799DC8A7 for ; Mon, 6 Mar 2006 16:11: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 96384-03 for ; Mon, 6 Mar 2006 16:11:00 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-2.sun.com (brmea-mail-2.Sun.COM [192.18.98.43]) by postgresql.org (Postfix) with ESMTP id 145B39DCAD3 for ; Mon, 6 Mar 2006 16:10:56 -0400 (AST) Received: from fe-amer-02.sun.com ([192.18.108.176]) by brmea-mail-2.sun.com (8.12.10/8.12.9) with ESMTP id k26KAw8u021524 for ; Mon, 6 Mar 2006 13:10:58 -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 <0IVQ002012NLUV00@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Mon, 06 Mar 2006 13:10:58 -0700 (MST) Received: from [129.148.9.88] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IVQ00AIY2Q5A061@mail-amer.sun.com>; Mon, 06 Mar 2006 13:10:58 -0700 (MST) Date: Mon, 06 Mar 2006 15:10:53 -0500 From: "Jignesh K. Shah" Subject: Re: t1000/t2000 sun-servers In-reply-to: To: Neil Saunders Cc: Claus Guttesen , Postgresql Performance Message-id: <440C974D.7000808@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.087 required=5 tests=[AWL=0.086, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.087 X-Spam-Level: X-Archive-Number: 200603/43 X-Sequence-Number: 17480 Suggestions for benchmarks on Sun Fire T2000... * Don't try DSS or TPC-H type of test with Postgres on Sun Fire T2000 Since such queries tend to have one connection, it will perform badly with Postgre since it will use only one hardware virtual CPU of the available 32 virtual CPU on Sun Fire T2000. (Oracle/DB2 have ways of breaking the queries into multiple processes and hence use multiple virtual CPUs on Sun Fire T2000, PostgreSQL cannot do the same in such cases) * Use OLTP Type of benchmark Where you have more than 30 simultaneous users/connections doing work on Postgres without bottlenecking on datafiles of course :-) * Use multiple databases or instances of Postgresql Like migrate all your postgresql databases to one T2000. You might see that your average response time may not be faster but it can handle probably all your databases migrated to one T2000. In essence, your single thread performance will not speed up on Sun Fire T2000 but you can certainly use it to replace all your individual postgresql servers in your organization or see higher scalability in terms of number of users handled with 1 server with Sun Fire T2000. For your /etc/system use the parameters as mentioned in http://www.sun.com/servers/coolthreads/tnb/parameters.jsp For hints on setting it up for Postgresql refer to other databases setup on http://www.sun.com/servers/coolthreads/tnb/applications.jsp If you get specific performance problems send email to pgsql-performance@postgresql.org Regards, Jignesh Neil Saunders wrote: >I may be able to organize a test on a T2000 if someone could give >advice as to an appropriate test to run... > >Cheers, > >Neil > >On 3/6/06, Claus Guttesen wrote: > > >>Hi. >> >>Has anybody tried the new Sun "cool-thread" servers t1000/t2000 from >>Sun? I'd love to see benchmarks with Solaris 10 and pg 8.1. >> >>regards >>Claus >> >>---------------------------(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 6: explain analyze is your friend > > From pgsql-performance-owner@postgresql.org Mon Mar 6 16:17:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 24BD19DCAD3 for ; Mon, 6 Mar 2006 16:17: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 97211-05 for ; Mon, 6 Mar 2006 16:17:24 -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 B50889DCA67 for ; Mon, 6 Mar 2006 16:17:21 -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 k26KHHuQ085324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Mar 2006 13:17: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 k26KHHOT014731; Mon, 6 Mar 2006 13:17: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 k26KHGqA014730; Mon, 6 Mar 2006 13:17:16 -0700 (MST) (envelope-from mfuhr) Date: Mon, 6 Mar 2006 13:17:16 -0700 From: Michael Fuhr To: Joost Kraaijeveld Cc: "Pgsql-Performance (E-mail)" Subject: Re: Can anyone explain this pgbench results? Message-ID: <20060306201716.GA14663@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.122 required=5 tests=[AWL=0.122] X-Spam-Score: 0.122 X-Spam-Level: X-Archive-Number: 200603/44 X-Sequence-Number: 17481 On Mon, Mar 06, 2006 at 07:46:05PM +0100, Joost Kraaijeveld wrote: > Michael Fuhr wrote: > > What's your setting? > > Default. Have you tweaked postgresql.conf at all? If so, what non-default settings are you using? > > Are your test results more consistent > > if you execute CHECKPOINT between them? > > Could you tell me how I could do that? Connect to the database as a superuser and execute a CHECKPOINT statement. http://www.postgresql.org/docs/8.1/interactive/sql-checkpoint.html From the command line you could do something like psql -c checkpoint pgbench -c 10 -t 150 test psql -c checkpoint pgbench -c 10 -t 150 test psql -c checkpoint pgbench -c 10 -t 150 test -- Michael Fuhr From pgsql-performance-owner@postgresql.org Mon Mar 6 16:50:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C391C9DC9E4 for ; Mon, 6 Mar 2006 16: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 03471-05 for ; Mon, 6 Mar 2006 16:50:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.hive.is (scania.ipf.is [85.197.192.147]) by postgresql.org (Postfix) with SMTP id 451AD9DC8A7 for ; Mon, 6 Mar 2006 16:50:22 -0400 (AST) Received: (qmail 93030 invoked by uid 1010); 6 Mar 2006 20:50:42 -0000 Received: from 85.197.216.186 by scania.ipf.is (envelope-from , uid 1009) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1283. spamassassin: 3.1.0. perlscan: 1.25-st-qms. Clear:RC:1(85.197.216.186):SA:0(-4.1/4.0):. Processed in 7.472889 secs); 06 Mar 2006 20:50:42 -0000 X-Antivirus-HIVE-Mail-From: gnari@hive.is via scania.ipf.is X-Antivirus-HIVE: 1.25-st-qms (Clear:RC:1(85.197.216.186):SA:0(-4.1/4.0):. Processed in 7.472889 secs Process 92861) Received: from dsl-216-186.hive.is (HELO ?192.168.1.34?) (85.197.216.186) by mx1.hive.is with SMTP; 6 Mar 2006 20:50:32 -0000 Subject: Re: Sequencial scan instead of using index From: Ragnar To: Harry Hehl Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset=ISO-8859-1 Date: Mon, 06 Mar 2006 20:51:46 +0000 Message-Id: <1141678306.18656.152.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.147 required=5 tests=[AWL=0.147] X-Spam-Score: 0.147 X-Spam-Level: X-Archive-Number: 200603/46 X-Sequence-Number: 17483 On m�n, 2006-03-06 at 13:46 -0500, Harry Hehl wrote: > Query: select * from ommemberrelation where srcobj='somevalue' > and dstobj in (select objectid from omfilesysentry where name='dir15_file80'); > > Columns srcobj, dstobj & name are all indexed. > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > Nested Loop IN Join (cost=486.19..101533.99 rows=33989 width=177) (actual time=5.493..90.682 rows=1 loops=1) > Join Filter: ("outer".dstobj = "inner".objectid) > -> Seq Scan on ommemberrelation (cost=0.00..2394.72 rows=33989 width=177) (actual time=0.078..70.887 rows=100 loops=1) > Filter: (srcobj = '3197a4e6-abf1-11da-a0f9-000fb05ab829'::text) > -> Materialize (cost=486.19..487.48 rows=129 width=16) (actual time=0.004..0.101 rows=26 loops=100) Looks like the planner is expecting 33989 rows, making an index scan a ppor choice, but in fact only 100 rows actually match your srcobj value. Could we see the explain analyze with enable_seqscan = false please ? Possibly you might want totry to increase the statistics target for this columns , as in: ALTER TABLE ommemberrelation ALTER COLUMN srcobj SET STATISTICS 1000; ANALYZE; and try again (with enable_seqscan=true) A target of 1000 ismost probably overkill, but start with this value, and if it improves matters, you can experiment with lower settings. gnari From pgsql-performance-owner@postgresql.org Mon Mar 6 17:24:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 222C99DCA67 for ; Mon, 6 Mar 2006 17:24: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 10862-01 for ; Mon, 6 Mar 2006 17:24:39 -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 0DFB89DC9AE for ; Mon, 6 Mar 2006 17:24:35 -0400 (AST) Received: from [192.168.0.5] (84.60.139.254) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.7) for ; Mon, 6 Mar 2006 22:24:33 +0100 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <440C974D.7000808@sun.com> References: <440C974D.7000808@sun.com> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-10-164313186; protocol="application/pkcs7-signature" Message-Id: <0EED23D8-4ECF-498B-8AF6-A453A0E34702@pharmaline.de> From: Guido Neitzer Subject: Re: t1000/t2000 sun-servers Date: Mon, 6 Mar 2006 22:24:29 +0100 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.213 required=5 tests=[AWL=0.213] X-Spam-Score: 0.213 X-Spam-Level: X-Archive-Number: 200603/47 X-Sequence-Number: 17484 --Apple-Mail-10-164313186 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 06.03.2006, at 21:10 Uhr, Jignesh K. Shah wrote: > Like migrate all your postgresql databases to one T2000. You might > see that your average response time may not be faster but it can > handle probably all your databases migrated to one T2000. > > In essence, your single thread performance will not speed up on Sun > Fire T2000 but you can certainly use it to replace all your > individual postgresql servers in your organization or see higher > scalability in terms of number of users handled with 1 server with > Sun Fire T2000. How good is a pgbench test for evaluating things like this? I have used it to compare several machines, operating systems and PostgreSQL versions - but it was more or less just out of curiosity. The real evaluation was made with "real life tests" - mostly scripts which also tested the application server itself. But as it was it's easy to compare several machines with pgbench, I just did the tests and they were interesting and reflected the real world not as bad as I had thought from a "benchmark". So, personally I'm interested in a simple pgbench test - perhaps with some more ( > 50) clients simulated ... cug --Apple-Mail-10-164313186 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGNzCCAvAw ggJZoAMCAQICEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MDIxMTE3NDM1NFoXDTA3MDIxMTE3NDM1 NFowTTEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEqMCgGCSqGSIb3DQEJARYbZ3Vp ZG8ubmVpdHplckBwaGFybWFsaW5lLmRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA yLhNUnNv30/r+pFUHocoIWGm8AAwFbwAWqFRhEwZzxLPCMSZme3G7W/5hyK+SxeQoOK8PPCsNyvy sLBqUVHB3nm5w/NzZKk1gfc2QlzjPtv2C7bUnigDJs+X0YlgdxTxs68RdHBn/rbjjaxl+SkiEcsz kZhKsAnS6zhlWSX7zDCIRR5VD08M0/fYSTwEcX1j8lWb/3McY7bCcHbLd+762QQAn03A4cPco4OK 3KAMld0n6qFFMG23IKx7qDTonYtCzsDVspQ1Fk14yJYVdf62RLWGBJPF+RMXB9juFhgdUrHZY3mo wamFF3qZ8HD9wb+G7lhL8F+d5khDuLBYFXCqdQIDAQABozgwNjAmBgNVHREEHzAdgRtndWlkby5u ZWl0emVyQHBoYXJtYWxpbmUuZGUwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQCFnjZk bGIY3sGlsEIn98cV+tX9xNTThIwN6jhu7mGuxzvX+hN86kdlhEgaPmaatH8KfXXyfnhpTK3KOk8O zDsxJqQDVe1HEW8M/4MkORMlydbcxSRPL967pgMRNjAMafL/IlssFJ3kF7q/2AjRd4VhnyoA3Yl/ sXF3WLOTJB5OzjCCAz8wggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpB MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhh d3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24x JDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVy c29uYWwtZnJlZW1haWxAdGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTla MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSww KgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0B AQEFAAOBjQAwgYkCgYEAxKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B 1OVQCjDXAmNaLIkVcI7dyfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk 16emu59l0cUqVIUPSAR/p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/ AgEAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25h bEZyZWVtYWlsQ0EuY3JsMAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJp dmF0ZUxhYmVsMi0xMzgwDQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOW lJ1/TCG4+DYfqi2fNi/A9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amc OY6MIE9lX5Xa9/eH1sYITq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8xggMQMIIDDAIB ATB2MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQu MSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQHu2nEIcbtVh7 Lds/867h7zAJBgUrDgMCGgUAoIIBbzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3 DQEJBTEPFw0wNjAzMDYyMTI0MzBaMCMGCSqGSIb3DQEJBDEWBBRgnHzikEz9GZRUd/yrFvvRn+U7 fjCBhQYJKwYBBAGCNxAEMXgwdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1 bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3Vp bmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcN AQEBBQAEggEACNEoHjOxzlTKayQrkj/Zsabr+TZQwPyxqzAbkN9BRv27B6gCfo3+kk1sh17VMQ1O xXV4f7i2yHA5LTaTIYBTu3H9a0/zGkGCGABXaD4QDrLNQzSzD+pVcfQqil235q4rO3CBEyk0N3lB e1X8wDdnAiLthvloGW28wf7HT/0JA0qx8iKLx7P+E3orR89ypJCk2NE9apw8il7z6ownF6RnEFCN zBPSakF2uoM3B5fyRLg35gQC4YRYCiVWoVW6ojqW+71xo4G5654CW6Wx4/EZSRmtJJpayU9vk3Bi a3VS8DazbiTSW7+7z2Esz5DlrJp/uyyTF8zIKtq8vNOU9FUpkAAAAAAAAA== --Apple-Mail-10-164313186-- From pgsql-performance-owner@postgresql.org Mon Mar 6 18:11:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 162839DCB6B for ; Mon, 6 Mar 2006 18:11: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 15312-04 for ; Mon, 6 Mar 2006 18:11:32 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from brmea-mail-2.sun.com (brmea-mail-2.Sun.COM [192.18.98.43]) by postgresql.org (Postfix) with ESMTP id 426129DCB52 for ; Mon, 6 Mar 2006 18:11:27 -0400 (AST) Received: from fe-amer-04.sun.com ([192.18.108.178]) by brmea-mail-2.sun.com (8.12.10/8.12.9) with ESMTP id k26MBU8u001699 for ; Mon, 6 Mar 2006 15:11:30 -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 <0IVQ00K017P60W00@mail-amer.sun.com> (original mail from J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; Mon, 06 Mar 2006 15:11:30 -0700 (MST) Received: from [129.148.9.88] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IVQ00FIY8B5G1Y1@mail-amer.sun.com>; Mon, 06 Mar 2006 15:11:30 -0700 (MST) Date: Mon, 06 Mar 2006 17:11:29 -0500 From: "Jignesh K. Shah" Subject: Re: t1000/t2000 sun-servers In-reply-to: <0EED23D8-4ECF-498B-8AF6-A453A0E34702@pharmaline.de> To: Guido Neitzer Cc: Postgresql Performance Message-id: <440CB391.2090402@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: <440C974D.7000808@sun.com> <0EED23D8-4ECF-498B-8AF6-A453A0E34702@pharmaline.de> User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050322) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.091 required=5 tests=[AWL=0.090, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.091 X-Spam-Level: X-Archive-Number: 200603/48 X-Sequence-Number: 17485 pgbench according to me is more io write intensive benchmark. T2000 with its internal drive may not perform well with pgbench with a high load. If you are using external storage, try it out. I havent tried it out yet but let me know what you see. -Jignesh Guido Neitzer wrote: > On 06.03.2006, at 21:10 Uhr, Jignesh K. Shah wrote: > >> Like migrate all your postgresql databases to one T2000. You might >> see that your average response time may not be faster but it can >> handle probably all your databases migrated to one T2000. >> >> In essence, your single thread performance will not speed up on Sun >> Fire T2000 but you can certainly use it to replace all your >> individual postgresql servers in your organization or see higher >> scalability in terms of number of users handled with 1 server with >> Sun Fire T2000. > > > How good is a pgbench test for evaluating things like this? I have > used it to compare several machines, operating systems and PostgreSQL > versions - but it was more or less just out of curiosity. The real > evaluation was made with "real life tests" - mostly scripts which > also tested the application server itself. > > But as it was it's easy to compare several machines with pgbench, I > just did the tests and they were interesting and reflected the real > world not as bad as I had thought from a "benchmark". > > So, personally I'm interested in a simple pgbench test - perhaps with > some more ( > 50) clients simulated ... > > cug From pgsql-performance-owner@postgresql.org Mon Mar 6 20:14:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D38D89DC893 for ; Mon, 6 Mar 2006 20: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 35080-02 for ; Mon, 6 Mar 2006 20:14:34 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id C638E9DC9AF for ; Mon, 6 Mar 2006 20:14:28 -0400 (AST) Received: from oc.hemac.com.mx (unknown [201.144.70.52]) by svr4.postgresql.org (Postfix) with ESMTP id 8208C5AF181 for ; Tue, 7 Mar 2006 00:14:29 +0000 (GMT) Received: from [192.168.0.62] by oc.hemac.com.mx (MDaemon.PRO.v8.0.2.R) with ESMTP id md50000033634.msg for ; Mon, 06 Mar 2006 18:15:58 -0600 Message-ID: <440CD0BB.2020800@gmail.com> Date: Mon, 06 Mar 2006 18:15:55 -0600 From: "i.v.r." User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Help understanding indexes, explain, and optimizing a query Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: ivanvr@oc.hemac.com.mx X-Spam-Processed: hermes.oc.hemac.com.mx, Mon, 06 Mar 2006 18:15:58 -0600 (not processed: message from trusted or authenticated source) X-Return-Path: ivanvega@gmail.com X-MDaemon-Deliver-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: 200603/49 X-Sequence-Number: 17486 Hi everyone, I'm experimenting with PostgreSQL, but since I'm no expert DBA, I'm experiencing some performance issues. Please take a look at the following query: SELECT /*groups."name" AS t2_r1, groups."id" AS t2_r3, groups."user_id" AS t2_r0, groups."pretty_url" AS t2_r2, locations."postal_code" AS t0_r6, locations."pretty_url" AS t0_r7, locations."id" AS t0_r8, locations."colony_id" AS t0_r0, locations."user_id" AS t0_r1, locations."group_id" AS t0_r2, locations."distinction" AS t0_r3, locations."street" AS t0_r4, locations."street_2" AS t0_r5, schools."updated" AS t1_r10, schools."level_id" AS t1_r4, schools."pretty_url" AS t1_r11, schools."user_id" AS t1_r5, schools."id" AS t1_r12, schools."type_id" AS t1_r6, schools."distinction" AS t1_r7, schools."cct" AS t1_r8, schools."created_on" AS t1_r9, schools."location_id" AS t1_r0, schools."service_id" AS t1_r1, schools."sustentation_id" AS t1_r2, schools."dependency_id" AS t1_r3*/ groups.*, locations.*, schools.* FROM locations LEFT OUTER JOIN groups ON groups.id = locations.group_id LEFT OUTER JOIN schools ON schools.location_id = locations.id WHERE (colony_id = 71501) ORDER BY groups.name, locations.distinction, schools.distinction As you can see, I've commented out some parts. I did that as an experiment, and it improved the query by 2x. I really don't understand how is that possible... I also tried changing the second join to an INNER join, and that improves it a little bit also. Anyway, the main culprit seems to be that second join. Here's the output from EXPLAIN: Sort (cost=94315.15..94318.02 rows=1149 width=852) Sort Key: groups.name, locations.distinction, schools.distinction -> Merge Left Join (cost=93091.96..94256.74 rows=1149 width=852) Merge Cond: ("outer".id = "inner".location_id) -> Sort (cost=4058.07..4060.94 rows=1148 width=646) Sort Key: locations.id -> Hash Left Join (cost=1.01..3999.72 rows=1148 width=646) Hash Cond: ("outer".group_id = "inner".id) -> Index Scan using locations_colony_id on locations (cost=0.00..3992.91 rows=1148 width=452) Index Cond: (colony_id = 71501) -> Hash (cost=1.01..1.01 rows=1 width=194) -> Seq Scan on groups (cost=0.00..1.01 rows=1 width=194) -> Sort (cost=89033.90..89607.67 rows=229510 width=206) Sort Key: schools.location_id -> Seq Scan on schools (cost=0.00..5478.10 rows=229510 width=206) I don't completely understand what that output means, but it would seem that the first join costs about 4000, but if I remove that join from the query, the performance difference is negligible. So as I said, it seems the problem is the join on the schools table. I hope it's ok for me to post the relevant tables here, so here they are (I removed some constraints and indexes that aren't relevant to the query above): CREATE TABLE groups ( user_id int4 NOT NULL, name varchar(50) NOT NULL, pretty_url varchar(50) NOT NULL, id serial NOT NULL, CONSTRAINT groups_pk PRIMARY KEY (id), ) CREATE TABLE locations ( colony_id int4 NOT NULL, user_id int4 NOT NULL, group_id int4 NOT NULL, distinction varchar(60) NOT NULL, street varchar(60) NOT NULL, street_2 varchar(50) NOT NULL, postal_code varchar(5) NOT NULL, pretty_url varchar(60) NOT NULL, id serial NOT NULL, CONSTRAINT locations_pk PRIMARY KEY (id), CONSTRAINT colony FOREIGN KEY (colony_id) REFERENCES colonies (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT "group" FOREIGN KEY (group_id) REFERENCES groups (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, ) CREATE INDEX locations_fki_colony ON locations USING btree (colony_id); CREATE INDEX locations_fki_group ON locations USING btree (group_id); CREATE TABLE schools ( location_id int4 NOT NULL, service_id int4 NOT NULL, sustentation_id int4 NOT NULL, dependency_id int4 NOT NULL, level_id int4 NOT NULL, user_id int4 NOT NULL, type_id int4 NOT NULL, distinction varchar(25) NOT NULL, cct varchar(20) NOT NULL, created_on timestamp(0) NOT NULL, updated timestamp(0), pretty_url varchar(25) NOT NULL, id serial NOT NULL, CONSTRAINT schools_pk PRIMARY KEY (id), CONSTRAINT "location" FOREIGN KEY (location_id) REFERENCES locations (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, ) CREATE INDEX schools_fki_location ON schools USING btree (location_id); So I'm wondering what I'm doing wrong. I migrated this database from MySQL, and on there it ran pretty fast. Kind regards, Ivan V. From pgsql-performance-owner@postgresql.org Mon Mar 6 20:19:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 15FDF9DC836 for ; Mon, 6 Mar 2006 20: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 33278-09 for ; Mon, 6 Mar 2006 20:19:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 44ADF9DC822 for ; Mon, 6 Mar 2006 20:19:25 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 6472F56491; Mon, 6 Mar 2006 18:19:14 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Mon, 6 Mar 2006 18:19:14 -0600 Date: Mon, 6 Mar 2006 18:19:13 -0600 From: "Jim C. Nasby" To: PFC Cc: pgsql-performance@postgresql.org Subject: Re: Planner enhancement suggestion. Message-ID: <20060307001913.GS51968@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:lists@peufeu.com::U8Le1yRrFuNkL/WU:03PNv X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::US/OuXK2G0oEoGtu:00000 0000000000000000000000001Z25 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/50 X-Sequence-Number: 17487 On Sun, Mar 05, 2006 at 10:00:25PM +0100, PFC wrote: > > Bitmap index scan is bliss. Many thanks to the postgres team ! Now > searching in tables with a lot of fields and conditions is no longer a > pain. > > And just a thought : > > SELECT * FROM table WHERE category IN (1,2,3) ORDER BY price LIMIT > 10; > > Suppose you have an index on category, and another index on price. > Depending on the stats postgres has about the values, you'll either get : > > 0- seq scan + sort > 1- Plain or Bitmap Index scan using "category", then sort by "price" > 2- Index scan on "price", Filter on "category IN (1,2,3)", no sort. > > 1 is efficient if the category is rare. Postgres knows this and uses > this plan well. > Without a LIMIT, option 1 should be preferred. > > 2 is efficient if the items in the categories 1,2,3 are cheap (close > to the start of the index on price). However if the items in question are > on the other side of the index, it will index-scan a large part of the > table. This can be a big hit. Postgres has no stats about the correlation > of "category" and "price", so it won't know when there is going to be a > problem. > > Another option would be interesting. It has two steps : > > - Build a bitmap using the index on "category" (just like in case 1) > so we know which pages on the table have relevant rows > > - Index scan on "price", but only looking in the heap for pages > which are flagged in the bitmap, and then "Recheck Cond" on "category". > In other words, do an index scan to get the rows in the right order, > but don't bother to check the heap for pages where the bitmap says there > are no rows. > In the worst case, you still have to run through the entire index, > but at least not through the entire table ! > > It can also speed up some merge joins. The problem is that you're now talking about doing 2 index scans instead of just one and a sort. If the correlation on price is high, it could still win. As the cost estimator for index scan stands right now, there's no way such a plan would be chosen unless correlation was extremely high, however. -- 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 Mar 6 20:40:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8DC1E9DC839 for ; Mon, 6 Mar 2006 20:40: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 38024-06 for ; Mon, 6 Mar 2006 20:40:22 -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 36AB59DC822 for ; Mon, 6 Mar 2006 20:40:16 -0400 (AST) Received: by zproxy.gmail.com with SMTP id o1so1382625nzf for ; Mon, 06 Mar 2006 16:40:19 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=Typj2pzQzcqtG4vooxgcrJiKnujoBD3k8B/VKJDmlOfysBKQDp4yMY+ajRGDPjeE8+5qwIS2jpr6Qw3h/4k63lFI4F6wGDVSnbdL09jKg6FEwZGX8Ta06lblGvAMwcaHjnmk7lvapHy0SQff2ro2c3BgB77NBKzc7GS9jlX78mQ= Received: by 10.36.126.13 with SMTP id y13mr7814079nzc; Mon, 06 Mar 2006 16:40:18 -0800 (PST) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id c1sm213043nzd.2006.03.06.16.40.17; Mon, 06 Mar 2006 16:40:18 -0800 (PST) Message-ID: <440CD673.8080208@gmail.com> Date: Tue, 07 Mar 2006 11:40:19 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "i.v.r." CC: pgsql-performance@postgresql.org Subject: Re: Help understanding indexes, explain, and optimizing References: <440CD0BB.2020800@gmail.com> In-Reply-To: <440CD0BB.2020800@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.117 required=5 tests=[AWL=0.117] X-Spam-Score: 0.117 X-Spam-Level: X-Archive-Number: 200603/51 X-Sequence-Number: 17488 i.v.r. wrote: > Hi everyone, > > I'm experimenting with PostgreSQL, but since I'm no expert DBA, I'm > experiencing some performance issues. > > Please take a look at the following query: > > SELECT > /*groups."name" AS t2_r1, > groups."id" AS t2_r3, > groups."user_id" AS t2_r0, > groups."pretty_url" AS t2_r2, > locations."postal_code" AS t0_r6, > locations."pretty_url" AS t0_r7, > locations."id" AS t0_r8, > locations."colony_id" AS t0_r0, > locations."user_id" AS t0_r1, > locations."group_id" AS t0_r2, > locations."distinction" AS t0_r3, > locations."street" AS t0_r4, > locations."street_2" AS t0_r5, > schools."updated" AS t1_r10, > schools."level_id" AS t1_r4, > schools."pretty_url" AS t1_r11, > schools."user_id" AS t1_r5, > schools."id" AS t1_r12, > schools."type_id" AS t1_r6, > schools."distinction" AS t1_r7, > schools."cct" AS t1_r8, > schools."created_on" AS t1_r9, > schools."location_id" AS t1_r0, > schools."service_id" AS t1_r1, > schools."sustentation_id" AS t1_r2, > schools."dependency_id" AS t1_r3*/ > groups.*, > locations.*, > schools.* > FROM locations > LEFT OUTER JOIN groups ON groups.id = locations.group_id > LEFT OUTER JOIN schools ON schools.location_id = locations.id > WHERE (colony_id = 71501) > ORDER BY groups.name, locations.distinction, schools.distinction > > As you can see, I've commented out some parts. I did that as an > experiment, and it improved the query by 2x. I really don't understand > how is that possible... I also tried changing the second join to an > INNER join, and that improves it a little bit also. > > Anyway, the main culprit seems to be that second join. Here's the output > from EXPLAIN: > > Sort (cost=94315.15..94318.02 rows=1149 width=852) > Sort Key: groups.name, locations.distinction, schools.distinction > -> Merge Left Join (cost=93091.96..94256.74 rows=1149 width=852) > Merge Cond: ("outer".id = "inner".location_id) > -> Sort (cost=4058.07..4060.94 rows=1148 width=646) > Sort Key: locations.id > -> Hash Left Join (cost=1.01..3999.72 rows=1148 width=646) > Hash Cond: ("outer".group_id = "inner".id) > -> Index Scan using locations_colony_id on > locations (cost=0.00..3992.91 rows=1148 width=452) > Index Cond: (colony_id = 71501) > -> Hash (cost=1.01..1.01 rows=1 width=194) > -> Seq Scan on groups (cost=0.00..1.01 > rows=1 width=194) > -> Sort (cost=89033.90..89607.67 rows=229510 width=206) > Sort Key: schools.location_id > -> Seq Scan on schools (cost=0.00..5478.10 rows=229510 > width=206) > > I don't completely understand what that output means, but it would seem > that the first join costs about 4000, but if I remove that join from the > query, the performance difference is negligible. So as I said, it seems > the problem is the join on the schools table. > > I hope it's ok for me to post the relevant tables here, so here they are > (I removed some constraints and indexes that aren't relevant to the > query above): > > CREATE TABLE groups > ( > user_id int4 NOT NULL, > name varchar(50) NOT NULL, > pretty_url varchar(50) NOT NULL, > id serial NOT NULL, > CONSTRAINT groups_pk PRIMARY KEY (id), > ) > > CREATE TABLE locations > ( > colony_id int4 NOT NULL, > user_id int4 NOT NULL, > group_id int4 NOT NULL, > distinction varchar(60) NOT NULL, > street varchar(60) NOT NULL, > street_2 varchar(50) NOT NULL, > postal_code varchar(5) NOT NULL, > pretty_url varchar(60) NOT NULL, > id serial NOT NULL, > CONSTRAINT locations_pk PRIMARY KEY (id), > CONSTRAINT colony FOREIGN KEY (colony_id) > REFERENCES colonies (id) MATCH SIMPLE > ON UPDATE NO ACTION ON DELETE NO ACTION, > CONSTRAINT "group" FOREIGN KEY (group_id) > REFERENCES groups (id) MATCH SIMPLE > ON UPDATE NO ACTION ON DELETE NO ACTION, > ) > CREATE INDEX locations_fki_colony > ON locations > USING btree > (colony_id); > CREATE INDEX locations_fki_group > ON locations > USING btree > (group_id); > > CREATE TABLE schools > ( > location_id int4 NOT NULL, > service_id int4 NOT NULL, > sustentation_id int4 NOT NULL, > dependency_id int4 NOT NULL, > level_id int4 NOT NULL, > user_id int4 NOT NULL, > type_id int4 NOT NULL, > distinction varchar(25) NOT NULL, > cct varchar(20) NOT NULL, > created_on timestamp(0) NOT NULL, > updated timestamp(0), > pretty_url varchar(25) NOT NULL, > id serial NOT NULL, > CONSTRAINT schools_pk PRIMARY KEY (id), > CONSTRAINT "location" FOREIGN KEY (location_id) > REFERENCES locations (id) MATCH SIMPLE > ON UPDATE NO ACTION ON DELETE NO ACTION, > ) > CREATE INDEX schools_fki_location > ON schools > USING btree > (location_id); > > So I'm wondering what I'm doing wrong. I migrated this database from > MySQL, and on there it ran pretty fast. Have you done an 'analyze' or 'vacuum analyze' over these tables? A left outer join gets *everything* from the second table: > LEFT OUTER JOIN groups ON groups.id = locations.group_id > LEFT OUTER JOIN schools ON schools.location_id = locations.id So they will load everything from groups and schools. Maybe they should be left join's not left outer joins? -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Mon Mar 6 22:10:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 31E2B9DC99F for ; Mon, 6 Mar 2006 22:10: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 51541-02 for ; Mon, 6 Mar 2006 22:10:20 -0400 (AST) X-Greylist: delayed 01:55:49.871687 by SQLgrey- Received: from oc.hemac.com.mx (unknown [201.144.70.52]) by postgresql.org (Postfix) with ESMTP id 3D9639DC9C4 for ; Mon, 6 Mar 2006 22:10:12 -0400 (AST) Received: from [192.168.0.62] by oc.hemac.com.mx (MDaemon.PRO.v8.0.2.R) with ESMTP id md50000033635.msg for ; Mon, 06 Mar 2006 20:11:48 -0600 Message-ID: <440CEBE3.6030004@gmail.com> Date: Mon, 06 Mar 2006 20:11:47 -0600 From: "i.v.r." User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Help understanding indexes, explain, and optimizing References: <440CD0BB.2020800@gmail.com> <440CD673.8080208@gmail.com> In-Reply-To: <440CD673.8080208@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Authenticated-Sender: ivanvr@oc.hemac.com.mx X-Spam-Processed: hermes.oc.hemac.com.mx, Mon, 06 Mar 2006 20:11:48 -0600 (not processed: message from trusted or authenticated source) X-Return-Path: ivanvega@gmail.com X-MDaemon-Deliver-To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.97 required=5 tests=[AWL=-1.731, RCVD_IN_NJABL_DUL=1.713, RCVD_IN_SORBS_DUL=1.988] X-Spam-Score: 1.97 X-Spam-Level: * X-Archive-Number: 200603/52 X-Sequence-Number: 17489 Chris escribi�: > Have you done an 'analyze' or 'vacuum analyze' over these tables? > > A left outer join gets *everything* from the second table: > > > LEFT OUTER JOIN groups ON groups.id = locations.group_id > > LEFT OUTER JOIN schools ON schools.location_id = locations.id > > So they will load everything from groups and schools. Maybe they > should be left join's not left outer joins? > > Yes, I did that. I tried your other suggestion and it did improve it by about 200ms. I also repurposed the query by selecting first from the groups table and joining with the locations and schools tables, and that made all the difference. Now it's down to 32ms. Yipee! Thanks! Ivan V. From pgsql-performance-owner@postgresql.org Mon Mar 6 23:22:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 609AE9DC9F9 for ; Mon, 6 Mar 2006 23:22: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 66211-01 for ; Mon, 6 Mar 2006 23:22: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 860809DC9BC for ; Mon, 6 Mar 2006 23:22:12 -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 k273MA0J085652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Mar 2006 20:22:14 -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 k273MAjU017820; Mon, 6 Mar 2006 20:22:10 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k273M943017819; Mon, 6 Mar 2006 20:22:09 -0700 (MST) (envelope-from mfuhr) Date: Mon, 6 Mar 2006 20:22:09 -0700 From: Michael Fuhr To: Joost Kraaijeveld Cc: pgsql-performance@postgresql.org Subject: Re: Can anyone explain this pgbench results? Message-ID: <20060307032209.GA17543@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.122 required=5 tests=[AWL=0.122] X-Spam-Score: 0.122 X-Spam-Level: X-Archive-Number: 200603/53 X-Sequence-Number: 17490 [Please copy the mailing list on replies.] On Mon, Mar 06, 2006 at 09:38:20PM +0100, Joost Kraaijeveld wrote: > Michael Fuhr wrote: > > Have you tweaked postgresql.conf at all? If so, what non-default > > settings are you using? > > Yes, I have tweaked the following settings: > > shared_buffers = 40000 > work_mem = 512000 > maintenance_work_mem = 512000 > max_fsm_pages = 40000 > effective_cache_size = 131072 Are you sure you need work_mem that high? How did you decide on that value? Are all other settings at their defaults? No changes to the write ahead log (WAL) or background writer (bgwriter) settings? What version of PostgreSQL are you running? The paths in your original message suggest 8.1.x. > >>> Are your test results more consistent > > psql -c checkpoint > > pgbench -c 10 -t 150 test > > psql -c checkpoint > > pgbench -c 10 -t 150 test > > psql -c checkpoint > > pgbench -c 10 -t 150 test > > OK, that leads to a consistant hight score. I also noticed that > "psql -c checkpoint" results in I/O on the database partition but > not on the partition that has the logfiles (pg_xlog directory). Do > you know if that how it should be? A checkpoint updates the database files with the data from the write-ahead log; you're seeing those writes to the database partition. The postmaster does checkpoints every checkpoint_timeout seconds (default 300) or every checkpoint_segment log segments (default 3); it also uses a background writer to trickle pages to the database files between checkpoints so the checkpoints don't have as much work to do. I've been wondering if your pgbench runs are being affected by that background activity; the fact that you get consistently good performance after forcing a checkpoint suggests that that might be the case. If you run pgbench several times without intervening checkpoints, do your postmaster logs have any messages like "checkpoints are occurring too frequently"? It might be useful to increase checkpoint_warning up to the value of checkpoint_timeout and then see if you get any such messages during pgbench runs. If checkpoints are happening a lot more often than every checkpoint_timeout seconds then try increasing checkpoint_segments (assuming you have the disk space). After doing so, restart the database and run pgbench several times without intervening checkpoints and see if performance is more consistent. Note that tuning PostgreSQL for pgbench performance might be irrelevant for your actual needs unless your usage patterns happen to resemble what pgbench does. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Tue Mar 7 01:04:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2FFE29DC986 for ; Tue, 7 Mar 2006 01:04: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 82526-08 for ; Tue, 7 Mar 2006 01:04:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [203.96.152.181]) by postgresql.org (Postfix) with ESMTP id C99E79DC8D7 for ; Tue, 7 Mar 2006 01:04:17 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IVQ005J9RF5UY@linda-2.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 07 Mar 2006 18:04:17 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-158.dsl.clear.net.nz [218.101.29.158]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id B15FBE29173; Tue, 07 Mar 2006 18:04:16 +1300 (NZDT) Date: Tue, 07 Mar 2006 18:04:13 +1300 From: Mark Kirkwood Subject: Re: Sequencial scan instead of using index In-reply-to: To: Harry Hehl Cc: pgsql-performance@postgresql.org Message-id: <440D144D.9000106@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.18 required=5 tests=[AWL=0.180] X-Spam-Score: 0.18 X-Spam-Level: X-Archive-Number: 200603/54 X-Sequence-Number: 17491 Harry Hehl wrote: > There seems to be many posts on this issue but I not yet found an answer to the seq scan issue. > > I am having an issue with a joins. I am using 8.0.3 on FC4 > > Query: select * from ommemberrelation where srcobj='somevalue' and dstobj in (select objectid from omfilesysentry where name='dir15_file80'); > > Columns srcobj, dstobj & name are all indexed. > > The planner is over-estimating the number of rows here (33989 vs 100): -> Seq Scan on ommemberrelation (cost=0.00..2394.72 rows=33989 width=177) (actual time=0.078..70.887 rows=100 loops=1) The usual way to attack this is to up the sample size for ANALYZE: ALTER TABLE ommemberrelation ALTER COLUMN srcobj SET STATISTICS 100; ALTER TABLE ommemberrelation ALTER COLUMN dstobj SET STATISTICS 100; -- or even 1000. ANALYZE ommemberrelation; Then try EXPLAIN ANALYZE again. If you can upgrade to 8.1.(3), then the planner can consider paths that use *both* the indexes on srcobj and dstobj (which would probably be the business!). Cheers Mark From pgsql-performance-owner@postgresql.org Tue Mar 7 06:34:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 59B4C9DC84D for ; Tue, 7 Mar 2006 06:34: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 74153-09 for ; Tue, 7 Mar 2006 06:34:22 -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 C96A99DC99C for ; Tue, 7 Mar 2006 06:34:17 -0400 (AST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: Can anyone explain this pgbench results? Date: Tue, 7 Mar 2006 11:34:18 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can anyone explain this pgbench results? Thread-Index: AcZBln2ncyX6TE3zTJKoARSuZn3dJAALbCWQ From: "Joost Kraaijeveld" To: "Michael Fuhr" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.085 required=5 tests=[AWL=0.085] X-Spam-Score: 0.085 X-Spam-Level: X-Archive-Number: 200603/55 X-Sequence-Number: 17492 Hi Michael, Michael Fuhr wrote: >>> Have you tweaked postgresql.conf at all? If so, what non-default >>> settings are you using? >>=20 >> Yes, I have tweaked the following settings: >>=20 >> shared_buffers =3D 40000 >> work_mem =3D 512000 >> maintenance_work_mem =3D 512000 >> max_fsm_pages =3D 40000 >> effective_cache_size =3D 131072 >=20 > Are you sure you need work_mem that high? How did you decide on > that value?=20 I have used = http://www.powerpostgresql.com/Downloads/annotated_conf_80.html , = expecting that the differences between 8.0 and 8.1 do not invalidate the = recommendations. I have checked with (some) of my (large) queries and = adjusted upward untill I had no temp files in the = PGDATA/base/DB_OID/pgsql_tmp. (The warning about > Are all other settings at their defaults? =20 Yep. > No changes to the write ahead log (WAL) or background writer = (bgwriter) settings? No, because the forementioned document explicitely states that it has = recomendations on these subjects. > What version of PostgreSQL are you running? The paths in your > original message suggest 8.1.x. Debian's Ecth 8.1.0-3 > A checkpoint updates the database files with the data from the > write-ahead log; you're seeing those writes to the database partition. > The postmaster does checkpoints every checkpoint_timeout seconds > (default 300) or every checkpoint_segment log segments (default 3); > it also uses a background writer to trickle pages to the database > files between checkpoints so the checkpoints don't have as much > work to do. I've been wondering if your pgbench runs are being > affected by that background activity; the fact that you get > consistently good performance after forcing a checkpoint suggests > that that might be the case.=20 OK, thanks.=20 To be sure if I understand it correctly: 1. Every update/insert is first written to a WAL log file which is in = the PGDATA/pg_xlog directory.=20 2. Routinely the background writer than writes the changes to the = PGDATA/base/DB_OID/ directory. 2. Postmaster forces after 300 secs or if the log segments are full = (which ever comes first?) a checkpoint so that the WAL log file are = empty ( I assume that that are the changes the background writer has not = written yet since the last forced checkpont?). > If you run pgbench several times without intervening checkpoints, > do your postmaster logs have any messages like "checkpoints are > occurring too frequently"? It might be useful to increase > checkpoint_warning up to the value of checkpoint_timeout and then > see if you get any such messages during pgbench runs. If checkpoints > are happening a lot more often than every checkpoint_timeout seconds > then try increasing checkpoint_segments (assuming you have the disk > space). After doing so, restart the database and run pgbench several > times without intervening checkpoints and see if performance is > more consistent. I will try that this day. > Note that tuning PostgreSQL for pgbench performance might be > irrelevant for your actual needs unless your usage patterns happen > to resemble what pgbench does. The advantage of using pgbench is a repeatable short command that leads = to something that is showing in actual real world usage. My problem is with the raw performance of my disk array (3Ware 9500S-8 = SATA RAID5 controller with 5 disks). I am having *very* serious = performance problems if I do large updates on my databases. E.g. an = update of 1 (boolean) column in a table (update prototype.customers set = deleted =3D false) that has 368915 records last forever (> 3500 secs ). = The only noticable disk activity during such an update is on the = disk/partition that has the PGDATA/base/DB_OID/ directory (/dev/sdc, the = 3Ware 9800S-8 RAID 5 array). There is *no* noticable disk activity on = the disk/partition that hase the PGDATA/pg_xlog directory (/dev/sdb, on = a Sil 3114 on-board SAT controller). The throughtput during the update = is ~ 2 MB/sec. The thoughtput during a large file copy or running bonnie = (a benchmark) is > 40 MB/sec. My primary goal is to understand the = differences ( and than sue the guilty ones ;-)), and than maybe either = learn to live with it or find a solution. The number of write = operations/sec during the update is ~ 2000 /sec. I suspect that the RAID = card cannot handle a lot of small write operations (with fsync?) in a = short time without performance penalty (and yes, the write cache on the = controller is enabled). 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 Mar 7 09:08:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E0B019DC988 for ; Tue, 7 Mar 2006 09:08: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 07942-04 for ; Tue, 7 Mar 2006 09:08:43 -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 853519DC845 for ; Tue, 7 Mar 2006 09:08:37 -0400 (AST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: Can anyone explain this pgbench results? Date: Tue, 7 Mar 2006 14:08:40 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can anyone explain this pgbench results? Thread-Index: AcZBln2ncyX6TE3zTJKoARSuZn3dJAAUGzPg From: "Joost Kraaijeveld" To: "Michael Fuhr" Cc: 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: 200603/56 X-Sequence-Number: 17493 Hi Michael, Michael Fuhr wrote: > If you run pgbench several times without intervening checkpoints, > do your postmaster logs have any messages like "checkpoints are > occurring too frequently"? It might be useful to increase > checkpoint_warning up to the value of checkpoint_timeout and then > see if you get any such messages during pgbench runs. If checkpoints > are happening a lot more often than every checkpoint_timeout seconds > then try increasing checkpoint_segments (assuming you have the disk > space). After doing so, restart the database and run pgbench several > times without intervening checkpoints and see if performance is > more consistent. I got the "checkpoints are occurring too frequently". Increasing the = number of checkpoint_segments from the default 3 to 10 resulted in more = tests without performance penalty (~ 5-6 tests). The perfomance penalty = is also a little less. It takes several minutes for the background = writer to catch up. This will solve my problems at the customers site (they do not run sm = many sales transaction per second), but not my own problem while = converting the old database to a new databse :-(. Maybe I should invest = in other hardware or re-arrange my RAID5 in a RAID10 (or 50???). 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 Mar 7 11:03:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D24519DCC49 for ; Tue, 7 Mar 2006 11:03: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 36605-03 for ; Tue, 7 Mar 2006 11:03:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id 1C53F9DC988 for ; Tue, 7 Mar 2006 11:02:56 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 85182252; Tue, 07 Mar 2006 07:02:58 -0800 From: "Dave Dutcher" To: "'Chris'" , "'i.v.r.'" Cc: Subject: Re: Help understanding indexes, explain, and optimizing Date: Tue, 7 Mar 2006 09:02:58 -0600 Message-ID: <003b01c641f8$39185a70$8300a8c0@tridecap.com> 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.2627 In-Reply-To: <440CD673.8080208@gmail.com> 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/57 X-Sequence-Number: 17494 Actually I think LEFT OUTER JOIN is equivalent to LEFT JOIN. The Postgres manual says that the word OUTER is optional. Either way you get "...all rows in the qualified Cartesian product (i.e., all combined rows that pass its join condition), plus one copy of each row in the left-hand table for which there was no right-hand row that passed the join condition." It sounds like the original posters problem was a less than optimal join order, and from what I understand Postgres can't reorder left joins. -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Chris Sent: Monday, March 06, 2006 6:40 PM To: i.v.r. Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Help understanding indexes, explain, and optimizing i.v.r. wrote: > Hi everyone, [Snip] > So I'm wondering what I'm doing wrong. I migrated this database from > MySQL, and on there it ran pretty fast. Have you done an 'analyze' or 'vacuum analyze' over these tables? A left outer join gets *everything* from the second table: > LEFT OUTER JOIN groups ON groups.id = locations.group_id > LEFT OUTER JOIN schools ON schools.location_id = locations.id So they will load everything from groups and schools. Maybe they should be left join's not left outer joins? -- Postgresql & php tutorials http://www.designmagick.com/ ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Tue Mar 7 11:36:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1F07B9DC840 for ; Tue, 7 Mar 2006 11: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 47851-04 for ; Tue, 7 Mar 2006 11:36: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 E0B7A9DCBD2 for ; Tue, 7 Mar 2006 11:36: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 k27FYvds018786; Tue, 7 Mar 2006 10:34:58 -0500 (EST) To: "Dave Dutcher" cc: "'Chris'" , "'i.v.r.'" , pgsql-performance@postgresql.org Subject: Re: Help understanding indexes, explain, and optimizing In-reply-to: <003b01c641f8$39185a70$8300a8c0@tridecap.com> References: <003b01c641f8$39185a70$8300a8c0@tridecap.com> Comments: In-reply-to "Dave Dutcher" message dated "Tue, 07 Mar 2006 09:02:58 -0600" Date: Tue, 07 Mar 2006 10:34:57 -0500 Message-ID: <18785.1141745697@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/58 X-Sequence-Number: 17495 "Dave Dutcher" writes: > It sounds like the original posters problem was a less than optimal join > order, and from what I understand Postgres can't reorder left joins. Not really relevant to the OP's immediate problem, but: that's fixed in CVS HEAD. http://archives.postgresql.org/pgsql-hackers/2005-12/msg00760.php http://archives.postgresql.org/pgsql-committers/2005-12/msg00352.php regards, tom lane From pgsql-performance-owner@postgresql.org Tue Mar 7 12:34:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 399409DCB94 for ; Tue, 7 Mar 2006 12:34: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 61201-03 for ; Tue, 7 Mar 2006 12:34:42 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 7992A9DCB46 for ; Tue, 7 Mar 2006 12:34:39 -0400 (AST) Received: from techforce.com.br (unknown [64.84.33.124]) by svr4.postgresql.org (Postfix) with ESMTP id D37665AF03E for ; Tue, 7 Mar 2006 16:34:38 +0000 (GMT) Received: from techforce.com.br (techforce.com.br [127.0.0.1]) by techforce.com.br (8.12.11/8.12.11) with ESMTP id k27GTMDv024480 for ; Tue, 7 Mar 2006 08:29:22 -0800 From: "andremachado" To: pgsql-performance@postgresql.org Subject: firebird X postgresql 8.1.2 windows, performance comparison Date: Tue, 7 Mar 2006 13:29:22 -0300 Message-Id: <20060307162842.M37264@techforce.com.br> X-Mailer: Open WebMail 2.51 20050228 X-OriginatingIP: 161.148.38.12 (andremachado@techforce.com.br) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=OPENWEBMAIL_ATT_0.826143206653313" 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: 200603/59 X-Sequence-Number: 17496 This is a multi-part message in MIME format. ------=OPENWEBMAIL_ATT_0.826143206653313 Content-Type: text/plain; charset=iso-8859-1 Hello, A friend asked for help to accelerate some postgresql queries on postgresql 8.1.2 for windows. He is comparing with firebird. Firebird was being up to 90 times faster at some queries. Attached is a gziped text file containing some steps I tried on a simple example query. Could get improvements from 270 seconds to 74 seconds. But Firebird effortlessly still can perform the same query at 20 seconds. Please, do you have some suggestion? Thanks. Andre Felipe Machado ------=OPENWEBMAIL_ATT_0.826143206653313 Content-Type: application/x-gzip; name="sql_query_demorada.txt.tar.gz" Content-Disposition: attachment; filename="sql_query_demorada.txt.tar.gz" Content-Transfer-Encoding: base64 H4sICJJhDEQAA3dJa2I4YS50YXIA7FzbchtHkvXr6gv2sUI7WlOzZqvvFzs0ETRFrTkjS7JI2ztP HQ2gAPaw0Q31hRQdfth/2J/bz9mTVdUX9AUAKXltTxgPIgh25cnKysw6mVVQ8T4J31c8vwsXfJ3l 0SLSyg/lZ5/0pRu67tr2Z/+N9//67//zv7ppeZ5lf6bTy9A91/U+M3RbNw0TTzp43rEc7zOmf1o1 xl9VUUY5Y59FS57EGz75XFGlxfRff7evr1+8eP3y+b+xgid8XrJ5VqXl0fmL8Pzy7NunbJlna/bi 7PTVybuT05M39JaxOE15zv6RxSk7PXlxcnH57g29YVnKjvBTw+h2yHO83f7kKaNXR8jrN5cn4cvz i9OTV+z1SyHm9UsaU0t/rqTWvz/tjiZFQxLBztXgczka06rfPGW3VzznTOly8u67789/ePPceESv 2gL8wyaJIJBFaZTc/cRrk/z5n90KXz1iv8zru+/P3v2dvX118vrR8e/19Yh9ExVX7K9kZHY0z4ry uWEFtmdolqNptu7YjqMZPsuz2+K5YViuExjsNl6UV8+R456yo2heVlHCynjNn3uuo3uaYRuaZnq6 p7uaq3v1UAcp0GJJlm3w21NaE4F8mqWLL9nR46wqef5YixdhumTP2WOx+Op38fTxXxg7Txf8A7uY RymrijhdseV1HMYlX4dpVkaheDhcXvM7cpHmczjSsp6crum6pnmWb9paYEvdTMsJPNNU0zKcoDct Q9PNQNMM3Q2sQAt8fXtYd0qkpJiWgvMN24MVYJD6nRzrkTBXIbqG3UN0PNsINMPzNa15Ww8MPNvd wpQvQv6W5yu+tZam0Ni6J7xnWpruulh/w7fgCbazB1y+JPxwQefYdYsyz7aXtf50IIZmcpHl5WAO ZuD4mqMWzbNtT03A1r3eBFzX14IAC+0Gpha4ej3E9SaVly+B+zd+9yWDel0txx8fN7r0McNx4WLB AdoanhYYcBEbk8TCHKzsbqsv+DyJ8mge9ezefr5T7Gi4xYsPm+uOYERZ57fHeP942wiubWq+8h7b hTVUjBnm0Aa+Tx5n25rtBPWIA20gXy/jBJOHFTDLKH9fxTc09d0jJ7NKvfDhlsma5NL4NN70ckvg aWadMB3brdMlvLc3ZzxPy27Ymqn7zar7kzOe1FUkv2VczKMk7Phso2zn76yfCl3P0y3NU1GFLOE4 ul2rPHBVx9Z0LKlm+T5yhGt6ncTQXapLICYsB9nCqC+Z6RmOI6e5Lh4dGfAIvopJx+Jpw1DmOY9K jmRNM4SnbVue5tEQkaNtrvHVpIjOyg2kdRjPQN4ftOkP2rTrNUabTDMwsD/5IjoCw2m2KtAmy3Lc Sdrkm4ZralaA9GeiMvQdpELjN0qbwAY9q+Y/rumYxjRtMkFbMCffMV2yS3A4bXLtwCDySBuIfNfw Fi+wJnmLa9qWr1kwvda8fRBt8j1KdPeFNz1TM20Pm5hrIbEj6f2atKmZg+9Br5Y2GdNExHQtzfIw AdP3wP2CX4M2wccssL0DtNU10/RpACz9GydNO/eh3QzKcJEPXKsmRCg+piiUDvIIe4BJGYH+6xKo 0d17mjI5KHI0Rz+MMxk6wttEpBn2r8WZbMcyLARIzZl8w/WmOZOv+SIpILIcDD2UMjm2heLF83dR JjYgPEjk3dSRbTOIoy5R+GpaCsb3xWxxr0NkxFIV2C7rEpEjSTp2DOyO6yu/eyT8LWxdNzRGWJ6i NzXp2SY8tWBF9b76gwT+QQJ3vEZJoGGDBOo2kUDLxU+zaYAZYHnOJAl0fNt0NJBISm50fqC5gf+L ksBBkO5mfmA0htdQON9xp5kfkjR1jwKwWR8UyrsP8fOwFXiCecl3cqwb2IblTzIvkAOMMVHIas3b hxE/Pwg0x7gnvEUVNI0ybT+wUNXva9bJ1y9F/Oo5oAjxNM9UuoDTNVTK7xM/38WD2KQsQwcD9H8V 4gcWoLnOAdpieR24l2HYWuA5/7TMzzSwIqZitrYT+DuYn+7T4rmosszfF/Oz9EDzgjHm5w6TCgoa 0CjEpvtQ5jdOkXZzPRP1ZI1o2AgTN2i4Xl9JBJyuGyKFO7rmm+aBZM+0HR8TNIydZC+pCqzSDnb1 1eizhzXBxsdO9uDGH99JP/8gWP9/BOt3z6/GyJXh6baviX3KCzwUu/V2gcAJdC9oyJXeC8vAt0xL 80VvzjJ80DLf0H9L5Mo0tHrXJZoEplgne7c/F+x6jjiOtH0bOSZw70OvdN1yNBccs35X8xvfddvG Vh/SNT2wP88UfTX19kH0ysZCadjm7wdvYXOjw2TNCjzX0Pxft6/WzME2sAxBrYtl2Q1h6TctLNAr 2wc59TDiPid8D6BXw6jxUY9Qy8Rz4S3eAeqaCCyi0gZ4pNlM8FCCNRE8vxS/ugfZMC04kWWOkY0+ o8cA6oMaqOXcuocsRxxign7YURvcFq05+lkTNLMldMZwBWwvoD4s/XwQo9tFSAdNkj0tyEPVRu1A dR8lM896kNbyJfVWPrSHkX5CmkeHFC3NozRT07x+hKAUDqjEF31+/9CWnmWZruVhlClZnjvG8hpK VFxltyxKkj5DSKM179ng5x22LHhZkknuMWT7teDFPI83ZZyl+6nEf3zcpv+Rw/e9HrFosQjXcUFO EgpmOTBLtlz+y/DTk6rM1lEZw3WSO5JSMCWGldEs4VjJJehdOucFKzP28t2bb8GLo6rghQbUfH4V 3/Bwnq3XUboYmPhnRpcvy+HHP4KPysGEpIaTQDDuPEriKA3JtX7KUuD2pzEUd54iG29yXhbs5PTi 8gsm/jmjf0iti5NLFuFPjXDh7ExIF6DlFU/JBuQLAhjpvSvf1YeYF4SGgWwdfYjX1VrKxPZU8DkC XJgLE9skvOQwWQyEHpKEzm6ieVUNFmznfC/KKFfoHQlFNdvkGVaq2JIcqtIjpPzAwyXiPcshRNfM oeTX1XoG+p8tWVlBdcyn4ID6glWbRVRiMTB0wWlOBdvkMX7DNOvaBjaOUNcAALMjGTlPhJgJhcqr nCMbJAuJ7egjZv42ToV1049QbBs9jTZiqXpAY2t8Sc9BTpFwvmEzXt5ynnZNjhQIFdpF30ZSPygb Y3dKojsp9dgYIv0g5dGjTD4Koes4SWIl+Qu2xJxa4dNISbyOy8OQojVdG2bRTRQnItpnHCgcqXiz QWAehLnlVcKt7P1utWvRlGkPdSb1Y8uXgGjo9/Gm/foAdLa6zVHt5CFyZYio30SrrewEDx4ifh3N r1c5zLxgcnSTL1odII9JYYBbJhUI1gZ/EaN6sPh8TplkCwP0xLIOgVajAVXDzqol8vse4MZ3+wjm qJGHuDJ+RNTVQST+XvS9vAOa5NUnNfKrd98fYmSCHTXySCjtMzBB7jRwks2vwyL+qc97GgTfCEaS 9AUYVMHEOFpGtoiLaykMMrP0H1mVhyNsSo2e2JKb/exrKYHN8ixazEEykdzym3jOBUNDHMyvONRe VqkIzXCWLeLeEiFgB/JPaRSrRzE1alHlxABO352dXJ6xl9+/Pr08f/O6Btmg3CvDgq/WMGrRE+jv mEO9/LBMGYG8kJ8l2Yo1orq5XPAfQUla0GJbhQEnUCqMuf9eYnBP7NsoTwdE92dmjUC/ylYIqSVb UkhhCLyjFdRO/grpnadgepTrlzl/X+Fj0L/yiqjRVVygOGnUfUraCPoSggZi1Yacm5BPLs9fj4RI Ywwp4vMCClFBJrIC3LAW2YKs4zRcg8P04p6Eoc4hN9xhcTmOJfyGJ/RRhM0tp6Yrpo8IbBUhPLDO uJxKbiKv7oDqbNJz1Dm9pQXPTAu1dUkcQURFBiAD0oJDHwrcVpMintGqFSOajOS8dtJqT4MG8yrP aarZZluHot7YkXzwc12T7nr6Qod0GaN2iJPxZIQA/vLZiaxXEbYQlWerPFpHxbO3oBKrnF989+qZ rxnPsJNGzzbys+J9opHkrr6UTXgOT1hTY1ziVrlgxOS4XCpDVJ28n3+gNny8nVEmaPFZSiRGomyS SDSyYWUUKx2JIhVnRAEpf9JX6GJBKeabKhQ3LkJBCQSX6rkDHYHsWAgFiZnxAuLpCgcCUFFyaXKI JErFo/mVut4h+ccR6uyndTKUfwCvSpVaWE7YJ8sHOjVqmbsc5DC98JFQqwYj3/7xm7N3Z0qJcat0 lLi/aUQ4KuyOOkKNjl1IAZRuGXG9PKYlDlGCFkUnP+zf1UAxBM51mt2mSh6r5TElD0jkveEizjnx 2VHSc5842KFQEwbiuQYRKryAeS7Ku4lAFPXuxZsv2Lcv/r5DPFLLhjIUhXskvY4orkhDYkO6iZJK zngWIkIkYyg20SDB7gk2uMsxTWEWIcxIkKAJQjCPFoLhjO6e0yT9EurXe2aXHFLg3kZIpRlt5iAT KqmJLU5cfxP0XYIK/Fm1CqktUN7hR5wO9u+JZsJC7JKbKC+kvch7kU55Y9WiI52SlHz0IOlvc5mD KCjEKCFX7U3SJ4ip9AFIg3sD8A98Xom8KmeQTQPknBhsydN7AXRmEC1pS5diRPdoALaMqgSbXIlM jxwwL8IyyldNzJIzDLE6260YztrhTA7viBYNqxEP3p8caukdCdS9kdfw5IfCEURm5lS1dGHbfTaM iyyROxnJx/iF2mdLPuiOdfC7dKEVIVhMk5dTftt9bkIBggyzNLmbXr/BrGnMsRhD1q0KguyhFR24 27i8CrN40ecpE3Cn0opCoLQkCWBvzl+AldzVUkn+HRJHPA+TeJZHOSI2wmNbov6EPyFR7piSGCPS gBQmupoJ6hiR5dfZopL9A46iDBOj1iVsywc12FRqGtnQsHFUa9FFZtGMslxdl6ksfM0EBIGKjBnO 4nIdbWh7P8yAI6wGsERqACKFHQtp9MeixbmKiqtoNSTrE/XZThiSBQ+GuJyvoial9NDEpYFPhCZv IPRARPyNWO4hIELWqOHWdL46NpcHoAhZo3NJwYToROVTGIxk8cWxEDeGVfD3Y1Z7mMsVsl6Mo2TU eoU4Uh55PWBedHsmnmPHF0Ixx00HqEQKmprUfYEuz1+w7cngtw0mUxIjHynBJwz3Ix5UaWAWza+L hDxZyhK9rixHsYvkxqRgsFLsmlEiEOVNoUm+Mj6r7ws1pViwFsQosDdV2eV9Z//19tXJ+Wv2w9m7 r99cnAkswKZREm7ixVjJN31uQ20uZUOwXbBe2vXfwno1g9nwebyMoYcq5QCVR+ESORi1ZryKe22c PVV2275TYxUBI/mYmRALOx7LBkdDaekEDKVKkiDP8rYh3kHY1TyiQ65jUS+IVD7jdxl1+K5i7MJF NVMlo2gspBn91xuE86jgdIC1LO7SeV/23lV8meV0wEZjr/IsjX+K6qZ33ZhumwXLitrA0YqHt3Ix DkJQC0eD2y4odSFurziV3Tlmi+1RLp3kclGndwTcFX+f7ZjYnqhb8ZRTp0v8lzV1+V2fgpHoEFvy dOYYKW//8+y7N18yNSoWkbyQrLPcYjfkJxk+yMUIoqwoTzC/ogYm1WT7YcSWI84pgVvPFCEsh6td P0pWGex9ta4hNlmWTPR5D4NIF/FNvKiQKSiLyPDbVMmWAeXNQtGRjaN+62ykiyxB1KgbKmRRf1dw auJnkyjb5yz7UVqO2wzEhMQ5Mt0cK7bDSyyRWkwgXs2i6Y4Uu39TahVComxI9bRrqvHHeOLxSFfq EYspwe5Q5/7KCIm1OqPKiCcm1EG2X9HhDPIDVcsH0vEXzeOUv5QQRsU7GZzIwy+TOP/6BjuQ7MJV 87LNnku4F8pOgX6dz8DHCx6nhWhJHDglgY88JoL8bzxH0GRFpxVBN04q+N1MlKoRbZKIDwI6plPk tIjJ/xW+tH14hRUbHKHsLySbYSoTNNpIsdsY1/xu6E3YDM5fnX35rCryZ0mGAgaOUrxPnvFy/gxj HQ2jUEft0IFG1dvHiA6MvgeoNmehTH4zdVYEqXUfdwfe5HzjOWEkc+lQ5XTYjAgXJ1yyP5iochjc SXQT6LxZyS3vNrtyw065zTGE6P1h41NWozqffIOcFeYSrecu6OjZxG7QZmWidFXR+QSyq4yKRhiF Q8NtFFCGLTMa60HuBxL6SookeKBoyTQC5bF/IWGwy4DPTHCWh8DIbUtJH960+EjpE01Myjo8DaPF gnaxMX/98w4oClvlxzk7f8uUmCNePCVKIYXjHQFlK/gzqof5KGOYylHiZE70cYpqTo1uMDHWylGC F9QdT+sGUl9GUSIAdnU/usPJbG0DTlUFNcx0e5tCfhXSiMNgWlEESOMotRQNUDFpq52GShfyZLug I4EspSs286QSZ48LtQ3WEPWuODqXaQgxkXps3WOr72stGLZq0Q3ja3lYSFAwfpaHsOgsw5Zx15Na 881pu7UjgQeBK+DUCaCGEB1boBD2YQZTzL4eWR/xiVPvbrd0pMNMiLRc03cF2mO84yd/P36yPn6y CJ988+TbJxfabh8RG5uQu6H9PU9H/WN0lz1w8dqYVVy19TSSXUMkccqppl7GH0Ygnoys12mWlnkm mLbMO6LbJSTICkO4Ck2FZEsUOrSuvSls/KaWOHYNa3B82zbrR88+olkGjq6K0BqAeql0iYcrd9Ja baSz9lSRaxqlw3SPaYtLneJSUEd+XRzRsRxJZFFJOVJqI64KyC41zDKmxdRm+RFn+VsY4gBiNFr2 xYsced9oUY2jUcA9eOo8+p6AeVZKpyJTDGQbtj1SPTZ3ept4Y7UY6S/ZfF7lqsp/TQ5YQcMe3ki1 Sk1x8xMAXsdJNrtrIIc+2pWdgrQMP22rSmKA1JRsXXbLQZrPR5Zs94LNq7UofW/4fdcMFU4KMslD Oo+p7bAb81INQRYg4dQZrFOlmB2lOZHr1BUB+mstGqh0kwIMhRQMb7P8GnG33gYwXMsfuZc5uKu0 pv9M+E6Fs2ipUN7uyFf3A9SZEIbtYUM7T/WGt/Q6l1g6chWSsAfdzgvVbYEe0kG3sVqsAr8nZZTy rCqSO3lpRpq8vqOhlra9VS20KNZh/1Zii0dXIu+nhjgjkgIJV6b4JZ2pypNI5NgSpcq18OlagZwn oy2rB5hh5HzzQD3qG4BRPri0JPQYUaOpv4Z6NFcDIa4SoaxwRBOEOpN5CK6y2joV/Jm5IzdfhzCt DCZlKNHiwg8q4pHF/JlZk3cvx2cgL+6QNKU5XUSQDts94W00PyQgW+lCmLg+un0MTECgJ9jQ+CLc uvRVCzU/Ki5q2f3zYMJFNpxfo2zZbB/VNrj2IZc0hRAmhIi79M3+AJANanNktAXdPczvNgOmP9V1 Fg83o4Wkqe5yM8qxRxe8Vvfy9K0U0k36ojJEjqaFgKFC+obH9H3pkXVIs+4Xkdqr+EIcnVyr8/B4 pME30Y16BaWo6SUWrR2NnK5EUtsva1tSWNZFJnPa6P2un9kuR91/tSuiTbw9NYRLLXk5p/PkJvWR FlzWkuF4mTux0uKbMFQoNt99ETc3ok1JnWwlSh2JiVl3S5CcrxD9yyS6yYZ4Qny0uKFNb9fdDQgB T8jp/C6X1Sp7LEU+BkTB6WtOg7sMHUF/okblF5tqloyx8rYnDIOtIyVP9cIoTcsOZ8OOqaUqHz1+ X0WJOM8RaoiO48dc4FUef1Tf9Xo6fZNXodXdsxE0XzPGvn3UJleFpkSQTOHOYX2dfkTmno2vk99k ZCiqU0sUZGd210EnVKqOy3CdLaYapKN07h0iszsNKSahy30opbHrXHGQTEGnRiSOXZ6XxRm8XO3W kqDJrojUu+4/IIHStUbk7vp7deTqRZGMTmDPROrju4uLVz0+RvfqFxESM51NyCvF6rS82CXwc03T Pmf1g6Id356UA0gdiEtTNdx9/ALh7qPjeneBsOyWck3d7DnqldZPRY5K77b6PaJaCOUXNGSFe5C9 TrOEjtMK+W2MYzmyUzJQx6y+K0k76U1c3jVoarmUGe+D1kGQlw9UM6H9bmXRoCBJ8f9r71p247ah aNf+ikFW7cKE+BQFo4su2sCA4y7soGg2hmFP6gFsj5OZqYF+fe8hJY4e1Gs87tiFCARSgoiX1FC8 h5eX56yxNMm/0pWbQTusfJl/X2I95I3Rm6z2Jx/iVC0q2ppZPkdfXH9n6MmRL85ZvsobWJnKO5xG 9QMNlo7zajBSKgcqVxuCXi5RFm+Qnrqtrny6dz8rK5wiTLW6X6K/eXU+ZFtYgcn1zRNhU0Jf97QK xfjYNE5+NU1+auA5AJdQDZlzOO5hsY6YWNze17e8ot9Y9bTDYrXaYKxVDMVqxzHdv6/vx9Xe2fz5 w1O7Tyi8wsj1ENW5RAZiwzX4+L138mQcp0O/RMITWysfP13GVicheFGcQvYpi377By/Sr8XyM80u mxb/kwbpg0uAwjJsDs6VxdeWkyvRL+yjj+Xh1BUyf/9yJ4RCttDs7PTi8tdzZ/v898vT3/4MllpT ulrdBvaNy+FTPyvRSF9uvt8gsJDvgqFmjxnasmi3lQ7Opi0CCKUqCZ3W8mprJst5sz2d67FTz6Yt DOFlXD0ieWf+zSVy9Bq6hHdczT4AWf58/vns7AP2rd1fZ6cXM/cvVPvmcUELMXI383V0Z2dA+nN4 ynM54d8+U63HtCy4dr8SKg+xZp8XfVszjYOQ9WTGftPLZ5dY5x/O1w1N0zVTNEU6koJy+IOWb7wL vl67XbdZ+dEuc9Gj25WaI5NK7yHuWsXN/Io8gtRddc+p7ZoRt6yjX7i8YRUPCZRtuIPfbmmG0bFe +AkwHIVuGLhb1DxTz8nzUv1f3QHafBPHT7khZbphBz9e1c7wjrh0kw5jz9f3Xb5k1p38Ug3oHTuL RW0YWZVFB1r1xy9nuVHk/V09zNd3yxiFBuKSyPK5jqUWogEeNvk9E1dHiNvSn5viuGE44r5Zl7IJ Y9Hi2g+ZiN0Dxz7dD0ZcDBEfwD8EJ6k7D/R+bmNx1FZ4+EieYuMO5oeTYk84nZzX5X/jO5p9HXj6 kYPcfktDU7DQlBQwHBFNdV15Ul9oNphhjnwoneoPtf9UqzJ2uOAkfuaghXjmaGa0liZupEk2OLEN TmyDLSVK5ZxAjEiA5ynVOrMsK0hAueSp1e1sg0KrjKV4UhgJiqjE7pXK+WL+zbNddfMKGp0IzVTQ 3TAiVVkHaXNCfWQm1UoyrsQIVkGZKM1S6m5xl/NhJVJmW9bkOltYKrRImIZMV7jdiVVQGq2YtCPN g3lWcXDQcmskS81/LnK2F9oybkoEuspYJXU7bRlESYR7KtFMFjJbDd6yZlPLBIjhdUtDldmgEpKY wChYp8UVNLI4B7U5fTtMFKTGNLAMl62GfdkPByK9JOiaSCuo3wNaLKlniWBOUkPZ4YTYvrweB2L5 029nOuTQUivE/roFNWjkQ+lRJpCfeznRoaVZhDF/LRgAU9lFdJhl2hEd0vXwRIcDm53Qf3WjmWmz W6t96SY6rJNEGyVk6sRuOugDqxirwK0nWwh7VPZ6HSAtVFQQTU2cza+Fot4jfIogJqFosrQW34XU im9FBbmx5Itb8RLnKTP0LdFMJAmwyHS8ZuwA79ut1SmE3n77VUFY8ndNqIQ506T0HDxEO1TypQ0z tEA8X3oQgmeV7qE0BQwtXmZN2bFJr59wr/zlxNpM9ak4FHsx63U6WIMXz6B5hK1psCRqODoln09v QTvnj5vclRstWwmQMSC1hvf3N53ePw44Mq9iMsKmoHcBiuiUJekQzuX9YYy94Iomg7LxgI9ZaYfg igaWIKgGpnJ/zZ2sFVmrUyZzIoOeqtiyVg/wyvvED0Obio8NJOxbjZ/B8GEUZEgVlxnTNAc4xKD6 CYf7AAMCLrolqlMHChNSmJDCcRtS4Iw7qnBJTp6miBBZEUaodqQgtcQqn7EsSSUnN6wOARXA+z8Q KuiEaWh6WSkg4246HJcvB8MKOgmhoj6sIA3hBMJ5ipbzGUtKrOlvAyw4RW2nZpVl1FQ5IpblIgSG 56ECExxx0LmNeG7IfyUIiBR3O+AFggk2HWNVUQetgVFhkq0fec+QQZL3tkqhS/QelTY7wQZaw2Nm 8dcgm9q+lueaZRJqF+56ENgwtKkJtZBeT8akHBt1GAUbMq61dpPVUNiwj70ckPhOoYhDb+i8R4QR xxhCWYQ1Gc/IK22VeghjWBG0PdK0LqbHoWGC8c+s4ARTRDZeKerlGMMFqtM4xmhE1w00SMhJKq0V OYU3izEgyR50t2oYo66aTD6cY0uJOoHfo+jU28EY5KehJ0ZuLLG01tcjMAYApHEq1u6m8Nzatm5H cEnrOONkv/K7XWISOeYebFVJCFBjQArCUZn4H4QlZAbtN40uQac3E7thDHLBbpsD19wTp2E3qSnQ KQmrIQTlr4fBGAObSosVJaC1RjOfMq+JMqzIhITKaQRl/DCVqUxlKlOZylSmMpWpTGUqU5nKmPIv 7Uza3gCgAAA= ------=OPENWEBMAIL_ATT_0.826143206653313-- From pgsql-performance-owner@postgresql.org Tue Mar 7 12:42:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 234349DC83A for ; Tue, 7 Mar 2006 12:42: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 65962-01 for ; Tue, 7 Mar 2006 12:42:44 -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 1598C9DC860 for ; Tue, 7 Mar 2006 12:42:42 -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 k27GU2S5031441; Tue, 7 Mar 2006 08:30:03 -0800 Message-ID: <440DB85D.2040804@commandprompt.com> Date: Tue, 07 Mar 2006 08:44:13 -0800 From: "Joshua D. Drake" User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: andremachado CC: pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison References: <20060307162842.M37264@techforce.com.br> In-Reply-To: <20060307162842.M37264@techforce.com.br> 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]); Tue, 07 Mar 2006 08:30:03 -0800 (PST) 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: 200603/60 X-Sequence-Number: 17497 andremachado wrote: > Hello, > A friend asked for help to accelerate some postgresql queries on postgresql > 8.1.2 for windows. > He is comparing with firebird. > Firebird was being up to 90 times faster at some queries. > Attached is a gziped text file containing some steps I tried on a simple > example query. > Could get improvements from 270 seconds to 74 seconds. > But Firebird effortlessly still can perform the same query at 20 seconds. > Please, do you have some suggestion? > Thanks. > Try increasing your work mem and shared buffers considerably. Sincerely, Joshua D. Drake > Andre Felipe Machado > > > ------------------------------------------------------------------------ > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- The PostgreSQL Company - Command Prompt, Inc. 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 Tue Mar 7 12:57:45 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 555EB9DC83A for ; Tue, 7 Mar 2006 12:57: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 69719-01 for ; Tue, 7 Mar 2006 12:57:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web53209.mail.yahoo.com (web53209.mail.yahoo.com [206.190.49.79]) by postgresql.org (Postfix) with SMTP id D63DE9DC851 for ; Tue, 7 Mar 2006 12:57:41 -0400 (AST) Received: (qmail 72852 invoked by uid 60001); 7 Mar 2006 16:57: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:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=1yeLke0LlQ8FIVhybiJRBp/faJ6HytBnVYh1vrK6nuZf9rAWS0D3Pc6eI3dwXgJIkiu84+RniKJuONu668p9Z+UQK21odsitiZLHZ2RCFiMBCKmhl/wfLmYt9S0N6qAaqCVQ7e8BqpnRZcJtMFPqNRgaru7r4FECJLSVHLIKo6w= ; Message-ID: <20060307165739.72850.qmail@web53209.mail.yahoo.com> Received: from [201.35.218.73] by web53209.mail.yahoo.com via HTTP; Tue, 07 Mar 2006 13:57:39 ART Date: Tue, 7 Mar 2006 13:57:39 -0300 (ART) From: Carlos Henrique Reimer Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison To: pgsql-performance@postgresql.org In-Reply-To: <20060307162842.M37264@techforce.com.br> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-142276793-1141750659=:71939" Content-Transfer-Encoding: 8bit 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: 200603/61 X-Sequence-Number: 17498 --0-142276793-1141750659=:71939 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Andre, I noticed that enable_bitmapscan and enable_seqscan are off, is there a reason for it? Have you tried with enable_bitmapscan on? How much RAM do you have? What kind of disks are being used? Beste regards, Reimer 55-47-33270878 Blumenau - SC - Brazil andremachado escreveu: Hello, A friend asked for help to accelerate some postgresql queries on postgresql 8.1.2 for windows. He is comparing with firebird. Firebird was being up to 90 times faster at some queries. Attached is a gziped text file containing some steps I tried on a simple example query. Could get improvements from 270 seconds to 74 seconds. But Firebird effortlessly still can perform the same query at 20 seconds. Please, do you have some suggestion? Thanks. Andre Felipe Machado ---------------------------(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 --------------------------------- Yahoo! Acesso Gr�tis Internet r�pida e gr�tis. Instale o discador agora! --0-142276793-1141750659=:71939 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Andre,
 
I noticed that enable_bitmapscan and enable_seqscan are off, is there a reason for it? Have you tried with enable_bitmapscan on?
 
How much RAM do you have? What kind of disks are being used?
 
Beste regards,
 
Reimer
55-47-33270878
Blumenau - SC - Brazil

andremachado <andremachado@techforce.com.br> escreveu:
Hello,
A friend asked for help to accelerate some postgresql queries on postgresql
8.1.2 for windows.
He is comparing with firebird.
Firebird was being up to 90 times faster at some queries.
Attached is a gziped text file containing some steps I tried on a simple
example query.
Could get improvements from 270 seconds to 74 seconds.
But Firebird effortless ly still can perform the same query at 20 seconds.
Please, do you have some suggestion?
Thanks.
Andre Felipe Machado


---------------------------(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


Yahoo! Acesso Gr�tis
Internet r�pida e gr�tis. Instale o discador agora! --0-142276793-1141750659=:71939-- From pgsql-performance-owner@postgresql.org Tue Mar 7 13:08:58 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0ABE09DC860 for ; Tue, 7 Mar 2006 13: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 68875-08 for ; Tue, 7 Mar 2006 13:08:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 42DF09DC851 for ; Tue, 7 Mar 2006 13:08:54 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 7 Mar 2006 17:08:53 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 07 Mar 2006 11:08:53 -0600 Subject: Re: firebird X postgresql 8.1.2 windows, performance From: Scott Marlowe To: andremachado Cc: pgsql-performance@postgresql.org In-Reply-To: <20060307162842.M37264@techforce.com.br> References: <20060307162842.M37264@techforce.com.br> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1141751333.18820.172.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 07 Mar 2006 11:08:53 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.15 required=5 tests=[AWL=0.149, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.15 X-Spam-Level: X-Archive-Number: 200603/62 X-Sequence-Number: 17499 On Tue, 2006-03-07 at 10:29, andremachado wrote: > Hello, > A friend asked for help to accelerate some postgresql queries on postgresql > 8.1.2 for windows. > He is comparing with firebird. > Firebird was being up to 90 times faster at some queries. > Attached is a gziped text file containing some steps I tried on a simple > example query. > Could get improvements from 270 seconds to 74 seconds. > But Firebird effortlessly still can perform the same query at 20 seconds. > Please, do you have some suggestion? First off, PostgreSQL on Windows is still kinda new, so it's quite possible that on some flavor of unix the disparity we're seeing wouldn't be so great. You may be seeing some issue with PostgreSQL's fairly new windows port instead of some basic postgresql problem. Is this running on the same basic hardware for both databases? I would imagine so, but just wanted to check. As someone else mentioned, try cranking up work mem, and to a lesser extent, shared_buffers. Also, as mentioned, why are bitmap scans and seq scans turned off? Bitmap scans are quite a nice improvement, and sometimes, a sequential scan is faster than an index. Forcing PostgreSQL to always use an index it not really a good idea. Lastly, I noticed that after you clusters on all your indexes, the query planner switched from a merge join to a hash join, and it was slower. You might wanna try turning off hash joins for a quick test to see if merge joins are any faster. Lastly, you might want to compare the two databases running on linux or BSD to see how they compare there. From pgsql-performance-owner@postgresql.org Tue Mar 7 13:15:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2A1659DC95A for ; Tue, 7 Mar 2006 13:15: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 77120-01 for ; Tue, 7 Mar 2006 13:15:17 -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 A68DA9DC896 for ; Tue, 7 Mar 2006 13:15:16 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 07 Mar 2006 14:38:03 -0300 X-IronPort-AV: i="3.99,385,1131332400"; d="scan'208"; a="34777249:sNHT18595228" Received: from alvh.no-ip.org (201.221.201.29) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD0096D11D; Tue, 7 Mar 2006 14:15:15 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 459F9C45AFD; Tue, 7 Mar 2006 14:15:14 -0300 (CLST) Date: Tue, 7 Mar 2006 14:15:14 -0300 From: Alvaro Herrera To: Scott Marlowe Cc: andremachado , pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance Message-ID: <20060307171514.GE6748@surnet.cl> Mail-Followup-To: Scott Marlowe , andremachado , pgsql-performance@postgresql.org References: <20060307162842.M37264@techforce.com.br> <1141751333.18820.172.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1141751333.18820.172.camel@state.g2switchworks.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.581 required=5 tests=[AWL=-0.338, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.581 X-Spam-Level: * X-Archive-Number: 200603/63 X-Sequence-Number: 17500 Scott Marlowe wrote: > Lastly, I noticed that after you clusters on all your indexes, the query > planner switched from a merge join to a hash join, and it was slower. > You might wanna try turning off hash joins for a quick test to see if > merge joins are any faster. Anyway please note that clustering "all indexes" does not really make sense. You can cluster only on one index. If you cluster on another, then the first clustering will be lost. Better make sure to cluster on the one index where it makes the most difference. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Tue Mar 7 13:19:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 08B5A9DCB94 for ; Tue, 7 Mar 2006 13:19: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 71030-10 for ; Tue, 7 Mar 2006 13:19:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 90C689DCC05 for ; Tue, 7 Mar 2006 13:18:59 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 7 Mar 2006 17:18:59 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 07 Mar 2006 11:18:59 -0600 Subject: Re: firebird X postgresql 8.1.2 windows, performance From: Scott Marlowe To: Alvaro Herrera Cc: andremachado , pgsql-performance@postgresql.org In-Reply-To: <20060307171514.GE6748@surnet.cl> References: <20060307162842.M37264@techforce.com.br> <1141751333.18820.172.camel@state.g2switchworks.com> <20060307171514.GE6748@surnet.cl> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1141751939.18820.174.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 07 Mar 2006 11:18:59 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.15 required=5 tests=[AWL=0.149, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.15 X-Spam-Level: X-Archive-Number: 200603/64 X-Sequence-Number: 17501 On Tue, 2006-03-07 at 11:15, Alvaro Herrera wrote: > Scott Marlowe wrote: > > > Lastly, I noticed that after you clusters on all your indexes, the query > > planner switched from a merge join to a hash join, and it was slower. > > You might wanna try turning off hash joins for a quick test to see if > > merge joins are any faster. > > Anyway please note that clustering "all indexes" does not really make > sense. You can cluster only on one index. If you cluster on another, > then the first clustering will be lost. Better make sure to cluster on > the one index where it makes the most difference. Note that I was referring to his clustering on an index for each table. I.e. not on every single index. but he clustered on four tables / indexes at once, so that was what I was referring to. Sorry for any confusion there. So, do you see any obvious, low hanging fruit here? From pgsql-performance-owner@postgresql.org Tue Mar 7 13:22:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3A0DC9DC9A3 for ; Tue, 7 Mar 2006 13:22: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 74218-09 for ; Tue, 7 Mar 2006 13:22:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id 9FC609DC97A for ; Tue, 7 Mar 2006 13:22:25 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 07 Mar 2006 14:46:51 -0300 X-IronPort-AV: i="4.02,172,1139194800"; d="scan'208"; a="45026893:sNHT19437220" Received: from alvh.no-ip.org (201.221.201.29) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD0096D457; Tue, 7 Mar 2006 14:22:24 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id B7F82C45AFD; Tue, 7 Mar 2006 14:22:24 -0300 (CLST) Date: Tue, 7 Mar 2006 14:22:24 -0300 From: Alvaro Herrera To: Scott Marlowe Cc: andremachado , pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance Message-ID: <20060307172224.GG6748@surnet.cl> Mail-Followup-To: Scott Marlowe , andremachado , pgsql-performance@postgresql.org References: <20060307162842.M37264@techforce.com.br> <1141751333.18820.172.camel@state.g2switchworks.com> <20060307171514.GE6748@surnet.cl> <1141751939.18820.174.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1141751939.18820.174.camel@state.g2switchworks.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.58 required=5 tests=[AWL=-0.339, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.58 X-Spam-Level: * X-Archive-Number: 200603/65 X-Sequence-Number: 17502 Scott Marlowe wrote: > On Tue, 2006-03-07 at 11:15, Alvaro Herrera wrote: > > Scott Marlowe wrote: > > > > > Lastly, I noticed that after you clusters on all your indexes, the query > > > planner switched from a merge join to a hash join, and it was slower. > > > You might wanna try turning off hash joins for a quick test to see if > > > merge joins are any faster. > > > > Anyway please note that clustering "all indexes" does not really make > > sense. You can cluster only on one index. If you cluster on another, > > then the first clustering will be lost. Better make sure to cluster on > > the one index where it makes the most difference. > > Note that I was referring to his clustering on an index for each table. > I.e. not on every single index. but he clustered on four tables / > indexes at once, so that was what I was referring to. Sorry for any > confusion there. Ah, sorry, I misinterpreted. > So, do you see any obvious, low hanging fruit here? Sorry, I didn't look at his test case very closely :-( -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Tue Mar 7 14:08:56 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6CEB19DCAAF for ; Tue, 7 Mar 2006 14:08: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 92444-06 for ; Tue, 7 Mar 2006 14:08:54 -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 36B7C9DCA8D for ; Tue, 7 Mar 2006 14:08:50 -0400 (AST) Received: (qmail 7207 invoked from network); 7 Mar 2006 19:09:16 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 7 Mar 2006 19:09:16 +0100 Date: Tue, 07 Mar 2006 19:09:15 +0100 To: "Jim C. Nasby" Subject: Re: Planner enhancement suggestion. Cc: pgsql-performance@postgresql.org References: <20060307001913.GS51968@pervasive.com> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <20060307001913.GS51968@pervasive.com> User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/66 X-Sequence-Number: 17503 > The problem is that you're now talking about doing 2 index scans instead > of just one and a sort. It depends on what you call an index scan : a- Scanning just the index (no heap lookup) to create a bitmap b- Scanning the index and hitting the heap in index order to retrieve the rows (a) should be quite fast, because indexes generally use less space than the main table, and have good locality of reference. (b) is OK if the table fits in memory, but if it has to seek on every row from the heap... So, when doing : SELECT * FROM products WHERE category=C ORDER BY price LIMIT 20; If the category contains few products, using the index on category then sorting is good. However, if the category contains many items, postgres is likely to use the index on price to avoid the sort. It needs to lose time fetching many rows from the heap which will not be in category C. In that case, I guess it would be a win to build a bitmap of the pages containing rows which belongs to category C, and only do the heap lookup on these pages. I have a query like that. When category C contains cheap products, the index scan on price finds them pretty quick. However if it is a category containing mostly expensive products, the index scan will have to hit most of the table in order to find them. The time needed for the query for these two extreme varies from 1 ms to about 20 ms (and that's because the table is fully cached, or else the worst case would be a lot slower). I would definitely prefer a constant 2 ms. The other solution is to create an index on (category,price), but this path leads to lots, lots of indexes given all the combinations. The bitmap trick I proposed in my previous post would be even more interesting if the table is clustered on category (which seems a reasonable thing to do). > If the correlation on price is high, it could > still win. As the cost estimator for index scan stands right now, > there's no way such a plan would be chosen unless correlation was > extremely high, however. Does the cost estimator know about this kind of correlation ? From pgsql-performance-owner@postgresql.org Tue Mar 7 14:37:36 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5CAB09DCBEE for ; Tue, 7 Mar 2006 14:37: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 98116-08 for ; Tue, 7 Mar 2006 14:37:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id EF5939DCB46 for ; Tue, 7 Mar 2006 14:37:30 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 4BF415646A; Tue, 7 Mar 2006 12:37:16 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 12:37:16 -0600 Date: Tue, 7 Mar 2006 12:37:15 -0600 From: "Jim C. Nasby" To: PFC Cc: pgsql-performance@postgresql.org Subject: Re: Planner enhancement suggestion. Message-ID: <20060307183715.GU82989@pervasive.com> References: <20060307001913.GS51968@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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:lists@peufeu.com::c5udBtpFtXOtvxqZ:02SDe X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::PqrLYIwWie8bg/kF:00000 0000000000000000000000000qfZ X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/67 X-Sequence-Number: 17504 On Tue, Mar 07, 2006 at 07:09:15PM +0100, PFC wrote: > > >The problem is that you're now talking about doing 2 index scans instead > >of just one and a sort. > > It depends on what you call an index scan : > a- Scanning just the index (no heap lookup) to create a bitmap Sure, and then you scan the other index and read the heap at the same time (b). Your plan requires doing both. The question is: in what cases will it be faster to scan the extra index and build the bitmap vs. just doing a sort. > b- Scanning the index and hitting the heap in index order to > retrieve the rows > > (a) should be quite fast, because indexes generally use less space > than the main table, and have good locality of reference. (b) is OK if the > table fits in memory, but if it has to seek on every row from the heap... If the table fits in memory, who cares? A sort should be damn fast at that point, because you're dealing with a small set of data. > So, when doing : > SELECT * FROM products WHERE category=C ORDER BY price LIMIT 20; > > If the category contains few products, using the index on category > then sorting is good. > However, if the category contains many items, postgres is likely to > use the index on price to avoid the sort. It needs to lose time fetching Have you actually seen this behavior? My experience is that you have to have a correlation somewhere over 80-90% before an index scan is favored over a seqscan + sort (which as I mentioned before appears to be broken). > The bitmap trick I proposed in my previous post would be even more > interesting if the table is clustered on category (which seems a > reasonable thing to do). In which case it's highly unlikely that using the price index will buy you anything. > Does the cost estimator know about this kind of correlation ? Yes. The problem is that the index scan cost estimator figures out a best and worst case cost, and then interpolates between the two using correlation^2. IMO it should be using abs(correlation) to do this, and there's some data at http://stats.distributed.net/~decibel/ that backs this up. There's also been some discussions on -hackers (search the archives for "index cost correlation nasby"), but I've not had time to follow up on this. If you wanted to test a new index cost formula it would be a one line change to the code. -- 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 Mar 7 14:43:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 064619DCC40 for ; Tue, 7 Mar 2006 14:43: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 01659-04 for ; Tue, 7 Mar 2006 14:43:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 915B79DCBF3 for ; Tue, 7 Mar 2006 14:43:27 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id E71BE5646E; Tue, 7 Mar 2006 12:43:27 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 12:43:27 -0600 Date: Tue, 7 Mar 2006 12:43:27 -0600 From: "Jim C. Nasby" To: Guido Neitzer Cc: Postgresql Performance Subject: Re: t1000/t2000 sun-servers Message-ID: <20060307184326.GV82989@pervasive.com> References: <440C974D.7000808@sun.com> <0EED23D8-4ECF-498B-8AF6-A453A0E34702@pharmaline.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0EED23D8-4ECF-498B-8AF6-A453A0E34702@pharmaline.de> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:guido.neitzer@pharmaline.de::XXFUXE+8xW3azUiY:0000000000 000000000000000000000000A2KV X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::u6DJuG0x+JLwfW+0:00000 000000000000000000000000049r X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/68 X-Sequence-Number: 17505 On Mon, Mar 06, 2006 at 10:24:29PM +0100, Guido Neitzer wrote: > On 06.03.2006, at 21:10 Uhr, Jignesh K. Shah wrote: > > >Like migrate all your postgresql databases to one T2000. You might > >see that your average response time may not be faster but it can > >handle probably all your databases migrated to one T2000. > > > >In essence, your single thread performance will not speed up on Sun > >Fire T2000 but you can certainly use it to replace all your > >individual postgresql servers in your organization or see higher > >scalability in terms of number of users handled with 1 server with > >Sun Fire T2000. > > How good is a pgbench test for evaluating things like this? I have > used it to compare several machines, operating systems and PostgreSQL > versions - but it was more or less just out of curiosity. The real > evaluation was made with "real life tests" - mostly scripts which > also tested the application server itself. > > But as it was it's easy to compare several machines with pgbench, I > just did the tests and they were interesting and reflected the real > world not as bad as I had thought from a "benchmark". > > So, personally I'm interested in a simple pgbench test - perhaps with > some more ( > 50) clients simulated ... I had the opportunity to do some dbt2 testing on Solaris and Sun hardware; it's probably your best bet for a test. You'll need to essentially fit the database into memory though, otherwise you'll be completely I/O bound. Another issue is that currently the test framework runs on the same machine as the database, so it's not very realistic in that regard, but if you were to change that dependancy I'm pretty sure OSBC would gratefully accept patches. -- 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 Mar 7 14:46:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7D3DC9DCBF3; Tue, 7 Mar 2006 14:46: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 01583-07; Tue, 7 Mar 2006 14:46:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 38B3F9DCA52; Tue, 7 Mar 2006 14:45:59 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id C8EDC5646E; Tue, 7 Mar 2006 12:45:59 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 12:45:58 -0600 Date: Tue, 7 Mar 2006 12:45:58 -0600 From: "Jim C. Nasby" To: "Marc G. Fournier" Cc: newz@bearfruit.org, Nagita Karunaratne , pgsql-performance@postgresql.org Subject: Re: Postgres on VPS - how much is enough? Message-ID: <20060307184558.GW82989@pervasive.com> References: <20060306131355.A1227@ganymede.hub.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060306131355.A1227@ganymede.hub.org> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:scrappy@postgresql.org::ajIzrcb4P6ntohlo:000000000000000 0000000000000000000000001oHe X-Hashcash: 1:20:060307:newz@bearfruit.org::sZJtSSalP4giAsen:0000000000000000000 0000000000000000000000006U9A X-Hashcash: 1:20:060307:nagita.k@gmail.com::1iCppf+1VYNf54Uy:0000000000000000000 0000000000000000000000004xPq X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::Rc1FSzNPEEnSgeHA:00000 0000000000000000000000001hHq X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/69 X-Sequence-Number: 17506 On Mon, Mar 06, 2006 at 01:14:45PM -0400, Marc G. Fournier wrote: > We host VPSs here (http://www.hub.org) and don't use the 'single file, > virtual file system' to put them into ... it must depend on where you > host? Yeah, but aren't you also using FreeBSD jails? AFAIK linux doesn't have an equivalent to jail; all their VPS stuff actually brings up a full-blown copy of linux, kernel and all. -- 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 Mar 7 15:00:24 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E02849DCB46 for ; Tue, 7 Mar 2006 15:00: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 06713-01 for ; Tue, 7 Mar 2006 15:00:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 83F739DCB0A for ; Tue, 7 Mar 2006 15:00:20 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id EDC795646A; Tue, 7 Mar 2006 13:00:20 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 13:00:19 -0600 Date: Tue, 7 Mar 2006 13:00:19 -0600 From: "Jim C. Nasby" To: Jeremy Haile Cc: pgsql-performance@postgresql.org Subject: Re: Postgres and Ingres R3 / SAN Message-ID: <20060307190019.GX82989@pervasive.com> References: <20060306131355.A1227@ganymede.hub.org> <1141675112.28202.255960101@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1141675112.28202.255960101@webmail.messagingengine.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:jhaile@fastmail.fm::SVIST9B10eWbCiLr:0000000000000000000 000000000000000000000000Ee3q X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::6LU5uDhSOvNAqRit:00000 00000000000000000000000036E8 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/70 X-Sequence-Number: 17507 Please don't steal threds; post a new email rather than replying to an existing thread. On Mon, Mar 06, 2006 at 02:58:32PM -0500, Jeremy Haile wrote: > Clustering solutions for PostgreSQL are currently pretty limited. Slony > could be a good option in the future, but it currently only supports > Master-Slave replication (not true clustering) and in my experience is a > pain to set up and administer. Bizgres MPP has a lot of promise, > especially for data warehouses, but it currently doesn't have the best > OLTP database performance. > > So, I had a couple of questions: > 1) I have heard bad things from people on this list regarding SANs - but > is there a better alternative for a high performance database cluster? > (both for redundancy and performance) I've heard internal storage > touted before, but then you have to do something like master-master > replication to get horizontal scalability and write performance will > suffer. PostgreSQL on a SAN won't buy you what I think you think it will. It's essentially impossible to safely run two PostgreSQL installs off the same data files without destroying your data. What a SAN can buy you is disk-level replication, but I've no experience with that. > 2) Has anyone on this list had experience using Ingres R3 in a clustered > environment? I am considering using Ingres R3's built-in clustering > support with a SAN, but am interested to know other people's experiences > before we start toying with this possibility. Any experience with the > Ingres support from Computer Associates? Good/bad? Can you point us at more info about this? I can't even find a website for Ingress... I'd be careful about OSS-based clusters. Everyone I've seen has some limitations, some of which are pretty serious. There are some that are command-based clustering/replication, but that raises some serious potential issues with non-deterministic functions among other things. Continuent seems to have done a good job dealing with this, but there's still some gotchas you need to be aware of. Then there's things like MySQL cluster, which requires that the entire database fits in memory. Well, if the database is in memory, it's going to be pretty dang fast to begin with, so you're unlikely to need scaleability across machines. Basically, truely enterprise-class clustering (and replication) are extremely hard to do, which is why this is pretty much exclusively the realm of the 'big 3' at this point. Slony-II could seriously change things when it comes out, though it still won't give you the data guarantees that a true syncronous multi-master setup does. But it will hopefully offer multi-master syncronous type behavior with the performance of an async database, which would be a huge leap forward. Perhaps if you posted your performance requirements someone could help point you to a solution that would meet them. -- 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 Mar 7 15:09:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 430969DCC46 for ; Tue, 7 Mar 2006 15:09: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 08544-02 for ; Tue, 7 Mar 2006 15:09:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (unknown [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id 793179DCBF9 for ; Tue, 7 Mar 2006 15:09:13 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Tue, 7 Mar 2006 14:07:25 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B240E@morpheus.bostonstock.com> From: "mcelroy, tim" To: "'pgsql-performance@postgresql.org'" Subject: pg_reset_stats + cache I/O % Date: Tue, 7 Mar 2006 14:07:24 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6421A.5E6BCC86" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.395 required=5 tests=[AWL=-0.058, HTML_FONT_FACE_BAD=0.452, HTML_MESSAGE=0.001] X-Spam-Score: 0.395 X-Spam-Level: X-Archive-Number: 200603/71 X-Sequence-Number: 17508 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C6421A.5E6BCC86 Content-Type: text/plain; charset="iso-8859-1" Good afternoon, Relatively new to PostgreSQL and have been assigned the task of capturing cache I/O % hits. I figured out (thanks to other posts) how to turn on the capture and what stats to (kind of) capture. I did find a view in the archives as shown below but it does not execute, error follows. I'm using 8.0.1 so that shouldn't be the issue. Any help will be appreciated. Also, I also found pg_reset_stats.tar.gz in the archives with a lot of talk regarding its addition as a patch, did it ever make it in? If not, can I get a copy of it somewhere? The tar.gz gets corrupted when I download it. Thank you, Tim CREATE VIEW cache_hits AS SELECT relname, ROUND(CASE WHEN heap_blks_hit = 0 THEN 0 ELSE ((heap_blks_hit::float /(heap_blks_read::float + heap_blks_hit::float)) * 100) END ,2) as heap, ROUND(CASE WHEN idx_blks_hit = 0 THEN 0 ELSE ((idx_blks_hit::float /(idx_blks_read::float + idx_blks_hit::float)) * 100) END,2) as index,ROUND(CASE WHEN toast_blks_hit = 0 THEN 0 ELSE ((toast_blks_hit::float /(toast_blks_read::float + toast_blks_hit::float)) * 100) END,2) as toast FROM pg_statio_user_tables WHERE heap_blks_read <> 0 or idx_blks_read <> 0 OR toast_blks_read <> 0 union select 'ALL TABLES', ROUND(CASE WHEN sum(heap_blks_hit) = 0 THEN 0 ELSE ((sum(heap_blks_hit::float) /(sum(heap_blks_read::float) + sum(heap_blks_hit::float))) * 100) END ,2) as heap, ROUND(CASE WHEN sum(idx_blks_hit) = 0 THEN 0 ELSE ((sum(idx_blks_hit::float) /(sum(idx_blks_read::float) + sum(idx_blks_hit::float))) * 100) END,2) as index,ROUND(CASE WHEN sum(toast_blks_hit) = 0 THEN 0 ELSE ((sum(toast_blks_hit::float) /(sum(toast_blks_read::float) + sum(toast_blks_hit::float))) * 100) END,2) as toast FROM pg_statio_user_tables HAVING sum(heap_blks_read) <> 0 or sum(idx_blks_read) <> 0 OR sum(toast_blks_read) <> 0 ; ERROR: function round(double precision, integer) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. ------_=_NextPart_001_01C6421A.5E6BCC86 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable pg_reset_stats + cache I/O %

Good afternoon,

Relatively new to PostgreSQL and have been assigned the task of capturing cache = I/O % hits.  I figured out (thanks to other posts) how to turn on = the capture and what stats to (kind of) capture.  I did find a = view in the = archives as shown below but it does not execute, error follows.  I'm using 8.0.1 so that shouldn't be the = issue.  Any help will be appreciated.

Also, I = also found pg_reset_stats.tar.gz in the archives with a lot of talk regarding its addition as a = patch, did it ever make it in?  If not, can I get a copy of = it somewhere?  The tar.gz = gets corrupted when I download it.

Thank = you,

Tim

CREATE VIEW cache_hits AS SELECT relname, ROUND(CASE WHEN = heap_blks_hit =3D 0

THEN 0 ELSE ((heap_blks_hit::float /(heap_blks_read::float = +

heap_blks_hit::float)) * 100) END ,2) as heap, ROUND(CASE = WHEN  idx_blks_hit

=3D 0 THEN 0 ELSE ((idx_blks_hit::float = /(idx_blks_read::float +

idx_blks_hit::float)) * 100) END,2) as index,ROUND(CASE WHEN = toast_blks_hit

=3D 0 THEN 0 ELSE  ((toast_blks_hit::float = /(toast_blks_read::float +

toast_blks_hit::float)) * 100)  END,2) as toast FROM = pg_statio_user_tables

WHERE heap_blks_read <> 0 or idx_blks_read <> 0 OR = toast_blks_read <> 0

union select 'ALL TABLES', ROUND(CASE WHEN sum(heap_blks_hit) =3D 0 = THEN 0

ELSE ((sum(heap_blks_hit::float) /(sum(heap_blks_read::float) = +

sum(heap_blks_hit::float))) * 100) END ,2) as heap, = ROUND(CASE WHEN

sum(idx_blks_hit) =3D 0 THEN 0 ELSE = ((sum(idx_blks_hit::float)

/(sum(idx_blks_read::float) +  sum(idx_blks_hit::float))) * = 100) END,2) as

index,ROUND(CASE WHEN sum(toast_blks_hit) =3D 0 THEN 0 = ELSE

((sum(toast_blks_hit::float) /(sum(toast_blks_read::float) = +

sum(toast_blks_hit::float))) * 100)  END,2) as toast = FROM

pg_statio_user_tables HAVING sum(heap_blks_read) <> 0 or = sum(idx_blks_read)

<> 0 OR sum(toast_blks_read) <> 0 ;

ERROR:  function round(double precision, integer) = does not exist

HINT:  No function matches the given name and = argument types. You may need to add explicit type = casts.

------_=_NextPart_001_01C6421A.5E6BCC86-- From pgsql-performance-owner@postgresql.org Tue Mar 7 15:09:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 813B59DCC40 for ; Tue, 7 Mar 2006 15:09: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 05835-07 for ; Tue, 7 Mar 2006 15:09:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 466E39DCC60 for ; Tue, 7 Mar 2006 15:09:34 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id EA0AA5646A; Tue, 7 Mar 2006 13:09:34 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 13:09:34 -0600 Date: Tue, 7 Mar 2006 13:09:34 -0600 From: "Jim C. Nasby" To: Joost Kraaijeveld Cc: "Pgsql-Performance (E-mail)" Subject: Re: Can anyone explain this pgbench results? Message-ID: <20060307190933.GY82989@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:j.kraaijeveld@askesis.nl::yt1u2OYai4axlgNU:0000000000000 0000000000000000000000004uZS X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::MxPCMZu4yTLVfrU2:00000 0000000000000000000000005gHg X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/72 X-Sequence-Number: 17509 On Mon, Mar 06, 2006 at 04:29:49PM +0100, Joost Kraaijeveld wrote: > I was expecting a low(ish) score the first run (because the tables are not loaded in the cache yet), followed by continues high(ish) scores, but not an alternating pattern. I also did not expect so much difference, given the hardware I have (Dual Opteron, 4GB memory , 3Ware SATA RAID5 with 5 disks, seerate swap and pg_log disks). On a side-note: RAID5 and databases generally don't mix well. Most people find that pg_xlog will live happily with the OS; it's the data files that need the most bandwidth. If you start swapping, performance will tank to the point that it's unlikely that swap being on seperate disks will help at all. Better off to just keep it with the OS and use the disks for the database tables. Speaking of 'disks', what's your exact layout? Do you have a 5 drive raid5 for the OS and the database, 1 drive for swap and 1 drive for pg_xlog? -- 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 Mar 7 15:20:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 08D669DCC8F for ; Tue, 7 Mar 2006 15:20: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 08457-10 for ; Tue, 7 Mar 2006 15:20:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 9A3609DCC8E for ; Tue, 7 Mar 2006 15:20:52 -0400 (AST) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 07 Mar 2006 11:20:50 -0800 Subject: Re: Postgres and Ingres R3 / SAN From: Mark Lewis To: "Jim C. Nasby" Cc: Jeremy Haile , pgsql-performance@postgresql.org In-Reply-To: <20060307190019.GX82989@pervasive.com> References: <20060306131355.A1227@ganymede.hub.org> <1141675112.28202.255960101@webmail.messagingengine.com> <20060307190019.GX82989@pervasive.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Tue, 07 Mar 2006 11:20:50 -0800 Message-Id: <1141759250.4237.7.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-22) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.139 required=5 tests=[AWL=0.138, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.139 X-Spam-Level: X-Archive-Number: 200603/73 X-Sequence-Number: 17510 On Tue, 2006-03-07 at 13:00 -0600, Jim C. Nasby wrote: ... > PostgreSQL on a SAN won't buy you what I think you think it will. It's > essentially impossible to safely run two PostgreSQL installs off the > same data files without destroying your data. What a SAN can buy you is > disk-level replication, but I've no experience with that. It is possible to run two instances against the same SAN using tools such as RedHat's Cluster Suite. We use that in-house as a cheap alternative for Oracle clustering, although we're not using it for our PostgreSQL servers yet. It's not for load balancing, just active/passive fault tolerance. -- Mark Lewis From pgsql-performance-owner@postgresql.org Tue Mar 7 15:22:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D7FE19DCBBD for ; Tue, 7 Mar 2006 15: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 10107-03 for ; Tue, 7 Mar 2006 15:22:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id DD4D59DCA9B for ; Tue, 7 Mar 2006 15:22:24 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 400785646A; Tue, 7 Mar 2006 13:22:22 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 13:22:21 -0600 Date: Tue, 7 Mar 2006 13:22:21 -0600 From: "Jim C. Nasby" To: Mark Lewis Cc: Jeremy Haile , pgsql-performance@postgresql.org Subject: Re: Postgres and Ingres R3 / SAN Message-ID: <20060307192221.GA82989@pervasive.com> References: <20060306131355.A1227@ganymede.hub.org> <1141675112.28202.255960101@webmail.messagingengine.com> <20060307190019.GX82989@pervasive.com> <1141759250.4237.7.camel@archimedes> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1141759250.4237.7.camel@archimedes> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:mark.lewis@mir3.com::dtOnAInZdvONlnox:000000000000000000 00000000000000000000000023Em X-Hashcash: 1:20:060307:jhaile@fastmail.fm::2e7v7JT2G5kjOmQm:0000000000000000000 0000000000000000000000000bxL X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::9RHXIg8yOenwown0:00000 0000000000000000000000003mkD X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/74 X-Sequence-Number: 17511 On Tue, Mar 07, 2006 at 11:20:50AM -0800, Mark Lewis wrote: > On Tue, 2006-03-07 at 13:00 -0600, Jim C. Nasby wrote: > > ... > > > PostgreSQL on a SAN won't buy you what I think you think it will. It's > > essentially impossible to safely run two PostgreSQL installs off the > > same data files without destroying your data. What a SAN can buy you is > > disk-level replication, but I've no experience with that. > > It is possible to run two instances against the same SAN using tools > such as RedHat's Cluster Suite. We use that in-house as a cheap > alternative for Oracle clustering, although we're not using it for our > PostgreSQL servers yet. It's not for load balancing, just > active/passive fault tolerance. True, but the OP was talking about scaleability, which is not something you get with this setup. -- 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 Mar 7 15:37:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5DFF99DCBB6 for ; Tue, 7 Mar 2006 15:37: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 12320-09 for ; Tue, 7 Mar 2006 15:37: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 AC6669DCBEE for ; Tue, 7 Mar 2006 15:37:12 -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 k27JauXw002757; Tue, 7 Mar 2006 14:36:57 -0500 (EST) To: "mcelroy, tim" cc: "'pgsql-performance@postgresql.org'" Subject: Re: pg_reset_stats + cache I/O % In-reply-to: <0C4841B42F87D51195BD00B0D020F5CB044B240E@morpheus.bostonstock.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B240E@morpheus.bostonstock.com> Comments: In-reply-to "mcelroy, tim" message dated "Tue, 07 Mar 2006 14:07:24 -0500" Date: Tue, 07 Mar 2006 14:36:56 -0500 Message-ID: <2756.1141760216@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/75 X-Sequence-Number: 17512 "mcelroy, tim" writes: > ERROR: function round(double precision, integer) does not exist Try coercing to numeric instead of float. Also, it'd be a good idea to put that coercion outside the sum()'s instead of inside --- summing bigints is probably noticeably faster than summing numerics. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Mar 7 15:49:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2CBCC9DCA56 for ; Tue, 7 Mar 2006 15:49: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 14331-06 for ; Tue, 7 Mar 2006 15:49:35 -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 851619DC8A4 for ; Tue, 7 Mar 2006 15:49:30 -0400 (AST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: Can anyone explain this pgbench results? Date: Tue, 7 Mar 2006 20:49:30 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can anyone explain this pgbench results? Thread-Index: AcZCGz1dJrt1voWIR0G70Kyd4E/DmAAA6YTA From: "Joost Kraaijeveld" To: "Jim C. Nasby" Cc: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.089 required=5 tests=[AWL=0.089] X-Spam-Score: 0.089 X-Spam-Level: X-Archive-Number: 200603/76 X-Sequence-Number: 17513 Jim C. Nasby wrote: =20 > Speaking of 'disks', what's your exact layout? Do you have a 5 drive > raid5 for the OS and the database, 1 drive for swap and 1 drive for > pg_xlog? On a Sil SATA 3114 controller: /dev/sda OS + Swap /dev/sdb /var with pg_xlog On the 3Ware 9500S-8, 5 disk array: /dev/sdc with the database (and very safe, my MP3 collection ;-)) As I wrote in one of my posts to Michael, I suspect that the card is not = handling the amount of write operations as well as I expected. I wonder = if anyone else sees the same characteristics with this kind of card. 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 Mar 7 15:56:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EFEC39DCC47 for ; Tue, 7 Mar 2006 15:56: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 15523-09 for ; Tue, 7 Mar 2006 15:56:49 -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 05D2D9DCC89 for ; Tue, 7 Mar 2006 15:56:46 -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 k27JukFO002877; Tue, 7 Mar 2006 14:56:46 -0500 (EST) To: Scott Marlowe cc: Alvaro Herrera , andremachado , pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance In-reply-to: <1141751939.18820.174.camel@state.g2switchworks.com> References: <20060307162842.M37264@techforce.com.br> <1141751333.18820.172.camel@state.g2switchworks.com> <20060307171514.GE6748@surnet.cl> <1141751939.18820.174.camel@state.g2switchworks.com> Comments: In-reply-to Scott Marlowe message dated "Tue, 07 Mar 2006 11:18:59 -0600" Date: Tue, 07 Mar 2006 14:56:45 -0500 Message-ID: <2876.1141761405@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/77 X-Sequence-Number: 17514 Scott Marlowe writes: > So, do you see any obvious, low hanging fruit here? It would help if we were being told the whole truth about the settings being used. The first few plans are clearly suffering from the "enable_seqscan = off" error, but the last few don't seem to be. I don't trust the SHOW ALL at all since it disagrees with the immediately following retail SHOWs --- there is seemingly a whole lot of parameter changing going on that we are not being told about. It'd also be a good idea to know something about the datatypes involved, particularly for the join keys. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Mar 7 15:59:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C34919DCBB6 for ; Tue, 7 Mar 2006 15:59: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 15168-10 for ; Tue, 7 Mar 2006 15:59:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 5A36C9DCC47 for ; Tue, 7 Mar 2006 15:59:45 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 679C756492; Tue, 7 Mar 2006 13:59:31 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 13:59:30 -0600 Date: Tue, 7 Mar 2006 13:59:30 -0600 From: "Jim C. Nasby" To: Joost Kraaijeveld Cc: "Pgsql-Performance (E-mail)" Subject: Re: Can anyone explain this pgbench results? Message-ID: <20060307195930.GB82989@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:j.kraaijeveld@askesis.nl::x/Cv2+8yGq6oDwqk:0000000000000 0000000000000000000000004Z4X X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::Lk4Dj0R4EK7OuHzT:00000 0000000000000000000000003jn0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/78 X-Sequence-Number: 17515 On Tue, Mar 07, 2006 at 08:49:30PM +0100, Joost Kraaijeveld wrote: > > Jim C. Nasby wrote: > > > Speaking of 'disks', what's your exact layout? Do you have a 5 drive > > raid5 for the OS and the database, 1 drive for swap and 1 drive for > > pg_xlog? > > On a Sil SATA 3114 controller: > /dev/sda OS + Swap > /dev/sdb /var with pg_xlog > > On the 3Ware 9500S-8, 5 disk array: > /dev/sdc with the database (and very safe, my MP3 collection ;-)) > > As I wrote in one of my posts to Michael, I suspect that the card is not handling the amount of write operations as well as I expected. I wonder if anyone else sees the same characteristics with this kind of card. Well, the problem is that you're using RAID5, which has a huge write overhead. You're unlikely to get good performance with it. Also, it sounds like sda and sdb are not mirrored. If that's the case, you have no protection from a drive failure taking out your entire database, because you'd lose pg_xlog. If you want better performance your best bets are to either setup RAID10 or if you don't care about the data, just go to RAID0. -- 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 Mar 7 16:07:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 14D8B9DCC7C; Tue, 7 Mar 2006 16:07: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 17438-04; Tue, 7 Mar 2006 16:07:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- 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 DAC7C9DCC47; Tue, 7 Mar 2006 16:07:34 -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 1FGiT0-0003zy-2Y; Tue, 07 Mar 2006 20:07:34 +0000 Received: from 84.13.89.207 ([84.13.89.207]) by ratbert.vale-housing.co.uk ([192.168.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 7 Mar 2006 20:07:34 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 07 Mar 2006 20:08:50 +0000 Subject: Re: Postgres on VPS - how much is enough? From: Dave Page To: "Jim C. Nasby" , "Marc G. Fournier" CC: , Nagita Karunaratne , Message-ID: Thread-Topic: [PERFORM] Postgres on VPS - how much is enough? Thread-Index: AcZCF3KivZO5IZNnTVyBxSxMntiF9QAC4Bib In-Reply-To: <20060307184558.GW82989@pervasive.com> 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.328 required=5 tests=[AWL=0.075, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.328 X-Spam-Level: * X-Archive-Number: 200603/79 X-Sequence-Number: 17516 On 7/3/06 18:45, "Jim C. Nasby" wrote: > On Mon, Mar 06, 2006 at 01:14:45PM -0400, Marc G. Fournier wrote: >> We host VPSs here (http://www.hub.org) and don't use the 'single file, >> virtual file system' to put them into ... it must depend on where you >> host? > > Yeah, but aren't you also using FreeBSD jails? AFAIK linux doesn't have > an equivalent to jail; all their VPS stuff actually brings up a > full-blown copy of linux, kernel and all. No, linux vserver is equivalent to a jail - and they work superbly imho. developer.pgadmin.org is just one such VM that I run. http://www.linux-vserver.org/ Regards, Dave. From pgsql-performance-owner@postgresql.org Tue Mar 7 16:15:45 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AF0949DC950 for ; Tue, 7 Mar 2006 16:15: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 18435-10 for ; Tue, 7 Mar 2006 16:15:45 -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 2A1A49DC8A4 for ; Tue, 7 Mar 2006 16:15:41 -0400 (AST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: Can anyone explain this pgbench results? Date: Tue, 7 Mar 2006 21:15:37 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can anyone explain this pgbench results? Thread-Index: AcZCIjS2gwxDYEL/SHu1oDUPJYQxawAADQfg From: "Joost Kraaijeveld" To: "Jim C. Nasby" Cc: "Pgsql-Performance (E-mail)" 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: 200603/80 X-Sequence-Number: 17517 Jim C. Nasby wrote: > Well, the problem is that you're using RAID5, which has a huge write > overhead. You're unlikely to get good performance with it. Apparently. But I had no idea that the performance hit would be that = big.=20 Running bonnie or copying a large file with dd show that the card can do = 30-50 MB/sec. Running a large update on my postgresql database however, = show a throughtput of ~ 2MB/sec, doing between ~ 2500 - 2300 = writes/second (avarage). with an utilisation of almost always 100%, and = large await times ( almost always > 700), large io-wait percentages = (>50%), all measured with iostat. =20 > Also, it sounds like sda and sdb are not mirrored. If that's the case, > you have no protection from a drive failure taking out your entire > database, because you'd lose pg_xlog. >=20 > If you want better performance your best bets are to either > setup RAID10 or if you don't care about the data, just go to RAID0. Because it is just my development machine I think I will opt for the = last option. More diskspace left. 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 Mar 7 16:21:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3C2849DCBBD for ; Tue, 7 Mar 2006 16:21: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 20020-08 for ; Tue, 7 Mar 2006 16:21:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D441E9DCB73 for ; Tue, 7 Mar 2006 16:21:01 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id F16C25646F; Tue, 7 Mar 2006 14:21:02 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 7 Mar 2006 14:21:02 -0600 Date: Tue, 7 Mar 2006 14:21:02 -0600 From: "Jim C. Nasby" To: Joost Kraaijeveld Cc: "Pgsql-Performance (E-mail)" Subject: Re: Can anyone explain this pgbench results? Message-ID: <20060307202102.GE58405@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060307:j.kraaijeveld@askesis.nl::KiUMAD93ZgjPeviH:0000000000000 0000000000000000000000003ifm X-Hashcash: 1:20:060307:pgsql-performance@postgresql.org::hg0oagzeE4sFMT+W:00000 000000000000000000000000056R X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/81 X-Sequence-Number: 17518 On Tue, Mar 07, 2006 at 09:15:37PM +0100, Joost Kraaijeveld wrote: > Jim C. Nasby wrote: > > Well, the problem is that you're using RAID5, which has a huge write > > overhead. You're unlikely to get good performance with it. > Apparently. But I had no idea that the performance hit would be that big. > > Running bonnie or copying a large file with dd show that the card can do 30-50 MB/sec. Running a large update on my postgresql database however, show a throughtput of ~ 2MB/sec, doing between ~ 2500 - 2300 writes/second (avarage). with an utilisation of almost always 100%, and large await times ( almost always > 700), large io-wait percentages (>50%), all measured with iostat. While there are some issues with PostgreSQL not getting as close to the theoretical maximum of a dd bs=8k (you did match the block size to PostgreSQL's page size, right? :) ), a bigger issue in this case is that better cards are able to remove much/all of the RAID5 write penalty in the case where you're doing a large sequential write, because it will just blow entire stripes down to disk. This is very different from doing a more random IO. And it's also very possible that if you use a block size that's smaller than the stripe size that the controller won't be able to pick up on that. In any case, RAID0 will absolutely be the fastest performance you can get. -- 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 Mar 7 21:37:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 899659DC97D for ; Tue, 7 Mar 2006 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 73865-02 for ; Tue, 7 Mar 2006 21:37:44 -0400 (AST) X-Greylist: delayed 09:03:05.870451 by SQLgrey- Received: from techforce.com.br (unknown [64.84.33.124]) by postgresql.org (Postfix) with ESMTP id A573E9DC816 for ; Tue, 7 Mar 2006 21:37:38 -0400 (AST) Received: from 200-203-017-037.paemt7001.dsl.brasiltelecom.net.br (200-203-017-037.paemt7001.dsl.brasiltelecom.net.br [200.203.17.37] (may be forged)) (authenticated bits=0) by techforce.com.br (8.12.11/8.12.11) with ESMTP id k281WJ0c018330 for ; Tue, 7 Mar 2006 17:32:21 -0800 Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison From: Andre Felipe Machado To: pgsql-performance@postgresql.org In-Reply-To: <20060307162842.M37264@techforce.com.br> References: <20060307162842.M37264@techforce.com.br> Content-Type: text/plain Date: Tue, 07 Mar 2006 22:40:15 -0300 Message-Id: <1141782015.1610.40.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 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: 200603/82 X-Sequence-Number: 17519 Hello, Many thanks for the valuable suggestions and insights. The defaults enable_bitmapscan and enable_seqscan were altered by my friend. He already re enabled them (maybe even while I was trying some of the queries). The machine is a P4 3.2GHz, 1 GBram, sata hd, windows 2000. I did not used pg on win before to have any advice to my friend. The previously attached file contains SOME relevant info from the psql session, in order to not clutter file. When some server parameter was modified (at least by me) and server restarted, a new sholl parameter was issued to show the new value. Firebird is running at the same machine. As you can see by the session log, indexes were created on the columns used and tables was first clustered on the indexes actually used by the query. The subsequent cluster commands only recluster on the same indexes previously clustered. shared_buffers was increased from 1000 to 16384 pages effective_cache_size was increased from 1000 to 65535 pages and at the final steps REDUCED to 8192 pages work_mem was increased from 1024 first to 16384 KB and then to 65535 KB. The first 2 parameters reduced time 18%. work_mem reduced time almost 66%. But work_mem easily can exhaust ram with many users connected, as each connection query will use this amount of memory (if I can remember). How much it can grow at this 1 gbram win machine? Some of the docs I already read suggested that indexes should be entirely contained in ram. How to dimension the parameters? Other docs adviced that some memory parameters could actually degrade performance if too big. There are peak points at the performance curve by adjusting mem parameters. I hope tomorrow execute explain with the bitmapscan and seqscan enabled. bitmapscans are almost always faster? The data, as far I know, are a sample real app data (hey, if and when in production it will be even large?). They are almost true random as my friend informed, and according to him, cluster should not really be of benefit. It seems confirmed by the various explain analyze commands before and after clustering. Any suggestions? Do you see some obvious error on the steps at the previous session log file? It seems that Firebird windows can use adequately as much ram it finds and postgresql windows can not. How dimension ram to the indexes? Only by trial and error? I tried some suggested values found at some tuning docs suitable to the available system ram. Thanks Andre Felipe From pgsql-performance-owner@postgresql.org Tue Mar 7 22:15:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 05B849DC97D for ; Tue, 7 Mar 2006 22:15: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 77737-10 for ; Tue, 7 Mar 2006 22:16:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.205]) by postgresql.org (Postfix) with ESMTP id 100149DC812 for ; Tue, 7 Mar 2006 22:15:55 -0400 (AST) Received: by xproxy.gmail.com with SMTP id h29so53613wxd for ; Tue, 07 Mar 2006 18:16:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=a/S1eavgSwUH+uFi8bsMXeqa6epSR8KVnH/SeprGe83T4JbdqBMH3DIFzjmtLjTJbtRJ1pjbyMPWyNYmCKzXvFLQQ7BTr2LRc3JUPUJhIDhExrShIdz+5T8mdC+PmF4WsbdOrJLZMoF9B7wTeZogcfiX6PTMMgQ+8Uvz+hv573Y= Received: by 10.70.31.9 with SMTP id e9mr317333wxe; Tue, 07 Mar 2006 18:16:00 -0800 (PST) Received: by 10.70.128.2 with HTTP; Tue, 7 Mar 2006 18:16:00 -0800 (PST) Message-ID: Date: Tue, 7 Mar 2006 20:16:00 -0600 From: "Matthew Nuzum" Reply-To: newz@bearfruit.org To: "Dave Page" Subject: Re: Postgres on VPS - how much is enough? Cc: "Jim C. Nasby" , "Marc G. Fournier" , "Nagita Karunaratne" , 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: <20060307184558.GW82989@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.198 required=5 tests=[AWL=0.198] X-Spam-Score: 0.198 X-Spam-Level: X-Archive-Number: 200603/83 X-Sequence-Number: 17520 On 3/7/06, Dave Page wrote: > On 7/3/06 18:45, "Jim C. Nasby" wrote: > > On Mon, Mar 06, 2006 at 01:14:45PM -0400, Marc G. Fournier wrote: > >> We host VPSs here (http://www.hub.org) and don't use the 'single file, > >> virtual file system' to put them into ... it must depend on where you > >> host? > > > > Yeah, but aren't you also using FreeBSD jails? AFAIK linux doesn't have > > an equivalent to jail; all their VPS stuff actually brings up a > > full-blown copy of linux, kernel and all. > > No, linux vserver is equivalent to a jail - and they work superbly imho. > developer.pgadmin.org is just one such VM that I run. > > http://www.linux-vserver.org/ > > Regards, Dave. I can confirm this. I've been using linux-vserver for years. It is a very up-to-date and active project that is extremely responsive and helpful to users of all experience levels. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Wed Mar 8 10:01:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 98FA89DC826 for ; Wed, 8 Mar 2006 10:01: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 12988-02 for ; Wed, 8 Mar 2006 10:01:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (unknown [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id DADC89DC815 for ; Wed, 8 Mar 2006 10:01:46 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Wed, 8 Mar 2006 08:59:59 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B241C@morpheus.bostonstock.com> From: "mcelroy, tim" To: 'Tom Lane' Cc: "'pgsql-performance@postgresql.org'" Subject: Re: pg_reset_stats + cache I/O % Date: Wed, 8 Mar 2006 08:59:51 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C642B8.91D4AC0C" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.185 required=5 tests=[AWL=0.184, HTML_MESSAGE=0.001] X-Spam-Score: 0.185 X-Spam-Level: X-Archive-Number: 200603/84 X-Sequence-Number: 17521 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C642B8.91D4AC0C Content-Type: text/plain; charset="iso-8859-1" Thanks Tom, sorry I neglected to copy the list on my previous email..... Does this query make sense and is it valid for an accurate cache % hit ratio for the entire DB? I would assume I could use the same logic with other views such as pg_stat_user_tables to get a per table ratio? SELECT 100 - round((blks_hit::numeric / (blks_hit::numeric + blks_read::numeric)) * 100,2) AS "Cache % Hit" FROM pg_stat_database WHERE datname = 'Fix1'; Cache % Hit -------------------- 98.06 (1 row) Thank you, Tim -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us] Sent: Tuesday, March 07, 2006 2:37 PM To: mcelroy, tim Cc: 'pgsql-performance@postgresql.org' Subject: Re: [PERFORM] pg_reset_stats + cache I/O % "mcelroy, tim" writes: > ERROR: function round(double precision, integer) does not exist Try coercing to numeric instead of float. Also, it'd be a good idea to put that coercion outside the sum()'s instead of inside --- summing bigints is probably noticeably faster than summing numerics. regards, tom lane ------_=_NextPart_001_01C642B8.91D4AC0C Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] pg_reset_stats + cache I/O %

Thanks Tom, sorry I neglected to copy the list on my = previous email.....

Does this query make sense and is it valid for an = accurate cache % hit ratio for the entire DB?  I would assume I = could use the same logic with other views such as pg_stat_user_tables = to get a per table ratio?

SELECT 100 - round((blks_hit::numeric / = (blks_hit::numeric + blks_read::numeric)) * 100,2)
AS "Cache % Hit"
FROM pg_stat_database
WHERE datname =3D 'Fix1';

<RETURNS>

Cache % Hit
--------------------
       98.06
(1 row)

Thank you,
Tim

 -----Original Message-----
From:   Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent:   Tuesday, March 07, 2006 2:37 = PM
To:     mcelroy, tim
Cc:     = 'pgsql-performance@postgresql.org'
Subject:        = Re: [PERFORM] pg_reset_stats + cache I/O %

"mcelroy, tim" = <tim.mcelroy@bostonstock.com> writes:
> ERROR:  function round(double precision, = integer) does not exist

Try coercing to numeric instead of float.  Also, = it'd be a good idea to
put that coercion outside the sum()'s instead of = inside --- summing
bigints is probably noticeably faster than summing = numerics.

        =         =         regards, tom = lane

------_=_NextPart_001_01C642B8.91D4AC0C-- From pgsql-performance-owner@postgresql.org Wed Mar 8 10:28:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 75B619DC89D for ; Wed, 8 Mar 2006 10: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 16195-01 for ; Wed, 8 Mar 2006 10:28:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id B6FB99DC887 for ; Wed, 8 Mar 2006 10:28:50 -0400 (AST) Received: (qmail 31840 invoked by uid 514); 8 Mar 2006 15:25:24 +0100 Received: from 62.37.216.137 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.216.137):SA:0(-0.9/5.0):. Processed in 0.675658 secs); 08 Mar 2006 14:25:24 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.137):SA:0(-0.9/5.0):. Processed in 0.675658 secs Process 31831) Received: from 62-37-216-137.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.216.137) by mail.rentalia.net with SMTP; 8 Mar 2006 15:25:23 +0100 Message-ID: <440EEA14.70606@rentalia.com> Date: Wed, 08 Mar 2006 15:28:36 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Is good idea an array of 365 elements in a cell of a table, in order to perform searchs? 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: 200603/85 X-Sequence-Number: 17522 Hi, Im having a dude with a new inplementation in a web site. The ojective is create a search as fast as possible. I have thought two possibilities to do that: I have several items. Those items has 1 or more of capacity. Each capacity, has several dates (From 1 january to 10 of april, for example). The dates covers 366 days, the current year, and they are indeterminated ranges. Per each date, it has price per day, per week, per15days and per month. I have designed two possibilities: First: IdItem StartDate EndDate Capacity PricePerDay PricePerWeek* PricePer15days* PricePerMonth* 1 1-1-2005 10-1-2005 2 100 90 85 80 1 11-1-2005 20-1-2005 2 105 94 83 82 1 21-1-2005 5-2-2005 4 405 394 283 182 2 ... Right now arround 30.000 rows, in one year is spected to have 60.000 rows * In order to compare right, all prices will be translated to days. Example, PricePerWeek will have the Week Price / 7 and go on Second IdItem Capacity Days Week 15Days Month Year 1 2 [Array of 365 values, one per day of year] [ .Array. ] [ .Array. ] [ .Array. ] [ .Array. ] ^__ Each item of array its a price Right now arround 2.500 rows. in one year is spected to have 5.000 rows I have to compare prices or prices and dates or prices and dates and capacity or capacity and prices I have no experience working with arrays on a table. Is it fast? Witch one do u think will have better performance? Any good idea? I hope this is enouth information. Thanks in advance, Ruben Rubio Rey From pgsql-performance-owner@postgresql.org Wed Mar 8 13:15:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 52CAE9DCA41 for ; Wed, 8 Mar 2006 13: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 40200-01 for ; Wed, 8 Mar 2006 13:15:16 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 20E9E9DCA1C for ; Wed, 8 Mar 2006 13:15:15 -0400 (AST) Received: from ylpvm43.prodigy.net (ylpvm43-ext.prodigy.net [207.115.57.74]) by svr4.postgresql.org (Postfix) with ESMTP id 97FAA5AF18F for ; Wed, 8 Mar 2006 17:15:12 +0000 (GMT) Received: from pimout1-ext.prodigy.net (pimout1-int.prodigy.net [207.115.5.65]) by ylpvm43.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id k28HFDBd013555 for ; Wed, 8 Mar 2006 12:15:13 -0500 X-ORBL: [68.92.113.60] Received: from homer.d-oh.org (adsl-68-92-113-60.dsl.okcyok.swbell.net [68.92.113.60]) by pimout1-ext.prodigy.net (8.13.4 outbound domainkey aix/8.13.4) with SMTP id k28HF9e2097868 for ; Wed, 8 Mar 2006 12:15:09 -0500 Received: (qmail 2881 invoked by uid 1013); 8 Mar 2006 17:15:03 -0000 Received: from alex@innovacomputing.com by homer by uid 64011 with qmail-scanner-1.20 (clamscan: 0.65. hbedv: 6.22.0.1/6.22.0.50. Clear:RC:1(192.168.0.100):. Processed in 2.217185 secs); 08 Mar 2006 17:15:03 -0000 Received: from unknown (HELO ?192.168.0.100?) (192.168.0.100) by homer.int.d-oh.org with SMTP; 8 Mar 2006 17:15:00 -0000 Message-ID: <440F1115.4020400@innovacomputing.com> Date: Wed, 08 Mar 2006 11:15:01 -0600 From: Alex Adriaanse User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Greg Stark Cc: pgsql-performance@postgresql.org Subject: Re: Bad row estimates References: <4408E91C.90104@innovacomputing.com> <87wtfasng0.fsf@stark.xeocode.com> <14850.1141488599@sss.pgh.pa.us> <87fylyrsfy.fsf@stark.xeocode.com> In-Reply-To: <87fylyrsfy.fsf@stark.xeocode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/86 X-Sequence-Number: 17523 Thank you all for your valuable input. I have tried creating a partial index, a GIST index, and a GIST + partial index, as suggested, but it does not seem to make a significant difference. For instance: CREATE INDEX test_table_1_interval_idx ON test_table_1 USING GIST (box(point(start_ts::abstime::integer, start_ts::abstime::integer), point(end_ts::abstime::integer, end_ts::abstime::integer))) WHERE id = g_id; ANALYZE test_table_1; EXPLAIN ANALYZE SELECT count(*) FROM test_table_1 INNER JOIN test_table_2 ON (test_table_2.s_id=13300613 AND test_table_1.id = test_table_2.n_id) WHERE box(point(start_ts::abstime::integer, start_ts::abstime::integer), point(end_ts::abstime::integer, end_ts::abstime::integer)) ~ box(point(now()::abstime::integer,now()::abstime::integer),point(now()::abstime::integer,now()::abstime::integer)) AND test_table_1.id = test_table_1.g_id; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=15.09..15.10 rows=1 width=0) (actual time=69.771..69.772 rows=1 loops=1) -> Nested Loop (cost=9.06..15.08 rows=1 width=0) (actual time=69.752..69.752 rows=0 loops=1) -> Index Scan using test_table_1_interval_idx on test_table_1 (cost=0.07..4.07 rows=1 width=22) (actual time=2.930..3.607 rows=135 loops=1) Index Cond: (box(point((((start_ts)::abstime)::integer)::double precision, (((start_ts)::abstime)::integer)::double precision), point((((end_ts)::abstime)::integer)::double precision, (((end_ts)::abstime)::integer)::double precision)) ~ box(point((((now())::abstime)::integer)::double precision, (((now())::abstime)::integer)::double precision), point((((now())::abstime)::integer)::double precision, (((now())::abstime)::integer)::double precision))) -> Bitmap Heap Scan on test_table_2 (cost=8.99..11.00 rows=1 width=12) (actual time=0.486..0.486 rows=0 loops=135) Recheck Cond: ((test_table_2.s_id = 13300613::numeric) AND ("outer".id = test_table_2.n_id)) -> BitmapAnd (cost=8.99..8.99 rows=1 width=0) (actual time=0.485..0.485 rows=0 loops=135) -> Bitmap Index Scan on test_table_2_s_id (cost=0.00..2.17 rows=48 width=0) (actual time=0.015..0.015 rows=1 loops=135) Index Cond: (s_id = 13300613::numeric) -> Bitmap Index Scan on test_table_2_n_id (cost=0.00..6.57 rows=735 width=0) (actual time=0.467..0.467 rows=815 loops=135) Index Cond: ("outer".id = test_table_2.n_id) Total runtime: 69.961 ms (Note: without the GIST index the query currently runs in about 65ms) Its row estimates are still way off. As a matter of fact, it almost seems as if the index doesn't affect row estimates at all. What would you guys suggest? Thanks, Alex Greg Stark wrote: > You could actually take short cuts using expression indexes to do this. If it > works out well then you might want to implement a real data type to avoid the > overhead of the SQL conversion functions. > > Here's an example. If I were to do this for real I would look for a better > datatype than the box datatype and I would wrap the whole conversion in an SQL > function. But this will serve to demonstrate: > > stark=> create table interval_test (start_ts timestamp with time zone, end_ts timestamp with time zone); > CREATE TABLE > > stark=> create index interval_idx on interval_test using gist (box(point(start_ts::abstime::integer, end_ts::abstime::integer) , point(start_ts::abstime::integer, end_ts::abstime::integer))); > CREATE INDEX > > stark=> explain select * from interval_test where box(point(now()::abstime::integer,now()::abstime::integer),point(now()::abstime::integer,now()::abstime::integer)) ~ box(point(start_ts::abstime::integer, end_ts::abstime::integer) , point(start_ts::abstime::integer, end_ts::abstime::integer)); > QUERY PLAN > ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > Index Scan using interval_idx on interval_test (cost=0.07..8.36 rows=2 width=16) > Index Cond: (box(point((((now())::abstime)::integer)::double precision, (((now())::abstime)::integer)::double precision), point((((now())::abstime)::integer)::double precision, (((now())::abstime)::integer)::double precision)) ~ box(point((((start_ts)::abstime)::integer)::double precision, (((end_ts)::abstime)::integer)::double precision), point((((start_ts)::abstime)::integer)::double precision, (((end_ts)::abstime)::integer)::double precision))) > (2 rows) > > From pgsql-performance-owner@postgresql.org Wed Mar 8 13:37:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8BB219DC815 for ; Wed, 8 Mar 2006 13:37: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 41150-08 for ; Wed, 8 Mar 2006 13:37:13 -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 62E989DC880 for ; Wed, 8 Mar 2006 13:37:12 -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 1FH2ay-0003Qq-00; Wed, 08 Mar 2006 12:37:08 -0500 To: Alex Adriaanse Cc: Greg Stark , pgsql-performance@postgresql.org Subject: Re: Bad row estimates References: <4408E91C.90104@innovacomputing.com> <87wtfasng0.fsf@stark.xeocode.com> <14850.1141488599@sss.pgh.pa.us> <87fylyrsfy.fsf@stark.xeocode.com> <440F1115.4020400@innovacomputing.com> In-Reply-To: <440F1115.4020400@innovacomputing.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 08 Mar 2006 12:37:07 -0500 Message-ID: <87r75cn8ho.fsf@stark.xeocode.com> Lines: 31 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.128 required=5 tests=[AWL=0.128] X-Spam-Score: 0.128 X-Spam-Level: X-Archive-Number: 200603/87 X-Sequence-Number: 17524 Alex Adriaanse writes: > Its row estimates are still way off. As a matter of fact, it almost seems as > if the index doesn't affect row estimates at all. Indexes normally don't affect estimates. Expression indexes do effectively create a new column to generate stats for, but that doesn't really help here because there aren't any estimation functions for the geometric gist indexes. > -> BitmapAnd (cost=8.99..8.99 rows=1 width=0) (actual time=0.485..0.485 rows=0 loops=135) > -> Bitmap Index Scan on test_table_2_s_id (cost=0.00..2.17 rows=48 width=0) (actual time=0.015..0.015 rows=1 loops=135) > Index Cond: (s_id = 13300613::numeric) > -> Bitmap Index Scan on test_table_2_n_id (cost=0.00..6.57 rows=735 width=0) (actual time=0.467..0.467 rows=815 loops=135) > Index Cond: ("outer".id = test_table_2.n_id) If this query is representative then it seems you might be better off without the test_table_2_n_id index. Of course this could be a problem if you need that index for other purposes. I'm puzzled how test_table_2_s_id's estimate isn't more precise. Are there some values of s_id that are quite common and others that are unique? You might try raising the statistics target on s_id. Incidentally, 70ms is pretty good. I'm usually happy if all my mundane queries are under 100ms and the more complex queries in the vicinity of 300ms. Trying to optimize below 100ms is hard because you'll find a lot of variability in the performance. Any extraneous disk i/o from checkpoints, vacuums, even other services, will throw off your expectations. -- greg From pgsql-performance-owner@postgresql.org Wed Mar 8 14:27:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 996D19DC815 for ; Wed, 8 Mar 2006 14: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 47225-10 for ; Wed, 8 Mar 2006 14:27:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 4A7749DC826 for ; Wed, 8 Mar 2006 14:27:40 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 844B956444; Wed, 8 Mar 2006 12:27:41 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 8 Mar 2006 12:27:40 -0600 Date: Wed, 8 Mar 2006 12:27:40 -0600 From: "Jim C. Nasby" To: "mcelroy, tim" Cc: 'Tom Lane' , "'pgsql-performance@postgresql.org'" Subject: Re: pg_reset_stats + cache I/O % Message-ID: <20060308182740.GF45250@pervasive.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B241C@morpheus.bostonstock.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B241C@morpheus.bostonstock.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060308:tim.mcelroy@bostonstock.com::EBH6kZ8+QskV2maa:0000000000 0000000000000000000000004VbS X-Hashcash: 1:20:060308:tgl@sss.pgh.pa.us::osI3MjFw2ZFqWvU7:00000000000000000000 00000000000000000000000023uo X-Hashcash: 1:20:060308:pgsql-performance@postgresql.org::Pv+P7Wt47081rGes:00000 000000000000000000000000292z X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/88 X-Sequence-Number: 17525 Out of curiosity, why do you want this info? More important, do the folks who are looking at this understand that a key part of PostgreSQL's tuning strategy is to let the OS handle the bulk of the caching? On Wed, Mar 08, 2006 at 08:59:51AM -0500, mcelroy, tim wrote: > Thanks Tom, sorry I neglected to copy the list on my previous email..... > > Does this query make sense and is it valid for an accurate cache % hit ratio > for the entire DB? I would assume I could use the same logic with other > views such as pg_stat_user_tables to get a per table ratio? > > SELECT 100 - round((blks_hit::numeric / (blks_hit::numeric + > blks_read::numeric)) * 100,2) > AS "Cache % Hit" > FROM pg_stat_database > WHERE datname = 'Fix1'; > > > > Cache % Hit > -------------------- > 98.06 > (1 row) > > Thank you, > Tim > > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Tuesday, March 07, 2006 2:37 PM > To: mcelroy, tim > Cc: 'pgsql-performance@postgresql.org' > Subject: Re: [PERFORM] pg_reset_stats + cache I/O % > > "mcelroy, tim" writes: > > ERROR: function round(double precision, integer) does not exist > > Try coercing to numeric instead of float. Also, it'd be a good idea to > put that coercion outside the sum()'s instead of inside --- summing > bigints is probably noticeably faster than summing numerics. > > regards, tom lane -- 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 Wed Mar 8 14:46:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6ADAB9DC9E2 for ; Wed, 8 Mar 2006 14:46: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 52310-06 for ; Wed, 8 Mar 2006 14:46:40 -0400 (AST) X-Greylist: delayed 00:09:06.9977 by SQLgrey- Received: from morpheus.bostonstock.com (morpheus.bostonstock.com [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id D847D9DC9B5 for ; Wed, 8 Mar 2006 14:46:36 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Wed, 8 Mar 2006 13:35:38 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B2431@morpheus.bostonstock.com> From: "mcelroy, tim" To: "'Jim C. Nasby'" Cc: "'pgsql-performance@postgresql.org'" Subject: Re: pg_reset_stats + cache I/O % Date: Wed, 8 Mar 2006 13:35:35 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C642DF.1646114E" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.18 required=5 tests=[AWL=0.179, HTML_MESSAGE=0.001] X-Spam-Score: 0.18 X-Spam-Level: X-Archive-Number: 200603/89 X-Sequence-Number: 17526 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C642DF.1646114E Content-Type: text/plain; charset="iso-8859-1" I actually need this info as I was tasked by management to provide it. Not sure if they understand that or not, I do but management does like to see how well the system and its components are performing. Also, I would utilize these results to test any cache tuning changes I may make. Tim -----Original Message----- From: Jim C. Nasby [mailto:jnasby@pervasive.com] Sent: Wednesday, March 08, 2006 1:28 PM To: mcelroy, tim Cc: 'Tom Lane'; 'pgsql-performance@postgresql.org' Subject: Re: [PERFORM] pg_reset_stats + cache I/O % Out of curiosity, why do you want this info? More important, do the folks who are looking at this understand that a key part of PostgreSQL's tuning strategy is to let the OS handle the bulk of the caching? On Wed, Mar 08, 2006 at 08:59:51AM -0500, mcelroy, tim wrote: > Thanks Tom, sorry I neglected to copy the list on my previous email..... > > Does this query make sense and is it valid for an accurate cache % hit ratio > for the entire DB? I would assume I could use the same logic with other > views such as pg_stat_user_tables to get a per table ratio? > > SELECT 100 - round((blks_hit::numeric / (blks_hit::numeric + > blks_read::numeric)) * 100,2) > AS "Cache % Hit" > FROM pg_stat_database > WHERE datname = 'Fix1'; > > > > Cache % Hit > -------------------- > 98.06 > (1 row) > > Thank you, > Tim > > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Tuesday, March 07, 2006 2:37 PM > To: mcelroy, tim > Cc: 'pgsql-performance@postgresql.org' > Subject: Re: [PERFORM] pg_reset_stats + cache I/O % > > "mcelroy, tim" writes: > > ERROR: function round(double precision, integer) does not exist > > Try coercing to numeric instead of float. Also, it'd be a good idea to > put that coercion outside the sum()'s instead of inside --- summing > bigints is probably noticeably faster than summing numerics. > > regards, tom lane -- 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 ------_=_NextPart_001_01C642DF.1646114E Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] pg_reset_stats + cache I/O %

I actually need this info as I was tasked by = management to provide it.  Not sure if they understand that or = not, I do but management does like to see how well the system and its = components are performing.  Also, I would utilize these results to = test any cache tuning changes I may make. 

Tim

 -----Original Message-----
From:   Jim C. Nasby [mailto:jnasby@pervasive.com] =
Sent:   Wednesday, March 08, 2006 1:28 = PM
To:     mcelroy, tim
Cc:     'Tom Lane'; = 'pgsql-performance@postgresql.org'
Subject:        = Re: [PERFORM] pg_reset_stats + cache I/O %

Out of curiosity, why do you want this info? More = important, do the
folks who are looking at this understand that a key = part of PostgreSQL's
tuning strategy is to let the OS handle the bulk of = the caching?

On Wed, Mar 08, 2006 at 08:59:51AM -0500, mcelroy, = tim wrote:
> Thanks Tom, sorry I neglected to copy the list = on my previous email.....
>
> Does this query make sense and is it valid for = an accurate cache % hit ratio
> for the entire DB?  I would assume I could = use the same logic with other
> views such as pg_stat_user_tables to get a per = table ratio?
>
> SELECT 100 - round((blks_hit::numeric / = (blks_hit::numeric +
> blks_read::numeric)) * 100,2)
> AS "Cache % Hit"
> FROM pg_stat_database
> WHERE datname =3D 'Fix1';
>
> <RETURNS>
>
> Cache % Hit
> --------------------
>        = 98.06
> (1 row)
>
> Thank you,
> Tim
>
>  -----Original Message-----
> From: =         Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Tuesday, March 07, 2006 2:37 PM
> To:   mcelroy, tim
> Cc:   = 'pgsql-performance@postgresql.org'
> Subject:      Re: = [PERFORM] pg_reset_stats + cache I/O %
>
> "mcelroy, tim" = <tim.mcelroy@bostonstock.com> writes:
> > ERROR:  function round(double = precision, integer) does not exist
>
> Try coercing to numeric instead of float.  = Also, it'd be a good idea to
> put that coercion outside the sum()'s instead = of inside --- summing
> bigints is probably noticeably faster than = summing numerics.
>
>       =         =         regards, tom lane

--
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  &nbs= p;    cell: 512-569-9461

------_=_NextPart_001_01C642DF.1646114E-- From pgsql-performance-owner@postgresql.org Wed Mar 8 14:53:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E2BA9DC829 for ; Wed, 8 Mar 2006 14:53: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 53613-02 for ; Wed, 8 Mar 2006 14:53:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id B62F39DC811 for ; Wed, 8 Mar 2006 14:53:12 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 2444356452; Wed, 8 Mar 2006 12:53:11 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 8 Mar 2006 12:53:10 -0600 Date: Wed, 8 Mar 2006 12:53:10 -0600 From: "Jim C. Nasby" To: Ruben Rubio Rey Cc: pgsql-performance@postgresql.org Subject: Re: Is good idea an array of 365 elements in a cell of a table, in order to perform searchs? Message-ID: <20060308185310.GG45250@pervasive.com> References: <440EEA14.70606@rentalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <440EEA14.70606@rentalia.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060308:ruben@rentalia.com::KKOCt7wGLb+2k3Ar:0000000000000000000 0000000000000000000000003qTF X-Hashcash: 1:20:060308:pgsql-performance@postgresql.org::iUyJT6BpBNf5iItx:00000 0000000000000000000000001gZ/ X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/90 X-Sequence-Number: 17527 If you need to compare stuff on a day-by-day basis, I think you'll be much better off just expanding stuff into a table of: item_id int NOT NULL , day date NOT NULL , capacitiy ... , price_per_day ... , price_per_week ... , PRIMARY KEY( item_id, day ) (Note that camel case and databases don't mix well...) Sure, you're de-normalizing here, but the key is that you're putting the data into a format where you can easily do things like: SELECT sum(capacity) FROM ... WHERE day = '2006-12-18'; Trying to do that with arrays would be noticably more complex. And if you wanted to do a whole month or something? Yeck... BTW, another option is to roll price_per_15_days and price_per_month into a different table, since you'd only need 24 rows per item. Might be worth the trade-off in complexity depending on the specifics of the application. On Wed, Mar 08, 2006 at 03:28:36PM +0100, Ruben Rubio Rey wrote: > Hi, > > Im having a dude with a new inplementation in a web site. > The ojective is create a search as fast as possible. I have thought two > possibilities to do that: > > I have several items. Those items has 1 or more of capacity. Each > capacity, has several dates (From 1 january to 10 of april, for > example). The dates covers 366 days, the current year, and they are > indeterminated ranges. Per each date, it has price per day, per week, > per15days and per month. > > I have designed two possibilities: > > First: > IdItem StartDate EndDate Capacity PricePerDay PricePerWeek* > PricePer15days* PricePerMonth* > 1 1-1-2005 10-1-2005 2 100 > 90 85 80 > 1 11-1-2005 20-1-2005 2 105 > 94 83 82 > 1 21-1-2005 5-2-2005 4 405 > 394 283 182 > 2 ... > Right now arround 30.000 rows, in one year is spected to have 60.000 rows > > * In order to compare right, all prices will be translated to days. > Example, PricePerWeek will have the Week Price / 7 and go on > > Second > IdItem Capacity Days > Week 15Days Month Year > 1 2 [Array of 365 values, one per day of > year] [ .Array. ] [ .Array. ] [ .Array. ] [ .Array. ] > ^__ Each item of array its a price > > Right now arround 2.500 rows. in one year is spected to have 5.000 rows > > I have to compare prices or prices and dates or prices and dates and > capacity or capacity and prices > > I have no experience working with arrays on a table. Is it fast? > Witch one do u think will have better performance? > Any good idea? > > I hope this is enouth information. > Thanks in advance, > Ruben Rubio Rey > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- 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 Wed Mar 8 15:24:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8F36A9DC84E for ; Wed, 8 Mar 2006 15:24: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 58023-03 for ; Wed, 8 Mar 2006 15:24:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ausimss.pervasive.com (ausimss.pervasive.com [66.45.103.246]) by postgresql.org (Postfix) with ESMTP id D79BC9DC815 for ; Wed, 8 Mar 2006 15:24:39 -0400 (AST) Received: from ausbayes2.aus.pervasive.com ([172.16.8.6]) by ausimss.pervasive.com with InterScan Messaging Security Suite; Wed, 08 Mar 2006 13:24:37 -0600 Received: from ausmailowa.aus.pervasive.com ([172.16.4.8]) by ausbayes2.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 8 Mar 2006 13:24:36 -0600 Received: from ausmailid.aus.pervasive.com ([172.16.4.64]) by ausmailowa.aus.pervasive.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 8 Mar 2006 13:24:17 -0600 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Postgres and Ingres R3 / SAN Date: Wed, 8 Mar 2006 13:24:17 -0600 Message-ID: <4D27CB1096EF1C408F4BFAB0046EC7B6099E48@ausmailid.aus.pervasive.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Postgres and Ingres R3 / SAN Thread-Index: AcZC4/dOGwccGpGNTZC/Q27LA52YVgAAQayw From: "Jim Nasby" To: "Jeremy Haile" Cc: X-OriginalArrivalTime: 08 Mar 2006 19:24:17.0555 (UTC) FILETIME=[E485B630:01C642E5] 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: 200603/91 X-Sequence-Number: 17528 Adding -performance back; you should do a reply-all if you want to reply = to list messages. > From: Jeremy Haile [mailto:jhaile@fastmail.fm] > > Can you point us at more info about this? I can't even find=20 > a website > > for Ingres... >=20 > Ingres is based off of the same original codebase that PostgreSQL was > based upon (a long time ago) It is owned by Computer=20 > Associates and was > open sourced last year. It supports clustering and replication, and > I've seen an Ingres install set up as a cluster backed by a=20 > SAN before.=20 > I just haven't talked to anyone (at least unbiased) who has used this > type of setup in production, and I'm not fully aware of the > advantages/disadvantages of this type of setup with Ingres. =20 > Since this > group seems pretty knowledgable about performance advantages=20 > (and we are > currently running PostgreSQL), I wanted to see if there were any > experiences or opinions. >=20 > Here is a link to their website: > http://opensource.ca.com/projects/ingres >=20 >=20 > > Perhaps if you posted your performance requirements someone=20 > could help > > point you to a solution that would meet them. >=20 > This is honestly more of a curiousity question at the moment,=20 > so I don't > have any specific numbers. We definitely have a requirement for > failover in the case of a machine failure, so we at least need > Master->Slave replication. However, I wanted to solicit=20 > information on > clustering alternatives as well, since scalability will likely be a > future problem for our database.=20 Ahh, ok... that's likely a much different requirement than true = clustering. What a lot of folks do right now is segregate their application into a = read-only stream and the more interactive read-write streams, and then = use Slony to replicate data to a number of machines for the read-only = work. This way anyone who's hitting the site read-only (and can handle = some possible delay) will just hit one of the slave machines. People who = are doing interactive work (updating data) will hit the master. Since = most applications do far more reading than they do writing, this is a = pretty good way to load-balance. -- 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 Wed Mar 8 20:20:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0D31C9DCA41 for ; Wed, 8 Mar 2006 20:20: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 99721-03 for ; Wed, 8 Mar 2006 20:20:27 -0400 (AST) X-Greylist: delayed 01:12:55.46771 by SQLgrey- Received: from tomts29-srv.bellnexxia.net (tomts29.bellnexxia.net [209.226.175.103]) by postgresql.org (Postfix) with ESMTP id 13FB09DC82D for ; Wed, 8 Mar 2006 20:20:21 -0400 (AST) Received: from mail.oghma.on.ca ([69.159.214.132]) by tomts29-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with SMTP id <20060308230728.UCSV24441.tomts29-srv.bellnexxia.net@mail.oghma.on.ca> for ; Wed, 8 Mar 2006 18:07:28 -0500 Received: (aITmail 1329 invoked by uid 8); 8 Mar 2006 23:07:31 -0000 Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) by uther.oghma.on.a with SMTP; 8 Mar 2006 23:07:31 -0000 From: Gorshkov Organization: Oghma Systems To: pgsql-performance@postgresql.org Subject: embedded postgres and threading Date: Wed, 8 Mar 2006 19:32:37 -0500 User-Agent: KMail/1.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603081932.37939.listsubscriptions@oghma.on.ca> X-ORIGINAL-HEADER: Received: (aITmail 1329 invoked by uid 8); 8 Mar 2006 23:07:31 -0000 X-ORIGINAL-HEADER: Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) X-ORIGINAL-HEADER: by uther.oghma.on.a with SMTP; 8 Mar 2006 23:07:31 -0000 X-ORIGINAL-HEADER: From: Gorshkov X-ORIGINAL-HEADER: Organization: Oghma Systems X-ORIGINAL-HEADER: To: pgsql-performance@postgresql.org X-ORIGINAL-HEADER: Subject: embedded postgres and threading X-ORIGINAL-HEADER: Date: Wed, 8 Mar 2006 19:32:37 -0500 X-ORIGINAL-HEADER: User-Agent: KMail/1.7 X-ORIGINAL-HEADER: MIME-Version: 1.0 X-ORIGINAL-HEADER: Content-Type: text/plain; X-ORIGINAL-HEADER: charset="us-ascii" X-ORIGINAL-HEADER: Content-Transfer-Encoding: 7bit X-ORIGINAL-HEADER: Content-Disposition: inline X-ORIGINAL-HEADER: Message-Id: <200603081932.37939.listsubscriptions@oghma.on.ca> X-RECEIPT-TO[0]: 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: 200603/92 X-Sequence-Number: 17529 Sorry if this is the wrong list ....... I'm in the process of developing an application based on gtk & postgress for both windows & linux. Short, simple and to the point - I'm using embedded SQL .... is there anything I should know about using postgress in multiple threads, under linux OR windows? I've not been able to find anything in the FAQ or documentation regarding this From pgsql-performance-owner@postgresql.org Wed Mar 8 23:23:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 00B749DCB8C for ; Wed, 8 Mar 2006 23:23: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 38533-07 for ; Wed, 8 Mar 2006 23:23:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id EC43E9DCB46 for ; Wed, 8 Mar 2006 23:23:32 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 182385645D; Wed, 8 Mar 2006 21:23:38 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 8 Mar 2006 21:23:37 -0600 Date: Wed, 8 Mar 2006 21:23:37 -0600 From: "Jim C. Nasby" To: "mcelroy, tim" Cc: "'pgsql-performance@postgresql.org'" Subject: Re: pg_reset_stats + cache I/O % Message-ID: <20060309032337.GW45250@pervasive.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B2431@morpheus.bostonstock.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B2431@morpheus.bostonstock.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060309:tim.mcelroy@bostonstock.com::4PyoxPIxKm4yLz0G:0000000000 0000000000000000000000004Gaz X-Hashcash: 1:20:060309:pgsql-performance@postgresql.org::/HH955dTInJHvsFy:00000 0000000000000000000000001eRL X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/93 X-Sequence-Number: 17530 On Wed, Mar 08, 2006 at 01:35:35PM -0500, mcelroy, tim wrote: > I actually need this info as I was tasked by management to provide it. Not > sure if they understand that or not, I do but management does like to see > how well the system and its components are performing. Also, I would > utilize these results to test any cache tuning changes I may make. What I feared. While monitoring cache hit % over time isn't a bad idea, it's less than half the picture, which makes fertile ground for optimizing for some mythical target instead of actual system performance. If the "conclusion" from these numbers is that shared_buffers needs to get set larger than min(50000, 10% of memory) I'd very seriously re-consider how performance tuning is being done. But hopefully I'm just being paranoid and you guys are just doing a great job of monitoring things and keeping on the ball. :) -- 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 Thu Mar 9 06:23:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 385F49DC889 for ; Thu, 9 Mar 2006 06:23: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 29905-05 for ; Thu, 9 Mar 2006 06:23:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from bilbao.pandasoftware.es (unknown [62.14.249.71]) by postgresql.org (Postfix) with ESMTP id 08C629DC86C for ; Thu, 9 Mar 2006 06:23:48 -0400 (AST) Received: from escorpexh05.pandasoftware.local (escorpext02 [192.168.100.182]) by bilbao.pandasoftware.es (Postfix) with ESMTP id 6845C1B38D4 for ; Thu, 9 Mar 2006 11:23:28 +0100 (CET) Received: from ESCORPEXH03.pandasoftware.local ([172.16.0.70]) by escorpexh05.pandasoftware.local with Microsoft SMTPSVC(6.0.3790.211); Thu, 9 Mar 2006 11:23:49 +0100 Received: escorpexh03.pandasoftware.local 172.16.0.73 from 172.16.3.5 172.16.3.5 via HTTP with MS-WebStorage 6.5.6944 Received: from pndsoft by escorpexh03.pandasoftware.local; 09 Mar 2006 11:24:36 +0100 Subject: pgCluster and postgres 8.1 From: Javier Somoza To: pgsql-performance@postgresql.org Content-Type: multipart/alternative; boundary="=-YbmsJPbyGw5GVIE2s3sY" Message-Id: <1141899876.1569.17.camel@pndsoft> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Thu, 09 Mar 2006 11:24:36 +0100 X-OriginalArrivalTime: 09 Mar 2006 10:23:49.0975 (UTC) FILETIME=[8E976E70:01C64363] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.978 required=5 tests=[AWL=0.976, HTML_MESSAGE=0.001, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.978 X-Spam-Level: X-Archive-Number: 200603/94 X-Sequence-Number: 17531 --=-YbmsJPbyGw5GVIE2s3sY Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi all ! I wanna test my system performance when using pgCluster. I'm using postgreSQL 8.1.0 and i've downloaded pgcluster-1.5.0rc7 and pgcluster-1.5.0rc7-patch. Do i need to recompile postgreSQL with the patch? Can i use pgcluster-1.5 with this version of postgreSQL? Thx all --=-YbmsJPbyGw5GVIE2s3sY Content-Type: text/html; charset=utf-8

        Hi all !

        I wanna test my system performance when using pgCluster.
        I'm using postgreSQL 8.1.0 and i've downloaded pgcluster-1.5.0rc7
        and pgcluster-1.5.0rc7-patch.

        Do i need to recompile postgreSQL with the patch?
        Can i use pgcluster-1.5 with this version of postgreSQL?

        Thx all --=-YbmsJPbyGw5GVIE2s3sY-- From pgsql-performance-owner@postgresql.org Thu Mar 9 06:41:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CA0189DC93F for ; Thu, 9 Mar 2006 06:41: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 34346-03 for ; Thu, 9 Mar 2006 06:41:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web53209.mail.yahoo.com (web53209.mail.yahoo.com [206.190.49.79]) by postgresql.org (Postfix) with SMTP id 2E7959DC93D for ; Thu, 9 Mar 2006 06:41:28 -0400 (AST) Received: (qmail 27383 invoked by uid 60001); 9 Mar 2006 10:41:31 -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=EzeeFa/8MEIRQUY/+4dQOvtVm5ar9TSK7ZeOC8OzNEHA5TpZlzcaUL51ScmljJ7FjyEieM81AAX7MY7YX1u9FkSAQ9P6VsTgvlBxYoC+XlB2EF7hCnH5yARxcSNPB7bXu9xYQPLtlq+jRcA11iczApR3c+FjXOjaaXuluo/D8Rc= ; Message-ID: <20060309104131.27381.qmail@web53209.mail.yahoo.com> Received: from [200.193.113.215] by web53209.mail.yahoo.com via HTTP; Thu, 09 Mar 2006 07:41:31 ART Date: Thu, 9 Mar 2006 07:41:31 -0300 (ART) From: Carlos Henrique Reimer Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison To: Andre Felipe Machado , pgsql-performance@postgresql.org In-Reply-To: <1141782015.1610.40.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1231407823-1141900891=:20975" 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: 200603/95 X-Sequence-Number: 17532 --0-1231407823-1141900891=:20975 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Andre, Could not Postgresql file cache being killed by firebird activity? Haven�t you tried decrease ramdom_page_cost to 3 or 2? It would be better if only one person will make configuration changes, otherwise it will be difficult to measure each configuration change impact. Reimer Andre Felipe Machado escreveu: Hello, Many thanks for the valuable suggestions and insights. The defaults enable_bitmapscan and enable_seqscan were altered by my friend. He already re enabled them (maybe even while I was trying some of the queries). The machine is a P4 3.2GHz, 1 GBram, sata hd, windows 2000. I did not used pg on win before to have any advice to my friend. The previously attached file contains SOME relevant info from the psql session, in order to not clutter file. When some server parameter was modified (at least by me) and server restarted, a new sholl parameter was issued to show the new value. Firebird is running at the same machine. As you can see by the session log, indexes were created on the columns used and tables was first clustered on the indexes actually used by the query. The subsequent cluster commands only recluster on the same indexes previously clustered. shared_buffers was increased from 1000 to 16384 pages effective_cache_size was increased from 1000 to 65535 pages and at the final steps REDUCED to 8192 pages work_mem was increased from 1024 first to 16384 KB and then to 65535 KB. The first 2 parameters reduced time 18%. work_mem reduced time almost 66%. But work_mem easily can exhaust ram with many users connected, as each connection query will use this amount of memory (if I can remember). How much it can grow at this 1 gbram win machine? Some of the docs I already read suggested that indexes should be entirely contained in ram. How to dimension the parameters? Other docs adviced that some memory parameters could actually degrade performance if too big. There are peak points at the performance curve by adjusting mem parameters. I hope tomorrow execute explain with the bitmapscan and seqscan enabled. bitmapscans are almost always faster? The data, as far I know, are a sample real app data (hey, if and when in production it will be even large?). They are almost true random as my friend informed, and according to him, cluster should not really be of benefit. It seems confirmed by the various explain analyze commands before and after clustering. Any suggestions? Do you see some obvious error on the steps at the previous session log file? It seems that Firebird windows can use adequately as much ram it finds and postgresql windows can not. How dimension ram to the indexes? Only by trial and error? I tried some suggested values found at some tuning docs suitable to the available system ram. Thanks Andre Felipe ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq --------------------------------- Yahoo! Acesso Gr�tis Internet r�pida e gr�tis. Instale o discador agora! --0-1231407823-1141900891=:20975 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Andre,
 
Could not Postgresql file cache being killed by firebird activity?
Haven�t you tried decrease ramdom_page_cost to 3 or 2?

It would be better if only one person will make configuration changes,
otherwise it will be difficult to measure each configuration change impact.

Reimer



Andre Felipe Machado <andremachado@techforce.com.br> escreveu:
Hello,
Many thanks for the valuable suggestions and insights.
The defaults enable_bitmapscan and enable_seqscan were altered by my
friend. He already re enabled them (maybe even while I was trying some
of the queries).
The machine is a P4 3.2GHz, 1 GBram, sata hd, windows 2000. I did not
used pg on win before to have any advice to my friend.
The previously attached file contains SOME relevant info from the psql
session, in order to not clutter file.
When some server parameter was modified (at least by me) and server
restarted, a new sholl parameter was issued to show the new value.
Firebird is running at the same machine.
As you can see by the session log, indexes were created on the columns
used and tables was first clustered on the indexes actually used by the
query.
The subsequent cluster commands only recluster on the same indexes
previously clustered.
shared_buffers was increased from 1000 to 16384 pages
effective_cache_size was increased from 1000 to 65535 pages and at the
final steps REDUCED to 8192 pages
work_mem was increased from 1024 first to 16384 KB and then to 65535
KB.
The first 2 parameters reduced time 18%.
work_mem reduced time almost 66%.
But work_mem easily can exhaust ram with many users connected, as each
connection query will use this amount of memory (if I can remember).
How much it can grow at this 1 gbram win machine?
Some of the docs I already read suggested that indexes should be
entirely contained in ram. How to dimension the parameters?
Other docs adviced that some memory parameters could actually degrade
performance if too big. There are peak points at the performance curve
by adjusting mem parameters.
I hope tomorrow execute explain with the bitmapscan and seqscan enabled.
bitmapscans are almost always faster?

The data, as far I know, are a sample real app data (hey, if and when in
production it will be even large?). They are almost true random as my
friend informed, and according to him, cluster should not really be of
benefit. It seems confirmed by the various explain analyze commands
before and after clustering.

Any suggestions? Do you see some obvious error on the steps at the
previous session log file?
It seems that Firebird windows can use adequately as much ram it finds
and postgresql windows can not. How dimens ion ram to the indexes? Only
by trial and error? I tried some suggested values found at some tuning
docs suitable to the available system ram.

Thanks
Andre Felipe





---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Yahoo! Acesso Gr�tis
Internet r�pida e gr�tis. Instale o discador agora! --0-1231407823-1141900891=:20975-- From pgsql-performance-owner@postgresql.org Thu Mar 9 08:04:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 75EC59DCA28 for ; Thu, 9 Mar 2006 08:04: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 49034-02 for ; Thu, 9 Mar 2006 08:04:34 -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 AFE1F9DCA0B for ; Thu, 9 Mar 2006 08:04:29 -0400 (AST) Received: (qmail 31599 invoked from network); 9 Mar 2006 13:05:08 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 9 Mar 2006 13:05:08 +0100 Date: Thu, 09 Mar 2006 13:05:07 +0100 To: "Carlos Henrique Reimer" , "Andre Felipe Machado" , pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison References: <20060309104131.27381.qmail@web53209.mail.yahoo.com> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <20060309104131.27381.qmail@web53209.mail.yahoo.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.104 required=5 tests=[AWL=0.104] X-Spam-Score: 0.104 X-Spam-Level: X-Archive-Number: 200603/96 X-Sequence-Number: 17533 > I hope tomorrow execute explain with the bitmapscan and seqscan enabled. > bitmapscans are almost always faster? Like all the rest, they're just a tool, which works great when used in its intended purpose : - Fetching just a few percent of the rows from a table is better served by an index scan - Fetching a lot of rows (>30-50%) from a table is better served by a seq scan - Bitmap scan comes in between and it's a very welcome addition. Also Bitmap scan will save your life if you have complex searches, like if you run a dating site and have an index on blondes and an index on boob size, because it can use several indexes in complex AND/OR queries. Common wisdom says simpler databases can be faster than postgres on simple queries. Reality check with pg 8.1 driven by PHP : - SELECT 1 mysql 5 ~ 42 us postgres ~ 70 us - SELECT * FROM users WHERE id=1 mysql 5 ~ 180 us postgres ~ 160 us Of course people doing stupid things, like using the database to keep a hit counter on their website which is updated on every hit, will say that postgres is slow. From pgsql-performance-owner@postgresql.org Thu Mar 9 09:15:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E70189DCAC3 for ; Thu, 9 Mar 2006 09:15: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 61097-06 for ; Thu, 9 Mar 2006 09:15:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (unknown [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id 2B5F89DCB63 for ; Thu, 9 Mar 2006 09:15:24 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Thu, 9 Mar 2006 08:13:34 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B243B@morpheus.bostonstock.com> From: "mcelroy, tim" To: "'Jim C. Nasby'" Cc: "'pgsql-performance@postgresql.org'" Subject: Re: pg_reset_stats + cache I/O % Date: Thu, 9 Mar 2006 08:13:30 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6437B.42B8F4B6" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.175 required=5 tests=[AWL=0.174, HTML_MESSAGE=0.001] X-Spam-Score: 0.175 X-Spam-Level: X-Archive-Number: 200603/97 X-Sequence-Number: 17534 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C6437B.42B8F4B6 Content-Type: text/plain; charset="iso-8859-1" Sorry I realized your fears :) PostgreSQL is a new (last four months) install here and I'm responsible for it. Great DB and I enjoy working with it a lot and learning the nuances of it. Keep in mind that the management are 'old-time' system folks who love charts showing system and in this case DB performance. I'm basically just using the out-of-the-box defaults in my postgresql.conf file and that seems to be working so far. But as the DB grows I just need a way to prove the DB is functioning properly when apps get slow. You know the old you're guilty till proven innocent syndrome.... Ok enough on that. Yes, thank you we try to keep on the ball regarding system monitoring. BTW - I'm still waiting to see if anyone out there can say yea or nay if the SQL I wrote is a valid indicator of overall cache % hit? > SELECT 100 - round((blks_hit::numeric / (blks_hit::numeric + > blks_read::numeric)) * 100,2) > AS "Cache % Hit" > FROM pg_stat_database > WHERE datname = 'Fix1'; > > > > Cache % Hit > -------------------- > 98.06 > (1 row) Thank you, Tim -----Original Message----- From: Jim C. Nasby [mailto:jnasby@pervasive.com] Sent: Wednesday, March 08, 2006 10:24 PM To: mcelroy, tim Cc: 'pgsql-performance@postgresql.org' Subject: Re: [PERFORM] pg_reset_stats + cache I/O % On Wed, Mar 08, 2006 at 01:35:35PM -0500, mcelroy, tim wrote: > I actually need this info as I was tasked by management to provide it. Not > sure if they understand that or not, I do but management does like to see > how well the system and its components are performing. Also, I would > utilize these results to test any cache tuning changes I may make. What I feared. While monitoring cache hit % over time isn't a bad idea, it's less than half the picture, which makes fertile ground for optimizing for some mythical target instead of actual system performance. If the "conclusion" from these numbers is that shared_buffers needs to get set larger than min(50000, 10% of memory) I'd very seriously re-consider how performance tuning is being done. But hopefully I'm just being paranoid and you guys are just doing a great job of monitoring things and keeping on the ball. :) -- 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 ------_=_NextPart_001_01C6437B.42B8F4B6 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] pg_reset_stats + cache I/O %

Sorry I realized your fears :)

PostgreSQL is a new (last four months) install here = and I'm responsible for it.  Great DB and I enjoy working with it = a lot and learning the nuances of it.  Keep in mind that the = management are 'old-time' system folks who love charts showing system = and in this case DB performance.  I'm basically just using the = out-of-the-box defaults in my postgresql.conf file and that seems to be = working so far.  But as the DB grows I just need a way to prove = the DB is functioning properly when apps get slow.  You know the = old you're guilty till proven innocent syndrome....  Ok enough on = that. 

Yes, thank you we try to keep on the ball regarding = system monitoring.  BTW - I'm still waiting to see if anyone out = there can say yea or nay if the SQL I wrote is a valid indicator of = overall cache % hit?

> SELECT 100 - round((blks_hit::numeric / = (blks_hit::numeric +
> blks_read::numeric)) * 100,2)
> AS "Cache % Hit"
> FROM pg_stat_database
> WHERE datname =3D 'Fix1';
>
> <RETURNS>
>
> Cache % Hit
> --------------------
>        = 98.06
> (1 row)

Thank you,
Tim


 -----Original Message-----
From:   Jim C. Nasby [mailto:jnasby@pervasive.com] =
Sent:   Wednesday, March 08, 2006 10:24 = PM
To:     mcelroy, tim
Cc:     = 'pgsql-performance@postgresql.org'
Subject:        = Re: [PERFORM] pg_reset_stats + cache I/O %

On Wed, Mar 08, 2006 at 01:35:35PM -0500, mcelroy, = tim wrote:
> I actually need this info as I was tasked by = management to provide it.  Not
> sure if they understand that or not, I do but = management does like to see
> how well the system and its components are = performing.  Also, I would
> utilize these results to test any cache tuning = changes I may make. 

What I feared. While monitoring cache hit % over time = isn't a bad idea,
it's less than half the picture, which makes fertile = ground for
optimizing for some mythical target instead of = actual system
performance. If the "conclusion" from = these numbers is that
shared_buffers needs to get set larger than = min(50000, 10% of memory)
I'd very seriously re-consider how performance = tuning is being done.

But hopefully I'm just being paranoid and you guys = are just doing a
great job of monitoring things and keeping on the = ball. :)
--
Jim C. Nasby, Sr. Engineering Consultant  &= nbsp;   jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: = 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf  &nbs= p;    cell: 512-569-9461

------_=_NextPart_001_01C6437B.42B8F4B6-- From pgsql-performance-owner@postgresql.org Thu Mar 9 16:07:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 22E409DC845 for ; Thu, 9 Mar 2006 16:07: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 55796-04 for ; Thu, 9 Mar 2006 16:07:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 38F0D9DCC78 for ; Thu, 9 Mar 2006 16:07:11 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id E0E38A06BA for ; Thu, 9 Mar 2006 15:07:07 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 387F312401F for ; Thu, 9 Mar 2006 15:07:07 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22045-02 for ; Thu, 9 Mar 2006 15:07:07 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 2020F1217F5 for ; Thu, 9 Mar 2006 15:07:07 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Thu, 9 Mar 2006 15:07:04 -0500 User-Agent: KMail/1.9.1 References: <200603060938.00751.jdevisser@digitalfairway.com> In-Reply-To: <200603060938.00751.jdevisser@digitalfairway.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603091507.04663.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/98 X-Sequence-Number: 17535 I have more information on this issue. =46irst of, the problem now happens after about 1-2 hours, as opposed to th= e 6-8=20 I mentioned earlier. Yey for shorter test cycles. =46urtermore, it does not happen on Linux machines, both single CPU and dua= l=20 CPU, nor on single CPU windows machines. We can only reproduce on a dual CP= U=20 windows machine, and if we take one CPU out, it does not happen. I executed the following after it hung: db=3D# select l.pid, c.relname, l.mode, l.granted, l.page, l.tuple=20 from pg_locks l, pg_class c where c.oid =3D l.relation order by l.pid; Which showed me that several transactions where waiting for a particular ro= w=20 which was locked by another transaction. This transaction had no pending=20 locks (so no deadlock), but just does not complete and hence never=20 relinquishes the lock. What gives? has anybody ever heard of problems like this on dual CPU window= s=20 machines? jan On Monday 06 March 2006 09:38, Jan de Visser wrote: > Hello, > > While doing performance tests on Windows Server 2003 we observed to > following two problems. > > Environment: J2EE application running in JBoss application server, against > pgsql 8.1 database. Load is caused by a smallish number of (very) complex > transactions, typically about 5-10 concurrently. > > The first one, which bothers me the most, is that after about 6-8 hours t= he > application stops processing. No errors are reported, neither by the JDBC > driver nor by the server, but when I kill the application server, I see > that all my connections hang in a SQL statements (which never seem to > return): > > 2006-03-03 08:17:12 4504 6632560 LOG: =A0duration: 45087000.000 ms > =A0statement: EXECUTE =A0[PREPARE: =A0SELECT objID FROM objects= WHERE > objID =3D $1 FOR UPDATE] > > I think I can reliably reproduce this by loading the app, and waiting a > couple of hours. =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Thu Mar 9 16:10:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 99AC69DC9D1 for ; Thu, 9 Mar 2006 16:10: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 55143-05 for ; Thu, 9 Mar 2006 16:10: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 DAE659DC97E for ; Thu, 9 Mar 2006 16:10:44 -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 k29KAhto027203; Thu, 9 Mar 2006 15:10:43 -0500 (EST) To: Jan de Visser cc: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows In-reply-to: <200603091507.04663.jdevisser@digitalfairway.com> References: <200603060938.00751.jdevisser@digitalfairway.com> <200603091507.04663.jdevisser@digitalfairway.com> Comments: In-reply-to Jan de Visser message dated "Thu, 09 Mar 2006 15:07:04 -0500" Date: Thu, 09 Mar 2006 15:10:43 -0500 Message-ID: <27202.1141935043@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/99 X-Sequence-Number: 17536 Jan de Visser writes: > Furtermore, it does not happen on Linux machines, both single CPU and dual > CPU, nor on single CPU windows machines. We can only reproduce on a dual CPU > windows machine, and if we take one CPU out, it does not happen. > ... > Which showed me that several transactions where waiting for a particular row > which was locked by another transaction. This transaction had no pending > locks (so no deadlock), but just does not complete and hence never > relinquishes the lock. Is the stuck transaction still consuming CPU time, or just stopped? Is it possible to get a stack trace from the stuck process? I dunno if you've got anything gdb-equivalent under Windows, but that's the first thing I'd be interested in ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 9 17:15:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 006049DCA1E for ; Thu, 9 Mar 2006 17:15: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 63883-10 for ; Thu, 9 Mar 2006 17:15:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 159129DCA14 for ; Thu, 9 Mar 2006 17:15:48 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id B03F9A068D for ; Thu, 9 Mar 2006 16:15:49 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 0D1411217F5 for ; Thu, 9 Mar 2006 16:15:49 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24531-07 for ; Thu, 9 Mar 2006 16:15:48 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id E94FE120D42 for ; Thu, 9 Mar 2006 16:15:48 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Thu, 9 Mar 2006 16:15:47 -0500 User-Agent: KMail/1.9.1 References: <200603060938.00751.jdevisser@digitalfairway.com> <200603091507.04663.jdevisser@digitalfairway.com> <27202.1141935043@sss.pgh.pa.us> In-Reply-To: <27202.1141935043@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603091615.47323.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/100 X-Sequence-Number: 17537 On Thursday 09 March 2006 15:10, Tom Lane wrote: > Jan de Visser writes: > > Furtermore, it does not happen on Linux machines, both single CPU and > > dual CPU, nor on single CPU windows machines. We can only reproduce on a > > dual CPU windows machine, and if we take one CPU out, it does not happe= n. > > ... > > Which showed me that several transactions where waiting for a particular > > row which was locked by another transaction. This transaction had no > > pending locks (so no deadlock), but just does not complete and hence > > never relinquishes the lock. > > Is the stuck transaction still consuming CPU time, or just stopped? CPU drops off. In fact, that's my main clue something's wrong ;-) > > Is it possible to get a stack trace from the stuck process? I dunno > if you've got anything gdb-equivalent under Windows, but that's the > first thing I'd be interested in ... I wouldn't know. I'm hardly a windows expert. Prefer not to touch the stuff= ,=20 myself. Can do some research though... > > regards, tom lane jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 jdevisser@digitalfairway.com =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Baruk Khazad! Khaza= d ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Thu Mar 9 17:22:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9F29D9DCBEE for ; Thu, 9 Mar 2006 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 74554-09 for ; Thu, 9 Mar 2006 17:22:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by postgresql.org (Postfix) with ESMTP id 92E349DCB76 for ; Thu, 9 Mar 2006 17:22:04 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 92B3F8F283; Thu, 9 Mar 2006 22:22:05 +0100 (CET) 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: Hanging queries on dual CPU windows Date: Thu, 9 Mar 2006 22:22:04 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA0F841@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hanging queries on dual CPU windows Thread-Index: AcZDtaIrD+z4hizoSTi6bCeKFZzXCwACdo+Q From: "Magnus Hagander" To: "Tom Lane" , "Jan de Visser" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/101 X-Sequence-Number: 17538 > Is it possible to get a stack trace from the stuck process? =20 > I dunno if you've got anything gdb-equivalent under Windows,=20 > but that's the first thing I'd be interested in ... Try Process Explorer from www.sysinternals.com. //Magnus From pgsql-performance-owner@postgresql.org Thu Mar 9 22:23:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C917E9DCBD1 for ; Thu, 9 Mar 2006 22:23: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 34707-05 for ; Thu, 9 Mar 2006 22:23:34 -0400 (AST) X-Greylist: delayed 01:40:47.508336 by SQLgrey- Received: from qsrv01ps.mx.bigpond.com (qsrv01ps.mx.bigpond.com [144.140.82.181]) by postgresql.org (Postfix) with ESMTP id 529239DCB97 for ; Thu, 9 Mar 2006 22:23:25 -0400 (AST) Received: from [192.168.248.100] (really [149.167.166.208]) by omta05ps.mx.bigpond.com with ESMTP id <20060309235136.LAEH14751.omta05ps.mx.bigpond.com@[192.168.248.100]>; Thu, 9 Mar 2006 23:51:36 +0000 Message-ID: <4410BF88.5080001@bigpond.net.au> Date: Fri, 10 Mar 2006 09:51:36 +1000 From: David Brown User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andre Felipe Machado CC: pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison References: <20060307162842.M37264@techforce.com.br> <1141782015.1610.40.camel@localhost.localdomain> In-Reply-To: <1141782015.1610.40.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.358 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 1.358 X-Spam-Level: * X-Archive-Number: 200603/104 X-Sequence-Number: 17541 Andre Felipe Machado wrote: >It seems that Firebird windows can use adequately as much ram it finds >and postgresql windows can not. > > PostgreSQL relies on the OS cache to utilize RAM. Make sure that most of the RAM is 'available' so Windows can do its thing. effective_cache_size should be set correspondingly high - at least 65535. shared_buffers should be as low as you can get away with (allowing for multiple users). 16384 is 12.5% of your RAM and far too high. AFAIK, PostgreSQL still doesn't differentiate between index blocks and data blocks. >work_mem reduced time almost 66%. >But work_mem easily can exhaust ram with many users connected, as each >connection query will use this amount of memory (if I can remember). >How much it can grow at this 1 gbram win machine? > > work_mem has to be just big enough to allow hash joins to operate efficiently. This varies from query to query and can be set in your code accordingly. However, the 1024 default is just too low for most applications and you'll probably find even 4096 is a huge improvement. You need to find the minimum that delivers acceptable performance in most queries and boost it for selected queries as required. BTW, which version of Firebird is this? From pgsql-performance-owner@postgresql.org Thu Mar 9 21:49:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A9C639DC838 for ; Thu, 9 Mar 2006 21:49: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 27897-09 for ; Thu, 9 Mar 2006 21:49:05 -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 36E7B9DC807 for ; Thu, 9 Mar 2006 21:49:00 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 4so619215nzn for ; Thu, 09 Mar 2006 17:49:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=ra1eGem1k3QO3zmZwm+iyDT/+BXqpYmS1gXboOkwBgOj1hJ/cN+dxHR8VpuVfUS8XZPfeR1NZQUjOmHGnFGLe9QhMn0y3/b5tr9fLl4VJVJ1Thdhxz26Oa1YE7kST5tv/N62cMocqvB1Uds8gtLuzYYGpzuNZOVDOrNtbLB3Bao= Received: by 10.64.241.8 with SMTP id o8mr238334qbh; Thu, 09 Mar 2006 17:49:04 -0800 (PST) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id e11sm1286939qbc.2006.03.09.17.49.02; Thu, 09 Mar 2006 17:49:04 -0800 (PST) Message-ID: <4410DB03.9040007@gmail.com> Date: Fri, 10 Mar 2006 12:48:51 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Javier Somoza CC: pgsql-performance@postgresql.org Subject: Re: pgCluster and postgres 8.1 References: <1141899876.1569.17.camel@pndsoft> In-Reply-To: <1141899876.1569.17.camel@pndsoft> 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.117 required=5 tests=[AWL=0.117] X-Spam-Score: 0.117 X-Spam-Level: X-Archive-Number: 200603/102 X-Sequence-Number: 17539 Javier Somoza wrote: > I wanna test my system performance when using pgCluster. > I'm using postgreSQL 8.1.0 and i've downloaded pgcluster-1.5.0rc7 > and pgcluster-1.5.0rc7-patch. > > Do i need to recompile postgreSQL with the patch? > Can i use pgcluster-1.5 with this version of postgreSQL? What does the documentation that comes with the patch say? -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Thu Mar 9 22:00:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 020179DC807 for ; Thu, 9 Mar 2006 22:00: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 30069-04 for ; Thu, 9 Mar 2006 22:00:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id D16A69DCA74 for ; Thu, 9 Mar 2006 22:00:24 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id C4C7DA068D for ; Thu, 9 Mar 2006 21:00:28 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 7920812403D for ; Thu, 9 Mar 2006 21:00:28 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09198-05 for ; Thu, 9 Mar 2006 21:00:28 -0500 (EST) Received: from whitby.toronto.digitalfairway.ca (unknown [192.168.100.153]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 50A8B124039 for ; Thu, 9 Mar 2006 21:00:28 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Thu, 9 Mar 2006 21:00:27 -0500 User-Agent: KMail/1.9.1 References: <200603060938.00751.jdevisser@digitalfairway.com> <200603091507.04663.jdevisser@digitalfairway.com> <27202.1141935043@sss.pgh.pa.us> In-Reply-To: <27202.1141935043@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603092100.27527.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/103 X-Sequence-Number: 17540 On Thursday 09 March 2006 15:10, Tom Lane wrote: > Is it possible to get a stack trace from the stuck process? =C2=A0I dunno > if you've got anything gdb-equivalent under Windows, but that's the > first thing I'd be interested in ... Here ya go: http://www.devisser-siderius.com/stack1.jpg http://www.devisser-siderius.com/stack2.jpg http://www.devisser-siderius.com/stack3.jpg There are three threads in the process. I guess thread 1 (stack1.jpg) is th= e=20 most interesting. I also noted that cranking up concurrency in my app reproduces the problem = in=20 about 4 minutes ;-) With thanks to Magnus Hagander for the Process Explorer hint. jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 jdevisser@digitalfairway.com =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Baruk Khazad! Khaza= d ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Thu Mar 9 22:28:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 45BCD9DC807 for ; Thu, 9 Mar 2006 22:28: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 37716-06 for ; Thu, 9 Mar 2006 22:28:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from akranes.seattleserver.com (akranes.seattleserver.com [205.234.78.154]) by postgresql.org (Postfix) with ESMTP id 01AED9DC870 for ; Thu, 9 Mar 2006 22:28:06 -0400 (AST) Received: from pool-71-113-119-162.sttlwa.dsl-w.verizon.net ([71.113.119.162] helo=[192.168.0.100]) by akranes.seattleserver.com with esmtpa (Exim 4.54) id 1FHXM2-0007wL-Kl for pgsql-performance@postgresql.org; Fri, 10 Mar 2006 02:27:46 +0000 From: Casey Allen Shobe Organization: SeattleServer.com, Inc. To: pgsql-performance@postgresql.org Subject: Using materialized views for commonly-queried subsets Date: Fri, 10 Mar 2006 02:25:08 +0000 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603100225.08152.lists@seattleserver.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.672 required=5 tests=[AWL=0.672] X-Spam-Score: 0.672 X-Spam-Level: X-Archive-Number: 200603/105 X-Sequence-Number: 17542 I typed up a description of a situation where the only viable option to improve performance was to use a materialized view, which, when implemented, was found to improve performance twenty-sevenfold, even with a fairly small amount of excess data (which is antipated to grow). I thought this might be of use to anybody else in a similar situation, so I thought I'd post it here. http://community.seattleserver.com/viewtopic.php?t=11 Feel free to reproduce as you see fit. Cheers, -- Casey Allen Shobe | cshobe@seattleserver.com | 206-381-2800 SeattleServer.com, Inc. | http://www.seattleserver.com From pgsql-performance-owner@postgresql.org Fri Mar 10 03:11:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4FDAE9DCA84 for ; Fri, 10 Mar 2006 03:11: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 83418-02 for ; Fri, 10 Mar 2006 03:11:53 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 2A2629DC821 for ; Fri, 10 Mar 2006 03:11:51 -0400 (AST) Received: from hotmail.com (bay107-dav18.bay107.hotmail.com [64.4.51.90]) by svr4.postgresql.org (Postfix) with ESMTP id 20B4B5AF026 for ; Fri, 10 Mar 2006 07:11:52 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 9 Mar 2006 23:11:50 -0800 Message-ID: Received: from 84.193.85.191 by BAY107-DAV18.phx.gbl with DAV; Fri, 10 Mar 2006 07:11:46 +0000 X-Originating-IP: [84.193.85.191] X-Originating-Email: [nbforyou@hotmail.com] X-Sender: nbforyou@hotmail.com From: "NbForYou" To: Subject: Process Time X200 Date: Fri, 10 Mar 2006 08:11:44 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001B_01C6441A.45329860" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 10 Mar 2006 07:11:50.0612 (UTC) FILETIME=[E6EDE140:01C64411] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.92 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.92 X-Spam-Level: * X-Archive-Number: 200603/106 X-Sequence-Number: 17543 This is a multi-part message in MIME format. ------=_NextPart_000_001B_01C6441A.45329860 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I could need some help. I have a Postgresql database=20 When i do a query on my homeserver the result is given back fast but = when i do the same query on my webhost server the query is useless = because of the processtime (200 times slower (56366.20 / 281.000 =3D = 200.59) ). My Pc is just a simple pc in reference to the high quality = systems my webhost uses. I have included the query plan and the table Query: explain analyze SELECT B.gegevensnaam AS boss, E.gegevensnaam=20 FROM nieuw_gegevens AS E=20 LEFT OUTER JOIN=20 nieuw_gegevens AS B=20 ON B.lft=20 =3D (SELECT MAX(lft)=20 FROM nieuw_gegevens AS S=20 WHERE E.lft > S.lft=20 AND E.lft < S.rgt) order by boss, gegevensnaam=20 On the WEBHOST:=20 QUERY PLAN=20 Sort (cost=3D1654870.86..1654871.87 rows=3D403 width=3D38) (actual = time=3D56365.13..56365.41 rows=3D403 loops=3D1)=20 Sort Key: b.gegevensnaam, e.gegevensnaam=20 -> Nested Loop (cost=3D0.00..1654853.42 rows=3D403 width=3D38) = (actual time=3D92.76..56360.79 rows=3D403 loops=3D1)=20 Join Filter: ("inner".lft =3D (subplan))=20 -> Seq Scan on nieuw_gegevens e (cost=3D0.00..8.03 rows=3D403 = width=3D19) (actual time=3D0.03..1.07 rows=3D403 loops=3D1)=20 -> Seq Scan on nieuw_gegevens b (cost=3D0.00..8.03 rows=3D403 = width=3D19) (actual time=3D0.00..0.79 rows=3D403 loops=3D403)=20 SubPlan=20 -> Aggregate (cost=3D10.16..10.16 rows=3D1 width=3D4) = (actual time=3D0.34..0.34 rows=3D1 loops=3D162409)=20 -> Seq Scan on nieuw_gegevens s (cost=3D0.00..10.04 = rows=3D45 width=3D4) (actual time=3D0.20..0.33 rows=3D2 loops=3D162409)=20 Filter: (($0 > lft) AND ($0 < rgt))=20 Total runtime: 56366.20 msec=20 11 row(s)=20 Total runtime: 56,370.345 ms=20 On my HOMESERVER:=20 QUERY PLAN=20 Sort (cost=3D12459.00..12461.04 rows=3D813 width=3D290) (actual = time=3D281.000..281.000 rows=3D403 loops=3D1)=20 Sort Key: b.gegevensnaam, e.gegevensnaam=20 -> Merge Left Join (cost=3D50.94..12419.71 rows=3D813 width=3D290) = (actual time=3D281.000..281.000 rows=3D403 loops=3D1)=20 Merge Cond: ("outer"."?column3?" =3D "inner".lft)=20 -> Sort (cost=3D25.47..26.48 rows=3D403 width=3D149) (actual = time=3D281.000..281.000 rows=3D403 loops=3D1)=20 Sort Key: (subplan)=20 -> Seq Scan on nieuw_gegevens e (cost=3D0.00..8.03 = rows=3D403 width=3D149) (actual time=3D0.000..281.000 rows=3D403 = loops=3D1)=20 SubPlan=20 -> Aggregate (cost=3D10.16..10.16 rows=3D1 = width=3D4) (actual time=3D0.697..0.697 rows=3D1 loops=3D403)=20 -> Seq Scan on nieuw_gegevens s = (cost=3D0.00..10.05 rows=3D45 width=3D4) (actual time=3D0.308..0.658 = rows=3D2 loops=3D403)=20 Filter: (($0 > lft) AND ($0 < rgt))=20 -> Sort (cost=3D25.47..26.48 rows=3D403 width=3D149) (actual = time=3D0.000..0.000 rows=3D770 loops=3D1)=20 Sort Key: b.lft=20 -> Seq Scan on nieuw_gegevens b (cost=3D0.00..8.03 = rows=3D403 width=3D149) (actual time=3D0.000..0.000 rows=3D403 = loops=3D1)=20 Total runtime: 281.000 ms=20 15 row(s)=20 Total runtime: 287.273 ms=20 As you can see the query isn't useful anymore because of the = processtime. Please Also notice that both systems use a different query = plan. =20 Also on the webhost we have a loop of 162409 (403 rows * 403 rows). Both systems also use a different postgresql version. But I cannot = believe that the performance difference between 1 version could be this = big regarding self outer join queries! Table=20 CREATE TABLE nieuw_gegevens=20 (=20 gegevensid int4 NOT NULL DEFAULT = nextval('nieuw_gegevens_gegevensid_seq'::text),=20 gegevensnaam varchar(255) NOT NULL,=20 lft int4 NOT NULL,=20 rgt int4 NOT NULL,=20 keyword text,=20 CONSTRAINT nieuw_gegevens_pkey PRIMARY KEY (gegevensid),=20 CONSTRAINT nieuw_gegevens_gegevensnaam_key UNIQUE (gegevensnaam)=20 )=20 WITH OIDS;=20 Does anyone now how to resolve this problem? Could it be that the = configuration of the webhost postgresql could me wrong? thank you ------=_NextPart_000_001B_01C6441A.45329860 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
 
I could need some help.
 
 I have a = Postgresql=20 database 

When i do a query on my homeserver the result is = given=20 back fast but when i do the same query on my webhost server the query is = useless=20 because of the processtime (200 times slower =20 (56366.20 / 281.000 =3D = 200.59) ). My Pc=20 is just a simple pc in reference to the high quality systems my webhost=20 uses.
I have included the query plan and the=20 table
Query:

explain analyze SELECT B.gegevensnaam AS boss, E.gegevensnaam =
FROM=20 nieuw_gegevens AS E
LEFT OUTER JOIN
nieuw_gegevens AS B
ON = B.lft=20
=3D (SELECT MAX(lft)
FROM nieuw_gegevens AS S
WHERE E.lft = > S.lft=20
AND E.lft < S.rgt) order by boss, gegevensnaam 

On=20 the WEBHOST:

QUERY PLAN=20
Sort  (cost=3D1654870.86..1654871.87 rows=3D403 = width=3D38) (actual=20 time=3D56365.13..56365.41 rows=3D403 loops=3D1)
  Sort = Key:=20 b.gegevensnaam, e.gegevensnaam
  ->  Nested=20 Loop  (cost=3D0.00..1654853.42 rows=3D403 width=3D38) (actual=20 time=3D92.76..56360.79 rows=3D403 loops=3D1)=20
        Join Filter: = ("inner".lft =3D=20 (subplan))=20
        ->  Seq = Scan on=20 nieuw_gegevens e  (cost=3D0.00..8.03 rows=3D403 width=3D19) = (actual=20 time=3D0.03..1.07 rows=3D403 loops=3D1)=20
        ->  Seq = Scan on=20 nieuw_gegevens b  (cost=3D0.00..8.03 rows=3D403 width=3D19) = (actual=20 time=3D0.00..0.79 rows=3D403 loops=3D403)=20
        SubPlan=20
          ->&nbs= p; Aggregate  (cost=3D10.16..10.16=20 rows=3D1 width=3D4) (actual time=3D0.34..0.34 rows=3D1 loops=3D162409)=20
           &nb= sp;    ->  Seq=20 Scan on nieuw_gegevens s  (cost=3D0.00..10.04 rows=3D45 = width=3D4) (actual=20 time=3D0.20..0.33 rows=3D2 loops=3D162409)=20
           &nb= sp;          Filter:=20 (($0 > lft) AND ($0 < rgt))
Total runtime: 56366.20 msec =

11=20 row(s)

Total runtime: 56,370.345 ms 


On my = HOMESERVER:=20

QUERY PLAN
Sort  (cost=3D12459.00..12461.04 = rows=3D813=20 width=3D290) (actual time=3D281.000..281.000 rows=3D403 loops=3D1) =
  Sort=20 Key: b.gegevensnaam, e.gegevensnaam =
  ->  Merge Left=20 Join  (cost=3D50.94..12419.71 rows=3D813 width=3D290) (actual=20 time=3D281.000..281.000 rows=3D403 loops=3D1)=20
        Merge Cond:=20 ("outer"."?column3?" =3D "inner".lft)=20
        ->  Sort=   (cost=3D25.47..26.48=20 rows=3D403 width=3D149) (actual time=3D281.000..281.000 rows=3D403 = loops=3D1)=20
           &nb= sp;  Sort=20 Key: (subplan)=20
           &nb= sp;  ->  Seq=20 Scan on nieuw_gegevens e  (cost=3D0.00..8.03 rows=3D403 = width=3D149) (actual=20 time=3D0.000..281.000 rows=3D403 loops=3D1)=20
           &nb= sp;        SubPlan=20
           &nb= sp;          -> = ; Aggregate  (cost=3D10.16..10.16=20 rows=3D1 width=3D4) (actual time=3D0.697..0.697 rows=3D1 loops=3D403)=20
           &nb= sp;           &nbs= p;    ->  Seq=20 Scan on nieuw_gegevens s  (cost=3D0.00..10.05 rows=3D45 = width=3D4) (actual=20 time=3D0.308..0.658 rows=3D2 loops=3D403)=20
           &nb= sp;           &nbs= p;          Filter:=20 (($0 > lft) AND ($0 < rgt))=20
        ->  Sort=   (cost=3D25.47..26.48=20 rows=3D403 width=3D149) (actual time=3D0.000..0.000 rows=3D770 = loops=3D1)=20
           &nb= sp;  Sort=20 Key: b.lft=20
           &nb= sp;  ->  Seq=20 Scan on nieuw_gegevens b  (cost=3D0.00..8.03 rows=3D403 = width=3D149) (actual=20 time=3D0.000..0.000 rows=3D403 loops=3D1)
Total runtime: 281.000 ms =

15=20 row(s)

Total runtime: 287.273 ms 


As you can see = the=20 query isn't useful anymore because of the processtime. Please = Also=20 notice that both systems use a different query plan.  
Also on the webhost we have a loop of 162409 (403 rows * 403 = rows).
Both systems also use a different postgresql version. But I cannot = believe=20 that the performance difference between 1 version could be this big = regarding=20 self outer join queries!

Table

CREATE TABLE = nieuw_gegevens
(=20
  gegevensid int4 NOT NULL DEFAULT=20 nextval('nieuw_gegevens_gegevensid_seq'::text), =
  gegevensnaam=20 varchar(255) NOT NULL,
  lft int4 NOT NULL, =
  rgt=20 int4 NOT NULL,
  keyword text,
  CONSTRAINT=20 nieuw_gegevens_pkey PRIMARY KEY (gegevensid),
  CONSTRAINT = nieuw_gegevens_gegevensnaam_key UNIQUE (gegevensnaam)
)
WITH = OIDS;=20


Does anyone now how to resolve this problem? Could it be = that the=20 configuration of the webhost postgresql could me wrong?
 
thank = you
------=_NextPart_000_001B_01C6441A.45329860-- From pgsql-performance-owner@postgresql.org Fri Mar 10 04:59:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7E4B69DCA84 for ; Fri, 10 Mar 2006 04:59: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 18183-03 for ; Fri, 10 Mar 2006 04:59: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 493109DC9AC for ; Fri, 10 Mar 2006 04:59: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 k2A8xiJ7090100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Mar 2006 01:59:48 -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 k2A8xi34008986; Fri, 10 Mar 2006 01:59:44 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k2A8xiAe008985; Fri, 10 Mar 2006 01:59:44 -0700 (MST) (envelope-from mfuhr) Date: Fri, 10 Mar 2006 01:59:43 -0700 From: Michael Fuhr To: NbForYou Cc: pgsql-performance@postgresql.org Subject: Re: Process Time X200 Message-ID: <20060310085943.GA8913@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.121 required=5 tests=[AWL=0.121] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200603/107 X-Sequence-Number: 17544 On Fri, Mar 10, 2006 at 08:11:44AM +0100, NbForYou wrote: > As you can see the query isn't useful anymore because of the > processtime. Please Also notice that both systems use a different > query plan. > Also on the webhost we have a loop of 162409 (403 rows * 403 rows). > Both systems also use a different postgresql version. But I cannot > believe that the performance difference between 1 version could be > this big regarding self outer join queries! What versions are both servers? I'd guess that the webhost is using 7.3 or earlier and you're using 7.4 or later. I created a table like yours, populated it with test data, and ran your query on several versions of PostgreSQL. I saw the same horrible plan on 7.3 and the same good plan on later versions. The 7.4 Release Notes do mention improvements in query planning; apparently one of those improvements is making the difference. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Fri Mar 10 05:11:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6BC1E9DC9CB for ; Fri, 10 Mar 2006 05:11: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 18266-06 for ; Fri, 10 Mar 2006 05:11:07 -0400 (AST) X-Greylist: delayed 01:59:14.968539 by SQLgrey- Received: from hotmail.com (bay107-dav4.bay107.hotmail.com [64.4.51.76]) by postgresql.org (Postfix) with ESMTP id 0B5FE9DCC78 for ; Fri, 10 Mar 2006 05:11:03 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 10 Mar 2006 01:11:05 -0800 Message-ID: Received: from 84.193.85.191 by BAY107-DAV4.phx.gbl with DAV; Fri, 10 Mar 2006 09:11:01 +0000 X-Originating-IP: [84.193.85.191] X-Originating-Email: [nbforyou@hotmail.com] X-Sender: nbforyou@hotmail.com From: "NbForYou" To: "Michael Fuhr" Cc: References: <20060310085943.GA8913@winnie.fuhr.org> Subject: Re: Process Time X200 Date: Fri, 10 Mar 2006 10:11:00 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 10 Mar 2006 09:11:05.0496 (UTC) FILETIME=[8F928980:01C64422] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.679 required=5 tests=[AWL=-0.239, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.679 X-Spam-Level: * X-Archive-Number: 200603/108 X-Sequence-Number: 17545 Hey Michael, you sure know your stuff! Versions: PostgreSQL 7.3.9-RH running on the webhost. PostgreSQL 8.0.3 running on my homeserver. So the only solution is to ask my webhost to upgrade its postgresql? The question is will he do that? After all a license fee is required for commercial use. And running a webhosting service is a commercial use. thanks for replying and going through the effort of creating the database and populating it. Nick ----- Original Message ----- From: "Michael Fuhr" To: "NbForYou" Cc: Sent: Friday, March 10, 2006 9:59 AM Subject: Re: [PERFORM] Process Time X200 > On Fri, Mar 10, 2006 at 08:11:44AM +0100, NbForYou wrote: >> As you can see the query isn't useful anymore because of the >> processtime. Please Also notice that both systems use a different >> query plan. >> Also on the webhost we have a loop of 162409 (403 rows * 403 rows). >> Both systems also use a different postgresql version. But I cannot >> believe that the performance difference between 1 version could be >> this big regarding self outer join queries! > > What versions are both servers? I'd guess that the webhost is using > 7.3 or earlier and you're using 7.4 or later. I created a table > like yours, populated it with test data, and ran your query on > several versions of PostgreSQL. I saw the same horrible plan on > 7.3 and the same good plan on later versions. The 7.4 Release Notes > do mention improvements in query planning; apparently one of those > improvements is making the difference. > > -- > Michael Fuhr > > ---------------------------(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 Mar 10 05:20:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E03859DC9AC for ; Fri, 10 Mar 2006 05:20: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 20321-05 for ; Fri, 10 Mar 2006 05:20:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by postgresql.org (Postfix) with ESMTP id 868709DC99A for ; Fri, 10 Mar 2006 05:20:14 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id C01D68F285; Fri, 10 Mar 2006 10:20:15 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 10:20:15 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA35104@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hanging queries on dual CPU windows Thread-Index: AcZD5oUoSULVTQQFQWyoK26aQCkvXQAPJAbg From: "Magnus Hagander" To: "Jan de Visser" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/109 X-Sequence-Number: 17546 > > Is it possible to get a stack trace from the stuck process?=20 > =A0I dunno=20 > > if you've got anything gdb-equivalent under Windows, but that's the=20 > > first thing I'd be interested in ... >=20 > Here ya go: >=20 > http://www.devisser-siderius.com/stack1.jpg > http://www.devisser-siderius.com/stack2.jpg > http://www.devisser-siderius.com/stack3.jpg >=20 > There are three threads in the process. I guess thread 1=20 > (stack1.jpg) is the most interesting. >=20 > I also noted that cranking up concurrency in my app=20 > reproduces the problem in about 4 minutes ;-) Actually, stack2 looks very interesting. Does it "stay stuck" in = pg_queue_signal? That's really not supposed to happen. Also, can you confirm that stack1 actually *stops* in = pgwin32_waitforsinglesocket? Or does it go out and come back? ;-) (A good signal of this is to check the cswitch delta. If it stays at = zero, then it's stuck. If it shows any values, that means it's actuall = going out and coming back) And finally, is this 8.0 or 8.1? There have been some significant = changes in the handling of the signals between the two... //Magnus From pgsql-performance-owner@postgresql.org Fri Mar 10 05:23:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DA6409DC821 for ; Fri, 10 Mar 2006 05:23: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 21301-07 for ; Fri, 10 Mar 2006 05:23:41 -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 1D6779DCA84 for ; Fri, 10 Mar 2006 05:23:32 -0400 (AST) Received: from [192.168.0.5] (84.60.147.231) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.7) for ; Fri, 10 Mar 2006 10:23:33 +0100 In-Reply-To: References: <20060310085943.GA8913@winnie.fuhr.org> Mime-Version: 1.0 (Apple Message framework v746.2) X-Priority: 3 Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-1-466656002; protocol="application/pkcs7-signature" Message-Id: <5A24FFF8-56D8-44F1-8CBB-611AAE61EBAE@pharmaline.de> From: Guido Neitzer Subject: Re: Process Time X200 Date: Fri, 10 Mar 2006 10:23:32 +0100 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.194 required=5 tests=[AWL=0.194] X-Spam-Score: 0.194 X-Spam-Level: X-Archive-Number: 200603/110 X-Sequence-Number: 17547 --Apple-Mail-1-466656002 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 10.03.2006, at 10:11 Uhr, NbForYou wrote: > So the only solution is to ask my webhost to upgrade its postgresql? Seems to be. > The question is will he do that? You are the customer. If they don't, go to another provider. > After all a license fee is required for > commercial use. And running a webhosting service is a commercial use. No license fee is required for any use of PostgreSQL. Read the license: "Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies." A commercial license is needed for MySQL, not for PostgreSQL. cug -- PharmaLine, Essen, GERMANY Software and Database Development --Apple-Mail-1-466656002 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGNzCCAvAw ggJZoAMCAQICEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MDIxMTE3NDM1NFoXDTA3MDIxMTE3NDM1 NFowTTEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEqMCgGCSqGSIb3DQEJARYbZ3Vp ZG8ubmVpdHplckBwaGFybWFsaW5lLmRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA yLhNUnNv30/r+pFUHocoIWGm8AAwFbwAWqFRhEwZzxLPCMSZme3G7W/5hyK+SxeQoOK8PPCsNyvy sLBqUVHB3nm5w/NzZKk1gfc2QlzjPtv2C7bUnigDJs+X0YlgdxTxs68RdHBn/rbjjaxl+SkiEcsz kZhKsAnS6zhlWSX7zDCIRR5VD08M0/fYSTwEcX1j8lWb/3McY7bCcHbLd+762QQAn03A4cPco4OK 3KAMld0n6qFFMG23IKx7qDTonYtCzsDVspQ1Fk14yJYVdf62RLWGBJPF+RMXB9juFhgdUrHZY3mo wamFF3qZ8HD9wb+G7lhL8F+d5khDuLBYFXCqdQIDAQABozgwNjAmBgNVHREEHzAdgRtndWlkby5u ZWl0emVyQHBoYXJtYWxpbmUuZGUwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQCFnjZk bGIY3sGlsEIn98cV+tX9xNTThIwN6jhu7mGuxzvX+hN86kdlhEgaPmaatH8KfXXyfnhpTK3KOk8O zDsxJqQDVe1HEW8M/4MkORMlydbcxSRPL967pgMRNjAMafL/IlssFJ3kF7q/2AjRd4VhnyoA3Yl/ sXF3WLOTJB5OzjCCAz8wggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpB MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhh d3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24x JDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVy c29uYWwtZnJlZW1haWxAdGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTla MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSww KgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0B AQEFAAOBjQAwgYkCgYEAxKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B 1OVQCjDXAmNaLIkVcI7dyfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk 16emu59l0cUqVIUPSAR/p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/ AgEAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25h bEZyZWVtYWlsQ0EuY3JsMAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJp dmF0ZUxhYmVsMi0xMzgwDQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOW lJ1/TCG4+DYfqi2fNi/A9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amc OY6MIE9lX5Xa9/eH1sYITq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8xggMQMIIDDAIB ATB2MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQu MSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQHu2nEIcbtVh7 Lds/867h7zAJBgUrDgMCGgUAoIIBbzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3 DQEJBTEPFw0wNjAzMTAwOTIzMzNaMCMGCSqGSIb3DQEJBDEWBBTUbqgo+IkDN55AvrUrA1MHoksN xzCBhQYJKwYBBAGCNxAEMXgwdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1 bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3Vp bmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcN AQEBBQAEggEArT+aSYHOYW5MMqFQAH54McReczcbc6yw9HegReF9MUYXEDsAU0jIgjey2Ywc24rQ E9f2feox9w7t2KX516czqQ8KaSwfX10rWQY1mDCoOkZfMrxKPYoXOsDey6Lzh1sr5TDJX5LXKyGC RRSSBgC42TkP4Vh/erXeML4Mfw5+mPeh6pbHQgDdBpTIA4lv72vlSZydGWlPN4b4UaaUiW4uGQgW 0VV//krKLAKhy88T9yxPCpMbOIXpmZYXKMbEoUko4fr0h3Ee3X0FQzMaWSxGjcAeZbayJbbVxn1Q YXiqbRcQvovBEqAjWurrZxBFWXcBJRCdmBEmHoN3Z5dUIGJ3uAAAAAAAAA== --Apple-Mail-1-466656002-- From pgsql-performance-owner@postgresql.org Fri Mar 10 05:33:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9E4149DCAAD for ; Fri, 10 Mar 2006 05:33: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 21538-09 for ; Fri, 10 Mar 2006 05:33:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.hive.is (scania.ipf.is [85.197.192.147]) by postgresql.org (Postfix) with SMTP id 466599DC80E for ; Fri, 10 Mar 2006 05:33:01 -0400 (AST) Received: (qmail 76207 invoked by uid 1009); 10 Mar 2006 09:32:55 -0000 Received: from dsl-216-186.hive.is (HELO ?192.168.1.34?) (85.197.216.186) by mx1.hive.is with SMTP; 10 Mar 2006 09:32:55 -0000 Subject: Re: Process Time X200 From: Ragnar To: NbForYou Cc: Michael Fuhr , pgsql-performance@postgresql.org In-Reply-To: References: <20060310085943.GA8913@winnie.fuhr.org> Content-Type: text/plain; charset=ISO-8859-1 Date: Fri, 10 Mar 2006 09:35:15 +0000 Message-Id: <1141983315.18656.180.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 8bit 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: 200603/111 X-Sequence-Number: 17548 On f�s, 2006-03-10 at 10:11 +0100, NbForYou wrote: > Hey Michael, you sure know your stuff! > > Versions: > > PostgreSQL 7.3.9-RH running on the webhost. > PostgreSQL 8.0.3 running on my homeserver. > > So the only solution is to ask my webhost to upgrade its postgresql? > The question is will he do that? After all a license fee is required for > commercial use. And running a webhosting service is a commercial use. A licence fee for what? Certainly not for postgresql. gnari From pgsql-performance-owner@postgresql.org Fri Mar 10 06:26:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B38709DCAAD for ; Fri, 10 Mar 2006 06:26: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 31229-08 for ; Fri, 10 Mar 2006 06:26:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.131]) by postgresql.org (Postfix) with ESMTP id AEB849DCA55 for ; Fri, 10 Mar 2006 06:26:30 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay04.plus.net with esmtp (Exim) id 1FHepK-0003v3-Ls; Fri, 10 Mar 2006 10:26:30 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id C2E544102AF; Fri, 10 Mar 2006 09:40: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 59C20FF04; Fri, 10 Mar 2006 09:40:47 +0000 (GMT) Message-ID: <4411499F.4000005@archonet.com> Date: Fri, 10 Mar 2006 09:40:47 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: NbForYou Cc: Michael Fuhr , pgsql-performance@postgresql.org Subject: Re: Process Time X200 References: <20060310085943.GA8913@winnie.fuhr.org> 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.121 required=5 tests=[AWL=0.121] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200603/115 X-Sequence-Number: 17552 NbForYou wrote: > Hey Michael, you sure know your stuff! > > Versions: > > PostgreSQL 7.3.9-RH running on the webhost. > PostgreSQL 8.0.3 running on my homeserver. > > So the only solution is to ask my webhost to upgrade its postgresql? > The question is will he do that? After all a license fee is required for > commercial use. And running a webhosting service is a commercial use. No, you're thinking of MySQL - PostgreSQL is free for anyone, for any purpose. You can even distribute your own changes without giving them back to the community if you want to complicate your life. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Mar 10 05:50:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BFA479DC821 for ; Fri, 10 Mar 2006 05:50: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 24290-09 for ; Fri, 10 Mar 2006 05:50:25 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id E104B9DC816 for ; Fri, 10 Mar 2006 05:50:21 -0400 (AST) Received: from michael.eatserver.nl (michael.eatserver.nl [212.203.14.103]) by svr4.postgresql.org (Postfix) with ESMTP id 1224B5AF09C for ; Fri, 10 Mar 2006 09:50:23 +0000 (GMT) Received: from dvipc (82-170-251-187.dsl.ip.tiscali.nl [82.170.251.187]) (authenticated bits=0) by michael.eatserver.nl (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id k2A9oCNd002355; Fri, 10 Mar 2006 10:50:13 +0100 From: "H.J. Sanders" To: Subject: x206-x225 Date: Fri, 10 Mar 2006 10:50:20 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01C64430.6D0A2C20" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new 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: 200603/112 X-Sequence-Number: 17549 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C64430.6D0A2C20 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0001_01C64430.6D0A2C20" ------=_NextPart_001_0001_01C64430.6D0A2C20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello list. We have compared 2 IBM x servers: IBM X206 IBM X226 ---------------------- ------------------- processor Pentium 4 3.2 Ghz Xeon 3.0 Ghz main memory 1.25 GB 4 GB discs 2 x SCSI RAID1 10000RPM 1 x ATA 7200 RPM LINUX 2.6 (SUSE 9) same PGSQL 7.4 same postgresql.conf attached same We have bij means of an informix-4GL program done the following test: create table : name char(18) adres char(20) key integer create index on (key) Time at X206 Time at X226 ---------------- ---- ------------------ insert record (key goes from 1 to 10000) 6 sec. 41 sec. select record (key goes from 1 to 10000) 4 4 delete record (key goes from 1 to 10000) 6 41 This is ofcourse a totally unexpected results (you should think off the opposite). Funny is that the select time is the same for both machines. Does anybody has any any idea what can cause this strange results or where we can start our investigations? Regards Henk Sanders ------=_NextPart_001_0001_01C64430.6D0A2C20 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello = list.
 
We have compared 2 = IBM x=20 servers:
 
       &nbs= p;            = ;           =20 IBM=20 X206           &nb= sp;           &nbs= p;            = ;  =20 IBM X226
          &nbs= p;            = ;            = =20 ----------------------        &nb= sp;           &nbs= p;      =20 -------------------
processor         &= nbsp;           &n= bsp; =20 Pentium 4 3.2=20 Ghz           &nbs= p;            = ;   =20 Xeon 3.0 Ghz   
main=20 memory           &= nbsp;       =20 1.25=20 GB            = ;            =             &= nbsp;  =20 4 GB       
discs          = ;            =        =20 2 x SCSI=20 RAID1  10000RPM        =      =20 1 x ATA 7200 RPM
 
LINUX          = ;            =      =20 2.6 (SUSE=20 9)            = ;            =            =20 same
PGSQL          = ;            =      =20 7.4           &nbs= p;            = ;            =             &= nbsp; same
postgresql.conf        &= nbsp;     =20 attached           = ;            =             &= nbsp;       =20 same
 
 
We have bij means = of an=20 informix-4GL program done the following test:
 
 
create table  = : name=20 char(18)
       &nbs= p;       =20 adres char(20)
       &nbs= p;       =20 key    integer
 
create index on=20 (key)
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           =20 Time at = X206           =20 Time at X226
       &nbs= p;            = ;            =             &= nbsp;           &n= bsp;  =20 --------------------       =20 ------------------
 
insert record (key = goes from 1=20 to=20 10000)           &= nbsp; 6=20 sec.           &nb= sp;           =20 41 sec.
select record (key = goes from 1=20 to = 10000)            = 4            =             &= nbsp;       =20 4
delete record (key = goes from 1=20 to = 10000)            = 6            =             &= nbsp;      =20 41
 
 
This is ofcourse a = totally=20 unexpected results (you should think off the = opposite).
 
Funny is that the = select time=20 is the same for both machines.
 
Does anybody has = any any idea=20 what can cause this strange results or where we
can start our=20 investigations?
 
 
Regards
 
 
Henk=20 Sanders
 
 
 
 
 

------=_NextPart_001_0001_01C64430.6D0A2C20-- ------=_NextPart_000_0000_01C64430.6D0A2C20 Content-Type: application/octet-stream; name="postgresql.conf-74" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="postgresql.conf-74" # -----------------------------=0A= # PostgreSQL configuration file=0A= # -----------------------------=0A= #=0A= # This file consists of lines of the form:=0A= #=0A= # name =3D value=0A= #=0A= # (The '=3D' is optional.) White space may be used. Comments are = introduced=0A= # with '#' anywhere on a line. The complete list of option names and=0A= # allowed values can be found in the PostgreSQL documentation. The=0A= # commented-out settings shown in this file represent the default values.=0A= #=0A= # Any option can also be given as a command line switch to the=0A= # postmaster, e.g. 'postmaster -c log_connections=3Don'. Some options=0A= # can be changed at run-time with the 'SET' SQL command.=0A= #=0A= # This file is read on postmaster startup and when the postmaster=0A= # receives a SIGHUP. If you edit the file on a running system, you have =0A= # to SIGHUP the postmaster for the changes to take effect, or use =0A= # "pg_ctl reload".=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # CONNECTIONS AND AUTHENTICATION=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Connection Settings -=0A= =0A= #tcpip_socket =3D false=0A= max_connections =3D 100=0A= # note: increasing max_connections costs about 500 bytes of shared=0A= # memory per connection slot, in addition to costs from shared_buffers=0A= # and max_locks_per_transaction.=0A= #superuser_reserved_connections =3D 2=0A= #port =3D 5432=0A= #unix_socket_directory =3D ''=0A= #unix_socket_group =3D ''=0A= #unix_socket_permissions =3D 0777 # octal=0A= #virtual_host =3D '' # what interface to listen on; defaults to any=0A= #rendezvous_name =3D '' # defaults to the computer name=0A= =0A= # - Security & Authentication -=0A= =0A= #authentication_timeout =3D 60 # 1-600, in seconds=0A= #ssl =3D false=0A= #password_encryption =3D true=0A= #krb_server_keyfile =3D ''=0A= #db_user_namespace =3D false=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # RESOURCE USAGE (except WAL)=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Memory -=0A= =0A= #dvi=0A= shared_buffers =3D 12000 # min 16, at least max_connections*2, 8KB each=0A= sort_mem =3D 10240 # min 64, size in KB was 1024=0A= #vacuum_mem =3D 8192 # min 1024, size in KB=0A= =0A= # - Free Space Map -=0A= =0A= #max_fsm_pages =3D 20000 # min max_fsm_relations*16, 6 bytes each=0A= #max_fsm_relations =3D 1000 # min 100, ~50 bytes each=0A= max_fsm_relations =3D 500 # min 100, ~50 bytes each=0A= =0A= # - Kernel Resource Usage -=0A= =0A= #max_files_per_process =3D 1000 # min 25=0A= #preload_libraries =3D ''=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # WRITE AHEAD LOG=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Settings -=0A= =0A= #fsync =3D true # turns forced synchronization on or off=0A= #wal_sync_method =3D fsync # the default varies across platforms:=0A= # fsync, fdatasync, open_sync, or open_datasync=0A= #wal_buffers =3D 8 # min 4, 8KB each=0A= wal_buffers =3D 64 # min 4, 8KB each=0A= =0A= # - Checkpoints -=0A= =0A= #dvi checkpoint_segments =3D 3 # in logfile segments, min 1, 16MB each=0A= checkpoint_segments =3D 30 # in logfile segments, min 1, 16MB each=0A= =0A= #checkpoint_timeout =3D 300 # range 30-3600, in seconds=0A= #checkpoint_warning =3D 30 # 0 is off, in seconds=0A= #commit_delay =3D 0 # range 0-100000, in microseconds=0A= #commit_siblings =3D 5 # range 1-1000=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # QUERY TUNING=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Planner Method Enabling -=0A= =0A= #enable_hashagg =3D true=0A= #enable_hashjoin =3D true=0A= #enable_indexscan =3D true=0A= #enable_mergejoin =3D true=0A= #enable_nestloop =3D true=0A= #enable_seqscan =3D true=0A= #enable_sort =3D true=0A= #enable_tidscan =3D true=0A= =0A= # - Planner Cost Constants -=0A= =0A= #effective_cache_size =3D 1000 # typically 8KB each=0A= #random_page_cost =3D 4 # units are one sequential page fetch cost=0A= #cpu_tuple_cost =3D 0.01 # (same)=0A= #cpu_index_tuple_cost =3D 0.001 # (same)=0A= #cpu_operator_cost =3D 0.0025 # (same)=0A= =0A= # - Genetic Query Optimizer -=0A= =0A= #geqo =3D true=0A= geqo =3D false=0A= #geqo_threshold =3D 11=0A= #geqo_effort =3D 1=0A= #geqo_generations =3D 0=0A= #geqo_pool_size =3D 0 # default based on tables in statement,=0A= # range 128-1024=0A= #geqo_selection_bias =3D 2.0 # range 1.5-2.0=0A= =0A= # - Other Planner Options -=0A= =0A= #default_statistics_target =3D 10 # range 1-1000=0A= #from_collapse_limit =3D 8=0A= #join_collapse_limit =3D 8 # 1 disables collapsing of explicit JOINs=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # ERROR REPORTING AND LOGGING=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Syslog -=0A= =0A= #syslog =3D 0 # range 0-2; 0=3Dstdout; 1=3Dboth; 2=3Dsyslog=0A= #syslog_facility =3D 'LOCAL0'=0A= #syslog_ident =3D 'postgres'=0A= =0A= # - When to Log -=0A= =0A= #client_min_messages =3D notice # Values, in order of decreasing detail:=0A= # debug5, debug4, debug3, debug2, debug1,=0A= # log, info, notice, warning, error=0A= =0A= #log_min_messages =3D notice # Values, in order of decreasing detail:=0A= # debug5, debug4, debug3, debug2, debug1,=0A= # info, notice, warning, error, log, fatal,=0A= # panic=0A= =0A= #log_error_verbosity =3D default # terse, default, or verbose messages=0A= =0A= #log_min_error_statement =3D panic # Values in order of increasing = severity:=0A= # debug5, debug4, debug3, debug2, debug1,=0A= # info, notice, warning, error, panic(off)=0A= =0A= #log_min_duration_statement =3D -1 # Log all statements whose=0A= # execution time exceeds the value, in=0A= # milliseconds. Zero prints all queries.=0A= # Minus-one disables.=0A= =0A= #silent_mode =3D false # DO NOT USE without Syslog!=0A= =0A= # - What to Log -=0A= =0A= #debug_print_parse =3D false=0A= #debug_print_rewritten =3D false=0A= #debug_print_plan =3D false=0A= #debug_pretty_print =3D false=0A= #log_connections =3D false=0A= #log_duration =3D false=0A= #log_pid =3D false=0A= #log_statement =3D false=0A= log_timestamp =3D true=0A= #log_hostname =3D false=0A= #log_source_port =3D false=0A= #dvi=0A= log_statement =3D true=0A= #debug_print_plan =3D true=0A= #log_duration =3D true=0A= log_min_duration_statement =3D 2000=0A= =0A= #------------------------------------------------------------------------= ---=0A= # RUNTIME STATISTICS=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Statistics Monitoring -=0A= =0A= #log_parser_stats =3D false=0A= #log_planner_stats =3D false=0A= #log_executor_stats =3D false=0A= #log_statement_stats =3D false=0A= =0A= # - Query/Index Statistics Collector -=0A= =0A= #stats_start_collector =3D true=0A= #stats_command_string =3D false=0A= #stats_block_level =3D false=0A= #stats_row_level =3D false=0A= #stats_reset_on_server_start =3D true=0A= =0A= =0A= #dvi=0A= stats_start_collector =3D true=0A= stats_command_string =3D true=0A= stats_block_level =3D true=0A= stats_row_level =3D true=0A= #------------------------------------------------------------------------= ---=0A= # CLIENT CONNECTION DEFAULTS=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Statement Behavior -=0A= =0A= #search_path =3D '$user,public' # schema names=0A= #check_function_bodies =3D true=0A= #default_transaction_isolation =3D 'read committed'=0A= #default_transaction_read_only =3D false=0A= #statement_timeout =3D 0 # 0 is disabled, in milliseconds=0A= =0A= # - Locale and Formatting -=0A= =0A= datestyle =3D 'european'=0A= #datestyle =3D 'iso, mdy'=0A= #timezone =3D unknown # actually, defaults to TZ environment setting=0A= #australian_timezones =3D false=0A= #extra_float_digits =3D 0 # min -15, max 2=0A= #client_encoding =3D sql_ascii # actually, defaults to database encoding=0A= =0A= # These settings are initialized by initdb -- they may be changed=0A= lc_messages =3D 'en_US.UTF-8' # locale for system error message strings=0A= lc_monetary =3D 'en_US.UTF-8' # locale for monetary formatting=0A= lc_numeric =3D 'en_US.UTF-8' # locale for number formatting=0A= lc_time =3D 'en_US.UTF-8' # locale for time formatting=0A= =0A= # - Other Defaults -=0A= =0A= #explain_pretty_print =3D true=0A= #dynamic_library_path =3D '$libdir'=0A= #max_expr_depth =3D 10000 # min 10=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # LOCK MANAGEMENT=0A= #------------------------------------------------------------------------= ---=0A= =0A= #deadlock_timeout =3D 1000 # in milliseconds=0A= #max_locks_per_transaction =3D 64 # min 10, ~260*max_connections bytes = each=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # VERSION/PLATFORM COMPATIBILITY=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Previous Postgres Versions -=0A= =0A= #add_missing_from =3D true=0A= #regex_flavor =3D advanced # advanced, extended, or basic=0A= #sql_inheritance =3D true=0A= =0A= # - Other Platforms & Clients -=0A= =0A= #transform_null_equals =3D false=0A= ------=_NextPart_000_0000_01C64430.6D0A2C20-- From pgsql-performance-owner@postgresql.org Fri Mar 10 05:59:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CB8949DC9E1 for ; Fri, 10 Mar 2006 05:59: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 26915-07 for ; Fri, 10 Mar 2006 05:59:42 -0400 (AST) X-Greylist: delayed 00:09:21.142465 by SQLgrey- Received: from michael.eatserver.nl (michael.eatserver.nl [212.203.14.103]) by postgresql.org (Postfix) with ESMTP id B0D589DC99A for ; Fri, 10 Mar 2006 05:59:37 -0400 (AST) Received: from dvipc (82-170-251-187.dsl.ip.tiscali.nl [82.170.251.187]) (authenticated bits=0) by michael.eatserver.nl (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id k2A9xcNd005644 for ; Fri, 10 Mar 2006 10:59:39 +0100 From: "H.J. Sanders" To: Subject: FW: x206-x226 Date: Fri, 10 Mar 2006 10:59:46 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_000D_01C64431.BE7B5D80" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.097 required=5 tests=[AWL=0.096, HTML_MESSAGE=0.001] X-Spam-Score: 0.097 X-Spam-Level: X-Archive-Number: 200603/113 X-Sequence-Number: 17550 This is a multi-part message in MIME format. ------=_NextPart_000_000D_01C64431.BE7B5D80 Content-Type: multipart/alternative; boundary="----=_NextPart_001_000E_01C64431.BE7B5D80" ------=_NextPart_001_000E_01C64431.BE7B5D80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello list. Reading my own e-mail I notice I made a very important mistake. The X206 has 1 x ATA 7200 RPM The X226 has 2 x SCSI RAID1 10000RPM I corrected it below. Sorry . Henk Sanders -----Oorspronkelijk bericht----- Van: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]Namens H.J. Sanders Verzonden: vrijdag 10 maart 2006 10:50 Aan: pgsql-performance@postgresql.org Onderwerp: [PERFORM] x206-x225 Hello list. We have compared 2 IBM x servers: IBM X206 IBM X226 ---------------------- ------------------- processor Pentium 4 3.2 Ghz Xeon 3.0 Ghz main memory 1.25 GB 4 GB discs 1 x ATA 7200 RPM 2 x SCSI RAID1 10000RPM LINUX 2.6 (SUSE 9) same PGSQL 7.4 same postgresql.conf attached same We have bij means of an informix-4GL program done the following test: create table : name char(18) adres char(20) key integer create index on (key) Ti me at X206 Time at X226 -------------- ------ ------------------ insert record (key goes from 1 to 10000) 6 sec. 41 sec. select record (key goes from 1 to 10000) 4 4 delete record (key goes from 1 to 10000) 6 41 This is ofcourse a totally unexpected results (you should think off the opposite). Funny is that the select time is the same for both machines. Does anybody has any any idea what can cause this strange results or where we can start our investigations? Regards Henk Sanders ------=_NextPart_001_000E_01C64431.BE7B5D80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello = list.
 
Reading my=20 own e-mail I notice I made a very important = mistake.
 
The=20 X206  has  1 x ATA 7200 RPM
The X226=20 has  2 x SCSI=20 RAID1  10000RPM    
 
I corrected=20 it below.
 
Sorry=20 .
 
 
Henk=20 Sanders
 
       &nbs= p; =20
 -----Oorspronkelijk=20 bericht-----
Van: pgsql-performance-owner@postgresql.org=20 [mailto:pgsql-performance-owner@postgresql.org]Namens H.J.=20 Sanders
Verzonden: vrijdag 10 maart 2006 10:50
Aan:=20 pgsql-performance@postgresql.org
Onderwerp: [PERFORM]=20 x206-x225

Hello=20 list.
 
We have compared = 2 IBM x=20 servers:
 
       &nbs= p;            = ;           =20 IBM=20 = X206           &nb= sp;           &nbs= p;            = ;  =20 IBM X226
          &nbs= p;            = ;            = =20 = ----------------------        &nb= sp;           &nbs= p;      =20 -------------------
processor         &= nbsp;           &n= bsp; =20 Pentium 4 3.2=20 = Ghz           &nbs= p;            = ;   =20 Xeon 3.0 Ghz   
main=20 = memory           &= nbsp;       =20 1.25=20 = GB            = ;            =             &= nbsp;  =20 4 GB       
discs          = ;            =         =20 1 x ATA 7200 RPM       &nbs= p;            = ;   =20  2 x SCSI=20 = RAID1  10000RPM        =      =20
 
LINUX          = ;            =      =20 2.6 (SUSE=20 = 9)            = ;            =            =20 same
PGSQL          = ;            =      =20 = 7.4           &nbs= p;            = ;            =             &= nbsp; same
postgresql.conf        &= nbsp;     =20 = attached           = ;            =             &= nbsp;       =20 same
 
 
We have bij means = of an=20 informix-4GL program done the following test:
 
 
create = table  : name=20 char(18)
       &nbs= p;       =20 adres char(20)
       &nbs= p;       =20 key    integer
 
create index on=20 (key)
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           =20 Time at = X206           =20 Time at X226
       &nbs= p;            = ;            =             &= nbsp;           &n= bsp;  =20 --------------------       =20 ------------------
 
insert record = (key goes from=20 1 to=20 = 10000)           &= nbsp;=20 6=20 = sec.           &nb= sp;           =20 41 sec.
select record = (key goes from=20 1 to = 10000)            = = 4            =             &= nbsp;       =20 4
delete record = (key goes from=20 1 to = 10000)            = = 6            =             &= nbsp;      =20 41
 
 
This is ofcourse = a totally=20 unexpected results (you should think off the = opposite).
 
Funny is that the = select time=20 is the same for both machines.
 
Does anybody has = any any idea=20 what can cause this strange results or where we
can start our=20 investigations?
 
 
Regards
 
 
Henk=20 Sanders
 
 
 
 
 

------=_NextPart_001_000E_01C64431.BE7B5D80-- ------=_NextPart_000_000D_01C64431.BE7B5D80 Content-Type: application/octet-stream; name="postgresql.conf-74" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="postgresql.conf-74" # -----------------------------=0A= # PostgreSQL configuration file=0A= # -----------------------------=0A= #=0A= # This file consists of lines of the form:=0A= #=0A= # name =3D value=0A= #=0A= # (The '=3D' is optional.) White space may be used. Comments are = introduced=0A= # with '#' anywhere on a line. The complete list of option names and=0A= # allowed values can be found in the PostgreSQL documentation. The=0A= # commented-out settings shown in this file represent the default values.=0A= #=0A= # Any option can also be given as a command line switch to the=0A= # postmaster, e.g. 'postmaster -c log_connections=3Don'. Some options=0A= # can be changed at run-time with the 'SET' SQL command.=0A= #=0A= # This file is read on postmaster startup and when the postmaster=0A= # receives a SIGHUP. If you edit the file on a running system, you have =0A= # to SIGHUP the postmaster for the changes to take effect, or use =0A= # "pg_ctl reload".=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # CONNECTIONS AND AUTHENTICATION=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Connection Settings -=0A= =0A= #tcpip_socket =3D false=0A= max_connections =3D 100=0A= # note: increasing max_connections costs about 500 bytes of shared=0A= # memory per connection slot, in addition to costs from shared_buffers=0A= # and max_locks_per_transaction.=0A= #superuser_reserved_connections =3D 2=0A= #port =3D 5432=0A= #unix_socket_directory =3D ''=0A= #unix_socket_group =3D ''=0A= #unix_socket_permissions =3D 0777 # octal=0A= #virtual_host =3D '' # what interface to listen on; defaults to any=0A= #rendezvous_name =3D '' # defaults to the computer name=0A= =0A= # - Security & Authentication -=0A= =0A= #authentication_timeout =3D 60 # 1-600, in seconds=0A= #ssl =3D false=0A= #password_encryption =3D true=0A= #krb_server_keyfile =3D ''=0A= #db_user_namespace =3D false=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # RESOURCE USAGE (except WAL)=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Memory -=0A= =0A= #dvi=0A= shared_buffers =3D 12000 # min 16, at least max_connections*2, 8KB each=0A= sort_mem =3D 10240 # min 64, size in KB was 1024=0A= #vacuum_mem =3D 8192 # min 1024, size in KB=0A= =0A= # - Free Space Map -=0A= =0A= #max_fsm_pages =3D 20000 # min max_fsm_relations*16, 6 bytes each=0A= #max_fsm_relations =3D 1000 # min 100, ~50 bytes each=0A= max_fsm_relations =3D 500 # min 100, ~50 bytes each=0A= =0A= # - Kernel Resource Usage -=0A= =0A= #max_files_per_process =3D 1000 # min 25=0A= #preload_libraries =3D ''=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # WRITE AHEAD LOG=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Settings -=0A= =0A= #fsync =3D true # turns forced synchronization on or off=0A= #wal_sync_method =3D fsync # the default varies across platforms:=0A= # fsync, fdatasync, open_sync, or open_datasync=0A= #wal_buffers =3D 8 # min 4, 8KB each=0A= wal_buffers =3D 64 # min 4, 8KB each=0A= =0A= # - Checkpoints -=0A= =0A= #dvi checkpoint_segments =3D 3 # in logfile segments, min 1, 16MB each=0A= checkpoint_segments =3D 30 # in logfile segments, min 1, 16MB each=0A= =0A= #checkpoint_timeout =3D 300 # range 30-3600, in seconds=0A= #checkpoint_warning =3D 30 # 0 is off, in seconds=0A= #commit_delay =3D 0 # range 0-100000, in microseconds=0A= #commit_siblings =3D 5 # range 1-1000=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # QUERY TUNING=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Planner Method Enabling -=0A= =0A= #enable_hashagg =3D true=0A= #enable_hashjoin =3D true=0A= #enable_indexscan =3D true=0A= #enable_mergejoin =3D true=0A= #enable_nestloop =3D true=0A= #enable_seqscan =3D true=0A= #enable_sort =3D true=0A= #enable_tidscan =3D true=0A= =0A= # - Planner Cost Constants -=0A= =0A= #effective_cache_size =3D 1000 # typically 8KB each=0A= #random_page_cost =3D 4 # units are one sequential page fetch cost=0A= #cpu_tuple_cost =3D 0.01 # (same)=0A= #cpu_index_tuple_cost =3D 0.001 # (same)=0A= #cpu_operator_cost =3D 0.0025 # (same)=0A= =0A= # - Genetic Query Optimizer -=0A= =0A= #geqo =3D true=0A= geqo =3D false=0A= #geqo_threshold =3D 11=0A= #geqo_effort =3D 1=0A= #geqo_generations =3D 0=0A= #geqo_pool_size =3D 0 # default based on tables in statement,=0A= # range 128-1024=0A= #geqo_selection_bias =3D 2.0 # range 1.5-2.0=0A= =0A= # - Other Planner Options -=0A= =0A= #default_statistics_target =3D 10 # range 1-1000=0A= #from_collapse_limit =3D 8=0A= #join_collapse_limit =3D 8 # 1 disables collapsing of explicit JOINs=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # ERROR REPORTING AND LOGGING=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Syslog -=0A= =0A= #syslog =3D 0 # range 0-2; 0=3Dstdout; 1=3Dboth; 2=3Dsyslog=0A= #syslog_facility =3D 'LOCAL0'=0A= #syslog_ident =3D 'postgres'=0A= =0A= # - When to Log -=0A= =0A= #client_min_messages =3D notice # Values, in order of decreasing detail:=0A= # debug5, debug4, debug3, debug2, debug1,=0A= # log, info, notice, warning, error=0A= =0A= #log_min_messages =3D notice # Values, in order of decreasing detail:=0A= # debug5, debug4, debug3, debug2, debug1,=0A= # info, notice, warning, error, log, fatal,=0A= # panic=0A= =0A= #log_error_verbosity =3D default # terse, default, or verbose messages=0A= =0A= #log_min_error_statement =3D panic # Values in order of increasing = severity:=0A= # debug5, debug4, debug3, debug2, debug1,=0A= # info, notice, warning, error, panic(off)=0A= =0A= #log_min_duration_statement =3D -1 # Log all statements whose=0A= # execution time exceeds the value, in=0A= # milliseconds. Zero prints all queries.=0A= # Minus-one disables.=0A= =0A= #silent_mode =3D false # DO NOT USE without Syslog!=0A= =0A= # - What to Log -=0A= =0A= #debug_print_parse =3D false=0A= #debug_print_rewritten =3D false=0A= #debug_print_plan =3D false=0A= #debug_pretty_print =3D false=0A= #log_connections =3D false=0A= #log_duration =3D false=0A= #log_pid =3D false=0A= #log_statement =3D false=0A= log_timestamp =3D true=0A= #log_hostname =3D false=0A= #log_source_port =3D false=0A= #dvi=0A= log_statement =3D true=0A= #debug_print_plan =3D true=0A= #log_duration =3D true=0A= log_min_duration_statement =3D 2000=0A= =0A= #------------------------------------------------------------------------= ---=0A= # RUNTIME STATISTICS=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Statistics Monitoring -=0A= =0A= #log_parser_stats =3D false=0A= #log_planner_stats =3D false=0A= #log_executor_stats =3D false=0A= #log_statement_stats =3D false=0A= =0A= # - Query/Index Statistics Collector -=0A= =0A= #stats_start_collector =3D true=0A= #stats_command_string =3D false=0A= #stats_block_level =3D false=0A= #stats_row_level =3D false=0A= #stats_reset_on_server_start =3D true=0A= =0A= =0A= #dvi=0A= stats_start_collector =3D true=0A= stats_command_string =3D true=0A= stats_block_level =3D true=0A= stats_row_level =3D true=0A= #------------------------------------------------------------------------= ---=0A= # CLIENT CONNECTION DEFAULTS=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Statement Behavior -=0A= =0A= #search_path =3D '$user,public' # schema names=0A= #check_function_bodies =3D true=0A= #default_transaction_isolation =3D 'read committed'=0A= #default_transaction_read_only =3D false=0A= #statement_timeout =3D 0 # 0 is disabled, in milliseconds=0A= =0A= # - Locale and Formatting -=0A= =0A= datestyle =3D 'european'=0A= #datestyle =3D 'iso, mdy'=0A= #timezone =3D unknown # actually, defaults to TZ environment setting=0A= #australian_timezones =3D false=0A= #extra_float_digits =3D 0 # min -15, max 2=0A= #client_encoding =3D sql_ascii # actually, defaults to database encoding=0A= =0A= # These settings are initialized by initdb -- they may be changed=0A= lc_messages =3D 'en_US.UTF-8' # locale for system error message strings=0A= lc_monetary =3D 'en_US.UTF-8' # locale for monetary formatting=0A= lc_numeric =3D 'en_US.UTF-8' # locale for number formatting=0A= lc_time =3D 'en_US.UTF-8' # locale for time formatting=0A= =0A= # - Other Defaults -=0A= =0A= #explain_pretty_print =3D true=0A= #dynamic_library_path =3D '$libdir'=0A= #max_expr_depth =3D 10000 # min 10=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # LOCK MANAGEMENT=0A= #------------------------------------------------------------------------= ---=0A= =0A= #deadlock_timeout =3D 1000 # in milliseconds=0A= #max_locks_per_transaction =3D 64 # min 10, ~260*max_connections bytes = each=0A= =0A= =0A= #------------------------------------------------------------------------= ---=0A= # VERSION/PLATFORM COMPATIBILITY=0A= #------------------------------------------------------------------------= ---=0A= =0A= # - Previous Postgres Versions -=0A= =0A= #add_missing_from =3D true=0A= #regex_flavor =3D advanced # advanced, extended, or basic=0A= #sql_inheritance =3D true=0A= =0A= # - Other Platforms & Clients -=0A= =0A= #transform_null_equals =3D false=0A= ------=_NextPart_000_000D_01C64431.BE7B5D80 Content-Type: text/plain; name="ATT00011.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ATT00011.txt" ---------------------------(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 ------=_NextPart_000_000D_01C64431.BE7B5D80-- From pgsql-performance-owner@postgresql.org Fri Mar 10 06:06:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CFC059DC97F for ; Fri, 10 Mar 2006 06:06: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 28756-07 for ; Fri, 10 Mar 2006 06:06:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id 47B2C9DC88C for ; Fri, 10 Mar 2006 06:06:16 -0400 (AST) Received: (qmail 7488 invoked by uid 514); 10 Mar 2006 11:02:46 +0100 Received: from 62.37.216.137 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.216.137):SA:0(-1.7/5.0):. Processed in 0.528997 secs); 10 Mar 2006 10:02:46 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.137):SA:0(-1.7/5.0):. Processed in 0.528997 secs Process 7476) Received: from 62-37-216-137.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.216.137) by mail.rentalia.net with SMTP; 10 Mar 2006 11:02:46 +0100 Message-ID: <44114F85.8020702@rentalia.com> Date: Fri, 10 Mar 2006 11:05:57 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Query time 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.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200603/114 X-Sequence-Number: 17551 Hi, I think im specting problems with a 7.4.8 postgres database. Sometimes some big query takes between 5 to 15 seconds. It happens sometimes all the day it does not depend if database is busy. I have measured that sentence in 15 - 70 ms in normal circunstances. Why sometimes its takes too much time? How can I fix it? Is a postgres version problem, database problem or query problem? Any ideas will be apreciatted. Ruben Rubio From pgsql-performance-owner@postgresql.org Fri Mar 10 06:30:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 17B279DC9E1 for ; Fri, 10 Mar 2006 06: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 32649-08 for ; Fri, 10 Mar 2006 06:30:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id 7469D9DC960 for ; Fri, 10 Mar 2006 06:30:16 -0400 (AST) Received: (qmail 14411 invoked by uid 514); 10 Mar 2006 11:26:46 +0100 Received: from 62.37.216.137 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.216.137):SA:0(-1.3/5.0):. Processed in 3.864244 secs); 10 Mar 2006 10:26:46 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.137):SA:0(-1.3/5.0):. Processed in 3.864244 secs Process 14397) Received: from 62-37-216-137.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.216.137) by mail.rentalia.net with SMTP; 10 Mar 2006 11:26:42 +0100 Message-ID: <44115521.1040805@rentalia.com> Date: Fri, 10 Mar 2006 11:29:53 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query time References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/116 X-Sequence-Number: 17553 There is not possibility to use another database. It's the best option I have seen. We have been working in postgres in last 3 years, and this is the first problem I have seen. (The database is working in a large website, 6.000 visits per day in a dedicated server) Any other idea? Chethana, Rao (IE10) wrote: >USUALLY POSTGRES DATABASE TAKES MORE TIME, COMPARED TO OTHER DATABASES. >HOWEVER U CAN FINETUNE THE PERFORMANCE OF POSTGRESQL. >IF U HAVE AN OPTION GO FOR SQLITE, MYSQL OR FIREBIRD. > >-----Original Message----- >From: pgsql-performance-owner@postgresql.org >[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Ruben Rubio >Rey >Sent: Friday, March 10, 2006 2:06 AM >To: pgsql-performance@postgresql.org >Subject: [PERFORM] Query time > >Hi, > >I think im specting problems with a 7.4.8 postgres database. > >Sometimes some big query takes between 5 to 15 seconds. It happens >sometimes all the day it does not depend if database is busy. > >I have measured that sentence in 15 - 70 ms in normal circunstances. > >Why sometimes its takes too much time? >How can I fix it? >Is a postgres version problem, database problem or query problem? > >Any ideas will be apreciatted. > >Ruben Rubio > > > >---------------------------(end of broadcast)--------------------------- >TIP 6: explain analyze is your friend > > > > From pgsql-performance-owner@postgresql.org Fri Mar 10 06:45:08 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DE33F9DCBD1 for ; Fri, 10 Mar 2006 06:45: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 36446-05 for ; Fri, 10 Mar 2006 06:45:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay107-dav7.bay107.hotmail.com [64.4.51.79]) by postgresql.org (Postfix) with ESMTP id 6AEB59DCA55 for ; Fri, 10 Mar 2006 06:45:05 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 10 Mar 2006 02:45:07 -0800 Message-ID: Received: from 84.193.85.191 by BAY107-DAV7.phx.gbl with DAV; Fri, 10 Mar 2006 10:45:07 +0000 X-Originating-IP: [84.193.85.191] X-Originating-Email: [nbforyou@hotmail.com] X-Sender: nbforyou@hotmail.com From: "NbForYou" To: References: <20060310085943.GA8913@winnie.fuhr.org> <4411499F.4000005@archonet.com> Subject: Re: Process Time X200 Date: Fri, 10 Mar 2006 11:45:06 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 10 Mar 2006 10:45:07.0888 (UTC) FILETIME=[B2B33B00:01C6442F] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.631 required=5 tests=[AWL=-0.288, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.631 X-Spam-Level: * X-Archive-Number: 200603/117 X-Sequence-Number: 17554 Ok, Everybody keeps saying that Postgresql is free... So I contacted my webhost and their respons was they have to pay a license fee. But because they use PLESK as a service I think they are refering to a fee PLESK charges them for the use combination PLESK - POSTGRESQL I do not know however that this information is accurate... I thank everybody who have responded so far. Great feedback! ----- Original Message ----- From: "Richard Huxton" To: "NbForYou" Cc: "Michael Fuhr" ; Sent: Friday, March 10, 2006 10:40 AM Subject: Re: [PERFORM] Process Time X200 > NbForYou wrote: >> Hey Michael, you sure know your stuff! >> >> Versions: >> >> PostgreSQL 7.3.9-RH running on the webhost. >> PostgreSQL 8.0.3 running on my homeserver. >> >> So the only solution is to ask my webhost to upgrade its postgresql? >> The question is will he do that? After all a license fee is required for >> commercial use. And running a webhosting service is a commercial use. > > No, you're thinking of MySQL - PostgreSQL is free for anyone, for any > purpose. You can even distribute your own changes without giving them back > to the community if you want to complicate your life. > > -- > 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 Fri Mar 10 06:48:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A69BC9DCAC2 for ; Fri, 10 Mar 2006 06:48: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 36037-07 for ; Fri, 10 Mar 2006 06:48:32 -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 4C6F39DCA55 for ; Fri, 10 Mar 2006 06:48:28 -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 k2AAmR6K090463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Mar 2006 03:48:29 -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 k2AAmROX014612; Fri, 10 Mar 2006 03:48:27 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k2AAmQA5014611; Fri, 10 Mar 2006 03:48:26 -0700 (MST) (envelope-from mfuhr) Date: Fri, 10 Mar 2006 03:48:26 -0700 From: Michael Fuhr To: Ruben Rubio Rey Cc: pgsql-performance@postgresql.org Subject: Re: Query time Message-ID: <20060310104826.GA14532@winnie.fuhr.org> References: <44114F85.8020702@rentalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44114F85.8020702@rentalia.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: 200603/118 X-Sequence-Number: 17555 On Fri, Mar 10, 2006 at 11:05:57AM +0100, Ruben Rubio Rey wrote: > Sometimes some big query takes between 5 to 15 seconds. It happens > sometimes all the day it does not depend if database is busy. > > I have measured that sentence in 15 - 70 ms in normal circunstances. Is it the *exact* same query, including the values you're querying for? The same query with different values can run with different plans depending on row count estimates. It might be useful to see the query string and the EXPLAIN ANALYZE output for a fast query and a slow one. How many tables are you querying? Might you be hitting geqo_threshold (default 12)? If so then the following thread might be helpful: http://archives.postgresql.org/pgsql-performance/2006-01/msg00132.php -- Michael Fuhr From pgsql-performance-owner@postgresql.org Fri Mar 10 07:38:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E16BF9DC821 for ; Fri, 10 Mar 2006 07: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 45354-04 for ; Fri, 10 Mar 2006 07:38:18 -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 2B9379DC83B for ; Fri, 10 Mar 2006 07:38:12 -0400 (AST) Received: (qmail 24227 invoked from network); 10 Mar 2006 12:38:56 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 10 Mar 2006 12:38:56 +0100 To: NbForYou , pgsql-performance@postgresql.org Subject: Re: Process Time X200 References: <20060310085943.GA8913@winnie.fuhr.org> <4411499F.4000005@archonet.com> Message-ID: Date: Fri, 10 Mar 2006 12:38:54 +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: User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/119 X-Sequence-Number: 17556 > Ok, Everybody keeps saying that Postgresql is free... > > So I contacted my webhost and their respons was they have to pay a > license fee. > > But because they use PLESK as a service I think they are refering to a > fee PLESK charges them > for the use combination PLESK - POSTGRESQL Probably. Although in my humble opinion, proposing postgres 7.3 in 2006 is a bit disrespectful to the considerable work that has been done by the postgres team since that release. If you don't find a host to your liking, and you have a large website, as you say, consider a dedicated server. Prices are quite accessible now, you can install the latest version of Postgres. Going from 7.3 to 8.1, and having your own server with all its resources dedicated to running your site, will probably enhance your performance. Consider lighttpd which is a speed demon and uses very little resources. From pgsql-performance-owner@postgresql.org Fri Mar 10 07:53:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D5F59DCBC1 for ; Fri, 10 Mar 2006 07:53: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 48230-07 for ; Fri, 10 Mar 2006 07:53:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id DE4599DC9DC for ; Fri, 10 Mar 2006 07:53:01 -0400 (AST) Received: (qmail 15192 invoked by uid 514); 10 Mar 2006 12:49:32 +0100 Received: from 62.37.216.137 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.216.137):SA:0(-2.0/5.0):. Processed in 1.862776 secs); 10 Mar 2006 11:49:32 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.137):SA:0(-2.0/5.0):. Processed in 1.862776 secs Process 15064) Received: from 62-37-216-137.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.216.137) by mail.rentalia.net with SMTP; 10 Mar 2006 12:49:30 +0100 Message-ID: <44116889.80804@rentalia.com> Date: Fri, 10 Mar 2006 12:52:41 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query time References: <44114F85.8020702@rentalia.com> <20060310104826.GA14532@winnie.fuhr.org> In-Reply-To: <20060310104826.GA14532@winnie.fuhr.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.103 required=5 tests=[AWL=0.103] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200603/120 X-Sequence-Number: 17557 Michael Fuhr wrote: >On Fri, Mar 10, 2006 at 11:05:57AM +0100, Ruben Rubio Rey wrote: > > >>Sometimes some big query takes between 5 to 15 seconds. It happens >>sometimes all the day it does not depend if database is busy. >> >>I have measured that sentence in 15 - 70 ms in normal circunstances. >> >> > >Is it the *exact* same query, including the values you're querying >for? The same query with different values can run with different >plans depending on row count estimates. It might be useful to see >the query string and the EXPLAIN ANALYZE output for a fast query >and a slow one. > >How many tables are you querying? Might you be hitting geqo_threshold >(default 12)? If so then the following thread might be helpful: > >http://archives.postgresql.org/pgsql-performance/2006-01/msg00132.php > > > The querys that are failing are very similar. But, when I see the warning in logs files, I take that query and try it, and takes a few miliseconds (as spected). That query one table on FROM and 2 or 3 on WHERE clause. Rigth now Im using the default server configuration for geqo_threshold, but i'll ckeck the link that u provide me. From pgsql-performance-owner@postgresql.org Fri Mar 10 10:16:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5135A9DC85F for ; Fri, 10 Mar 2006 10:16: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 72465-09 for ; Fri, 10 Mar 2006 10:16:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay05.plus.net (pih-relay05.plus.net [212.159.14.132]) by postgresql.org (Postfix) with ESMTP id 058359DC80E for ; Fri, 10 Mar 2006 10:16:01 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay05.plus.net with esmtp (Exim) id 1FHiPP-0005BE-Tt; Fri, 10 Mar 2006 14:15:59 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id B1B2C414B74; Fri, 10 Mar 2006 13:40:22 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 86683FF08; Fri, 10 Mar 2006 13:40:22 +0000 (GMT) Message-ID: <441181C6.3040401@archonet.com> Date: Fri, 10 Mar 2006 13:40:22 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: "H.J. Sanders" Cc: pgsql-performance@postgresql.org Subject: Re: x206-x225 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.121] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200603/122 X-Sequence-Number: 17559 H.J. Sanders wrote: > X206 IBM X226 > ---------------------- ------------------- > processor Pentium 4 3.2 > Ghz Xeon 3.0 Ghz > main memory 1.25 > GB 4 GB > discs 2 x SCSI RAID1 10000RPM > 1 x ATA 7200 RPM Noting that the SCSI discs are on the *slower* machine. > Time at X206 Time at X226 > -------------------- ------------------ > insert record (1 to 10000) 6 sec. 41 sec. > select record (1 to 10000) 4 4 > delete record (1 to 10000) 6 41 > > > This is ofcourse a totally unexpected results (you should think off the > opposite). Your ATA disk is lying about disk caching being turned off. Assuming each insert is in a separate transaction, then it's not going to do 10,000 / 6 = 1667 transactions/sec - that's faster than it's rotational speed. > Funny is that the select time is the same for both machines. Because you're limited by the speed to read from RAM. By the way - these sort of tests are pretty much meaningless in any practical terms. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Mar 10 10:16:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B01E49DCB60 for ; Fri, 10 Mar 2006 10:16: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 74731-02 for ; Fri, 10 Mar 2006 10:16:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.131]) by postgresql.org (Postfix) with ESMTP id D54F29DCAC0 for ; Fri, 10 Mar 2006 10:16:24 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay04.plus.net with esmtp (Exim) id 1FHiPk-0005S2-JZ; Fri, 10 Mar 2006 14:16:20 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id C590540C1D2; Fri, 10 Mar 2006 13:41:46 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id B1DA9FF04; Fri, 10 Mar 2006 13:41:46 +0000 (GMT) Message-ID: <4411821A.8000605@archonet.com> Date: Fri, 10 Mar 2006 13:41:46 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Ruben Rubio Rey Cc: pgsql-performance@postgresql.org Subject: Re: Query time References: <44114F85.8020702@rentalia.com> In-Reply-To: <44114F85.8020702@rentalia.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.121 required=5 tests=[AWL=0.121] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200603/123 X-Sequence-Number: 17560 Ruben Rubio Rey wrote: > Hi, > > I think im specting problems with a 7.4.8 postgres database. > > Sometimes some big query takes between 5 to 15 seconds. It happens > sometimes all the day it does not depend if database is busy. > > I have measured that sentence in 15 - 70 ms in normal circunstances. > > Why sometimes its takes too much time? > How can I fix it? > Is a postgres version problem, database problem or query problem? Information, Ruben - we can't do anything without information. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Mar 10 10:03:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DC77A9DC821 for ; Fri, 10 Mar 2006 10:03: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 71390-06 for ; Fri, 10 Mar 2006 10:03:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 8C9779DC80C for ; Fri, 10 Mar 2006 10:03:14 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id 66B1BA068D for ; Fri, 10 Mar 2006 09:03:17 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 0EE4F12493D for ; Fri, 10 Mar 2006 09:03:17 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15721-07 for ; Fri, 10 Mar 2006 09:03:16 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id D69D112493C for ; Fri, 10 Mar 2006 09:03:16 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 09:03:14 -0500 User-Agent: KMail/1.9.1 References: <6BCB9D8A16AC4241919521715F4D8BCEA35104@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCEA35104@algol.sollentuna.se> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603100903.14517.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/121 X-Sequence-Number: 17558 On Friday 10 March 2006 04:20, Magnus Hagander wrote: > > > Is it possible to get a stack trace from the stuck process? > > > > =A0I dunno > > > > > if you've got anything gdb-equivalent under Windows, but that's the > > > first thing I'd be interested in ... > > > > Here ya go: > > > > http://www.devisser-siderius.com/stack1.jpg > > http://www.devisser-siderius.com/stack2.jpg > > http://www.devisser-siderius.com/stack3.jpg > > > > There are three threads in the process. I guess thread 1 > > (stack1.jpg) is the most interesting. > > > > I also noted that cranking up concurrency in my app > > reproduces the problem in about 4 minutes ;-) > Just reproduced again.=20 > Actually, stack2 looks very interesting. Does it "stay stuck" in > pg_queue_signal? That's really not supposed to happen. Yes it does.=20 > > Also, can you confirm that stack1 actually *stops* in > pgwin32_waitforsinglesocket? Or does it go out and come back? ;-) > > (A good signal of this is to check the cswitch delta. If it stays at zero, > then it's stuck. If it shows any values, that means it's actuall going out > and coming back) I only see CSwitch change once I click OK on the thread window. Once I do=20 that, it goes up to 3 and back to blank again. The 'context switches' count= er=20 does not increase like it does for other processes (like e.g. process=20 explorer itself). Another thing which may or may not be of interest: Nothing is listed in the= =20 'TCP/IP' tab for the stuck process. I would have expected to see at least t= he=20 socket of the client connection there?? > > And finally, is this 8.0 or 8.1? There have been some significant changes > in the handling of the signals between the two... This is 8.1.3 on Windows 2003 Server. Also reproduced on 8.1.0 and 8.1.1 (a= lso=20 on 2K3).=20 > > //Magnus jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Fri Mar 10 10:27:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D5959DC9C6 for ; Fri, 10 Mar 2006 10:27: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 76873-02 for ; Fri, 10 Mar 2006 10:27:50 -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 52C889DCAC0 for ; Fri, 10 Mar 2006 10:27:44 -0400 (AST) Received: by zproxy.gmail.com with SMTP id x7so729009nzc for ; Fri, 10 Mar 2006 06:27: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:in-reply-to:mime-version:content-type:references; b=JJXL4c3fK6hXBszfUJX6PJWYram38Oa4NWtwWQsxNxusISkoPb5TE5+UqM6v/Zd08PEI+qIostnk22gPlR1c+6VZxWnD7L2fOfFOC/aVy4bJsJRGWtmb2CY4c59qRKZ6JBxBxXO3SKUk1c67+54G2csSA7XG1uRa6ejgdWvJopw= Received: by 10.36.250.47 with SMTP id x47mr1030173nzh; Fri, 10 Mar 2006 06:27:48 -0800 (PST) Received: by 10.36.60.2 with HTTP; Fri, 10 Mar 2006 06:27:48 -0800 (PST) Message-ID: Date: Fri, 10 Mar 2006 09:27:48 -0500 From: "Daniel Blaisdell" To: pgsql-performance@postgresql.org Subject: Re: x206-x225 In-Reply-To: <441181C6.3040401@archonet.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_14519_25417823.1142000868631" References: <441181C6.3040401@archonet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.097 required=5 tests=[AWL=0.096, HTML_MESSAGE=0.001] X-Spam-Score: 0.097 X-Spam-Level: X-Archive-Number: 200603/124 X-Sequence-Number: 17561 ------=_Part_14519_25417823.1142000868631 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The primary slow down is probably between your system bus from main memory to your disk storage. If you notice from your statistics that the select statements are very close. This is because all the data you need is already in system memory. The primary bottle neck is probably disk I/O. Scsi will always be faster than ATA. Scsi devices have dedicated hardware for getting data to and from the disc to the main system bus without requiring a trip through the CPU. You may be able to speed up the ata disc by enabling DMA by using hdparm. hdparm -d1 /dev/hda (or whatever your device is) -Daniel -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBEEYzX9SJ2nhowvKERAoiFAKCLR+7a7ReZ2mjjPjpONHLGIQD1SgCeNNON V1kbyATIFVPWuf1W6Ji0IFg=3D =3D5Msr -----END PGP SIGNATURE----- On 3/10/06, Richard Huxton wrote: > > H.J. Sanders wrote: > > X206 IBM X226 > > ---------------------- ------------------- > > processor Pentium 4 3.2 > > Ghz Xeon 3.0 Ghz > > main memory 1.25 > > GB 4 GB > > discs 2 x SCSI RAID1 10000RPM > > 1 x ATA 7200 RPM > > Noting that the SCSI discs are on the *slower* machine. > > > Time at X206 Time at X226 > > -------------------- ------------------ > > insert record (1 to 10000) 6 sec. 41 sec. > > select record (1 to 10000) 4 4 > > delete record (1 to 10000) 6 41 > > > > > > This is ofcourse a totally unexpected results (you should think off the > > opposite). > > Your ATA disk is lying about disk caching being turned off. Assuming > each insert is in a separate transaction, then it's not going to do > 10,000 / 6 =3D 1667 transactions/sec - that's faster than it's rotational > speed. > > > Funny is that the select time is the same for both machines. > > Because you're limited by the speed to read from RAM. > > By the way - these sort of tests are pretty much meaningless in any > practical terms. > -- > Richard Huxton > Archonet Ltd > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > ------=_Part_14519_25417823.1142000868631 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The primary slow down is probably between your system bus from main memory to your disk storage. If you notice from your statistics that the select statements are very close. This is because all the data you need is already in system memory. The primary bottle neck is probably disk I/O. Scsi will always be faster than ATA. Scsi devices have dedicated hardware for getting data to and from the disc to the main system bus without requiring a trip through the CPU.

You may be able to speed up the ata disc by enabling DMA by using hdparm.
hdparm -d1 /dev/hda  (or whatever your device is)

-Daniel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBEEYzX9SJ2nhowvKERAoiFAKCLR+7a7ReZ2mjjPjpONHLGIQD1SgCeNNON
V1kbyATIFVPWuf1W6Ji0IFg=3D
=3D5Msr
-----END PGP SIGNATURE-----

On 3/10/06, Richard Huxton <dev@archonet= .com> wrote:
H.J. Sanders wrote:
> X206            = ;            &n= bsp;            = ;  IBM X226
> ----------------------         = ;            &n= bsp;      -------------------
> processor           =             &nb= sp;Pentium 4 3.2
> Ghz            =             &nb= sp;   Xeon 3.0 Ghz
> main memory           &nb= sp;        1.25
> GB            &= nbsp;           &nbs= p;            &= nbsp;  4 GB
> discs           &nbs= p;            &= nbsp;     2 x SCSI RAID1  10000RPM
> 1 x ATA 7200 RPM

Noting tha= t the SCSI discs are on the *slower* machine.

> Time at X206 = ;           Time at = X226
> --------------------       =  ------------------
> insert record (1 to 10000)  &nbs= p;       6 sec.    4= 1 sec.
> select record (1 to 10000)          4 &n= bsp;        4
> delete record (1 to 10000)          6 &n= bsp;       41
>
>
> This is ofcourse a totally unexpected results (y= ou should think off the
> opposite).

Your ATA disk is lying ab= out disk caching being turned off. Assuming
each insert is in a separate= transaction, then it's not going to do
10,000 / 6 =3D 1667 transactions/sec - that's faster than it's rotation= al
speed.

> Funny is that the select time is the same for both= machines.

Because you're limited by the speed to read from RAM.

By the way - these sort of tests are pretty much meaningless in any
= practical terms.
--
   Richard Huxton
   Archo= net Ltd

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

------=_Part_14519_25417823.1142000868631-- From pgsql-performance-owner@postgresql.org Fri Mar 10 10:32:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AB4CF9DC80E for ; Fri, 10 Mar 2006 10:32: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 77599-01 for ; Fri, 10 Mar 2006 10:32:27 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 9E52F9DC80C for ; Fri, 10 Mar 2006 10:32:21 -0400 (AST) Received: from mail.digame.de (mail.digame.de [80.148.11.250]) by svr4.postgresql.org (Postfix) with SMTP id 547885AF8B5 for ; Fri, 10 Mar 2006 14:32:25 +0000 (GMT) Received: from ATLANTIK-CL.intern.digame.de ([192.168.10.181] RDNS failed) by mail.digame.de with Microsoft SMTPSVC(6.0.3790.1830); Fri, 10 Mar 2006 15:32:20 +0100 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: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 15:32:19 +0100 Message-ID: <84AAD313D71B1D4F9EE20E739CC3B6EDE96CE6@ATLANTIK-CL.intern.digame.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hanging queries on dual CPU windows Thread-Index: AcZDtZxqdCJzXqxOQCePinRNV3Bp7wAmVQvg From: "Hakan Kocaman" To: "Tom Lane" , "Jan de Visser" Cc: X-OriginalArrivalTime: 10 Mar 2006 14:32:20.0887 (UTC) FILETIME=[7099CA70:01C6444F] 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: 200603/125 X-Sequence-Number: 17562 Hi, > -----Original Message----- > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tom Lane > Sent: Thursday, March 09, 2006 9:11 PM > To: Jan de Visser > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Hanging queries on dual CPU windows=20 >=20 >=20 > Jan de Visser writes: > > Furtermore, it does not happen on Linux machines, both=20 > single CPU and dual=20 > > CPU, nor on single CPU windows machines. We can only=20 > reproduce on a dual CPU=20 > > windows machine, and if we take one CPU out, it does not happen. > > ... > > Which showed me that several transactions where waiting for=20 > a particular row=20 > > which was locked by another transaction. This transaction=20 > had no pending=20 > > locks (so no deadlock), but just does not complete and hence never=20 > > relinquishes the lock. >=20 > Is the stuck transaction still consuming CPU time, or just stopped? >=20 > Is it possible to get a stack trace from the stuck process? I dunno > if you've got anything gdb-equivalent under Windows, but that's the > first thing I'd be interested in ... Debugging Tools for Windows from Microsoft http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx Additinonally you need a symbol-file or you use "SRV*c:\debug\symbols*http://msdl.microsoft.com/download/symbols" to load the symbol-file dynamically from the net. Best regards >=20 > regards, tom lane >=20 > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings Hakan Kocaman Software-Development digame.de GmbH Richard-Byrd-Str. 4-8 50829 K=F6ln Tel.: +49 (0) 221 59 68 88 31 Fax: +49 (0) 221 59 68 88 98 Email: hakan.kocaman@digame.de =20 From pgsql-performance-owner@postgresql.org Fri Mar 10 10:33:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8D6A79DCC7A for ; Fri, 10 Mar 2006 10:33: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 75772-06 for ; Fri, 10 Mar 2006 10:33:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 001D29DCB60 for ; Fri, 10 Mar 2006 10:32:58 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id A07C495098 for ; Fri, 10 Mar 2006 09:33:03 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 4329B1248E6 for ; Fri, 10 Mar 2006 09:33:03 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18562-07 for ; Fri, 10 Mar 2006 09:33:03 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 1655F120C4B for ; Fri, 10 Mar 2006 09:33:03 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 09:32:59 -0500 User-Agent: KMail/1.9.1 References: <6BCB9D8A16AC4241919521715F4D8BCEA35104@algol.sollentuna.se> <200603100903.14517.jdevisser@digitalfairway.com> In-Reply-To: <200603100903.14517.jdevisser@digitalfairway.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603100933.00047.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/126 X-Sequence-Number: 17563 On Friday 10 March 2006 09:03, Jan de Visser wrote: > On Friday 10 March 2006 04:20, Magnus Hagander wrote: > > > > Is it possible to get a stack trace from the stuck process? > > > > > > =A0I dunno > > > > > > > if you've got anything gdb-equivalent under Windows, but that's the > > > > first thing I'd be interested in ... > > > > > > Here ya go: > > > > > > http://www.devisser-siderius.com/stack1.jpg > > > http://www.devisser-siderius.com/stack2.jpg > > > http://www.devisser-siderius.com/stack3.jpg > > > > > > There are three threads in the process. I guess thread 1 > > > (stack1.jpg) is the most interesting. > > > > > > I also noted that cranking up concurrency in my app > > > reproduces the problem in about 4 minutes ;-) > > Just reproduced again. > > > Actually, stack2 looks very interesting. Does it "stay stuck" in > > pg_queue_signal? That's really not supposed to happen. > > Yes it does. An update on that: There is actually *two* processes in this state, both=20 hanging in pg_queue_signal. I've looked at the source of that, and the=20 obvious candidate for hanging is EnterCriticalSection. I also found this: http://blogs.msdn.com/larryosterman/archive/2005/03/02/383685.aspx where they say: " In addition, for Windows 2003, SP1, the EnterCriticalSection API has a subt= le=20 change that's intended tor resolve many of the lock convoy issues. Before= =20 Win2003 SP1, if 10 threads were blocked on EnterCriticalSection and all 10= =20 threads had the same priority, then EnterCriticalSection would service thos= e=20 threads in a FIFO (first -in, first-out) basis. Starting in Windows 2003=20 SP1, the EnterCriticalSection will wake up a random thread from the waiting= =20 threads. If all the threads are doing the same thing (like a thread pool)= =20 this won't make much of a difference, but if the different threads are doin= g=20 different work (like the critical section protecting a widely accessed=20 object), this will go a long way towards removing lock convoy semantics. " Could it be they broke it when they did that???? > > > Also, can you confirm that stack1 actually *stops* in > > pgwin32_waitforsinglesocket? Or does it go out and come back? ;-) > > > > (A good signal of this is to check the cswitch delta. If it stays at > > zero, then it's stuck. If it shows any values, that means it's actuall > > going out and coming back) > > I only see CSwitch change once I click OK on the thread window. Once I do > that, it goes up to 3 and back to blank again. The 'context switches' > counter does not increase like it does for other processes (like e.g. > process explorer itself). > > Another thing which may or may not be of interest: Nothing is listed in t= he > 'TCP/IP' tab for the stuck process. I would have expected to see at least > the socket of the client connection there?? > > > And finally, is this 8.0 or 8.1? There have been some significant chang= es > > in the handling of the signals between the two... > > This is 8.1.3 on Windows 2003 Server. Also reproduced on 8.1.0 and 8.1.1 > (also on 2K3). > > > //Magnus > > jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Fri Mar 10 10:47:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0A8789DC86B for ; Fri, 10 Mar 2006 10:47: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 79216-08 for ; Fri, 10 Mar 2006 10:47:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 457209DC85F for ; Fri, 10 Mar 2006 10:47:19 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id 077BAA068D for ; Fri, 10 Mar 2006 09:47:24 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id ED246124A31 for ; Fri, 10 Mar 2006 09:47:23 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21190-01 for ; Fri, 10 Mar 2006 09:47:23 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id CA5FA12493D for ; Fri, 10 Mar 2006 09:47:23 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 09:47:22 -0500 User-Agent: KMail/1.9.1 References: <6BCB9D8A16AC4241919521715F4D8BCEA35104@algol.sollentuna.se> <200603100903.14517.jdevisser@digitalfairway.com> <200603100933.00047.jdevisser@digitalfairway.com> In-Reply-To: <200603100933.00047.jdevisser@digitalfairway.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603100947.22460.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/127 X-Sequence-Number: 17564 On Friday 10 March 2006 09:32, Jan de Visser wrote: > > > Actually, stack2 looks very interesting. Does it "stay stuck" in > > > pg_queue_signal? That's really not supposed to happen. > > > > Yes it does. > > An update on that: There is actually *two* processes in this state, both > hanging in pg_queue_signal. I've looked at the source of that, and the > obvious candidate for hanging is EnterCriticalSection. I also found this: > > http://blogs.msdn.com/larryosterman/archive/2005/03/02/383685.aspx > > where they say: > > " > In addition, for Windows 2003, SP1, the EnterCriticalSection API has a > subtle change that's intended tor resolve many of the lock convoy issues. > =A0Before Win2003 SP1, if 10 threads were blocked on EnterCriticalSection= and > all 10 threads had the same priority, then EnterCriticalSection would > service those threads in a FIFO (first -in, first-out) basis. =A0Starting= in > Windows 2003 SP1, the EnterCriticalSection will wake up a random thread > from the waiting threads. =A0If all the threads are doing the same thing > (like a thread pool) this won't make much of a difference, but if the > different threads are doing different work (like the critical section > protecting a widely accessed object), this will go a long way towards > removing lock convoy semantics. " > > Could it be they broke it when they did that???? See also this: http://bugs.mysql.com/bug.php?id=3D12071 It appears the mysql people ran into this and concluded it is a Windows bug= =20 they needed to work around. jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Fri Mar 10 11:10:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F0CCA9DC821 for ; Fri, 10 Mar 2006 11:10: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 85467-01 for ; Fri, 10 Mar 2006 11:11:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by postgresql.org (Postfix) with ESMTP id 10F129DC80C for ; Fri, 10 Mar 2006 11:10:56 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id B00BD8F283; Fri, 10 Mar 2006 16:11:00 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 16:11:00 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA35109@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hanging queries on dual CPU windows Thread-Index: AcZET6GI7h5pHGsdTmujzQ+P7Py95wABMQRQ From: "Magnus Hagander" To: "Jan de Visser" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/128 X-Sequence-Number: 17565 > > > > =A0I dunno > > > > > > > > > if you've got anything gdb-equivalent under Windows,=20 > but that's=20 > > > > > the first thing I'd be interested in ... > > > > > > > > Here ya go: > > > > > > > > http://www.devisser-siderius.com/stack1.jpg > > > > http://www.devisser-siderius.com/stack2.jpg > > > > http://www.devisser-siderius.com/stack3.jpg > > > > > > > > There are three threads in the process. I guess thread 1 > > > > (stack1.jpg) is the most interesting. > > > > > > > > I also noted that cranking up concurrency in my app=20 > reproduces the=20 > > > > problem in about 4 minutes ;-) > > > > Just reproduced again. > > > > > Actually, stack2 looks very interesting. Does it "stay stuck" in=20 > > > pg_queue_signal? That's really not supposed to happen. > > > > Yes it does. >=20 > An update on that: There is actually *two* processes in this=20 > state, both hanging in pg_queue_signal. I've looked at the=20 > source of that, and the obvious candidate for hanging is=20 > EnterCriticalSection. I also found this: >=20 > http://blogs.msdn.com/larryosterman/archive/2005/03/02/383685.aspx >=20 > where they say: >=20 > " > In addition, for Windows 2003, SP1, the EnterCriticalSection=20 > API has a subtle change that's intended tor resolve many of=20 > the lock convoy issues. Before > Win2003 SP1, if 10 threads were blocked on=20 > EnterCriticalSection and all 10 threads had the same=20 > priority, then EnterCriticalSection would service those=20 > threads in a FIFO (first -in, first-out) basis. Starting in=20 > Windows 2003 SP1, the EnterCriticalSection will wake up a=20 > random thread from the waiting threads. If all the threads=20 > are doing the same thing (like a thread pool) this won't make=20 > much of a difference, but if the different threads are doing=20 > different work (like the critical section protecting a widely=20 > accessed object), this will go a long way towards removing=20 > lock convoy semantics. > " >=20 > Could it be they broke it when they did that???? In theory, yes, but it still seems a bit far fetched :-( If you have the env to rebuild, can you try changing the order of the = lines: ResetEvent(pgwin32_signal_event); LeaveCriticalSection(&pg_signal_crit_sec); in backend/port/win32/signal.c And if not, can you also try disabling the stats collector and see if = that makes a difference. (Could be a workaround..) //Magnus From pgsql-performance-owner@postgresql.org Fri Mar 10 11:15:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5CCA69DCBD0 for ; Fri, 10 Mar 2006 11: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 85169-04 for ; Fri, 10 Mar 2006 11:15:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 3B2919DC9D4 for ; Fri, 10 Mar 2006 11:15:45 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id D91FE5645D; Fri, 10 Mar 2006 09:15:50 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 10 Mar 2006 09:15:49 -0600 Date: Fri, 10 Mar 2006 09:15:49 -0600 From: "Jim C. Nasby" To: "mcelroy, tim" Cc: "'pgsql-performance@postgresql.org'" Subject: Re: pg_reset_stats + cache I/O % Message-ID: <20060310151549.GE45250@pervasive.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B243B@morpheus.bostonstock.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B243B@morpheus.bostonstock.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060310:tim.mcelroy@bostonstock.com::it/bYd0HajDWrVPN:0000000000 000000000000000000000000B55U X-Hashcash: 1:20:060310:pgsql-performance@postgresql.org::RCAvggeMBM9rjgZe:00000 00000000000000000000000018fl X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/129 X-Sequence-Number: 17566 On Thu, Mar 09, 2006 at 08:13:30AM -0500, mcelroy, tim wrote: > charts showing system and in this case DB performance. I'm basically just > using the out-of-the-box defaults in my postgresql.conf file and that seems Ugh... the default config won't get you far. Take a look here: http://www.powerpostgresql.com/Downloads/annotated_conf_80.html Or, I've been planning on posting a website with some better "canned" postgresql.conf config files for different configurations; if you send me specs on the machine you're running on I'll come up with something that's at least more reasonable. -- 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 Mar 10 11:17:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2CF969DC80C for ; Fri, 10 Mar 2006 11:17: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 86526-01 for ; Fri, 10 Mar 2006 11:17:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id DE3129DC821 for ; Fri, 10 Mar 2006 11:17:33 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 0CE6F5645D; Fri, 10 Mar 2006 09:17:39 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 10 Mar 2006 09:17:37 -0600 Date: Fri, 10 Mar 2006 09:17:37 -0600 From: "Jim C. Nasby" To: Casey Allen Shobe Cc: pgsql-performance@postgresql.org Subject: Re: Using materialized views for commonly-queried subsets Message-ID: <20060310151737.GF45250@pervasive.com> References: <200603100225.08152.lists@seattleserver.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200603100225.08152.lists@seattleserver.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060310:lists@seattleserver.com::Sw9ObpQNPwZEL83U:00000000000000 000000000000000000000000GZz9 X-Hashcash: 1:20:060310:pgsql-performance@postgresql.org::iyH5+lHPL2muxela:00000 0000000000000000000000006L/4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/130 X-Sequence-Number: 17567 See also http://www.jonathangardner.net/PostgreSQL/materialized_views/matviews.html On Fri, Mar 10, 2006 at 02:25:08AM +0000, Casey Allen Shobe wrote: > I typed up a description of a situation where the only viable option to > improve performance was to use a materialized view, which, when implemented, > was found to improve performance twenty-sevenfold, even with a fairly small > amount of excess data (which is antipated to grow). I thought this might be > of use to anybody else in a similar situation, so I thought I'd post it here. > > http://community.seattleserver.com/viewtopic.php?t=11 > > Feel free to reproduce as you see fit. > > Cheers, > -- > Casey Allen Shobe | cshobe@seattleserver.com | 206-381-2800 > SeattleServer.com, Inc. | http://www.seattleserver.com > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- 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 Mar 10 11:26:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 319F19DC9D4 for ; Fri, 10 Mar 2006 11:26: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 86917-04 for ; Fri, 10 Mar 2006 11:27:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 3FD739DC80C for ; Fri, 10 Mar 2006 11:26:55 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id CBD8B5645D; Fri, 10 Mar 2006 09:27:00 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 10 Mar 2006 09:26:59 -0600 Date: Fri, 10 Mar 2006 09:26:59 -0600 From: "Jim C. Nasby" To: Ruben Rubio Rey Cc: pgsql-performance@postgresql.org Subject: Re: Query time Message-ID: <20060310152659.GG45250@pervasive.com> References: <44115521.1040805@rentalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44115521.1040805@rentalia.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060310:ruben@rentalia.com::Q6Jxm+7uk3RwCWST:0000000000000000000 0000000000000000000000004oKa X-Hashcash: 1:20:060310:pgsql-performance@postgresql.org::Qybaftj1KVfwxgke:00000 000000000000000000000000CDKu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/131 X-Sequence-Number: 17568 On Fri, Mar 10, 2006 at 11:29:53AM +0100, Ruben Rubio Rey wrote: > There is not possibility to use another database. It's the best option I > have seen. We have been working in postgres in last 3 years, and this is > the first problem I have seen. (The database is working in a large > website, 6.000 visits per day in a dedicated server) > > Any other idea? > > > Chethana, Rao (IE10) wrote: > > >USUALLY POSTGRES DATABASE TAKES MORE TIME, COMPARED TO OTHER DATABASES. > >HOWEVER U CAN FINETUNE THE PERFORMANCE OF POSTGRESQL. > >IF U HAVE AN OPTION GO FOR SQLITE, MYSQL OR FIREBIRD. If I were you I wouldn't believe any performance recommendations from someone who can't find their caps-lock key or spell "you". The fact is, on any meaningful benchmark current versions of PostgreSQL are on par with other databases. Any benchmark that shows PostgreSQL to be 'slow' is almost certain to be very old and/or does a very poor job of reflecting how client-server databases are normally used. The one caveat is that PostgreSQL is often overkill for single user embedded database type apps. -- 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 Mar 10 11:48:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 513779DC821 for ; Fri, 10 Mar 2006 11:48: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 91846-04 for ; Fri, 10 Mar 2006 11:48:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.192]) by postgresql.org (Postfix) with ESMTP id 1D0F59DC80E for ; Fri, 10 Mar 2006 11:48:17 -0400 (AST) Received: by xproxy.gmail.com with SMTP id h30so528037wxd for ; Fri, 10 Mar 2006 07:48:23 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DsULRePl5xEm+UcMHoQM8o9TODWBSjZJVK0PEMCgWi18xXlP0LS7fGadwBccWX72bDWWFMuK9bGcxlGBhbpO6HgfJPyJHqifJQIzXCcYXW28IdTLJuzTDLYhqxeE8Wj/NeezvJXP5ejYKFkj0oapRWQkCjpNoXl5jys1Z5D+09I= Received: by 10.70.123.18 with SMTP id v18mr3721752wxc; Fri, 10 Mar 2006 07:48:22 -0800 (PST) Received: by 10.70.128.2 with HTTP; Fri, 10 Mar 2006 07:48:22 -0800 (PST) Message-ID: Date: Fri, 10 Mar 2006 09:48:22 -0600 From: "Matthew Nuzum" Reply-To: newz@bearfruit.org To: NbForYou Subject: Re: Process Time X200 Cc: "Michael Fuhr" , 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: <20060310085943.GA8913@winnie.fuhr.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.162 required=5 tests=[AWL=0.162] X-Spam-Score: 0.162 X-Spam-Level: X-Archive-Number: 200603/132 X-Sequence-Number: 17569 On 3/10/06, NbForYou wrote: > Hey Michael, you sure know your stuff! > > Versions: > > PostgreSQL 7.3.9-RH running on the webhost. > PostgreSQL 8.0.3 running on my homeserver. > > So the only solution is to ask my webhost to upgrade its postgresql? > The question is will he do that? After all a license fee is required for > commercial use. And running a webhosting service is a commercial use. > > thanks for replying and going through the effort of creating the database > and populating it. > > Nick > You can look at the explain analyze output of the query from pg 7.3, figure out why the plan is bad and tweak your query to get optimum performance. Yes, I agree with the other statements that say, "upgrade to 7.4 or 8.x if you can" but if you can't, then you can still work on it. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Fri Mar 10 12:13:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2D65F9DCA4F for ; Fri, 10 Mar 2006 12:13: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 96371-01 for ; Fri, 10 Mar 2006 12:13:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 44B6D9DC80C for ; Fri, 10 Mar 2006 12:13:38 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id 798F3A059E for ; Fri, 10 Mar 2006 11:13:37 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 277DB124A31 for ; Fri, 10 Mar 2006 11:13:37 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25204-09 for ; Fri, 10 Mar 2006 11:13:37 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 104FB124023 for ; Fri, 10 Mar 2006 11:13:37 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 11:13:35 -0500 User-Agent: KMail/1.9.1 References: <6BCB9D8A16AC4241919521715F4D8BCEA35109@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCEA35109@algol.sollentuna.se> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603101113.35868.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/133 X-Sequence-Number: 17570 On Friday 10 March 2006 10:11, Magnus Hagander wrote: > > Could it be they broke it when they did that???? > > In theory, yes, but it still seems a bit far fetched :-( Well, I rolled back SP1 and am running my test again. Looking much better,= =20 hasn't locked up in 45mins now, whereas before it would lock up within 5min= s. So I think they broke something. jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Fri Mar 10 12:45:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 72E1B9DC805 for ; Fri, 10 Mar 2006 12: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 99057-10 for ; Fri, 10 Mar 2006 12:45:49 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 7391C9DC8A3 for ; Fri, 10 Mar 2006 12:45:48 -0400 (AST) Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) by svr4.postgresql.org (Postfix) with ESMTP id 6D7D95AF09C for ; Fri, 10 Mar 2006 16:45:48 +0000 (GMT) Received: from [192.168.0.250] (helo=deepcore.i-free.ru) by office1.i-free.ru with smtp (Exim 3.36 #1 (Debian)) id 1FHkkK-0008EB-00 for ; Fri, 10 Mar 2006 19:45:44 +0300 Date: Fri, 10 Mar 2006 19:45:45 +0300 From: Evgeny Gridasov To: pgsql-performance@postgresql.org Subject: one-field index vs. multi-field index planner estimates Message-Id: <20060310194545.be002083.eugrid@fpm.kubsu.ru> In-Reply-To: <200603101113.35868.jdevisser@digitalfairway.com> References: <6BCB9D8A16AC4241919521715F4D8BCEA35109@algol.sollentuna.se> <200603101113.35868.jdevisser@digitalfairway.com> X-Mailer: Sylpheed version 2.2.1 (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.103 required=5 tests=[AWL=0.103] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200603/134 X-Sequence-Number: 17571 Hello. Recently I've discovered an interesting thing (Postgres version 8.1.3): example table: CREATE TABLE test ( id INT, name TEXT, comment TEXT, phone TEXT, visible BOOLEAN ); then, CREATE INDEX i1 ON test(phone); CREATE INDEX i2 ON test(phone, visible); CREATE INDEX i3 ON test(phone, visible) WHERE visible; then insert lot's of data and try to execute query like: SELECT * FROM test WHERE phone='12345' AND visible; uses index i1, and filters all visible fields. When I drop index i1, postgres starts to use index i2 and the query began to work much more faster. When I drop index i2, postgres uses index i3 which is faster than i2 ofcourse. I've noticed that planner estimated all queries for all three cases with the same cost. So, is it a planner bad estimate or what? -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Fri Mar 10 12:47:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D4B319DCA5E for ; Fri, 10 Mar 2006 12:47: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 97864-08 for ; Fri, 10 Mar 2006 12:46:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 11BF89DCA79 for ; Fri, 10 Mar 2006 12:46:57 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Fri, 10 Mar 2006 16:46:56 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 10 Mar 2006 10:46:56 -0600 Subject: Re: Process Time X200 From: Scott Marlowe To: NbForYou Cc: pgsql-performance@postgresql.org In-Reply-To: References: <20060310085943.GA8913@winnie.fuhr.org> <4411499F.4000005@archonet.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142009216.6249.37.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 10 Mar 2006 10:46:56 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.149 required=5 tests=[AWL=0.148, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.149 X-Spam-Level: X-Archive-Number: 200603/135 X-Sequence-Number: 17572 On Fri, 2006-03-10 at 04:45, NbForYou wrote: > Ok, Everybody keeps saying that Postgresql is free... > > So I contacted my webhost and their respons was they have to pay a license > fee. > > But because they use PLESK as a service I think they are refering to a fee > PLESK charges them > for the use combination PLESK - POSTGRESQL > > I do not know however that this information is accurate... > > I thank everybody who have responded so far. Great feedback! I think it's time to get a new hosting provider. If they're still running PostgreSQL 7.3.9 (the latest 7.3 is 7.3.14, and 8.1.3 is amazingly faster than 7.3.anything...) then they're likely not updating other vital components either, and therefore it's only a matter of time before your machine gets hacked. From pgsql-performance-owner@postgresql.org Fri Mar 10 13:09:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 519D89DC80E for ; Fri, 10 Mar 2006 13:09: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 06273-05 for ; Fri, 10 Mar 2006 13:09:26 -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 0E8C69DC805 for ; Fri, 10 Mar 2006 13:09:24 -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 k2AH9JNT006629; Fri, 10 Mar 2006 12:09:19 -0500 (EST) To: Evgeny Gridasov cc: pgsql-performance@postgresql.org Subject: Re: one-field index vs. multi-field index planner estimates In-reply-to: <20060310194545.be002083.eugrid@fpm.kubsu.ru> References: <6BCB9D8A16AC4241919521715F4D8BCEA35109@algol.sollentuna.se> <200603101113.35868.jdevisser@digitalfairway.com> <20060310194545.be002083.eugrid@fpm.kubsu.ru> Comments: In-reply-to Evgeny Gridasov message dated "Fri, 10 Mar 2006 19:45:45 +0300" Date: Fri, 10 Mar 2006 12:09:19 -0500 Message-ID: <6628.1142010559@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/136 X-Sequence-Number: 17573 Evgeny Gridasov writes: > Recently I've discovered an interesting thing (Postgres version 8.1.3): Have you ANALYZEd the table since loading it? What fraction of the rows have visible = true? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 10 13:28:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 42DF59DC80C for ; Fri, 10 Mar 2006 13:28: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 11031-04 for ; Fri, 10 Mar 2006 13:28:26 -0400 (AST) X-Greylist: delayed 00:42:38.959611 by SQLgrey- Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) by postgresql.org (Postfix) with ESMTP id 7E5619DC805 for ; Fri, 10 Mar 2006 13:28:24 -0400 (AST) Received: from [192.168.0.250] (helo=deepcore.i-free.ru) by office1.i-free.ru with smtp (Exim 3.36 #1 (Debian)) id 1FHlPZ-00016m-00; Fri, 10 Mar 2006 20:28:21 +0300 Date: Fri, 10 Mar 2006 20:28:23 +0300 From: Evgeny Gridasov To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: one-field index vs. multi-field index planner Message-Id: <20060310202823.88495774.eugrid@fpm.kubsu.ru> In-Reply-To: <6628.1142010559@sss.pgh.pa.us> References: <6BCB9D8A16AC4241919521715F4D8BCEA35109@algol.sollentuna.se> <200603101113.35868.jdevisser@digitalfairway.com> <20060310194545.be002083.eugrid@fpm.kubsu.ru> <6628.1142010559@sss.pgh.pa.us> X-Mailer: Sylpheed version 2.2.1 (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.105 required=5 tests=[AWL=0.105] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200603/137 X-Sequence-Number: 17574 Tom, ofcourse I've analyzed it. visible is true for about 0.3% of all rows. testing table contains about 300,000-500,000 rows. On Fri, 10 Mar 2006 12:09:19 -0500 Tom Lane wrote: > Evgeny Gridasov writes: > > Recently I've discovered an interesting thing (Postgres version 8.1.3): > > Have you ANALYZEd the table since loading it? What fraction of the rows > have visible = true? -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Fri Mar 10 13:30:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2E5249DCB28 for ; Fri, 10 Mar 2006 13:30: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 12345-03 for ; Fri, 10 Mar 2006 13:30:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailserver.sandvine.com (sandvine.com [199.243.201.138]) by postgresql.org (Postfix) with ESMTP id B45009DCA79 for ; Fri, 10 Mar 2006 13:30:42 -0400 (AST) 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: Trouble managing planner for timestamptz columns Date: Fri, 10 Mar 2006 12:30:41 -0500 Message-ID: <2BCEB9A37A4D354AA276774EE13FB8C2BCC46E@mailserver.sandvine.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Trouble managing planner for timestamptz columns Thread-Index: AcZEZXH/k6GZem04TL2THouhjxgTBAAAInXQ From: "Marc Morin" To: 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: 200603/138 X-Sequence-Number: 17575 =20 We have large tables that hold statistics based on time. They are of the form. CREATE TABLE stats ( id serial primary key, logtime timestamptz, d1 int, s1 bigint ); CREATE INDEX idx on stats(logtime); Some of these tables have new data inserted at a rate of 500,000+ rows / hour. The entire table will grow to being 10's to 100's of millions of rows in size. (Yes, we are also paritioning these, it's the size of an individual partition that we're talking about). We tend to analyze these tables every day or so and this doesn't always prove to be sufficient.... Our application is a reporting application and the end users typically like to query the newest data the most. As such, the queries of the form... select=20 * from stats inner join dimension_d1 using (d1) where logtime between X and Y and d1.something =3D value;=20 This usually results in a hash join (good thing) where the dimension table is loaded into the hash table and it index scans stats using idx index. The trouble starts when both X and Y are times "after" the last analyze. This restriction clause is outside the range of values in the historgram created by the last analyze. Postgres's estimate on the number of rows returned here is usually very low and incorrect, as you'd expect... =20 Trouble can occur when the planner will "flip" its decision and decide to hash join by loading the results of the index scan on idx into the hash table instead of the dimension table.... =20 Since the table is so large and the system is busy (disk not idle at all), doing an analyze on this table in the production system can take 1/2 hour! (statistics collector set to 100). We can't "afford" to analyze more often... It certainly would be nice if postgres could understand somehow that some columns are "dynamic" and that it's histogram could be stretched to the maximal values or some other technique for estimating rows to the right of the range of values in the histogram... Or have some concept of error bars on it's planner decisions.... Suggestions? Comments? Marc From pgsql-performance-owner@postgresql.org Fri Mar 10 14:31:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4E9659DC999 for ; Fri, 10 Mar 2006 14: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 25371-02 for ; Fri, 10 Mar 2006 14:31:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by postgresql.org (Postfix) with ESMTP id C92089DC99A for ; Fri, 10 Mar 2006 14:31:31 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 6281E8F285; Fri, 10 Mar 2006 19:31:31 +0100 (CET) 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: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 19:25:57 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA0F847@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hanging queries on dual CPU windows Thread-Index: AcZEXbB4qPGrF3w9Re+9U9MBiLplWgAEE0lw From: "Magnus Hagander" To: "Jan de Visser" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/140 X-Sequence-Number: 17577 > > > Could it be they broke it when they did that???? > > > > In theory, yes, but it still seems a bit far fetched :-( >=20 > Well, I rolled back SP1 and am running my test again. Looking=20 > much better, hasn't locked up in 45mins now, whereas before=20 > it would lock up within 5mins. >=20 > So I think they broke something. Wow. I guess I was lucky that I didn't say it was impossible :-) But what really is happening. What other thread is actually holding the critical section at this point, causing us to block? The only places it gets held is while looping the signal queue, but it is released while calling the signal function itself... But they obviously *have* been messing with critical sections, so maybe they accidentally changed something else as well... What bothers me is that nobody else has reported this. It could be that this was exposed by the changes to the signal handling done for 8.1, and the ppl with this level of concurrency are either still on 8.0 or just not on SP1 for their windows boxes yet... Do you have any other software installed on the machine? That might possibly interfere in some way? But let's have it run for a bit longer to confirm this does help. If so, we could perhaps recode that part using a Mutex instead of a critical section - since it's not a performance critical path, the difference shouldn't be large. If I code up a patch for that, can you re-apply SP1 and test it? Or is this a production system you can't really touch? //Magnus From pgsql-performance-owner@postgresql.org Fri Mar 10 14:31:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D00CB9DCB59 for ; Fri, 10 Mar 2006 14:31: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 24231-04 for ; Fri, 10 Mar 2006 14:31: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 A5FF79DC999 for ; Fri, 10 Mar 2006 14:31: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 k2AIVDY6007330; Fri, 10 Mar 2006 13:31:13 -0500 (EST) To: "Marc Morin" cc: pgsql-performance@postgresql.org Subject: Re: Trouble managing planner for timestamptz columns In-reply-to: <2BCEB9A37A4D354AA276774EE13FB8C2BCC46E@mailserver.sandvine.com> References: <2BCEB9A37A4D354AA276774EE13FB8C2BCC46E@mailserver.sandvine.com> Comments: In-reply-to "Marc Morin" message dated "Fri, 10 Mar 2006 12:30:41 -0500" Date: Fri, 10 Mar 2006 13:31:13 -0500 Message-ID: <7329.1142015473@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/139 X-Sequence-Number: 17576 "Marc Morin" writes: > We tend to analyze these tables every day or so and this doesn't always > prove to be sufficient.... Seems to me you just stated your problem. Instead of having the planner make wild extrapolations, why not set up a cron job to analyze these tables more often? Or use autovacuum which will do it for you. > Since the table is so large and the system is busy (disk not idle at > all), doing an analyze on this table in the production system can take > 1/2 hour! (statistics collector set to 100). I'd believe that for vacuum analyze, but analyze alone should be cheap. Have you perhaps got some weird datatypes in the table? Maybe you should back off the stats target a bit? We do support analyzing selected columns, so you might try something like a cron job analyzing only the timestamp column, with a suitably low stats target for that column. This would yield numbers far more reliable than any extrapolation the planner could do. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 10 14:58:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6CEAB9DC999 for ; Fri, 10 Mar 2006 14:58: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 27100-09 for ; Fri, 10 Mar 2006 14:58: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 0F75B9DCA2C for ; Fri, 10 Mar 2006 14:58: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 k2AIwoZX007571; Fri, 10 Mar 2006 13:58:51 -0500 (EST) To: Evgeny Gridasov cc: pgsql-performance@postgresql.org Subject: Re: one-field index vs. multi-field index planner In-reply-to: <20060310202823.88495774.eugrid@fpm.kubsu.ru> References: <6BCB9D8A16AC4241919521715F4D8BCEA35109@algol.sollentuna.se> <200603101113.35868.jdevisser@digitalfairway.com> <20060310194545.be002083.eugrid@fpm.kubsu.ru> <6628.1142010559@sss.pgh.pa.us> <20060310202823.88495774.eugrid@fpm.kubsu.ru> Comments: In-reply-to Evgeny Gridasov message dated "Fri, 10 Mar 2006 20:28:23 +0300" Date: Fri, 10 Mar 2006 13:58:50 -0500 Message-ID: <7570.1142017130@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/141 X-Sequence-Number: 17578 Evgeny Gridasov writes: > ofcourse I've analyzed it. > visible is true for about 0.3% of all rows. Well, I get an indexscan on i3 ... there isn't going to be any strong reason for the planner to prefer i2 over i1, given that the phone column is probably near-unique and the i2 index will be bigger than i1. I don't see why it wouldn't like i3 though. Could we see the EXPLAIN ANALYZE results with and without i3? regression=# CREATE TABLE test (phone TEXT, visible BOOLEAN); CREATE TABLE regression=# insert into test select (z/2)::text,(z%1000)<=3 from generate_series(1,300000) z; INSERT 0 300000 regression=# CREATE INDEX i1 ON test(phone); CREATE INDEX regression=# CREATE INDEX i2 ON test(phone, visible); CREATE INDEX regression=# CREATE INDEX i3 ON test(phone, visible) WHERE visible; CREATE INDEX regression=# analyze test; ANALYZE regression=# explain SELECT * FROM test WHERE phone='12345' AND visible; QUERY PLAN ---------------------------------------------------------------- Index Scan using i3 on test (cost=0.00..5.82 rows=1 width=10) Index Cond: ((phone = '12345'::text) AND (visible = true)) (2 rows) regression=# drop index i3; DROP INDEX regression=# explain SELECT * FROM test WHERE phone='12345' AND visible; QUERY PLAN ---------------------------------------------------------------- Index Scan using i2 on test (cost=0.00..5.82 rows=1 width=10) Index Cond: ((phone = '12345'::text) AND (visible = true)) Filter: visible (3 rows) regression=# regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 10 15:27:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7315D9DCB7A for ; Fri, 10 Mar 2006 15:27: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 33333-06 for ; Fri, 10 Mar 2006 15:27:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 2C4B69DCB71 for ; Fri, 10 Mar 2006 15:27:43 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id 0813AA068D for ; Fri, 10 Mar 2006 14:27:44 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id EC0F7124A33 for ; Fri, 10 Mar 2006 14:27:43 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04203-08 for ; Fri, 10 Mar 2006 14:27:43 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id D3C821217F5 for ; Fri, 10 Mar 2006 14:27:43 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 14:27:39 -0500 User-Agent: KMail/1.9.1 References: <6BCB9D8A16AC4241919521715F4D8BCEA0F847@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCEA0F847@algol.sollentuna.se> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603101427.40357.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/142 X-Sequence-Number: 17579 On Friday 10 March 2006 13:25, Magnus Hagander wrote: > > > > Could it be they broke it when they did that???? > > > > > > In theory, yes, but it still seems a bit far fetched :-( > > > > Well, I rolled back SP1 and am running my test again. Looking > > much better, hasn't locked up in 45mins now, whereas before > > it would lock up within 5mins. > > > > So I think they broke something. > > Wow. I guess I was lucky that I didn't say it was impossible :-) > > > But what really is happening. What other thread is actually holding the > critical section at this point, causing us to block? The only places it > gets held is while looping the signal queue, but it is released while > calling the signal function itself... > > But they obviously *have* been messing with critical sections, so maybe > they accidentally changed something else as well... > > What bothers me is that nobody else has reported this. It could be that > this was exposed by the changes to the signal handling done for 8.1, and > the ppl with this level of concurrency are either still on 8.0 or just > not on SP1 for their windows boxes yet... Do you have any other software > installed on the machine? That might possibly interfere in some way? Just a JDK, JBoss, cygwin (running sshd), and a VNC Server. I don't think t= hat=20 interferes. > > But let's have it run for a bit longer to confirm this does help.=20 I turned it off after 2.5hr. The longest I had to wait before, with less lo= ad,=20 was 1.45hr. > If so,=20 > we could perhaps recode that part using a Mutex instead of a critical > section - since it's not a performance critical path, the difference > shouldn't be large. If I code up a patch for that, can you re-apply SP1 > and test it? Or is this a production system you can't really touch? I can do whatever the hell I want with it, so if you could cook up a patch= =20 that would be great. As a BTW: I reinstalled SP1 and turned stats collection off. That also seem= s=20 to work, but is not really a solution since we want to use autovacuuming. > > //Magnus jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Fri Mar 10 15:37:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AA1C99DCADA for ; Fri, 10 Mar 2006 15:37: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 33543-08 for ; Fri, 10 Mar 2006 15:37:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id B30CD9DC999 for ; Fri, 10 Mar 2006 15:37:16 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id 8A3EDA0631 for ; Fri, 10 Mar 2006 14:37:17 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 7A255124D0E for ; Fri, 10 Mar 2006 14:37:17 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06037-01 for ; Fri, 10 Mar 2006 14:37:17 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 60337124D0D for ; Fri, 10 Mar 2006 14:37:17 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Hanging queries on dual CPU windows Date: Fri, 10 Mar 2006 14:37:13 -0500 User-Agent: KMail/1.9.1 References: <6BCB9D8A16AC4241919521715F4D8BCEA0F847@algol.sollentuna.se> <200603101427.40357.jdevisser@digitalfairway.com> In-Reply-To: <200603101427.40357.jdevisser@digitalfairway.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603101437.14902.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/143 X-Sequence-Number: 17580 On Friday 10 March 2006 14:27, Jan de Visser wrote: > As a BTW: I reinstalled SP1 and turned stats collection off. That also > seems to work, but is not really a solution since we want to use > autovacuuming. I lied. I hangs now. Just takes a lot longer... jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Fri Mar 10 17:47:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6697A9DC981 for ; Fri, 10 Mar 2006 17:47: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 55989-09 for ; Fri, 10 Mar 2006 17:47:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailserver.sandvine.com (sandvine.com [199.243.201.138]) by postgresql.org (Postfix) with ESMTP id 3BD6B9DC805 for ; Fri, 10 Mar 2006 17:47:09 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Trouble managing planner for timestamptz columns Date: Fri, 10 Mar 2006 16:47:08 -0500 Message-ID: <2BCEB9A37A4D354AA276774EE13FB8C2BCC473@mailserver.sandvine.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Trouble managing planner for timestamptz columns Thread-Index: AcZEcNE9pumwfzR9Sq+/Xl7hf4jpcgAFDW4A From: "Marc Morin" To: "Tom Lane" Cc: 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: 200603/144 X-Sequence-Number: 17581 Well this analyze just took 12 minutes... Stats target of 100. # time psql xxx xxx -c "analyze elem_trafficstats_1" ANALYZE real 12m1.070s user 0m0.001s sys 0m0.015s=20 A large table, but by far, not the largest... Have about 1 dozen or so tables like this, so analyzing them will take 3-4 hours of time... No weird datatypes, just bigints for facts, timestamptz and ints for dimensions. My problem is not the analyze itself, it's the fact that our db is really busy doing stuff.... Analyze I/O is competing... I am random I/O bound like crazy. If I set the stats target to 10, I get # time psql xxxx xxx -c "set session default_statistics_target to 10;analyze elem_trafficstats_1" ANALYZE real 2m15.733s user 0m0.009s sys 0m2.255s=20 Better, but not sure what side affect this would have. > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 > Sent: Friday, March 10, 2006 1:31 PM > To: Marc Morin > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Trouble managing planner for=20 > timestamptz columns=20 >=20 > "Marc Morin" writes: > > We tend to analyze these tables every day or so and this doesn't=20 > > always prove to be sufficient.... >=20 > Seems to me you just stated your problem. Instead of having=20 > the planner make wild extrapolations, why not set up a cron=20 > job to analyze these tables more often? Or use autovacuum=20 > which will do it for you. >=20 > > Since the table is so large and the system is busy (disk=20 > not idle at=20 > > all), doing an analyze on this table in the production=20 > system can take > > 1/2 hour! (statistics collector set to 100). >=20 > I'd believe that for vacuum analyze, but analyze alone should=20 > be cheap. > Have you perhaps got some weird datatypes in the table? =20 > Maybe you should back off the stats target a bit? >=20 > We do support analyzing selected columns, so you might try=20 > something like a cron job analyzing only the timestamp=20 > column, with a suitably low stats target for that column. =20 > This would yield numbers far more reliable than any=20 > extrapolation the planner could do. >=20 > regards, tom lane >=20 From pgsql-performance-owner@postgresql.org Fri Mar 10 19:40:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5FFB59DC805 for ; Fri, 10 Mar 2006 19:40: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 74577-06 for ; Fri, 10 Mar 2006 19:40: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 E97B89DCA1B for ; Fri, 10 Mar 2006 19:40: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 k2ANeetI022203; Fri, 10 Mar 2006 18:40:40 -0500 (EST) To: "Marc Morin" cc: pgsql-performance@postgresql.org Subject: Re: Trouble managing planner for timestamptz columns In-reply-to: <2BCEB9A37A4D354AA276774EE13FB8C2BCC473@mailserver.sandvine.com> References: <2BCEB9A37A4D354AA276774EE13FB8C2BCC473@mailserver.sandvine.com> Comments: In-reply-to "Marc Morin" message dated "Fri, 10 Mar 2006 16:47:08 -0500" Date: Fri, 10 Mar 2006 18:40:40 -0500 Message-ID: <22202.1142034040@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/145 X-Sequence-Number: 17582 "Marc Morin" writes: > Well this analyze just took 12 minutes... Stats target of 100. > # time psql xxx xxx -c "analyze elem_trafficstats_1" Try analyzing just the one column, and try reducing its stats target to 10. It does make a difference: sorttest=# set default_statistics_target TO 100; SET Time: 0.382 ms sorttest=# analyze verbose d10; INFO: analyzing "public.d10" INFO: "d10": scanned 30000 of 833334 pages, containing 3600000 live rows and 0 dead rows; 30000 rows in sample, 100000080 estimated total rows ANALYZE Time: 137186.347 ms sorttest=# set default_statistics_target TO 10; SET Time: 0.418 ms sorttest=# analyze verbose d10(col1); INFO: analyzing "public.d10" INFO: "d10": scanned 3000 of 833334 pages, containing 360000 live rows and 0 dead rows; 3000 rows in sample, 100000080 estimated total rows ANALYZE Time: 17206.018 ms sorttest=# regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 10 21:37:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5AD569DCBDD for ; Fri, 10 Mar 2006 21:37: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 93650-01 for ; Fri, 10 Mar 2006 21:37:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from techforce.com.br (unknown [64.84.33.124]) by postgresql.org (Postfix) with ESMTP id EEAC09DC841 for ; Fri, 10 Mar 2006 21:37:08 -0400 (AST) Received: from 201-3-157-178.paemt705.dsl.brasiltelecom.net.br (201-3-157-178.paemt705.dsl.brasiltelecom.net.br [201.3.157.178] (may be forged)) (authenticated bits=0) by techforce.com.br (8.12.11/8.12.11) with ESMTP id k2B1V8qH003828 for ; Fri, 10 Mar 2006 17:31:09 -0800 Subject: firebird X postgresql 8.1.2 windows, performance comparison From: Andre Felipe Machado To: pgsql-performance@postgresql.org In-Reply-To: <20060307162842.M37264@techforce.com.br> References: <20060307162842.M37264@techforce.com.br> Content-Type: text/plain Date: Fri, 10 Mar 2006 22:39:57 -0300 Message-Id: <1142041197.7572.6.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 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: 200603/146 X-Sequence-Number: 17583 Hello, I got good results on tuning postgresql performance for my friend. One of the queries took almost 10 minutes. Now it completes on 26 miliseconds! (at the second run) A combination of query otimization, indexes choosing (with some droping and clustering), server parameters reconfigurations. Firebird still execute it on almost 2 minutes, much slower. Firebird is much slower than Postgresql at queries without joins. Postgresql is lightning faster than Firebird when manually tunned and without using joins and aggregates functions. The example query and its explain analyze results are attached, with the "show all" output of each config iteration, and indexes created. (UPDATE: i am sending msg from home and does not have the correct log file here. Will send the file at monday....) BUT there are some issues still unknown. The example query executes consistently at 56 seconds, and even at 39 seconds. Firebird executes the same query at 54 seconds the first time and at 20 seconds at next times. Today I went to the machine (was previously executing pg commands remotely) to observe the windows behaviour. Postgresql uses around 30% cpu and hard disk heavily (not so as vacuum) at all executions. Firebird uses around 40% cpu and hard disk heavily at the first execution. The second execution uses around 60% cpu and **NO** disk activity. The previously cited query running at 26 miliseconds down from 10 minutes, can achieve this performance at the second run, with **NO** disk activity. At the first run it uses 1,7 seconds, down from 10 minutes. The hard disk is clearly a bottleneck. 1,7 seconds against 26 miliseconds. So, How "convince" postgresql to use windows disk cache or to read all indexes to ram? It seems that effective_cache_size does not tell postgresql to actually use windows disk cache. What parameter must be configured? Do you have some suggestions? Regards. Andre Felipe Machado www.techforce.com.br From pgsql-performance-owner@postgresql.org Sat Mar 18 22:25:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D8ED39DCA72 for ; Sat, 11 Mar 2006 02: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 43933-10 for ; Sat, 11 Mar 2006 02:14:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.travelamericas.com (unknown [206.130.134.147]) by postgresql.org (Postfix) with SMTP id 4263A9DC842 for ; Sat, 11 Mar 2006 02:14:17 -0400 (AST) Received: (qmail 30477 invoked from network); 11 Mar 2006 06:14:16 -0000 Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) by verkiel.travelamericas.com with SMTP; 11 Mar 2006 06:14:16 -0000 Message-ID: <44126AB7.6060709@metatrontech.com> Date: Fri, 10 Mar 2006 22:14:15 -0800 From: Chris Travers User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andre Felipe Machado CC: pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison References: <20060307162842.M37264@techforce.com.br> <1142041197.7572.6.camel@localhost.localdomain> In-Reply-To: <1142041197.7572.6.camel@localhost.localdomain> Content-Type: multipart/mixed; boundary="------------020806090202020900040704" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.106 required=5 tests=[AWL=0.106] X-Spam-Score: 0.106 X-Spam-Level: X-Archive-Number: 200603/309 X-Sequence-Number: 17746 This is a multi-part message in MIME format. --------------020806090202020900040704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Andre Felipe Machado wrote: >Postgresql uses around 30% cpu and hard disk heavily (not so as vacuum) >at all executions. >Firebird uses around 40% cpu and hard disk heavily at the first >execution. >The second execution uses around 60% cpu and **NO** disk activity. > >The previously cited query running at 26 miliseconds down from 10 >minutes, can achieve this performance at the second run, with **NO** >disk activity. >At the first run it uses 1,7 seconds, down from 10 minutes. > >The hard disk is clearly a bottleneck. >1,7 seconds against 26 miliseconds. > > >So, >How "convince" postgresql to use windows disk cache or to read all >indexes to ram? >It seems that effective_cache_size does not tell postgresql to actually >use windows disk cache. >What parameter must be configured? >Do you have some suggestions? > > Assuming these are selects and that you have already vacuumed, etc. Look at memory useage. It seems likely that you have a difference in caching behavior. PostgreSQL has its own cache, and failing that will use the OS disk cache. So there may be a number of possible issues involved including whether the data is staying in the OS cache, how much memory is being used for caching, etc. It is also likely that the Windows version of PostgreSQL may have some issues in these areas that the UNIX/Linux versions may not simply because it is more immature. You might even try a vacuum full to retrieve space. This may mean smaller tables, more likely to remain in disk cache, etc. But that would not provide any indication of scalability. Best Wishes, Chris Travers Metatron Technology Consulting --------------020806090202020900040704 Content-Type: text/x-vcard; charset=utf-8; name="chris.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="chris.vcf" begin:vcard fn:Chris Travers n:Travers;Chris email;internet:chris@metatrontech.com tel;work:509-888-0220 tel;cell:509-630-9974 x-mozilla-html:FALSE version:2.1 end:vcard --------------020806090202020900040704-- From pgsql-performance-owner@postgresql.org Sat Mar 11 03:49:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E2C0B9DC832 for ; Sat, 11 Mar 2006 03:49: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 77162-10 for ; Sat, 11 Mar 2006 03:49:43 -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 E57E49DC84B for ; Sat, 11 Mar 2006 03:49:40 -0400 (AST) Received: obelix 172.31.0.1 from 172.31.1.4 172.31.1.4 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 11 Mar 2006 08:49:38 +0100 Subject: Re: x206-x225 From: Joost Kraaijeveld To: Richard Huxton Cc: pgsql-performance@postgresql.org In-Reply-To: <441181C6.3040401@archonet.com> References: <441181C6.3040401@archonet.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 11 Mar 2006 08:49:38 +0100 Message-Id: <1142063378.6634.13.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.091 required=5 tests=[AWL=0.090, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.091 X-Spam-Level: X-Archive-Number: 200603/147 X-Sequence-Number: 17584 On Fri, 2006-03-10 at 13:40 +0000, Richard Huxton wrote: > Your ATA disk is lying about disk caching being turned off. Assuming > each insert is in a separate transaction, then it's not going to do > 10,000 / 6 = 1667 transactions/sec - that's faster than it's rotational > speed. Could you explain the calculation? Why should the number of transactions be related to the rotational speed of the disk, without saying anything about the number of bytes per rotation? -- 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 Sat Mar 11 03:57:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 035849DC84B for ; Sat, 11 Mar 2006 03:57: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 83038-02 for ; Sat, 11 Mar 2006 03:57:30 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 1CECA9DC80C for ; Sat, 11 Mar 2006 03:57:28 -0400 (AST) Received: from bifrost.lang.hm (dsl081-033-126.lax1.dsl.speakeasy.net [64.81.33.126]) by svr4.postgresql.org (Postfix) with ESMTP id 9998F5AF89F for ; Sat, 11 Mar 2006 07:57:29 +0000 (GMT) Received: from david.lang.hm (IDENT:1000@david.lang.hm [10.0.0.5]) by bifrost.lang.hm (8.13.4/8.13.4/Debian-3) with ESMTP id k2B7vGTL030130; Fri, 10 Mar 2006 23:57:16 -0800 Date: Fri, 10 Mar 2006 23:57:16 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Joost Kraaijeveld Cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: x206-x225 In-Reply-To: <1142063378.6634.13.camel@localhost> Message-ID: References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> 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: 200603/148 X-Sequence-Number: 17585 On Sat, 11 Mar 2006, Joost Kraaijeveld wrote: > On Fri, 2006-03-10 at 13:40 +0000, Richard Huxton wrote: >> Your ATA disk is lying about disk caching being turned off. Assuming >> each insert is in a separate transaction, then it's not going to do >> 10,000 / 6 = 1667 transactions/sec - that's faster than it's rotational >> speed. > Could you explain the calculation? Why should the number of transactions > be related to the rotational speed of the disk, without saying anything > about the number of bytes per rotation? each transaction requires a sync to the disk, a sync requires a real write (which you then wait for), so you can only do one transaction per rotation. David Lang From pgsql-performance-owner@postgresql.org Sat Mar 11 04:17:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0368B9DC9B2 for ; Sat, 11 Mar 2006 04:17: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 88247-03 for ; Sat, 11 Mar 2006 04:17:11 -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 7EAE09DC84B for ; Sat, 11 Mar 2006 04:17:08 -0400 (AST) Received: obelix 172.31.0.1 from 172.31.1.4 172.31.1.4 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 11 Mar 2006 09:17:09 +0100 Subject: Re: x206-x225 From: Joost Kraaijeveld To: David Lang Cc: Richard Huxton , pgsql-performance@postgresql.org In-Reply-To: References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 11 Mar 2006 09:17:09 +0100 Message-Id: <1142065029.6634.23.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.092 required=5 tests=[AWL=0.091, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.092 X-Spam-Level: X-Archive-Number: 200603/149 X-Sequence-Number: 17586 On Fri, 2006-03-10 at 23:57 -0800, David Lang wrote: > On Sat, 11 Mar 2006, Joost Kraaijeveld wrote: > > > On Fri, 2006-03-10 at 13:40 +0000, Richard Huxton wrote: > >> Your ATA disk is lying about disk caching being turned off. Assuming > >> each insert is in a separate transaction, then it's not going to do > >> 10,000 / 6 = 1667 transactions/sec - that's faster than it's rotational > >> speed. > > Could you explain the calculation? Why should the number of transactions > > be related to the rotational speed of the disk, without saying anything > > about the number of bytes per rotation? > > each transaction requires a sync to the disk, a sync requires a real > write (which you then wait for), so you can only do one transaction per > rotation. Not according to a conversation I had with Western Digital about the write performance of my own SATA disks. What I understand from their explanation their disk are limited by the MB/sec and not by the number of writes/second, e.g. I could write 50 MB/sec *in 1 bit/write* on my disk. This would suggest that the maximum transactions of my disk (overhead of OS and PostgreSQL ignored) would be 50MB / (transaction size in MB) per second. Or am I missing something (what would not surprise me, as I do not understand the perforance of my system at all ;-))? -- 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 Sat Mar 11 07:33:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CC3D59DC9D0 for ; Sat, 11 Mar 2006 07:33: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 37541-05 for ; Sat, 11 Mar 2006 07:33:07 -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 879509DC943 for ; Sat, 11 Mar 2006 07:33:02 -0400 (AST) Received: (qmail 8677 invoked from network); 11 Mar 2006 12:33:51 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 11 Mar 2006 12:33:51 +0100 Date: Sat, 11 Mar 2006 12:33:50 +0100 To: "Joost Kraaijeveld" , "David Lang" Subject: Re: x206-x225 Cc: "Richard Huxton" , pgsql-performance@postgresql.org References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <1142065029.6634.23.camel@localhost> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <1142065029.6634.23.camel@localhost> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.107 required=5 tests=[AWL=0.107] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/150 X-Sequence-Number: 17587 >> each transaction requires a sync to the disk, a sync requires a real >> write (which you then wait for), so you can only do one transaction per >> rotation. > Not according to a conversation I had with Western Digital about the It depends if you consider that "written to the disk" means "data is somewhere between the OS cache and the platter" or "data is writter on the platter and will survive a power loss". Postgres wants the second option, of course. For that, the data has to be on the disk. Thus, the disk has to seek, wait till the desired sector arrives in front of the head, write, and tell the OS it's done. Your disk just stores data in its embedded RAM buffer and tells the OS it's written, but if you lose power, you lose anything that's in the disk embedded RAM cache... Advanced RAID cards have battery backed up RAM cache precisely for that purpose. Your harddisk doesn't. From pgsql-performance-owner@postgresql.org Sat Mar 11 10:26:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 441FD9DCBE7 for ; Sat, 11 Mar 2006 10:26: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 69593-08 for ; Sat, 11 Mar 2006 10:26:18 -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 B13DA9DCBE4 for ; Sat, 11 Mar 2006 10:26:11 -0400 (AST) Received: obelix 172.31.0.1 from 172.31.1.4 172.31.1.4 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 11 Mar 2006 15:26:14 +0100 Subject: Re: x206-x225 From: Joost Kraaijeveld To: PFC Cc: David Lang , Richard Huxton , pgsql-performance@postgresql.org In-Reply-To: References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <1142065029.6634.23.camel@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 11 Mar 2006 15:26:14 +0100 Message-Id: <1142087174.6634.32.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.093 required=5 tests=[AWL=0.092, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.093 X-Spam-Level: X-Archive-Number: 200603/151 X-Sequence-Number: 17588 On Sat, 2006-03-11 at 12:33 +0100, PFC wrote: > >> each transaction requires a sync to the disk, a sync requires a real > >> write (which you then wait for), so you can only do one transaction per > >> rotation. > > Not according to a conversation I had with Western Digital about the > > > It depends if you consider that "written to the disk" means "data is > somewhere between the OS cache and the platter" or "data is writter on the > platter and will survive a power loss". > > Postgres wants the second option, of course. I assume that for PostgreSQL "written to disk" is after fsync returned successfully. In practice that could very well mean that the data is still in a cache somewhere (controller or harddisk, not in the OS anymore, see also man page of fsync) -- 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 Sat Mar 11 12:59:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B12449DCA79 for ; Sat, 11 Mar 2006 12:59: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 99440-03 for ; Sat, 11 Mar 2006 12:59: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 417499DCA4F for ; Sat, 11 Mar 2006 12:59: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 k2BGxTr1028031; Sat, 11 Mar 2006 11:59:29 -0500 (EST) To: Joost Kraaijeveld cc: PFC , David Lang , Richard Huxton , pgsql-performance@postgresql.org Subject: Re: x206-x225 In-reply-to: <1142087174.6634.32.camel@localhost> References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <1142065029.6634.23.camel@localhost> <1142087174.6634.32.camel@localhost> Comments: In-reply-to Joost Kraaijeveld message dated "Sat, 11 Mar 2006 15:26:14 +0100" Date: Sat, 11 Mar 2006 11:59:29 -0500 Message-ID: <28030.1142096369@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/152 X-Sequence-Number: 17589 Joost Kraaijeveld writes: > I assume that for PostgreSQL "written to disk" is after fsync returned > successfully. In practice that could very well mean that the data is > still in a cache somewhere (controller or harddisk, not in the OS > anymore, see also man page of fsync) What it had better mean, if you want your database to be reliable, is that the data is stored someplace that will survive a system crash (power outage, kernel panic, etc). A battery-backed RAM cache is OK, assuming that total failure of the RAID controller is not one of the events you consider likely enough to need protection against. The description of your SATA drive makes it sound like the drive does not put data on the platter before reporting "write complete", but only stores it in on-board RAM cache. It is highly unlikely that there is any battery backing for that cache, and therefore that drive is not to be trusted. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Mar 11 14:26:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E2C359DCA79 for ; Sat, 11 Mar 2006 14:26: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 15208-05 for ; Sat, 11 Mar 2006 14:26:39 -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 6236A9DC867 for ; Sat, 11 Mar 2006 14:26:36 -0400 (AST) Received: obelix 172.31.0.1 from 172.31.1.4 172.31.1.4 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 11 Mar 2006 19:26:36 +0100 Subject: Re: x206-x225 From: Joost Kraaijeveld To: Tom Lane Cc: PFC , David Lang , Richard Huxton , pgsql-performance@postgresql.org In-Reply-To: <28030.1142096369@sss.pgh.pa.us> References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <1142065029.6634.23.camel@localhost> <1142087174.6634.32.camel@localhost> <28030.1142096369@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 11 Mar 2006 19:26:36 +0100 Message-Id: <1142101596.6634.50.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.093 required=5 tests=[AWL=0.092, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.093 X-Spam-Level: X-Archive-Number: 200603/153 X-Sequence-Number: 17590 On Sat, 2006-03-11 at 11:59 -0500, Tom Lane wrote: > Joost Kraaijeveld writes: > > I assume that for PostgreSQL "written to disk" is after fsync returned > > successfully. In practice that could very well mean that the data is > > still in a cache somewhere (controller or harddisk, not in the OS > > anymore, see also man page of fsync) > > What it had better mean, if you want your database to be reliable, > is that the data is stored someplace that will survive a system crash > (power outage, kernel panic, etc). A battery-backed RAM cache is OK, > assuming that total failure of the RAID controller is not one of the > events you consider likely enough to need protection against. Maybe I should have expressed myself better. The parent post said: > It depends if you consider that "written to the disk" means "data is > somewhere between the OS cache and the platter" or "data is written on > the platter and will survive a power loss". > > Postgres wants the second option, of course. With my remark I meant that the only thing *PostgreSQL* can expect is that the data is out of the OS: there is no greater guarantee in the fsync function. If the *database administrator* wants better guarantees, he (or she) better read your advise. > The description of your SATA drive makes it sound like the drive > does not put data on the platter before reporting "write complete", > but only stores it in on-board RAM cache. It is highly unlikely > that there is any battery backing for that cache, and therefore that > drive is not to be trusted. Yep, the drives have a write cache, and indeed, they are not backed up by a battery (neither is my RAID controller) but as this is a test/development machine, I don't really care. You made me rethink my production machine thought. I will have to check the drives and the state of their write cache of that machine. Thanks for that. -- 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 Sat Mar 11 17:15:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5D1859DC833 for ; Sat, 11 Mar 2006 17:15: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 61893-03 for ; Sat, 11 Mar 2006 17:15:49 -0400 (AST) X-Greylist: delayed 13:18:21.094133 by SQLgrey- Received: from bifrost.lang.hm (dsl081-033-126.lax1.dsl.speakeasy.net [64.81.33.126]) by postgresql.org (Postfix) with ESMTP id 0573C9DC821 for ; Sat, 11 Mar 2006 17:15:44 -0400 (AST) Received: from david.lang.hm (IDENT:1000@david.lang.hm [10.0.0.5]) by bifrost.lang.hm (8.13.4/8.13.4/Debian-3) with ESMTP id k2BLFfZi031423; Sat, 11 Mar 2006 13:15:42 -0800 Date: Sat, 11 Mar 2006 13:15:41 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Joost Kraaijeveld cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: x206-x225 In-Reply-To: <1142065029.6634.23.camel@localhost> Message-ID: References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <1142065029.6634.23.camel@localhost> 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.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200603/154 X-Sequence-Number: 17591 On Sat, 11 Mar 2006, Joost Kraaijeveld wrote: > Date: Sat, 11 Mar 2006 09:17:09 +0100 > From: Joost Kraaijeveld > To: David Lang > Cc: Richard Huxton , pgsql-performance@postgresql.org > Subject: Re: [PERFORM] x206-x225 > > On Fri, 2006-03-10 at 23:57 -0800, David Lang wrote: >> On Sat, 11 Mar 2006, Joost Kraaijeveld wrote: >> >>> On Fri, 2006-03-10 at 13:40 +0000, Richard Huxton wrote: >>>> Your ATA disk is lying about disk caching being turned off. Assuming >>>> each insert is in a separate transaction, then it's not going to do >>>> 10,000 / 6 = 1667 transactions/sec - that's faster than it's rotational >>>> speed. >>> Could you explain the calculation? Why should the number of transactions >>> be related to the rotational speed of the disk, without saying anything >>> about the number of bytes per rotation? >> >> each transaction requires a sync to the disk, a sync requires a real >> write (which you then wait for), so you can only do one transaction per >> rotation. > Not according to a conversation I had with Western Digital about the > write performance of my own SATA disks. What I understand from their > explanation their disk are limited by the MB/sec and not by the number > of writes/second, e.g. I could write 50 MB/sec *in 1 bit/write* on my > disk. This would suggest that the maximum transactions of my disk > (overhead of OS and PostgreSQL ignored) would be 50MB / (transaction > size in MB) per second. Or am I missing something (what would not > surprise me, as I do not understand the perforance of my system at > all ;-))? but if you do a 1 bit write, and wait for it to complete, and then do another 1 bit write that belongs on disk immediatly after the first one (and wait for it to complete) you have to wait until the disk rotates to the point that it can make the write before it's really safe on disk. so you can do one transaction in less then one rotation, but if you do 50 transactions you must wait at least 49 (and a fraction) roatations. if the disk cache is turned on then you don't have to wait for this, but you also will loose the data if you loose power so it's really not safe. David Lang From pgsql-performance-owner@postgresql.org Sat Mar 11 19:08:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CBD649DC833 for ; Sat, 11 Mar 2006 19:08: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 74894-08 for ; Sat, 11 Mar 2006 19:08:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id 90A5B9DC821 for ; Sat, 11 Mar 2006 19:08:44 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 9094832; Sat, 11 Mar 2006 15:11:42 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Postgres and Ingres R3 / SAN Date: Sat, 11 Mar 2006 15:06:52 -0800 User-Agent: KMail/1.8 Cc: "Jim Nasby" , "Jeremy Haile" References: <4D27CB1096EF1C408F4BFAB0046EC7B6099E48@ausmailid.aus.pervasive.com> In-Reply-To: <4D27CB1096EF1C408F4BFAB0046EC7B6099E48@ausmailid.aus.pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603111506.52841.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.082 required=5 tests=[AWL=0.082] X-Spam-Score: 0.082 X-Spam-Level: X-Archive-Number: 200603/155 X-Sequence-Number: 17592 Folks, > > Ingres is based off of the same original codebase that PostgreSQL was > > based upon (a long time ago) This is wrong. According to Andrew Yu and others who date back to the original POSTGRES, development of Postgres involved several of the same team members as INGRES (most notably Stonebraker himself) but the two database systems share no code. So the two systems share some ideas and algorithms, but Postgres is a ground-up rewrite without borrowed code. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Sun Mar 12 07:53:43 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 641EB9DCC88 for ; Sun, 12 Mar 2006 07:53: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 91445-07 for ; Sun, 12 Mar 2006 07:53:44 -0400 (AST) X-Greylist: delayed 00:06:38.425634 by SQLgrey- Received: from rediffmail.com (unknown [202.54.124.153]) by postgresql.org (Postfix) with SMTP id 259959DCC4C for ; Sun, 12 Mar 2006 07:53:38 -0400 (AST) Received: (qmail 7464 invoked by uid 510); 12 Mar 2006 11:46:25 -0000 Date: 12 Mar 2006 11:46:25 -0000 Message-ID: <20060312114625.7463.qmail@webmail8.rediffmail.com> Received: from unknown (220.227.249.101) by rediffmail.com via HTTP; 12 mar 2006 11:46:20 -0000 MIME-Version: 1.0 From: "Phadnis" Reply-To: "Phadnis" To: pgsql-performance@postgresql.org Subject: help needed asap.... Content-type: multipart/alternative; boundary="Next_1142163980---0-202.54.124.153-7350" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=4.058 required=5 tests=[AWL=1.121, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_WHOIS=0.879, HTML_IMAGE_ONLY_16=0.627, HTML_MESSAGE=0.001, HTML_SHORT_LINK_IMG_2=0.951, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 4.058 X-Spam-Level: **** X-Archive-Number: 200603/156 X-Sequence-Number: 17593 This is a multipart mime message --Next_1142163980---0-202.54.124.153-7350 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =A0=0AHi.=0A=0AI am new to postgres and i need help from u.i hope i get po= sitive response.. though my questions mite seem silly to u...=0A=0Aiam work= ing on postgres.. i have around 1 lakh records in almost 12 tables..=0A1 ) = when i try to query for count or for any thg it takes a long time to return= the result. How to avoid this=0A=0A2) also i want to know how to increase = the performance..( i do vacuum once in a day)=0A=0A3) apart from that iam = connecting to it through asp.net.. so when i try to fetch rcords the connec= tion breaks.. =0Ahow to avoid this..(very immp)=0A=0A4) also in the tables = i put a column -- serial id . so when i try to insert new records after de= leting the records(lets say at that time the last sequence number was 100).= . when i insert new record it will start with 101..=0Asuppose the sequence = number reaches its maximum limit can i use the previous 1-100 values, by us= ing the cycled option.=0A=0AThks..=0A=0A=0A=0A=0A --Next_1142163980---0-202.54.124.153-7350 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0A 
=0AHi.
=0A
=0AI am new to postgres and i need help f= rom u.i hope i get positive response.. though my questions mite seem silly = to u...
=0A
=0Aiam working on postgres.. i have around 1 lakh records= in almost 12 tables..
=0A1 ) when i try to query for count or for any t= hg it takes a long time to return the result. How to avoid this
=0A
= =0A2) also i want to know how to increase the  performance..( i do vac= uum once in a day)
=0A
=0A3) apart from that iam connecting to it thr= ough asp.net.. so when i try to fetch rcords the connection breaks..
= =0Ahow to avoid this..(very immp)
=0A
=0A4) also in the tables  = i put a column -- serial id . so when i try to insert new records after del= eting the records(lets say at that time the last sequence number was 100)..= when i insert new record it will start with 101..
=0Asuppose the sequen= ce number reaches its maximum limit can i use the previous 1-100 values, by= using the cycled option.
=0A
=0AThks..
=0A
=0A
=0A
=0A=0A=0A

=0A

=0A=0A --Next_1142163980---0-202.54.124.153-7350-- From pgsql-performance-owner@postgresql.org Sun Mar 12 14:38:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A0DB69DC87E for ; Sun, 12 Mar 2006 14:38: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 62171-07 for ; Sun, 12 Mar 2006 14:38:28 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.198]) by postgresql.org (Postfix) with ESMTP id 624659DC879 for ; Sun, 12 Mar 2006 14:38:26 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i29so801982wxd for ; Sun, 12 Mar 2006 10:38:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=g26s6PfkTVK9c/3g9K3YefqfFzNwm0BdlehGvwrmNGEyztvvdqn6Iu09HaEQYrP86FIm6PbFapOqb3yYS6EFFTvVvGctZibIRqvYzPwJOjbyQppIFv6y+WYgSgAe1CK9hAt0dCy7LszpXLqJQyUAAB0PkRNChf+sPVza3LZ1O/g= Received: by 10.70.97.12 with SMTP id u12mr2017303wxb; Sun, 12 Mar 2006 10:38:27 -0800 (PST) Received: by 10.70.128.2 with HTTP; Sun, 12 Mar 2006 10:38:27 -0800 (PST) Message-ID: Date: Sun, 12 Mar 2006 12:38:27 -0600 From: "Matthew Nuzum" Reply-To: newz@bearfruit.org To: Phadnis Subject: Re: help needed asap.... Cc: pgsql-performance@postgresql.org In-Reply-To: <20060312114625.7463.qmail@webmail8.rediffmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060312114625.7463.qmail@webmail8.rediffmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.155 required=5 tests=[AWL=0.155] X-Spam-Score: 0.155 X-Spam-Level: X-Archive-Number: 200603/157 X-Sequence-Number: 17594 On 12 Mar 2006 11:46:25 -0000, Phadnis wrote: > Hi. > > I am new to postgres and i need help from u.i hope i get positive respon= se.. though my questions mite seem silly to u... > > iam working on postgres.. i have around 1 lakh records in almost 12 tabl= es.. > 1 ) when i try to query for count or for any thg it takes a long time to= return the result. How to avoid this > > 2) also i want to know how to increase the performance..( i do vacuum o= nce in a day) > These two questions are applicable to this list... your other questions may get quicker responses on the users list. However, you haven't provided enough information for anyone here to help. Here's what you should do: Find queries that you think should be faster than they are. For example, if your query is "Select count(*) from foo" you can get important performance information about the query by running: EXPLAIN ANALYZE select count(*) from foo Send the details of the query, including the output from the explain analyze output (which looks pretty meaningless until you've learned what to look for) to the list with a detailed question. Also, for general performance hints, tell the list what your setup is, what items you've tweaked (and maybe why). Generally, be as generous with your details as you can. Also, have you googled around for hints? Here's a good website with information: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php Notice there's a section on performance tips. Also, this list works because volunteers who have knowledge and free time choose to help when they can. If you really need answers ASAP, there are a few organizations who provide paid support. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Sun Mar 12 16:59:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B22549DCAA7 for ; Sun, 12 Mar 2006 16:59: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 91152-01 for ; Sun, 12 Mar 2006 16:59:51 -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 59EA89DCA9B for ; Sun, 12 Mar 2006 16:59:47 -0400 (AST) Received: (qmail 3939 invoked by uid 500); 12 Mar 2006 21:00:51 -0000 Date: Sun, 12 Mar 2006 15:00:51 -0600 From: Bruno Wolff III To: Phadnis Cc: pgsql-performance@postgresql.org Subject: Re: help needed asap.... Message-ID: <20060312210051.GA32559@wolff.to> Mail-Followup-To: Bruno Wolff III , Phadnis , pgsql-performance@postgresql.org References: <20060312114625.7463.qmail@webmail8.rediffmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20060312114625.7463.qmail@webmail8.rediffmail.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/158 X-Sequence-Number: 17595 On Sun, Mar 12, 2006 at 11:46:25 -0000, Phadnis wrote: > � > 1 ) when i try to query for count or for any thg it takes a long time to return the result. How to avoid this Postgres doesn't cache counts, so if you are counting a lot of records, this may take a while to run. If you do a lot of counts or need them to be fast even if it slows other things down, there are some things you can do to address this. Several strategies have been repeatedly discussed in the archives. From pgsql-performance-owner@postgresql.org Mon Mar 13 04:02:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B03489DCA21 for ; Mon, 13 Mar 2006 04: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 76033-07 for ; Mon, 13 Mar 2006 04:02:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id 10F709DCA3E for ; Mon, 13 Mar 2006 04:02:49 -0400 (AST) Received: (qmail 5953 invoked by uid 514); 13 Mar 2006 08:59:09 +0100 Received: from 62.37.216.137 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.216.137):SA:0(-1.0/5.0):. Processed in 0.55214 secs); 13 Mar 2006 07:59:09 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.137):SA:0(-1.0/5.0):. Processed in 0.55214 secs Process 5944) Received: from 62-37-216-137.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.216.137) by mail.rentalia.net with SMTP; 13 Mar 2006 08:59:08 +0100 Message-ID: <44152722.9080008@rentalia.com> Date: Mon, 13 Mar 2006 09:02:42 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query time References: <44114F85.8020702@rentalia.com> <4411821A.8000605@archonet.com> In-Reply-To: <4411821A.8000605@archonet.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.106 required=5 tests=[AWL=0.106] X-Spam-Score: 0.106 X-Spam-Level: X-Archive-Number: 200603/159 X-Sequence-Number: 17596 Richard Huxton wrote: > Ruben Rubio Rey wrote: > >> Hi, >> >> I think im specting problems with a 7.4.8 postgres database. >> >> Sometimes some big query takes between 5 to 15 seconds. It happens >> sometimes all the day it does not depend if database is busy. >> >> I have measured that sentence in 15 - 70 ms in normal circunstances. >> >> Why sometimes its takes too much time? >> How can I fix it? >> Is a postgres version problem, database problem or query problem? > > > Information, Ruben - we can't do anything without information. > What usefull information could I provide? From pgsql-performance-owner@postgresql.org Mon Mar 13 04:16:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4889D9DC81E for ; Mon, 13 Mar 2006 04:16: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 79414-09 for ; Mon, 13 Mar 2006 04:16:51 -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 2A9239DCA73 for ; Mon, 13 Mar 2006 04:16:48 -0400 (AST) Received: (qmail 9158 invoked from network); 13 Mar 2006 09:16:56 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 13 Mar 2006 09:16:56 +0100 To: pgsql-performance@postgresql.org Subject: Re: Query time References: <44114F85.8020702@rentalia.com> <4411821A.8000605@archonet.com> <44152722.9080008@rentalia.com> Message-ID: From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Mon, 13 Mar 2006 09:16:54 +0100 In-Reply-To: <44152722.9080008@rentalia.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.107 required=5 tests=[AWL=0.107] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/160 X-Sequence-Number: 17597 >> Information, Ruben - we can't do anything without information. >> > What usefull information could I provide? Offending queries, EXPLAIN ANALYZE, tables description, condiguration parameters, hardware, intended use... From pgsql-performance-owner@postgresql.org Mon Mar 13 07:39:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B3CDA9DCC95 for ; Mon, 13 Mar 2006 07:39: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 20026-03-2 for ; Mon, 13 Mar 2006 07:39:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailr.qinetiq-tim.net (mailr.qinetiq-tim.net [128.98.1.9]) by postgresql.org (Postfix) with SMTP id EAC769DCC53 for ; Mon, 13 Mar 2006 07:38:57 -0400 (AST) Received: (qmail 30373 invoked from network); 13 Mar 2006 11:16:51 -0000 Received: from mail-relay.eris.qinetiq.com (HELO mailhost.eris.qinetiq.com) (128.98.2.2) by mailr.eris.qinetiq.com with SMTP; 13 Mar 2006 11:16:51 -0000 Received: (qmail 16911 invoked from network); 13 Mar 2006 11:31:42 -0000 Received: from unknown (HELO frost.eris.qinetiq.com) (128.98.76.221) by ins1.eris.qinetiq.com with SMTP; 13 Mar 2006 11:31:42 -0000 From: Nick Howden Reply-To: n.howden@eris.qinetiq.com Organization: QinetiQ To: pgsql-performance@postgresql.org Subject: unsubscribe Date: Mon, 13 Mar 2006 11:24:56 +0000 User-Agent: KMail/1.5.3 References: <44114F85.8020702@rentalia.com> <44152722.9080008@rentalia.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603131124.56568.n.howden@eris.qinetiq.com> 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: 200603/161 X-Sequence-Number: 17598 unsubscribe From pgsql-performance-owner@postgresql.org Mon Mar 13 11:07:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 84B029DC843 for ; Mon, 13 Mar 2006 11:07: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 65683-04 for ; Mon, 13 Mar 2006 11:07:44 -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 A820C9DCCDD for ; Mon, 13 Mar 2006 11:07:37 -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 k2DF8EWR010119 for ; Mon, 13 Mar 2006 07:08:14 -0800 Message-ID: <44158989.6020103@modgraph-usa.com> Date: Mon, 13 Mar 2006 07:02:33 -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: No vacuum for insert-only database? 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.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/162 X-Sequence-Number: 17599 If I only insert data into a table, never update or delete, then I should never have to vacuum it. Is that correct? Thanks, Craig From pgsql-performance-owner@postgresql.org Mon Mar 13 11:10:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 871199DCCC7 for ; Mon, 13 Mar 2006 11:10: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 64101-08 for ; Mon, 13 Mar 2006 11:10: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 54E449DC94A for ; Mon, 13 Mar 2006 11:09:44 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 13 Mar 2006 11:09:49 -0400 X-IronPort-AV: i="3.99,385,1131332400"; d="scan'208"; a="36177132:sNHT50364784" Received: from alvh.no-ip.org (201.221.200.21) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00A276E1; Mon, 13 Mar 2006 11:09:49 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 3E6ACC3A2BE; Mon, 13 Mar 2006 11:09:49 -0400 (CLT) Date: Mon, 13 Mar 2006 11:09:49 -0400 From: Alvaro Herrera To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: No vacuum for insert-only database? Message-ID: <20060313150949.GK8274@surnet.cl> Mail-Followup-To: "Craig A. James" , pgsql-performance@postgresql.org References: <44158989.6020103@modgraph-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44158989.6020103@modgraph-usa.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.561 required=5 tests=[AWL=-0.358, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.561 X-Spam-Level: * X-Archive-Number: 200603/163 X-Sequence-Number: 17600 Craig A. James wrote: > If I only insert data into a table, never update or delete, then I should > never have to vacuum it. Is that correct? You still need to vacuum eventually, to avoid transaction Id wraparound issues. But not as often. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Mon Mar 13 13:24:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 343249DCA35 for ; Mon, 13 Mar 2006 13:24: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 02428-09 for ; Mon, 13 Mar 2006 13:24:39 -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 CCA259DC94A for ; Mon, 13 Mar 2006 13:24:37 -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 k2DHPDjP010509; Mon, 13 Mar 2006 09:25:13 -0800 Message-ID: <4415A9A4.5020903@modgraph-usa.com> Date: Mon, 13 Mar 2006 09:19:32 -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: Alvaro Herrera CC: pgsql-performance@postgresql.org Subject: Re: No vacuum for insert-only database? References: <44158989.6020103@modgraph-usa.com> <20060313150949.GK8274@surnet.cl> In-Reply-To: <20060313150949.GK8274@surnet.cl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.103 required=5 tests=[AWL=0.103] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200603/164 X-Sequence-Number: 17601 Alvaro Herrera wrote: >>If I only insert data into a table, never update or delete, then I should >>never have to vacuum it. Is that correct? > > You still need to vacuum eventually, to avoid transaction Id wraparound > issues. But not as often. Thanks. Any suggestions for what "not as often" means? For example, if my database will never contain more than 10 million rows, is that a problem? 100 million rows? When does transaction ID wraparound become a problem? Craig From pgsql-performance-owner@postgresql.org Mon Mar 13 13:41:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D83C79DC94A for ; Mon, 13 Mar 2006 13:41: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 05018-09 for ; Mon, 13 Mar 2006 13:41:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id 3B37B9DC864 for ; Mon, 13 Mar 2006 13:41:36 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 13 Mar 2006 13:41:36 -0400 X-IronPort-AV: i="4.02,187,1139194800"; d="scan'208"; a="46120758:sNHT19893516" Received: from alvh.no-ip.org (201.221.200.21) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00A2D0DD; Mon, 13 Mar 2006 13:41:36 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id F3260C3A2BE; Mon, 13 Mar 2006 13:41:35 -0400 (CLT) Date: Mon, 13 Mar 2006 13:41:35 -0400 From: Alvaro Herrera To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: No vacuum for insert-only database? Message-ID: <20060313174135.GA16213@surnet.cl> Mail-Followup-To: "Craig A. James" , pgsql-performance@postgresql.org References: <44158989.6020103@modgraph-usa.com> <20060313150949.GK8274@surnet.cl> <4415A9A4.5020903@modgraph-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4415A9A4.5020903@modgraph-usa.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.555 required=5 tests=[AWL=-0.364, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.555 X-Spam-Level: * X-Archive-Number: 200603/165 X-Sequence-Number: 17602 Craig A. James wrote: > Alvaro Herrera wrote: > >>If I only insert data into a table, never update or delete, then I should > >>never have to vacuum it. Is that correct? > > > >You still need to vacuum eventually, to avoid transaction Id wraparound > >issues. But not as often. > > Thanks. Any suggestions for what "not as often" means? For example, if my > database will never contain more than 10 million rows, is that a problem? > 100 million rows? When does transaction ID wraparound become a problem? Transaction ID wraparound will be a problem at a bit less than 2 billion transactions. So if you vacuum the table every 1 billion transactions you are safe. I suggest you read the "routine maintenance" section in the docs; the wraparound issue is explained there. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support From pgsql-performance-owner@postgresql.org Mon Mar 13 14:18:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2F1529DC878 for ; Mon, 13 Mar 2006 14:18: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 12440-08 for ; Mon, 13 Mar 2006 14:18:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from techforce.com.br (unknown [64.84.33.124]) by postgresql.org (Postfix) with ESMTP id 550F29DC864 for ; Mon, 13 Mar 2006 14:18:34 -0400 (AST) Received: from techforce.com.br (techforce.com.br [127.0.0.1]) by techforce.com.br (8.12.11/8.12.11) with ESMTP id k2DIBssE021778 for ; Mon, 13 Mar 2006 10:11:54 -0800 From: "andremachado" To: pgsql-performance@postgresql.org Subject: firebird X postgresql 8.1.2 windows, performance comparison Date: Mon, 13 Mar 2006 15:11:54 -0300 Message-Id: <20060313175614.M17691@techforce.com.br> X-Mailer: Open WebMail 2.51 20050228 X-OriginatingIP: 161.148.38.12 (andremachado@techforce.com.br) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=OPENWEBMAIL_ATT_0.547397314894141" 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: 200603/166 X-Sequence-Number: 17603 This is a multi-part message in MIME format. ------=OPENWEBMAIL_ATT_0.547397314894141 Content-Type: text/plain; charset=iso-8859-1 Hello, Attached is the text file containing the last rounds of configurations. This time, used "show all" just before issuing each relevant "explain analyze" to ensure available information. Note that the last runs are being executed concurrently with other problematic query that is consuming 100% cpu for HOURS. Some people suggested to reduce shared buffers, but for few users (1 or 2 simultaneously for this app, as my friend told me), it could be large. http://candle.pha.pa.us/main/writings/pgsql/hw_performance/ brought some light over the subject. For few users, could be a viable alternative. But, despite these huge improvements in speed, there are other problematic queries with postgresql. One of them is: select count(distinct NF.ID_NF ) as contagem, DE.AM_REFERENCIA as campo from DECLARACAO DE inner join CADASTRO CAD on (CAD.ID_DECLARACAO=DE.ID_DECLARACAO) inner join NOTA_FISCAL NF on (NF.ID_CADASTRO=CAD.ID_CADASTRO) inner join EMPRESA EMP on (EMP.ID_EMPRESA=DE.ID_EMPRESA) inner join ARQUIVO_PROCESSADO ARQ on (ARQ.ID_ARQUIVO=DE.ID_ARQUIVO) group by DE.AM_REFERENCIA order by DE.AM_REFERENCIA firebird windows executed in 1min30s postgresql windows is running for 3 hours and still not finished. I already know that count() is VERY performance problematic in postgresql. Is there a way to work around this? Unfortunately, the deadline for my friend project is approaching and he is giving up postgresql for firebird. If some work around is available, he will give another try. But i already saw that count and joins are still problem. He asked me if other people are struggling with poor performance and wondered if all other users are issuing simple queries only. Any suggestions? Thanks . Andre Felipe Machado ------=OPENWEBMAIL_ATT_0.547397314894141 Content-Type: application/x-gzip; name="sql_query_slow.txt.tar.gz" Content-Disposition: attachment; filename="sql_query_slow.txt.tar.gz" Content-Transfer-Encoding: base64 H4sICBuqFUQAA1puVlBLYS50YXIA1F3Nchs5ku6znmCPCO94W5qxaFIiKaknvBFqWe7WrCy7Lbl7 e2IjKsAqkKxWsVAuVElWhw/7Dvty+wZ72uPeNzMB1C+qSEruwzBi2hJFfF8ikUhkJrI46lPkfcpF +uCpSN4Pss/ZN1/9NRwNh9Px+Jv/hJ//6V/+67+HB4dHR4fjb4b4mowPxuPhN6PheDg5PBhOhwfw +fFkOv2GDb++KO1XrjKeMvYNn4soTETn51Qeq+6//sO+ZkEQz1/9M1NLec94FP11h9VeMV+J+jvs C+t+KZFlYbxovt03pP4KhPLTMMlCGe+w/XWvv6z9xB85fM1rh/Eg8FahUqARb57KVVstcj5vv3ma Z3LFs9CH9XhAEMUMCsv4LBIsFXORitgXimWSvfnw7i3zI54roQZAmvrL8E54vlyteBy0NPyFoSVn 7bd/Ob00g5HJDEdA2CIpj0Iee1m4Er/LGHjXz+IizkSapCJT7PTs+uYFo/+c439QrOvTG8bhTwU4 Q3BG6ESaLUWMOkBTIGKZZ1X86bDNeY1sMJCt+Odwla80ZhiDXfoyDkhdMLEkEpkAlYXA0GDS1PKO +3neWq/e+V6DHzHsFQSVz5JUwkqpGrLHYx49/C48BYssvDn3M5kCyHBw0Ea+ylczkQIry3IQHeaj BFC9YHkS8AwWA4YGAuekWJKG8BtM0xCgjjmbp0AAs0OMVEQE0yFQtkwFOIMo0NyToUPNb8OYtBs/ QbA6e8wTWqoGkWuNb/BzgKMiIRI2E9m9EHFV5SnY94vKoteZzD++VJkHsvEHjbo/ajP9rPHwo0x/ FEBXYRSFBvkFm8OcSvBupihchdlmTHwlczTLOx5GtNtnAlgEeOIkgY25EWfNqsisxuvNqm/RjGo3 NSbzT82WgBHigC2sab08QDpb3KchOBoPfKUHuz7hi5p3AgtuM37P/dtFCmoOmB5d+ItSBsBjGgzo 5lGuliyBv9CoBi2876MnqXEMB4eHh5tQm9FAZWln+Rz8+xriwnabDAdOJbd59f6hXWc3Ef1dNa28 Qhql+VdV8uWHj5soGWmdSnZspXUKRspeBUfSv/VU+Hsz7CkYjkcnDid9DQGUYjQOl5EFobrVYIAp 499knnqOYMqM7jiSi/Pse43AZqnkgc/BTYCnvQt9QQEa7AN/KUDseR7T1vRmMggbSwQbtoV/hqOY HcXMqCBPMQI4+3B+enPO3ny8Oru5eHdlSRIZxpmnxGIFSlUNwOOeOdjlB81kHIIXtLNILlgBVfXl FP9QSFKSqroIrZjAiOAy/7WBwZbc9zyNW3HuF3booL6UC9hSczbHLQVDwDpKoHLyS3DvIoZID339 PBWQlMUZhH/ZEkOjZajYbinuHkpD4YsHYSCsWjvkRubTm4srxxYplKEhvlUgEEenjl4BzNBCliSr MPZWEMM09j2CxTJDM+zRuB7HInEnInyLw+EGc1S4m2EHloIgH0SdYdbl3Miv9lBVDmk/lc2lhTgz Vubo0jwYiJIDQP3heoM4uG9LQVQ4w0VTDkEcLq+csznSQAA/T1OcqUzqIih7roPvgX9XNua2sycZ 4nkImUMYuX0R7N/vXp6mn/LwTsKuBahULlK+4urle4gkFqm4/uny5fFg9BIOUv4y0e+pT9EAkavy ojMRKRjCioex4c1TCojRboUWBiN1NH7x2QelhXWH0hEVn8cYw2iWJOJxLOj8hlylgkieWGIEiO4T yxEhRRR+knthHIjPHkUEFEo1rGEwHPZZuKGEmQkF8BBP4P4zEblWOUBiRCW4v2REZsKP3VTe71lf qP8AYVVsxILlBP3ItCVTIdZBn4FsJhe8RWJZMjTtX348/3BuhHBrpSLE9qqh3Wi4K+KQGBW9oACQ uUkM9dIQl9iDDFSpintYf6hBhEE8t7G8jw0es3jM4AETWq8XhKnAcNYZ82yzD3oEKrYBfa5gBBFe g3qus4eOjUjp7vW7F+zt61974MG1JOigcLtzbXUY4VI6TOfRHY9yPeOZBztEBwwq4S3/umazgbns 4xRmHLYZAlGUQMCCBxTgOA/P7hj9BsS3R2Y1NsSNe8/Bk0o8yyGWME6NTjg0HJqkISX+Wb7wsCqQ PcA/Ydw6vjtqCQEdkglPldYXWi+4U1FoVVXQ0Unpj26E/j7VPgg3BY0iXHM0aZvAQKVJgBJsTSA+ Cz8nv6pnILsJUoEBbCbirQgqM+BzPNE1DBWPWmRznkdwyGXg6cEH+MrLeLoo9iwaQ5urctrScFYO Z3p4BZrqVQ4LXu8cLHoFAYs3qcAdo98kQyDPLDBpqdKW56wXKhnpkwzxYXxgztlMtIpjFf5qtFBC UBBT+OVY3Fc/1yEAUnoyjh661681axyzT2NQu7lCygabqtDdh9nSk2HQjFM66M60FglQaxIB2LuL 1xCVPFhUxH8AxxH6XhTOUp7CjuXwsRrUn+BP4Ch7pkRjyA1oMCpqRpDGkJdfySDX5QMBORlMDCuX oFvRSsE6E6/2gQYHR76iGjLjM/RyNi0zXviWEQWSksf0ZmG24gke720FOja5I6gBVoxpgENj7RMY /lGVNEuulnzRDtUfQ4NYYMAAl4oFLzxKg+03SDK+FhsjsAYJbT+H4h5DQlhOxa0E+BXXXB7BQljO ucQQCEVSJl9DYYglgn2Cc3Ep8cmltUdxKZ0shjxyKk/J1BEfPo5KfE6i0IfznkBhikmFKAMH9LXm dHPxmtUnA78lMJkM43FH/t3h6n6BDxonMOP+rYrQkDUWFbpkCpkuuDamgSEmhTOTR8QIc4XspDNa cc/qozJTCilmgS0K3EmeVaO+839/f3l6ccV+Pv/w/bvrc+IC2phHXhIGroSv+9IGa1xGhxDrQsyL Z/570J6NXxLhh/MQ5DCJHFCl3JuDB4ZMM1yEjRrOmhS7rN2ZsSb8QnyYGcGCHvd1daMIaPH2CxKV KAIvK8pqeIWhr3KEN1z7lC2QI5+JB4nlvWUIZ7DKZyZhpKpCLDNmefDyaq4eYr8JvXYR38gUL9dw 7DKVcfg7twVvW5QuKwXzHEvAfCG8e70WGzGYdcPBZQUUSxD3S4E5dwqThbNRr5wO5HilbgS8C/FJ 9kxszaZbiFhglYvu/m3ubW/AENqD87jbcThy2x/Of3r3HTOjQtrIgQ45s1pog2Yi4Y2URmC8CrkJ zE9ZYhRN1x4cunTYpiYuDZN2sB5ujnweLSToe7myFImUUUeNdzOKOAjvwiAHR4FORO++JI9qClQi EqYaG/Jm2cwRyGgSM+oOs1hIvnOwaQzOOlnqdyzrWcoAtxgIE6I7ZFDcStV3Fy2RWUxgXM54dzmK bV+RWniAqKtRDemKVPwZfOKZoyS1w0L0rz3ibC8MIVpxnMLQJzrEAWe/wIsZ8A+YKm8Yi78uPo7u y4AwzNxR4Rg6/DF+82/v4ADSJbjcz0rnOQfzgpyT2G/TGQTjSoSxonrEhlMifvBjtMn/TaSwaaSq 1CGw2SQHu5tRnsrxjIT9gUT7wLQjYhXiBjACaOV7S1iy1v3J+jSyGGZcQSGOhq1z3IqHtjnBaXBx ef7dy1ylLyMJ6QtYivoUvRSZ/xLGTgYwCrKoHhlwlD0/HDIwALCHMwmT3nVdFAGqreL28HXON/SR I/K1RWXd+8YBTtdbujoYmWQYYieqJeBls8HNHpI+59CLW9xBUOUPTj6jNczy0TjQWkFdVHiukjov JvpJi5Xh8SLHywlwr3pbFGC4H4rYxhBJODO5qwK5nojk1SESxYFUkCkA9Z2/0jRwzEA80xG0PIZG n1sGvd1m8UT0jhImuh0RezwI8Bhz2eufe6hw2xo7TtnFe2ZgdoXaw5hCg8NPSCQXYM+QPfjOkKHL SdG1HFVxVO5jmRtCMVbiGOAAa+OxLR81MVQGG6Cv9lEdjmory28mK7A03cVt3PILD0dsRlNCISGO Q9eiCiLVqateRcWBvtZWeCEgY+yv8aOcLh4Dcw5aCnssOufSTUETsWNthc02awUMzmqqhYmVvilE KlC+TD3Q6EzCkfHQQLUBZ7feypHAB4AL4LEOwFJQvRZYkHszhZnQ3o60F3x05V2tlTrqy8iIy9Xd KFBe4u0//3X/+Wr/eeA9//H52+fXg34boYONcBM84NPYaR/OU3bDxSv3rAlWS0tDbEsRhbHAnHoe fnZQPHes15mMs1RSqK39DhW7CEGnGGQqOBXE1ix4Y22tySvsxiK6erBal7dlqd5588FnEoJ0k4Ra AqykYgePMOY0KKXRxtoQRa8pj9vuHqZNHZ3UEVTBt9kRXsohIuMZ+kgtDfUJ6Bo1qMUlRddh+YSL /BoHXT84d8u6/aJHbrtbTOHISbiGz9xGb0mYykwbFaqihT0ajx3pY9HQW+w3ZmG0vUjfz1OT5l+h AeYgYYPPka7iBc3BVyC8DSM5eygo2zZaxY4haGm/W6aVGAFiUbI02ZqBFO87lqx/wfx8Rbnvndh2 zSDFiSGYFB7exlg99HPemCHgBRAcK4PWVdLs0M2RrzMNAvhXCw2s2EcBEQoK6N3L9Bb23apOMJoe HjuaMluNSjAQD3O9nammgn67gm+6A8yNEAxbEw313um1W/QqLSwVXMNE+sDWPM/0CjSYNmrFKrkU /B5lPBYyV9GDbpnRKi86NMzalj3VJIZaec2exJIQGyK3k4OuiDQgEmsfP8crVX0RCU42g1zlloza CpCKyFm0eoQeHNebG8ph+/942upZIjkcYhQJWFuOojEQ4HLay4aHyiBYm0w9CFYWtUvBL2zq6Htt 05QYTGMYaOr3gZTYsZhf2GFn56V7BrpvB9GM5NiHoC22esFbSL7JjizRCYyaR+u3wEgE8QmcaCLw aj1fFvTgSRvDYjevg5EX3KF/C3lLUr+ptSYwnRz2Nq4ZakJhhEKt9MUJASwJZOfg0wJsPUwfklas 31V4pg8Xowmpq8BcjJqMnStuxb05e69Bqm6fckPw0rgSoCkPH/Dobpd2LEQsq48hlZ34BIc31+Y+ PHTU+DrqUZcgFNa9aNXK0eDVDSRW/mRZlIJ1DaR2as7+LtgJPWpZ39rF8Rgv7w3BpuYi8/FCufB9 KIXQ2aTnTnQ7VpoehMFUsXj0hTo3eJJhMdtAmUsxmnU1CUnFArb/POJ3ss1H8Dy4w2Ovr3cDQCBS SPEGL9X5KnumIZ8BhRL4lFOrl6EC9CesVb5I8lnkisvLsjAobMUNnqmGoZ/WRc4iPsaqqv7o/qec R3SlQ2JQzfEp/bvG4ndtr9dedyOvYbP1Mwfb8WDkevio9K6GzUAgJpmzZ7vpHZjrgpyKh9Nbw0Q7 FpLindlDhR5pMUHOvJUMumqkzojuA2zN6jw0TITdfZBNw7mzFBBnUkTlQHQ1z+v8DMzcnNc6RtOF ES23LUGAB8W+RvDe9rk6tHWlIucE1kzEXuFdX182QjLsqw84eGa8n9A9xebCXPUBfjsYDL5l9oNU ki8vy4HI3IlrVRXhu7uDsP/22B4vACbv0dnYes9uI7veIycVP9RKPpQwePoBDZ3kbqSvMxnhlZrS T2Ps65GVrAGLZrZZEs/SuzB7KNjMchk1bsNWYdD9B6aeUD5bqQoW8FIiw+zEbFNFLrSH5e8ilZgS aTLQZH0+xsQBFoFKGnnvVNz6ycDILRVHzJ4RsObLe06N+gYtmPYNDFpK7YFKlUPwRZ2yqEEYFdST n/4b0FqSYytVKpI4XwOnq7aWBSkzP4HoFOKvCBJRtI+89eRXm/JtK6LDyKWAATqK5FZh5qAIg6h5 6+XcY/WnHUKlcrS1GpELHR/TvePRdui94otV0n0oPC4jQ0yJLYito8FkhcqcSfh06N8dFYqS5Ye3 N32xU/EUsu5Z1DdAqEidjZlnmqmdFj8JRrqiHihMxISHRbR5x5Mrzh32gy7n4VNX2Pq7oCeEioYh dnlxfXN+RdxX724u3vxaMHV2dXUeG3h3XK2gaq8Eli7z1MfagrkIQ2QdNHS10ZagG7fT2hpCBRLC 00ZjbYOy2ji7ZnJreJrttJYIleHF2MAjPlEzx1qiGzwdFXuGoeWrq4+Xl8/w7pp+ZRfXjN4B9DwO IRWD40ZkzsudDfqfi1H3EJgIeu8joO5DXsBplRC8KDfrxuigQY0PQjbbGddTy3vqrdODTeLQpm5Q gYukLymoFkAgfxv1xa+cLt5YdWgfnfPR7Rqyw6msfYi7AdzusTAeqx96zVPbDRLK62CFq3dW7qJA lYMe/KbcDK0jC7UDLB6FbhEsw8bJtObJ8wr+nB6gNfc42uUWPdMtHly8Os/mE6GWkx6yex71nSXr q2v1qt4+kVpANK5a3oGC/XJ6aXix/c9biWwpXd+igdVJbPbhrg5DFEBHTvrmhDCK6i38z7ePHBZP uedZpanQVTNuTPtww0PUXUDWfX9IQ6VE3AW/Q0wJE1qBhgJXObUzRozhuMjp6fziebEEH1E2WHqh l+CCKYLaHU2HmKFDaJdKtbezY76CZofZn4pvG9DfFPHXHTz6zs6/Y5XFJEwdq8VCYLq1ezA5mg73 IMz24Q3VKAzvUsyxt/PjxdUNAIHQKsR8HbI18Jz6u1X0lWWlsavoTWTPamjP6HssdK8DkxirEvdg 5+fTs48f3xZTYv8RhDtNjfW9sEzEsVUNi8n/8394IXOuYKlWnHV9hc6V7O7ngDE3YSLpB/ZaxlK/ p183fCZ2Ir7zpG/D+UvrhwbOTvVnZksqXxhfpHnCMbGTdDPqJdgF1ff6wv43DvCGstIDVcPZIaAa iW7+s5cTPFhL00FS4uwYoCqNzwOOxrx+Dv00FqeKHQg/wpIO3xjdjV3iVNEhqoY/880F70A3ODXo jRZ1A+jGms5vQ69QeBh4FQXN3WybK7uJbdXTAbw1dkVWQLdW1YW+zUK20dfJvi06recGUm+7lhZ3 /To+DjcDB6h/6ZN4c1xsksY0jyN4PH+UHgqMXnDwNkGe9ci9JTjhzkP8biCELwzdje8Gr2A04a2T 1T7dmkmXxbjhKxg7JYiDiRRT0ZGch34I83LMpZMJBzahyVosqN1CnbvJDV3B2ClANiWi93Ml66v/ BKIq1nqjchNVMNbAu8V/HHwYfPb8OPnNzqx7l/XDOxRD0BIfK4RdINOQezEvjGgL6C6ppRf7nbH7 U6ELdceHk5M/Cno8bl0Tfy3odnvAU6CDJfijFXmfp+h6jdsxTGEMFiI3InsiUyp8keBhGIlFh0n2 M7lP8iY6VcG+LnoG+zWEKfY+nNaP3nHKGHj77Zfheo+wrfBxsSSPF35NskA0uUfNFEj2x9JEYbzc wHE+Slc53laFwotbRYGN0XsWmuAhtQ4D3nHPux6+Gb8h7h33MmDt31JrcJ0hFoGLVOGe5Q+O71bZ ELxD40VkuGlOtYXoZCVFnLYJgRu8grNT92rV2HOzCWxlMMlths/bb6KWXnhCqQE7g9q+GTzW79vz 8ampuOOYhLdgIywot4J54PdFrKHphLY4OxaoylOmWk+z0QKnBd4MmHt5Hhk0t0LYR1amKjg7rSXZ Cr+HpBo6704OnHVVW4w032fAiq8G1o8asz/T0/ns9fnZ5emH07PTd/gjYyF1x9N3V5ydvj69vvnw Dn/Ay/td+Hdw8dorh7yCH+vv7JHUFZCrdzen3puL67PTS3b1hmCu3uAYi/7KoNrf96qjL27O33oI wS7M4As9+urNK/vDnrkqM7Kcfvjp48XP716Nmt9p/nVeP308//Are395elWtcf6DvHbYj/hFGH+j r1TZxUuZV6OjyfHh4WByMBiMx4ej0dHgeIp9H+rVaDQejodH7D4MsuWro+l0j+1yP8vhEMU78Ffw t/FoMDmeDgbHx8PJ0WA6ObYjJ6Ph+JDh16DAb3u4EER8JuPgO7b7DI5JkT4bUCmFvWLPaMXN7/Tp /X9l7Fp8Ytf4XSD4VUz2/MKrbCs6ft3eYDAdn5yMBgcHmvoAkqMj+EULPZqcNIQe4aDJYDA6Opqe DKYn4/qwqsQoA0ltNTU6PhwPB8cjGG1/1KOPRofDY8s5HR61FXUIEk5B2OJHO/DkaDytsepXwV1d qsnJwWQwmmxLPxpOx8cDWMrB4HB8Aio7Gq2j16+OJbMVpPrC2XdbKM2lrJzlrLmWx9NjMKmhWZTR +GgygV/0xA6GTQMcHR9PQAnHg8HB0cnhcHAwPKkP7JpYc2UnJ8PpYHw0GJgfjHbGR1ap4+GowY3/ 7xUDEAC4zU920PSok7dnbf+/vXNrkttG8v155qdgaNYx8q5F8X7xCZ8I25LH2pVljyWfObOxERVU Fbu7RtXFdl2k0Ya+7z7t476fTIDg/QqA1WwNGGFXqbuZ+ScAAgkQzJ9jQrNwJimwXBtu2wgUOJEP J/qjFfRWbxGIViu4+Hmv1Xp1560FvlQrG7SHhp+1Yctz4WtW01G9pm3TiWgLth07MDzHLp815mLr VW6HEfR3YI98UmtuYHms4zC9ugQPbzs4gXxmJ/gji7rQ8B1JE6b/mMD/WBGVSvwRfH+UtwnoXc0J Ei0jMOGSLNtwrIhLIT1+TUjGGdY2irVcaBDjrZSu9gV5HYNd7tAjkXIbIUXQuHSzceG+C/cO+RC4 bnpQsV3X/oZMIg/nPTr+Wg/DyPVwCNJvj9pjK+iNxGTDVvjwKoNBwqLpKuPxKhcDqggjVC4DTbks JkUmGGUBKJQLw0/mxJ3MCTi5ENLk/iAml8CWXBRUcjk0ySVgJBfDj1wOOCIJMSIfKjIPRuSewCEX RYUsAQ4yEw5kVgCIIPJDF2F+KMoHCeouw/VYDsnjXtgd90HrWACfQzqRY04Gh0zqxsU5G7LJGjOw NGagZ8zLy5BNyLg8E+NSFIzZuRfzkC5mYVvYvm25bkeXL5tnMRvBYm5mxUyUirm4FHORKOZlT8xK m5iRLzETUeICDInZqRGzcSIuRIa4JAtiDvrD5XgPMgkPF2Q6zEJxmInbMBepYcFshiWBGWbiMkgh MVyevSBKW+CBLdwPXmF+oIJkhII8aMKFMAkzghFmQyHIhh/MijuYFXAgF2kwG8RgLmzBLKCC2dEE 0mEE94wfmAM4MAdiYC6owAIwAvcGDpgBFTA/HOASOIALAAAukfJfbpL/y6T1v1wi/0ul7p83Wf89 pOcPzWHPkhPy28Me50zBP1vSfalp9qUn1p8xlf5Fk+fPki5fLEG+9JT4UpLgz5T2/t4S3V8wtf1s yezvIX39zAnrBVPUO3bgV2/qOZPSS0hDf7nE8xJSzc+QXP7S6eTnTiA/V8r42ZLEz5oWfs5E8BdJ /T5LsnfZ6d1nSuh+2RTul0vaPmea9gslZp8vFfuMydflp1u/aIL1GVOqz5xEXWra9HkSpctPjT5j MvTZ05/fQ8Lz+VOce7Zrh+2vAslOai4xjfl3z569+uGbP7BtuXShhGQ0uyqnXcVop5wS53E5883/ 7rYC59fN5Ol5xtrYUin7Kzy7yKzzmGbR6TmxfF5dfP+Zm2RdfsHfQguljEOPi3w9LItPNYOPSqle vPheeQlepVTvc6NSqquU6oO2VUp1lVKdz7hKqa5Sqj+4lOq1ALL/GN8bq3TtKl37iHTt9XkAh+ne 1OYqGbxKBi9HfDFL5hffmSm8thggu2QmSecwr/Lkqzz5w3ZVnnyVJ3+aYZUnf0otqDz5Y51U8+S3 Z2fVtNkStPbJHXtstGXmbuXKfj86eSvvcbGkr7zyBFPF8ju+RIpZAXmXzE0roFJaTlt+DfeeC5df +tgcujJS6ArInC/3roCo+ZL2ShI1W7ZffnljswRLThLMrXf+3MIipTkyK7GEpMTyFM6TyliiQNkZ kPmPi+VOlitxnqzL3AKlJGvmdi45xTP3MU9uaBE995JVWqLcjmzU4smoBUTefxZrTuGzpL4W1TKQ L3t6umz+4z4TbUtR/Y+bopu/8C6T2ptX3VISgl9Gvows4nNpLV6z1aRlHxeWOpSzXJsraXm3JDk5 zMWKZSjtuTY57znvITNfOreEsWnWNTlp1vmFyk3Pzq9Delp3KVLkpIOXIqU3jbzGkUZeQJbc/PPS VHRlrdckpa3n1TeU414TSnIvsQA7kuNrfMnx+YXNkVSfT8noRPza+Ez8OLRwDy7j0/dr/On7uY/x ef+1aXn/51JUBgZoXMSAOZWx5PraFNbAXILKkAJtEqVgLkVlvIE2iW8wl6ISGEHjACPMJatMVNCm IxXmklVmMWhTYQxziSpTHLQpGAd+PWPxDxov/kFA22huhMYHjuDVNRo3oU3jTfAfE0gVmgiqQorC IciFJky5EFA5Go+hGWP5GAJqRoM1NEGyhoBGeUgOERWjYR6aKM1DXOUIDog2HgQiVU8XQkSbwhAR VzSCPqJNwo+ISBoNLtEuTS6pyhuCl2iz00va1bTjS7Qp/BL+ypPAPRFxP5qYwh59iSJTBKWOQa1o 0lgrQlIvTGgZ1DLAbdE4uS1iBSQD9cJ/yIPESNLQj5fRRPgyQgrHkmm0qWgaOaoGoDbaNKrNjJom 8nBmVFI8gNSmo3Sk6BqC8GjTKTz8qmTSezgljEb+aNOYPzLltIGCtEmkIN5jAmFIM0YjhgTVjEET aXxsIj5VknlGvMcEDpI2BwhpbClJoyTxF9RouhJr1cN4JQE1o7lM2iQwk4Ci0UQnbS6kE3dZjgVB aXJJUMIFLQkfxXtMwE5pnNwpcWlDvCqNm1fFLW00g0rj5VxdShkHHotbm0yqFr+KsTQuTYDGxa9u LMVLE6R48eobzf7ShOBf3McEapjGgQ2bQ1UV26TJwo35Art7+gVXIWWaMKXMEnnJegLcTJNLNxNQ PJaKpk3DokmVxM1Tk6pCCMQmomQswU2binCbR1S9ExGBvzmhzH6jCxmnjWfGcR9isDlup5IZdfyH FLodr+vRTDxtNBRP1tPbEe/5yOTpiUgeC+LTREl8fPLmgffx6xhi/WmyYH9cx3hCoMZDCOQWJcIV lDVeDNAINREaIb88YYqhgO/R+ENNkH/IL1GYm8jvejRvUTNGAhdF1IxGNWpSWI38QkczHjUuyKME YUNwSG0SHZJf0GiqpDYNK8mvaDSOUpvOoxSQNRpkqU0mWQrJGsvA1PghmCL6RuMztfH8TBE9csmb MpV0Mjuxax+GdoazLd1VUZ+aBNanuMohRKgmyAjllziaLapNhovyixoLJdVEoKQTNY0lmGoTCab8 pTSWfKpNJZ/yS5JNTBUumgHOqibOWRWWOEBn1abSWSVIGqK6ajxYVxFlEoGwckT0phnVJpBkJemR gaCdQUuTLqtNpdfKF9XE3mp83FtuYaNxuZosXu50hSPpuhonXteKfCmJDoaYvBovlJf3mADz1bpo vpWDYQGy13n1PIs2fQlL/2fyamiZZwtfdWg+uEGHvGieI3rhC84rH8On8eLZCk/R6DnfwHf2I/qT L8nVlKyUkbuvfiB2Xv1glKC/32RmcwgwRmj56QXp90V29gt6+qsfvmFfGH03E1Mi8PLXR/3482/P f/2r/svLb19pXPCACZgBcQv6j/i697+S7AmPsR/7xnK8wHBtw7DN0HQDI7Jw4eH4jWU5UWQHEMls TjffBG74pf4YQkEI8MiMAn4fGZbvGobnup5puGakHzR6omeZrqNjXgL415dY1MQrNOPN1/rjR3Bn J4dHRhkY9Y3+iDSMyk/JmU/+j67/RFIvlEVj2joD3HtBZBt2SBXbjhdFlpcpdtyophhOciLDcEPL so3IM7XqaWW99KB+m7L3V1XB+6vSSSj4BXmK/Rpf7D+Tm7VOmy4BbXR8j658VV7oR77hR1k1uIHn B5MapJ+VgBWZzRKAWjMcxw88KIGg7MJvKYDOa6kgt3O4EM6wqtcSOJFtQbGXS3rStbDatLyW2jTh Wjzb9w3bt7rrEi+CtL+8wTshCIPmQ7/QMwMoBNZyorovbOtmGMIp9As7ZVq1BB0l3LglHdMyLHOK QChkaO+GEZqGY/uTZDHrrfLo0XH3Fsiq6u1Q/LxhCS/3dfI7bU6YXJV1APCl3nJMAy6YNlCvuHY7 cotrn3TkrQarHvouxy1b77r2euuxw8hwLOgtySe14AZWyNqp6TWrxo4COIF8clSN6/dUTSHyO5Lu SP8xgf+x4i3V0CP4/ihvYNBcnLZrmKSu44ItGE1gOIEGbLnu6Eugx68JSWXAGluB1oQW1n9mqQhK PRb2Tq2YznJTI6WhD2MLK0e12usdLVgMoc7Jx8QioAe9hq5ieENQdgeYMIKzr3XPswPTiGDIuD1i 7FcN/RobLkiGhFR3v549Fpw3FFxcJEiOUjgoIeS7yNEeFYaGF2G3FXiRZYSss7Rcz7ZdFhX6Qb3h uy50cz6MRDAdcwzf9dl5FwsKA88xIX7y8oggiNyIjZwNwXCSDQN7CH1zYPiWu8yY0A8dzzHsImCz LZf1PRC3t4R5eJKP1+R41gXCvBAcum5bkbdHbtBCfMsPoLacSZFbhCGOkX3JQhfPYhGvazY6YmiP Fg6/2ZfeaKczGAv8KT5dnJJYOALahun5Dy7Aqg/oLGYK8abmjZkik8YbkcniDdftjJmwBDGGoJ9z hkH+FFk2hjbQFKDkbCu8/9Dm6t221BbKEc4VgUvWghy/eY31povziNAjwSp8zh+5RDAm2EYA931L 5LJofGWJXrkkfOXEg0pX+EqFr2yXp/CVYzX8A+Ar+y7BUPxKxa8cK28sv7LgQCqAZY+6kQDLMXxD RbBUBEtZEhXBsuRcESy79HymBMuxKhXCsnL6Q0RYlvQaimE5pFoxLKcX3j8mw1JTEMupWouX2x8O w1IhLNsQlopg2Uaw1BXBkp6uCJYDUnoJlnVZimBZJlguHGC5cH5lPReT4lc2+ZWLw1ey2GmZ+Mo2 SOQ94ysXS69cGrxycezKpaErW2UtAF25THLlEsGVy+JW6kvmVi4UW7lAauXioZUPgllpLAlZqYiV I4mVDwJYuTBe5eJwlcujVS4bVrkoVqVCVZZRlQ+HVKlAlW1aBkCVugJVLh1UuXhO5SIxlYpS2UOp XCikUjEq2xmVy0JULo1QaSwJUKn4lH18SoWnHIenNJZEp1wcnPLBsikVmrJ6+mg05WLJlO3SlkGm XCyYUnEp+7mUne1qEVxKfelcysVjKRdJpXxoUMoHw6R8cEhKRaRcOpFyiUDKB8CjVDhKhaPM938b Y2iUIvdzuVqGX9h5aDBKxaIcw6J8IChKXaEoqyhKXaEoO1GUikTZQ6I0lgSifCgcyqViKJdGoVwc hHKZDMplIigXTqBUAMqeYlkMf/JB4CeXT59cIHxSXyB8Ul8cfFJX8Mku+KS+fPikvkD4pGJP9qcI NRR6sh09uUTy5FLBk4vnTi4cO7lg6mQPdFLhhSTjhR4cXaiXLeR4duAbBSNogC3k2IZFWBaRaXqG 60SLZwvZCMh0bC/yEYr2ebCFLIRoWkHkeYZvRYtjC1mWg0xS3zICbxoVcjJbyAEfhC1Ev1yCLWRD TXm2YUS24Zn254AWQqCOHRpu9YTZ0EJQgJZP+h78XAxaCP7cR2iiZYT+AqCJ8slC+EcuEhHhY36u kBOFMFhAx4ZcoSr1WtGExE7vORRNiJ6uaELt8hRNaKwGRRNSNCFFExonT9GEFE1I0YSE1Cma0FSB iiZET1c0IUUTUjShSVoUTUh8CFM0IYHCUzQhRRMapVXRhBRNaLImRRMaL1TRhPqkKJpQqyxFE5oi T9GEpglTNKExihRNSFiRogmN1KNoQkOCFE1ogipFEyJbNBRNaKosRRMSEKhoQiPFKJrQSBWKJiRB jqIJ1U9XNCFFE+Jyr2hCiiakaEKKJtQnUNGEZEhSNCFFE2qXoGhCfXoUTWhIlKIJKZoQvxhFE8o9 K5qQogm1K1M0odmEKZqQoglN0adoQpJFKZqQogkpmpCiCfFqUjShNjWKJvQZ0YRE+rdytSiaEDWv aEKKJqRoQp3yFE2o73RFE6KnK5qQogkpmpCiCY2Rp2hCI5UomtBokYomNEGToglJUKRoQoomxClJ 0YQGRCia0BgtiibUcrqiCSmaUBdNKMvfX//U/2OzncTYwTX9GF/3wQe5//U/uFvk+RFK5DbWuxL2 v0q791jDOW+2dyn5oj9L9yn9GT3exG/BSZHRnyf1/r80vnTb0XS2Av1Jj68P57sYl2ZSslFtdUfI Db2V9N/7DW4EK72W0bRT8ZFBIbIqjTeDXjp8NOyUvTDQyPAV9Hthdsq2S5CLkdbbbRd2ytZhqgW/ jscL77Ce2amYHlWlI0zXqhTJH3mBV4AwGfpDoLDrtlnxdBiebLuPWDLWdntFNq0PaZ9qndTnCNVT 65LZHa5HPrsn6PzoP/oUj7ebk6AoHIqrHHIbvcahs9mcTz26JxovMbZWJahYh/124yUbdfOsb6Q9 MWsmXS2m3XyrjRZHpFxKRZRebddbuKyWS+l0hCfWTZPGwoyyO6jzZmo33WZjrB/y8/MxrdY9v5+y qeEW1e6nZGPAfLt6PvNIYFvv7/7Grqz7Fus331IwxHSKyYngFkgP23i1j/MmNMF0l+p0tV93htCi pvPi3jteNJdp1x3I/cBvenAD3STTmxvojG5J1yNS1v19TuZou4cGko7yJebokKyTOxwHd8l1R4Ps d9Q+iNetk/VEudZPcLdu4Qp705v0W+8YYDLzDJu1He4Pporf51XCL75/mkC8nFdkXx76mtXLbru/ GdFpcpXUGR8Jb5PVfsyEe3I1E/PvwcEm7th1Mmy+Hrih3ffx6kQgfAKF0hpbEePJ4Yh3bPyxJV/w SOMdJZ6HhGMnUxOkk1aSB2hjHLQbr9gpOyjHnOP0T2ovd+9OmFpvTKn0midWKoZbg9m+K+Ds89nI KDoDbxkg4UdwG1yTKRW4xyyWA246TdftlN0UEyyxBprbaRivB8q9fviC5UboyrkYVbdT9jHJfI+P svnHnt26CKnA5rLB5g8QbY5HK97c8g3TMQzbNhGSHTkMU267fhDkeHOnTia2LcN04bzA8yPrfvDm YWiF8JVhs33ftMwcb94QbBphGBqGH5mha5iMIH4Jvnlj3BtinAe2bxpejVbOGOdu88J8ByoC/iz0 jYDRjSdCzjtXswZ456FjI8W8rQ7aeOfwF1Bztul7RhB5E4DndhQYiKfPvmQsccfrgY+DPtP1oGXT L9OB53ZEcd3jfXp+doVeZDhBv0t6LJ547kbQIOFed0I+4nlo2AgwJ58MpQ39QxdaHErQsm3DoJ9z Es9tb4IsKzJcD5qf6xq+7z045LntNa6xgTyHFusF0HTJ5/zQ88D3nACaIYGeP7b8tshFBSzyjgcZ sPRHLE4YmFYeAAxGLEFoeDZ0zr7pmDbcycHCI5YgMCy4RQy4TwIPbmH/c4lY8L6Hi4Oe14Nx0l1y xOJAb4h1YLlR6BiBac8csljQW+NwSb9cJGSJDCs0achie/0u6bHskMUKIPLCeQkE+b5/kZjFtYwA 3Br0czkxC/R32Bag6Bx/fChFj4cRs0ATh1iRfMwfsfiW5foQ/rkqYlERS+chc43FCWG4CiECcC2I APK+ZbkRC45aNi5F+JZj+FH0uUQsMBw4OJTbrmu6hsN6myVGLDAIRRjlWk4Irc53eupAQsRi+QEM e3gK/XKJiAW6fJNELDAaunb4OUQsHkQrhhdiqH+RiMV2Ddf0sT3j53IiFiOC3gaarmEGU5cgHkjA EpI1FvyYP2DxPNN2jCjqC1hU4KICF3rIDFxcGCRxhu+bLvTW4eIfDsFwEkA4AP1vCLJNK/xcAheI BlzLxC44CAMMJpcbuJClFrIQEZgQ7JrOzIGLA2G1h4EL+XKpwIVcoRXBAPeZLLXgXWNDB+FeKnDx Ao8ELl4w/jnM/IFLYEZYsUbImvvnFrj4nkVWWryp10ePiSsteHM5jq9WWlTA0nlIXWlxDMckAQA+ G3Icd+EBC8y2bbwh4apcmDb6PVsp6PFQAhbodm0bnw15pmsWT6KXGLDgcG5ipwiCcSVi7pUWaM4h uqNfLhKw4HI3LrDDcGvZ/S7psfyABcI9DFisfA1v5oAlMnCrnEE/FxSwhLjLxnKg5KLPM2CBDgMD lsAbv75VPqattLgWzCVMuCt7VlqK0OV4k37AtIX1kbyFvNP1lj8ex4SCzXqOvtOrRylrsTYcBfDk BpB3es9BpWvIViOJSDAXJokHGwUjmCIix32QbMXg7qhn/mgCfJ29nkRziRImLTRwzDJqgLzD+mb7 PmF5Hlvsi/LPISylTkr5HNHxGZplvNvGe5KfE/OYHatnCpbLC5YB7ah/+/3rN1/p5H/P8X94oa+/ fYOJpL7NZRT51Ei5nE83mAKaEiCbKUQRsMCvTm9JOsLYSgyrhPmeM6YZ1NcWs3FVRVGVKU170+VG NCFYkeyx5KuS2rH4+SqbAK0w/EpWVzFJPflJN/nTFKOGV0USvjMUh440WRD1VZEu5oApnBICCjps 4V9QdGwuBlUcwzwsAwSAjUOyI2Y6pFcg0Z90ETYFnP5TRtDaC1xCVec+vmuyK4UbIyYtJBT0XZLc 5bkYSzUOA8zxq1LrrIpqzdYlzCEbTNH1Fc3ClOvoFpVn75IqaiBl1yh5lVuF3CsC7IrmvdLXvrKq HXuHZB9Virpw7qquO2RYOKh7e/0BUU6HFQx9K+hH6xmY4P7lL0w8/bt4/Q6z6CGJm3hqyQyKuDnq GKRd7c4QoyMfhJxVkwg/XyeNzLIwy+fOB9omMfOCeaEyeSwHWK/AThCFLVbDTYG0lyHdGOtqyO+P 9Ru8pG53ON9bDb/89bcxNYwSW2tYMBXeUA2jvN4aJqnFW0hzuYfQioSoJ4QkQBwQggYhZRCv4Dzd /y09H1bdLE9ZSS+/o570t4c03qwxRVoGMiezGegtyGSxYDu9TTfbWlsSTd1PZqM5wylzkGHavv/1 +bdvnus//Pbq+zcvfn7F9NylW4TcJdcUglc1GArIaQsxN5jEDakFW4I31XO35RGfogMxbC8EHqty WxPqk+zLUuXWI+KJKj/Eh31jVvpJd8RCJcKO3V4hbGVHEhtflXwWJXoDMQDCfm4xILg6UKDMDkEW ONNA6ujj4sq+ROEkxL8EhIR6+uOxmz2SaenEn87PPj2S5MNpSS/KIpmWuwYqMpZyKqrLKoWb60Na b39l5BjVRGaUpONlqSyL9JWZ6uP27S4HYVTdCg5hDV5viXJIYIIVHlkWo2bESzYnZ8VK9O6vthQG 3eHw+6+ffksXoTDDN76Jf32Ib+Pj01/o6+Cv//zyaWhYTzFh6NMCG22gZb1Bw4GGSHL/Ur8MnYHu qRicn+PtnPx9DQVcY+FIg5mU6FBYd+djUvJNxtUUJ144xmEe0C2Jjtd354yJR4LWBrwKgzvT5B7+ B8FVpZygeVJako6e8vJoJP34kH74ko1C9BdHbR3vM/2UzZke2shbVL/N2z4n62csd6YJ78C//Pj8 1+eZ1vZSLmnlj7QmQcJKuoneUkGj0vMRxqcVonmwba3Wu/h4TMpJtWWFPEiUQz3v9umHfeZXZ371 zC8owhuxNSt6bnLKLd2nKL+lyR/mLkHDMyjH16ePHZ0KWbB7/fNX+k/P/ipaKhkJQae5/ikcASsR +2gSUryPd2daLm9XhElCMGEEBVo3Kql3gfb8JIe1oEtKJkMJSbwh8Xk7pEh8gv2GkSLq2Hbo0j7E MHQR1D3ErdnAQIIZ8uiSTL2pOiL07fkaGZen00f42NYB0RLWazckciIUclJZeCMi5Cmv0mNJBw4J 9E8l6/jlQHt87AmIfaKgDQVdkYJaZ5SSIZGgsmippN1SDglOE09JlVUxS6lQhjh1SB44NGQRUtmq IAStTvHhOu/85LGeGROtTO8mnkoqKFCteZ9LZENkKkqecBmfICDacMTbfVleB29EHmekHLjW6CL5 2LtPPtTYtm36yvQRedQRVnx1zgiKq+k6loR92J5uVul20wSZimZfpxVHXNPKQ1f6zy+eHUscPlTy Efrz7TpDqn5sIC8/6f8Ev4LhkFdJEZygZdI1U5fkoR8yVcmQf5tuznThNrm6QvYVPtlDDEFj+YeO KzKS5hfhEoQb59u7El2HLQllo/K7HImQkHFx9ZY8gj+uG12nBPpvI6z/I0E2oRzq9gnxi788Fopu 4uNNfN3yJHteRegWbmzwjHnM8m6+Joxs2Lu8MLpRsKaH9GAtNTezHuK2teZucV9ZWwnNK4i4bS2h PcwecJdHi8U5BaHbZPOEeG6TdUx+b6u2uWUVSOXW2uskf82rCrfubtcQBBP/UHB3JU0nGFHuoaTe vHimV4sI/nWXZATOllVN4WHuL2Ay67FzmGrmlTySSQ+b7R7RdxkENKOsEm1073PnvEC4qH47ZuW0 JdMD6CQLkhyb3T3/f7+8/PbFK/3/Pv/1u59fPyeyQOEe94VuN20rWeK7WvBBTFaBMEOGmTIGwr9A 1bGJwl2yJnxptpIFkg7x6gqGagSUXW9PDVSMrMXLMgWI+MlmTwy4gxKgGp/QFet8MoybkwgxFEbk pIV3Je9xBG5BekLWLkiA8Db5mOKzrZstghTPb7P1tZzYzTThrqGrAQCRcHv7IT3gRil0c3NI99v/ jNljcfZEuljZvULiHSFNfaDNQbaYrJWhn+IBJK4uf7hJcIn0AEUIIR9tZ3QuFpeeRoDE6+T33szR 0rqy62Sf4BMZCknK1krZNiVUsYKItLuTF1wC/9PzP//8tZ552GZsTjIZPVUmFtj+U/jBgZyBM9n4 NjlRBiwReU3RlRUIXu5F8AalIou7k/SipzIKL95dp1DlN7dMzl2a7jqe3MqXs99s3283hN+Ygczu 0rvzrlKJ9NUW8vh0G9cfCgkifKmgzMN7XIRMYEIBnQBOujoVVfejyFVUTJxzJ1BQZAclbt4/Vrsu 0qSyxgfqbt7G3Q9R9OnPUa5XYJE+Q6mpyxddH8FfPGp5kKLpWxw8e+RMF0MsMjmtYshfdMiBkfwa 95xAj4qLk9Jn7s9ywziKZO50XH7FqsG4+P6Hun/9GWIW+pDpjHQ8Nt5dQQM/QT+ESt8d3sIE/phs 90eyVC29oIhSGE5Ip/hvyQE6g/RYWqLGLeJnaPdvyYofkkxxwxhKeoKbGPfHLd6rmdKMyX4DLaax 30PeIltuPus1c9XUfVXLu+Rjs9XDMP/i5fOvn56Ph6e7dB3voEEff989TU7rp3CuZ8BZp/jtCC14 NgsQWrTo+NJAFgASUYf3XRth9FI2bcEC6iyc7RqF7Na07XdlqIe+gEtBIYTsB6IPzHbZIiPMIciq MG53zDScPt71dY7SNOS7HMgDMQiWsirDhVhsyHgPIilhS5+E5AJbtz7IE5g3oXh/fc7g07RjyB1j j5AH75moFOKsuO0hnlxRpBwYoBMmWmR5P3dOd74eqSQIISBg74jK55ZE45dMSXNn9AWVdDxjxM4/ 2a/izQbDmbZJwj9LkoX9YnbvH/QXv+iZy8fJ8UuMhakQ+Iai0mvoA/b7ZN0a6ooPK2SXFHmecDwT 8jPMYfTCYyZhgw/Y93WuOrNxPEGXwbliXn2qUHjBOiueUGVrCUxN9wNy7JyvV3iGVDWFR9SF5nGs OOZ6jp11JKmC9hu6Y/OYECY37vBf785k/9kmi9iYGBbAtVqTIYYUDvPCnkaxN2A2OsSf5GlQcks3 g6Eo5HIckHLzNoU45GPNKpv0cYrKa6ywD6rA7TVhKNMumgkhT2dBCyqUXVXZKgDzwbZukY2c5ced LU+oURs2qe7dt8X2rCdf/PXJF7dPvtisvvjxi5++eG0MN/dSIZEgi7i5w+j1sG9t0q2RoaxyyltR 0RFms8biNkIVTMxuu09w4fJq+/cWa19wh6rkdAQ3H1IylaZjBHmmQ5zRpQnSvLF8UAYVhPst2R2w yts6syj44kpjl2Cxo6B1e0j8NoU5eLYox7TgA1B8nyDJ7gOjEE7vxZpq4vku3ndFB6NKkryqSN5j KOlgCzW4BQs96/EJhz2qmuyvpY+1KcO7obYrtpt/Z2tFCtlK0dpryOs3qI+pvUb2WKJVmjRl2X7L idIO6YneIli8DduW64psl8rfps37Lp35o20/Xa/Ph2yx9RXeTOcTwtArwlpW7PB5u82vbLKwd9td Sph+VFrzvizb3kNcz6usskyGMzp82Ffcp5Xmnv+8pVnJalTr8y1ZIXyfTG1Xp8N5D1PDZIX7W1jR ylL3JjMO3S7KwKdobGwkJYajFRmyso26+FsmAvThDmmI3vFSVh/SwzvowG6rDizfCblfHWx5+QIc YGBK+0+yno4DeklHtks324sDpw3MKGTt9Gq+n1Xa716SkIkiRYzvZTEyZU2U0ObKHlFH+PfuFO+T 9HzcfaQb8Wl157u0sxZYvEpN9B5vV/W33AqHvsCenX69ZH8OdYwC6cB/hZv86D42GFFPh3j9jtzM TOgh2bU+LIGCFXlzuldoyza6kYLZm1/xofEaBmkJ3Hor601NxfkbYeD4TLrFTBFZIcend4cVxOjX lT1jUNfcb4V2KCrc6dRdpoK8wfAu+djS5D7pjsgzlP5yoS8joOOsPHCrMb1XyzsVmSlf4M3o/iZF /JJXJqs7H1ETxOwQQSWbVeUtGmbUnq1Tq/UfTEZ9DyRKhLFt/W61Se6qmw4zHzgwyOwyiDedeCMZ AfJIA9TcxccjDE8bfI3t8PGusWAg4XEzsZs7Ik67HivnZ3muQCsuFcGb73+h3srxA1lWg0EcGwzU 0gqTdHS/TC340HaflvPjFKkHiGvcBpptQd22PFITfP7yEi4UHweRVlh4gQAhc42P2dLiIQy0001K x7LWV3aga+EVQ0+f8MJOjCFusQUN7qer5LTGLZf5sIeKE7ogt+pYeRRuvSSbCi635flTyPbw+O6E j7kzr9n+JlKY5fWTQ3IN3fTVLn6fti6KftLjzXsMzKZuEM/VsfIETxBCH3Bz14EuDOqPqN9HoOOY YDqfxhbnkqF/wseHXzHELL+OI9TQbZw5zJ4g4VBPH0zmM2p8Zkr/9Mnv53hHdsMQneQB4AVeqM16 gsfsDZ8vu9+szUSxx00tVkPD4k+XUx5vM1WZK/RNbt0VSxXQcrJjBz73k+/WHWhZd5FNJphrMp14 +7EkE+XhOuVpdZt28NWFp2C/QgdYLhnqcIcvpx1/30EYdJPAFJJMbVp8C6YGoItYcONn4SudV9Hl dloYbLkahlR8hQ+GfZYtC+/+47EfES/tVbXXr1/WZlGYM2ATw6COOznoO8PZZtSjHNd/NAzjjzoz SbYZFBtRQVK235TWVL6E0P7CnLxtlCzeAcfpBxwp2LOJx7Wl0i/JCLP/WHk8QRY4VjT1Bl2JrDsS fTcl3eFGqSNNtPGE+iitcuDjJfbGIYaL77enj7murGFl1TiPrpIWurc4W3AussAdcz0wzCQnXHfJ +scjGSil6Pn35JDishCVBfVYLaOsLwAB6LIQlH5orTaZBQQ+JlYb0bjKLqUSBcgJTardYy7qSeYR G38l9dvxDHMm8gYtViCctamuAcnbgFdZ7GHPco67FIsxc02f7TJFKO+0voNpLcybdtv3CTb6cyP3 kpi8nxqzNpwh5C5BGpmt3W5PLXK2m119h5Rw11XNU7E9Hs94u1VEtSnBTInv413JlGQlvcWS3N51 ByUkJJptkQ59p/jGXiM0yRbojlnshAny/r1nlfyT/qef3vDPZ8pr6CwLJX3Lj+7+wVqkC15ZTkvy si3+Jdylt+SlFVzrSjCd9PaqIzmKYL/1J/rEDTMa4cvG1yT5Tf4uhv7yxes3z18Rla9+fvPih7/m mjrf7ZEQtODOzfITVjrSQJeQng9rXLfONlahBhqBd71lWxiV9bYtW5MueYQpau2925qi8nu10kpp QFH9bVsmCUt1tcd3HJLfya5wiZLeYJB31B/hFPObV7+9fPkIt5WSf+ovXuvkJ6DjvN/+HdrP+l1y at2eI/HN7dw6ZR3gz34D7082KclOQ0Xkj7/pK92bmkTM0lZ/30+exPQDefGLOskWOJoSa5JgOCTZ gMtr9J90zxLYTFCSFJO9XXrZSZ+w1jyhFcuC485gytCaiObWb7qoK/QoYEKK0JocslYGLbG8lUl4 jbkshyQkJctd2OBPWzrW5fk0G1putrWASTCVYYeWK5LcMNusQ0fi/FXxhiZsaVVNs5QP2Ynfo+tD vOuLWiQ+W6w+o3tC1DHPeHdVlljwCv7y7ctMIL7GtrpNTjdpW2ZvfCaJr2DEAy/VdQqk8xi624X4 yJ8Tw39rlgotT+V6PpVenmt7il21b0W+lAQF/U+06QtrqIY8NsQe4j9hygjlcgsFvWl7FithCriH aORMctrmmaTuMGVl5pU2wRsYmMlM5rGFaPouZuKTP+j/sdlOYvHgWn6Mr/ngA9z/+h/cJfL8CCVx G+tdifpfpd17q+GcN9u7lHzRn6X7lP6MHm/it+CkyOTPk3L/Xxpfuu1oOlt5/qTH14fzXYxLMinZ oEY5Mf2V89/7DW4AK72O0bRT8ZEBIrKqjDeDXjp8NOyUvTDqyPAV9Hthdsq2S8CLkdbbbRd2ytZh igW/jscL77Ce2amYHlWlI0zXqhQpIHmBV+gwGQZEoLDrtlnxdBiebLuPXjLWdntFNq0PaZ9qndQn qi7dblPLpa0uc7sDpcFrd7h98Nkln7QwNulhWtvrs3uCzpr+o68kxtttJVxNLN/cRq9x6Bw3575W MdF4mSFWoqR12G83XrJRN8/6ctqUWfPraont5ltttDgi5VIqovRqu97CZbVcSqcjPLFumjQWZpTd 8Z03f7vpNhtj/ZCfn49pte75/ZRNDbeodj8lGwPm29Xzmd9u/r5a7+/+xq6s+xbrN99SMMR0ikmU 1tjVbOPVPs6b0ATTXarT1X7dGeqLms6Le+940VymXXcgRwW/6cGNfpNMb26gM7olXY9IWff3OZmj 7R4aSDrKl5ijQ7JO7nB83SXXHQ2y31F70FG3TtY95Vo/wd26hSvsTcPSb71jgMnMM7zXdrg/mCp+ n1cJv/j+aQ3xcl6R/YPoa1Yvu+3+ZkSnyVVSZ3x0vU1W+zELA5OrmZh/Dw42ccfumGHz9cAN7b6P VycCEBQolNbYihhPDke8Y+OPLXmNRxrvKPE8JBw7+ZsgnbSSPEAb46DdeMVO2UGDW8upvqO93L07 YQrAMaXSa55YqRhuDWb7roCzz2cjo+iKQcsACT+C2+CaTNXAPWbbHHDTabpup+ymmGCJNdDcTsN4 PVDu9cMXLDdCV87Fs7qdso9J5nt8lM0/9tzmYumTPyheu3xe+wMFtncg273QMAlS2XdszwgYet0J LNvtQbbbjoH/GbYXRKZlRG5waWa7DdJ91wgZfD10EAWeM9v9mmLHMhzTJWjzKPIMK7SWDG13nNCI gnZoe1CHLYdQFqFhRJHjR4YXXBTabtmRC7XgmW210KS2W44BrQNOc60Qmo0TuROw7Y4TGY6H3Gzy hQHRI4Ycd6JG0USWEfhQNtmX6dh2B1R69hSf8Neug2d4phGF7oPDttdvdfh75NZ7LlyRx0dtj4wA b1jymeHAA8fK8ehuswTtICKgePick9qOkPLRsuzQCE2oWNc0fN99cNj2nMReXGMd227DHekEUCTk c35wu+2FoRVBgbo95PYLhC6DVzXxUKGL5KMvcnHMwPMiI/JGRi4B3MbQ6KA3C0wrgLbuLjxy8R0Y ZQMcMyM/cA0nDD6XyAUG8wijAT+MbB+HmQVHLlADlg/DRWB6pmf4nj1r4GJb4MPB+Jp+uUTg4tv0 Cq3AhhP8Bx+4WLYRwjUZEEoEjn2RyMWN4OaGSQb9XE7k4kMkCu0Pbk0rP+GzilxgXmFh5EI/549c YPCIAt9wYKDpjlzU4ouKYNghc+3F94wQGh/MRjxceon8pQcwMJ64Fum6g8Dw7egzil9MvDDHdcMQ hmp/2fGLHWBAEcKJBnaNs8YvpmOgOiP7cpGFF7ibQoxf4Av84YOPX+DvMezHVZAovMzCSwC9CVQa /VxM+AKztDCA5udCv2d+lgsveIXkniaf84cvoeXa0AwDqyd6+V/qUIc61KEOdahDHZ/Z8f8BDLtF cQDQAgA= ------=OPENWEBMAIL_ATT_0.547397314894141-- From pgsql-performance-owner@postgresql.org Mon Mar 13 14:51:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B4E429DCA4F for ; Mon, 13 Mar 2006 14:51: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 19460-04 for ; Mon, 13 Mar 2006 14:51:03 -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 BCA259DCC3E for ; Mon, 13 Mar 2006 14:51:01 -0400 (AST) Received: (qmail 10028 invoked by uid 500); 13 Mar 2006 18:52:08 -0000 Date: Mon, 13 Mar 2006 12:52:08 -0600 From: Bruno Wolff III To: "Craig A. James" Cc: Alvaro Herrera , pgsql-performance@postgresql.org Subject: Re: No vacuum for insert-only database? Message-ID: <20060313185208.GA5558@wolff.to> Mail-Followup-To: Bruno Wolff III , "Craig A. James" , Alvaro Herrera , pgsql-performance@postgresql.org References: <44158989.6020103@modgraph-usa.com> <20060313150949.GK8274@surnet.cl> <4415A9A4.5020903@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4415A9A4.5020903@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.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/167 X-Sequence-Number: 17604 On Mon, Mar 13, 2006 at 09:19:32 -0800, "Craig A. James" wrote: > Alvaro Herrera wrote: > >>If I only insert data into a table, never update or delete, then I should > >>never have to vacuum it. Is that correct? > > > >You still need to vacuum eventually, to avoid transaction Id wraparound > >issues. But not as often. > > Thanks. Any suggestions for what "not as often" means? For example, if my > database will never contain more than 10 million rows, is that a problem? > 100 million rows? When does transaction ID wraparound become a problem? I believe it is at billion (10^9). From pgsql-performance-owner@postgresql.org Mon Mar 13 15:16:56 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 032179DCD7F for ; Mon, 13 Mar 2006 15:16: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 23828-05 for ; Mon, 13 Mar 2006 15:16:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id 01D0C9DCD8D for ; Mon, 13 Mar 2006 15:16:52 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 9102598; Mon, 13 Mar 2006 11:19:50 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison Date: Mon, 13 Mar 2006 11:15:00 -0800 User-Agent: KMail/1.8 Cc: "andremachado" References: <20060313175614.M17691@techforce.com.br> In-Reply-To: <20060313175614.M17691@techforce.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603131115.01056.josh@agliodbs.com> 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: 200603/168 X-Sequence-Number: 17605 Andre, > http://candle.pha.pa.us/main/writings/pgsql/hw_performance/ > brought some light over the subject. For few users, could be a viable > alternative. That article is very old. Read this instead: http://www.powerpostgresql.com/PerfList > select count(distinct NF.ID_NF ) as contagem, DE.AM_REFERENCIA as campo > from DECLARACAO DE inner join CADASTRO CAD on > (CAD.ID_DECLARACAO=DE.ID_DECLARACAO) > inner join NOTA_FISCAL NF on (NF.ID_CADASTRO=CAD.ID_CADASTRO) > inner join EMPRESA EMP on (EMP.ID_EMPRESA=DE.ID_EMPRESA) > inner join ARQUIVO_PROCESSADO ARQ on (ARQ.ID_ARQUIVO=DE.ID_ARQUIVO) > group by DE.AM_REFERENCIA > order by DE.AM_REFERENCIA > > firebird windows executed in 1min30s > postgresql windows is running for 3 hours and still not finished. How about an EXPLAIN? And, did you run ANALYZE on the data? > I already know that count() is VERY performance problematic in > postgresql. Is there a way to work around this? > Unfortunately, the deadline for my friend project is approaching and he > is giving up postgresql for firebird. > If some work around is available, he will give another try. But i > already saw that count and joins are still problem. > He asked me if other people are struggling with poor performance and > wondered if all other users are issuing simple queries only. No, actually we excel at complex queries. Some of the data warehousing stuff I run involves queries more than a page long. Either you're hitting some Windows-specific problem, or you still have some major basic tuning issues. That being said, there's nothing wrong with Firebird if he wants to use it. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Mar 13 15:18:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CD94E9DCDB6 for ; Mon, 13 Mar 2006 15:18: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 25400-04-2 for ; Mon, 13 Mar 2006 15:18:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id AE50C9DCD93 for ; Mon, 13 Mar 2006 15:18:44 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 9102639; Mon, 13 Mar 2006 11:21:41 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: No vacuum for insert-only database? Date: Mon, 13 Mar 2006 11:16:53 -0800 User-Agent: KMail/1.8 Cc: Alvaro Herrera , "Craig A. James" References: <44158989.6020103@modgraph-usa.com> <4415A9A4.5020903@modgraph-usa.com> <20060313174135.GA16213@surnet.cl> In-Reply-To: <20060313174135.GA16213@surnet.cl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603131116.53998.josh@agliodbs.com> 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: 200603/169 X-Sequence-Number: 17606 Craig, > Transaction ID wraparound will be a problem at a bit less than 2 billion > transactions. So if you vacuum the table every 1 billion transactions > you are safe. I suggest you read the "routine maintenance" section in > the docs; the wraparound issue is explained there. For reference, we calculated on a data warehouse with about 700 million rows in the main fact table that we had 6 years until XID wraparound. Mind you, that's partly because all of our rows were inserted in large batches of 100,000 rows each. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Mar 13 16:02:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A974C9DCDAE for ; Mon, 13 Mar 2006 16:02: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 34260-04 for ; Mon, 13 Mar 2006 16:02:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 3761D9DCD9C for ; Mon, 13 Mar 2006 16:02:25 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Mon, 13 Mar 2006 20:02:26 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 13 Mar 2006 14:02:26 -0600 Subject: Re: firebird X postgresql 8.1.2 windows, performance From: Scott Marlowe To: andremachado Cc: pgsql-performance@postgresql.org In-Reply-To: <20060313175614.M17691@techforce.com.br> References: <20060313175614.M17691@techforce.com.br> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142280146.2087.7.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 13 Mar 2006 14:02:26 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.149 required=5 tests=[AWL=0.148, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.149 X-Spam-Level: X-Archive-Number: 200603/170 X-Sequence-Number: 17607 On Mon, 2006-03-13 at 12:11, andremachado wrote: > Hello, > Attached is the text file containing the last rounds of configurations. > This time, used "show all" just before issuing each relevant "explain analyze" > to ensure available information. > Note that the last runs are being executed concurrently with other problematic > query that is consuming 100% cpu for HOURS. > Some people suggested to reduce shared buffers, but for few users (1 or 2 > simultaneously for this app, as my friend told me), it could be large. > > http://candle.pha.pa.us/main/writings/pgsql/hw_performance/ > brought some light over the subject. For few users, could be a viable alternative. > > But, despite these huge improvements in speed, there are other problematic > queries with postgresql. > One of them is: > > select count(distinct NF.ID_NF ) as contagem, DE.AM_REFERENCIA as campo > from DECLARACAO DE inner join CADASTRO CAD on > (CAD.ID_DECLARACAO=DE.ID_DECLARACAO) > inner join NOTA_FISCAL NF on (NF.ID_CADASTRO=CAD.ID_CADASTRO) > inner join EMPRESA EMP on (EMP.ID_EMPRESA=DE.ID_EMPRESA) > inner join ARQUIVO_PROCESSADO ARQ on (ARQ.ID_ARQUIVO=DE.ID_ARQUIVO) > group by DE.AM_REFERENCIA > order by DE.AM_REFERENCIA > > firebird windows executed in 1min30s > postgresql windows is running for 3 hours and still not finished. > > I already know that count() is VERY performance problematic in postgresql. > Is there a way to work around this? Well, it's not uncommon in mvcc databases. My testing against Oracle 9.x series showed little difference on similar machines. In fact, my workstation running PostgreSQL was faster at count() queries than our old Sun 420 running Oracle, which has much more memory. Can we see an explain output and schema (if needed) for this query? Just plain explain, not analyze, since, like you said, it's been running for hours. I'd like to just add, that if you use any database long enough, you'll eventually come up with queries that it runs slow on that other databases run quickly on. It's just the nature of the beast. That said, I've never seen a team work so hard to fix poorly performing queries as the guys that write PostgreSQL. If there's a natural, basic fix to the problem, you'll see it pretty quick, whether that be in the query itself, the planner, or the execution of the query. And if it's just not possible in PostgreSQL, you'll usually hear that pretty quick too. From pgsql-performance-owner@postgresql.org Mon Mar 13 19:51:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B3CCD9DCDC0 for ; Mon, 13 Mar 2006 19:51: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 92773-06 for ; Mon, 13 Mar 2006 19:51:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (unknown [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id 74F009DCD90 for ; Mon, 13 Mar 2006 19:51:46 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Mon, 13 Mar 2006 18:49:41 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B2466@morpheus.bostonstock.com> From: "mcelroy, tim" To: "'pgsql-performance@postgresql.org'" Subject: PG Statistics Date: Mon, 13 Mar 2006 18:49:39 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C646F8.CA9C655E" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.171 required=5 tests=[AWL=0.170, HTML_MESSAGE=0.001] X-Spam-Score: 0.171 X-Spam-Level: X-Archive-Number: 200603/171 X-Sequence-Number: 17608 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C646F8.CA9C655E Content-Type: text/plain; charset="iso-8859-1" Good evening, Does anyone know how much of a performance hit turning stats_block_level and stats_row_level on will incur? Do both need to be on to gather cache related statistics? I know the annotated_conf_80 document states to only turn them on for debug but if they're not that performance intensive I cannot see the harm. Thank you, Tim McElroy ------_=_NextPart_001_01C646F8.CA9C655E Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable PG Statistics

Good evening,

Does anyone know how much of a performance hit = turning stats_block_level and  stats_row_level on will = incur?  Do both need to be on to gather cache related = statistics?  I know the annotated_conf_80 document states to only = turn them on for debug but if they're not that performance intensive I = cannot see the harm.

Thank you,
Tim McElroy

------_=_NextPart_001_01C646F8.CA9C655E-- From pgsql-performance-owner@postgresql.org Mon Mar 13 20:19:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 63AC19DC85A for ; Mon, 13 Mar 2006 20:19: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 98245-01 for ; Mon, 13 Mar 2006 20:19:14 -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 660FA9DC856 for ; Mon, 13 Mar 2006 20:19:08 -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 k2E0Is3x095291 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 13 Mar 2006 17:18:58 -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 k2E0Isd7090879; Mon, 13 Mar 2006 17:18:54 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k2E0IrAv090878; Mon, 13 Mar 2006 17:18:53 -0700 (MST) (envelope-from mfuhr) Date: Mon, 13 Mar 2006 17:18:53 -0700 From: Michael Fuhr To: "mcelroy, tim" Cc: "'pgsql-performance@postgresql.org'" Subject: Re: PG Statistics Message-ID: <20060314001853.GA90740@winnie.fuhr.org> References: <0C4841B42F87D51195BD00B0D020F5CB044B2466@morpheus.bostonstock.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B2466@morpheus.bostonstock.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: 200603/172 X-Sequence-Number: 17609 On Mon, Mar 13, 2006 at 06:49:39PM -0500, mcelroy, tim wrote: > Does anyone know how much of a performance hit turning stats_block_level and > stats_row_level on will incur? Do both need to be on to gather cache > related statistics? I know the annotated_conf_80 document states to only > turn them on for debug but if they're not that performance intensive I > cannot see the harm. I ran some tests a few months ago and found that stats_command_string had a significant impact, whereas stats_block_level and stats_row_level were almost negligible. Here are my test results: http://archives.postgresql.org/pgsql-performance/2005-12/msg00307.php Your results may vary. If you see substantially different results then please post the particulars. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Mon Mar 13 20:53:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D313C9DCDBC for ; Mon, 13 Mar 2006 20:53: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 01778-09 for ; Mon, 13 Mar 2006 20:53:35 -0400 (AST) X-Greylist: delayed 00:10:00.414942 by SQLgrey- Received: from barracuda.tecarta.com (66.238.115.136.ptr.us.xo.net [66.238.115.136]) by postgresql.org (Postfix) with ESMTP id DCB579DCDBB for ; Mon, 13 Mar 2006 20:53:29 -0400 (AST) X-ASG-Debug-ID: 1142296677-3314-93-0 X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi Received: from [10.0.0.174] (adsl-63-193-127-22.dsl.snfc21.pacbell.net [63.193.127.22]) by barracuda.tecarta.com (Spam Firewall) with ESMTP id 54D6B2003DAF; Mon, 13 Mar 2006 16:37:57 -0800 (PST) X-ASG-Orig-Subj: Re: [PERFORM] PG Statistics Subject: Re: PG Statistics From: Steve Poe To: "mcelroy, tim" Cc: "'pgsql-performance@postgresql.org'" In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B2466@morpheus.bostonstock.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B2466@morpheus.bostonstock.com> Content-Type: text/plain Date: Mon, 13 Mar 2006 16:37:51 -0800 Message-Id: <1142296671.11790.28.camel@amd64-gentoo-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit 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.9717 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: 200603/175 X-Sequence-Number: 17612 Tim, When I have done ODBC load tests with stats_block_level enabled on (20 mins. per test), I've seen about 3-4% performance hit. Your mileage may vary. Steve Poe On Mon, 2006-03-13 at 18:49 -0500, mcelroy, tim wrote: > Good evening, > > Does anyone know how much of a performance hit turning > stats_block_level and stats_row_level on will incur? Do both need to > be on to gather cache related statistics? I know the > annotated_conf_80 document states to only turn them on for debug but > if they're not that performance intensive I cannot see the harm. > > Thank you, > Tim McElroy > From pgsql-performance-owner@postgresql.org Mon Mar 13 20:40:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 736C89DC89A for ; Mon, 13 Mar 2006 20: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 01612-01 for ; Mon, 13 Mar 2006 20:40:15 -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 8EC679DCDBE for ; Mon, 13 Mar 2006 20:40:10 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1477853nzn for ; Mon, 13 Mar 2006 16:40:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding; b=W3Yv/M31mLiD5/EwsDc/4iiVSx7qVzHf/MXy3KAyXf3KVe7zP1MAX7sJwd73c/jvoO6VkUzMZiiiSCjvdhrZhT6JdgDzL9L8vRoqJV+mi8FnQhbETbVovaC24TaD7lhrJXozFb/Gbm1Ron1+oKObwgwt8DQxeJF9nxhyKqPUzTA= Received: by 10.36.24.18 with SMTP id 18mr881028nzx; Mon, 13 Mar 2006 16:40:10 -0800 (PST) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 40sm618608nzf.2006.03.13.16.40.09; Mon, 13 Mar 2006 16:40:10 -0800 (PST) Message-ID: <441610EB.7070001@gmail.com> Date: Tue, 14 Mar 2006 11:40:11 +1100 From: Chris 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: import performance Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/173 X-Sequence-Number: 17610 Hi all, I'm trying to work out why my 8.1 system is slower than my 7.4 system for importing data. The import is a lot of "insert into" commands - it's a converted database from another system so I can't change it to copy commands. My uncommented config options: autovacuum = off bgwriter_all_maxpages = 15 bgwriter_all_percent = 10.0 bgwriter_delay = 2000 bgwriter_lru_maxpages = 10 bgwriter_lru_percent = 5.0 checkpoint_segments = 10 commit_delay = 100000 commit_siblings = 500 temp_buffers = 500 wal_buffers = 16 max_connections = 16 shared_buffers = 256 (I was playing around with the bgwriter stuff to see if it made any differences, so I could be making it worse). It's a pretty small machine - 2.6GHz with 512M RAM. My main concern is 7.4 on a smaller machine with less memory is faster to import this data. Suggestions on what I need to do would be fantastic, thanks! -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Mon Mar 13 20:48:36 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3182B9DC86C for ; Mon, 13 Mar 2006 20:48: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 01292-06 for ; Mon, 13 Mar 2006 20:48:39 -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 680759DCC73 for ; Mon, 13 Mar 2006 20:48:32 -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 k2E0mToE016345; Tue, 14 Mar 2006 11:48:29 +1100 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id k2E0mS1q016342; Tue, 14 Mar 2006 11:48:28 +1100 X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs Date: Tue, 14 Mar 2006 11:48:28 +1100 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: Chris cc: pgsql-performance@postgresql.org Subject: Re: import performance In-Reply-To: <441610EB.7070001@gmail.com> Message-ID: References: <441610EB.7070001@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.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200603/174 X-Sequence-Number: 17611 On Tue, 14 Mar 2006, Chris wrote: > Hi all, > > I'm trying to work out why my 8.1 system is slower than my 7.4 system > for importing data. > > The import is a lot of "insert into" commands - it's a converted > database from another system so I can't change it to copy commands. > > > My uncommented config options: > > > autovacuum = off > > bgwriter_all_maxpages = 15 > bgwriter_all_percent = 10.0 The above is a bit high. > bgwriter_delay = 2000 This too. > bgwriter_lru_maxpages = 10 > bgwriter_lru_percent = 5.0 > > checkpoint_segments = 10 > > commit_delay = 100000 > commit_siblings = 500 Way too high > > temp_buffers = 500 > > wal_buffers = 16 Make this at least 64. > > max_connections = 16 > > shared_buffers = 256 Make this higher too. If this is a dedicated machine with 512 MB of ram, set it to something like 125000. You may need to adjust shared memory settings for your operating system. See the manual for details. Thanks, Gavin From pgsql-performance-owner@postgresql.org Mon Mar 13 20:57:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 705FE9DC9E2 for ; Mon, 13 Mar 2006 20:57: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 02513-04 for ; Mon, 13 Mar 2006 20:57:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id 3209D9DC89A for ; Mon, 13 Mar 2006 20:57:02 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 85707515; Mon, 13 Mar 2006 16:57:05 -0800 From: "Dave Dutcher" To: "'Gavin Sherry'" , "'Chris'" Cc: Subject: Re: import performance Date: Mon, 13 Mar 2006 18:57:05 -0600 Message-ID: <000001c64702$36ad6dc0$8300a8c0@tridecap.com> 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.2627 In-Reply-To: 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=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/176 X-Sequence-Number: 17613 [Snip] > > > > shared_buffers = 256 > > Make this higher too. If this is a dedicated machine with 512 MB of ram, > set it to something like 125000. > > You may need to adjust shared memory settings for your operating system. > See the manual for details. > Whoa. Maybe I'm wrong, but isn't each buffer 8192 bytes? So you are suggesting that he set his shared buffers to a gigabyte on a machine with 512 MB of ram? Or was that just a miscalculation? Dave From pgsql-performance-owner@postgresql.org Mon Mar 13 21:00:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5403E9DC890 for ; Mon, 13 Mar 2006 21:00: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 01292-10 for ; Mon, 13 Mar 2006 21:00:30 -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 9070D9DC85A for ; Mon, 13 Mar 2006 21:00:24 -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 k2E10KS8016430; Tue, 14 Mar 2006 12:00:20 +1100 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id k2E10JnW016427; Tue, 14 Mar 2006 12:00:19 +1100 X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs Date: Tue, 14 Mar 2006 12:00:19 +1100 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: Dave Dutcher cc: "'Chris'" , pgsql-performance@postgresql.org Subject: Re: import performance In-Reply-To: <000001c64702$36ad6dc0$8300a8c0@tridecap.com> Message-ID: References: <000001c64702$36ad6dc0$8300a8c0@tridecap.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.025 required=5 tests=[AWL=0.025] X-Spam-Score: 0.025 X-Spam-Level: X-Archive-Number: 200603/177 X-Sequence-Number: 17614 On Mon, 13 Mar 2006, Dave Dutcher wrote: > [Snip] > > > > > > shared_buffers = 256 > > > > Make this higher too. If this is a dedicated machine with 512 MB of > ram, > > set it to something like 125000. > > > > You may need to adjust shared memory settings for your operating > system. > > See the manual for details. > > > > Whoa. Maybe I'm wrong, but isn't each buffer 8192 bytes? So you are > suggesting that he set his shared buffers to a gigabyte on a machine > with 512 MB of ram? Or was that just a miscalculation? One to many zeros. Oops. Gavin From pgsql-performance-owner@postgresql.org Mon Mar 13 21:24:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7231A9DCDEE for ; Mon, 13 Mar 2006 21:24: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 06014-05-2 for ; Mon, 13 Mar 2006 21:24:23 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) by postgresql.org (Postfix) with ESMTP id 1C6299DCBD5 for ; Mon, 13 Mar 2006 21:24:17 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 14so1445702nzn for ; Mon, 13 Mar 2006 17:24:21 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=PcRZt+717ppXVVBhTxP8TDfXsG/k7S1d8QcziOx9zjr7OVPCZsRk8OhW9JGUw9t4c/Hv+OHvlprblCeyVxAwnjp3xtbtCFzDhRibj5e4NAKZ0FRyqFrmwSmN7pV3y2C4ifZ6U4ooGeS44cqH8QgipmNamDLDRQWy6LscZVk+lnM= Received: by 10.36.247.71 with SMTP id u71mr1736546nzh; Mon, 13 Mar 2006 17:24:21 -0800 (PST) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id r15sm263941nza.2006.03.13.17.24.20; Mon, 13 Mar 2006 17:24:21 -0800 (PST) Message-ID: <44161B46.5050801@gmail.com> Date: Tue, 14 Mar 2006 12:24:22 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gavin Sherry CC: pgsql-performance@postgresql.org Subject: Re: import performance References: <441610EB.7070001@gmail.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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/178 X-Sequence-Number: 17615 Gavin Sherry wrote: > On Tue, 14 Mar 2006, Chris wrote: > > >>Hi all, >> >>I'm trying to work out why my 8.1 system is slower than my 7.4 system >>for importing data. >> >>The import is a lot of "insert into" commands - it's a converted >>database from another system so I can't change it to copy commands. >> new config variables... autovacuum = off bgwriter_all_maxpages = 15 bgwriter_all_percent = 2.0 bgwriter_delay = 500 bgwriter_lru_maxpages = 10 bgwriter_lru_percent = 5.0 checkpoint_segments = 10 checkpoint_timeout = 300 commit_delay = 10000 commit_siblings = 10 fsync = on lc_messages = 'en_US.UTF-8' lc_monetary = 'en_US.UTF-8' lc_numeric = 'en_US.UTF-8' lc_time = 'en_US.UTF-8' log_connections = on log_destination = 'syslog' log_disconnections = on log_duration = on log_statement = 'all' max_connections = 16 redirect_stderr = on shared_buffers = 12500 silent_mode = off stats_command_string = off syslog_facility = 'LOCAL0' syslog_ident = 'postgres' temp_buffers = 500 wal_buffers = 256 I changed a couple of things and restarted postgres before trying again. Still getting pretty insert times :( INSERT 0 1 Time: 1251.956 ms INSERT 0 1 Time: 700.244 ms INSERT 0 1 Time: 851.254 ms INSERT 0 1 Time: 407.725 ms INSERT 0 1 Time: 267.881 ms INSERT 0 1 Time: 575.834 ms INSERT 0 1 Time: 371.914 ms INSERT 0 1 The table schema is bare: CREATE TABLE ArticleLive_articlepages ( PageID serial not null, ArticleID integer default '0', SortOrderID integer default '0', Title varchar(100) NOT NULL default '', Content text, PRIMARY KEY (PageID) ); (I know the fields will be lowercased...). -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Mon Mar 13 21:32:10 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 322559DC85A for ; Mon, 13 Mar 2006 21:32: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 08014-04 for ; Mon, 13 Mar 2006 21:32:13 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id B02959DC855 for ; Mon, 13 Mar 2006 21:32:07 -0400 (AST) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr4.postgresql.org (Postfix) with ESMTP id 2A3115AF024 for ; Tue, 14 Mar 2006 01:32:11 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id k2E1VwfO011223; Mon, 13 Mar 2006 19:31:58 -0600 Date: Mon, 13 Mar 2006 19:33:18 -0600 From: Frank Wiles To: Chris Cc: swm@alcove.com.au, pgsql-performance@postgresql.org Subject: Re: import performance Message-Id: <20060313193318.61709662.frank@wiles.org> In-Reply-To: <44161B46.5050801@gmail.com> References: <441610EB.7070001@gmail.com> <44161B46.5050801@gmail.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.074 required=5 tests=[AWL=0.074] X-Spam-Score: 0.074 X-Spam-Level: X-Archive-Number: 200603/179 X-Sequence-Number: 17616 On Tue, 14 Mar 2006 12:24:22 +1100 Chris wrote: > Gavin Sherry wrote: > > On Tue, 14 Mar 2006, Chris wrote: > > > > > >>Hi all, > >> > >>I'm trying to work out why my 8.1 system is slower than my 7.4 > >>system for importing data. > >> > >>The import is a lot of "insert into" commands - it's a converted > >>database from another system so I can't change it to copy commands. Are you on the same hardware specifically in your disk subsystem? Anything else different about how the two servers are used? --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Mon Mar 13 21:42:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 235C99DCDBB for ; Mon, 13 Mar 2006 21:42: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 09070-06 for ; Mon, 13 Mar 2006 21:42:23 -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 7D48E9DCDBC for ; Mon, 13 Mar 2006 21:42:17 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1488740nzn for ; Mon, 13 Mar 2006 17:42:21 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=Npb3adMDy+7GIxj2J6QyAZzRrA9LW2Er+oxJgjQz64llurBWcoIXYc4kEWd++ortg6CNIZsDOEtxB7E0xn2XPbEwci0zFSmWe87H6iOmwcNDdL6JQZwEUQJhtsIDZL+2HpdVKCs3LuD2bHTymNB06MUk0Px/CXIvQ98xiRUDqx8= Received: by 10.36.24.12 with SMTP id 12mr3423045nzx; Mon, 13 Mar 2006 17:42:21 -0800 (PST) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 17sm2027385nzo.2006.03.13.17.42.20; Mon, 13 Mar 2006 17:42:21 -0800 (PST) Message-ID: <44161F7D.9070707@gmail.com> Date: Tue, 14 Mar 2006 12:42:21 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Frank Wiles CC: pgsql-performance@postgresql.org Subject: Re: import performance References: <441610EB.7070001@gmail.com> <44161B46.5050801@gmail.com> <20060313193318.61709662.frank@wiles.org> In-Reply-To: <20060313193318.61709662.frank@wiles.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/180 X-Sequence-Number: 17617 Frank Wiles wrote: > On Tue, 14 Mar 2006 12:24:22 +1100 > Chris wrote: > > >>Gavin Sherry wrote: >> >>>On Tue, 14 Mar 2006, Chris wrote: >>> >>> >>> >>>>Hi all, >>>> >>>>I'm trying to work out why my 8.1 system is slower than my 7.4 >>>>system for importing data. >>>> >>>>The import is a lot of "insert into" commands - it's a converted >>>>database from another system so I can't change it to copy commands. > > > Are you on the same hardware specifically in your disk subsystem? > Anything else different about how the two servers are used? Different hardware. 7.4 is running on a 500MHz computer with 256M compared to 8.1 running on a 2.6GHz with 512M. The only notable config variables on that machine (the rest are logging): commit_delay = 10000 checkpoint_segments = 10 checkpoint_warning = 300 insert times: Time: 63.756 ms INSERT 13584074 1 Time: 46.465 ms INSERT 13584075 1 Time: 70.518 ms INSERT 13584077 1 Time: 59.864 ms INSERT 13584078 1 Time: 35.984 ms Tons of difference :/ -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Mon Mar 13 21:51:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2088C9DCBD6 for ; Mon, 13 Mar 2006 21: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 10112-06 for ; Mon, 13 Mar 2006 21:51: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 B4A879DCDAA for ; Mon, 13 Mar 2006 21:51: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 k2E1pLlv012029; Mon, 13 Mar 2006 20:51:22 -0500 (EST) To: Chris cc: Frank Wiles , pgsql-performance@postgresql.org Subject: Re: import performance In-reply-to: <44161F7D.9070707@gmail.com> References: <441610EB.7070001@gmail.com> <44161B46.5050801@gmail.com> <20060313193318.61709662.frank@wiles.org> <44161F7D.9070707@gmail.com> Comments: In-reply-to Chris message dated "Tue, 14 Mar 2006 12:42:21 +1100" Date: Mon, 13 Mar 2006 20:51:21 -0500 Message-ID: <12028.1142301081@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/181 X-Sequence-Number: 17618 Chris writes: > Tons of difference :/ Have you checked that the I/O performance is comparable? It seems possible that there's something badly misconfigured about the disks on your new machine. Benchmarking with "bonnie" or some such would be useful; also try looking at "iostat 1" output while running the inserts on both machines. Also, are the inserts just trivial "insert values (... some constants ...)" or is there more to it than that? regards, tom lane From pgsql-performance-owner@postgresql.org Mon Mar 13 21:56:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0B5AC9DC86C for ; Mon, 13 Mar 2006 21:56: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 10947-06 for ; Mon, 13 Mar 2006 21:56:10 -0400 (AST) X-Greylist: delayed 00:23:58.670959 by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by postgresql.org (Postfix) with ESMTP id A52A89DC829 for ; Mon, 13 Mar 2006 21:56:04 -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 k2E1u7i9011333; Mon, 13 Mar 2006 19:56:07 -0600 Date: Mon, 13 Mar 2006 19:57:27 -0600 From: Frank Wiles To: Chris Cc: pgsql-performance@postgresql.org Subject: Re: import performance Message-Id: <20060313195727.78df3adc.frank@wiles.org> In-Reply-To: <44161F7D.9070707@gmail.com> References: <441610EB.7070001@gmail.com> <44161B46.5050801@gmail.com> <20060313193318.61709662.frank@wiles.org> <44161F7D.9070707@gmail.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.077 required=5 tests=[AWL=0.077] X-Spam-Score: 0.077 X-Spam-Level: X-Archive-Number: 200603/182 X-Sequence-Number: 17619 On Tue, 14 Mar 2006 12:42:21 +1100 Chris wrote: > Different hardware. > > 7.4 is running on a 500MHz computer with 256M compared to 8.1 running > on a 2.6GHz with 512M. Well when it comes to inserts CPU and RAM have almost nothing to do with it. What are the hard disk differences? Does the old server have fast SCSI disk and the new box SATA? Or the old server was on a RAID volume and the new one isn't, etc... those are the sort of hardware differences that are important in this particular case. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Mon Mar 13 22:27:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4E3CA9DCA09 for ; Mon, 13 Mar 2006 22:27: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 14081-08 for ; Mon, 13 Mar 2006 22:27:30 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by postgresql.org (Postfix) with ESMTP id 7B33A9DC829 for ; Mon, 13 Mar 2006 22:27:24 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1496705nzn for ; Mon, 13 Mar 2006 18:27:29 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=q8O/p8Ljo1PSD2VERQTBs0ScDo5USVVIIwQCnHgX4b7vGST4veoLD69fzR+5JHqN5/WbLPC06t0IYruQckhFUpBJaYuXFquyp4+nXF0W0/cM9vrJLvCsmi/cF9MzX4AqWA0kVesEyW8eKGRqL0X/AUy3MlP4ZOz+lsErQT+ZF3s= Received: by 10.37.20.37 with SMTP id x37mr252473nzi; Mon, 13 Mar 2006 18:27:29 -0800 (PST) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 14sm290035nzp.2006.03.13.18.27.27; Mon, 13 Mar 2006 18:27:28 -0800 (PST) Message-ID: <44162A10.7080205@gmail.com> Date: Tue, 14 Mar 2006 13:27:28 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane CC: Frank Wiles , pgsql-performance@postgresql.org Subject: Re: import performance References: <441610EB.7070001@gmail.com> <44161B46.5050801@gmail.com> <20060313193318.61709662.frank@wiles.org> <44161F7D.9070707@gmail.com> <12028.1142301081@sss.pgh.pa.us> In-Reply-To: <12028.1142301081@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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/183 X-Sequence-Number: 17620 Tom Lane wrote: > Chris writes: > >>Tons of difference :/ > > > Have you checked that the I/O performance is comparable? It seems > possible that there's something badly misconfigured about the disks > on your new machine. Benchmarking with "bonnie" or some such would > be useful; also try looking at "iostat 1" output while running the > inserts on both machines. I'll check out bonnie, thanks. hdparm shows a world of difference (which I can understand) - that being the old server is a lot slower. hdparm -t /dev/hda /dev/hda: Timing buffered disk reads: 24 MB in 3.13 seconds = 7.67 MB/sec hdparm -T /dev/hda /dev/hda: Timing cached reads: 596 MB in 2.00 seconds = 298.00 MB/sec Newer server: hdparm -t /dev/hda /dev/hda: Timing buffered disk reads: 70 MB in 3.02 seconds = 23.15 MB/sec hdparm -T /dev/hda /dev/hda: Timing cached reads: 1512 MB in 2.00 seconds = 754.44 MB/sec > Also, are the inserts just trivial "insert values (... some constants ...)" > or is there more to it than that? Straight inserts, no foreign keys, triggers etc. The only other thing I can see is the old server is ext2: /dev/hda4 on / type ext2 (rw,errors=remount-ro) the new one is ext3: /dev/hda2 on / type ext3 (rw) If it's a server issue not a postgres issue I'll keep playing :) I thought my config was bad but I guess not. Thanks for all the help. -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Tue Mar 14 02:14:00 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8C2D29DCB11 for ; Tue, 14 Mar 2006 02:13: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 49883-05 for ; Tue, 14 Mar 2006 02:13:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from bifrost.lang.hm (dsl081-033-126.lax1.dsl.speakeasy.net [64.81.33.126]) by postgresql.org (Postfix) with ESMTP id 659EE9DCB6A for ; Tue, 14 Mar 2006 02:13:56 -0400 (AST) Received: from david.lang.hm (IDENT:1000@david.lang.hm [10.0.0.5]) by bifrost.lang.hm (8.13.4/8.13.4/Debian-3) with ESMTP id k2E6DsGo004814; Mon, 13 Mar 2006 22:13:54 -0800 Date: Mon, 13 Mar 2006 22:13:53 -0800 (PST) From: David Lang X-X-Sender: dlang@david.lang.hm To: Chris cc: Tom Lane , Frank Wiles , pgsql-performance@postgresql.org Subject: Re: import performance In-Reply-To: <44162A10.7080205@gmail.com> Message-ID: References: <441610EB.7070001@gmail.com> <44161B46.5050801@gmail.com> <20060313193318.61709662.frank@wiles.org> <44161F7D.9070707@gmail.com> <12028.1142301081@sss.pgh.pa.us> <44162A10.7080205@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.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/184 X-Sequence-Number: 17621 On Tue, 14 Mar 2006, Chris wrote: > The only other thing I can see is the old server is ext2: > /dev/hda4 on / type ext2 (rw,errors=remount-ro) > > the new one is ext3: > /dev/hda2 on / type ext3 (rw) this is actually a fairly significant difference. with ext3 most of your data actually gets written twice, once to the journal and a second time to the spot on the disk it's actually going to live. in addition there are significant differences in how things are arranged on disk between the two filesystems, (overridable at mount, but only changes future new files). the ext3 layout is supposed to be better for a general purpose filesystem, but I've found common cases (lots of files and directories) where it's significantly slower, and I think postgres will fall into those layouts. try makeing a xfs filesystem for your postgres data and see what sort of performance you get on it. David Lang From pgsql-performance-owner@postgresql.org Tue Mar 14 02:28:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B6DE69DCB86 for ; Tue, 14 Mar 2006 02:28: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 48772-10 for ; Tue, 14 Mar 2006 02:28:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by postgresql.org (Postfix) with ESMTP id A8FC69DC890 for ; Tue, 14 Mar 2006 02:28:33 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1533846nzn for ; Mon, 13 Mar 2006 22:28:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=FWIQHn/y9fztZLMPm/wRbSIWW5yN10Ke9z1VZolq3cgTGMDm43TVkm8wVhKCBGSHtBLzf+tKbCUfQU9zP2EEBUuHoJxrQur+3aTG+4aarwSy1Q/sR3TjIAWj0Hc3y/k8rg0+uJQBRsJKHamnjLTrht8vmYQTFzOFNo4v6L2g+7w= Received: by 10.36.79.18 with SMTP id c18mr1425643nzb; Mon, 13 Mar 2006 22:28:34 -0800 (PST) Received: from ?10.1.1.22? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 7sm2308660nzn.2006.03.13.22.28.32; Mon, 13 Mar 2006 22:28:33 -0800 (PST) Message-ID: <44166292.70708@gmail.com> Date: Tue, 14 Mar 2006 17:28:34 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Lang CC: pgsql-performance@postgresql.org Subject: Re: import performance References: <441610EB.7070001@gmail.com> <44161B46.5050801@gmail.com> <20060313193318.61709662.frank@wiles.org> <44161F7D.9070707@gmail.com> <12028.1142301081@sss.pgh.pa.us> <44162A10.7080205@gmail.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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/185 X-Sequence-Number: 17622 David Lang wrote: > On Tue, 14 Mar 2006, Chris wrote: > >> The only other thing I can see is the old server is ext2: >> /dev/hda4 on / type ext2 (rw,errors=remount-ro) >> >> the new one is ext3: >> /dev/hda2 on / type ext3 (rw) > > > this is actually a fairly significant difference. > > with ext3 most of your data actually gets written twice, once to the > journal and a second time to the spot on the disk it's actually going to > live. > > in addition there are significant differences in how things are arranged > on disk between the two filesystems, (overridable at mount, but only > changes future new files). the ext3 layout is supposed to be better for > a general purpose filesystem, but I've found common cases (lots of files > and directories) where it's significantly slower, and I think postgres > will fall into those layouts. > > try makeing a xfs filesystem for your postgres data and see what sort of > performance you get on it. Interesting. To be honest I think I'm just lucky with my really old server. I can't see any particular tweaks in regards to drives or anything else. I have another server running postgres 7.4.something and it's as slow as the 8.1 system. #1 is running 2.4.x kernel - pg 7.4 (debian package) - good performance. ext2. #2 is running 2.2.x kernel (I know I know).. - pg 7.4 (debian package) - reasonable performance. ext2. #3 is running 2.6.x kernel - pg 8.1 (fedora package) - reasonable performance. ext3. -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Tue Mar 14 08:09:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 235C09DCABE for ; Tue, 14 Mar 2006 08:09: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 16894-07 for ; Tue, 14 Mar 2006 08:09:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from techforce.com.br (unknown [64.84.33.124]) by postgresql.org (Postfix) with ESMTP id A779A9DCA29 for ; Tue, 14 Mar 2006 08:09:37 -0400 (AST) Received: from techforce.com.br (techforce.com.br [127.0.0.1]) by techforce.com.br (8.12.11/8.12.11) with ESMTP id k2EC2o0Q022009 for ; Tue, 14 Mar 2006 04:02:50 -0800 From: "andremachado" To: pgsql-performance@postgresql.org Subject: firebird X postgresql 8.1.2 windows, performance comparison Date: Tue, 14 Mar 2006 09:02:49 -0300 Message-Id: <20060314120200.M31128@techforce.com.br> X-Mailer: Open WebMail 2.51 20050228 X-OriginatingIP: 161.148.38.12 (andremachado@techforce.com.br) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=OPENWEBMAIL_ATT_0.492229069673584" 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: 200603/186 X-Sequence-Number: 17623 This is a multi-part message in MIME format. ------=OPENWEBMAIL_ATT_0.492229069673584 Content-Type: text/plain; charset=iso-8859-1 Hello, Attached is a file containing the problematic queries cited yesterday, with "explain", "\di" and "show all" outputs. The first one finished in almost 4 hours. Firebird for windows finished in 1m30s. The second one CRASHED after some hours, without finishing. The error message is at the file too. I will ask my friend to reduce shared_buffers to 16000 as this number gave the best results for his machine. Do you have any suggestion? Regards. Andre Felipe Machado ------=OPENWEBMAIL_ATT_0.492229069673584 Content-Type: application/x-gzip; name="sql_query_problem.txt.tar.gz" Content-Disposition: attachment; filename="sql_query_problem.txt.tar.gz" Content-Transfer-Encoding: base64 H4sICKWvFkQAA0xGZnVsYS50YXIA1F1bc+PGct5n/YI8Tm28sZSz4vKm2yZ7qmiJe6xztNJaku04 lSrUEBiSsEAMhQGkpWsf8h/y5/IP8pTHvKe7Z3AlwAtA2QnLtaRAovtDT0/fpmesHj3rMRLBwpoH cuSJWSv8Er7a7avdabeP+/1X/w6f/+4f/uM/293eyUmv/6qNr067122fvOq0++2jo+5J/6gNvz/q 9o9fsfaOcZS+IhXygLFXfCw8dy4qf6ciX1V/+//2tbc3chx//OHvmfgy97jrMyU8YYfMlpEf7juu Cl0f/rz+2Lq8sK4/HjCu4Ds/5BMxe8suhq3BJ+t2+HF4O7w+vxzQt3w2l2wcyBl8fX41uB2cD27g I2Ou74uA/SqBy/ngYnB3f3uDH5j02T68I4f0jg9AO3fhIHv/9c39wPp4eXc+uAJsREFDjAl/MATj v3N3Dz99vh3eDfCdboV3/K25bDibv3I3Dm5/+PHypxvr8+3N+fDubnBxg5eIBrzjXeYXhob564BN AhnN2WixLDEZOEC97Jt/2mN1Xz/8OLz9hX2+GlzvHf6Rrz32F3zwwWQSiAkPBWP7tlThh24fJvxR 6+i41eoedTudXqvXY4F8Vh86x+zZdcLph9MDfPzDPzN2J4Ow7MZ+H6xI6+TI3Ng/OTo+yd+tX3T/ 38TiPXNEi8+sQIxFIHzb5elvkM/3XE3ZX3GYY2bts17ruN1qnZ6d9tut0946TvpFdM6l77xn+69l FIrgdct1LJs7XIWBZB/Ya1Kp3NUlKvTk4pHd2dxHBfNlyK2xq2zuMX8cQ2y32oCvd3ZyetICSBvh S541ecyjfuusAxLVHwyVIyBTSWOF1E5Ouy2gsz21ldJzhO3xgNu8IL/0+kqqRWkmgwEf8rI86bVT ndoYdVGmJ0enrU4XqNG7pnZ2cny6EbEVwj07anX6jciulLKYzQOheF7E5uLGtEuBd1owyVv9fj+Z 6Rncne7GxFfC58Fj5D4VNMRc3JJDUWEy+ueIvMZ0z45b8ChLD3Vcg2VWh0BkQB3/NdrYNpT7WxIu fyIjFwz8bKEUdyReyj9aI+bF5zntt47BytCbJto7gU/1nqn4NLHmwnv+ESrZ7Xfh0cTERTOgDpJA aDkiiuYOuq5syKFEyH4aWPdw6cq6vB9e311AFPKB7ZvoSUWzfbj8ycKbWvEvD3RUlHzBnqfgiNK/ dYgFZDKs4rBL/7TwRRJFQYyS8C4EPi8SidFLQ8oFOoSj04YfwH/cd7YVCNtGJP/MzjKv2tHS/4FY aY9dCxUKh11Jmahv5/i0dXoEtr572juDMEnr8HFiX7rtThIi4TRbCrJiAp3js1bbxAbdsvmGFEoA dFvtDt4NVNor7k5pXPqO+KJnZKRcf8LGD27GQVupMbbGD2KxxqyCHz4+M8ant8ZKaM7GIeQcAShj GdTv3HDG5+x7Af+sigmMDNqtIwOlt8bV3gp7KuyHGAuQWo5eyqKaFRGWwZqRLoBF0caArRwlLdu8 h4KnyMNflkqlOLd7hEo9yMSvVibuTTQhG9/m9aDXP24dxRp4fFxQ/xLEGVLFwHs5HM8Q+eh68C0Q 2FfRCGy/X7Qx79/70UwErp3NLqLRZ/hpVpwog6XZ2Gv1T+BhWn0TKXRWxT6VUnRDMdOihEfwx4n0 kusF2UFqYAR3tj7WKs4iSDM+sG+0quQes8kD/t6PVvlQVf7/8+D68vw9FkA8B7WSybmA+eZ6gr2e T6wvnpy8a7dN8Uq/ner34clrtg9f6x93+28hTpjMhB+ybq9z8B6gPHHPdSDMmkR4eQ9fcbTxb467 lQe7AuAcjWYgPP5f/yPUHhuqx0jMOPtaccu1nIkqcnDPvTuX9IFdSF/qa/p1z0fAJHWPf6rh4/60 9KGazh6bRyPPtRECnwTRnKO4pCUCMBhzMm8rXl/Zf/uOawv4MAd9ATVVJXRyPJZC4XVcKngs0cly SUze2idYzSWmk6WdMf8bUi+nndLJUjfB9ebAK6gbOjnSGw3pBqQLQ7rWPzYQdpF2LJ4KwlvTXhEy bUy7fCCXqa/Dvi11Gk9EnZlu28qlbCwTumukUZfuev2oR5fetTAcGWyne6vohmCs9R+rJLE53VLv u6V8ExoriYNxdKJVWrEl8ZWB5YbEMzSK5GNbrlU5Vr8qTSwnX0qjhBHJJSMiOXZtFx6r5FEqGeGN RdKkLDHReMZXTv5y0mU0NuVD1yMl82Nfn0+W1HqNKueTobGGfDn6euRd54tl+/Nfk0rr2tfGnpRI SwvyExtNjcstnycqtAXpKtTS8u3Zerz1SCfi9nuQab8Q6X7/6KVIH/d2KRBnCsZoRqaniaxX2xzD yPVBQeRGvJoxCoQt5uhfPUgbyxVyNaPyoKNIPQy4r3ZLPYTZ6sITyg0GYzsHY8inK5I1yVeD95Mh qQ9+dVpDXCJrtAiFsmgF4QW5eK4/3cBo1pJUZCkRuAIrBHWprxhmIv8EDBzuVGbha8gXAzek+8St ELiunlBr6JbGVkRcBApnLF/IKKxJvELiSUi4afK3BXTSkiRA24RBOfEcnSyDbMy5Gf6t9GX+EGI5 fhOprCRPVHKES4PZVU9Q0+bHnrFpxaDEQcIlmAYTStWAPRYh17CpJF2kk2WTJljNFDShs0S8GCiv 5FMvWF4KXWsWz4p0sjy2Ir+CR5b8/lG/tDZbeGdqKp8Z97zi4p/PlyqdVUVRfCkRhliGXol505cj lB2489CV/t76FcU6pdTd3b7ipaHvMe44FkY/IB+LVmuXBCPHmzjMSrkOYMBnPHTBBnoLZKeY4cdC PvKwwK2jI9CSULKPtzefGHiUSAnVAniBPXWfBETjsxkuOC/Tx8bN9b6rEt7PgyvDBBEZNsg4AuXk nst9SBBn4jfpC5W/s6FcLv1QBDCjQ8UG53f3bxn9M8R/8EHvBvfYbTlIYDCEwQgHwQunYNVAqqiI BDHnwr+y43Z9dHD7HQIDHmzGv7izaKbZUwOpLX2HxgqkNfcEODLbc3EZJA9Ko5RP3I6iisSysRDv Qh4YnBleuLynPVgOg8V97i1+Exb6Y2GNuR3KAIi0W90mGK6j2UgE8CQsjEAcICOIM0P11jSWKAZM HIFyUuCUXPgLRGeg4BBzNobwCSWGNALhEZkK6OEUrOlUeo7mfdRuMMpf2SfIDnFs/QaPkMfp8zkp SoFRQ2W8R5LAUnlCzNlIhM9C+NkRD8AKvM1oZx6UecPVRQsegy801cNOI1A/adZIlWmqwH/mep5r QLxlY5BUiqMalOfO3HDnoPgMm7wZf+KuR5Z2JACQAO85n4Ox2whebqrQXOk3gVecK6v0ywztpjPE vOUmCHDENdwGgKtmyHrggG40eQ4ggQkscH0W2NE5n+ScCMzf+sLE27/j9gO2noO/0JwSa53iBd5M MwZoYy9SUzaHb+iuAkS4bqMdz/Fot3q9ddWvrSAaLgAphjeKxhACrAGYTNwih26zEV4GqK0MmbHY 1ND3qjjBM+i8IPrDRvjq9sdNRhghlo5wE4uzwQgjvJUj7En7wVLubxUJ8Vd22jmr76EhSIAsQjFi gArHHFc9aK7AXPq/yiiwSjIKc3fD+DKJo77TnNgokNyxOdhn8LFPmCYhb7AW1FhmjSOfLJ01ko5b 0CWwf/VfX9k5da7FDJhh4EQBRr7nt8PB/ZB9/PH6/P7y5jrGM5euH1qmz0UVCJ42gFMWYuJ2JA6J AM4z7LNJ2GY9PuUSFLanAFUe7lI0bOA2C5bWRsRbonzmgb+UlX5lvWah0pWcgJ0aY4+Sh9RB41Oe qUSnEAMIH1IxDAjGgXiM4DLkZ+EUM42pq9h++mQHCJxCfAvyNFCbklwaOA/uL6/r2pKMeDWnbxXg xroiWWSYgTHnFMvM9a0ZlqnyNtcU8HBmNcZiyDNPPAkPL3GIp0BiCo0oGLMUL8KC5NENqxwV+dKa iIqwMuGmHcii/tESiYmXNCbKKMnw4tChVgJ2NIMpauWOUF+Wl1Yau7BUmCaWArR2FAQoQuq9y+BV cYwK/gHeZ3FOHouV8Ppjd2JRD145w/P37wa6ZKmwgQ5SwUnAZ1y9+6yrUXc/XL07bXXeQQTH38UV qkevhZSzeNE+iwAUcYbbBDTfKKDclloANRjMz3E6iy82CNjN2+jGCe7Qx8hd48GWVezrh7GLlMjw Jr8qMfFCH4f7fV2Kju15ZLnYH2lR0Eq5Rp489lrWdv8ZURloICuhAAa2jYLhMUm4HkRgjfmG4PaU ESgTSe8H8vkg9kL6C7Vnc9/gBw0BkctgCXyCv1tXP7fGD5cIfowJZ+DP3w9vhwZruZQzWOtHWmux kiUyIDO4CW9G0Ig0UuCfIF8KXNQty/a4UhkLuruQBwJlwvPgy2ff8GUxX2b4AiKciJbjBgKzzNIY f5spvQpRMqXphwlLwHABcrwLFxVGhQp2dzdv2aeLX5pKBezuHM032jeuJwVtQEIbTSHFE/ciLZeR BRNdB6dqzpcc2s6sC+jzIUpkxMGuIEuKSQmC4A7F56Ux1Q4S7HuQSBxIZXMrNGnPHFyXxFgQ4lbj GCiYoZ5ySr01OgI6iiYW1lNDPOzA9ZfCv8b1WocipzkPlB4snIjgvEQypCqDA12C/umOcXwOtMVH S0D0CYGJRbR+Y/BchIJYXxCK+CLsiDyjloqshhIITBND4edovYhU+BijR82QFhyWYI155EHwE4JX B2NqKyvkwSQxfqjd9VHlIzbixFJOTHPKoKDlkJJ5vjuDHKPIcMIyfiDQ/uiLpNnkhgXWO7Lw0jDN cpX0dCCE9OF+x4RpuMmsNrxs4JpyoNg78b2+eM7+rgIfIrKk7y3YLhYZiuJD6odEHYczUgiugEtl gD274dSSrlOMrRsDO9cDR6z14CErdnN5ofDECcMfkSzAnru25bmjgONhMBx+liP1DXwF7rAukjQ4 QcpkmjVLWvTzJHfI5c+kE+nCrRiPwfXSyh6Mqlgq/2i/UtuzlIZLEG5EM1q4ZXyEviwuCRmv/MAI C6Ijv2iNaGeespdMZ+NSTElYDwAxqgc4mu0h8cUvVYpoytWUT0pWsl8WEbKFic3NnrDYzBeA0X7j 3x+Y3udcwEMWrGTkXhgPsS0duZkAa18moZcFRGxLJeRD9uDRduDfFZBPG5EPiXMZLCUey4btpWEp XQFzuVc6eorOqCkl+5Ko8IgC14YgmPiD4OYZTCF4lD9AUveXFywvIvhrDiIKMYMvqWo2dnM/A0lj sUfcflAeTnrNlZZkZOC4Prg1piFA2glRH/cImz7joTIvaCyqH5WRk0vpARhJgDmPwmx2N/yXz1eD y2v20/D2u5u7IcEChD42F7pOWSWreVcLLsSYAYQMGTJlDIQ/w9DFicJc2O7YBbymkgWQAm6NwVWH kIpP3EKxf4fFy3ThyvAx2RNiAWkRBBjGQ12xTpJhbE6ybOl54JFFumKe4bCr5QhsQTqk2gUFCCOx kLi2NXUh/FTRyNTXqA6M+4djTNg1NFYLf1WffWN9+ygDbJRCNtNA+u5vPF4Wj1ek08ruOMI1XT4R 1rNWh12DMVqGfNIFSKwuP09pS3UAIoSQT+uZzsV4ZjUCIE7E48rG9Z2ZsonwBa7I0GGIca00blNC FBZEpNVGvmEJ/C/DH27eM8PBJVPq6GQ0zCUWqP8SLgR0B2ayfCZAbCoGiY+hK9Alo9lwgmqQ6ewk K6pZmRiZexMJQz6dxXDmUnoVK7e7h+M77pPrRGDY0ehr0zaPvNwg6uNoaPnU5cVFoQZdXikgw+EJ i5ACEgowAph0VSLK96PsFlGaOCdMQFDUQYl98ypvukiljPIBuumIVy+isO3XUSYWUNRrKAV0SdH1 NfzidclCyh5z0XmugLM9GKIYwykFQ7+ogAOefII9J2BRsTi588z9IiGMXsSwY1h+xaHBuPiPd3V/ vYGYRS8yRXaY+rsxKHgIdgiRPgQjSOCVcH1FpeqdC4qQgjsho/g3EYAxkCpTosYWcTzIY0QVP44B GJ1RqsQhNjH6ysW5apDqsbemoDFL/R67K7Il5I3VTFBr9nksD2KxrPXg5i+vhu/fRSp450mbe6DQ 6tF7J0L7Hdx71IK7Qj7aAAveHQcIJVgY9vObAJBABU9VjTAs08zfUECVwnFtBOLZWverNsiALaiF IAVC/UB6wcwzRUZ9TCsJO8YQLuarjOPOMCRdDrQgBsGSGTIsxKIi4xzEjVquXglJAJa2PuwOYKJC 3J9E2AMBLk4bhoQxWoQkeDegJMRZvGwRb7egSA46X6BEi8r7CXPd+ao0JHOmUxXNl4Wk4xeDZLkz +ndEUrHGiMZf+BZ3HAxnypKEf9wRLLSLZu4H7PIzMyz3hTrAWFgDgU8ISk7ABvi+sEtD3eZuhbqk aD1BRTaulUMOw1KOBoKDC+x+vM5RpKFCMBk1K+b5VYWUC45ZukJlagkxmuoFcjTOEwvv2CmalCPi ik++UgkeVTlGOxog39Edmwq7GaSPHf62F1H/mWMithhMHMCVUtsFGBJOzCVejYp3wDgM4k9aDRIz 3QyGoHBbYICbbEcS4pBFgWqc9NUElYxYSh9QAdsJoIlNdAyEVmcBCyLc9VCZKkDMI27dokbO7HJn yQo1YkOVqu6+TduzDt/8cvhmdvjGsd58/+bTm7vWenXPCImCLGIzx+g18EtVujQy3JWcEi1KDaHJ GtNphChiMJ7rCyxcjt0vJdTe1A5V6fZz6YeBpFRa+wha0yFmujRB6o3yQRgaEPZbxjPASnQ9pthw 48pSl2DaUVDaHsJHEnJwU5SLseACKO4nEGYetFLgei4WUBPnOferooONJElbFWkfQwZHXKjBFizk zHiIbk+jpv5avawNki5DWxXbvXxnaw4KtVKUWo3d2Q3NY1urYZYlSqHtDJnpt9wSWiBDPUVQvEu0 O/1+k3apZDdtYrtYzE/rvrTtKDDF1mucTFGIZ0fmgJVU7HC9vVsf2dbAHlxP0pEiGtryvMzS9iGu r4ssVybDjA4X+9J5mlP35HqJWu1KqexoRhXCJ7GtXoVB5ENqKCzsb4lFuyt094Y4mF36f8JMUt9I EkNvRS7LNOritzEIwIcd0hC946NYzzJ4AAM2yzPoHPdOa28dLNl8AQwwMNX2k+rp6NAzOEyXrunF gdvWZBS76vRa3p+V6XfPQDCgSMS4Lys+GKcAqlFz5QpQCv72Qu4LGSlvkR6Cq9IubaOB6VZqwqtm VnGXW8rwuEHPzmq81J+jGSNA7fjH2OSn+9jAo4YBtx9oMsdA8ezcsvEGwTbZOb0SaEkb3YaA451f PFjahkGaUBtvrt60jDjZERYfXByPNVXIcfUusCBGn+R6xmCsa+8KrUCUsmOanUFBOxgexKJE5b6y XpM1lNVy0ZsRkLGRB7Ya67ma7VSMSR032Bm9WqWIL22ZzHc+IiaI2SGCEo6V20UTE+2+mFEr2I8Y RrEHEiGCb7MfLEfM802Hhgc6hl2aDOLGiBudCJBEGoBmzpUC9+TgNrZgMV8qGOxguZnoJoyIadWy cnLXUb+BFmdEcH/+WXPLxg9UVgMnjgoDo2ThIR3Vm6kbLtr6Mns+Tnr0ALHGNlDTguqWLKk1XH/B A9NxOYi0MOUCAYJhjctsMl2EAT11pPZlpVt2wLTUBaNv32LDDscQN21Bg/k0FqGNLZeJ20PEQhfk rIrKY2PtpdNUsNyWnJ9C7eF8HuIyt+Fq+ptImNn6SSAmYKbHHn+SpUXRr4w7TxiYbdsgnqCL5Qmc IIQOsLkr0IVB9lrzfQ04lMDjfJZanDOEvsHlw7fxCVf1cSgYoRk3DM0KErp6vTCZZNS4Zqp/evgY cY+6YQgnLQD+DhtqjSXYj3f4HFTvrDWg4uWmEqqnrU7943Ky/tagMqyQN01dKz4qoOTmXhf/91v1 eS93oBlzYZKJmDWlE6NFBibCwzplaM1kxfGOjVOwWzCAWclohh5uTlOPHoRBUwEpJKU2JbwbHg2g i1gw8U34qvMqXW7XwojL1eBScQsfuP34tCyc/UqtO/J1R1vV7u6uClkUnhngcHDq2Mmh9wybZlS1 G9bftlqtb1lMktoM0kZUgGT6TfVIJSWE8g1zu2ujjOMdYCyf0VPEaxP7hVLpAXkYf5FbnqACh6WP 3tCVyCKjpntTpIeNUkoftHGoeWSqHLi8FO84xHDxyQ0XCS6jWGYYXwZXBovuLTYF5/QUOJXgATcj Qqy7GPuoyFHuBM+/ikBiWUjDgnHMy8jYAgDwv+1dTW/TQBDlp1g9cckhBypx4MABqkhpODQVgksU xS6xiOOA7Qah/njmzay3u+uPqHh7mydVVaLW87Le2PP5DJPPhMpz72mLuUBk44WnjTluzEfxvIA4 rol/ebSkZsYiNr8n/VY1FDPxBC1OIP1X6ueA4jXgecmetpZTHUosozEttd2WEejVuxOFtRQ3HfLH DJu+6WgvTaN324naECFYk0SNo7Uir3vo5Okh7JCafOnydSryqmrwdfNI9TGBUuKjI4EcncnosmTF adgpYZfo1ZJ0sF1iYq/jmpgEXWV8JwjkfR/Jkj8lN7fr/49n3Bx6q0IpU37S/YOzKAkvo2nJw7b4 S/qWFjy0glxXBiXn/GFAHGXidetGKm5QNMKw8Q8Wv7GzGMlycbf+tGKWqy/rxedvltPgbE8EpwWd m26FVe40dEkom9875K1NYxU4iAc+NGX7fNBY07ZtTtqxSCFqMHcbMHLnaqOt0gVG4bRtSwmrujli xiH7xV3hESmt4eRVyRVCzA+r++XyCm2l/DJZ3CX8DvFojvkf2j+7n1nd254TcXLbHl2eoIr37sn6 LC1ZnUZI2PK3jHSnAUV5Sn1oIxbF8syDX2LEJDi6FANKdDtkNWA3R/+UvJtPaCZwKG25tytxjYwR 69UJ9Y488b5zUTI0INFt/Zak7qRSwAskQgM6nCujnVh7j8eZmGN26bAgKae7sOHrXO51Vk+zw2Wf Bw7TRCnDAS4PLG5omnXkTmxHxTucsNN8Tq+yPtyJP8LrvD2MeS0Ra4t+jW7G7FrL+HZ5KRZ8gq8f l4Ygxtg2RVbvyz5lb9QkMYKxvTBUN0hQ4hjpdmEbtk5MP7tWCs1KuTa1MzzXV8X2jz9/fx1FoGC8 oi0Da2DDZUNcIf5SyEjrUtBCp3212Agh4JG8kYY1ba2S1AmSlcaqbME93Zg5knk7v+5/1mr7+41C oVAoFAqFQqFQKBQKhUKhUCgUinj4B6c0sBoAoAAA ------=OPENWEBMAIL_ATT_0.492229069673584-- From pgsql-performance-owner@postgresql.org Tue Mar 14 09:52:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ABB2B9DCDC7 for ; Tue, 14 Mar 2006 09:52: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 36386-09 for ; Tue, 14 Mar 2006 09:52:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (unknown [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id F37489DCDBB for ; Tue, 14 Mar 2006 09:52:11 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Tue, 14 Mar 2006 08:50:05 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B2469@morpheus.bostonstock.com> From: "mcelroy, tim" To: 'Michael Fuhr' Cc: "'pgsql-performance@postgresql.org'" Subject: Re: PG Statistics Date: Tue, 14 Mar 2006 08:50:04 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6476E.126BA23A" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.168 required=5 tests=[AWL=0.167, HTML_MESSAGE=0.001] X-Spam-Score: 0.168 X-Spam-Level: X-Archive-Number: 200603/187 X-Sequence-Number: 17624 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C6476E.126BA23A Content-Type: text/plain; charset="iso-8859-1" Thank you for the insight Michael. I'll be performing some tests with the various setting on/off this week and will post the results. Tim -----Original Message----- From: Michael Fuhr [mailto:mike@fuhr.org] Sent: Monday, March 13, 2006 7:19 PM To: mcelroy, tim Cc: 'pgsql-performance@postgresql.org' Subject: Re: [PERFORM] PG Statistics On Mon, Mar 13, 2006 at 06:49:39PM -0500, mcelroy, tim wrote: > Does anyone know how much of a performance hit turning stats_block_level and > stats_row_level on will incur? Do both need to be on to gather cache > related statistics? I know the annotated_conf_80 document states to only > turn them on for debug but if they're not that performance intensive I > cannot see the harm. I ran some tests a few months ago and found that stats_command_string had a significant impact, whereas stats_block_level and stats_row_level were almost negligible. Here are my test results: http://archives.postgresql.org/pgsql-performance/2005-12/msg00307.php Your results may vary. If you see substantially different results then please post the particulars. -- Michael Fuhr ------_=_NextPart_001_01C6476E.126BA23A Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] PG Statistics

Thank you for the insight Michael.  I'll be = performing some tests with the various setting on/off this week and = will post the results.

Tim

 -----Original Message-----
From:   Michael Fuhr [mailto:mike@fuhr.org]
Sent:   Monday, March 13, 2006 7:19 = PM
To:     mcelroy, tim
Cc:     = 'pgsql-performance@postgresql.org'
Subject:        = Re: [PERFORM] PG Statistics

On Mon, Mar 13, 2006 at 06:49:39PM -0500, mcelroy, = tim wrote:
> Does anyone know how much of a performance hit = turning stats_block_level and
> stats_row_level on will incur?  Do both = need to be on to gather cache
> related statistics?  I know the = annotated_conf_80 document states to only
> turn them on for debug but if they're not that = performance intensive I
> cannot see the harm.

I ran some tests a few months ago and found that = stats_command_string
had a significant impact, whereas stats_block_level = and stats_row_level
were almost negligible.  Here are my test = results:

http://archives.postgresql.org/pgsql-performance/2005-= 12/msg00307.php

Your results may vary.  If you see substantially = different results
then please post the particulars.

--
Michael Fuhr

------_=_NextPart_001_01C6476E.126BA23A-- From pgsql-performance-owner@postgresql.org Tue Mar 14 09:53:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C99359DCC48 for ; Tue, 14 Mar 2006 09:53: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 40512-01 for ; Tue, 14 Mar 2006 09:53:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (unknown [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id 5DF2D9DCB46 for ; Tue, 14 Mar 2006 09:53:23 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Tue, 14 Mar 2006 08:51:18 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B246A@morpheus.bostonstock.com> From: "mcelroy, tim" To: 'Steve Poe' Cc: "'pgsql-performance@postgresql.org'" Subject: Re: PG Statistics Date: Tue, 14 Mar 2006 08:51:17 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6476E.4240CFDA" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.165 required=5 tests=[AWL=0.164, HTML_MESSAGE=0.001] X-Spam-Score: 0.165 X-Spam-Level: X-Archive-Number: 200603/188 X-Sequence-Number: 17625 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C6476E.4240CFDA Content-Type: text/plain; charset="iso-8859-1" Thanks you Steve. As mentioned in my other reply to Michael Fuhr I'll post the results from tests to be performed this week. Tim -----Original Message----- From: Steve Poe [mailto:spoe@sfnet.cc] Sent: Monday, March 13, 2006 7:38 PM To: mcelroy, tim Cc: 'pgsql-performance@postgresql.org' Subject: Re: [PERFORM] PG Statistics Tim, When I have done ODBC load tests with stats_block_level enabled on (20 mins. per test), I've seen about 3-4% performance hit. Your mileage may vary. Steve Poe On Mon, 2006-03-13 at 18:49 -0500, mcelroy, tim wrote: > Good evening, > > Does anyone know how much of a performance hit turning > stats_block_level and stats_row_level on will incur? Do both need to > be on to gather cache related statistics? I know the > annotated_conf_80 document states to only turn them on for debug but > if they're not that performance intensive I cannot see the harm. > > Thank you, > Tim McElroy > ------_=_NextPart_001_01C6476E.4240CFDA Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] PG Statistics

Thanks you Steve.  As mentioned in my other = reply to Michael Fuhr I'll post the results from tests to be performed = this week.

Tim

 -----Original Message-----
From:   Steve Poe [mailto:spoe@sfnet.cc]
Sent:   Monday, March 13, 2006 7:38 = PM
To:     mcelroy, tim
Cc:     = 'pgsql-performance@postgresql.org'
Subject:        = Re: [PERFORM] PG Statistics

Tim,

When I have done ODBC load tests with = stats_block_level enabled on (20
mins. per test), I've seen about 3-4% performance = hit. Your mileage may
vary.

Steve Poe

On Mon, 2006-03-13 at 18:49 -0500, mcelroy, tim = wrote:
> Good evening,
>
> Does anyone know how much of a performance hit = turning
> stats_block_level and  stats_row_level on = will incur?  Do both need to
> be on to gather cache related statistics?  = I know the
> annotated_conf_80 document states to only turn = them on for debug but
> if they're not that performance intensive I = cannot see the harm.
>
> Thank you,
> Tim McElroy
>

------_=_NextPart_001_01C6476E.4240CFDA-- From pgsql-performance-owner@postgresql.org Tue Mar 14 10:06:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D95B19DC809 for ; Tue, 14 Mar 2006 10:06: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 42621-02 for ; Tue, 14 Mar 2006 10:06:39 -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 C5DE39DCAE3 for ; Tue, 14 Mar 2006 10:06:32 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 12so1116749nzp for ; Tue, 14 Mar 2006 06:06:36 -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=FSsPzWCGeaOx7FmYddqV+OCtP4MMqnPkWMQvoE5oOFDDuTkf2yWXxea/ppz0PvkNF0Qfs+8swO7lfOHhNDoa3vIcn2XiSFt/HmCF8zbRmxnmAjiUHg1ZhvRI/aIg9jU1ANiGUVEzF6n1ckRQIAc5ipgYUOuaZkbZF93y1RpznCU= Received: by 10.65.112.6 with SMTP id p6mr1844466qbm; Tue, 14 Mar 2006 06:06:36 -0800 (PST) Received: by 10.65.137.20 with HTTP; Tue, 14 Mar 2006 06:06:36 -0800 (PST) Message-ID: Date: Tue, 14 Mar 2006 09:06:36 -0500 From: "Merlin Moncure" To: andremachado Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison Cc: pgsql-performance@postgresql.org In-Reply-To: <20060314120200.M31128@techforce.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060314120200.M31128@techforce.com.br> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.143 required=5 tests=[AWL=0.143] X-Spam-Score: 0.143 X-Spam-Level: X-Archive-Number: 200603/189 X-Sequence-Number: 17626 On 3/14/06, andremachado wrote: > Hello, > Attached is a file containing the problematic queries cited yesterday, wi= th > "explain", "\di" and "show all" outputs. > The first one finished in almost 4 hours. Firebird for windows finished i= n 1m30s. > The second one CRASHED after some hours, without finishing. The error mes= sage > is at the file too. > I will ask my friend to reduce shared_buffers to 16000 as this number gav= e the > best results for his machine. > Do you have any suggestion? > Regards. > Andre Felipe Machado Are you looking for help optimizing the postgresql database generally or for help making those queries run faster? 1. do all basic stuff. (analyze, etc etc) 2. for first query, try rewriting without explicit join select count(distinct NF.ID_NF) as contagem, DE.AM_REFERENCIA as campo from DECLARACAO DE, CADASTRO CAD, NOTA_FISCAL NF, EMPRESA EMP, ARQUIVO_PROCESSADO ARQ where CAD.ID_DECLARACAO=3DDE.ID_DECLARACAO and NF.ID_CADASTRO=3DCAD.ID_CADASTRO and EMP.ID_EMPRESA=3DDE.ID_EMPRESA and ARQ.ID_ARQUIVO=3DDE.ID_ARQUIVO group by DE.AM_REFERENCIA order by DE.AM_REFERENCIA ; 3. second query is a mess. remove try removing explicit joins and replace 'where in' with 'where exists' 4. your tables look like classic overuse of surrogate keys. Do some experimentation with natural keys to reduce the number of joins involved. Merlin From pgsql-performance-owner@postgresql.org Tue Mar 14 13:00:34 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E1D479DCB90 for ; Tue, 14 Mar 2006 13:00: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 72312-01 for ; Tue, 14 Mar 2006 13:00:32 -0400 (AST) X-Greylist: delayed 00:16:15.72966 by SQLgrey- Received: from mail.livedatagroup.com (unknown [64.139.144.2]) by postgresql.org (Postfix) with ESMTP id 871319DCB88 for ; Tue, 14 Mar 2006 13:00:31 -0400 (AST) Received: from [192.168.2.126] (gw.livedatagroup.com [205.242.255.66]) by mail.livedatagroup.com (Postfix) with ESMTP id 8940555F97 for ; Tue, 14 Mar 2006 11:44:13 -0500 (EST) Message-ID: <4416F2DC.4010400@livedatagroup.com> Date: Tue, 14 Mar 2006 11:44:12 -0500 From: Pallav Kalva MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Vacuum template databases, Urgent: Production problem 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: 200603/190 X-Sequence-Number: 17627 Hi, Do we have to vacuum template0 database regularly ? We got this warning this morning while vacuuming databases. As a part of my daily vacuum job I do vacuum of quartz, helix_fdc and affiliate databases which are the one's which are heavily updated and used. But today I realized that usps, template1 and template0 is also being used in a transaction somehow based on this (SELECT datname, age(datfrozenxid) FROM pg_database;) query. Actually we dont do any updates on usps , template1 and templat0 databases but some how still the age(datfrozenxid keeps incrementing. My question now is do I have to vacuum daily template1 and template0 databse, is there any harm on vacuuming these databases daily ?, since these are postgres system tables I am kind of worried. I was told that template0 is freezed but not sure why the age(datfrozenxid keeps incrementing. I am going to vacuum usps from now anyway. We are using Postgres version 8.0.2 If some one can please help me on this it would be really great, this is a production database and we cant afford to loose anything. Thanks! Pallav. Message from the log --------------------- WARNING: some databases have not been vacuumed in 1618393379 transactions HINT: Better vacuum them within 529090268 transactions, or you may have a wraparound failure. SELECT datname, age(datfrozenxid) FROM pg_database; datname | age -----------+------------ quartz | 1076729648 helix_fdc | 1078452246 usps | 1621381218 affiliate | 1078561327 template1 | 1621381218 template0 | 1621381218 (6 rows) SELECT datname, age(datfrozenxid) FROM pg_database; datname | age -----------+------------ quartz | 1076770467 helix_fdc | 1078493065 usps | 1621422037 affiliate | 1078602146 template1 | 1621422037 template0 | 1621422037 (6 rows) I ran this just 2 minutes apart and you can see the age value changes for template0 and template1 From pgsql-performance-owner@postgresql.org Tue Mar 14 13:27:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F11259DCB67 for ; Tue, 14 Mar 2006 13: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 76886-05 for ; Tue, 14 Mar 2006 13:27:53 -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 C6F969DC885 for ; Tue, 14 Mar 2006 13:27: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 k2EHRoAR020781; Tue, 14 Mar 2006 12:27:50 -0500 (EST) To: Pallav Kalva cc: pgsql-performance@postgresql.org Subject: Re: Vacuum template databases, Urgent: Production problem In-reply-to: <4416F2DC.4010400@livedatagroup.com> References: <4416F2DC.4010400@livedatagroup.com> Comments: In-reply-to Pallav Kalva message dated "Tue, 14 Mar 2006 11:44:12 -0500" Date: Tue, 14 Mar 2006 12:27:50 -0500 Message-ID: <20780.1142357270@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/191 X-Sequence-Number: 17628 Pallav Kalva writes: > Do we have to vacuum template0 database regularly ? No, and in fact you can't because it's marked not datallowconn. But you do need to vacuum template1 and usps every now and then. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Mar 14 13:30:34 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BD9399DC883 for ; Tue, 14 Mar 2006 13:30: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 76886-07 for ; Tue, 14 Mar 2006 13:30:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (morpheus.bostonstock.com [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id CBCF49DC882 for ; Tue, 14 Mar 2006 13:30:28 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Tue, 14 Mar 2006 12:28:17 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B246C@morpheus.bostonstock.com> From: "mcelroy, tim" To: 'Tom Lane' Cc: pgsql-performance@postgresql.org Subject: Re: Vacuum template databases, Urgent: Production probl Date: Tue, 14 Mar 2006 12:28:17 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6478C.81094620" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.162 required=5 tests=[AWL=0.161, HTML_MESSAGE=0.001] X-Spam-Score: 0.162 X-Spam-Level: X-Archive-Number: 200603/192 X-Sequence-Number: 17629 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C6478C.81094620 Content-Type: text/plain; charset="iso-8859-1" If one adds the '-a' arg to vacuumdb wouldn't that vacuum all databases including template1? Tim -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tom Lane Sent: Tuesday, March 14, 2006 12:28 PM To: Pallav Kalva Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Vacuum template databases, Urgent: Production problem Pallav Kalva writes: > Do we have to vacuum template0 database regularly ? No, and in fact you can't because it's marked not datallowconn. But you do need to vacuum template1 and usps every now and then. regards, tom lane ---------------------------(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 ------_=_NextPart_001_01C6478C.81094620 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] Vacuum template databases, Urgent: Production = problem

If one adds the '-a' arg to vacuumdb wouldn't that = vacuum all databases including template1?

Tim

 -----Original Message-----
From:   pgsql-performance-owner@postgresql.org = [mailto:pgsql-perf= ormance-owner@postgresql.org]  On Behalf Of Tom Lane
Sent:   Tuesday, March 14, 2006 12:28 = PM
To:     Pallav Kalva
Cc:     = pgsql-performance@postgresql.org
Subject:        = Re: [PERFORM] Vacuum template databases, Urgent: Production problem =

Pallav Kalva <pkalva@livedatagroup.com> = writes:
>    Do we have to vacuum = template0 database regularly ?

No, and in fact you can't because it's marked not = datallowconn.
But you do need to vacuum template1 and usps every = now and then.

        =         =         regards, tom = lane

---------------------------(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

------_=_NextPart_001_01C6478C.81094620-- From pgsql-performance-owner@postgresql.org Tue Mar 14 14:40:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E4D19DCC61 for ; Tue, 14 Mar 2006 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 91076-01 for ; Tue, 14 Mar 2006 14:40:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from techforce.com.br (unknown [64.84.33.124]) by postgresql.org (Postfix) with ESMTP id 203899DCB8E for ; Tue, 14 Mar 2006 14:40:14 -0400 (AST) Received: from techforce.com.br (techforce.com.br [127.0.0.1]) by techforce.com.br (8.12.11/8.12.11) with ESMTP id k2EIXKc4030408 for ; Tue, 14 Mar 2006 10:33:21 -0800 From: "andremachado" To: pgsql-performance@postgresql.org Subject: firebird X postgresql 8.1.2 windows, performance comparison Date: Tue, 14 Mar 2006 15:33:20 -0300 Message-Id: <20060314183226.M29726@techforce.com.br> X-Mailer: Open WebMail 2.51 20050228 X-OriginatingIP: 161.148.38.12 (andremachado@techforce.com.br) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=OPENWEBMAIL_ATT_0.601322115256579" 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: 200603/193 X-Sequence-Number: 17630 This is a multi-part message in MIME format. ------=OPENWEBMAIL_ATT_0.601322115256579 Content-Type: text/plain; charset=iso-8859-1 Hello, Many thanks for your suggestions. I am trying to optimize server configs, as (presumed) my friend already optimized his queries and firebird windows is executing them fast. You could see at the new attached file the results of the queries rewrite. Unfortunately, the first query simply returned the same estimated costs by the planner. The second one, using EXISTS, multiplied its cost almost 200 times! "Exists" is painfully slow. The shared_buffers was reduced again. Do you have any suggestions? Many thanks. Andre Felipe Machado ------=OPENWEBMAIL_ATT_0.601322115256579 Content-Type: application/x-gzip; name="sql_query_rewrite.txt.tar.gz" Content-Disposition: attachment; filename="sql_query_rewrite.txt.tar.gz" Content-Transfer-Encoding: base64 H4sICEAKF0QAA3gxSzlvYi50YXIA7F1bc9tGlvazfsE+dnnijTQr0bzp5qy3itEl0YwsOZKcbOYF 1QSaJEYgQKEByUr5Yf7D/Ln9OXvO6W7cQYkEFFeqwkpMiQT6fDh9+ty7Je886y4W4aMViofQjUQn +hy9avfV7XW7e8Phq3/Bz//xn//+v25/sL8/GL7q4qvfh98Gr3rdYXd3r7vb7e3B9bv9/e4r1m0Z R+UrlhEPGXvFJ8JzF6L2Ohn7sv7bP+xr7Dj+5P1fmJwFD4x73ncbLPfy+VzkP2FfWP1Liihy/emS K5benn85Qtqhu4jcwN/Y2Hnq9V9PXvGSty95KegbjDuONXelBP5YkzCYlxkTTCbPZk4FX0dxFMx5 5Nowj49ITjJNj0V87AkWiokIhW8LyaKAnV5dfmC2x2MpZAfghfbMvReWHczn3HcqxscVEK0P75fR uSaCiDQZJAxLMOSey30rcufit8AHfLk7G/LlzI9EuAhFJNno6Ppmm9E/J/gPPuj16IZx+CqBwRAG IxwEL5oJH7mKgkgQgzjKjr/XXR8d3H6NwIAGm/PP7jyeK/KuD4vJDnyH5gq4tfBEJGC+XABTAKVQ BvfcjuOSWBkyDZl4DWpS48zQkvF4EQYgUDKHweI+9x5/E5YEWRTWhNtREMIg3U6/CYaLeD4WITwJ i2JgB/BICgC1zeKFwyOQGiDiCOSTZIvQhd+AdRoKTjFnkxCgAMdwjFB4NEwN9GgWCtCKnqNo73Yb zPIX9sH1aW79Bo+Qx+nzBQlKgVBDYbzBIYGk9IRYsLGIHoTwszMeghbYzkhnHpR+swMZWfAY/FGN utNrBOpnRRpHZWpUoD93Pc/VILbZBDiV4qgH5blzN2odFJ8HMa7Ke+56pGnHAgAJsJ6LBSi7Z8HL LRVaK8Mm8IprZZl86al97grRb7kFAhTBy1tf9upXyNPAAd14Ss5raIHps0CPLvg0Z0Rg/a7PTLz9 e27fTkOYZYcpSom2TvECbaYIA7SJF8sZW8A3dFcBInxuox7P0eh2BoNBmxA1FYBk4I3jCbgATwBM Fm6RQr/ZDJcBKi1DasyoGvpeFhd4Bp0Xxl9ths+vPj1nhhFi5Qw30TjPmGGEt3SGvcC+taT7W9Gl Tygc9A7Xt9DgJEAUIRkRQIFjjitvFVUgHvj/DOLQqogo9N0N/cvEj/peUWLjMOCOzUE/g429d21B 0QxoC3smgA+T2CdNZ40Dxy3IEui/9V9f2BESYIYA0wScOETP9+jqZHRzwk4/XRzdnF1eGDyLwPUj S4rpHCZUFgY8aACnysWEiYk4BAK4zrxgyhKyWYtPsQS57SlAmYdb8oY13GbO0pMe8YooH3jol6LS L2zQzFU6D6agpyZsgnoKRgeJT2mmHJ2BDyB8CMXQIZiE4i6GjyE+i2YYacxcyTbTJ9tC4OTiWxCn gdhUxNJAeXRzdrGuLsmwV1H6VgJujmYfNTKsQEM5xTJ3fWsOTn5B5+JgfhDhymqMRQ/PPHEvPPyI gz8FHJOoREGZpXgRFgSPblRnqMiWromoCCvjbtphUJQ/CBh9qf0lhYkiSlK8OHUolYAd1WCKWrpj lBdZQbahCUuZqX0pQGvHYYgsDBZ5vNL4qGAf4H1uYnLDVsLrT9ypBfJdPb+g5969HYV3sXsfgHaD ocJgGvI5l28/glc8DcX1T+dvDzq9t+DB8bcL9Zm88zo4chYv6mcRgiDOuetrunFIsS0uL6HAYHyO y1l8toHBbl5HNw5wT3z03BWehcd9X5CLGUuRoU12NcDAC20cJk5d8o7tRWy5viM+W+S0UqyRH77b 6XbXNv8ZVmlowCshAQa4xqh4dBCuJhFIY7whuD1jBEp70pth8LBlrJD6Qm7Y3Nf4QUKA5UFYAp/g 768rnyvjh48IvsGEK/CXH0+uTjTWai5nsK7vaT2JlTSRBpnBTXgzjEaksQT7BPFS6KJsWbbHpcxo 0PZcHnCUCc+tHzz4mi4zdJmmC4hwIVqOGwqMMit9/FWW9DJEyZKmCxOSgOEY+HgdPdYoFUrYXV9u sw/HvzblCujdBapv1G9cLQqMJUlHk0txz71Y8WVswUJXzqlc8JJBa027gDzvIEfGHPQKkiSflCAI 7pB/XulTtRBg3wBHjCOVja1QpT1wMF0B+oLgt2rDQM4MSjbxTaMjoON4amE+NXqEN9cvuX+N87UO eU4LHko1WbgQwXiJZEplBgeaBHVpyzg+hkrjoyag8QmB9kWUfKPzXISCWF8Qivgs7Jgso+JKUA9F lfQi4efGehGu8Al6j4ogFRxKsCY89sD5icCqgzK1pRXxcJooP5Tu9VHlPTaixFJKTFHKoKBySMU6 b08hGxQZSpjGDwXqH/UhSTaZYYH5jiy81E2zXBl4yhHC8eF+R7tpkSjXaJ4NL+u4phTI905sry8e stfV4ENEVuB7j6yNIkORfTj6Do2O0xlLBFfAJTPAHtxoZgWuU/StGwM7UhNHpNXkISl2eXYMfvSj oY9IHkGfu7blueOQh6AfOVyWG+ob+ArM4bpIUucERybVrEhS0c8LuEMmfx44sUrciskETC9V9mBW RSn9o+zK2pal0l0CdyOeU+GW8THaMpMS0lb5lhEWREd20Rq70ZwvpF1SnY1TMRVuPQBErx7gKLI7 RBe/lCmiGZczPq2oZL8sIiQLCxsoh2LKEzVfAPbPwC1jeHlgjOgW8JAGq5i5F8ZDZCtnbi5A21dx 6GUBEdlKDvkQPXhBsKgY8SUBIVnh7BDlKlhS3FVN20vDkioD5nKvcvZkEFbb35dFJT4vPNcGJ5jo A+MWGUwRWJSvwKmbs2OWZxH8tgAWRRjBV2Q1G5u5X2BIrbHH3L6VHi56RZVKMkHouD6YNaYgQNgJ Xh/3CBswkLt+bVzQmFWfpOaTS+EBKEmAuYijbHR38r8fz0dnF+znk6vvL69PCBYg9LlnLVynKpPV vKsFCzF6AiFChkgZHeGPMHUmUFgI2524gFdnsgBSyK0JmOoIQvGpW0j2t5i8TAtXmo6OnhALcIsg wDTuqIx1Egxjc5JlB54HFlmkFfMMhbbKEdiCtEO5C3IQxuIxwNrWzAX3U8ZjnV+jPLAfRMxgwq6h iXz07aVUGsrbaRBioxSSmYWB7/7GTVncVKTTzO4kxpounwrrQYlD22C0lCGdtACJ2eWHmcAUaQgs BJdPyZmKxXimGgEQp+IuWE6jJVU2Fb7Aigx1lZpcqWlTQhQWeKT1Sr5hCvyHk58u3zFNwSVV6qhg NMoFFij/AXwQ0h0YyfK5ALZJAxIfQ2WgK2az4QJVINPVSVpUkdI+MvemAUz5bG7gLILAq6nctg/H d9x714lBsaPSV6ptEXu5SZTCE7p86vJiUahBl1cKSFO4xySkgIAClAAGXbWI8v0o7SJKA+eECDCK Oihh8uYyr7pIpLTwAbrZmNcXUdjqdZSpBSOqGkoBXZJ0fQ1XvK4opGwwF43nEjirg6ERDZxKMHRF DRyw5FPsOQGNisnJ1iP342RgtCKaHMP0K04N+sVf39T97RJ8FlVkiu0otXcTEPAI9BAivQ3HEMBL 4fqSUtWtM4qQgjkhpfh3EYIyCGQmRY0t4jHI/ZgyfhwdMFj3CGkHmxh96eJa1UjV3FszkJhSv0d7 SbZkeK01E9SKfB7LrXgsSz2Y+bPzk3dvYxm+9QKbeyDQ8s57KyL7Ldy724G7Ij5+Bha82zgIFVgY DGQcQAIV3tc1wsCoplTalEG1zHFtBOLZSvajel2wFoIUCPUDqYKZp5OMEENQVhjbHTWG6HGxTDm2 hiHpcqCCGDhLesowEYuCjGsQ5opKy1mAla0P7QFMRIj70xh7IMDEKcWQEEaNkDjvGlQAfhavKuK1 C4r4oOIFCrQovZ8QV52vUkECFwIc9hqv/KUhKf9FIyl3Rv+OSGpqjKj8hW9xx0F3pipI+GtLsFAv 6rUfsrOPTJPcFHILfWEFBH5CUMEUdIDvC7vS1W1uVqhLiuoJMraxVg4xDEspaggOFth9U+cojiEj UBlrZszzVYWUCs5ZWqHSuQSDpr5Ajsp5auEdraJJKSIuHB5thUzwyNo5ammCfEd1bErsZgh87PC3 vZj6zxztsRkwxoGrHK0NMMQcQ8VUo8wOGIeB/0nVIDFXzWAICsQjCC2YzHEAfshjYVQT9K0JKpmx dHxABWSngMaoaAOEqrOABRG2PVU6C2BomNYtauTMljsrKtSIDUWqvvs2bc/aefPrzpv5zhvHevPj mw9vrjtPi3uGSeRkEZkFeq+hXynSlZ5hW3xKpChVhDpqTJcRojBgPNcXmLicuJ8rRnuztqtKtx8F fhQGFEorG0E1HSKmUhMk3sgfhKEAYb+lWQFWIutmxIYbV0pdgmlHQWV7CB8HEIPrpJzBggVQ3E8g 9DropMDVWiygJsoL7td5B8/iJG1VpH0MGRwmUYMtWEiZ8QjNnkJN/bWqrA2crkJb59u9fGdrDgq1 UlRqjfb0hqKxqtbQZYlKaK0h0/2WK0ILg0gtEWRvaezecNikXSrZTZvoLmboKdkPbDsOdbL1AhdT DI9SAFaRscN6e399ZCsDu3W9YPyYQCuvy+zYPvj16yLLpckwosNiX7pOc+KefF4hVm0JlR3PKUN4 L1aVqyiMfQgNhYX9LYa1baG70YOD2kUYWEUztpE4htaKTJZu1MVvDQjAhx3S4L3jo1gPQXgLCmye J9DbGxysvXWwYvMFEEDHVOlPyqejQc/g0F26uhcHbnsiomir06u8PyvT756BoEERi3FflqW7dgug GjVXLgEl4Xcv4r4IYuk9qkZ8Nd1Jl7aWwHQrNeGVc6u4yy0luNegZ2c5XurPUYQRoDL8E2zyU31s YFGjkNu3tJgN0FB4lcUSYGyTndNLgVa00T0TsNn5xcPSNgyShLXx5vJNZcTJjjAgHJNa1IgoQ47V u9ACH32a6xmDuV57V2gNopQcU+Q0CtrBcCseK0TuCxs0qaEs54vajICENT+w1Vit1Wynohlqr8HO 6OUiRXRpy2S+8xExgc8OHpRwrNwuGjNo/8WUWkF/GBjFHkiECLbNvrUcscg3HWoaaBjaVBlEjRE1 OhEg8TQAzYJLCebJwW1s4eOilDBoodxM4yaEiGhdWTm5a3fYQIozLLg5+qioZf0HSquBEUeBgVmy 8JCO+s3UDYu2fpA9Hyc9eoBIYxuobkF1K0pqDesv5/CgWA4iKUypgIOgSWOZLUiLMCCnTqBsWeWW HVAt64JRt6+wYYeji5u2oMF6mojIxpbLxOwhYqESclZN5rGx9NJpKphuS85PofZwvoiwzK2p6v4m YmY2fxKKKajpicfvg8qk6BfGnXt0zFZtEE/QGX4CJXChQ2zuClVikL1WdF8DDinwOJ9Si3NmoG+w fLi9iMfeGnF/tpQMMzTnmqCuIKGpV4XJJKLGmqm6dOcu5h51wxBOKgD+DhtqtSbYNDt8tup31mpQ ptxUMepBp7f+cTlZe6tRaVJIm5auZY4KqLh50N/fW7vyXdmBptWFDiYMaQonxo8ZmAgP85SRNQ+c uvpowxDsChRgljOKoIeb0+SdB27QTEAISaFNBe2GRwOoJBYsfO2+qrhKpdsVM0y6GkwqbuEDs29O y8LVL6X3BImWtqpdX58Xoig8M8DhYNSxk0PtGdbNqLId0t92Op1vmRmS2gzSRlSApPtN1UwlKYTq DXPttVEafwcIBw9oKUxtYrOQKt0iC+M/5soTlOCw1NEbKhNZJNR0b0rgYaOUVAdt7CgamSwHlpfM jkN0F+/d6DHBpQVLT+PL4MpgUb3FOuGcngInEzxgZkSEeRetHyUZylbw/EOEAaaFFCyYxzyPtC4A AEgyBRQ8VE5bmwwCGitOG2G09KPkvIB2XJO8ekxA7WiKKPy5o99kDDET7aDFCYS7nHwOqL0GvFyy x9RypBcgGzVpVds1iBBeZC8grIW4yXPvBQp9XDp7qRm8D6WoDSOEhCRAo2ht7kYVcFzHK3ZINVZd +XMqXCljXG45UFVI8KTEe+5lhmoZyVK2iPmi3ikhl+jFknRIO8AdeyXXRCfopPad8IC8fyzJkn9h P3y4WT+eyebQzSmUapef6v7BWVQJL32mJW22xSthlc5p0wrmuoSF1atJzeEoDfXWD6rihica4Wbj KR1+k+zFYOdn1zcnF4Ty4vLm7PTXBFPt3p4WnBbs3MxWWJWlAZUQxKGNeWvdWIUYlAdet8s2HbSt 3bYmJ52hCCFqYd9tAVF2X21rXHoCUXG3rYGEXLV83OMg7qgrvEVIN+jkSfYaQ8z3F5/Oz19jWyn9 ys6uGX0COGLf/QzyY9+KqLI9p8Wd28noDxAGCPrsE1DfcQI6nUaBSMrfaku3U4CIp7QV9/u1BzF4 oI1fiohOcJQhFiCBOaTTgLM5+i9st9egmSADiVNvF8sSWQas8pzQ3MgN7c6TR4YWQJRbv1VSt1Ep YIUjQgtwKFcGkphtZWqcY87CoQNJKd2FAh+5ytYl52mWsMzcgsPU8CjDGiwTOtxQN+soS5xsFS9h QknLY3oR/lAn/hJcD9xb5rW0WFvM1+h2CJ2hjKsrl2LBJ/hldK4B4jY2ay6iWVB1sjfWJHELBn9i U10tQBXHqG4XopHUieF/2xyFlhzlGkeZzXNVVez8+L3DvVYOKFhe0VYb1hANlQ1RQ/wGISPwZQ6M dqpqsS2EgD54IzGdaZucJLXAIys1VSWCMzDMFMls9va6mJWFcCwM5NbGhj6/fwNear8Uo+Bm06He Avj14rRzdmxdnG7Rbo2Azgqdb28wdnzSGX2wrk5OT65OLo7ORmo3B3jB9BcA6ID645Oj89HV6Gh0 CT9us6PR8ej65uoSf9hG325knZ5dH8HEXpxus5MPH69Orkf4vm3+iMDo6qdPZz9fWh+vLo9Orq9H x5f4EX2rjCuMhPBSQu8BVu4D9CMzf5NAPY5B8l7fnyDLXwxQ8FuNTA9tcOYvBVj4pQasL9W/0WXK 2IKOLPFNpaOrvvluI5kgsz86OY58pdmiQXb+wpbNWnpN49nLDlU/i9mrVprNwvDPm9XyTU/ObvmW pbOcvXzN2f5r8tqYcz9Wf4dhDBEHOoiZL1Ox0OLwXVlQVhGQerGoEAUGtgKb7ehMiKxUYOZo8+k5 3Mren5cjGmH5ZObuzkgd3bpsSnM3VoskjbFsjrfWnNh1lDu9fvp0cvUr+3g+unj6D5i85GuD/YAP PtLHygjGNtHNed8f9vaGvc7goNPp7/b34X23j+lI+b63DyGOE83eH2zh4+/8D2PXFL6XbxzuDobd zmBX3zjcP9w97OXuVi+6/+/i8R145B2OPUPqz5G4PL0G6fyIp078jQ5w0cS6h4POXrfTOQQ3YL/T 7z9FSb1oHLCwzju2+Rp8DhG+7riOZXOHo/lk79lrEqncp6VR6MnFHbvGkzhAwMAdxO28eFw/wy2v CiIej9npDA4P+nsdgPQsfMmzJo+5O4SbgaPqBz3K7nB/t3aMJVzbP+h3YJzVR1vKPUfYHpY0eYF/ 6edLRy1yM5kM+CHPy/1Bt7O/uyrqIk/3dw86vT6MRu9qtEOsbT5nsCXMPdzt9IaNhl3KZTHHgjvP s1h/+OyxK4H3Or1BpzMcDjuDQQl3r//swZfC52r/eB6+/nBFCkWBycifI/IS0z/c68CjlB5qbw2S WRkClsHo+K+Wxq4eebjiwNVPpPliulK5E+BH+UdrRLz4PAfDzh5oGXpTgw7293prPlPxaYzkwnv+ EWrJbfbrQpomLtGfPvMfw2deSdiS19f3q/70qP70qP70qP44HlUrLkk18GGnCyK2B07CcP/FXKpW PML0Kb6yS9WqC1L9VKs7Ims+S2vuYXuOYb1LVfKpVE4+59tgkfLnkXUDH51bZzcnF9fHF6cgeJva /5LxfBM+/mDhTR1z5ZbyoJIvtH+TXkhOGgyTIWUcN3Vp4YvElcHahqFddHNeIr1FLwUp5+0Qjl4X LoD/sL1hRYawVVjy3+ww81o7BfX1HSXwlC7oJFp2TmfgGsu81zlABbMHfs/+bmf3UEnx/qHxkvrd buIn4XIre1pmCHBgutqs9Xcr1h6OUAWB1DaOsj9Ycnc6xhntUqLVGVOhZnLrZqy0lRoUa4LHPS1X rQOgq81Fb+8JjaEoa6OQM2a9biXU7+lga/ajgH+WOQaKB6C/DP8HT9jbK0GnShosMFTZhalybZa4 WRprhrt4PAuw1gC2ciMp3uatFP69lxz8Mldq2bnaI9TKQcaJtTLObyIJWSc3r8Hxz6MPOwdGgve7 hQVQgTkzWNH/LnvlmUFOXQ++hQE2sXvT435Rz7x7p89wygYZ8fgjXJplKHKhtB57/QH52vRuAopl XlCdoOKJisTPVErRM8RxD7SxGy4duFJUgSMQXLxn39TLxlJpTFBZNFKlGPaGBXjL5bC8sLMIc3xv yvEX4/UqXP49+VvL2c3+8Il0k5wFD//f3rk1t21jcXyf/Sk4nWbq7sSMLtZtd/bBm7itdxynE7vb TV84siTbmsiSIkrxZicffnEuuJAEqAshO2nAmdZpY+H8BZLAAXDO+UGwf37StdSrKYPZCzdqaUs3 2vDj2cvI9TtYP5NXhNlX/HjJRdIPoCJZwmz6BL2kQsdUDKxQRTLoDHY4TCO2R2njkdwqoQwcrOQq BvoVYbIIUz+S2RGW9qtWDRduNhkxsiDAsILQY1YLMuizn6zMVuK44TQ6eXl59TzCf53Cv+CLXp5c we7oiZKho5AZAm1g54uJN5Xx42vJn5AlyZXAGAeZExWbqGqXmaphtDpFwrCVSYiwAOUzgG+A1FVI iSjyvbcByW9M+pbSM6WVP0dVKjpEbtL3Nl8hq3PanxcrPlZ+GCHUH2uHI6XaZM7yHV+IUeC58XTG Tuy8inH1ip23BrZuBJvPxrx6FbUm0HUjeZlXBd+VChUfiu/KeqT8xm8I/8jWHq8c8el6Q9YLj3Og +acipfdNUIGblA4SraT0Wtxs7pxFs56UDvJKSelSoLN8Q6PaHS4KpFEGhzE51ODfp/kXPAeaf6o7 DLD5De4wSLTe4YoB5OvuMMgrvcOYkGsnKpCFbr1XqVYI5t9L8Fmf6kugVWGcCPWJuwKmr1SRf5Kl 6Hox6w8HEFjM5b9xNRMzJl1XRGJUvdlW1YR3XB6qykdsgIubvXx7enJ1Gv3028XLq7M3F3EG264Q 6tkGfVXkl480BBJgrv8Yi4JqcvuWlHlrGjrmLHqVm/eIt1RZpEahmWY1Vwkrro5voETJBNMBbwyb ukfvhA8AJXLuwSG4WVAZlgmUf4CVBtTqPNTfDAnKxJ9/hNIdZOmH1F2xg7U4i4buv2Joiil7M0Nv rKjyjonKZx0Ew90cLGb5588s1EWacEWJA69MANFJH6w6HV9PVPmIrNmKU1ihyq1RGxBL8GWqeLGP ynUi5ZpcdivqBXaJm5uyLTZFFVsmcIoNm4IZc0VmColhHn0y+u9AdHCugoy3EiBGTSW4dytCJLBt nFeZ7zSKmNUVE5+dKsnZKe3Ekt95+t+aJa+qLFKVOQPRLmch+ov0YNCfsn7JnbfVqyL9jV2fz631 ywroUhO8gb//cvr2lLXae9nQuruntVVpLUM36jU6GpQikz6RTPqEmfSGKV8uD0J2hJ7309nDlO1G 0m7EdoUieBHLSv1v90qXKVKvNP6iMik0AJ3ocvnJyYb6HJ1dvnkevX71rmqvcP0Ak5bo4FQMrxEw hM6phZHtb3QRz/ORKnGiQUMggWnzjtI+1RfYV7K+Qr7YuRjSHvpi6iICzHs5MaAzg0d9uPQmdbGm rduZl172a4foORFqHW4WUd+huinf0jTOAejxVz3rsFPfbQWUM1ImViywNym6cj31SgE6r6UQmh64 J/uRYvQKVd4mg3jgUJBFtHJdVychQr1q11eFZFlJzKx5jZYMFQahPteMt4oKrMKwBNv4hFS3FPEd u1jzZpUOf9U5TMc1V5NDzb055rxDn1mzw1+tDtl9+eocxHh+yNeBlcKAlZjMxkPvNftf0o1D03Tz wFT05uxValSvAyUEpudCpJ8KhSI/R9+LvxLT4a5KtHMCLePQTCbx0A8qkeKUfz8brmjjdnRzQ0jJ BJP3C9s/NK/4SDXX7pJwN1b3c6MmjdwS4ln5vSokwLRpgtJbgNP7pU2TWSuTG9jv/VvLSfb+kfNA GeSwBznM54TZSO+PIMyKVMcRzIYK368eNGu9cwilt/XQfgWhWWsPAZQeifSPK2iK4X9HaNkmKx19 eArCuy5EbL17znpZ+1UFocHjgXCC0b7ouLmhaSlmlCfoqauzV1G2i5BKz3UrLbua1SkiokkesVUJ UraKRzKzxXA8hYJxXDqTa5OiNoqtdq4LKnfVbyn30xiXB2KQ1PXX5Oru9D+/np+cXUT/Pn37zzeX pygLcFz9STIfD207WdWjWgi8QnjmVEwnKTjCv4pbJxcK89GAGOW8kyUkLfoJgugTZtTn2vS1eWnW zkE7CqdJZWpAgriNR7RjrRbDEJz09IDgdHXN+2uqzrXUBFFDN2vK9lR+3n6aLSBQCszcLWZT5rlD Z8oTab2zC4x6qs/0QI+DbzH8lIEdfQAJu8sPd0hWWYguFC4fPWe0FusbpxEx4cLLbXgayoBNBicy VFqI90oz0HIm1dubqbgFThh1tsA4clqMLjMLC3j+Z4h9RnC5WMn270dLqpyKIiVizYLz8Q+fXypT 7CP3J7czccvv7qWc+Ww2cZzc+pczHY4/jodY9dBJnmdSPRyfjvv5Q6GKhW9JEFsAlBUU4gdIACy6 nIqy8Sh+FemFszIiOgojKCGGN80OXfhI8cMn1N1d90vg89ufo9wmokUJn7dvun4nfsMBn4fJs0TO 9mKwRSnHKgZ/wyGH4PRQiI2R9Xk5FV2aV6phmEXYXATbr3BrwC9++qnuX2+Ez0KHTCuoKSfnu5sJ 0ESnqBQA6sDrHk9T3Kr23lGoVEwnOCgqcLreooYQ8ZV47q9HVKQeJpoUEeJHEMQ4TcfwrsYZ/ryV eOpvk001b+fPZ7W8H30qPvVimj87P/3bi1W6eIFga/FApx8mL0bLwQvx2VYsPrXsX2+gBT4tHQSL FgA9SQcQRS0+ugJhIs2lrdpBzs4ZDySHHhn17rFgJwVaiObQox3sHyyMYKLmB0hOdDbiT4OKcsAD MeEs8S2DjVh4kOEdlHASU6CLl+pJoHqE+tPbFZdspoFBGYYRQTnvLEri6Pcsyop7V8Yp8pUJ9JxH 5Wpzv5LIf2ElxcjoR1TiOGMkVlbCYHrbIuGvnmRpBLQQdvZrxCYPR+mP4AuTEPGnmNCf5eRKL6h1 rCe/wnrJYg1jYAxYgsmFL7bhIFJtKsFKn0degjqh4r0EqcZ9QA6D822yHg6+pRpt0QYOF2++8x55 ukHTIUVsctH/5wznwceZPTYpRjpw1tZ8UcyVFXkaJTNghpHwPzOwGUTQI39bs+qzrcpF346i1B3T 7SM2Edi+aoiWQphTb0NH+4L8ShvbIn7hkXJH3+rwrKNn746e3R89GybPfnn2+tllvP5xNzoJnSw0 MwfvdTG1PtJWz9BXP6mnSA+EvGo0+ClChRQDEPqE8PSW1p7t7Krix6Hc8WKGS2lNaiBjtDWBjzf0 D8jQkHb5BuTp1ZUTVwpRgjqiwBoeQlR53pTTbGsJAyjQ5eldLDK3xSPWn+7AxNM9SRgxyGMwdMiN GgjBAstRfwnTHqnG+Fo61qbK1wW1Lt9u/5GtGSnEqbcC572NG2Rj21GDjyWs0rwp43jLLaUp5Dx0 b6Ht+vHuxPloa+S8eJZWCjivhFl27OC8vbG7sq2FKUJtjkJvbXtaQvnZQJreJoMVHRz26fc087hr kF3xsfL1UA1W97hD+HG07XO1ZFw9MNlU1/pSd8WNi2EXqzne6rkRewxmK5yyOFAX/laKiA9MBn1i owgQ8njn1MGNyQGGDo7SNZjM5SsKX5FexfwsI949S3FEAjp0MfK1JX42K2pfmK0cyxoD8el2qyht fgJ1KrVEzFv4C2ywVSFmp1yvggJvjJZPoQrjxHpYIjq2SuZ0Ob+sGEa3oWCZ+dVfFNIw8EnYWW9m v6moWGWECcMrHBZZkYbTJwSnzzTZrsKKtinS5iIyxyowgwGQ9LZmKlDE1/ULJSOAYe4PZNLju2pG Ksqm2hUyo8sfKbSLKZPZyEfQJCH0SSaLRjZakVO0+fghZeRjIEEi0ukTpNNbbMDE4HPIQGsRWsOK AMrTEGokoh7S2IBZn98w8HDcjO0qQ2jUydqTn2odV3iKjS4ApCNaM/0H3FYDiGmMQPoEinS4k6kr HtpOZ2Z9HF164EAC6RNNqc9/tuL5y7n4oqkkL2krwkFg04RvV4cw4jkdzmgus6bsiKFlVzH08S0S dvrg4uoQNPE+3YyWAwi5VNMeKB7Rhlzi2Hn0A5yF7TZVPwXDw/vzJRxzs1WOb8LONPdPFqNbMUwT k97efH/4ERyzbQPElTrZn8KScKEXENy1oI3B6DuyC3xCQtMXQpyNhr6H48Pn89X1ZId1v3mUjIB7 NsgnSDDV08GkWlHDmSn96hEwGzEaJlbY+UdIqOWR4FBm+PzozqxlUfK4ydJqN67vXi7HnG9ZFZsC 2/jqugFu/tYQxiyWAbXlgbNaJshDNH1yPxu6zkcrLsHeigEwA3tGg0RY/zARbtDdSCwhcWljsV2x NABtYokXn91XWlfRdjt1htyuFlMqpPCJaT/DDE+LWO6cQj+papeX57lVFNQMGPYXyLnmnOFEguu9 mP4hjuMfItkkhhnoQFQhieNNJxIKTlsI9oQ5f2GU0t8RhmcPMFPIs4nD3FbpjzjDTD9ljicIXk6l N2xQdX9IdbSxJVSdHyy+jfvRZWih2GLecNZV4FKlB3jmS9h34fERoe9+9PwxWsxgW4hkifuY7SMe C4QAMKkFzR6st81nBwkbW9421JjwV8l4AX5ck+zwqEQdsUXkz5ul3xR5PpFA+uwekL8AvMxmjzzL SScz6EY2TWe7UpEF+Y4wlWz7FceK14VVWyn0PUegH07yEVKeCfTjNF3B65YRZVMClRI/9idGU56V lHbL6H5eRpXFujL72ksStmeQsVdwTXiDLmXfCQrk/VGyS/45+vn11e7rGXMPXVahpCw/iv6Bu0gb XlzTEpNt4TfFW3o/Z3z5YARVZcc3juIoFcetn+nEDSoaQbLxLRa/UbkY0fnZ5dXpBaq8eHN19tM7 pcmZ2+PBaYHITfOElWYaMSTMVosB7FtzYBVoIA/clWWrG/WVbWsnz+fybnOKzLxab720RlE+21ZK gl5NppDjMPqAUeEeJV2Bk5dG38ES8x9IvoewUvzP6Owywv8TZ6nutvAcj5nbqnUiF9h57ur4m1K6 hzmJxIXK2/AlcfaAiV9kpAw5b0oyMfW6zVa9QjCBIamPsV2RaaRMmLVOaKblivPO2pKhORHF0G/a 1K10FLBFidDYwnoHSP0ns72Ke8wO1juYGdNcp+ppFrTcjXMOU8VShg4tZcz5giZ40rKa9tI/GIlf ogtQ8yVei8ezxewZ3RGqk5bh7cpsscA3+P3knAVCGlvCnPqiBTiThBSM/pqkOqdAWsdQtAvaUOfE 4p+BLIWmSrmulkbynO0UO9v+45xoU8IaqMFjQxgh/ieWjAlT6W1nsR6WgFPhjaywpq2qJDWHkpVs lR7BOzEx40rmsN52UI4CSjugtPeHMHCBH1utdrsZ13oANWoD+LEt8T7H5eBH44OtXrN1HHd7CnfY 7jR8gx8bCH7s9rrd47hxvM4SXU8Bfuz0unGjvpk+C/ixKcGPTR/gx7oEP27XWmnvfXXgxw6DHzt+ wY/HDH7cudnSXg4obfNLBJS2X5R2kziWzcdFabvMubiPAaQdQNrOKzhWwbEKjlVJbwbHKjhWa79E cKy+RcfK6WKpCb3I11Z/5YezTc0dKk9jc8Z03kcppXBbHJpoSzJ3XqnRSqVNNGe75Qzv/Dfanuht MfzohO+n996sfG/hDNXaYkxo9Wr1lhjyeBw/7kqXrd7rleO9uQXxoy7dPdv7Xwr3hjaaJR/WTfhl e9c7ykftrBmzAtr7T4z2bvZqwglrdOWU0sg9/BbNAe0d0N4B7e0b7e10z8r8sz05aJZrF5+NPoOJ 02nOlXG4ZHkh6zbq7J6l1Z0qfkfwptb7bqWfU1typS6p+nDGofPgzD2aK/foLtyBc7Mou1NUO261 mrWmmMHaPIM1G/V6OzeJWWaek4tXm0xEYSzc31iolFicY17s6k1Kq49q9YeU8zNn58e9OdZSrpt7 e7H4BQyH5/v6ej2G8zhf75c340aj7CtbJLm2FYejtV6wejHsbn141r3N+/VeeSAQQ+P/fnBycXL+ 7o/T4A4Ed+CLdQeiJ9vU2dgv6DbatU6zE9fYL2i0G41m79H9gnYt7nTFyAY/e2vHSuva3jpE2QZR XtELU20+8Gk1ywbRahNz79ubmDtf+MT8VT5sh/XWJgEh4bQinFZ846cVzZ544brtTlu85F32SZtb nVZAC+JHq1bhtKLZforTiq74EU4rvvnTivZxvd1UkUHNgkNn0fxlnlZsPlXrVh53wrZ05fZHBF+n R7KHENWQsxNydtZM+vbQ0matUxfL2EZTrEDqvW7rWE0/9WwoXz60NPNB8ae2XrK1e612wzZ7VQ8t rddbtU4vbnXXmaLr8WNLW52u0NdobqYvxJaG2NIQW7rBlwixpd9ibGlI2glJO87rS/esGt1291g8 +B0Ylnq9zrFeopR7VpkP1hv1btyQk2CnVW90an49q3ovbop5rNuttTtxrbfOEl1P4Fj1OmKp16lt pq8wgPe6sG4Twyj9oapjVRM3pbtDa6W995U5Vm0xnnfbcUw/vTtWFZot7eXgWJlfIjhW37Bj9Zdw hStc4QpXuMIVrnCFK1zhCle4whWucIUrXOEKV7jCFa4/4/V/vVNQVwBAAQA= ------=OPENWEBMAIL_ATT_0.601322115256579-- From pgsql-performance-owner@postgresql.org Tue Mar 14 15:36:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CDB9E9DCDBB for ; Tue, 14 Mar 2006 15:36: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 98647-09 for ; Tue, 14 Mar 2006 15:36:28 -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 BCD509DCC94 for ; Tue, 14 Mar 2006 15:36:25 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i23so2320479wra for ; Tue, 14 Mar 2006 11:36: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=esR5YMKJPBeSogkE3VM75XBfefigYAb0DW9XYwBPo+ljKcms3BzD0AkDoFP8zQsc5fk2yeNYViox5R5/1kauMxC3uwfPWimkUQNBZ13BwSprNnUku/KLK7hKoxgLjieT1TBOKYuJkZ4s9PhduvkKJZrrSLCEp7XmDL4PvmTNFoQ= Received: by 10.65.59.17 with SMTP id m17mr2794377qbk; Tue, 14 Mar 2006 11:36:25 -0800 (PST) Received: by 10.65.137.20 with HTTP; Tue, 14 Mar 2006 11:36:25 -0800 (PST) Message-ID: Date: Tue, 14 Mar 2006 14:36:25 -0500 From: "Merlin Moncure" To: andremachado Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison Cc: pgsql-performance@postgresql.org In-Reply-To: <20060314183226.M29726@techforce.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060314183226.M29726@techforce.com.br> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.142 required=5 tests=[AWL=0.142] X-Spam-Score: 0.142 X-Spam-Level: X-Archive-Number: 200603/194 X-Sequence-Number: 17631 On 3/14/06, andremachado wrote: > Unfortunately, the first query simply returned the same estimated costs b= y the > planner. Can you try making a big increase to work_mem .conf parameter (as much as is reasonalbe) and see if that helps either query? ok, thats understandable. you do have indexes on all the id columns, yes? > The second one, using EXISTS, multiplied its cost almost 200 times! regardless of what the planner said, could you please try running query with explain analyze? also: 1. DE.ID_ARQUIVO in (10) could be written as DE.ID_ARQUIVO =3D 10 2. and CAD.ID_DECLARACAO=3DDE.ID_DECLARACAO and CAD.ID_CADASTRO=3DNOTA_FISCAL.ID_CADASTRO could possibly beneift from key on CAD(ID_DECLARACAO, ID_CADASTRO) also, you could try adding an index on DE(ID_ARQUIVO, ID_DECLARACAO) 3. and (select sum(ITEM_NOTA.VA_TOTAL) from ITEM_NOTA where ITEM_NOTA.ID_NF =3D NOTA_FISCAL.ID_NF) < 999999999999; this is probably the major performance killer. you have to somehow optimize the 'sum' out of the target of the major where clause. One way to possibly tackle that is to attempt to materialze the sum into nota_fiscal. merlin From pgsql-performance-owner@postgresql.org Tue Mar 14 16:11:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 165139DCC91 for ; Tue, 14 Mar 2006 16:11: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 05942-09 for ; Tue, 14 Mar 2006 16:11:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C8FC29DCC9F for ; Tue, 14 Mar 2006 16:11:25 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 953CA56431; Tue, 14 Mar 2006 14:11:26 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 14:11:25 -0600 Date: Tue, 14 Mar 2006 14:11:25 -0600 From: "Jim C. Nasby" To: Scott Marlowe Cc: NbForYou , pgsql-performance@postgresql.org Subject: Re: Process Time X200 Message-ID: <20060314201125.GR45250@pervasive.com> References: <20060310085943.GA8913@winnie.fuhr.org> <4411499F.4000005@archonet.com> <1142009216.6249.37.camel@state.g2switchworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1142009216.6249.37.camel@state.g2switchworks.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:smarlowe@g2switchworks.com::3uTFgeRWQZB21/3O:00000000000 0000000000000000000000003c2u X-Hashcash: 1:20:060314:nbforyou@hotmail.com::p90xMtOl/wXcuraN:00000000000000000 0000000000000000000000003usm X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::rF91r0ZPNXPFLGry:00000 0000000000000000000000000tJo X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/195 X-Sequence-Number: 17632 On Fri, Mar 10, 2006 at 10:46:56AM -0600, Scott Marlowe wrote: > I think it's time to get a new hosting provider. > > If they're still running PostgreSQL 7.3.9 (the latest 7.3 is 7.3.14, and > 8.1.3 is amazingly faster than 7.3.anything...) then they're likely not > updating other vital components either, and therefore it's only a matter > of time before your machine gets hacked. Or you lose data. IIRC there have been some data-loss bugs fixed between 7.3.9 and 7.3.14. -- 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 Mar 14 16:26:57 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E8EE59DC818 for ; Tue, 14 Mar 2006 16:26: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 10795-08 for ; Tue, 14 Mar 2006 16:26:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 92E949DC80A for ; Tue, 14 Mar 2006 16:26:54 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id D17CA56427; Tue, 14 Mar 2006 14:26:55 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 14:26:54 -0600 Date: Tue, 14 Mar 2006 14:26:54 -0600 From: "Jim C. Nasby" To: Andre Felipe Machado Cc: pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison Message-ID: <20060314202654.GS45250@pervasive.com> References: <20060307162842.M37264@techforce.com.br> <1142041197.7572.6.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1142041197.7572.6.camel@localhost.localdomain> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:andremachado@techforce.com.br::PHh0r+O1UBA3Pz6t:00000000 0000000000000000000000002hzi X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::d3mw5WH7iteooXm7:00000 000000000000000000000000FjZ0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/196 X-Sequence-Number: 17633 On Fri, Mar 10, 2006 at 10:39:57PM -0300, Andre Felipe Machado wrote: > It seems that effective_cache_size does not tell postgresql to actually > use windows disk cache. No, it just tells PostgreSQL how much cache memory it should expect to have. > What parameter must be configured? > Do you have some suggestions? Well, you could try increasing shared_buffers, but the real question is why Windows isn't caching the data. Are you sure that the data you're reading is small enough to fit entirely in memory? Remember that Firebird has a completely different on-disk storage layout than PostgreSQL, so just because the table fits in memory there doesn't mean it will do so on PostgreSQL. -- 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 Mar 14 16:32:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D886E9DCC36 for ; Tue, 14 Mar 2006 16:32: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 13586-01 for ; Tue, 14 Mar 2006 16:32:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 8A9419DCB4C for ; Tue, 14 Mar 2006 16:32:52 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id CDDC756431; Tue, 14 Mar 2006 14:32:53 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 14:32:53 -0600 Date: Tue, 14 Mar 2006 14:32:53 -0600 From: "Jim C. Nasby" To: David Lang Cc: Joost Kraaijeveld , Richard Huxton , pgsql-performance@postgresql.org Subject: Re: x206-x225 Message-ID: <20060314203253.GT45250@pervasive.com> References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:david@lang.hm::YcFS+ZH6qRsk0DBA:00000oMg X-Hashcash: 1:20:060314:j.kraaijeveld@askesis.nl::PTaCQFHI0wTYKkVw:0000000000000 00000000000000000000000002D1 X-Hashcash: 1:20:060314:dev@archonet.com::I3txaL7EmcLS1Iuc:006+Z X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::bZQiAjJUsbkVJQ92:00000 0000000000000000000000000HcK X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/197 X-Sequence-Number: 17634 On Fri, Mar 10, 2006 at 11:57:16PM -0800, David Lang wrote: > On Sat, 11 Mar 2006, Joost Kraaijeveld wrote: > > >On Fri, 2006-03-10 at 13:40 +0000, Richard Huxton wrote: > >>Your ATA disk is lying about disk caching being turned off. Assuming > >>each insert is in a separate transaction, then it's not going to do > >>10,000 / 6 = 1667 transactions/sec - that's faster than it's rotational > >>speed. > >Could you explain the calculation? Why should the number of transactions > >be related to the rotational speed of the disk, without saying anything > >about the number of bytes per rotation? > > each transaction requires a sync to the disk, a sync requires a real > write (which you then wait for), so you can only do one transaction per > rotation. But shouldn't it be possible to batch up WAL writes and syncs? In other words, if you have 5 transactions that all COMMIT at exactly the same time, it should be possible to get all 5 WAL pages (I'll assume each one generated a small enough change so as not to require multiple WAL pages) to the drive before the platter comes around to the right position. The drive should then be able to write all 5 at once. At least, theoretically... -- 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 Mar 14 17:10:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 794D99DC829 for ; Tue, 14 Mar 2006 17: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 24244-01 for ; Tue, 14 Mar 2006 17:10:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id BB69F9DC818 for ; Tue, 14 Mar 2006 17:10:50 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 5A75F56427; Tue, 14 Mar 2006 15:10:52 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 15:10:51 -0600 Date: Tue, 14 Mar 2006 15:10:51 -0600 From: "Jim C. Nasby" To: andremachado Cc: pgsql-performance@postgresql.org Subject: Re: firebird X postgresql 8.1.2 windows, performance comparison Message-ID: <20060314211050.GU45250@pervasive.com> References: <20060314120200.M31128@techforce.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060314120200.M31128@techforce.com.br> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:andremachado@techforce.com.br::YESpiXCiPUcH6uvB:00000000 000000000000000000000000CvMx X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::sgTrNscoBXaNOr1u:00000 0000000000000000000000001gT/ X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/198 X-Sequence-Number: 17635 On Tue, Mar 14, 2006 at 09:02:49AM -0300, andremachado wrote: > Hello, > Attached is a file containing the problematic queries cited yesterday, with > "explain", "\di" and "show all" outputs. > The first one finished in almost 4 hours. Firebird for windows finished in 1m30s. > The second one CRASHED after some hours, without finishing. The error message > is at the file too. PANIC: could not open file "pg_xlog/0000000100000018000000E7" (log file 24, segment 231): Invalid argument IIRC that means you have a data corruption issue. As for the queries, EXPLAIN ANALYZE would be in order here. It looks like the first one might benefit from increasing work_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 Mar 14 17:13:58 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C4DDC9DC883 for ; Tue, 14 Mar 2006 17: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 24251-02 for ; Tue, 14 Mar 2006 17:13:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 8DECC9DC80A for ; Tue, 14 Mar 2006 17:13:54 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 92B7256431; Tue, 14 Mar 2006 15:13:56 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 15:13:56 -0600 Date: Tue, 14 Mar 2006 15:13:56 -0600 From: "Jim C. Nasby" To: Pallav Kalva Cc: pgsql-performance@postgresql.org Subject: Re: Vacuum template databases, Urgent: Production problem Message-ID: <20060314211355.GV45250@pervasive.com> References: <4416F2DC.4010400@livedatagroup.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4416F2DC.4010400@livedatagroup.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:pkalva@livedatagroup.com::N05x7gdA3IZeZMkg:0000000000000 0000000000000000000000001WkH X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::Yb3vOpQO4Ipnhk6p:00000 0000000000000000000000003f5O X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/199 X-Sequence-Number: 17636 On Tue, Mar 14, 2006 at 11:44:12AM -0500, Pallav Kalva wrote: > Hi, > > Do we have to vacuum template0 database regularly ? We got this warning > this morning while vacuuming databases. As a part of my daily vacuum job > I do vacuum of quartz, helix_fdc and affiliate databases which are the > one's which are heavily updated and used. But today I realized that usps, > template1 and template0 is also being used in a transaction somehow based > on this (SELECT datname, age(datfrozenxid) FROM pg_database;) query. > Actually we dont do any updates on usps , template1 and templat0 databases > but some how still the age(datfrozenxid keeps incrementing. > My question now is do I have to vacuum daily template1 and template0 > databse, is there any harm on vacuuming these databases daily ?, since > these are postgres system tables I am kind of worried. I was told that > template0 is freezed but not sure why the age(datfrozenxid keeps > incrementing. I am going to vacuum usps from now anyway. We are using > Postgres version 8.0.2 You should upgrade to 8.0.6; data loss bugs have been fixed in there. If you never update USPS you can do a vacuum freeze on it and you won't need to worry about XID rollover. Same with template1. But if they're small databases it's probably safer just to periodically vacuum (once a month or so). If you up to 8.1 and enable autovacuum, it should take care of all of this for you. -- 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 Mar 14 17:16:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 17A8E9DC883 for ; Tue, 14 Mar 2006 17:16: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 19039-07 for ; Tue, 14 Mar 2006 17:16:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D777A9DC81A for ; Tue, 14 Mar 2006 17:16:34 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id AA62E56427; Tue, 14 Mar 2006 15:16:36 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 15:16:35 -0600 Date: Tue, 14 Mar 2006 15:16:35 -0600 From: "Jim C. Nasby" To: "mcelroy, tim" Cc: 'Tom Lane' , pgsql-performance@postgresql.org Subject: Re: Vacuum template databases, Urgent: Production probl Message-ID: <20060314211635.GW45250@pervasive.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B246C@morpheus.bostonstock.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B246C@morpheus.bostonstock.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:tim.mcelroy@bostonstock.com::QBHAM178x32PFuln:0000000000 0000000000000000000000004uIL X-Hashcash: 1:20:060314:tgl@sss.pgh.pa.us::Nb5eBftfRp7dzV5n:00000000000000000000 0000000000000000000000002pCN X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::PXrHtwGcisnVHGgR:00000 00000000000000000000000041Ml X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/200 X-Sequence-Number: 17637 On Tue, Mar 14, 2006 at 12:28:17PM -0500, mcelroy, tim wrote: > If one adds the '-a' arg to vacuumdb wouldn't that vacuum all databases > including template1? It does on 8.1... decibel@phonebook.1[15:15]~:18%vacuumdb -va | & grep template1 vacuumdb: vacuuming database "template1" decibel@phonebook.1[15:16]~:19% Try it and find out. -- 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 Mar 14 17:21:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A13709DCBFF for ; Tue, 14 Mar 2006 17:21: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 18108-09 for ; Tue, 14 Mar 2006 17:21:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from morpheus.bostonstock.com (unknown [192.233.205.44]) by postgresql.org (Postfix) with ESMTP id 286299DCB69 for ; Tue, 14 Mar 2006 17:21:48 -0400 (AST) Received: by morpheus.bostonstock.com with Internet Mail Service (5.5.2653.19) id ; Tue, 14 Mar 2006 16:19:38 -0500 Message-ID: <0C4841B42F87D51195BD00B0D020F5CB044B2472@morpheus.bostonstock.com> From: "mcelroy, tim" To: "'Jim C. Nasby'" Cc: 'Tom Lane' , pgsql-performance@postgresql.org Subject: Re: Vacuum template databases, Urgent: Production probl Date: Tue, 14 Mar 2006 16:19:37 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C647AC.FFDC653E" 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: 200603/201 X-Sequence-Number: 17638 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C647AC.FFDC653E Content-Type: text/plain; charset="iso-8859-1" Humm, well I am running 8.0.1 and use that option and see the following in my vacuum output log: vacuumdb: vacuuming database "template1" So I would assume that it is being vacuumed? Maybe I'm wrong. If so, we should be upgrading soon and it won't be an issue. Thanks, Tim -----Original Message----- From: Jim C. Nasby [mailto:jnasby@pervasive.com] Sent: Tuesday, March 14, 2006 4:17 PM To: mcelroy, tim Cc: 'Tom Lane'; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Vacuum template databases, Urgent: Production probl On Tue, Mar 14, 2006 at 12:28:17PM -0500, mcelroy, tim wrote: > If one adds the '-a' arg to vacuumdb wouldn't that vacuum all databases > including template1? It does on 8.1... decibel@phonebook.1[15:15]~:18%vacuumdb -va | & grep template1 vacuumdb: vacuuming database "template1" decibel@phonebook.1[15:16]~:19% Try it and find out. -- 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 ------_=_NextPart_001_01C647AC.FFDC653E Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] Vacuum template databases, Urgent: Production = probl

Humm, well I am running 8.0.1 and use that option and = see the following in my vacuum output log:

vacuumdb: vacuuming database = "template1"

So I would assume that it is being vacuumed?  = Maybe I'm wrong.  If so, we should be upgrading soon and it won't = be an issue.

Thanks,
Tim

 -----Original Message-----
From:   Jim C. Nasby [mailto:jnasby@pervasive.com] =
Sent:   Tuesday, March 14, 2006 4:17 = PM
To:     mcelroy, tim
Cc:     'Tom Lane'; = pgsql-performance@postgresql.org
Subject:        = Re: [PERFORM] Vacuum template databases, Urgent: Production = probl

On Tue, Mar 14, 2006 at 12:28:17PM -0500, mcelroy, = tim wrote:
> If one adds the '-a' arg to vacuumdb wouldn't = that vacuum all databases
> including template1?

It does on 8.1...

decibel@phonebook.1[15:15]~:18%vacuumdb -va | & = grep template1
vacuumdb: vacuuming database = "template1"
decibel@phonebook.1[15:16]~:19%

Try it and find out.
--
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  &nbs= p;    cell: 512-569-9461

------_=_NextPart_001_01C647AC.FFDC653E-- From pgsql-performance-owner@postgresql.org Tue Mar 14 17:24:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AC0DF9DC8D2 for ; Tue, 14 Mar 2006 17:24: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 24720-07 for ; Tue, 14 Mar 2006 17:24:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 796F39DC80A for ; Tue, 14 Mar 2006 17:24:10 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 6B9D256423; Tue, 14 Mar 2006 15:24:12 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 15:24:11 -0600 Date: Tue, 14 Mar 2006 15:24:11 -0600 From: "Jim C. Nasby" To: "mcelroy, tim" Cc: 'Tom Lane' , pgsql-performance@postgresql.org Subject: Re: Vacuum template databases, Urgent: Production probl Message-ID: <20060314212411.GY45250@pervasive.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B2472@morpheus.bostonstock.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B2472@morpheus.bostonstock.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:tim.mcelroy@bostonstock.com::26MHBAl9EkS/i1Hk:0000000000 0000000000000000000000003Ajm X-Hashcash: 1:20:060314:tgl@sss.pgh.pa.us::q8twVGLwsZB0mBiJ:00000000000000000000 0000000000000000000000000m70 X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::lP5MnWi/wmYjzYhg:00000 0000000000000000000000007DA5 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/202 X-Sequence-Number: 17639 On Tue, Mar 14, 2006 at 04:19:37PM -0500, mcelroy, tim wrote: > Humm, well I am running 8.0.1 and use that option and see the following in > my vacuum output log: > > vacuumdb: vacuuming database "template1" > > So I would assume that it is being vacuumed? Maybe I'm wrong. If so, we > should be upgrading soon and it won't be an issue. My guess is that vacuumdb -a will vacuum anything that it's allowed to connect to, which normally means every database except for template0. If you want the Real Answer, look in the source. -- 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 Mar 14 17:46:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 039169DC81A for ; Tue, 14 Mar 2006 17:46: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 26338-07 for ; Tue, 14 Mar 2006 17:46:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay05.plus.net (pih-relay05.plus.net [212.159.14.132]) by postgresql.org (Postfix) with ESMTP id 4A17A9DC80A for ; Tue, 14 Mar 2006 17:46:01 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay05.plus.net with esmtp (Exim) id 1FJHKq-0004Cu-6n; Tue, 14 Mar 2006 21:45:44 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id CB8A240C5CD; Tue, 14 Mar 2006 21:37:34 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7D3DF15EA4; Tue, 14 Mar 2006 21:37:34 +0000 (GMT) Message-ID: <4417379D.9020801@archonet.com> Date: Tue, 14 Mar 2006 21:37:33 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: "Jim C. Nasby" Cc: David Lang , Joost Kraaijeveld , pgsql-performance@postgresql.org Subject: Re: x206-x225 References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <20060314203253.GT45250@pervasive.com> In-Reply-To: <20060314203253.GT45250@pervasive.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.123 required=5 tests=[AWL=0.123] X-Spam-Score: 0.123 X-Spam-Level: X-Archive-Number: 200603/203 X-Sequence-Number: 17640 Jim C. Nasby wrote: > On Fri, Mar 10, 2006 at 11:57:16PM -0800, David Lang wrote: >> On Sat, 11 Mar 2006, Joost Kraaijeveld wrote: >> >>> On Fri, 2006-03-10 at 13:40 +0000, Richard Huxton wrote: >>>> Your ATA disk is lying about disk caching being turned off. Assuming >>>> each insert is in a separate transaction, then it's not going to do >>>> 10,000 / 6 = 1667 transactions/sec - that's faster than it's rotational >>>> speed. >>> Could you explain the calculation? Why should the number of transactions >>> be related to the rotational speed of the disk, without saying anything >>> about the number of bytes per rotation? >> each transaction requires a sync to the disk, a sync requires a real >> write (which you then wait for), so you can only do one transaction per >> rotation. > > But shouldn't it be possible to batch up WAL writes and syncs? In other > words, if you have 5 transactions that all COMMIT at exactly the same > time, it should be possible to get all 5 WAL pages (I'll assume each > one generated a small enough change so as not to require multiple WAL > pages) to the drive before the platter comes around to the right > position. The drive should then be able to write all 5 at once. At > least, theoretically... I think you mean this... http://www.postgresql.org/docs/8.1/static/runtime-config-wal.html commit_delay (integer) Time delay between writing a commit record to the WAL buffer and flushing the buffer out to disk, in microseconds. A nonzero delay can allow multiple transactions to be committed with only one fsync() system call, if system load is high enough that additional transactions become ready to commit within the given interval. But the delay is just wasted if no other transactions become ready to commit. Therefore, the delay is only performed if at least commit_siblings other transactions are active at the instant that a server process has written its commit record. The default is zero (no delay). commit_siblings (integer) Minimum number of concurrent open transactions to require before performing the commit_delay delay. A larger value makes it more probable that at least one other transaction will become ready to commit during the delay interval. The default is five. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Tue Mar 14 18:08:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D29879DC836 for ; Tue, 14 Mar 2006 18:08: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 32478-06 for ; Tue, 14 Mar 2006 18:08:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id DF8799DC81A for ; Tue, 14 Mar 2006 18:08:16 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id E2A2556423; Tue, 14 Mar 2006 16:08:18 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 14 Mar 2006 16:08:18 -0600 Date: Tue, 14 Mar 2006 16:08:18 -0600 From: "Jim C. Nasby" To: Richard Huxton Cc: David Lang , Joost Kraaijeveld , pgsql-performance@postgresql.org Subject: Re: x206-x225 Message-ID: <20060314220817.GA45250@pervasive.com> References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <20060314203253.GT45250@pervasive.com> <4417379D.9020801@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4417379D.9020801@archonet.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060314:dev@archonet.com::bu8Mx85zGms/5z8G:016yU X-Hashcash: 1:20:060314:david@lang.hm::uz3H/5PRWOnNoyAH:00007oqW X-Hashcash: 1:20:060314:j.kraaijeveld@askesis.nl::aGYCvJWTd48g4mgB:0000000000000 00000000000000000000000008U/ X-Hashcash: 1:20:060314:pgsql-performance@postgresql.org::VLVpuTcx19M1FTuo:00000 0000000000000000000000000pCf X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/204 X-Sequence-Number: 17641 On Tue, Mar 14, 2006 at 09:37:33PM +0000, Richard Huxton wrote: > >But shouldn't it be possible to batch up WAL writes and syncs? In other > >words, if you have 5 transactions that all COMMIT at exactly the same > >time, it should be possible to get all 5 WAL pages (I'll assume each > >one generated a small enough change so as not to require multiple WAL > >pages) to the drive before the platter comes around to the right > >position. The drive should then be able to write all 5 at once. At > >least, theoretically... > > I think you mean this... > > http://www.postgresql.org/docs/8.1/static/runtime-config-wal.html > > commit_delay (integer) No, that's not what I mean at all. On a system doing a large number of WAL-generating transactions per second, it's certainly possible for multiple transactions to commit in the period of time it takes for the platter to rotate back into position to allow for writing of the WAL data. What I don't know is if those multiple transactions would actually make it to the platter on that rotation, or if they'd serialize, resulting in one commit per revolution. I do know that there's no theoretical reason that they couldn't, it's just a matter of putting enough intelligence in the drive. Perhaps this is something that SCSI supports and (S)ATA doesn't, since SCSI allows multiple transactions to be 'in flight' on the bus at once. But since you mention commit_delay, this does lead to an interesting possible use: set it equal to the effective rotational period of the drive. If you know your transaction load well enough, you could possibly gain some benefit here. But of course a RAID controller with a BBU would be a better bet... -- 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 Mar 14 18:18:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 37CF49DCB74 for ; Tue, 14 Mar 2006 18: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 35001-01 for ; Tue, 14 Mar 2006 18:18:28 -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 B4FA79DC9A8 for ; Tue, 14 Mar 2006 18:18:23 -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 0905DB820 for ; Tue, 14 Mar 2006 17:18:25 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <0C4841B42F87D51195BD00B0D020F5CB044B2472@morpheus.bostonstock.com> References: <0C4841B42F87D51195BD00B0D020F5CB044B2472@morpheus.bostonstock.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Vacuum template databases, Urgent: Production probl Date: Tue, 14 Mar 2006 17:18:24 -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.068 required=5 tests=[AWL=0.068] X-Spam-Score: 0.068 X-Spam-Level: X-Archive-Number: 200603/205 X-Sequence-Number: 17642 On Mar 14, 2006, at 4:19 PM, mcelroy, tim wrote: > Humm, well I am running 8.0.1 and use that option and see the > following in > my vacuum output log: > > vacuumdb: vacuuming database "template1" > it has done so since at least 7.4, probably 7.3. the "-a" flag really does what is says. From pgsql-performance-owner@postgresql.org Wed Mar 15 05:43:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0F4F19DC8E1 for ; Wed, 15 Mar 2006 05:43: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 62246-09 for ; Wed, 15 Mar 2006 05:43:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ptb-relay02.plus.net (ptb-relay02.plus.net [212.159.14.213]) by postgresql.org (Postfix) with ESMTP id 8E5F99DC891 for ; Wed, 15 Mar 2006 05:43:40 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by ptb-relay02.plus.net with esmtp (Exim) id 1FJSXI-0004YB-Qh; Wed, 15 Mar 2006 09:43:21 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 5F69E40DBCA; Wed, 15 Mar 2006 09:26:10 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id BC3A915EA4; Wed, 15 Mar 2006 09:26:09 +0000 (GMT) Message-ID: <4417DDB1.8000308@archonet.com> Date: Wed, 15 Mar 2006 09:26:09 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: "Jim C. Nasby" Cc: David Lang , Joost Kraaijeveld , pgsql-performance@postgresql.org Subject: Re: x206-x225 References: <441181C6.3040401@archonet.com> <1142063378.6634.13.camel@localhost> <20060314203253.GT45250@pervasive.com> <4417379D.9020801@archonet.com> <20060314220817.GA45250@pervasive.com> In-Reply-To: <20060314220817.GA45250@pervasive.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.123 required=5 tests=[AWL=0.123] X-Spam-Score: 0.123 X-Spam-Level: X-Archive-Number: 200603/206 X-Sequence-Number: 17643 Jim C. Nasby wrote: >> I think you mean this... >> >> http://www.postgresql.org/docs/8.1/static/runtime-config-wal.html >> >> commit_delay (integer) > > No, that's not what I mean at all. On a system doing a large number of > WAL-generating transactions per second, it's certainly possible for > multiple transactions to commit in the period of time it takes for the > platter to rotate back into position to allow for writing of the WAL > data. What I don't know is if those multiple transactions would actually > make it to the platter on that rotation, or if they'd serialize, > resulting in one commit per revolution. I do know that there's no > theoretical reason that they couldn't, it's just a matter of putting > enough intelligence in the drive. > > Perhaps this is something that SCSI supports and (S)ATA doesn't, since > SCSI allows multiple transactions to be 'in flight' on the bus at once. SCSI Command queueing: http://www.storagereview.com/guide2000/ref/hdd/if/scsi/protCQR.html SATA "native command queuing": http://www.tomshardware.com/2004/11/16/can_command_queuing_turbo_charge_sata/ > But since you mention commit_delay, this does lead to an interesting > possible use: set it equal to the effective rotational period of the > drive. If you know your transaction load well enough, you could possibly > gain some benefit here. But of course a RAID controller with a BBU would > be a better bet... I suppose as long as you always have several transactions trying to commit, have a separate spindle(s) for the WAL then you could improve throughput at the cost of the shortest transaction times. Of course, it might be that the increase in lock duration etc. might outweigh any benefits. I'd suspect the cost/gain would be highly variable with changes in workload, and as you say write-cache+BBU seems more sensible. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Mar 15 06:09:34 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F3CF49DCC0D for ; Wed, 15 Mar 2006 06:09: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 68118-08 for ; Wed, 15 Mar 2006 06:09:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.204]) by postgresql.org (Postfix) with ESMTP id 3FA5D9DC8A5 for ; Wed, 15 Mar 2006 06:09:30 -0400 (AST) Received: by uproxy.gmail.com with SMTP id u40so37138ugc for ; Wed, 15 Mar 2006 02:09:33 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:from:to:subject:date:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:x-mimeole; b=E0UinzSBTLywp1QK0S2Ptf0UeMblgPGAr6wKbplvHmFgpzfXONLvDEPJZera+IoN1KKSvaICJQk1He8jmHx9WyXMEf4Q3E4/epZ2Lc8XnZ/DMrIXNWkP9Mbl/FvYAXrT1dr5SnJqpgx6u5Cd43i934hRbDLtPlJlPH7w9lcgDgQ= Received: by 10.66.184.5 with SMTP id h5mr240068ugf; Wed, 15 Mar 2006 02:09:32 -0800 (PST) Received: from maniek ( [62.148.95.123]) by mx.gmail.com with ESMTP id y1sm7028787uge.2006.03.15.02.09.31; Wed, 15 Mar 2006 02:09:32 -0800 (PST) Message-ID: <024d01c64818$9b5790e0$0c67a8c0@maniek> From: =?iso-8859-2?Q?Marcin_Ma=F1k?= To: Subject: VACUUM FULL hangs Date: Wed, 15 Mar 2006 11:09:52 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit 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=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200603/207 X-Sequence-Number: 17644 Hello list. I recently tried to do a slony replica of my database, and doing it falied. I retried, and then it succeeded (why it failed is another story). This caused that in the replica there is a lot of dead tuples ( If i understand correctly, a failure in creating the replica means a HUGE aborted transaction - and Slony should TRUNCATE the table, getting rid of dead tuples, but that is a subject for another list). so I did vacuum full verbose analyze (does it make sense ?) This hanged on a (quite large) table: INFO: vacuuming "public.calls" INFO: "calls": found 7980456 removable, 3989705 nonremovable row versions in 296943 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 136 to 224 bytes long. There were 891 unused item pointers. Total free space (including removable row versions) is 1594703944 bytes. 197958 pages are or will become empty, including 0 at the end of the table. 212719 pages containing 1588415680 free bytes are potential move destinations. CPU 7.25s/3.28u sec elapsed 144.95 sec. INFO: index "calls_pkey" now contains 3989705 row versions in 8975 pages DETAIL: 108927 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.35s/0.59u sec elapsed 39.03 sec. INFO: index "calls_cli" now contains 3989705 row versions in 13504 pages DETAIL: 108927 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.51s/0.60u sec elapsed 58.60 sec. INFO: index "calls_dnis" now contains 3989705 row versions in 13600 pages DETAIL: 108927 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.60s/0.90u sec elapsed 27.05 sec. INFO: index "calls_u" now contains 3989705 row versions in 23820 pages DETAIL: 108927 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.92s/0.78u sec elapsed 80.51 sec. INFO: index "calls_z" now contains 3989705 row versions in 13607 pages DETAIL: 108927 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.60s/0.85u sec elapsed 39.77 sec. It was hanging in this state for more than 3 hours, and I had to kill the vacuum process. From iostat I saw that there was continuous write activity, steadilly about 1.3 MB/s (the disk system can do about 40 MB/s), and there were iowait processes. There was no read activity. There were no other clients for that database (but there were clients in other databases in the instance). version is 8.1.0 . Autovacuum is off. I upped maintenance_work_mem to 512 MB . Any hints? If nothing comes up today, I am scratching that replica. telefony=# \d calls Table "public.calls" Column | Type | Modifiers ---------------+-----------------------------+------------------------------ ------------------------------ dt | timestamp without time zone | machine_ip | integer | port | integer | filename | character varying(15) | account | character(11) | duration | integer | ani | character(32) | application | character(32) | dnis | integer | z | integer | client | integer | taryfa | integer | operator | character varying(20) | id | integer | not null default nextval(('seq_calls_id'::text)::regclass) outgoing | character(12) | release_cause | text | waiting | integer | oper_pin | integer | Indexes: "calls_pkey" PRIMARY KEY, btree (id) "calls_u" UNIQUE, btree (dt, dnis, port, machine_ip, account) "calls_cli" btree (client, dt) "calls_dnis" btree (dnis, dt) "calls_z" btree (z, dt) Triggers: _ctele_denyaccess_5 BEFORE INSERT OR DELETE OR UPDATE ON calls FOR EACH ROW EXECUTE PROCEDURE _ctele.denyaccess('_ctele') Pozdrawiam Marcin Ma�k From pgsql-performance-owner@postgresql.org Wed Mar 15 08:15:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 180CC9DCCA9 for ; Wed, 15 Mar 2006 08:15: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 01405-07 for ; Wed, 15 Mar 2006 08:15:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.131]) by postgresql.org (Postfix) with ESMTP id B5D949DCC99 for ; Wed, 15 Mar 2006 08:15:24 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay04.plus.net with esmtp (Exim) id 1FJUuU-0005EU-Se; Wed, 15 Mar 2006 12:15:26 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id E7D4740DCFC; Wed, 15 Mar 2006 11:54:02 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id B0C5915EA4; Wed, 15 Mar 2006 11:54:02 +0000 (GMT) Message-ID: <4418005A.70108@archonet.com> Date: Wed, 15 Mar 2006 11:54:02 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: =?ISO-8859-2?Q?Marcin_Ma=F1k?= Cc: pgsql-performance@postgresql.org Subject: Re: VACUUM FULL hangs References: <024d01c64818$9b5790e0$0c67a8c0@maniek> In-Reply-To: <024d01c64818$9b5790e0$0c67a8c0@maniek> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.125 required=5 tests=[AWL=0.125] X-Spam-Score: 0.125 X-Spam-Level: X-Archive-Number: 200603/208 X-Sequence-Number: 17645 Marcin Ma=F1k wrote: > Hello list. >=20 > I recently tried to do a slony replica of my database, and doing it fal= ied. > I retried, and then it succeeded (why it failed is another story). >=20 > This caused that in the replica there is a lot of dead tuples ( If i > understand correctly, a failure in creating the replica means a HUGE ab= orted > transaction - and Slony should TRUNCATE the table, getting rid of dead > tuples, but that is a subject for another list). >=20 > so I did vacuum full verbose analyze (does it make sense ?) Fair enough. If you want empty tables TRUNCATE is probably a better bet=20 though. > This hanged on a (quite large) table: >=20 > INFO: vacuuming "public.calls" > INFO: "calls": found 7980456 removable, 3989705 nonremovable row versi= ons > in 296943 pages > DETAIL: 0 dead row versions cannot be removed yet. > Nonremovable row versions range from 136 to 224 bytes long. > There were 891 unused item pointers. > Total free space (including removable row versions) is 1594703944 bytes= =2E > 197958 pages are or will become empty, including 0 at the end of the ta= ble. > 212719 pages containing 1588415680 free bytes are potential move > destinations. OK, so there are 7.9 million removable rows and 3.9 million nonremovable = so truncate isn't an option since you have data you presumably want to=20 keep. It estimates about 200,000 pages will become empty, but none of=20 them are at the end of the table. This represents 1.5GB of unused=20 disk-space. I'm a bit puzzled as to how you managed to get so much free space at the = start of the table. Did the replication work on the second try? > CPU 7.25s/3.28u sec elapsed 144.95 sec. > INFO: index "calls_pkey" now contains 3989705 row versions in 8975 pag= es > DETAIL: 108927 index row versions were removed. > 0 index pages have been deleted, 0 are currently reusable. > CPU 0.35s/0.59u sec elapsed 39.03 sec. > INFO: index "calls_cli" now contains 3989705 row versions in 13504 pag= es > DETAIL: 108927 index row versions were removed. > 0 index pages have been deleted, 0 are currently reusable. > CPU 0.51s/0.60u sec elapsed 58.60 sec. > INFO: index "calls_dnis" now contains 3989705 row versions in 13600 pa= ges > DETAIL: 108927 index row versions were removed. > 0 index pages have been deleted, 0 are currently reusable. > CPU 0.60s/0.90u sec elapsed 27.05 sec. > INFO: index "calls_u" now contains 3989705 row versions in 23820 pages= > DETAIL: 108927 index row versions were removed. > 0 index pages have been deleted, 0 are currently reusable. > CPU 0.92s/0.78u sec elapsed 80.51 sec. > INFO: index "calls_z" now contains 3989705 row versions in 13607 pages= > DETAIL: 108927 index row versions were removed. > 0 index pages have been deleted, 0 are currently reusable. > CPU 0.60s/0.85u sec elapsed 39.77 sec. It's done all the indexes (and seems to have done them quite quickly),=20 and is presumably working on the data now. > It was hanging in this state for more than 3 hours, and I had to kill t= he > vacuum process. >=20 >>From iostat I saw that there was continuous write activity, steadilly a= bout > 1.3 MB/s (the disk system can do about 40 MB/s), and there were iowait > processes. There was no read activity. >=20 > There were no other clients for that database (but there were clients i= n > other databases in the instance). OK, so you might well be getting the vacuum writing one page, then WAL,=20 then vacuum, etc. That will mean the disk spends most of its time=20 seeking back and fore. How many disks do you have, and is the WAL on a=20 separate set of disks? I think it's just taking a long time because you have so many pages to=20 move and not enough disk bandwidth. Of course the root of the problem is = that you had so many dead rows after a failed replication, but you're=20 right and that's another email. --=20 Richard Huxton Archonet Ltd From pgsql-hackers-owner@postgresql.org Wed Mar 15 13:57:09 2006 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 23B299DCCB2; Wed, 15 Mar 2006 13:57: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 78478-09; Wed, 15 Mar 2006 13:57:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 79B259DCC9F; Wed, 15 Mar 2006 13:57:05 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 15 Mar 2006 11:57:05 -0600 Message-Id: <44180105.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 15 Mar 2006 11:56:53 -0600 From: "Kevin Grittner" To: , Subject: BETWEEN optimizer problems with single-value range Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part14314575.0__=" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.099 required=5 tests=[AWL=0.099] X-Spam-Score: 0.099 X-Spam-Level: X-Archive-Number: 200603/721 X-Sequence-Number: 81119 --=__Part14314575.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Attached is a simplified example of a performance problem we have seen, with a workaround and a suggestion for enhancement (hence both the performance and hackers lists). Our software is allowing users to specify the start and end dates for a query. When they enter the same date for both, the optimizer makes a very bad choice. We can work around it in application code by using an equality test if both dates match. I think the planner should be able to make a better choice here. (One obvious way to fix it would be to rewrite "BETWEEN a AND b" as "= a" when a is equal to b, but it seems like there is some underlying problem which should be fixed instead (or in addition to) this. The first query uses BETWEEN with the same date for both min and max values. The second query uses an equality test for the same date. The third query uses BETWEEN with a two-day range. In all queries, there are less than 4,600 rows for the specified cotfcNo value out of over 18 million rows in the table. We tried boosting the statistics samples for the columns in the selection, which made the estimates of rows more accurate, but didn't change the choice of plans. -Kevin --=__Part14314575.0__= Content-Type: application/octet-stream; name="between-optimization-problem.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="between-optimization-problem.txt" XGQgIkNhbCIKICAgICAgICAgICAgICAgICAgVGFibGUgInB1YmxpYy5DYWwiCiAgICAgIENvbHVt biAgICAgICB8ICAgICAgICAgVHlwZSAgICAgICAgICB8IE1vZGlmaWVycwotLS0tLS0tLS0tLS0t LS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tCiBjYWxTZXFObyAgICAg ICAgICB8ICJDYWxTZXFOb1QiICAgICAgICAgICB8IG5vdCBudWxsCiBjb3VudHlObyAgICAgICAg ICB8ICJDb3VudHlOb1QiICAgICAgICAgICB8IG5vdCBudWxsCiBhY3Rpdml0eVR5cGUgICAgICB8 ICJBY3Rpdml0eVR5cGVUIiAgICAgICB8IG5vdCBudWxsCiBjYWxEYXRlICAgICAgICAgICB8ICJE YXRlVCIgICAgICAgICAgICAgICB8IG5vdCBudWxsCiBjYWxSZWNUeXBlICAgICAgICB8IGNoYXJh Y3RlcigxKSAgICAgICAgICB8IG5vdCBudWxsCiBjdG9mY05vICAgICAgICAgICB8ICJDdG9mY05v VCIgICAgICAgICAgICB8IG5vdCBudWxsCiBpc0NvdXJ0VHlwZSAgICAgICB8IGJvb2xlYW4gICAg ICAgICAgICAgICB8IG5vdCBudWxsCiBpc05vdGNQcmludGVkICAgICB8IGJvb2xlYW4gICAgICAg ICAgICAgICB8IG5vdCBudWxsCiBpc1ByaW50T25EbHlDYWwgICB8IGJvb2xlYW4gICAgICAgICAg ICAgICB8IG5vdCBudWxsCiBsYXN0U3BjbE5vdGNTZXFObyB8ICJTcGNsTm90Y1NlcU5vVCIgICAg ICB8IG5vdCBudWxsCiBwcmlvcml0eSAgICAgICAgICB8ICJQcmlvcml0eVQiICAgICAgICAgICB8 IG5vdCBudWxsCiBzdGFydFRpbWUgICAgICAgICB8ICJUaW1lVCIgICAgICAgICAgICAgICB8IG5v dCBudWxsCiBjYWxEaXNwb0NvZGUgICAgICB8ICJDYWxEaXNwb0NvZGVUIiAgICAgICB8CiBjYWxU eHQgICAgICAgICAgICB8ICJUZXh0VCIgICAgICAgICAgICAgICB8CiBjYXNlTm8gICAgICAgICAg ICB8ICJDYXNlTm9UIiAgICAgICAgICAgICB8CiBjb21tZW50cyAgICAgICAgICB8IGNoYXJhY3Rl ciB2YXJ5aW5nKDkwKSB8CiBjdG9mY0FkZHJTZXFObyAgICB8IHNtYWxsaW50ICAgICAgICAgICAg ICB8CiBkaXNwb0RhdGUgICAgICAgICB8ICJEYXRlVCIgICAgICAgICAgICAgICB8CiBlbmRUaW1l ICAgICAgICAgICB8ICJUaW1lVCIgICAgICAgICAgICAgICB8CiBlc3REdXJhdGlvbiAgICAgICB8 ICJDYWxEdXJhdGlvblQiICAgICAgICB8CiBlc3RQZCAgICAgICAgICAgICB8ICJQZENvZGVUIiAg ICAgICAgICAgICB8CiBsb2MgICAgICAgICAgICAgICB8ICJMb2NUIiAgICAgICAgICAgICAgICB8 CiBtYXN0ZXJDYWxTZXFObyAgICB8ICJDYWxTZXFOb1QiICAgICAgICAgICB8CiBycHRyQ29kZSAg ICAgICAgICB8ICJDdG9mY05vVCIgICAgICAgICAgICB8CiB0YWcgICAgICAgICAgICAgICB8ICJU YWdUeXBlVCIgICAgICAgICAgICB8CiBnd01lc3NhZ2VJZCAgICAgICB8ICJHd01lc3NhZ2VJZFQi ICAgICAgICB8CkluZGV4ZXM6CiAgICAiQ2FsX3BrZXkiIFBSSU1BUlkgS0VZLCBidHJlZSAoImNv dW50eU5vIiwgImNhbFNlcU5vIikKICAgICJDYWxfQ2FsRGF0ZSIgVU5JUVVFLCBidHJlZSAoImNh bERhdGUiLCAiY291bnR5Tm8iLCAiY2FsRGlzcG9Db2RlIiwgImFjdGl2aXR5VHlwZSIsICJjYXNl Tm8iLCAiY2FsUmVjVHlwZSIsICJjYWxTZXFObyIpCiAgICAiQ2FsX0Nhc2VObyIgVU5JUVVFLCBi dHJlZSAoImNhc2VObyIsICJjb3VudHlObyIsICJjYWxTZXFObyIpCiAgICAiQ2FsX0N0b2ZjTm8i IFVOSVFVRSwgYnRyZWUgKCJjdG9mY05vIiwgImNhbERhdGUiLCAiY291bnR5Tm8iLCAic3RhcnRU aW1lIiwgcHJpb3JpdHksICJjYWxTZXFObyIpCgpleHBsYWluIGFuYWx5emUKU0VMRUNUICJDQSIu ImNhbERhdGUiLCAiQ0EiLiJzdGFydFRpbWUiCiAgRlJPTSAiQ2FsIiAiQ0EiCiAgV0hFUkUgIkNB Ii4iY3RvZmNObyIgPSAnMjE5MicKICAgIEFORCAiQ0EiLiJjYWxEYXRlIiBiZXR3ZWVuICcyMDA2 LTAzLTE1JyBBTkQgJzIwMDYtMDMtMTUnCiAgT1JERVIgQlkgImNhbERhdGUiLCAic3RhcnRUaW1l IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBRVUVSWSBQTEFOICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiBTb3J0ICAoY29zdD00LjAzLi40 LjAzIHJvd3M9MSB3aWR0aD0xMikgKGFjdHVhbCB0aW1lPTkyODMuNTYwLi45MjgzLjU2OCByb3dz PTQgbG9vcHM9MSkKICAgU29ydCBLZXk6ICJjYWxEYXRlIiwgInN0YXJ0VGltZSIKICAgLT4gIElu ZGV4IFNjYW4gdXNpbmcgIkNhbF9DYWxEYXRlIiBvbiAiQ2FsIiAiQ0EiICAoY29zdD0wLjAwLi40 LjAyIHJvd3M9MSB3aWR0aD0xMikgKGFjdHVhbCB0aW1lPTUzMi4yNDYuLjkyODMuNDUwIHJvd3M9 NCBsb29wcz0xKQogICAgICAgICBJbmRleCBDb25kOiAoKCgiY2FsRGF0ZSIpOjpkYXRlID49ICcy MDA2LTAzLTE1Jzo6ZGF0ZSkgQU5EICgoImNhbERhdGUiKTo6ZGF0ZSA8PSAnMjAwNi0wMy0xNSc6 OmRhdGUpKQogICAgICAgICBGaWx0ZXI6ICgoImN0b2ZjTm8iKTo6YnBjaGFyID0gJzIxOTInOjpi cGNoYXIpCiBUb3RhbCBydW50aW1lOiA5MjgzLjc1OCBtcwooNiByb3dzKQoKZXhwbGFpbiBhbmFs eXplClNFTEVDVCAiQ0EiLiJjYWxEYXRlIiwgIkNBIi4ic3RhcnRUaW1lIgogIEZST00gIkNhbCIg IkNBIgogIFdIRVJFICJDQSIuImN0b2ZjTm8iID0gJzIxOTInCiAgICBBTkQgIkNBIi4iY2FsRGF0 ZSIgPSAnMjAwNi0wMy0xNScKICBPUkRFUiBCWSAiY2FsRGF0ZSIsICJzdGFydFRpbWUiOwogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBR VUVSWSBQTEFOICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAKLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIFNvcnQgIChjb3N0PTI0LjM2Li4yNC4zOSByb3dz PTExIHdpZHRoPTEyKSAoYWN0dWFsIHRpbWU9MC43MTUuLjAuNzIzIHJvd3M9NCBsb29wcz0xKQog ICBTb3J0IEtleTogImNhbERhdGUiLCAic3RhcnRUaW1lIgogICAtPiAgSW5kZXggU2NhbiB1c2lu ZyAiQ2FsX0N0b2ZjTm8iIG9uICJDYWwiICJDQSIgIChjb3N0PTAuMDAuLjI0LjE3IHJvd3M9MTEg d2lkdGg9MTIpIChhY3R1YWwgdGltZT0wLjQyNC4uMC42Mjggcm93cz00IGxvb3BzPTEpCiAgICAg ICAgIEluZGV4IENvbmQ6ICgoKCJjdG9mY05vIik6OmJwY2hhciA9ICcyMTkyJzo6YnBjaGFyKSBB TkQgKCgiY2FsRGF0ZSIpOjpkYXRlID0gJzIwMDYtMDMtMTUnOjpkYXRlKSkKIFRvdGFsIHJ1bnRp bWU6IDAuODI4IG1zCig1IHJvd3MpCgpleHBsYWluIGFuYWx5emUKU0VMRUNUICJDQSIuImNhbERh dGUiLCAiQ0EiLiJzdGFydFRpbWUiCiAgRlJPTSAiQ2FsIiAiQ0EiCiAgV0hFUkUgIkNBIi4iY3Rv ZmNObyIgPSAnMjE5MicKICAgIEFORCAiQ0EiLiJjYWxEYXRlIiBiZXR3ZWVuICcyMDA2LTAzLTE1 JyBBTkQgJzIwMDYtMDMtMTYnCiAgT1JERVIgQlkgImNhbERhdGUiLCAic3RhcnRUaW1lIjsKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgUVVFUlkgUExBTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIFNvcnQg IChjb3N0PTQuMDMuLjQuMDMgcm93cz0xIHdpZHRoPTEyKSAoYWN0dWFsIHRpbWU9NS4zODQuLjUu NDk0IHJvd3M9NTkgbG9vcHM9MSkKICAgU29ydCBLZXk6ICJjYWxEYXRlIiwgInN0YXJ0VGltZSIK ICAgLT4gIEluZGV4IFNjYW4gdXNpbmcgIkNhbF9DdG9mY05vIiBvbiAiQ2FsIiAiQ0EiICAoY29z dD0wLjAwLi40LjAyIHJvd3M9MSB3aWR0aD0xMikgKGFjdHVhbCB0aW1lPTAuMzc3Li41LjEzMyBy b3dzPTU5IGxvb3BzPTEpCiAgICAgICAgIEluZGV4IENvbmQ6ICgoKCJjdG9mY05vIik6OmJwY2hh ciA9ICcyMTkyJzo6YnBjaGFyKSBBTkQgKCgiY2FsRGF0ZSIpOjpkYXRlID49ICcyMDA2LTAzLTE1 Jzo6ZGF0ZSkgQU5EICgoImNhbERhdGUiKTo6ZGF0ZSA8PSAnMjAwNi0wMy0xNic6OmRhdGUpKQog VG90YWwgcnVudGltZTogNS42ODYgbXMKKDUgcm93cykKCg== --=__Part14314575.0__=-- From pgsql-performance-owner@postgresql.org Wed Mar 15 14:16:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EC4269DCABB for ; Wed, 15 Mar 2006 14: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 89840-01 for ; Wed, 15 Mar 2006 14:16:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from 137086.vserver.de (vs137086.vserver.de [62.75.137.86]) by postgresql.org (Postfix) with ESMTP id 66A469DCAAA for ; Wed, 15 Mar 2006 14:16:19 -0400 (AST) Received: from a-kretschmer.de (p54B3CFDE.dip0.t-ipconnect.de [84.179.207.222]) (authenticated bits=0) by 137086.vserver.de (8.12.8/8.12.8) with ESMTP id k2FIGGaj031424 for ; Wed, 15 Mar 2006 19:16:17 +0100 Received: from kretschmer by a-kretschmer.de with local (Exim 4.60) (envelope-from ) id 1FJaYx-0006Cv-Hb for pgsql-performance@postgresql.org; Wed, 15 Mar 2006 19:17:35 +0100 Date: Wed, 15 Mar 2006 19:17:35 +0100 From: Andreas Kretschmer To: pgsql-performance@postgresql.org Subject: Re: BETWEEN optimizer problems with single-value range Message-ID: <20060315181735.GA22240@KanotixBox> References: <44180105.EE98.0025.0@wicourts.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <44180105.EE98.0025.0@wicourts.gov> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! X-Lugdd: Gerd Kube X-Info: My name is root. Just root. And I am licensed to kill -9 User-Agent: mutt-ng 1.5.9i (Linux) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.123 required=5 tests=[AWL=0.123] X-Spam-Score: 0.123 X-Spam-Level: X-Archive-Number: 200603/210 X-Sequence-Number: 17647 Kevin Grittner schrieb: > Attached is a simplified example of a performance problem we have seen, Odd. Can you tell us your PG-Version? Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknow) Kaufbach, Saxony, Germany, Europe. N 51.05082�, E 13.56889� From pgsql-performance-owner@postgresql.org Wed Mar 15 14:43:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 269DB9DCAB0 for ; Wed, 15 Mar 2006 14:43: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 98419-01 for ; Wed, 15 Mar 2006 14:43:16 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.197]) by postgresql.org (Postfix) with ESMTP id AD5F89DC9AC for ; Wed, 15 Mar 2006 14:43:14 -0400 (AST) Received: by uproxy.gmail.com with SMTP id u40so98336ugc for ; Wed, 15 Mar 2006 10:43:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:from:cc:references:subject:date:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:x-mimeole; b=raToDu7hP70qqqwONiih2Fww17lZ6HxzGqZMEv1lbim3v6MgyhZqhfcOjcdPhguo5yXb2h6WL1G8sXiB4oa4vavQfmV2wz0M7ARhZjE3ss9UUStea4ZLfi6VqLPY+fpzgkwSaT665nB4rs8I13mfXh4XWLb1XMo9oP0K5eDAK0s= Received: by 10.66.243.6 with SMTP id q6mr184173ugh; Wed, 15 Mar 2006 10:43:14 -0800 (PST) Received: from maniek ( [62.148.95.123]) by mx.gmail.com with ESMTP id m1sm7694533ugc.2006.03.15.10.43.13; Wed, 15 Mar 2006 10:43:14 -0800 (PST) Message-ID: <03ae01c64860$6039d160$0c67a8c0@maniek> From: =?iso-8859-2?Q?Marcin_Ma=F1k?= Cc: References: <024d01c64818$9b5790e0$0c67a8c0@maniek> <4418005A.70108@archonet.com> Subject: Re: VACUUM FULL hangs Date: Wed, 15 Mar 2006 19:43:35 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit 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=0.174 required=5 tests=[AWL=-0.015, MISSING_HEADERS=0.189] X-Spam-Score: 0.174 X-Spam-Level: X-Archive-Number: 200603/211 X-Sequence-Number: 17648 > I'm a bit puzzled as to how you managed to get so much free space at the > start of the table. Did the replication work on the second try? It actually worked on third try, I guess. > OK, so you might well be getting the vacuum writing one page, then WAL, > then vacuum, etc. That will mean the disk spends most of its time > seeking back and fore. How many disks do you have, and is the WAL on a > separate set of disks? It is 2 spindles software RAID1 . Till now there were no performance problems with this machine that would mandate trying anything more fancy, this machine is low traffic. Greetings Marcin Ma�k From pgsql-performance-owner@postgresql.org Wed Mar 15 14:49:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 756E49DC86D for ; Wed, 15 Mar 2006 14:49: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 99022-02 for ; Wed, 15 Mar 2006 14:49:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 242819DC825 for ; Wed, 15 Mar 2006 14:49:05 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 15 Mar 2006 12:49:06 -0600 Message-Id: <44180D33.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 15 Mar 2006 12:48:51 -0600 From: "Kevin Grittner" To: , "Andreas Kretschmer" Subject: Re: BETWEEN optimizer problems with single-value References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> In-Reply-To: <20060315181735.GA22240@KanotixBox> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/212 X-Sequence-Number: 17649 >>> On Wed, Mar 15, 2006 at 12:17 pm, in message <20060315181735.GA22240@KanotixBox>, Andreas Kretschmer wrote: > Kevin Grittner schrieb: > >> Attached is a simplified example of a performance problem we have seen, > > Odd. Can you tell us your PG- Version? I know we really should move to 8.1.3, but I haven't gotten to it yet. We're on a build from the 8.1 stable branch as of February 10th, with a patch to allow ANSI standard interpretation of string literals. (So this is 8.1.2 with some 8.1.3 changes plus the string literal patch.) If there are any changes in that time frame which might affect this issue, I could deploy a standard release and make sure that I see the same behavior. Let me know. -Kevin From pgsql-performance-owner@postgresql.org Wed Mar 15 15:17:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 04F529DC816 for ; Wed, 15 Mar 2006 15:17: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 09576-01 for ; Wed, 15 Mar 2006 15:17: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 CA4A39DCCB2 for ; Wed, 15 Mar 2006 15:17: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 k2FJHoBg028799; Wed, 15 Mar 2006 14:17:50 -0500 (EST) To: "Kevin Grittner" cc: pgsql-performance@postgresql.org, "Andreas Kretschmer" Subject: Re: BETWEEN optimizer problems with single-value In-reply-to: <44180D33.EE98.0025.0@wicourts.gov> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Wed, 15 Mar 2006 12:48:51 -0600" Date: Wed, 15 Mar 2006 14:17:50 -0500 Message-ID: <28798.1142450270@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/213 X-Sequence-Number: 17650 "Kevin Grittner" writes: >> Odd. Can you tell us your PG- Version? > this is 8.1.2 with some 8.1.3 changes plus the string literal patch.) 8.1 is certainly capable of devising the plan you want, for example in the regression database: regression=# explain select * from tenk1 where thousand = 10 and tenthous between 42 and 144; QUERY PLAN ------------------------------------------------------------------------------------ Index Scan using tenk1_thous_tenthous on tenk1 (cost=0.00..6.01 rows=1 width=244) Index Cond: ((thousand = 10) AND (tenthous >= 42) AND (tenthous <= 144)) (2 rows) It looks to me like this is a matter of bad cost estimation, ie, it's thinking the other index is cheaper to use. Why that is is not clear. Can we see the pg_stats rows for ctofcNo and calDate? Also, try to force it to generate the plan you want, so we can see what it thinks the cost is for that. If you temporarily drop the wrong index you should be able to get there: begin; drop index "Cal_CalDate"; explain analyze select ... ; -- repeat as needed if it chooses some other wrong index rollback; I hope you have a play copy of the database to do this in --- although it would be safe to do the above in a live DB, the DROP would exclusive-lock the table until you finish the experiment and rollback, which probably is not good for response time ... regards, tom lane From pgsql-hackers-owner@postgresql.org Wed Mar 15 15:37:01 2006 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF7269DCC9F for ; Wed, 15 Mar 2006 15: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 13118-06 for ; Wed, 15 Mar 2006 15:37:00 -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 9BEE99DCB70 for ; Wed, 15 Mar 2006 15:36:54 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 4so256056nzn for ; Wed, 15 Mar 2006 11:36:52 -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=I1jKsEqjwQdjltqEwcIzkdgHjS0hI3kt8fmAAgSTo/0c3o80Myupm5yKmeWwR4S1BWZQ6GZzmenGqkHU6+/DqQqdVrVb5DFbhOBc9y8TdbSjtTYPAmPrqzIk4orSFtXofI8qzR3o4O/7Ez+7zHasaZa038CLB4k29c1SgzpzAvI= Received: by 10.65.98.12 with SMTP id a12mr563498qbm; Wed, 15 Mar 2006 11:36:51 -0800 (PST) Received: by 10.65.137.20 with HTTP; Wed, 15 Mar 2006 11:36:51 -0800 (PST) Message-ID: Date: Wed, 15 Mar 2006 14:36:51 -0500 From: "Merlin Moncure" To: "Kevin Grittner" Subject: Re: [PERFORM] BETWEEN optimizer problems with single-value range Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org In-Reply-To: <44180105.EE98.0025.0@wicourts.gov> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <44180105.EE98.0025.0@wicourts.gov> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.14 required=5 tests=[AWL=0.140] X-Spam-Score: 0.14 X-Spam-Level: X-Archive-Number: 200603/722 X-Sequence-Number: 81120 On 3/15/06, Kevin Grittner wrote: > Attached is a simplified example of a performance problem we have seen, > with a workaround and a suggestion for enhancement (hence both the > performance and hackers lists). Hi Kevin. In postgres 8.2 you will be able to use the row-wise comparison for your query which should guarantee good worst case performance without having to maintain two separate query forms. it is also a more elegant syntax as you will see. SELECT "CA"."calDate", "CA"."startTime" FROM "Cal" "CA" WHERE ("CA"."ctofcNo", "CA"."calDate") BETWEEN (2192, '2006-03-15') and (2192, '2006-03-15') ORDER BY "ctofcNo", "calDate", "startTime"; Be warned this will not work properly in pg < 8.2. IMO, row-wise is the best way to write this type of a query. Please note the row constructor and the addition of ctofcNo into the order by clause to force use of the index. Merlin From pgsql-performance-owner@postgresql.org Wed Mar 15 15:39:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 372F19DCB4B for ; Wed, 15 Mar 2006 15:39: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 13828-09 for ; Wed, 15 Mar 2006 15:39:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 52BB09DC9AC for ; Wed, 15 Mar 2006 15:39:15 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id C3FA5A06BA for ; Wed, 15 Mar 2006 14:39:15 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id B2EE012985C for ; Wed, 15 Mar 2006 14:39:15 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11222-07 for ; Wed, 15 Mar 2006 14:39:15 -0500 (EST) Received: from [192.168.100.50] (unknown [192.168.100.50]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 9B86612985B for ; Wed, 15 Mar 2006 14:39:15 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Slow SELECTS after large update cycle Date: Wed, 15 Mar 2006 14:39:13 -0500 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603151439.13958.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/215 X-Sequence-Number: 17652 Hello, After fixing the hanging problems I reported here earlier (by uninstalling= =20 W2K3 SP1), I'm running into another weird one. After doing a +/- 8hr cycle of updates and inserts (what we call a 'batch')= ,=20 the first 'reporting' type query on tables involved in that write cycle is= =20 very slow. As an example, I have a query which according to EXPLAIN ANALYZE= =20 takes about 1.1s taking 46s. After this one hit, everything is back to=20 normal, and subsequent executions of the same query are in fact subsecond.= =20 Restarting the appserver and pgsql does not make the slowness re-appear, on= ly=20 running another batch will. During the 'write'/batch cycle, a large number of rows in various tables ar= e=20 inserted and subsequently (repeatedly) updated. The reporting type queries= =20 after that are basically searches on those tables. Anybody any ideas? Thanks, jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Wed Mar 15 15:43:56 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6947B9DCCC1 for ; Wed, 15 Mar 2006 15:43: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 17050-04 for ; Wed, 15 Mar 2006 15:43:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 1CAE19DCCAB for ; Wed, 15 Mar 2006 15:43:52 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 15 Mar 2006 13:43:54 -0600 Message-Id: <44181A11.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 15 Mar 2006 13:43:45 -0600 From: "Kevin Grittner" To: Subject: Background writer configuration Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/216 X-Sequence-Number: 17653 We were seeing clusters of query timeouts with our web site, which were corrected by adjusting the configuration of the background writer. I'm posting just to provide information which others might find useful -- I don't have any problem I'm trying to solve in this regard. The web site gets 1 to 2 million hits per day, with about the same number of select queries run to provide data for the web pages. The load is distributed across multiple databases. (We have four, but the load is easily handled by any two of them, and we often take one or two out of web use for maintenance or special statistical runs.) Each database gets the same stream of modification requests -- about 2.7 million database transactions per day. Each transaction can contain multiple inserts, updates, or deletes. The peak times for both the web requests and the data modifications are in the afternoon on business days. Most web queries run under a timeout limit of 20 seconds. During peak times, we would see clusters of timeouts (where queries exceeded the 20 second limit) on very simple queries which normally run in a few milliseconds. The pattern suggested that checkpoints were at fault. I boosted the settings for the background writer from the defaults to the values below, and we saw a dramatic reduction in these timeouts. We also happened to have one machine which had been out of the replication mix which was in "catch up" mode, processing the transaction stream as fast as the database could handle it, without any web load. We saw the transaction application rate go up by a factor of four when I applied these changes: bgwriter_lru_percent = 2.0 bgwriter_lru_maxpages = 250 bgwriter_all_percent = 1.0 bgwriter_all_maxpages = 250 This was with shared_buffers = 20000, so that last value was effectively limited to 200 by the percentage. I then did some calculations, based on the sustained write speed of our drive array (as measured by copying big files to it), and we tried this: bgwriter_lru_percent = 20.0 bgwriter_lru_maxpages = 200 bgwriter_all_percent = 10.0 bgwriter_all_maxpages = 600 This almost totally eliminated the clusters of timeouts, and caused the transaction application rate to increase by a factor of eight over the already-improved speed. (That is, we were running 30 to 35 times as many transactions per minute into the database, compared to the default background writer configuration.) I'm going to let these settings settle in for a week or two before we try adjusting them further (to see if we can eliminate those last few timeouts of this type). I guess my point is that people shouldn't be shy about boosting these numbers by a couple orders of magnitude from the default values. It may also be worth considering whether the defaults should be something more aggressive. -Kevin From pgsql-performance-owner@postgresql.org Wed Mar 15 15:51:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 49AC39DCC9F for ; Wed, 15 Mar 2006 15:51: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 18434-05 for ; Wed, 15 Mar 2006 15:51:11 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 238529DCBB2 for ; Wed, 15 Mar 2006 15:51:09 -0400 (AST) Received: from projects.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by svr4.postgresql.org (Postfix) with ESMTP id A02FF5AF96A for ; Wed, 15 Mar 2006 19:51:10 +0000 (GMT) Received: from [192.168.1.100] (or-67-76-146-141.sta.sprint-hsd.net [67.76.146.141]) (authenticated bits=0) by projects.commandprompt.com (8.13.4/8.13.4) with ESMTP id k2FJpAuf000839 for ; Wed, 15 Mar 2006 11:51:11 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. To: pgsql-performance@postgresql.org Subject: Re: Background writer configuration Date: Wed, 15 Mar 2006 11:54:33 -0800 User-Agent: KMail/1.9.1 References: <44181A11.EE98.0025.0@wicourts.gov> In-Reply-To: <44181A11.EE98.0025.0@wicourts.gov> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603151154.33504.jd@commandprompt.com> X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (projects.commandprompt.com [192.168.2.159]); Wed, 15 Mar 2006 11:51:11 -0800 (PST) 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: 200603/217 X-Sequence-Number: 17654 > I then did some calculations, based on the sustained write speed of our > drive array (as measured by copying big files to it), and we tried > this: > > bgwriter_lru_percent = 20.0 > bgwriter_lru_maxpages = 200 > bgwriter_all_percent = 10.0 > bgwriter_all_maxpages = 600 > > This almost totally eliminated the clusters of timeouts, and caused the > transaction application rate to increase by a factor of eight over the > already-improved speed. (That is, we were running 30 to 35 times as > many transactions per minute into the database, compared to the default > background writer configuration.) I'm going to let these settings > settle in for a week or two before we try adjusting them further (to see > if we can eliminate those last few timeouts of this type). Can you tell us what type of array you have? Joshua D. Drake > > I guess my point is that people shouldn't be shy about boosting these > numbers by a couple orders of magnitude from the default values. It may > also be worth considering whether the defaults should be something more > aggressive. > > -Kevin > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- The PostgreSQL Company - Command Prompt, Inc. 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 Wed Mar 15 16:26:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C140D9DC9C6 for ; Wed, 15 Mar 2006 16:26: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 28345-03 for ; Wed, 15 Mar 2006 16:26:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 66DE29DC94B for ; Wed, 15 Mar 2006 16:26:09 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 15 Mar 2006 14:26:11 -0600 Message-Id: <441823F5.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 15 Mar 2006 14:25:58 -0600 From: "Kevin Grittner" To: "Tom Lane" Cc: , "Andreas Kretschmer" Subject: Re: BETWEEN optimizer problems with single-value References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov><44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> In-Reply-To: <28798.1142450270@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/218 X-Sequence-Number: 17655 >>> On Wed, Mar 15, 2006 at 1:17 pm, in message <28798.1142450270@sss.pgh.pa.us>, Tom Lane wrote: > > 8.1 is certainly capable of devising the plan you want, for example > in the regression database: > > regression=# explain select * from tenk1 where thousand = 10 and tenthous > between 42 and 144; > QUERY PLAN > ------------------------------------------------------------------------------------ > Index Scan using tenk1_thous_tenthous on tenk1 (cost=0.00..6.01 rows=1 > width=244) > Index Cond: ((thousand = 10) AND (tenthous >= 42) AND (tenthous <= 144)) > (2 rows) That matches one of the examples where it optimized well. I only saw the bad plan when low and high ends of the BETWEEN range were equal. > It looks to me like this is a matter of bad cost estimation, ie, it's > thinking the other index is cheaper to use. Why that is is not clear. > Can we see the pg_stats rows for ctofcNo and calDate? schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-----------+---------+-----------+-----------+------------+-----------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+------------- public | Cal | calDate | 0 | 4 | 2114 | {2003-06-02,2000-06-20,2001-04-16,2003-06-17,2003-12-01,2004-10-12,2001-04-23,2001-10-15,2002-03-06,2002-05-03} | {0.00333333,0.00233333,0.00233333,0.00233333,0.00233333,0.00233333,0.002,0.002,0.002,0.002} | {1986-03-14,1999-06-11,2000-07-14,2001-05-18,2002-03-21,2002-12-04,2003-08-12,2004-05-13,2005-02-01,2005-09-28,2080-12-31} | 0.0545768 public | Cal | ctofcNo | 0 | 8 | 669 | {0793,1252,1571,0964,0894,1310,"DA ",0944,1668,0400} | {0.024,0.019,0.015,0.0123333,0.012,0.011,0.0106667,0.01,0.00966667,0.00866667} | {0000,0507,0733,0878,1203,1336,14AG,1633,1971,3705,YVJO} | -0.0179665 (2 rows) > Also, try to force it to generate the plan you want, so we can see what > it thinks the cost is for that. If you temporarily drop the wrong index > you should be able to get there: > > begin; > drop index "Cal_CalDate"; > explain analyze select ... ; > -- repeat as needed if it chooses some other wrong index > rollback; Sort (cost=4.03..4.03 rows=1 width=12) (actual time=48.484..48.486 rows=4 loops=1) Sort Key: "calDate", "startTime" -> Index Scan using "Cal_CtofcNo" on "Cal" "CA" (cost=0.00..4.02 rows=1 width=12) (actual time=36.750..48.228 rows=4 loops=1) Index Cond: ((("ctofcNo")::bpchar = '2192'::bpchar) AND (("calDate")::date >= '2006-03-15'::date) AND (("calDate")::date <= '2006-03-15'::date)) Total runtime: 56.616 ms From pgsql-performance-owner@postgresql.org Wed Mar 15 16:43:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B41089DCCA5 for ; Wed, 15 Mar 2006 16:43: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 31992-03 for ; Wed, 15 Mar 2006 16:43:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 46C479DC9AC for ; Wed, 15 Mar 2006 16:43:09 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 15 Mar 2006 14:43:11 -0600 Message-Id: <441827F5.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 15 Mar 2006 14:43:01 -0600 From: "Kevin Grittner" To: "Joshua Drake" , Subject: Re: Background writer configuration References: <44181A11.EE98.0025.0@wicourts.gov> <200603151154.33504.jd@commandprompt.com> In-Reply-To: <200603151154.33504.jd@commandprompt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/219 X-Sequence-Number: 17656 >>> On Wed, Mar 15, 2006 at 1:54 pm, in message <200603151154.33504.jd@commandprompt.com>, "Joshua D. Drake" wrote: >> I then did some calculations, based on the sustained write speed of our >> drive array (as measured by copying big files to it), and we tried >> this: >> >> bgwriter_lru_percent = 20.0 >> bgwriter_lru_maxpages = 200 >> bgwriter_all_percent = 10.0 >> bgwriter_all_maxpages = 600 >> >> This almost totally eliminated the clusters of timeouts, and caused the >> transaction application rate to increase by a factor of eight over the >> already- improved speed. (That is, we were running 30 to 35 times as >> many transactions per minute into the database, compared to the default >> background writer configuration.) I'm going to let these settings >> settle in for a week or two before we try adjusting them further (to see >> if we can eliminate those last few timeouts of this type). > > > Can you tell us what type of array you have? Each machine has a RAID5 array of 13 (plus one hot spare) 15,000 RPM Ultra 320 SCSI drives 2 machines using IBM ServRaid6M battery backed caching controllers 2 machines using IBM ServRaid4MX battery backed caching controllers From pgsql-performance-owner@postgresql.org Wed Mar 15 16:45:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D9FAF9DC883 for ; Wed, 15 Mar 2006 16:45: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 33093-01 for ; Wed, 15 Mar 2006 16:45:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from 137086.vserver.de (vs137086.vserver.de [62.75.137.86]) by postgresql.org (Postfix) with ESMTP id 1CD8D9DC816 for ; Wed, 15 Mar 2006 16:45:42 -0400 (AST) Received: from a-kretschmer.de (p54B3CFDE.dip0.t-ipconnect.de [84.179.207.222]) (authenticated bits=0) by 137086.vserver.de (8.12.8/8.12.8) with ESMTP id k2FKjfgb001825 for ; Wed, 15 Mar 2006 21:45:42 +0100 Received: from kretschmer by a-kretschmer.de with local (Exim 4.60) (envelope-from ) id 1FJctY-0004tk-R5 for pgsql-performance@postgresql.org; Wed, 15 Mar 2006 21:47:00 +0100 Date: Wed, 15 Mar 2006 21:47:00 +0100 From: Andreas Kretschmer To: pgsql-performance@postgresql.org Subject: Re: BETWEEN optimizer problems with single-value range Message-ID: <20060315204700.GA17623@KanotixBox> References: <44180105.EE98.0025.0@wicourts.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! X-Lugdd: Gerd Kube X-Info: My name is root. Just root. And I am licensed to kill -9 User-Agent: mutt-ng 1.5.9i (Linux) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.123 required=5 tests=[AWL=0.123] X-Spam-Score: 0.123 X-Spam-Level: X-Archive-Number: 200603/220 X-Sequence-Number: 17657 Merlin Moncure schrieb: > On 3/15/06, Kevin Grittner wrote: > > Attached is a simplified example of a performance problem we have seen, > > with a workaround and a suggestion for enhancement (hence both the > > performance and hackers lists). > > > Hi Kevin. In postgres 8.2 you will be able to use the row-wise 8.2? AFAIK, Feature freeze in juni/juli this year... Release august/september. > comparison for your query which should guarantee good worst case > performance without having to maintain two separate query forms. it Perhaps, a bitmap index scan (since 8.1) are useful for such querys. Thats why i asked which version. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknow) Kaufbach, Saxony, Germany, Europe. N 51.05082�, E 13.56889� From pgsql-hackers-owner@postgresql.org Wed Mar 15 18:11:17 2006 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 16B019DC999 for ; Wed, 15 Mar 2006 18: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 53732-05 for ; Wed, 15 Mar 2006 18:11:18 -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 F0AC09DC80D for ; Wed, 15 Mar 2006 18:11:14 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 4so288440nzn for ; Wed, 15 Mar 2006 14: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Qv+g6085KS4pmdwNC9HpR4Z4YvxNsLgYuvzsj5JTHbFM5J9tpXcSM0U2k9ouX6fkRdaP5k9NMJo6zY/4Txjuvyo0czqTISbF6BOjQfqfZ82aSiVb37Ca2fHlJr1NL6X8Mihor/w0S8Z0AyTHqkU7GEEYrCIF714OAA0EH35Gvtg= Received: by 10.65.133.19 with SMTP id k19mr554537qbn; Wed, 15 Mar 2006 14:11:16 -0800 (PST) Received: by 10.65.137.20 with HTTP; Wed, 15 Mar 2006 14:11:16 -0800 (PST) Message-ID: Date: Wed, 15 Mar 2006 17:11:16 -0500 From: "Merlin Moncure" To: "Andreas Kretschmer" Subject: Re: [PERFORM] BETWEEN optimizer problems with single-value range Cc: pgsql-performance@postgresql.org, "Kevin Grittner" , "postgres hackers" In-Reply-To: <20060315204700.GA17623@KanotixBox> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <44180105.EE98.0025.0@wicourts.gov> <20060315204700.GA17623@KanotixBox> 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: 200603/723 X-Sequence-Number: 81121 On 3/15/06, Andreas Kretschmer wrote: > Merlin Moncure schrieb: > > > On 3/15/06, Kevin Grittner wrote: > > > Attached is a simplified example of a performance problem we have see= n, > > > with a workaround and a suggestion for enhancement (hence both the > > > performance and hackers lists). > > > > > > Hi Kevin. In postgres 8.2 you will be able to use the row-wise > > 8.2? AFAIK, Feature freeze in juni/juli this year... > Release august/september. yes, but I was addressing kevin's point about enhancing the server... > > comparison for your query which should guarantee good worst case > > performance without having to maintain two separate query forms. it > > Perhaps, a bitmap index scan (since 8.1) are useful for such querys. > Thats why i asked which version. I think you will find that reading a range of records from a table ordered by an index utilizing the 8.2 comparison feature is much faster than a bitmap index scan. Merlin From pgsql-performance-owner@postgresql.org Wed Mar 15 19:05:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 972D49DCBE9 for ; Wed, 15 Mar 2006 19:05: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 68775-03 for ; Wed, 15 Mar 2006 19:05:23 -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 587DC9DCBDE for ; Wed, 15 Mar 2006 19:05:17 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 6765933695D; Wed, 15 Mar 2006 23:05:13 +0000 (GMT) Subject: Re: [HACKERS] BETWEEN optimizer problems with single-value range From: Simon Riggs To: Kevin Grittner Cc: pgsql-performance@postgresql.org In-Reply-To: <44180105.EE98.0025.0@wicourts.gov> References: <44180105.EE98.0025.0@wicourts.gov> Content-Type: text/plain Date: Wed, 15 Mar 2006 23:05:08 +0000 Message-Id: <1142463908.3859.188.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.094 required=5 tests=[AWL=0.094] X-Spam-Score: 0.094 X-Spam-Level: X-Archive-Number: 200603/222 X-Sequence-Number: 17659 On Wed, 2006-03-15 at 11:56 -0600, Kevin Grittner wrote: > Attached is a simplified example of a performance problem we have seen, > with a workaround and a suggestion for enhancement (hence both the > performance and hackers lists). > > Our software is allowing users to specify the start and end dates for a > query. When they enter the same date for both, the optimizer makes a > very bad choice. We can work around it in application code by using an > equality test if both dates match. I think the planner should be able > to make a better choice here. > (One obvious way to fix it would be to > rewrite "BETWEEN a AND b" as "= a" when a is equal to b, but it seems > like there is some underlying problem which should be fixed instead (or > in addition to) this. That might work, but I'm not sure if that is in itself the problem and it would be mostly wasted overhead in 99% of cases. The main issue appears to be that the planner chooses "Cal_CalDate" index rather than "Cal_CtofcNo" index when the BETWEEN values match. It seems that the cost of the first and third EXPLAINs is equal, yet for some reason it chooses different indexes in each case. My understanding was that it would pick the first index created if plan costs were equal. Is that behaviour repeatable with each query? ISTM that if we have equal plan costs then we should be choosing the index for which we have more leading columns, since that is more likely to lead to a more selective answer. But the plan selection is a simple "pick the best, or if they're equal pick the best sort order". > The first query uses BETWEEN with the same date for both min and max > values. The second query uses an equality test for the same date. The > third query uses BETWEEN with a two-day range. In all queries, there > are less than 4,600 rows for the specified cotfcNo value out of over 18 > million rows in the table. We tried boosting the statistics samples for > the columns in the selection, which made the estimates of rows more > accurate, but didn't change the choice of plans. The selectivity seems the same in both - clamped to a minimum of 1 row, so changing that doesn't look like it would help. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Mar 15 19:12:00 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 16CEF9DCCC8 for ; Wed, 15 Mar 2006 19:11: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 74245-03 for ; Wed, 15 Mar 2006 19:12:01 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by postgresql.org (Postfix) with ESMTP id E4CAC9DCBF9 for ; Wed, 15 Mar 2006 19:11:55 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 14so233980nzn for ; Wed, 15 Mar 2006 15:11:58 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=hvzDfF7V0gBXba342WKAcJj4KenrKSpHf/pS8hT+gcGFO7exQNrCWygXfhaQkL35pnxTL8dIkruAqcgX5zU+5R6ktz9RzZkhgN6EXzSxqsvqPQYCASoadJRJ0hmjg86xpUCFmNFbK6fDu1zss6kGLpBypMua9TWIv8yl1KYWeDU= Received: by 10.37.14.63 with SMTP id r63mr1472378nzi; Wed, 15 Mar 2006 15:11:58 -0800 (PST) Received: from ?10.1.1.20? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 6sm1614347nzn.2006.03.15.15.11.56; Wed, 15 Mar 2006 15:11:58 -0800 (PST) Message-ID: <44189F3B.1020209@gmail.com> Date: Thu, 16 Mar 2006 10:11:55 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jan de Visser CC: pgsql-performance@postgresql.org Subject: Re: Slow SELECTS after large update cycle References: <200603151439.13958.jdevisser@digitalfairway.com> In-Reply-To: <200603151439.13958.jdevisser@digitalfairway.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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/223 X-Sequence-Number: 17660 Jan de Visser wrote: > Hello, > > After fixing the hanging problems I reported here earlier (by uninstalling > W2K3 SP1), I'm running into another weird one. > > After doing a +/- 8hr cycle of updates and inserts (what we call a 'batch'), > the first 'reporting' type query on tables involved in that write cycle is > very slow. As an example, I have a query which according to EXPLAIN ANALYZE > takes about 1.1s taking 46s. After this one hit, everything is back to > normal, and subsequent executions of the same query are in fact subsecond. > Restarting the appserver and pgsql does not make the slowness re-appear, only > running another batch will. > > During the 'write'/batch cycle, a large number of rows in various tables are > inserted and subsequently (repeatedly) updated. The reporting type queries > after that are basically searches on those tables. After a large batch you need to run 'analyze' over the tables involved to get postgresql to update it's statistics so it can work out which indexes etc it should use. -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Wed Mar 15 19:21:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E945D9DCBD1 for ; Wed, 15 Mar 2006 19:21: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 75171-10 for ; Wed, 15 Mar 2006 19:21: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 AD2D99DCBD0 for ; Wed, 15 Mar 2006 19:21:35 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id C4DD6336403; Wed, 15 Mar 2006 23:21:32 +0000 (GMT) Subject: Re: Slow SELECTS after large update cycle From: Simon Riggs To: Jan de Visser Cc: pgsql-performance@postgresql.org In-Reply-To: <200603151439.13958.jdevisser@digitalfairway.com> References: <200603151439.13958.jdevisser@digitalfairway.com> Content-Type: text/plain Date: Wed, 15 Mar 2006 23:21:27 +0000 Message-Id: <1142464887.3859.195.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.094 required=5 tests=[AWL=0.094] X-Spam-Score: 0.094 X-Spam-Level: X-Archive-Number: 200603/224 X-Sequence-Number: 17661 On Wed, 2006-03-15 at 14:39 -0500, Jan de Visser wrote: > After fixing the hanging problems I reported here earlier (by uninstalling > W2K3 SP1), I'm running into another weird one. > > After doing a +/- 8hr cycle of updates and inserts (what we call a 'batch'), > the first 'reporting' type query on tables involved in that write cycle is > very slow. As an example, I have a query which according to EXPLAIN ANALYZE > takes about 1.1s taking 46s. After this one hit, everything is back to > normal, and subsequent executions of the same query are in fact subsecond. > Restarting the appserver and pgsql does not make the slowness re-appear, only > running another batch will. > > During the 'write'/batch cycle, a large number of rows in various tables are > inserted and subsequently (repeatedly) updated. The reporting type queries > after that are basically searches on those tables. > > Anybody any ideas? This is caused by updating the commit status hint bits on each row touched by the SELECTs. This turns the first SELECT into a write operation. Try running a scan of the whole table to take the hit before you give it back to the users. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Mar 15 19:34:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 43C629DCC82 for ; Wed, 15 Mar 2006 19:34: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 81351-02-2 for ; Wed, 15 Mar 2006 19:34:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id BD8969DCC97 for ; Wed, 15 Mar 2006 19:34:38 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 15 Mar 2006 17:34:40 -0600 Message-Id: <44185029.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 15 Mar 2006 17:34:33 -0600 From: "Kevin Grittner" To: "Simon Riggs" Cc: Subject: Re: [HACKERS] BETWEEN optimizer problems with single-value References: <44180105.EE98.0025.0@wicourts.gov> <1142463908.3859.188.camel@localhost.localdomain> In-Reply-To: <1142463908.3859.188.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: 200603/225 X-Sequence-Number: 17662 >>> On Wed, Mar 15, 2006 at 5:05 pm, in message <1142463908.3859.188.camel@localhost.localdomain>, Simon Riggs wrote: > On Wed, 2006- 03- 15 at 11:56 - 0600, Kevin Grittner wrote: > >> (One obvious way to fix it would be to >> rewrite "BETWEEN a AND b" as "= a" when a is equal to b, but it seems >> like there is some underlying problem which should be fixed instead (or >> in addition to) this. > > That might work, but I'm not sure if that is in itself the problem and > it would be mostly wasted overhead in 99% of cases. It sounds like we agree. > The main issue appears to be that the planner chooses "Cal_CalDate" > index rather than "Cal_CtofcNo" index when the BETWEEN values match. Agreed. > It seems that the cost of the first and third EXPLAINs is equal, yet for > some reason it chooses different indexes in each case. My understanding > was that it would pick the first index created if plan costs were equal. > Is that behaviour repeatable with each query? It seems to be a consistent pattern, although strictly speaking our evidence is anecdotal. We've got hundreds of known failures with the BETWEEN variant on equal dates and no known successes. We have a few dozen tests of the equality variant with 100% success in those tests. > ISTM that if we have equal plan costs then we should be choosing the > index for which we have more leading columns, since that is more likely > to lead to a more selective answer. But the plan selection is a simple > "pick the best, or if they're equal pick the best sort order". > The selectivity seems the same in both - clamped to a minimum of 1 row, > so changing that doesn't look like it would help. The fact that it costs these as equivalent is surprising in itself, and might be worth examining. This might be an example of something I suggested a while ago -- that the rounding a row estimate to an integer on the basis that "you can't read half a row" is not necessarily wise, because you can have a 50% chance of reading a row versus a higher or lower percentage. -Kevin From pgsql-performance-owner@postgresql.org Wed Mar 15 20:07:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 129E09DC80D for ; Wed, 15 Mar 2006 20:07: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 98985-02 for ; Wed, 15 Mar 2006 20:07:18 -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 10EB19DC82F for ; Wed, 15 Mar 2006 20:07:14 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 558FE333DCD; Thu, 16 Mar 2006 00:07:15 +0000 (GMT) Subject: Re: BETWEEN optimizer problems with single-value From: Simon Riggs To: Tom Lane Cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer In-Reply-To: <28798.1142450270@sss.pgh.pa.us> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> Content-Type: text/plain Date: Thu, 16 Mar 2006 00:07:06 +0000 Message-Id: <1142467626.3859.207.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.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200603/226 X-Sequence-Number: 17663 On Wed, 2006-03-15 at 14:17 -0500, Tom Lane wrote: > It looks to me like this is a matter of bad cost estimation, ie, it's > thinking the other index is cheaper to use. Why that is is not clear. > Can we see the pg_stats rows for ctofcNo and calDate? ISTM that when the BETWEEN constants match we end up in this part of clauselist_selectivity()... From pgsql-performance-owner@postgresql.org Wed Mar 15 20:24:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 327C09DC80D for ; Wed, 15 Mar 2006 20: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 02941-01 for ; Wed, 15 Mar 2006 20:24:50 -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 EEEB19DCCFC for ; Wed, 15 Mar 2006 20:24:44 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 5DE4F3360C4; Thu, 16 Mar 2006 00:24:47 +0000 (GMT) Subject: Re: BETWEEN optimizer problems with single-value From: Simon Riggs To: Tom Lane Cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer In-Reply-To: <1142467626.3859.207.camel@localhost.localdomain> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> Content-Type: text/plain Date: Thu, 16 Mar 2006 00:24:38 +0000 Message-Id: <1142468678.3859.221.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.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200603/227 X-Sequence-Number: 17664 On Thu, 2006-03-16 at 00:07 +0000, Simon Riggs wrote: > On Wed, 2006-03-15 at 14:17 -0500, Tom Lane wrote: > > > It looks to me like this is a matter of bad cost estimation, ie, it's > > thinking the other index is cheaper to use. Why that is is not clear. > > Can we see the pg_stats rows for ctofcNo and calDate? > > ISTM that when the BETWEEN constants match we end up in this part of > clauselist_selectivity()... (and now for the whole email...) /* * It's just roundoff error; use a small positive * value */ s2 = 1.0e-10; so that the planner underestimates the cost of using "Cal_CalDate" so that it ends up the same as "Cal_CtofcNo", and then we pick "Cal_CalDate" because it was created first. Using 1.0e-10 isn't very useful... the selectivity for a range should never be less than the selectivity for an equality, so we should simply put in a test against one of the pseudo constants and use that as the minimal value. That should lead to raising the apparent cost of Cal_CalDate so that Cal_CtofcNo can take precedence. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Mar 15 20:42:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 59C0E9DCB5C for ; Wed, 15 Mar 2006 20:42: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 08906-01 for ; Wed, 15 Mar 2006 20:42:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.digitalfairway.ca (ns.digitalfairway.ca [207.164.133.170]) by postgresql.org (Postfix) with ESMTP id 9C8FB9DCB4B for ; Wed, 15 Mar 2006 20:41:58 -0400 (AST) Received: from toronto.toronto.digitalfairway.ca (unknown [192.168.100.10]) by mail.digitalfairway.ca (Postfix) with ESMTP id C6D94A073B for ; Wed, 15 Mar 2006 19:42:01 -0500 (EST) Received: from localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 6DD41129899 for ; Wed, 15 Mar 2006 19:42:01 -0500 (EST) Received: from toronto.toronto.digitalfairway.ca ([127.0.0.1]) by localhost (toronto.toronto.digitalfairway.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01132-01 for ; Wed, 15 Mar 2006 19:42:01 -0500 (EST) Received: from [192.168.0.101] (CPE00119557f5ec-CM000f9faa78f6.cpe.net.cable.rogers.com [70.24.152.86]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by toronto.toronto.digitalfairway.ca (Postfix) with ESMTP id 434F412985B for ; Wed, 15 Mar 2006 19:42:01 -0500 (EST) From: Jan de Visser To: pgsql-performance@postgresql.org Subject: Re: Slow SELECTS after large update cycle Date: Wed, 15 Mar 2006 19:42:00 -0500 User-Agent: KMail/1.9.1 References: <200603151439.13958.jdevisser@digitalfairway.com> <1142464887.3859.195.camel@localhost.localdomain> In-Reply-To: <1142464887.3859.195.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603151942.01123.jdevisser@digitalfairway.com> X-Virus-Scanned: amavisd-new at digitalfairway.ca 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: 200603/228 X-Sequence-Number: 17665 On Wednesday 15 March 2006 18:21, Simon Riggs wrote: > On Wed, 2006-03-15 at 14:39 -0500, Jan de Visser wrote: > > After fixing the hanging problems I reported here earlier (by > > uninstalling W2K3 SP1), I'm running into another weird one. > > > > After doing a +/- 8hr cycle of updates and inserts (what we call a > > 'batch'), the first 'reporting' type query on tables involved in that > > write cycle is very slow. As an example, I have a query which according > > to EXPLAIN ANALYZE takes about 1.1s taking 46s. After this one hit, > > everything is back to normal, and subsequent executions of the same que= ry > > are in fact subsecond. Restarting the appserver and pgsql does not make > > the slowness re-appear, only running another batch will. > > > > During the 'write'/batch cycle, a large number of rows in various tables > > are inserted and subsequently (repeatedly) updated. The reporting type > > queries after that are basically searches on those tables. > > > > Anybody any ideas? > > This is caused by updating the commit status hint bits on each row > touched by the SELECTs. This turns the first SELECT into a write > operation. > > Try running a scan of the whole table to take the hit before you give it > back to the users. Thanks Simon. I didn't know about the cause, but I expected the answer to b= e=20 'deal with it', as it is. At least I can explain it now... > > Best Regards, Simon Riggs jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 jdevisser@digitalfairway.com =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Baruk Khazad! Khaza= d ai-menu! =2D------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Wed Mar 15 22:05:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B52DB9DC844 for ; Wed, 15 Mar 2006 22:05: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 30470-06 for ; Wed, 15 Mar 2006 22:05:26 -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 719BC9DC825 for ; Wed, 15 Mar 2006 22:05:19 -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 k2G25Oac011429; Wed, 15 Mar 2006 21:05:24 -0500 (EST) To: Simon Riggs cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer Subject: Re: BETWEEN optimizer problems with single-value In-reply-to: <1142468678.3859.221.camel@localhost.localdomain> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> Comments: In-reply-to Simon Riggs message dated "Thu, 16 Mar 2006 00:24:38 +0000" Date: Wed, 15 Mar 2006 21:05:24 -0500 Message-ID: <11428.1142474724@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/229 X-Sequence-Number: 17666 Simon Riggs writes: >> ISTM that when the BETWEEN constants match we end up in this part of >> clauselist_selectivity()... Yeah, I think you are right. > so that the planner underestimates the cost of using "Cal_CalDate" so > that it ends up the same as "Cal_CtofcNo", and then we pick > "Cal_CalDate" because it was created first. No, it doesn't end up the same --- but the difference is small enough to be in the roundoff-error regime. The real issue here is that we're effectively assuming that one row will be fetched from the index in both cases, and this is clearly not the case for the Cal_CalDate index. So we need a more accurate estimate for the boundary case. > Using 1.0e-10 isn't very useful... the selectivity for a range should > never be less than the selectivity for an equality, so we should simply > put in a test against one of the pseudo constants and use that as the > minimal value. That's easier said than done, because you'd first have to find the appropriate equality operator to use (ie, one having semantics that agree with the inequality operators). Another point is that the above statement is simply wrong, consider calDate BETWEEN '2006-03-15' AND '2006-03-14' for which an estimate of zero really is correct. Possibly we could drop this code's reliance on seeing SCALARLTSEL/SCALARGTSEL as the estimators, and instead try to locate a common btree opclass for the operators --- which would then let us identify the right equality operator to use, and also let us distinguish > from >= etc. If we're trying to get the boundary cases right I suspect we have to account for that. I could see such an approach being tremendously slow though :-(, because we'd go looking for btree opclasses even for operators that have nothing to do with < or >. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 16 06:45:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D78389DC808 for ; Thu, 16 Mar 2006 06:45: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 83421-01 for ; Thu, 16 Mar 2006 06:45:13 -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 97C709DC849 for ; Thu, 16 Mar 2006 06:45:09 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so311842nzo for ; Thu, 16 Mar 2006 02:45:12 -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=VPQXOYzqQvXr+hGuNDq4RtqwzZZni/m6TYQM/eohqH/WGnwdaxJfmrgbu/3agPYrvxX8x5ShCTXkJbJSIN3+fF3DElCorjAFpfqRNkpxIJZUNmVFneq4q5+/BgILfBYReugPlaH0MQJ5wuYQ/JA4t7PQzWBmf1N6ZeZNzjH/6LM= Received: by 10.65.158.13 with SMTP id k13mr621390qbo; Thu, 16 Mar 2006 02:45:12 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 02:45:12 -0800 (PST) Message-ID: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> Date: Thu, 16 Mar 2006 11:45:12 +0100 From: "Guillaume Smet" To: pgsql-performance@postgresql.org Subject: PostgreSQL and Xeon MP 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.302 required=5 tests=[AWL=0.302] X-Spam-Score: 0.302 X-Spam-Level: X-Archive-Number: 200603/230 X-Sequence-Number: 17667 Hello, We are experiencing performances problem with a quad Xeon MP and PostgreSQL 7.4 for a year now. Our context switch rate is not so high but the load of the server is blocked to 4 even on very high load and we have 60% cpu idle even in this case. Our database fits in RAM and we don't have any IO problem. I saw this post from Tom Lane http://archives.postgresql.org/pgsql-performance/2004-04/msg00249.php and several other references to problem with Xeon MP and I suspect our problems are related to this. We tried to put our production load on a dual standard Xeon on monday and it performs far better with the same configuration parameters. I know that work has been done by Tom for PostgreSQL 8.1 on multiprocessor support but I didn't find any information on if it solves the problem with Xeon MP or not. My question is should we expect a resolution of our problem by switching to 8.1 or will we still have problems and should we consider a hardware change? We will try to upgrade next tuesday so we will have the real answer soon but if anyone has any experience or information on this, he will be very welcome. Thanks for your help. -- Guillaume From pgsql-performance-owner@postgresql.org Thu Mar 16 07:37:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5D5B59DC84B for ; Thu, 16 Mar 2006 07:37: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 91552-04 for ; Thu, 16 Mar 2006 07:37:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by postgresql.org (Postfix) with ESMTP id F25459DC849 for ; Thu, 16 Mar 2006 07:37:23 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay06.plus.net with esmtp (Exim) id 1FJqnF-00050T-Jb; Thu, 16 Mar 2006 11:37:25 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 97A9F40C569; Thu, 16 Mar 2006 11:21:48 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 1A3D9FF04; Thu, 16 Mar 2006 11:21:48 +0000 (GMT) Message-ID: <44194A4B.3020106@archonet.com> Date: Thu, 16 Mar 2006 11:21:47 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Guillaume Smet Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> In-Reply-To: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.125 required=5 tests=[AWL=0.125] X-Spam-Score: 0.125 X-Spam-Level: X-Archive-Number: 200603/231 X-Sequence-Number: 17668 Guillaume Smet wrote: > Hello, > > We are experiencing performances problem with a quad Xeon MP and > PostgreSQL 7.4 for a year now. I had a similar issue with a client the other week. > Our context switch rate is not so high > but the load of the server is blocked to 4 even on very high load and > we have 60% cpu idle even in this case. Our database fits in RAM and > we don't have any IO problem. Actually, I think that's part of the problem - it's the memory bandwidth. > I saw this post from Tom Lane > http://archives.postgresql.org/pgsql-performance/2004-04/msg00249.php > and several other references to problem with Xeon MP and I suspect our > problems are related to this. You should be seeing context-switching jump dramatically if it's the "classic" multi-Xeon problem. There's a point at which it seems to just escalate without a corresponding jump in activity. > We tried to put our production load on a dual standard Xeon on monday > and it performs far better with the same configuration parameters. > > I know that work has been done by Tom for PostgreSQL 8.1 on > multiprocessor support but I didn't find any information on if it > solves the problem with Xeon MP or not. I checked with Tom last week. Thread starts below: http://archives.postgresql.org/pgsql-hackers/2006-02/msg01118.php He's of the opinion that 8.1.3 will be an improvement. > My question is should we expect a resolution of our problem by > switching to 8.1 or will we still have problems and should we consider > a hardware change? We will try to upgrade next tuesday so we will have > the real answer soon but if anyone has any experience or information > on this, he will be very welcome. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Mar 16 07:54:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 464CF9DC88F for ; Thu, 16 Mar 2006 07:54: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 93465-06 for ; Thu, 16 Mar 2006 07:54:16 -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 EDEF99DC849 for ; Thu, 16 Mar 2006 07:54:10 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 0A0823495CC; Thu, 16 Mar 2006 11:54:04 +0000 (GMT) Subject: Re: BETWEEN optimizer problems with single-value From: Simon Riggs To: Tom Lane Cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer In-Reply-To: <11428.1142474724@sss.pgh.pa.us> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> <11428.1142474724@sss.pgh.pa.us> Content-Type: text/plain Date: Thu, 16 Mar 2006 11:53:52 +0000 Message-Id: <1142510032.3859.320.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.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200603/232 X-Sequence-Number: 17669 On Wed, 2006-03-15 at 21:05 -0500, Tom Lane wrote: > So we need a more accurate estimate for the boundary case. Agreed. > > Using 1.0e-10 isn't very useful... the selectivity for a range should > > never be less than the selectivity for an equality, so we should simply > > put in a test against one of the pseudo constants and use that as the > > minimal value. > > That's easier said than done, because you'd first have to find the > appropriate equality operator to use (ie, one having semantics that > agree with the inequality operators). ... Kevin: this is also the reason we can't simply transform the WHERE clause into a more appropriate form... > Possibly we could drop this code's reliance on seeing > SCALARLTSEL/SCALARGTSEL as the estimators, and instead try to locate a > common btree opclass for the operators --- which would then let us > identify the right equality operator to use, and also let us distinguish > > from >= etc. If we're trying to get the boundary cases right I > suspect we have to account for that. I could see such an approach being > tremendously slow though :-(, because we'd go looking for btree > opclasses even for operators that have nothing to do with < or >. Trying to get the information in the wrong place would be very expensive, I agree. But preparing that information when we have access to it and passing it through the plan would be much cheaper. Relating op->opclass will be very useful in other places in planning, even if any one case seems not to justify the work to record it. (This case feels like deja vu, all over again.) The operator and the opclass are only connected via an index access method, but for a particular index each column has only one opclass. So the opclass will have a 1-1 correspondence with the operator for *that* plan only, realising that other plans might have different correspondences. find_usable_indexes() or thereabouts could annotate a restriction OpExpr with the opclass it will use. Once we have the link, clauselist_selectivity() can trivially compare opclasses for both OpExprs, then retrieve other information for that opclass for various purposes. Seems lots of work for such a corner case, but would be worth it if this solves other problems as well. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Thu Mar 16 08:28:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A0DA39DC808 for ; Thu, 16 Mar 2006 08:28: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 00903-03 for ; Thu, 16 Mar 2006 08:28:12 -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 004EC9DC849 for ; Thu, 16 Mar 2006 08:28:07 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so325493nzo for ; Thu, 16 Mar 2006 04:28: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=Y03jFoI8u8+aPnQ1tW21inmTEziXI0IZLjkCEeJhsXJ+QFkUzbPPxoB3NSzMY7AjoRGujLNCI6+9YqXItYxGen96DqyLgYjrEWsjRDxC2EUDuRVlFm99kbVS20CYW+9Q+YR8btGi3/BIzOHs4rjFfRf/jhmETjZTi3blw4ue4EA= Received: by 10.65.244.6 with SMTP id w6mr652342qbr; Thu, 16 Mar 2006 04:28:11 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 04:28:11 -0800 (PST) Message-ID: <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> Date: Thu, 16 Mar 2006 13:28:11 +0100 From: "Guillaume Smet" To: "Richard Huxton" Subject: Re: PostgreSQL and Xeon MP Cc: pgsql-performance@postgresql.org In-Reply-To: <44194A4B.3020106@archonet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.256 required=5 tests=[AWL=0.256] X-Spam-Score: 0.256 X-Spam-Level: X-Archive-Number: 200603/233 X-Sequence-Number: 17670 Richard, > You should be seeing context-switching jump dramatically if it's the > "classic" multi-Xeon problem. There's a point at which it seems to just > escalate without a corresponding jump in activity. No we don't have this problem of very high context switching in our case even when the database is very slow. When I mean very slow, we have pages which loads in a few seconds in the normal case (load between 3 and 4) which takes several minutes (up to 5-10 minutes) to be generated in the worst case (load at 4 but really bad performances). If I take a look on our cpu load graph, in one year, the cpu load was never higher than 5 even in the worst cases... > I checked with Tom last week. Thread starts below: > http://archives.postgresql.org/pgsql-hackers/2006-02/msg01118.php > > He's of the opinion that 8.1.3 will be an improvement. Thanks for pointing me this thread, I searched in -performance not in -hackers as the original thread was in -performance. We planned a migration to 8.1.3 so we'll see what happen with this version. Do you plan to test it before next tuesday? If so, I'm interested in your results. I'll post our results here as soon as we complete the upgrade. -- Guillaume From pgsql-performance-owner@postgresql.org Thu Mar 16 09:17:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 105889DCB10 for ; Thu, 16 Mar 2006 09:17: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 06986-09 for ; Thu, 16 Mar 2006 09:17:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by postgresql.org (Postfix) with ESMTP id A16689DCA2B for ; Thu, 16 Mar 2006 09:17:27 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay06.plus.net with esmtp (Exim) id 1FJsM7-0006xF-Cn; Thu, 16 Mar 2006 13:17:31 +0000 Received: from mainbox.archonet.com (unknown [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id ADD7840D385; Thu, 16 Mar 2006 12:55:59 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7E7CEFF04; Thu, 16 Mar 2006 12:55:59 +0000 (GMT) Message-ID: <4419605F.9000806@archonet.com> Date: Thu, 16 Mar 2006 12:55:59 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Guillaume Smet Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> In-Reply-To: <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.125 required=5 tests=[AWL=0.125] X-Spam-Score: 0.125 X-Spam-Level: X-Archive-Number: 200603/235 X-Sequence-Number: 17672 Guillaume Smet wrote: > Richard, > >> You should be seeing context-switching jump dramatically if it's the >> "classic" multi-Xeon problem. There's a point at which it seems to just >> escalate without a corresponding jump in activity. > > No we don't have this problem of very high context switching in our > case even when the database is very slow. When I mean very slow, we > have pages which loads in a few seconds in the normal case (load > between 3 and 4) which takes several minutes (up to 5-10 minutes) to > be generated in the worst case (load at 4 but really bad > performances). Very strange. > If I take a look on our cpu load graph, in one year, the cpu load was > never higher than 5 even in the worst cases... > >> I checked with Tom last week. Thread starts below: >> http://archives.postgresql.org/pgsql-hackers/2006-02/msg01118.php >> >> He's of the opinion that 8.1.3 will be an improvement. > > Thanks for pointing me this thread, I searched in -performance not in > -hackers as the original thread was in -performance. We planned a > migration to 8.1.3 so we'll see what happen with this version. > > Do you plan to test it before next tuesday? If so, I'm interested in > your results. I'll post our results here as soon as we complete the > upgrade. The client has just bought an Opteron to run on, I'm afraid. I might try 8.1 on the Xeon but it'll just be to see what happens and that won't be for a while. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Mar 16 09:11:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 88EE19DC9A6 for ; Thu, 16 Mar 2006 09: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 05836-09 for ; Thu, 16 Mar 2006 09:11:25 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 3D3369DC8D8 for ; Thu, 16 Mar 2006 09:11:20 -0400 (AST) Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de [83.236.156.26]) by svr4.postgresql.org (Postfix) with ESMTP id 65FD85AF028 for ; Thu, 16 Mar 2006 13:11:23 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aeccom.com (Postfix) with ESMTP id 052E91C1F0; Thu, 16 Mar 2006 14:11:20 +0100 (CET) Received: from mail.aeccom.com ([127.0.0.1]) by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19704-02-10; Thu, 16 Mar 2006 14:11:18 +0100 (CET) Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) by mail.aeccom.com (Postfix) with ESMTP id DB07B1C162; Thu, 16 Mar 2006 14:11:18 +0100 (CET) Message-ID: <441963F4.1010607@aeccom.com> Date: Thu, 16 Mar 2006 14:11:16 +0100 From: Sven Geisler Organization: AEC/communications GmbH User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Guillaume Smet Cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> In-Reply-To: <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at aeccom.com 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: 200603/234 X-Sequence-Number: 17671 Hi Guillaume, I had a similar issue last summer. Could you please provide details about your XEON MP server and some statistics (context-switches/load/CPU usage)? I tried different servers (x86) with different results. I saw a difference between XEON MP w/ and w/o EMT64. The memory bandwidth makes also a difference. What version of XEON MP does your server have? Which type of RAM does you server have? Do you use Hyperthreading? You should provide details from the XEON DP? Regards Sven. Guillaume Smet schrieb: > Richard, > >> You should be seeing context-switching jump dramatically if it's the >> "classic" multi-Xeon problem. There's a point at which it seems to just >> escalate without a corresponding jump in activity. > > No we don't have this problem of very high context switching in our > case even when the database is very slow. When I mean very slow, we > have pages which loads in a few seconds in the normal case (load > between 3 and 4) which takes several minutes (up to 5-10 minutes) to > be generated in the worst case (load at 4 but really bad > performances). > If I take a look on our cpu load graph, in one year, the cpu load was > never higher than 5 even in the worst cases... > >> I checked with Tom last week. Thread starts below: >> http://archives.postgresql.org/pgsql-hackers/2006-02/msg01118.php >> >> He's of the opinion that 8.1.3 will be an improvement. > > Thanks for pointing me this thread, I searched in -performance not in > -hackers as the original thread was in -performance. We planned a > migration to 8.1.3 so we'll see what happen with this version. > > Do you plan to test it before next tuesday? If so, I'm interested in > your results. I'll post our results here as soon as we complete the > upgrade. > > -- > Guillaume > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings -- /This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete your copy from your system. Thank you for your cooperation./ Sven Geisler Tel +49.30.5362.1627 Fax .1638 Senior Developer, AEC/communications GmbH Berlin, Germany From pgsql-performance-owner@postgresql.org Thu Mar 16 09:41:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A2669DCC10 for ; Thu, 16 Mar 2006 09:41: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 13308-02 for ; Thu, 16 Mar 2006 09:41:53 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) by postgresql.org (Postfix) with ESMTP id 4858F9DCC25 for ; Thu, 16 Mar 2006 09:41:48 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so336306nzo for ; Thu, 16 Mar 2006 05:41:52 -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=kJEORg7tivYw1HbYHN+zM9zAV0yGpPr38EgwwzVMHRdKlR/CZ2Tvo2WcBxVcQqNXmnckxdg2XSY2pOXkHV3Pt/UI3EAVRam6qCCTOKVYP9GGlz6/zugKDas9c+E93QYEKisMsKEiKNn7ztK29TjesZpmpCRAfHq2xtrKMyyR7g8= Received: by 10.65.100.4 with SMTP id c4mr586676qbm; Thu, 16 Mar 2006 05:41:51 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 05:41:50 -0800 (PST) Message-ID: <1d4e0c10603160541w59e19034scd13a4e11a9b9c09@mail.gmail.com> Date: Thu, 16 Mar 2006 14:41:50 +0100 From: "Guillaume Smet" To: "Richard Huxton" Subject: Re: PostgreSQL and Xeon MP Cc: pgsql-performance@postgresql.org In-Reply-To: <4419605F.9000806@archonet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <4419605F.9000806@archonet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.229 required=5 tests=[AWL=0.229] X-Spam-Score: 0.229 X-Spam-Level: X-Archive-Number: 200603/236 X-Sequence-Number: 17673 On 3/16/06, Richard Huxton wrote: > Very strange. Sure. I can't find any logical explanation for that but it is the behaviour we have for more than a year now (the site was migrated from Oracle to PostgreSQL on january 2005). We check iostat, vmstat and so on without any hint on why we have this behaviour. > The client has just bought an Opteron to run on, I'm afraid. I might try > 8.1 on the Xeon but it'll just be to see what happens and that won't be > for a while. I don't think it will be an option for us so I will have more information next week. From pgsql-performance-owner@postgresql.org Thu Mar 16 10:17:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 488DF9DC9E7 for ; Thu, 16 Mar 2006 10: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 17374-09 for ; Thu, 16 Mar 2006 10:17:35 -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 B9E099DC9E6 for ; Thu, 16 Mar 2006 10:17:29 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so342606nzo for ; Thu, 16 Mar 2006 06:17:34 -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=c5FqWMjm1mnL4yHnxVpY5UNo1Pvo9sWltCQVmgRg4JO8vOvpeJNTr/9gT5bb1Fx6pXt0BnsNvyz0+VkAdpdhZnqnvwdb1Ftd1yTTFipzDUP5lhMRHG7beBDZ14CsClTx3WzIg++Tx4r2kjAgSBundIdn6IuMAou9qgfE/haj4NI= Received: by 10.65.151.6 with SMTP id d6mr416991qbo; Thu, 16 Mar 2006 06:17:32 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 06:17:32 -0800 (PST) Message-ID: <1d4e0c10603160617w5d5aadc7o553103694fc3ca08@mail.gmail.com> Date: Thu, 16 Mar 2006 15:17:32 +0100 From: "Guillaume Smet" To: "Sven Geisler" Subject: Re: PostgreSQL and Xeon MP Cc: "Richard Huxton" , pgsql-performance@postgresql.org In-Reply-To: <441963F4.1010607@aeccom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.211 required=5 tests=[AWL=0.211] X-Spam-Score: 0.211 X-Spam-Level: X-Archive-Number: 200603/237 X-Sequence-Number: 17674 Sven, On 3/16/06, Sven Geisler wrote: > What version of XEON MP does your server have? The server is a dell 6650 from end of 2004 with 4 xeon mp 2.2 and 2MB cache per proc. Here are the information from Dell: 4x PROCESSOR, 80532, 2.2GHZ, 2MB cache, 400Mhz, SOCKET F 8x DUAL IN-LINE MEMORY MODULE, 512MB, 266MHz > Do you use Hyperthreading? No, we don't use it. > You should provide details from the XEON DP? The only problem is that the Xeon DP is installed with a 2.6 kernel and a postgresql 8.1.3 (it is used to test the migration from 7.4 to 8.1.3). So it's very difficult to really compare the two behaviours. It's a Dell 2850 with: 2 x PROCESSOR, 80546K, 2.8G, 1MB cache, XEON NOCONA, 800MHz 4 x DUAL IN-LINE MEMORY MODULE, 1GB, 400MHz This server is obviously newer than the other one. -- Guillaume From pgsql-performance-owner@postgresql.org Thu Mar 16 10:30:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 238449DCBB0 for ; Thu, 16 Mar 2006 10:30: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 20605-04 for ; Thu, 16 Mar 2006 10:30:09 -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 548399DCC0D for ; Thu, 16 Mar 2006 10:30:03 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so344950nzo for ; Thu, 16 Mar 2006 06:30: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=tCsrujKc5qenmLtrll9+6OBWzcf3DqTqKQPDDpmXXuTldE0Xa5P7eaf+6R3PeQVxMsIZA7eknie39Uq2BpjMYCzTy1/n0B0qicvsPJe2Oigxb81k2sSc8OJQ1E8S43h9HZGZ9pGKRb7+qd4lO6iuv2hqElReF1ZSBkLbh04ta4E= Received: by 10.65.225.14 with SMTP id c14mr751085qbr; Thu, 16 Mar 2006 06:30:07 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 06:30:07 -0800 (PST) Message-ID: <1d4e0c10603160630g7fe945ffo1d723843407ed128@mail.gmail.com> Date: Thu, 16 Mar 2006 15:30:07 +0100 From: "Guillaume Smet" To: "Sven Geisler" Subject: Re: PostgreSQL and Xeon MP Cc: "Richard Huxton" , pgsql-performance@postgresql.org In-Reply-To: <441963F4.1010607@aeccom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.198 required=5 tests=[AWL=0.198] X-Spam-Score: 0.198 X-Spam-Level: X-Archive-Number: 200603/238 X-Sequence-Number: 17675 On 3/16/06, Sven Geisler wrote: > Hi Guillaume, > > I had a similar issue last summer. Could you please provide details > about your XEON MP server and some statistics (context-switches/load/CPU > usage)? I forgot the statistics: CPU load usually from 1 to 4. CPU usage < 40% for each processor usually and sometimes when the server completely hangs, it grows to 60%.., Here is a top output of the server at this time: 15:21:17 up 138 days, 13:25, 1 user, load average: 1.29, 1.25, 1.38 82 processes: 81 sleeping, 1 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 25.7% 0.0% 3.9% 0.0% 0.3% 0.1% 69.7% cpu00 29.3% 0.0% 4.7% 0.1% 0.5% 0.0% 65.0% cpu01 20.7% 0.0% 1.9% 0.0% 0.3% 0.0% 76.8% cpu02 25.5% 0.0% 5.5% 0.0% 0.1% 0.3% 68.2% cpu03 27.3% 0.0% 3.3% 0.0% 0.1% 0.1% 68.8% Mem: 3857224k av, 3298580k used, 558644k free, 0k shrd, 105172k bu= ff 2160124k actv, 701304k in_d, 56400k in_c Swap: 4281272k av, 6488k used, 4274784k free 2839348k ca= ched We have currently between 3000 and 13000 context switches/s, average of 5000 I'd say visually. Here is a top output I had on november 17 when the server completely hangs (several minutes for each page of the website) and it is typical of this server behaviour: 17:08:41 up 19 days, 15:16, 1 user, load average: 4.03, 4.26, 4.36 288 processes: 285 sleeping, 3 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 59.0% 0.0% 8.8% 0.2% 0.0% 0.0% 31.9% cpu00 52.3% 0.0% 13.3% 0.9% 0.0% 0.0% 33.3% cpu01 65.7% 0.0% 7.6% 0.0% 0.0% 0.0% 26.6% cpu02 58.0% 0.0% 7.6% 0.0% 0.0% 0.0% 34.2% cpu03 60.0% 0.0% 6.6% 0.0% 0.0% 0.0% 33.3% Mem: 3857224k av, 3495880k used, 361344k free, 0k shrd, 92160k bu= ff 2374048k actv, 463576k in_d, 37708k in_c Swap: 4281272k av, 25412k used, 4255860k free 2173392k ca= ched As you can see, load is blocked to 4, no iowait and cpu idle of 30%. Vmstat showed 5000 context switches/s on average so we had no context switch storm. From pgsql-performance-owner@postgresql.org Sat Mar 18 22:25:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6A7B49DCC46 for ; Thu, 16 Mar 2006 10: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 21190-03 for ; Thu, 16 Mar 2006 10:30:29 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 1F0769DCC19 for ; Thu, 16 Mar 2006 10:30:23 -0400 (AST) Received: from is.rice.edu (is.rice.edu [128.42.42.24]) by svr4.postgresql.org (Postfix) with ESMTP id 38E485AF085 for ; Thu, 16 Mar 2006 14:30:27 +0000 (GMT) Received: from scan2.mail.rice.edu (scan2.mail.rice.edu [128.42.59.161]) by is.rice.edu (Postfix) with ESMTP id C98174187A; Thu, 16 Mar 2006 08:30:24 -0600 (CST) Received: from is.rice.edu ([128.42.42.24]) by scan2.mail.rice.edu (scan2.mail.rice.edu [128.42.59.161]) (amavisd-new, port 10024) with ESMTP id 28823-01; Thu, 16 Mar 2006 08:30:21 -0600 (CST) Received: by is.rice.edu (Postfix, from userid 18612) id 219A5418A2; Thu, 16 Mar 2006 08:30:21 -0600 (CST) Date: Thu, 16 Mar 2006 08:30:20 -0600 From: Kenneth Marshall To: Guillaume Smet Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP Message-ID: <20060316143020.GW22830@it.is.rice.edu> References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> User-Agent: Mutt/1.4.2i X-Virus-Scanned: by amavis-2.2.1 at scan2.mail.rice.edu 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: 200603/310 X-Sequence-Number: 17747 On Thu, Mar 16, 2006 at 11:45:12AM +0100, Guillaume Smet wrote: > Hello, > > We are experiencing performances problem with a quad Xeon MP and > PostgreSQL 7.4 for a year now. Our context switch rate is not so high > but the load of the server is blocked to 4 even on very high load and > we have 60% cpu idle even in this case. Our database fits in RAM and > we don't have any IO problem. I saw this post from Tom Lane > http://archives.postgresql.org/pgsql-performance/2004-04/msg00249.php > and several other references to problem with Xeon MP and I suspect our > problems are related to this. > We tried to put our production load on a dual standard Xeon on monday > and it performs far better with the same configuration parameters. > > I know that work has been done by Tom for PostgreSQL 8.1 on > multiprocessor support but I didn't find any information on if it > solves the problem with Xeon MP or not. > > My question is should we expect a resolution of our problem by > switching to 8.1 or will we still have problems and should we consider > a hardware change? We will try to upgrade next tuesday so we will have > the real answer soon but if anyone has any experience or information > on this, he will be very welcome. > > Thanks for your help. > > -- > Guillaume > Guillaume, We had a similar problem with poor performance on a Xeon DP and PostgreSQL 7.4.x. 8.0 came out in time for preliminary testing but it did not solve the problem and our production systems went live using a different database product. We are currently testing against 8.1.x and the seemingly bizarre lack of performance is gone. I would suspect that a quad-processor box would have the same issue. I would definitely recommend giving 8.1 a try. Ken From pgsql-performance-owner@postgresql.org Thu Mar 16 11:20:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D4A109DC883 for ; Thu, 16 Mar 2006 11:20: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 28482-07 for ; Thu, 16 Mar 2006 11:20: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 00C6D9DC869 for ; Thu, 16 Mar 2006 11:20: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 k2GFK9PU016634; Thu, 16 Mar 2006 10:20:09 -0500 (EST) To: "Guillaume Smet" cc: "Sven Geisler" , "Richard Huxton" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP In-reply-to: <1d4e0c10603160630g7fe945ffo1d723843407ed128@mail.gmail.com> References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160630g7fe945ffo1d723843407ed128@mail.gmail.com> Comments: In-reply-to "Guillaume Smet" message dated "Thu, 16 Mar 2006 15:30:07 +0100" Date: Thu, 16 Mar 2006 10:20:09 -0500 Message-ID: <16633.1142522409@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/239 X-Sequence-Number: 17676 "Guillaume Smet" writes: > Here is a top output I had on november 17 when the server completely > hangs (several minutes for each page of the website) and it is typical > of this server behaviour: > 17:08:41 up 19 days, 15:16, 1 user, load average: 4.03, 4.26, 4.36 > 288 processes: 285 sleeping, 3 running, 0 zombie, 0 stopped > CPU states: cpu user nice system irq softirq iowait idle > total 59.0% 0.0% 8.8% 0.2% 0.0% 0.0% 31.9% > cpu00 52.3% 0.0% 13.3% 0.9% 0.0% 0.0% 33.3% > cpu01 65.7% 0.0% 7.6% 0.0% 0.0% 0.0% 26.6% > cpu02 58.0% 0.0% 7.6% 0.0% 0.0% 0.0% 34.2% > cpu03 60.0% 0.0% 6.6% 0.0% 0.0% 0.0% 33.3% > Mem: 3857224k av, 3495880k used, 361344k free, 0k shrd, 92160k buff > 2374048k actv, 463576k in_d, 37708k in_c > Swap: 4281272k av, 25412k used, 4255860k free 2173392k cached > As you can see, load is blocked to 4, no iowait and cpu idle of 30%. Can you try strace'ing some of the backend processes while the system is behaving like this? I suspect what you'll find is a whole lot of delaying select() calls due to high contention for spinlocks ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 16 11:20:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4A8B59DCB53 for ; Thu, 16 Mar 2006 11: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 29717-01 for ; Thu, 16 Mar 2006 11:20:36 -0400 (AST) X-Greylist: delayed 02:09:13.06468 by SQLgrey- Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de [83.236.156.26]) by postgresql.org (Postfix) with ESMTP id 6B9729DCA75 for ; Thu, 16 Mar 2006 11:20:29 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aeccom.com (Postfix) with ESMTP id 21EF41C0D4; Thu, 16 Mar 2006 16:20:34 +0100 (CET) Received: from mail.aeccom.com ([127.0.0.1]) by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20943-02-5; Thu, 16 Mar 2006 16:20:33 +0100 (CET) Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) by mail.aeccom.com (Postfix) with ESMTP id 2F2471C0D0; Thu, 16 Mar 2006 16:20:33 +0100 (CET) Message-ID: <4419823F.6060205@aeccom.com> Date: Thu, 16 Mar 2006 16:20:31 +0100 From: Sven Geisler Organization: AEC/communications GmbH User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Guillaume Smet CC: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160617w5d5aadc7o553103694fc3ca08@mail.gmail.com> In-Reply-To: <1d4e0c10603160617w5d5aadc7o553103694fc3ca08@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at aeccom.com 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: 200603/240 X-Sequence-Number: 17677 Hi Guillaume, Guillaume Smet schrieb: > > The server is a dell 6650 from end of 2004 with 4 xeon mp 2.2 and 2MB > cache per proc. > > Here are the information from Dell: > 4x PROCESSOR, 80532, 2.2GHZ, 2MB cache, 400Mhz, SOCKET F > 8x DUAL IN-LINE MEMORY MODULE, 512MB, 266MHz > .... > >> You should provide details from the XEON DP? > > The only problem is that the Xeon DP is installed with a 2.6 kernel > and a postgresql 8.1.3 (it is used to test the migration from 7.4 to > 8.1.3). So it's very difficult to really compare the two behaviours. > > It's a Dell 2850 with: > 2 x PROCESSOR, 80546K, 2.8G, 1MB cache, XEON NOCONA, 800MHz > 4 x DUAL IN-LINE MEMORY MODULE, 1GB, 400MHz > Did you compare 7.4 on a 4-way with 8.1 on a 2-way? How many queries and clients did you use to test the performance? How much faster is the XEON DP? I think, you can expect that your XEON DP is faster on a single query because CPU and RAM are faster. The overall performance can be better on your XEON DP if you only have a few clients. I guess, the newer hardware and the newer PostgreSQL version cause the better performance. Regards Sven. From pgsql-performance-owner@postgresql.org Thu Mar 16 11:56:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4770F9DCC19 for ; Thu, 16 Mar 2006 11:56: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 35963-03 for ; Thu, 16 Mar 2006 11:57: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 2A0E29DCC64 for ; Thu, 16 Mar 2006 11:56: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 k2GFv1fA017044; Thu, 16 Mar 2006 10:57:01 -0500 (EST) To: Simon Riggs cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer Subject: Re: BETWEEN optimizer problems with single-value In-reply-to: <1142510032.3859.320.camel@localhost.localdomain> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> <11428.1142474724@sss.pgh.pa.us> <1142510032.3859.320.camel@localhost.localdomain> Comments: In-reply-to Simon Riggs message dated "Thu, 16 Mar 2006 11:53:52 +0000" Date: Thu, 16 Mar 2006 10:57:01 -0500 Message-ID: <17043.1142524621@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/241 X-Sequence-Number: 17678 Simon Riggs writes: > Trying to get the information in the wrong place would be very > expensive, I agree. But preparing that information when we have access > to it and passing it through the plan would be much cheaper. Where would that be? > The operator and the opclass are only connected via an index access > method, but for a particular index each column has only one opclass. If you're proposing making clauselist_selectivity depend on what indexes exist, I think that's very much the wrong approach. In the first place, it still has to give usable answers for unindexed columns, and in the second place there might be multiple indexes with different opclasses for the same column, so the ambiguity problem still exists. I have been wondering if we shouldn't add some more indexes on pg_amop or something to make it easier to do this sort of lookup --- we definitely seem to be finding multiple reasons to want to look up which opclasses contain a given operator. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 16 12:05:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7AE5F9DC854 for ; Thu, 16 Mar 2006 12:05: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 38527-01 for ; Thu, 16 Mar 2006 12:05:40 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.192]) by postgresql.org (Postfix) with ESMTP id CDEE69DC849 for ; Thu, 16 Mar 2006 12:05:39 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so364040nzo for ; Thu, 16 Mar 2006 08:05:39 -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=Sjq9ZxudZlDSftyAb2ToQULX2wMhDA2TNyrROb6snyCw4X56cAMqVr3zCrn2NcNgx0crmibV8jAZ/iXc4xHgNaeUlP940zlBSKh/u6HSSC9B5yxX9bZtR2pBnaWZ3gpLhG8IqQHjyurHzlvpq+0z6DqAxqiivcsWPP62lgsEv+A= Received: by 10.64.27.20 with SMTP id a20mr1216262qba; Thu, 16 Mar 2006 08:05:38 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 08:05:38 -0800 (PST) Message-ID: <1d4e0c10603160805n6d727a94ic2ab0ed0bcf56c1a@mail.gmail.com> Date: Thu, 16 Mar 2006 17:05:38 +0100 From: "Guillaume Smet" To: "Sven Geisler" Subject: Re: PostgreSQL and Xeon MP Cc: pgsql-performance@postgresql.org In-Reply-To: <4419823F.6060205@aeccom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160617w5d5aadc7o553103694fc3ca08@mail.gmail.com> <4419823F.6060205@aeccom.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.188 required=5 tests=[AWL=0.188] X-Spam-Score: 0.188 X-Spam-Level: X-Archive-Number: 200603/242 X-Sequence-Number: 17679 On 3/16/06, Sven Geisler wrote: > Did you compare 7.4 on a 4-way with 8.1 on a 2-way? I know there are too many parameters changing between the two servers but I can't really change anything before tuesday. On tuesday, we will be able to compare both servers with the same software. > How many queries and clients did you use to test the performance? Googlebot is indexing this site generating 2-3 mbits/s of traffic so we use the googlebot to stress this server. There was a lot of clients and a lot of queries. > How much faster is the XEON DP? Well, on high load, PostgreSQL scales well on the DP (load at 40, queries slower but still performing well) and is awfully slow on the MP box. From pgsql-performance-owner@postgresql.org Thu Mar 16 12:08:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0C1C09DC800 for ; Thu, 16 Mar 2006 12:08: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 37691-05 for ; Thu, 16 Mar 2006 12:08:48 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by postgresql.org (Postfix) with ESMTP id BB7FA9DC849 for ; Thu, 16 Mar 2006 12:08:47 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so364777nzo for ; Thu, 16 Mar 2006 08:08: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=SEYZZLgFQ2fpaL12IGtrwCUeAIg7j66+PQBdohmVyXUjWxBNWcYZt7EQcju025xvAZKani0GjtauKTiS8Ywf5J1XFdC+K/Mj/mh+ruHOlcXZauTeyDgKCZWZ0Fr/cP/wpmECkN3QC5gmtV4W6GDUafv5zjtdFtQsHDE3jk6VYWU= Received: by 10.64.27.10 with SMTP id a10mr290413qba; Thu, 16 Mar 2006 08:08:46 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 08:08:46 -0800 (PST) Message-ID: <1d4e0c10603160808y6c2f683csb74086b10c3cd40e@mail.gmail.com> Date: Thu, 16 Mar 2006 17:08:46 +0100 From: "Guillaume Smet" To: "Tom Lane" Subject: Re: PostgreSQL and Xeon MP Cc: "Sven Geisler" , "Richard Huxton" , pgsql-performance@postgresql.org In-Reply-To: <16633.1142522409@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: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160630g7fe945ffo1d723843407ed128@mail.gmail.com> <16633.1142522409@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.18 required=5 tests=[AWL=0.180] X-Spam-Score: 0.18 X-Spam-Level: X-Archive-Number: 200603/243 X-Sequence-Number: 17680 On 3/16/06, Tom Lane wrote: > Can you try strace'ing some of the backend processes while the system is > behaving like this? I suspect what you'll find is a whole lot of > delaying select() calls due to high contention for spinlocks ... Tom, I think we can try to do it. You mean strace -p pid with pid on some of the postgres process not on the postmaster itself, does you? Do we need other options? Which pattern should we expect? I'm not really familiar with strace and its output. Thanks for your help. From pgsql-performance-owner@postgresql.org Thu Mar 16 12:35:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 63F069DC800 for ; Thu, 16 Mar 2006 12:35: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 43903-03-2 for ; Thu, 16 Mar 2006 12:35: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 EC1379DCC19 for ; Thu, 16 Mar 2006 12:35:12 -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 k2GGYw1D017484; Thu, 16 Mar 2006 11:34:58 -0500 (EST) To: "Guillaume Smet" cc: "Sven Geisler" , "Richard Huxton" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP In-reply-to: <1d4e0c10603160808y6c2f683csb74086b10c3cd40e@mail.gmail.com> References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160630g7fe945ffo1d723843407ed128@mail.gmail.com> <16633.1142522409@sss.pgh.pa.us> <1d4e0c10603160808y6c2f683csb74086b10c3cd40e@mail.gmail.com> Comments: In-reply-to "Guillaume Smet" message dated "Thu, 16 Mar 2006 17:08:46 +0100" Date: Thu, 16 Mar 2006 11:34:58 -0500 Message-ID: <17483.1142526898@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/244 X-Sequence-Number: 17681 "Guillaume Smet" writes: > You mean strace -p pid with pid on some of the postgres process not on > the postmaster itself, does you? Right, pick a couple that are accumulating CPU time. > Do we need other options? strace will generate a *whole lot* of output to stderr. I usually do something like strace -p pid 2>outfile and then control-C it after a few seconds. > Which pattern should we expect? What we want to find out is if there's a lot of select()s and/or semop()s shown in the result. Ideally there wouldn't be any, but I fear that's not what you'll find. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 16 12:37:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 307DE9DC854 for ; Thu, 16 Mar 2006 12:37: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 45343-01 for ; Thu, 16 Mar 2006 12:36:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de [83.236.156.26]) by postgresql.org (Postfix) with ESMTP id 7224F9DCA44 for ; Thu, 16 Mar 2006 12:36:57 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aeccom.com (Postfix) with ESMTP id 0BC731C1CA; Thu, 16 Mar 2006 17:36:55 +0100 (CET) Received: from mail.aeccom.com ([127.0.0.1]) by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 21532-02-5; Thu, 16 Mar 2006 17:36:54 +0100 (CET) Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) by mail.aeccom.com (Postfix) with ESMTP id 384E41C118; Thu, 16 Mar 2006 17:36:54 +0100 (CET) Message-ID: <44199424.1080107@aeccom.com> Date: Thu, 16 Mar 2006 17:36:52 +0100 From: Sven Geisler Organization: AEC/communications GmbH User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Guillaume Smet CC: pgsql-performance@postgresql.org Subject: Re: PostgreSQL and Xeon MP References: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160617w5d5aadc7o553103694fc3ca08@mail.gmail.com> <4419823F.6060205@aeccom.com> <1d4e0c10603160805n6d727a94ic2ab0ed0bcf56c1a@mail.gmail.com> In-Reply-To: <1d4e0c10603160805n6d727a94ic2ab0ed0bcf56c1a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at aeccom.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.137 required=5 tests=[AWL=0.137] X-Spam-Score: 0.137 X-Spam-Level: X-Archive-Number: 200603/245 X-Sequence-Number: 17682 Hi Guillaume, Guillaume Smet schrieb: >> How much faster is the XEON DP? > > Well, on high load, PostgreSQL scales well on the DP (load at 40, > queries slower but still performing well) and is awfully slow on the > MP box. I know what you mean with awfully slow. I think, your application is facing contention. The contention becomes larger as more CPU you have. PostgreSQL 8.1 is addressing contention on multiprocessor servers as you mentioned before. I guess, you will see that your 4-way XEON MP isn't that bad if you compare both servers with the same PostgreSQL version. Regards Sven. From pgsql-performance-owner@postgresql.org Thu Mar 16 13:53:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 762029DCB70 for ; Thu, 16 Mar 2006 13:53: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 61195-09 for ; Thu, 16 Mar 2006 13:53:14 -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 D96699DC9A7 for ; Thu, 16 Mar 2006 13:53:12 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so384828nzo for ; Thu, 16 Mar 2006 09:53:13 -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=biEwtTfp0x3H3pzAC46/iBW6q5eosx5YQoPBQBlBaIM/A5GvzB1rtlGa3++LDpMoY5PNRyuV3XaoTuURenBo1qGd0iEHgv6N6u1axLe/7GCF2PEIzAFkwmloUq4pZPHpGCJXBWWprLXUTztM5SNDUkSPc6Q9eDPfx1jwD0Ikytk= Received: by 10.65.222.3 with SMTP id z3mr1354501qbq; Thu, 16 Mar 2006 09:53:12 -0800 (PST) Received: by 10.65.123.12 with HTTP; Thu, 16 Mar 2006 09:53:12 -0800 (PST) Message-ID: <1d4e0c10603160953w6fc36b74oc3c3dc58681578e6@mail.gmail.com> Date: Thu, 16 Mar 2006 18:53:12 +0100 From: "Guillaume Smet" To: "Tom Lane" Subject: Re: PostgreSQL and Xeon MP Cc: "Sven Geisler" , "Richard Huxton" , pgsql-performance@postgresql.org In-Reply-To: <17483.1142526898@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: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160630g7fe945ffo1d723843407ed128@mail.gmail.com> <16633.1142522409@sss.pgh.pa.us> <1d4e0c10603160808y6c2f683csb74086b10c3cd40e@mail.gmail.com> <17483.1142526898@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.174 required=5 tests=[AWL=0.174] X-Spam-Score: 0.174 X-Spam-Level: X-Archive-Number: 200603/246 X-Sequence-Number: 17683 On 3/16/06, Tom Lane wrote: > What we want to find out is if there's a lot of select()s and/or > semop()s shown in the result. Ideally there wouldn't be any, but > I fear that's not what you'll find. OK, I'll try to do it on monday before our upgrade then see what happens with PostgreSQL 8.1.3. Thanks for your help. From pgsql-performance-owner@postgresql.org Thu Mar 16 14:15:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B91DC9DCAD8 for ; Thu, 16 Mar 2006 14:15: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 71297-02 for ; Thu, 16 Mar 2006 14:15:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) by postgresql.org (Postfix) with ESMTP id 825289DC995 for ; Thu, 16 Mar 2006 14:15:29 -0400 (AST) Received: from [192.168.0.250] (helo=deepcore.i-free.ru) by office1.i-free.ru with smtp (Exim 3.36 #1 (Debian)) id 1FJx0L-0007Vg-00; Thu, 16 Mar 2006 21:15:21 +0300 Date: Thu, 16 Mar 2006 21:15:23 +0300 From: Evgeny Gridasov To: "Kevin Grittner" Cc: pgsql-performance@postgresql.org Subject: Re: Background writer configuration Message-Id: <20060316211523.73343cee.eugrid@fpm.kubsu.ru> In-Reply-To: <44181A11.EE98.0025.0@wicourts.gov> References: <44181A11.EE98.0025.0@wicourts.gov> X-Mailer: Sylpheed version 2.2.3 (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.093 required=5 tests=[AWL=0.093] X-Spam-Score: 0.093 X-Spam-Level: X-Archive-Number: 200603/247 X-Sequence-Number: 17684 Kevin, please, could you post other settings from your postgresql.conf? interested in: bgwriter_delay shared_buffers checkpoint_segments checkpoint_timeout wal_buffers On Wed, 15 Mar 2006 13:43:45 -0600 "Kevin Grittner" wrote: > We were seeing clusters of query timeouts with our web site, which were > corrected by adjusting the configuration of the background writer. I'm > posting just to provide information which others might find useful -- I > don't have any problem I'm trying to solve in this regard. > -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Thu Mar 16 14:33:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 042F79DC810 for ; Thu, 16 Mar 2006 14: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 73403-10 for ; Thu, 16 Mar 2006 14:33:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 87D3C9DC854 for ; Thu, 16 Mar 2006 14:33:28 -0400 (AST) Received: from [192.168.42.113] (natpool.bovine.net [67.100.216.14]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by noel.decibel.org (Postfix) with ESMTP id 0C29A56408 for ; Thu, 16 Mar 2006 12:33:29 -0600 (CST) Mime-Version: 1.0 (Apple Message framework v746.3) Content-Transfer-Encoding: 7bit Message-Id: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Jim Nasby Subject: 1 TB of memory Date: Thu, 16 Mar 2006 12:33:28 -0600 X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/248 X-Sequence-Number: 17685 PostgreSQL tuned to the max and still too slow? Database too big to fit into memory? Here's the solution! http://www.superssd.com/ products/tera-ramsan/ Anyone purchasing one will be expected to post benchmarks! :) -- 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 Thu Mar 16 14:41:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E34499DC9EB for ; Thu, 16 Mar 2006 14:41: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 77293-04-7 for ; Thu, 16 Mar 2006 14:41: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 0EF6E9DCB71 for ; Thu, 16 Mar 2006 14:41:02 -0400 (AST) Received: from [192.168.1.55] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id k2GIRknF022233; Thu, 16 Mar 2006 10:27:46 -0800 Message-ID: <4419B223.6000505@commandprompt.com> Date: Thu, 16 Mar 2006 10:44:51 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Jim Nasby CC: pgsql-performance@postgresql.org Subject: Re: 1 TB of memory References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> In-Reply-To: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.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]); Thu, 16 Mar 2006 10:27:46 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.13 required=5 tests=[AWL=0.130] X-Spam-Score: 0.13 X-Spam-Level: X-Archive-Number: 200603/249 X-Sequence-Number: 17686 Jim Nasby wrote: > PostgreSQL tuned to the max and still too slow? Database too big to > fit into memory? Here's the solution! > http://www.superssd.com/products/tera-ramsan/ > > Anyone purchasing one will be expected to post benchmarks! :) And give us one :) > -- > 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 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Thu Mar 16 15:28:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 511689DC810 for ; Thu, 16 Mar 2006 15:28: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 86666-03 for ; Thu, 16 Mar 2006 15:28:31 -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 E93829DC854 for ; Thu, 16 Mar 2006 15:28:28 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 22F8E35BF2C; Thu, 16 Mar 2006 19:28:25 +0000 (GMT) Subject: Re: BETWEEN optimizer problems with single-value From: Simon Riggs To: Tom Lane Cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer In-Reply-To: <17043.1142524621@sss.pgh.pa.us> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> <11428.1142474724@sss.pgh.pa.us> <1142510032.3859.320.camel@localhost.localdomain> <17043.1142524621@sss.pgh.pa.us> Content-Type: text/plain Date: Thu, 16 Mar 2006 19:28:18 +0000 Message-Id: <1142537298.3859.497.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.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200603/250 X-Sequence-Number: 17687 On Thu, 2006-03-16 at 10:57 -0500, Tom Lane wrote: > Simon Riggs writes: > > Trying to get the information in the wrong place would be very > > expensive, I agree. But preparing that information when we have access > > to it and passing it through the plan would be much cheaper. > > Where would that be? > > > The operator and the opclass are only connected via an index access > > method, but for a particular index each column has only one opclass. > > If you're proposing making clauselist_selectivity depend on what indexes > exist, I think that's very much the wrong approach. Using available information sounds OK to me. Guess you're thinking of the lack of plan invalidation? > In the first place, > it still has to give usable answers for unindexed columns, and in the > second place there might be multiple indexes with different opclasses > for the same column, so the ambiguity problem still exists. I was thinking that we would fill out the OpExpr with different opclasses for each plan, so each one sees a different story. (I was thinking there was a clauselist for each plan; if not, there could be.) So the multiple index problem shouldn't exist. Non-indexed cases still cause the problem, true. > I have been wondering if we shouldn't add some more indexes on pg_amop > or something to make it easier to do this sort of lookup --- we > definitely seem to be finding multiple reasons to want to look up > which opclasses contain a given operator. Agreed, but still looking for better way than that. [BTW how do you add new indexes to system tables? I want to add one to pg_inherits but not sure where to look.] Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Thu Mar 16 15:41:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 875609DCC7D for ; Thu, 16 Mar 2006 15:41: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 90385-08 for ; Thu, 16 Mar 2006 15:41:54 -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 1D2FA9DC943 for ; Thu, 16 Mar 2006 15:41:51 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 16 Mar 2006 15:41:52 -0400 X-IronPort-AV: i="4.02,198,1139194800"; d="scan'208"; a="36920855:sNHT18343764" Received: from alvh.no-ip.org (201.220.123.157) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00AA87E7; Thu, 16 Mar 2006 15:41:52 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 25046C3A2DC; Thu, 16 Mar 2006 15:41:52 -0400 (CLT) Date: Thu, 16 Mar 2006 15:41:52 -0400 From: Alvaro Herrera To: Simon Riggs Cc: Tom Lane , Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer Subject: Re: BETWEEN optimizer problems with single-value Message-ID: <20060316194151.GC17534@surnet.cl> Mail-Followup-To: Simon Riggs , Tom Lane , Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> <11428.1142474724@sss.pgh.pa.us> <1142510032.3859.320.camel@localhost.localdomain> <17043.1142524621@sss.pgh.pa.us> <1142537298.3859.497.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1142537298.3859.497.camel@localhost.localdomain> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.704 required=5 tests=[AWL=-0.215, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.704 X-Spam-Level: * X-Archive-Number: 200603/251 X-Sequence-Number: 17688 Simon Riggs wrote: > [BTW how do you add new indexes to system tables? I want to add one to > pg_inherits but not sure where to look.] See src/include/catalog/indexing.h -- I don't remember if there's anything else that needs modification. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Thu Mar 16 15:43:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2F6189DCC19 for ; Thu, 16 Mar 2006 15:43: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 90830-05 for ; Thu, 16 Mar 2006 15:43: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 5B7C19DCC07 for ; Thu, 16 Mar 2006 15:43:32 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 40D523348C0; Thu, 16 Mar 2006 19:43:27 +0000 (GMT) Subject: Re: BETWEEN optimizer problems with single-value From: Simon Riggs To: Alvaro Herrera Cc: Tom Lane , Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer In-Reply-To: <20060316194151.GC17534@surnet.cl> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> <11428.1142474724@sss.pgh.pa.us> <1142510032.3859.320.camel@localhost.localdomain> <17043.1142524621@sss.pgh.pa.us> <1142537298.3859.497.camel@localhost.localdomain> <20060316194151.GC17534@surnet.cl> Content-Type: text/plain Date: Thu, 16 Mar 2006 19:43:22 +0000 Message-Id: <1142538202.3859.513.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.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/252 X-Sequence-Number: 17689 On Thu, 2006-03-16 at 15:41 -0400, Alvaro Herrera wrote: > Simon Riggs wrote: > > > [BTW how do you add new indexes to system tables? I want to add one to > > pg_inherits but not sure where to look.] > > See src/include/catalog/indexing.h -- I don't remember if there's > anything else that needs modification. That was easy: many thanks! Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Thu Mar 16 15:45:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 90BE59DCC99 for ; Thu, 16 Mar 2006 15:45: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 91694-03 for ; Thu, 16 Mar 2006 15:45: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 16B719DCBD9 for ; Thu, 16 Mar 2006 15:45: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 k2GJjYwa019305; Thu, 16 Mar 2006 14:45:35 -0500 (EST) To: Simon Riggs cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer Subject: Re: BETWEEN optimizer problems with single-value In-reply-to: <1142537298.3859.497.camel@localhost.localdomain> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> <11428.1142474724@sss.pgh.pa.us> <1142510032.3859.320.camel@localhost.localdomain> <17043.1142524621@sss.pgh.pa.us> <1142537298.3859.497.camel@localhost.localdomain> Comments: In-reply-to Simon Riggs message dated "Thu, 16 Mar 2006 19:28:18 +0000" Date: Thu, 16 Mar 2006 14:45:34 -0500 Message-ID: <19304.1142538334@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/253 X-Sequence-Number: 17690 Simon Riggs writes: > I was thinking that we would fill out the OpExpr with different > opclasses for each plan, so each one sees a different story. (I was > thinking there was a clauselist for each plan; if not, there could be.) This is backwards: there isn't a plan yet. If there were, having clauselist_selectivity return different answers depending on what index the plan was thinking of using would still be wrong. > [BTW how do you add new indexes to system tables? I want to add one to > pg_inherits but not sure where to look.] src/include/catalog/indexing.h Offhand I think adding a new entry is all you have to do. You may also want a syscache to go with it, which'll take a bit more work. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 16 16:00:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3167A9DC854 for ; Thu, 16 Mar 2006 16:00: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 95695-01 for ; Thu, 16 Mar 2006 16:00:35 -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 076D59DC840 for ; Thu, 16 Mar 2006 16:00:32 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id D495A33723C; Thu, 16 Mar 2006 20:00:29 +0000 (GMT) Subject: Re: BETWEEN optimizer problems with single-value From: Simon Riggs To: Tom Lane Cc: Kevin Grittner , pgsql-performance@postgresql.org, Andreas Kretschmer In-Reply-To: <19304.1142538334@sss.pgh.pa.us> References: <44180105.EE98.0025.0@wicourts.gov> <20060315181735.GA22240@KanotixBox> <44180D33.EE98.0025.0@wicourts.gov> <28798.1142450270@sss.pgh.pa.us> <1142467626.3859.207.camel@localhost.localdomain> <1142468678.3859.221.camel@localhost.localdomain> <11428.1142474724@sss.pgh.pa.us> <1142510032.3859.320.camel@localhost.localdomain> <17043.1142524621@sss.pgh.pa.us> <1142537298.3859.497.camel@localhost.localdomain> <19304.1142538334@sss.pgh.pa.us> Content-Type: text/plain Date: Thu, 16 Mar 2006 20:00:19 +0000 Message-Id: <1142539219.3859.517.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.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/254 X-Sequence-Number: 17691 On Thu, 2006-03-16 at 14:45 -0500, Tom Lane wrote: > Simon Riggs writes: > > [BTW how do you add new indexes to system tables? I want to add one to > > pg_inherits but not sure where to look.] > > src/include/catalog/indexing.h > > Offhand I think adding a new entry is all you have to do. You may also > want a syscache to go with it, which'll take a bit more work. I see its actually postgres.bki... I never scrolled to the bottom before now. I'll have a go. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Thu Mar 16 16:36:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0000D9DCDC2 for ; Thu, 16 Mar 2006 16:36: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 10661-08 for ; Thu, 16 Mar 2006 16:36:02 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id E90B19DCDB1 for ; Thu, 16 Mar 2006 16:35:59 -0400 (AST) Received: from mx1.vodamail.co.za (mx1.vodamail.co.za [196.11.146.148]) by svr4.postgresql.org (Postfix) with ESMTP id 577735AF95D for ; Thu, 16 Mar 2006 20:36:00 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mx1.vodamail.co.za (Postfix) with ESMTP id CBCE149E49; Thu, 16 Mar 2006 22:35:54 +0200 (SAST) Received: from mx1.vodamail.co.za ([127.0.0.1]) by localhost (mx1.vodamail.co.za [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13872-01; Thu, 16 Mar 2006 22:35:53 +0200 (SAST) Received: from josh.flame2.flame.co.za (unknown [10.48.30.20]) by mx1.vodamail.co.za (Postfix) with ESMTP id CB63B49D29; Thu, 16 Mar 2006 22:35:43 +0200 (SAST) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by josh.flame2.flame.co.za (8.12.11/8.12.11) with ESMTP id k2GKYp6O003314; Thu, 16 Mar 2006 22:35:31 +0200 Subject: Indexes with descending date columns From: Theo Kramer Reply-To: theo@flame.co.za To: pgsql-performance@postgresql.org Content-Type: text/plain Organization: Flame Computing Enterprises cc Message-Id: <1142541290.2812.45.camel@josh> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 16 Mar 2006 22:34:51 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at vodamail.co.za 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: 200603/255 X-Sequence-Number: 17692 Hi I have a performance problem when traversing a table in index order with multiple columns including a date column in date reverse order. Below follows a simplified description of the table, the index and the associated query \d prcdedit prcdedit_prcd | character(20) | prcdedit_date | timestamp without time zone | Indexes: "prcdedit_idx" btree (prcdedit_prcd, prcdedit_date) When invoking a query such as select oid, prcdedit_prcd, prcdedit_date, 'dd/mm/yyyy hh24:mi:ss') as mydate where prcdedit_prcd > 'somevalue' order by prcdedit_prcd, prcdedit_date desc; the peformance is dismal. However removing the 'desc' qualifier as follows the query flys select oid, prcdedit_prcd, prcdedit_date, 'dd/mm/yyyy hh24:mi:ss') as mydate where prcdedit_prcd > 'somevalue' order by prcdedit_prcd, prcdedit_date; PostgreSQL Version = 8.1.2 Row count on the table is > 300000 Explain is as follows for desc Limit (cost=81486.35..81486.41 rows=25 width=230) (actual time=116619.652..116619.861 rows=25 loops=1) -> Sort (cost=81486.35..82411.34 rows=369997 width=230) (actual time=116619.646..116619.729 rows=25 loops=1) Sort Key: prcdedit_prcd, prcdedit_date, oid -> Bitmap Heap Scan on prcdedit (cost=4645.99..23454.94 rows=369997 width=230) (actual time=376.952..11798.834 rows=369630 loops=1) Recheck Cond: (prcdedit_prcd > '063266 '::bpchar) -> Bitmap Index Scan on prcdedit_idx (cost=0.00..4645.99 rows=369997 width=0) (actual time=366.048..366.048 rows=369630 loops=1) Index Cond: (prcdedit_prcd > '063266 '::bpchar) Total runtime: 116950.175 ms and as follows when I remove the 'desc' Limit (cost=0.00..2.34 rows=25 width=230) (actual time=0.082..0.535 rows=25 loops=1) -> Index Scan using prcdedit_idx on prcdedit (cost=0.00..34664.63 rows=369997 width=230) (actual time=0.075..0.405 rows=25 loops=1) Index Cond: (prcdedit_prcd > '063266 '::bpchar) Total runtime: 0.664 ms Any assistance/advice much appreciated. -- Regards Theo From pgsql-performance-owner@postgresql.org Thu Mar 16 16:42:00 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8822E9DCCA4 for ; Thu, 16 Mar 2006 16:41: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 12319-04 for ; Thu, 16 Mar 2006 16:41:59 -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 D44FB9DCC92 for ; Thu, 16 Mar 2006 16:41:55 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=eg5lg0cUJho3z9dRPl1TKCUyX1Cr+DFRJWISB2DbBRZhJV+Gob1DfXffEGW6xZib; h=Received:Message-ID:Date:From:Reply-To:To:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:X-ELNK-Trace:X-Originating-IP; Received: from [209.86.224.36] (helo=elwamui-hybrid.atl.sa.earthlink.net) by elasmtp-kukur.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1FJzIA-0004GY-DY; Thu, 16 Mar 2006 15:41:54 -0500 Message-ID: <31340165.1142541714303.JavaMail.root@elwamui-hybrid.atl.sa.earthlink.net> Date: Thu, 16 Mar 2006 15:41:54 -0500 (EST) From: Ron Peacetree Reply-To: Ron Peacetree To: Jim Nasby , pgsql-performance@postgresql.org Subject: Re: 1 TB of memory Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: EarthLink Zoo Mail 1.0 X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc7a10d64eb189336022e297989df5de45350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 209.86.224.36 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: 200603/256 X-Sequence-Number: 17693 The US Dept of Homeland Security has at least two =10=TB SSDs. Rumor is they are being used for Carnivore or an offshoot/descendent of Carnivore. Good luck getting them to give you benchmark data. You need >deep< pockets to afford >= 1TB of SSD. (...and as the example shows, perhaps more money than sense.) Ron -----Original Message----- >From: Jim Nasby >Sent: Mar 16, 2006 1:33 PM >To: pgsql-performance@postgresql.org >Subject: [PERFORM] 1 TB of memory > >PostgreSQL tuned to the max and still too slow? Database too big to >fit into memory? Here's the solution! http://www.superssd.com/ >products/tera-ramsan/ > >Anyone purchasing one will be expected to post benchmarks! :) >-- >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 > > > >---------------------------(end of broadcast)--------------------------- >TIP 6: explain analyze is your friend From pgsql-performance-owner@postgresql.org Thu Mar 16 16:46:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B31C69DCA79 for ; Thu, 16 Mar 2006 16:46: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 13153-04 for ; Thu, 16 Mar 2006 16:46:29 -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 AE5049DCA18 for ; Thu, 16 Mar 2006 16:46:25 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i30so338624wxd for ; Thu, 16 Mar 2006 12:46:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WkoqE7fpulKg5q80RtjjNNC/6hgYRW2pWvwXuCSuRhadmz78PUfM0fCioF8FQb6fo4ppap33w9jXJ4pjWDEYsXWk6kU9S6BvLGgN3nwOehSlxrHFzlQIfN06kRObcCp2AzS9EHf0QryP95TO1I7/DNAkt7Ow6LOlmeqKDHQw3jw= Received: by 10.70.77.6 with SMTP id z6mr2593883wxa; Thu, 16 Mar 2006 12:46:26 -0800 (PST) Received: by 10.70.128.2 with HTTP; Thu, 16 Mar 2006 12:46:26 -0800 (PST) Message-ID: Date: Thu, 16 Mar 2006 14:46:26 -0600 From: "Matthew Nuzum" Reply-To: newz@bearfruit.org To: pgsql-performance@postgresql.org Subject: Re: 1 TB of memory In-Reply-To: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.15 required=5 tests=[AWL=0.150] X-Spam-Score: 0.15 X-Spam-Level: X-Archive-Number: 200603/257 X-Sequence-Number: 17694 On 3/16/06, Jim Nasby wrote: > PostgreSQL tuned to the max and still too slow? Database too big to > fit into memory? Here's the solution! http://www.superssd.com/ > products/tera-ramsan/ > > Anyone purchasing one will be expected to post benchmarks! :) Pricing is tight-lipped, but searching shows $1.85 /GB. That's close to $500,000 for 250GB. One report says a person paid $219,000 for 32GB and 1TB costs "well over $1,000,000." But they "guarantee the performance." Too rich for me. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Thu Mar 16 17:40:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 161E09DC840 for ; Thu, 16 Mar 2006 17:40: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 24374-04 for ; Thu, 16 Mar 2006 17:40:39 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id BEB869DC837 for ; Thu, 16 Mar 2006 17:40:35 -0400 (AST) Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by svr4.postgresql.org (Postfix) with ESMTP id 40FEB5AF904 for ; Thu, 16 Mar 2006 21:40:38 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id A1F3E64437C for ; Thu, 16 Mar 2006 14:40:35 -0700 (MST) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23614-02 for ; Thu, 16 Mar 2006 14:40:32 -0700 (MST) Received: from [192.168.1.100] (c-67-165-220-189.hsd1.co.comcast.net [67.165.220.189]) by crestone.coronasolutions.com (Postfix) with ESMTP id 84977644365 for ; Thu, 16 Mar 2006 14:40:32 -0700 (MST) Message-ID: <4419DB50.10404@drivefaster.net> Date: Thu, 16 Mar 2006 14:40:32 -0700 From: Dan Harris User-Agent: Thunderbird 1.5 (Macintosh/20060122) MIME-Version: 1.0 To: PostgreSQL Performance Subject: Help optimizing a slow index scan Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.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: 200603/258 X-Sequence-Number: 17695 explain analyze select distinct eventmain.incidentid, eventmain.entrydate, eventgeo.long, eventgeo.lat, eventgeo.geox, eventgeo.geoy from eventmain, eventgeo where eventmain.incidentid = eventgeo.incidentid and ( long > -104.998027962962 and long < -104.985957781349 ) and ( lat > 39.7075542720006 and lat < 39.7186195832938 ) and eventmain.entrydate > '2006-1-1 00:00' and eventmain.entrydate <= '2006-3-17 00:00' order by eventmain.entrydate; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (cost=121313.81..121330.72 rows=451 width=178) (actual time=723719.761..723726.875 rows=1408 loops=1) -> Sort (cost=121313.81..121314.94 rows=451 width=178) (actual time=723719.755..723721.807 rows=1408 loops=1) Sort Key: eventmain.entrydate, eventmain.disposition, eventmain.incidentid, eventgeo.reportingarea, eventgeo.beatid, eventmain.finaltype, eventmain.casenumber, eventgeo.eventlocation, eventmain.insertdate, eventmain.priority, eventgeo.long, eventgeo.lat, eventgeo.geox, eventgeo.geoy -> Nested Loop (cost=0.00..121293.93 rows=451 width=178) (actual time=1916.230..723712.900 rows=1408 loops=1) -> Index Scan using eventgeo_lat_idx on eventgeo (cost=0.00..85488.05 rows=10149 width=76) (actual time=0.402..393376.129 rows=22937 loops=1) Index Cond: ((lat > 39.7075542720006::double precision) AND (lat < 39.7186195832938::double precision)) Filter: ((long > -104.998027962962::double precision) AND (long < -104.985957781349::double precision)) -> Index Scan using eventmain_incidentid_idx on eventmain (cost=0.00..3.52 rows=1 width=119) (actual time=14.384..14.392 rows=0 loops=22937) Index Cond: ((eventmain.incidentid)::text = ("outer".incidentid)::text) Filter: ((entrydate > '2006-01-01 00:00:00'::timestamp without time zone) AND (entrydate <= '2006-03-17 00:00:00'::timestamp without time zone)) Total runtime: >>> 723729.238 ms(!) <<< I'm trying to figure out why it's consuming so much time on the index scan for eventgeo_lat_idx. Also, I have an index on "long" that the planner does not appear to find helpful. There are 3.3 million records in eventmain and eventgeo. The server has a reasonably fast RAID10 setup with 16x 15k RPM drives and 12GB of RAM ( 11GB listed as "cache" by vmstat ). Running version 8.0.2 on linux kernel 2.6.12. I have just vacuum analyze'd both tables, rebuilt the eventgeo_lat_idx index and reran the query multiple times to see if caching helped ( it didn't help much ). The server seems to be fine utilizing other fields from this table but using "long" and "lat" seem to drag it down significantly. Is it because there's such slight differences between the records, since they are all within a few hundredths of a degree from each other? Thanks for your time and ideas. -Dan From pgsql-performance-owner@postgresql.org Thu Mar 16 17:43:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5ECD99DC837 for ; Thu, 16 Mar 2006 17:43: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 24580-03 for ; Thu, 16 Mar 2006 17:44:00 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 587329DC828 for ; Thu, 16 Mar 2006 17:43:57 -0400 (AST) Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by svr4.postgresql.org (Postfix) with ESMTP id E46B65AF904 for ; Thu, 16 Mar 2006 21:43:59 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id ACE8A644365 for ; Thu, 16 Mar 2006 14:43:58 -0700 (MST) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23674-03 for ; Thu, 16 Mar 2006 14:43:56 -0700 (MST) Received: from [192.168.1.100] (c-67-165-220-189.hsd1.co.comcast.net [67.165.220.189]) by crestone.coronasolutions.com (Postfix) with ESMTP id B584D64425B for ; Thu, 16 Mar 2006 14:43:56 -0700 (MST) Message-ID: <4419DC1C.9070806@drivefaster.net> Date: Thu, 16 Mar 2006 14:43:56 -0700 From: Dan Harris User-Agent: Thunderbird 1.5 (Macintosh/20060122) MIME-Version: 1.0 To: PostgreSQL Performance Subject: Re: Help optimizing a slow index scan References: <4419DB50.10404@drivefaster.net> In-Reply-To: <4419DB50.10404@drivefaster.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.net 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: 200603/259 X-Sequence-Number: 17696 Dan Harris wrote: > explain analyze .... doh.. sorry to reply to my own post. But I messed up copying some of the fields into the select statement that you'll see in the "Sort Key" section of the analyze results. The mistake was mine. Everything else is "normal" between the query and the plan. -Dan From pgsql-performance-owner@postgresql.org Thu Mar 16 17:59:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6E12F9DCCEE for ; Thu, 16 Mar 2006 17:59: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 25692-10 for ; Thu, 16 Mar 2006 17:59:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id B3E5A9DCC2D for ; Thu, 16 Mar 2006 17:59:02 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Thu, 16 Mar 2006 15:59:04 -0600 Message-Id: <44198B3D.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Thu, 16 Mar 2006 15:58:53 -0600 From: "Kevin Grittner" To: "Evgeny Gridasov" Cc: Subject: Re: Background writer configuration References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> In-Reply-To: <20060316211523.73343cee.eugrid@fpm.kubsu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/260 X-Sequence-Number: 17697 >>> On Thu, Mar 16, 2006 at 12:15 pm, in message <20060316211523.73343cee.eugrid@fpm.kubsu.ru>, Evgeny Gridasov wrote: > > please, could you post other settings from your postgresql.conf? Everything in postgresql.conf which is not commented out: listen_addresses = '*' # what IP interface(s) to listen on; max_connections = 600 # note: increasing max_connections costs shared_buffers = 20000 # min 16 or max_connections*2, 8KB each work_mem = 10240 # min 64, size in KB max_fsm_pages = 1400000 # min max_fsm_relations*16, 6 bytes each bgwriter_lru_percent = 20.0 # 0-100% of LRU buffers scanned/round bgwriter_lru_maxpages = 200 # 0-1000 buffers max written/round bgwriter_all_percent = 10.0 # 0-100% of all buffers scanned/round bgwriter_all_maxpages = 600 # 0-1000 buffers max written/round full_page_writes = off # recover from partial page writes wal_buffers = 20 # min 4, 8KB each checkpoint_segments = 10 # in logfile segments, min 1, 16MB each effective_cache_size = 524288 # typically 8KB each random_page_cost = 2 # units are one sequential page fetch redirect_stderr = on # Enable capturing of stderr into log log_line_prefix = '[%m] %p %q<%u %d %r> ' # Special values: stats_start_collector = on stats_block_level = on stats_row_level = on autovacuum = true # enable autovacuum subprocess? autovacuum_naptime = 10 # time between autovacuum runs, in secs autovacuum_vacuum_threshold = 1 # min # of tuple updates before autovacuum_analyze_threshold = 1 # min # of tuple updates before autovacuum_vacuum_scale_factor = 0.2 # fraction of rel size before autovacuum_analyze_scale_factor = 0.1 # fraction of rel size before lc_messages = 'C' # locale for system error message lc_monetary = 'C' # locale for monetary formatting lc_numeric = 'C' # locale for number formatting lc_time = 'C' # locale for time formatting sql_inheritance = off standard_conforming_strings = on From pgsql-performance-owner@postgresql.org Fri Mar 17 01:43:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 848F39DCA05 for ; Fri, 17 Mar 2006 01: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 30837-04 for ; Fri, 17 Mar 2006 01:43:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id 9E7A79DCA4B for ; Fri, 17 Mar 2006 01:42:59 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 9121707; Thu, 16 Mar 2006 21:45:55 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: 1 TB of memory Date: Thu, 16 Mar 2006 21:43:25 -0800 User-Agent: KMail/1.8.2 Cc: "Luke Lonergan" , "Jim Nasby" References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603162143.25428.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/263 X-Sequence-Number: 17700 Luke, > With a single 3 Gbyte/second infiniband connection to the device? Hey, take it easy! Jim's post was tongue-in-cheek. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Mar 17 02:25:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D175D9DCD06 for ; Fri, 17 Mar 2006 02:25: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 80121-05 for ; Fri, 17 Mar 2006 02:25:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pillette.com (adsl-67-119-5-202.dsl.snfc21.pacbell.net [67.119.5.202]) by postgresql.org (Postfix) with ESMTP id 2C42C9DCD2D for ; Fri, 17 Mar 2006 02:25:28 -0400 (AST) Received: (from andrew@localhost) by pillette.com (8.11.6/8.11.6) id k2H6PJ926955; Thu, 16 Mar 2006 22:25:19 -0800 Date: Thu, 16 Mar 2006 22:25:19 -0800 From: andrew@pillette.com Message-Id: <200603170625.k2H6PJ926955@pillette.com> Subject: Re: Indexes with descending date columns To: theo@flame.co.za Cc: pgsql-performance@postgresql.org X-Originating-IP: 209.125.147.195 X-Mailer: Webmin 0.940 MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.532 required=5 tests=[AWL=-0.018, NO_REAL_NAME=0.55] X-Spam-Score: 0.532 X-Spam-Level: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Archive-Number: 200603/264 X-Sequence-Number: 17701 > I have a performance problem when traversing a table in index order with > multiple columns including a date column in date reverse order. Below > follows a simplified description of the table, the index and the > associated query > > \d prcdedit > prcdedit_prcd | character(20) | > prcdedit_date | timestamp without time zone | > > Indexes: > "prcdedit_idx" btree (prcdedit_prcd, prcdedit_date) Depending on how you use the table, there are three possible solutions. First, if it makes sense in the domain, using an ORDER BY where _both_ columns are used descending will make PG search the index in reverse and will be just as fast as when both as searched by the default ascending. Second possibility: Create a dummy column whose value depends on the negative of prcdedit_date, e.g., -extract(epoch from prcdedit_date), keep the dummy column in sync with the original column using triggers, and rewrite your queries to use ORDER BY prcdedit_prod, dummy_column. Third: Create an index on a function which sorts in the order you want, and then always sort using the function index (you could use the -extract(epoch...) gimmick for that, among other possibilities.) HTH. From pgsql-performance-owner@postgresql.org Thu Mar 16 23:44:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 46C869DCA0B for ; Thu, 16 Mar 2006 23:44: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 83188-08 for ; Thu, 16 Mar 2006 23:44: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 DC9209DC9AF for ; Thu, 16 Mar 2006 23:44:30 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Thu, 16 Mar 2006 22:44:30 -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, 16 Mar 2006 22:44:30 -0500 Received: from 69.45.100.3 ([69.45.100.3]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.118]) with Microsoft Exchange Server HTTP-DAV ; Fri, 17 Mar 2006 03:44:30 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 16 Mar 2006 22:44:25 -0800 Subject: Re: 1 TB of memory From: "Luke Lonergan" To: "Jim Nasby" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] 1 TB of memory Thread-Index: AcZJKD2QJKPp1kWbQ36iwXaGKbAGBAAZf1mu In-Reply-To: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> MIME-Version: 1.0 X-OriginalArrivalTime: 17 Mar 2006 03:44:30.0721 (UTC) FILETIME=[19116710:01C64975] X-WSS-ID: 6804EF142XS29116176-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: 200603/261 X-Sequence-Number: 17698 Jim, > PostgreSQL tuned to the max and still too slow? Database too big to > fit into memory? Here's the solution! http://www.superssd.com/ > products/tera-ramsan/ With a single 3 Gbyte/second infiniband connection to the device? You'd be better off with 4 x $10K servers that do 800MB/s from disk each and a Bizgres MPP - then you'd do 3.2GB/s (faster than the SSD) at a price 1/10 of the SSD, and you'd have 24TB of RAID5 disk under you. Plus - need more speed? Add 12 more servers, and you'd run at 12.8GB/s and have 96TB of disk to work with, and you'd *still* spend less on HW and SW than the SSD. - Luke From pgsql-performance-owner@postgresql.org Fri Mar 17 00:24:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 932B09DCA0B for ; Fri, 17 Mar 2006 00:24: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 15058-02 for ; Fri, 17 Mar 2006 00:24:17 -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 47EF19DC9D7 for ; Fri, 17 Mar 2006 00:24:15 -0400 (AST) Received: from 172.16.1.148 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Thu, 16 Mar 2006 23:24:06 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 16 Mar 2006 23:24:06 -0500 Received: from 69.45.100.3 ([69.45.100.3]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.118]) with Microsoft Exchange Server HTTP-DAV ; Fri, 17 Mar 2006 04:24:05 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 16 Mar 2006 23:24:00 -0800 Subject: Re: 1 TB of memory From: "Luke Lonergan" To: "Jim Nasby" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] 1 TB of memory Thread-Index: AcZJKD2QJKPp1kWbQ36iwXaGKbAGBAAZf1muAAFh52Y= In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 17 Mar 2006 04:24:06.0064 (UTC) FILETIME=[A0E1FB00:01C6497A] X-WSS-ID: 6804E66C2F83778365-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.333 required=5 tests=[AWL=0.080, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.333 X-Spam-Level: * X-Archive-Number: 200603/262 X-Sequence-Number: 17699 Jim, On 3/16/06 10:44 PM, "Luke Lonergan" wrote: > Plus - need more speed? Add 12 more servers, and you'd run at 12.8GB/s and > have 96TB of disk to work with, and you'd *still* spend less on HW and SW > than the SSD. And I forgot to mention that with these 16 servers you'd have 64 CPUs and 256GB of RAM working for you in addition to the 96TB of disk. Every query would use all of that RAM and all of those CPUs, all at the same time. By comparison, with the SSD, you'd have 1 CPU trying to saturate 1 connection to the SSD. If you do anything other than just access the data there (order by, group by, join, aggregation, functions), you'll be faced with trying to have 1 CPU do all the work on 1 TB of data. I suggest that it won't be any faster than having the 1 TB on disk for most queries, as you would be CPU bound. By comparison, with the MPP system, all 64 CPUs would be used at one time to process the N TB of data and if you grew from N TB to 2N TB, you could double the machine size and it would take the same amount of time to do 2N as it did to do N. That's what data parallelism and scaling is all about. Without it, you don't have a prayer of using all 1TB of data in queries. - Luke From pgsql-performance-owner@postgresql.org Fri Mar 17 06:10:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A67CD9DCDEA for ; Fri, 17 Mar 2006 06: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 35548-02-7 for ; Fri, 17 Mar 2006 06:10:03 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id DDBFC9DCD2E for ; Fri, 17 Mar 2006 06:09:59 -0400 (AST) Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by svr4.postgresql.org (Postfix) with ESMTP id 58CA55AF8A9 for ; Fri, 17 Mar 2006 10:09:58 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 766DEA82C0 for ; Fri, 17 Mar 2006 11:10:03 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 04470-04 for ; Fri, 17 Mar 2006 11:10:02 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id C3199A82A5 for ; Fri, 17 Mar 2006 11:10:02 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id E899A1837A8; Fri, 17 Mar 2006 11:09:50 +0100 (CET) To: pgsql-performance@postgresql.org Subject: planner with index scan cost way off actual cost, advices to tweak cost constants? X-Hashcash: 1:20:060317:pgsql-performance@postgresql.org::JbFgD3TUswkpNqWY:000000000000000000000000000000Yzr From: Guillaume Cottenceau Date: 17 Mar 2006 11:09:50 +0100 Message-ID: <87ek11gz69.fsf@meuh.mnc.lan> Lines: 149 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: amavisd-new at mnc.ch 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: 200603/265 X-Sequence-Number: 17702 Hi, I have a problem with the postgres planner, which gives a cost to index scan which is much higher than actual cost (worst case considered, e.g. without any previous disk cache), and am posting here for advices for tweaking cost constants. Because of this problem, the planner typically chooses a seq scan when an index scan would be more efficient, and I would like to correct this if possible. Reading the documentation and postgresql list archives, I have run ANALYZE right before my tests, I have increased the statistics target to 50 for the considered table; my problem is that the index scan cost reported by EXPLAIN seems to be around 12.7 times higher that it should, a figure I suppose incompatible (too large) for just random_page_cost and effective_cache_size tweaks. Structure of the table: \d sent_messages Table "public.sent_messages" Column | Type | Modifiers ----------+--------------------------+---------------------------------------------------------------- uid | integer | not null default nextval('public.sent_messages_uid_seq'::text) sender | character varying(25) | receiver | character varying(25) | action | character varying(25) | cost | integer | date | timestamp with time zone | not null default ('now'::text)::timestamp(6) with time zone status | character varying(128) | theme | character varying(25) | operator | character varying(15) | Indexes: "sent_messages_pkey" primary key, btree (uid) "idx_sent_msgs_date_theme_status" btree (date, theme, status) What I did: - SET default_statistics_target = 50 - VACUUM FULL ANALYZE VERBOSE sent_messages - copied so that you can have a look at rows and pages taken up by relations INFO: vacuuming "public.sent_messages" INFO: "sent_messages": found 0 removable, 3692284 nonremovable row versions in 55207 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 103 to 177 bytes long. There were 150468 unused item pointers. Total free space (including removable row versions) is 2507320 bytes. 0 pages are or will become empty, including 0 at the end of the table. 2469 pages containing 262732 free bytes are potential move destinations. CPU 0.57s/0.20u sec elapsed 11.27 sec. INFO: index "sent_messages_pkey" now contains 3692284 row versions in 57473 pages DETAIL: 0 index row versions were removed. 318 index pages have been deleted, 318 are currently reusable. CPU 2.80s/1.27u sec elapsed 112.69 sec. INFO: index "idx_sent_msgs_date_theme_status" now contains 3692284 row versions in 88057 pages DETAIL: 0 index row versions were removed. 979 index pages have been deleted, 979 are currently reusable. CPU 4.22s/1.51u sec elapsed 246.88 sec. INFO: "sent_messages": moved 0 row versions, truncated 55207 to 55207 pages DETAIL: CPU 1.87s/3.18u sec elapsed 42.71 sec. INFO: vacuuming "pg_toast.pg_toast_77852470" INFO: "pg_toast_77852470": found 0 removable, 0 nonremovable row versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 0 to 0 bytes long. There were 0 unused item pointers. Total free space (including removable row versions) is 0 bytes. 0 pages are or will become empty, including 0 at the end of the table. 0 pages containing 0 free bytes are potential move destinations. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: index "pg_toast_77852470_index" now contains 0 row versions in 1 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.02 sec. INFO: analyzing "public.sent_messages" INFO: "sent_messages": 55207 pages, 15000 rows sampled, 3666236 estimated total rows - select rows of the table with a range condition on "date", find a range for which seq scan and index scan runtimes seem to be very close (I use Linux, I cat a 2G file to /dev/null between each request to flush disk cache, on a machine of 1G real RAM and 1G of swap, so that this is the worst case tested for index scan), notice that the cost used by the planner is 12.67 times higher for index scan, at a position it should be around 1 so that planner could make sensible choices: EXPLAIN ANALYZE SELECT * FROM sent_messages WHERE date > '2005-09-01' AND date < '2005-09-19'; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on sent_messages (cost=0.00..110591.26 rows=392066 width=78) (actual time=7513.205..13095.147 rows=393074 loops=1) Filter: ((date > '2005-09-01 00:00:00+00'::timestamp with time zone) AND (date < '2005-09-19 00:00:00+00'::timestamp with time zone)) Total runtime: 14272.522 ms SET enable_seqscan = false EXPLAIN ANALYZE SELECT * FROM sent_messages WHERE date > '2005-09-01' AND date < '2005-09-19'; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Index Scan using idx_sent_msgs_date_theme_status on sent_messages (cost=0.00..1402124.26 rows=392066 width=78) (actual time=142.638..12677.378 rows=393074 loops=1) Index Cond: ((date > '2005-09-01 00:00:00+00'::timestamp with time zone) AND (date < '2005-09-19 00:00:00+00'::timestamp with time zone)) Total runtime: 13846.504 ms Please notice that an index on the "date" column only would be much more efficient for the considered request (and I have confirmed this by creating and trying it), but I don't necessarily would need this index if the existing index was used. Of course real queries use smaller date ranges. - I then tried to tweak random_page_cost and effective_cache_size following advices from documentation: SET random_page_cost = 2; SET effective_cache_size = 10000; EXPLAIN SELECT * FROM sent_messages WHERE date > '2005-09-01' AND date < '2005-09-19'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------- Index Scan using idx_sent_msgs_date_theme_status on sent_messages (cost=0.00..595894.94 rows=392066 width=78) Index Cond: ((date > '2005-09-01 00:00:00+00'::timestamp with time zone) AND (date < '2005-09-19 00:00:00+00'::timestamp with time zone)) We can see that estimated index scan cost goes down but by a factor of approx. 2.3 which is far from enough to "fix" it. I am reluctant in changing way more the random_page_cost and effective_cache_size values as I'm suspecting it might have other (bad) consequences if it is too far away from reality (even if Linux is known to aggressively cache), the application being multithreaded (there is a warning about concurrent queries using different indexes in documentation). But I certainly could benefit from others' experience on this matter. I apologize for this long email but I wanted to be sure I gave enough information on the data and things I have tried to fix the problem myself. If anyone can see what I am doing wrong, I would be very interested in pointers. Thanks in advance! Btw, I use postgres 7.4.5 with -B 1000 -N 500 and all postgresql.conf default values except timezone = 'UTC', on an ext3 partition with data=ordered, and run Linux 2.6.12. -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Fri Mar 17 08:24:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BBF339DCB61 for ; Fri, 17 Mar 2006 08:24: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 61108-06 for ; Fri, 17 Mar 2006 08:24:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) by postgresql.org (Postfix) with ESMTP id C18909DCB5D for ; Fri, 17 Mar 2006 08:24:47 -0400 (AST) Received: from [192.168.0.250] (helo=deepcore.i-free.ru) by office1.i-free.ru with smtp (Exim 3.36 #1 (Debian)) id 1FKE0d-0006aN-00; Fri, 17 Mar 2006 15:24:47 +0300 Date: Fri, 17 Mar 2006 15:24:48 +0300 From: Evgeny Gridasov To: "Kevin Grittner" Cc: pgsql-performance@postgresql.org Subject: Re: Background writer configuration Message-Id: <20060317152448.452e4854.eugrid@fpm.kubsu.ru> In-Reply-To: <44198B3D.EE98.0025.0@wicourts.gov> References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> X-Mailer: Sylpheed version 2.2.3 (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.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/266 X-Sequence-Number: 17703 Yesterday we recieved a new server 2xAMD64(2core x 2chips = 4 cores) 8GB RAM and RAID-1 (LSI megaraid) I've maid some tests with pgbench (scaling 1000, database size ~ 16Gb) First of all, I'd like to mention that it was strange to see that the server performance degraded by 1-2% when we changed kernel/userland to x86_64 from default installed i386 userland/amd64 kernel. The operating system was Debian Linux, filesystem ext3. bg_writer_*_percent/maxpages setting did not dramatically increase performance, but setting bg_writer_delay to values x10 original setting (2000-4000) increased transaction rate by 4-7 times. I've tried shared buffers 32768, 65536, performance was almost equal. for all tests: checkpoint_segments = 16 checkpoint_timeout = 900 shared_buffers=65536 wal_buffers=128: bgwriter_delay = 200 bgwriter_lru_percent = 10.0 bgwriter_lru_maxpages = 100 bgwriter_all_percent = 5.0 bgwriter_all_maxpages = 50 result: ./pgbench -c 32 -t 500 -U postgres regression starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1000 number of clients: 32 number of transactions per client: 500 number of transactions actually processed: 16000/16000 tps = 112.740903 (including connections establishing) tps = 112.814327 (excluding connections establishing) (disk activity about 2-4mb/sec writing) bgwriter_delay = 4000 bgwriter_lru_percent = 10.0 bgwriter_lru_maxpages = 100 bgwriter_all_percent = 5.0 bgwriter_all_maxpages = 50 result: ./pgbench -c 32 -t 500 -U postgres regression starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1000 number of clients: 32 number of transactions per client: 500 number of transactions actually processed: 16000/16000 tps = 508.637831 (including connections establishing) tps = 510.107981 (excluding connections establishing) (disk activity about 20-40 mb/sec writing) Setting bgwriter_delay to higher values leads to slower postgresql shutdown time (I see postgresql writer process writing to disk). Sometimes postgresql didn't shutdown correctly (doesn't complete background writing ?). I've found some settings with which system behaves strange: ./pgbench -c 32 -t 3000 -U postgres regression vmstat 1: procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 25 528 14992 22884 7876736 0 0 457 383 77 83 1 0 94 5 0 7 632 14728 22892 7875780 0 88 4412 9456 1594 21623 9 5 8 78 1 19 796 16904 22928 7872712 0 16 3536 9053 1559 19717 9 4 12 75 0 4 872 14928 22936 7874208 0 36 3036 9092 1574 20874 9 4 2 85 0 24 912 16292 22964 7872068 0 44 3020 9316 1581 19922 9 4 9 78 0 1 912 17800 22980 7869876 0 0 2596 8700 1560 19926 9 4 4 84 4 23 996 18284 22996 7868292 32 0 3396 11048 1657 22802 11 5 3 81 0 22 960 14728 23020 7871448 52 0 3020 9648 1613 21641 9 4 5 82 0 28 1008 15440 23028 7869624 0 48 2992 10052 1608 21430 9 5 5 82 1 16 1088 17328 23044 7867196 0 0 2460 7884 1530 16536 8 3 9 79 0 23 1088 18440 23052 7865556 0 0 3256 10128 1635 22587 10 4 4 81 1 29 1076 14728 23076 7868604 0 0 2968 9860 1597 21518 10 5 7 79 1 24 1136 15952 23084 7866700 0 40 2696 8900 1560 19311 9 4 5 81 0 14 1208 17200 23112 7864736 0 16 2888 9508 1603 20634 10 4 6 80 0 21 1220 18520 23120 7862828 0 72 2816 9487 1572 19888 10 4 7 79 1 21 1220 14792 23144 7866000 0 0 2960 9536 1599 20331 9 5 5 81 1 24 1220 16392 23152 7864088 0 0 2860 8932 1583 19288 9 4 3 84 0 18 1276 18000 23168 7862048 0 0 2792 8592 1553 18843 9 4 9 78 1 17 1348 19144 23176 7860132 0 16 2840 9604 1583 20654 10 4 6 80 0 22 64 15112 23200 7864264 528 0 3280 8785 1582 19339 9 4 7 80 0 25 16 16008 23212 7862664 4 0 2764 8964 1605 18471 9 4 8 79 0 26 16 17544 23236 7860872 0 0 3008 9848 1590 20527 10 4 7 79 1 7 16 18704 23244 7858960 0 0 2756 8760 1564 19875 9 4 4 84 1 25 16 15120 23268 7861996 0 0 2768 8512 1550 18518 9 3 12 75 1 25 16 18076 23276 7859812 0 0 2484 8580 1536 18391 8 4 8 80 0 3 16 17832 23300 7862916 0 0 2888 8864 1586 21450 9 4 4 83 0 14 16 24280 23308 7866036 0 0 2816 9140 1537 20655 9 4 7 81 1 1 16 54452 23348 7867968 0 0 1808 6988 1440 14235 6 9 24 61 0 1 16 51988 23348 7868036 0 0 60 4180 1344 885 1 10 72 16 0 2 16 51988 23348 7868036 0 0 0 3560 1433 50 0 0 75 25 0 2 16 51988 23348 7868036 0 0 0 2848 1364 46 0 0 75 25 0 2 16 51988 23348 7868036 0 0 0 2560 1350 44 0 0 75 25 0 4 16 51996 23360 7868092 0 0 0 2603 1328 60 0 0 72 28 0 4 16 52060 23360 7868092 0 0 0 2304 1306 46 0 0 75 25 0 4 16 52140 23360 7868092 0 0 0 2080 1288 40 0 0 75 25 0 2 16 52140 23360 7868092 0 0 0 2552 1321 48 0 0 75 25 0 2 16 52220 23360 7868092 0 0 0 2560 1335 44 0 0 75 25 0 2 16 52220 23360 7868092 0 0 0 2560 1340 48 0 0 75 25 0 2 16 52284 23360 7868092 0 0 0 2560 1338 48 0 0 75 25 ... continued during the time with zero read io and write io about 2500 I see many hanging postgresql processes executing UPDATE or COMMIT. This lasts for a minute or so, after that I see the same IO which was during benchmark start. What happens during this period? On Thu, 16 Mar 2006 15:58:53 -0600 "Kevin Grittner" wrote: > >>> On Thu, Mar 16, 2006 at 12:15 pm, in message > <20060316211523.73343cee.eugrid@fpm.kubsu.ru>, Evgeny Gridasov > wrote: > > > > please, could you post other settings from your postgresql.conf? > > Everything in postgresql.conf which is not commented out: > > listen_addresses = '*' # what IP interface(s) to listen on; > max_connections = 600 # note: increasing > max_connections costs > shared_buffers = 20000 # min 16 or max_connections*2, > 8KB each > work_mem = 10240 # min 64, size in KB > max_fsm_pages = 1400000 # min max_fsm_relations*16, 6 > bytes each > bgwriter_lru_percent = 20.0 # 0-100% of LRU buffers > scanned/round > bgwriter_lru_maxpages = 200 # 0-1000 buffers max > written/round > bgwriter_all_percent = 10.0 # 0-100% of all buffers > scanned/round > bgwriter_all_maxpages = 600 # 0-1000 buffers max > written/round > full_page_writes = off # recover from partial page > writes -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Fri Mar 17 09:31:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B89479DCC37 for ; Fri, 17 Mar 2006 09:31: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 73317-06 for ; Fri, 17 Mar 2006 09:31:30 -0400 (AST) X-Greylist: delayed 01:00:01.386895 by SQLgrey- Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id 7FA589DCA67 for ; Fri, 17 Mar 2006 09:31:24 -0400 (AST) Received: from osgiliath.mathom.us ([151.200.254.241]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IW90093LUSDINY2@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 17 Mar 2006 06:31:26 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 4B5566E5B3 for ; Fri, 17 Mar 2006 07:31:24 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19408-03-3 for ; Fri, 17 Mar 2006 07:31:23 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 934F56E622; Fri, 17 Mar 2006 07:31:23 -0500 (EST) Date: Fri, 17 Mar 2006 07:31:23 -0500 From: Michael Stone Subject: Re: 1 TB of memory In-reply-to: To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20060317123121.GO15140@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: Debian amavisd-new at mathom.us References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.738 required=5 tests=[AWL=-0.498, RCVD_IN_SORBS_WEB=1.236] X-Spam-Score: 0.738 X-Spam-Level: X-Archive-Number: 200603/268 X-Sequence-Number: 17705 On Thu, Mar 16, 2006 at 10:44:25PM -0800, Luke Lonergan wrote: >You'd be better off with 4 x $10K servers that do 800MB/s from disk each and >a Bizgres MPP - then you'd do 3.2GB/s (faster than the SSD) at a price 1/10 >of the SSD, and you'd have 24TB of RAID5 disk under you. Except, of course, that your solution doesn't have a seek time of zero. That approach is great for applications that are limited by their sequential scan speed, not so good for applications with random access. At 3.2 GB/s it would still take over 5 minutes to seqscan a TB, so you'd probably want some indices--and you're not going to be getting 800MB/s per system doing random index scans from rotating disk (but you might with SSD). Try not to beat your product drum quite so loud... Mike Stone From pgsql-performance-owner@postgresql.org Fri Mar 17 09:35:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0E5F79DC81A for ; Fri, 17 Mar 2006 09:35: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 75136-05 for ; Fri, 17 Mar 2006 09:35:08 -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 9AABB9DC83C for ; Fri, 17 Mar 2006 09:35:02 -0400 (AST) Received: (qmail 21220 invoked from network); 17 Mar 2006 14:35:16 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 17 Mar 2006 14:35:16 +0100 To: "Evgeny Gridasov" , "Kevin Grittner" Cc: pgsql-performance@postgresql.org Subject: Re: Background writer configuration References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> Message-ID: From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Fri, 17 Mar 2006 14:35:15 +0100 In-Reply-To: <20060317152448.452e4854.eugrid@fpm.kubsu.ru> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/269 X-Sequence-Number: 17706 > First of all, I'd like to mention that it was strange to see that > the server performance degraded by 1-2% when we changed kernel/userland > to x86_64 > from default installed i386 userland/amd64 kernel. The operating system > was Debian Linux, > filesystem ext3. Did you use postgres compiled for AMD64 with the 64 kernel, or did you use a 32 bit postgres in emulation mode ? From pgsql-performance-owner@postgresql.org Fri Mar 17 09:38:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D5A8C9DCB8F for ; Fri, 17 Mar 2006 09:38: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 77079-01 for ; Fri, 17 Mar 2006 09:38:16 -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 A2F649DCB0F for ; Fri, 17 Mar 2006 09:38:10 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so532282nzo for ; Fri, 17 Mar 2006 05:38: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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MPA7eKxF9sxTdAL5DVMa0zXfh3vamjKHwAHBD0C4lUPTEEkJSXerEemYnCHt34isV++k2PINGQOUn8PUmP3iUF9YOMx8H/qXlQx4Om6PzzKyBW9wgD3ygqFrwYpkx4+BSnjcqfmlEydBr0PBKaI7kAO+DYkh9DEHFBMZzJZsBmY= Received: by 10.65.59.10 with SMTP id m10mr201152qbk; Fri, 17 Mar 2006 05:38:14 -0800 (PST) Received: by 10.65.240.17 with HTTP; Fri, 17 Mar 2006 05:38:14 -0800 (PST) Message-ID: <3cf983d0603170538s788b46b3saeec119a0fd0cce5@mail.gmail.com> Date: Fri, 17 Mar 2006 05:38:14 -0800 From: "Rodrigo Madera" To: pgsql-performance@postgresql.org Subject: Re: 1 TB of memory In-Reply-To: <20060317123121.GO15140@mathom.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> <20060317123121.GO15140@mathom.us> 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: 200603/270 X-Sequence-Number: 17707 For God's sake buy a mainframe! =3Do) On 3/17/06, Michael Stone wrote: > On Thu, Mar 16, 2006 at 10:44:25PM -0800, Luke Lonergan wrote: > >You'd be better off with 4 x $10K servers that do 800MB/s from disk each= and > >a Bizgres MPP - then you'd do 3.2GB/s (faster than the SSD) at a price 1= /10 > >of the SSD, and you'd have 24TB of RAID5 disk under you. > > Except, of course, that your solution doesn't have a seek time of zero. > That approach is great for applications that are limited by their > sequential scan speed, not so good for applications with random access. > At 3.2 GB/s it would still take over 5 minutes to seqscan a TB, so you'd > probably want some indices--and you're not going to be getting 800MB/s > per system doing random index scans from rotating disk (but you might > with SSD). Try not to beat your product drum quite so loud... > > Mike Stone > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Fri Mar 17 09:48:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 046059DC97E for ; Fri, 17 Mar 2006 09:48: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 77460-06 for ; Fri, 17 Mar 2006 09:48:09 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id DD7BB9DC947 for ; Fri, 17 Mar 2006 09:48:03 -0400 (AST) Received: from mail.advfn.com (mail.advfn.com [212.161.99.149]) by svr4.postgresql.org (Postfix) with ESMTP id A305B5AF87F for ; Fri, 17 Mar 2006 13:48:08 +0000 (GMT) Received: from [192.168.200.101] (host213-120-115-211.in-addr.btopenworld.com [213.120.115.211]) by mail.advfn.com (Postfix) with ESMTP id 99A5C14D114; Fri, 17 Mar 2006 13:48:04 +0000 (GMT) In-Reply-To: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: quoted-printable From: Alex Stapleton Subject: Re: 1 TB of memory Date: Fri, 17 Mar 2006 13:47:58 +0000 To: Jim Nasby X-Mailer: Apple Mail (2.746.3) 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: 200603/271 X-Sequence-Number: 17708 We got a quote for one of these (entirely for comedy value of course) =20= and it was in the region of =A31,500,000 give or take a few thousand. On 16 Mar 2006, at 18:33, Jim Nasby wrote: > PostgreSQL tuned to the max and still too slow? Database too big to =20= > fit into memory? Here's the solution! http://www.superssd.com/=20 > products/tera-ramsan/ > > Anyone purchasing one will be expected to post benchmarks! :) > -- > 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 > > > > ---------------------------(end of =20 > broadcast)--------------------------- > TIP 6: explain analyze is your friend From pgsql-performance-owner@postgresql.org Fri Mar 17 09:55:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B7D309DCAD6 for ; Fri, 17 Mar 2006 09:55: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 77861-07 for ; Fri, 17 Mar 2006 09:55:54 -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 147E99DCAEF for ; Fri, 17 Mar 2006 09:55:48 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so535139nzo for ; Fri, 17 Mar 2006 05:55:50 -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=LFz5tXC1wBnqiy4polcBfhLxzpfHPqz0fUjxjNCUSQA/d9btlC4/mdkA+29uQJqn5wxb0QACI9Dk66PGWrIAb3IDp7e11DnQwMpwGh1GjD7zqkWeuXkxGcAYz1mbkxdEiG7NFtJC7Ct4m4iWL2N2c7KdLnXAWg2D8zeNQOto4YI= Received: by 10.65.59.10 with SMTP id m10mr210475qbk; Fri, 17 Mar 2006 05:55:48 -0800 (PST) Received: by 10.65.135.10 with HTTP; Fri, 17 Mar 2006 05:55:48 -0800 (PST) Message-ID: Date: Fri, 17 Mar 2006 08:55:48 -0500 From: "Merlin Moncure" To: "Jim Nasby" Subject: Re: 1 TB of memory Cc: pgsql-performance@postgresql.org In-Reply-To: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.137 required=5 tests=[AWL=0.137] X-Spam-Score: 0.137 X-Spam-Level: X-Archive-Number: 200603/272 X-Sequence-Number: 17709 On 3/16/06, Jim Nasby wrote: > PostgreSQL tuned to the max and still too slow? Database too big to > fit into memory? Here's the solution! http://www.superssd.com/ > products/tera-ramsan/ > > Anyone purchasing one will be expected to post benchmarks! :) I like their approach...ddr ram + raid sanity backup + super reliable power system. Their prices are on jupiter (and i dont mean jupiter, fl) but hopefully there will be some competition and the invetible decline in prices. When prices drop from the current 1-2k$/Gb to a more realistic 250$/Gb there will be no reason not to throw one into a server. You could already make a case for an entry level one to handle the WAL and perhaps a few key tables/indexes, particularly ones that are frequenct vacuum targets. ddr approach is much faster than flash nvram inherintly and has a virtually unlimited duty cycle. My prediction is that by 2010 SSD will be relatively commonplace in the server market, barring some rediculous goverment intervention (patentes, etc). merlin From pgsql-performance-owner@postgresql.org Fri Mar 17 10:50:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9AF3B9DCA15 for ; Fri, 17 Mar 2006 10: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 90354-01 for ; Fri, 17 Mar 2006 10:50:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) by postgresql.org (Postfix) with ESMTP id 4F9869DC9BC for ; Fri, 17 Mar 2006 10:50:16 -0400 (AST) Received: from [192.168.0.250] (helo=deepcore.i-free.ru) by office1.i-free.ru with smtp (Exim 3.36 #1 (Debian)) id 1FKGHP-0001rF-00; Fri, 17 Mar 2006 17:50:15 +0300 Date: Fri, 17 Mar 2006 17:50:17 +0300 From: Evgeny Gridasov To: PFC Cc: Kevin.Grittner@wicourts.gov, pgsql-performance@postgresql.org Subject: Re: Background writer configuration Message-Id: <20060317175017.e15f2151.eugrid@fpm.kubsu.ru> In-Reply-To: References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> X-Mailer: Sylpheed version 2.2.3 (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.098 required=5 tests=[AWL=0.098] X-Spam-Score: 0.098 X-Spam-Level: X-Archive-Number: 200603/273 X-Sequence-Number: 17710 template1=# select version(); version --------------------------------------------------------------------------------------------- PostgreSQL 8.1.3 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) 3.3.5 (Debian 1:3.3.5-13) (1 row) On Fri, 17 Mar 2006 14:35:15 +0100 PFC wrote: > > > First of all, I'd like to mention that it was strange to see that > > the server performance degraded by 1-2% when we changed kernel/userland > > to x86_64 > > from default installed i386 userland/amd64 kernel. The operating system > > was Debian Linux, > > filesystem ext3. > > Did you use postgres compiled for AMD64 with the 64 kernel, or did you > use a 32 bit postgres in emulation mode ? > -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Fri Mar 17 10:55:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2E8379DC9BC for ; Fri, 17 Mar 2006 10:55: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 88040-08 for ; Fri, 17 Mar 2006 10:55:21 -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 E53049DC865 for ; Fri, 17 Mar 2006 10:55:14 -0400 (AST) Received: (qmail 23358 invoked from network); 17 Mar 2006 15:55:31 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 17 Mar 2006 15:55:31 +0100 To: "Evgeny Gridasov" Cc: Kevin.Grittner@wicourts.gov, pgsql-performance@postgresql.org Subject: Re: Background writer configuration References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> <20060317175017.e15f2151.eugrid@fpm.kubsu.ru> Message-ID: Date: Fri, 17 Mar 2006 15:55:31 +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: <20060317175017.e15f2151.eugrid@fpm.kubsu.ru> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/274 X-Sequence-Number: 17711 I got this : template1=# select version(); version ------------------------------------------------------------------------------------------------------------------------------------------ PostgreSQL 8.1.2 on x86_64-pc-linux-gnu, compiled by GCC x86_64-pc-linux-gnu-gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8) (1 ligne) Normally you should get a noticeable performance boost by using userland executables compiled for the 64 platform... strange... On Fri, 17 Mar 2006 15:50:17 +0100, Evgeny Gridasov wrote: > template1=# select version(); > version > --------------------------------------------------------------------------------------------- > PostgreSQL 8.1.3 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) 3.3.5 > (Debian 1:3.3.5-13) > (1 row) > > > On Fri, 17 Mar 2006 14:35:15 +0100 > PFC wrote: > >> >> > First of all, I'd like to mention that it was strange to see that >> > the server performance degraded by 1-2% when we changed >> kernel/userland >> > to x86_64 >> > from default installed i386 userland/amd64 kernel. The operating >> system >> > was Debian Linux, >> > filesystem ext3. >> >> Did you use postgres compiled for AMD64 with the 64 kernel, or did you >> use a 32 bit postgres in emulation mode ? >> > From pgsql-performance-owner@postgresql.org Fri Mar 17 10:57:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF7959DCB74 for ; Fri, 17 Mar 2006 10:57: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 90392-07 for ; Fri, 17 Mar 2006 10:57:43 -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 EEA1B9DCB61 for ; Fri, 17 Mar 2006 10:57:36 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so546555nzo for ; Fri, 17 Mar 2006 06:57:38 -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=fzx6OyyioxjLpayZU4ZXOrs28BZ5KUAHcYb45IA8G16AFwATTZDoB+kWAwVFzlIkoilwyZFEswyIeO5ACa9fhYXaUA7eznqhTllkw2DQwFiTJ9xBrAhm/sHZQouPwUHLr6RXgP5iDhpvV18NSYdUIwB/O32DV+OOkJhjNtllOf4= Received: by 10.65.110.11 with SMTP id n11mr245981qbm; Fri, 17 Mar 2006 06:57:37 -0800 (PST) Received: by 10.65.135.10 with HTTP; Fri, 17 Mar 2006 06:57:36 -0800 (PST) Message-ID: Date: Fri, 17 Mar 2006 09:57:36 -0500 From: "Merlin Moncure" To: "Rodrigo Madera" Subject: Re: 1 TB of memory Cc: pgsql-performance@postgresql.org In-Reply-To: <3cf983d0603170625k370b4d29rcbdd5c7015fc18fa@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> <3cf983d0603170625k370b4d29rcbdd5c7015fc18fa@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.137 required=5 tests=[AWL=0.137] X-Spam-Score: 0.137 X-Spam-Level: X-Archive-Number: 200603/275 X-Sequence-Number: 17712 On 3/17/06, Rodrigo Madera wrote: > I don't know about you databasers that crunch in some selects, updates > and deletes, but my personal developer workstation is planned to be a > 4x 300GB SATA300 with a dedicated RAID stripping controller (no > checksums, just speedup) and 4x AMD64 CPUs... not to mention 2GB for > each processor... all this in a nice server motherboard... no doubt, that will handle quite a lot of data. in fact, most databases (contrary to popular opinion) are cpu bound, not i/o bound.=20 However, at some point a different set of rules come into play. This point is constantly chaning due to the relentless march of hardware but I'd suggest that at around 1TB you can no longer count on things to run quickly just depending on o/s file caching to bail you out.=20 Or, you may have a single table + indexes thats 50 gb that takes 6 hours to vacuum sucking all your i/o. another useful aspect of SSD is the relative value of using system memory is much less, so you can reduce swappiness and tune postgres to rely more on the filesystem and give all your memory to work_mem and such. merlin From pgsql-performance-owner@postgresql.org Fri Mar 17 11:08:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 606039DCD27 for ; Fri, 17 Mar 2006 11:08: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 91505-05 for ; Fri, 17 Mar 2006 11:08:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 0537F9DCD0F for ; Fri, 17 Mar 2006 11:08:36 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Fri, 17 Mar 2006 09:08:41 -0600 Message-Id: <441A7C87.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Fri, 17 Mar 2006 09:08:23 -0600 From: "Kevin Grittner" To: "Evgeny Gridasov" Cc: Subject: Re: Background writer configuration References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> In-Reply-To: <20060317152448.452e4854.eugrid@fpm.kubsu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/276 X-Sequence-Number: 17713 >>> On Fri, Mar 17, 2006 at 6:24 am, in message <20060317152448.452e4854.eugrid@fpm.kubsu.ru>, Evgeny Gridasov wrote: > > I've maid some tests with pgbench If possible, tune the background writer with your actual application code under normal load. Optimal tuning is going to vary based on usage patterns. You can change these settings on the fly by editing the postgresql.conf file and running pg_ctl reload. This is very nice, as it allowed us to try various settings in our production environment while two machines dealt with normal update and web traffic and another was in a saturated update process. For us, the key seems to be to get the dirty blocks pushed out to the OS level cache as soon as possible, so that the OS can deal with them before the checkpoint comes along. > for all tests: > checkpoint_segments = 16 > checkpoint_timeout = 900 > shared_buffers=65536 > wal_buffers=128: > ./pgbench - c 32 - t 500 - U postgres regression Unless you are going to be running in short bursts of activity, be sure that the testing is sustained long enough to get through several checkpoints and settle into a "steady state" with any caching controller, etc. On the face of it, it doesn't seem like this test shows anything except how it would behave with a relatively short burst of activity sandwiched between big blocks of idle time. I think your second test may look so good because it is just timing how fast it can push a few rows into cache space. > Setting bgwriter_delay to higher values leads to slower postgresql shutdown time > (I see postgresql writer process writing to disk). Sometimes postgresql didn't > shutdown correctly (doesn't complete background writing ?). Yeah, here's where it gets to trying to finish all the work you avoided measuring in your benchmark. -Kevin From pgsql-performance-owner@postgresql.org Fri Mar 17 11:34:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E386A9DCA70 for ; Fri, 17 Mar 2006 11: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 93974-09 for ; Fri, 17 Mar 2006 11:34:34 -0400 (AST) X-Greylist: delayed 17:53:56.480384 by SQLgrey- Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by postgresql.org (Postfix) with ESMTP id DBDFA9DC9A4 for ; Fri, 17 Mar 2006 11:34:27 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id 100DA644304 for ; Fri, 17 Mar 2006 08:34:32 -0700 (MST) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11688-02 for ; Fri, 17 Mar 2006 08:34:27 -0700 (MST) Received: from [192.168.1.100] (c-67-165-220-189.hsd1.co.comcast.net [67.165.220.189]) by crestone.coronasolutions.com (Postfix) with ESMTP id 026326442FA for ; Fri, 17 Mar 2006 08:34:26 -0700 (MST) Message-ID: <441AD702.9020508@drivefaster.net> Date: Fri, 17 Mar 2006 08:34:26 -0700 From: Dan Harris User-Agent: Thunderbird 1.5 (Macintosh/20060122) MIME-Version: 1.0 To: PostgreSQL Performance Subject: Re: Help optimizing a slow index scan References: <4419DB50.10404@drivefaster.net> <4419DC1C.9070806@drivefaster.net> <684362e10603161915x431c6b08t@mail.gmail.com> In-Reply-To: <684362e10603161915x431c6b08t@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.net 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: 200603/277 X-Sequence-Number: 17714 Markus Bertheau wrote: > Have you tried using a GIST index on lat & long? These things are > meant for two-dimensional data, whereas btree doesn't handle > two-dimensional data that well. How many rows satisfy either of the > long / lat condition? > > >> According to the analyze, less than 500 rows matched. I'll look into GIST indexes, thanks for the feedback. -Dan From pgsql-performance-owner@postgresql.org Fri Mar 17 11:53:45 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 72A6F9DCB4D for ; Fri, 17 Mar 2006 11:53: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 00626-01-2 for ; Fri, 17 Mar 2006 11:53:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by postgresql.org (Postfix) with ESMTP id 1E04B9DCA3C for ; Fri, 17 Mar 2006 11:53:42 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id 5A5C664428A for ; Fri, 17 Mar 2006 08:53:47 -0700 (MST) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11844-10 for ; Fri, 17 Mar 2006 08:53:45 -0700 (MST) Received: from [192.168.1.100] (c-67-165-220-189.hsd1.co.comcast.net [67.165.220.189]) by crestone.coronasolutions.com (Postfix) with ESMTP id 2D7A8644286 for ; Fri, 17 Mar 2006 08:53:45 -0700 (MST) Message-ID: <441ADB88.9010701@drivefaster.net> Date: Fri, 17 Mar 2006 08:53:44 -0700 From: Dan Harris User-Agent: Thunderbird 1.5 (Macintosh/20060122) MIME-Version: 1.0 To: PostgreSQL Performance Subject: Re: Help optimizing a slow index scan References: <4419DB50.10404@drivefaster.net> <4419DC1C.9070806@drivefaster.net> <684362e10603161915x431c6b08t@mail.gmail.com> <441AD702.9020508@drivefaster.net> In-Reply-To: <441AD702.9020508@drivefaster.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.net 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: 200603/278 X-Sequence-Number: 17715 Dan Harris wrote: > Markus Bertheau wrote: >> Have you tried using a GIST index on lat & long? These things are >> meant for two-dimensional data, whereas btree doesn't handle >> two-dimensional data that well. How many rows satisfy either of the >> long / lat condition? >> >> >>> > According to the analyze, less than 500 rows matched. I'll look into > GIST indexes, thanks for the feedback. > > -Dan > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster When I try to create a GIST index, I get the following error: create index eventgeo_lat_idx on eventgeo using GIST (lat); ERROR: data type double precision has no default operator class for access method "gist" HINT: You must specify an operator class for the index or define a default operator class for the data type. I'm not sure what a "default operator class" is, exactly.. -Dan From pgsql-performance-owner@postgresql.org Fri Mar 17 08:59:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 44BEC9DC81A for ; Fri, 17 Mar 2006 08:59: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 70157-01 for ; Fri, 17 Mar 2006 08:59: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 74DEE9DCC01 for ; Fri, 17 Mar 2006 08:59:35 -0400 (AST) Received: from 172.16.1.25 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 17 Mar 2006 07:59:23 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 17 Mar 2006 07:59:22 -0500 Received: from 69.45.100.3 ([69.45.100.3]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.118]) with Microsoft Exchange Server HTTP-DAV ; Fri, 17 Mar 2006 12:59:22 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 17 Mar 2006 07:59:16 -0800 Subject: Re: 1 TB of memory From: "Luke Lonergan" To: "Josh Berkus" , pgsql-performance@postgresql.org cc: "Jim Nasby" Message-ID: Thread-Topic: [PERFORM] 1 TB of memory Thread-Index: AcZJhbEk8bQx3xxdQjGTFTdjpvFr1QAVgzPJ In-Reply-To: <200603162143.25428.josh@agliodbs.com> MIME-Version: 1.0 X-OriginalArrivalTime: 17 Mar 2006 12:59:22.0930 (UTC) FILETIME=[9CC55920:01C649C2] X-WSS-ID: 68046D2120C29043465-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.349 required=5 tests=[AWL=0.096, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.349 X-Spam-Level: * X-Archive-Number: 200603/267 X-Sequence-Number: 17704 Josh, On 3/16/06 9:43 PM, "Josh Berkus" wrote: >> With a single 3 Gbyte/second infiniband connection to the device? > > Hey, take it easy! Jim's post was tongue-in-cheek. You're right - I insulted his bandwidth, sorry :-) - Luke From pgsql-performance-owner@postgresql.org Fri Mar 17 12:56:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 987EA9DCBCC for ; Fri, 17 Mar 2006 12:56: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 12903-01 for ; Fri, 17 Mar 2006 12:56:09 -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 8CC549DCB94 for ; Fri, 17 Mar 2006 12:56:08 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so568855nzo for ; Fri, 17 Mar 2006 08:56: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=KAwj15CAbCC2qi1IVTWRxcqHeIXoZYu64jwoK33OHAfoX9Yggy3Hv0Z1yVUGw3zJ3ooyL64yf944N0KFOxP/MMN/HzOXFoKCGdpsJCdi7yj96BRe4fCo42eBuOvjqJ2o4loeA1Ge5NSkPRIusO973Bqicl+j5/MVbYLDJdStnD0= Received: by 10.65.152.4 with SMTP id e4mr93040qbo; Fri, 17 Mar 2006 08:56:03 -0800 (PST) Received: by 10.65.135.10 with HTTP; Fri, 17 Mar 2006 08:56:03 -0800 (PST) Message-ID: Date: Fri, 17 Mar 2006 11:56:03 -0500 From: "Merlin Moncure" To: "Dan Harris" Subject: Re: Help optimizing a slow index scan Cc: "PostgreSQL Performance" In-Reply-To: <4419DB50.10404@drivefaster.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4419DB50.10404@drivefaster.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.136 required=5 tests=[AWL=0.136] X-Spam-Score: 0.136 X-Spam-Level: X-Archive-Number: 200603/279 X-Sequence-Number: 17716 On 3/16/06, Dan Harris wrote: > explain analyze > select distinct eventmain.incidentid, eventmain.entrydate, > eventgeo.long, eventgeo.lat, eventgeo.geox, eventgeo.geoy > from eventmain, eventgeo > where > eventmain.incidentid =3D eventgeo.incidentid and > ( long > -104.998027962962 and long < -104.985957781349 ) and > ( lat > 39.7075542720006 and lat < 39.7186195832938 ) and > eventmain.entrydate > '2006-1-1 00:00' and > eventmain.entrydate <=3D '2006-3-17 00:00' > order by > eventmain.entrydate; As others will probably mention, effective queries on lot/long which is a spatial problem will require r-tree or gist. I don't have a lot of experience with exotic indexes but this may be the way to go. One easy optimization to consider making is to make an index on either (incidentid, entrydate) or (incident_id,long) which ever is more selective. This is 'yet another query' that would be fun to try out and tweak using the 8.2 upcoming row-wise comparison. merlin From pgsql-performance-owner@postgresql.org Fri Mar 17 12:57:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C88569DCA70 for ; Fri, 17 Mar 2006 12:57: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 09506-10 for ; Fri, 17 Mar 2006 12:57:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from m.wordtothewise.com (goliath.word-to-the-wise.com [208.187.80.130]) by postgresql.org (Postfix) with ESMTP id D40549DCA33 for ; Fri, 17 Mar 2006 12:57:00 -0400 (AST) Received: from [10.3.2.16] (184.word-to-the-wise.com [208.187.80.184]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by m.wordtothewise.com (Postfix) with ESMTP id BB046FF34 for ; Fri, 17 Mar 2006 08:56:59 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <20060317152448.452e4854.eugrid@fpm.kubsu.ru> References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6D84E9DE-E8AB-4C5D-8452-E141DBE9540D@blighty.com> Content-Transfer-Encoding: 7bit From: Steve Atkins Subject: Re: Background writer configuration Date: Fri, 17 Mar 2006 08:56:58 -0800 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=1.176 required=5 tests=[AWL=-0.264, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.176 X-Spam-Level: * X-Archive-Number: 200603/280 X-Sequence-Number: 17717 On Mar 17, 2006, at 4:24 AM, Evgeny Gridasov wrote: > Yesterday we recieved a new server 2xAMD64(2core x 2chips = 4 cores) > 8GB RAM and RAID-1 (LSI megaraid) > I've maid some tests with pgbench (scaling 1000, database size ~ 16Gb) > > First of all, I'd like to mention that it was strange to see that > the server performance degraded by 1-2% when we changed kernel/ > userland to x86_64 > from default installed i386 userland/amd64 kernel. The operating > system was Debian Linux, > filesystem ext3. 64 bit binaries usually run marginally slower than 32 bit binaries. AIUI the main reason is that they're marginally bigger, so fit less well in cache, have to haul themselves over the memory channels and so on. They're couch potato binaries. I've seen over 10% performance loss in compute-intensive code, so a couple of percent isn't too bad at all. If that 64 bit addressing gets you cheap access to lots of RAM, and your main applications can make good use of that then that can easily outweigh the overall loss in performance Cheers, Steve From pgsql-performance-owner@postgresql.org Fri Mar 17 13:19:24 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D802B9DCBBC for ; Fri, 17 Mar 2006 13:19: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 32808-06 for ; Fri, 17 Mar 2006 13:19: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 082169DC83D for ; Fri, 17 Mar 2006 13:19:19 -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 1FKIbd-0001yW-UB for pgsql-performance@postgresql.org; Fri, 17 Mar 2006 18:19:18 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FKIcL-0003aW-00 for ; Fri, 17 Mar 2006 18:20:01 +0100 Date: Fri, 17 Mar 2006 18:20:01 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Background writer configuration Message-ID: <20060317172001.GA13758@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> <6D84E9DE-E8AB-4C5D-8452-E141DBE9540D@blighty.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6D84E9DE-E8AB-4C5D-8452-E141DBE9540D@blighty.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+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.084 required=5 tests=[AWL=0.084] X-Spam-Score: 0.084 X-Spam-Level: X-Archive-Number: 200603/281 X-Sequence-Number: 17718 On Fri, Mar 17, 2006 at 08:56:58AM -0800, Steve Atkins wrote: > 64 bit binaries usually run marginally slower than 32 bit binaries. This depends a bit on the application, and what you mean by "64 bit" (ie. what architecture). Some specialized applications actually benefit from having a 64-bit native data type (especially stuff working with a small amount of bitfields -- think an anagram program), but Postgres is probably not among them unless you do lots of arithmetic on bigints. amd64 has the added benefit that you get twice as many registers available in 64-bit mode (16 vs. 8 -- the benefit gets even bigger when you consider that a few of those go to stack pointers etc.), so in some code you might get a few percent extra from that, too. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Fri Mar 17 13:37:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D65AE9DCBBC for ; Fri, 17 Mar 2006 13:36: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 55238-07 for ; Fri, 17 Mar 2006 13:36:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id EF5099DC842 for ; Fri, 17 Mar 2006 13:36:55 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 4DB8056431; Fri, 17 Mar 2006 11:36:55 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 17 Mar 2006 11:36:54 -0600 Date: Fri, 17 Mar 2006 11:36:53 -0600 From: "Jim C. Nasby" To: Luke Lonergan Cc: pgsql-performance@postgresql.org Subject: Re: 1 TB of memory Message-ID: <20060317173653.GC15742@pervasive.com> References: <8B16F5C8-DFC8-4694-902C-AE584E490530@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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060317:llonergan@greenplum.com::PD5qmBGOk3+vDWmO:00000000000000 000000000000000000000000Dfoh X-Hashcash: 1:20:060317:pgsql-performance@postgresql.org::yF/+YMecudZTbPG2:00000 0000000000000000000000002KgL X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/282 X-Sequence-Number: 17719 On Thu, Mar 16, 2006 at 10:44:25PM -0800, Luke Lonergan wrote: > Jim, > > > PostgreSQL tuned to the max and still too slow? Database too big to > > fit into memory? Here's the solution! http://www.superssd.com/ > > products/tera-ramsan/ > > With a single 3 Gbyte/second infiniband connection to the device? > > You'd be better off with 4 x $10K servers that do 800MB/s from disk each and > a Bizgres MPP - then you'd do 3.2GB/s (faster than the SSD) at a price 1/10 > of the SSD, and you'd have 24TB of RAID5 disk under you. > > Plus - need more speed? Add 12 more servers, and you'd run at 12.8GB/s and > have 96TB of disk to work with, and you'd *still* spend less on HW and SW > than the SSD. Now what happens as soon as you start doing random I/O? :) -- 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 Mar 17 13:37:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B83579DCBA3 for ; Fri, 17 Mar 2006 13:37: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 67881-03 for ; Fri, 17 Mar 2006 13:37:07 -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 2D6E19DCBD4 for ; Fri, 17 Mar 2006 13:37:06 -0400 (AST) Received: (qmail 19734 invoked by uid 500); 17 Mar 2006 17:38:28 -0000 Date: Fri, 17 Mar 2006 11:38:27 -0600 From: Bruno Wolff III To: Dan Harris Cc: PostgreSQL Performance Subject: Re: Help optimizing a slow index scan Message-ID: <20060317173827.GB15967@wolff.to> Mail-Followup-To: Bruno Wolff III , Dan Harris , PostgreSQL Performance References: <4419DB50.10404@drivefaster.net> <4419DC1C.9070806@drivefaster.net> <684362e10603161915x431c6b08t@mail.gmail.com> <441AD702.9020508@drivefaster.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <441AD702.9020508@drivefaster.net> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/283 X-Sequence-Number: 17720 On Fri, Mar 17, 2006 at 08:34:26 -0700, Dan Harris wrote: > Markus Bertheau wrote: > >Have you tried using a GIST index on lat & long? These things are > >meant for two-dimensional data, whereas btree doesn't handle > >two-dimensional data that well. How many rows satisfy either of the > >long / lat condition? > > > > > >> > According to the analyze, less than 500 rows matched. I'll look into > GIST indexes, thanks for the feedback. Have you looked at using the Earth Distance contrib module? If a spherical model of the earth is suitable for your application, then it may work for you and might be easier than trying to create Gist indexes yourself. From pgsql-performance-owner@postgresql.org Fri Mar 17 13:56:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E03F09DCB80 for ; Fri, 17 Mar 2006 13:56: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 03524-07 for ; Fri, 17 Mar 2006 13:56:43 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 3AA279DCA86 for ; Fri, 17 Mar 2006 13:56:42 -0400 (AST) Received: from ludojad.itpp.pl (ludojad.itpp.pl [193.41.112.10]) by svr4.postgresql.org (Postfix) with ESMTP id A14AE5AF030 for ; Fri, 17 Mar 2006 17:56:42 +0000 (GMT) Received: from [172.16.1.3] (localhost [127.0.0.1]) by ludojad.itpp.pl (Postfix) with ESMTP id 771C52E03E; Fri, 17 Mar 2006 18:56:39 +0100 (CET) In-Reply-To: <20060317175017.e15f2151.eugrid@fpm.kubsu.ru> References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> <20060317175017.e15f2151.eugrid@fpm.kubsu.ru> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: 11 Subject: Re: Background writer configuration Date: Fri, 17 Mar 2006 18:56:32 +0100 To: Evgeny Gridasov X-Mailer: Apple Mail (2.746.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: 200603/284 X-Sequence-Number: 17721 On 2006-03-17, at 15:50, Evgeny Gridasov wrote: > template1=# select version(); > version > ---------------------------------------------------------------------- > ----------------------- > PostgreSQL 8.1.3 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) > 3.3.5 (Debian 1:3.3.5-13) > (1 row) How about something like: $ file /usr/lib/postgresql/bin/postgres (or whatever directory postmaster binary is in) instead? -- 11. From pgsql-performance-owner@postgresql.org Fri Mar 17 14:07:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4B3D49DCA6D for ; Fri, 17 Mar 2006 14:07: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 12009-10 for ; Fri, 17 Mar 2006 14:07:36 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by postgresql.org (Postfix) with ESMTP id B51989DCA33 for ; Fri, 17 Mar 2006 14:07:34 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so581648nzo for ; Fri, 17 Mar 2006 10:07: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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Hp/sf6gLr2vg502oV07DesBhHhRujlJZVyylvoO+YVgJ97QLZWLfbOxjAv2oePVXnFWVk99zrTEUxckJg7GFe0UzUVgo2tjJ2GJk05TLwcMuzQERSXKyUkJ3+pN1g/596RZMtsmPawoTJbx/jxvZZXl4NTAgweIzcvqQP4diANE= Received: by 10.65.110.12 with SMTP id n12mr384275qbm; Fri, 17 Mar 2006 10:07:34 -0800 (PST) Received: by 10.65.135.10 with HTTP; Fri, 17 Mar 2006 10:07:34 -0800 (PST) Message-ID: Date: Fri, 17 Mar 2006 13:07:34 -0500 From: "Merlin Moncure" To: "Bruno Wolff III" , "Dan Harris" , "PostgreSQL Performance" Subject: Re: Help optimizing a slow index scan In-Reply-To: <20060317173827.GB15967@wolff.to> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4419DB50.10404@drivefaster.net> <4419DC1C.9070806@drivefaster.net> <684362e10603161915x431c6b08t@mail.gmail.com> <441AD702.9020508@drivefaster.net> <20060317173827.GB15967@wolff.to> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.136 required=5 tests=[AWL=0.136] X-Spam-Score: 0.136 X-Spam-Level: X-Archive-Number: 200603/285 X-Sequence-Number: 17722 On 3/17/06, Bruno Wolff III wrote: > Have you looked at using the Earth Distance contrib module? If a spherica= l > model of the earth is suitable for your application, then it may work for= you > and might be easier than trying to create Gist indexes yourself. earth distance =3D great stuff. If the maximum error is known then you can just pad the distance and filter the result on the client if exact precision is needed. Merlin From pgsql-performance-owner@postgresql.org Fri Mar 17 14:36:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C61A19DCB94 for ; Fri, 17 Mar 2006 14:36: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 92701-01 for ; Fri, 17 Mar 2006 14:36:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) by postgresql.org (Postfix) with ESMTP id 9000D9DCBD4 for ; Fri, 17 Mar 2006 14:36:08 -0400 (AST) Received: from [192.168.0.250] (helo=deepcore.i-free.ru) by office1.i-free.ru with smtp (Exim 3.36 #1 (Debian)) id 1FKJnx-0003Zk-00; Fri, 17 Mar 2006 21:36:05 +0300 Date: Fri, 17 Mar 2006 21:36:06 +0300 From: Evgeny Gridasov To: 11 Cc: pgsql-performance@postgresql.org Subject: Re: Background writer configuration Message-Id: <20060317213606.b8f037b4.eugrid@fpm.kubsu.ru> In-Reply-To: References: <44181A11.EE98.0025.0@wicourts.gov> <20060316211523.73343cee.eugrid@fpm.kubsu.ru> <44198B3D.EE98.0025.0@wicourts.gov> <20060317152448.452e4854.eugrid@fpm.kubsu.ru> <20060317175017.e15f2151.eugrid@fpm.kubsu.ru> X-Mailer: Sylpheed version 2.2.3 (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.1 required=5 tests=[AWL=0.100] X-Spam-Score: 0.1 X-Spam-Level: X-Archive-Number: 200603/286 X-Sequence-Number: 17723 eugene@test:~$ file /usr/lib/postgresql/8.1/bin/postgres /usr/lib/postgresql/8.1/bin/postgres: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.0, dynamically linked (uses shared libs), stripped On Fri, 17 Mar 2006 18:56:32 +0100 11 wrote: > On 2006-03-17, at 15:50, Evgeny Gridasov wrote: > > > template1=# select version(); > > version > > ---------------------------------------------------------------------- > > ----------------------- > > PostgreSQL 8.1.3 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) > > 3.3.5 (Debian 1:3.3.5-13) > > (1 row) > > How about something like: > $ file /usr/lib/postgresql/bin/postgres > (or whatever directory postmaster binary is in) instead? -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Sat Mar 18 22:25:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AF5559DC842 for ; Fri, 17 Mar 2006 15: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 68276-06 for ; Fri, 17 Mar 2006 15:32:57 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id AB7299DC871 for ; Fri, 17 Mar 2006 15:32:55 -0400 (AST) Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) by svr4.postgresql.org (Postfix) with ESMTP id F3F465AF198 for ; Fri, 17 Mar 2006 19:32:56 +0000 (GMT) Received: from [192.168.0.185] (helo=mail.i-free.local) by office1.i-free.ru with esmtp (Exim 3.36 #1 (Debian)) id 1FKKgt-0007cC-00; Fri, 17 Mar 2006 22:32:51 +0300 Received: from deepcore.i-free.ru ([192.168.0.250]) by mail.i-free.local with Microsoft SMTPSVC(6.0.3790.1830); Fri, 17 Mar 2006 22:32:47 +0300 Date: Fri, 17 Mar 2006 22:32:53 +0300 From: Evgeny Gridasov To: Dan Harris Cc: pgsql-performance@postgresql.org Subject: Re: Help optimizing a slow index scan Message-Id: <20060317223253.38c0e6b9.eugene@i-free.ru> In-Reply-To: <441ADB88.9010701@drivefaster.net> References: <4419DB50.10404@drivefaster.net> <4419DC1C.9070806@drivefaster.net> <684362e10603161915x431c6b08t@mail.gmail.com> <441AD702.9020508@drivefaster.net> <441ADB88.9010701@drivefaster.net> Organization: i-free.ru X-Mailer: Sylpheed version 2.2.3 (GTK+ 2.6.2; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Mar 2006 19:32:47.0165 (UTC) FILETIME=[91FDC6D0:01C649F9] 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: 200603/311 X-Sequence-Number: 17748 Try contrib/btree_gist. I've tried that one, but for my case it didn't help much. The performance was almost equal or even slower than built-in btree. On Fri, 17 Mar 2006 08:53:44 -0700 Dan Harris wrote: > Dan Harris wrote: > > Markus Bertheau wrote: > >> Have you tried using a GIST index on lat & long? These things are > >> meant for two-dimensional data, whereas btree doesn't handle > >> two-dimensional data that well. How many rows satisfy either of the > >> long / lat condition? > >> > >> > >>> > > According to the analyze, less than 500 rows matched. I'll look into > > GIST indexes, thanks for the feedback. > > > > -Dan > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 2: Don't 'kill -9' the postmaster > > When I try to create a GIST index, I get the following error: > > create index eventgeo_lat_idx on eventgeo using GIST (lat); > > ERROR: data type double precision has no default operator class for > access method "gist" > HINT: You must specify an operator class for the index or define a > default operator class for the data type. > > I'm not sure what a "default operator class" is, exactly.. > > -Dan > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > -- Evgeny Gridasov Software Engineer I-Free, Russia From pgsql-performance-owner@postgresql.org Fri Mar 17 16:45:00 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DAA1A9DCD59 for ; Fri, 17 Mar 2006 16:44: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 93432-03 for ; Fri, 17 Mar 2006 16:45:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by postgresql.org (Postfix) with ESMTP id 064899DCD4F for ; Fri, 17 Mar 2006 16:44:56 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id 95EFF6443FB for ; Fri, 17 Mar 2006 13:44:57 -0700 (MST) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 17843-06 for ; Fri, 17 Mar 2006 13:44:55 -0700 (MST) Received: from [192.168.1.100] (c-67-165-220-189.hsd1.co.comcast.net [67.165.220.189]) by crestone.coronasolutions.com (Postfix) with ESMTP id 034CF64439F for ; Fri, 17 Mar 2006 13:44:55 -0700 (MST) Message-ID: <441B1FC6.60001@drivefaster.net> Date: Fri, 17 Mar 2006 13:44:54 -0700 From: Dan Harris User-Agent: Thunderbird 1.5 (Macintosh/20060122) MIME-Version: 1.0 To: PostgreSQL Performance Subject: Re: Help optimizing a slow index scan References: <4419DB50.10404@drivefaster.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.net 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: 200603/288 X-Sequence-Number: 17725 Merlin Moncure wrote: > As others will probably mention, effective queries on lot/long which > is a spatial problem will require r-tree or gist. I don't have a lot > of experience with exotic indexes but this may be the way to go. > > One easy optimization to consider making is to make an index on either > (incidentid, entrydate) or (incident_id,long) which ever is more > selective. > > This is 'yet another query' that would be fun to try out and tweak > using the 8.2 upcoming row-wise comparison. > > merlin > Thanks to everyone for your suggestions. One problem I ran into is that apparently my version doesn't support the GIST index that was mentioned. "function 'box' doesn't exist" ).. So I'm guessing that both this as well as the Earth Distance contrib require me to add on some more pieces that aren't there. Furthermore, by doing so, I am tying my queries directly to "postgres-isms". One of the long term goals of this project is to be able to fairly transparently support any ANSI SQL-compliant back end with the same code base. If I had full control over the query designs, I could make stored procedures to abstract this. However, I have to deal with a "gray box" third-party reporting library that isn't so flexible. I'll certainly consider going with something postgre-specific, but only as a last resort. I tried the multi-column index as mentioned above but didn't see any noticeable improvement in elapsed time, although the planner did use the new index. What is the real reason for the index not being very effective on these columns? Although the numbers are in a very limited range, it seems that the records would be very selective as it's not terribly common for multiple rows to share the same coords. Is the "8.2. upcoming row-wise comparison" something that would be likely to help me? Thanks again for your input From pgsql-performance-owner@postgresql.org Fri Mar 17 17:28:08 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3B4029DC8A8 for ; Fri, 17 Mar 2006 17:28: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 01638-09 for ; Fri, 17 Mar 2006 17:28:08 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by postgresql.org (Postfix) with ESMTP id 88E7D9DC842 for ; Fri, 17 Mar 2006 17:28:05 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so611766nzo for ; Fri, 17 Mar 2006 13:28: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=SgjC2cLSmKE6KXnp1qx9L14ocaWSbYz+AKwsyEA3Kf7/Gvy17cHE/r5ZZTaPaxm4ZmPlKfJFoRtcI2O1MMlCm8avQd0tVoM34udIpWd+2/aG6+c3VGMFoeE2pRj3CPrrfIvnxZrhbc3MOwHuZ2IgztI0dpozKVl3adee3SsC3sM= Received: by 10.65.241.9 with SMTP id t9mr552602qbr; Fri, 17 Mar 2006 13:28:07 -0800 (PST) Received: by 10.65.135.10 with HTTP; Fri, 17 Mar 2006 13:28:07 -0800 (PST) Message-ID: Date: Fri, 17 Mar 2006 16:28:07 -0500 From: "Merlin Moncure" To: "Luke Lonergan" Subject: Re: 1 TB of memory Cc: "Jim C. Nasby" , 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: <20060317173653.GC15742@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.135 required=5 tests=[AWL=0.135] X-Spam-Score: 0.135 X-Spam-Level: X-Archive-Number: 200603/289 X-Sequence-Number: 17726 On 3/17/06, Luke Lonergan wrote: > > Now what happens as soon as you start doing random I/O? :) > If you are accessing 3 rows at a time from among billions, the problem yo= u > have is mostly access time - so an SSD might be very good for some OLTP > applications. However - the idea of putting Terabytes of data into an SS= D > through a thin straw of a channel is silly. I'll 'byte' on this..right now the price for gigabyte of ddr ram is hovering around 60$/gigabyte. If you conveniently leave aside the problem of making ddr ram fault tolerant vs making disks tolerant, you are getting 10 orders of magnitude faster seek time and unlimited bandwidth...at least from the physical device. While SANs are getting cheaper they are still fairly expensive at 1-5$/gigabyte depending on various factors. You can do the same tricks on SSD storage as with disks. SSD storage is 1-2k$/gigabyte currently, but I think there is huge room to maneuver price-wise after the major players recoup their investments and market forces kick in. IMO this process is already in play and the next cycle of hardware upgrades in the enterprise will be updating critical servers with SSD storage. Im guessing by as early 2010 a significant percentage of enterpise storage will be SSD of some flavor. merlin From pgsql-performance-owner@postgresql.org Fri Mar 17 17:41:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 60C1C9DCBD4 for ; Fri, 17 Mar 2006 17:41: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 06960-09 for ; Fri, 17 Mar 2006 17:41:41 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by postgresql.org (Postfix) with ESMTP id 641DB9DCBD2 for ; Fri, 17 Mar 2006 17:41:37 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so613472nzo for ; Fri, 17 Mar 2006 13:41:39 -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=Qj0lG+5bsfEuPIm356kRGzMPMejmWtI6BxnJHqTB3b91ivQHPEDiLnoSbb1DHJzvTpdxETI7siO7qKZYnOnNKfaqh1eAxGuaRoNzu9AY52BTNUJHQP1o8kU5ny9cvu0Q2MMW3aM6SxAUHEJqw55dnrp/YiTvPer86KYQk04esuY= Received: by 10.64.143.12 with SMTP id q12mr560910qbd; Fri, 17 Mar 2006 13:41:38 -0800 (PST) Received: by 10.65.135.10 with HTTP; Fri, 17 Mar 2006 13:41:38 -0800 (PST) Message-ID: Date: Fri, 17 Mar 2006 16:41:38 -0500 From: "Merlin Moncure" To: "Dan Harris" Subject: Re: Help optimizing a slow index scan Cc: "PostgreSQL Performance" In-Reply-To: <441B1FC6.60001@drivefaster.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4419DB50.10404@drivefaster.net> <441B1FC6.60001@drivefaster.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.134 required=5 tests=[AWL=0.134] X-Spam-Score: 0.134 X-Spam-Level: X-Archive-Number: 200603/290 X-Sequence-Number: 17727 On 3/17/06, Dan Harris wrote: > Merlin Moncure wrote: > Thanks to everyone for your suggestions. One problem I ran into is that > apparently my version doesn't support the GIST index that was > mentioned. "function 'box' doesn't exist" ).. So I'm guessing that both > this as well as the Earth Distance contrib require me to add on some > more pieces that aren't there. earth distance is a contrib module that has to be built and installed. it does use some pg-isms so I guess that can be ruled out. GIST is a bit more complex and I would consider reading the documentation very carefully regarding them and make your own determination. > Furthermore, by doing so, I am tying my queries directly to > "postgres-isms". [snip] > I tried the multi-column index as mentioned above but didn't see any > noticeable improvement in elapsed time, although the planner did use the > new index. did you try both flavors of the multiple key index I suggested? (there were other possiblities, please experiment) > Is the "8.2. upcoming row-wise comparison" something that would be > likely to help me? possibly. good news is that rwc is ansi sql. you can see my blog about it here: http://people.planetpostgresql.org/merlin/ Specifically, if you can order your table with an order by statement such that the records you want are contingous, then yes. However, even though it's ansi sql, various commercial databases implement rwc improperly or not at all (mysql, to their credit, gets it right) and I still feel like an exotic index or some other nifty pg trick might be the best performance approach here). Merlin From pgsql-performance-owner@postgresql.org Fri Mar 17 18:07:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0EA869DC8A8 for ; Fri, 17 Mar 2006 18:07: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 26516-05 for ; Fri, 17 Mar 2006 18:07:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id C999E9DC842 for ; Fri, 17 Mar 2006 18:07:06 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Fri, 17 Mar 2006 22:07:08 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 17 Mar 2006 16:07:08 -0600 Subject: Re: 1 TB of memory From: Scott Marlowe To: Merlin Moncure Cc: Luke Lonergan , "Jim C. Nasby" , pgsql-performance@postgresql.org In-Reply-To: References: <20060317173653.GC15742@pervasive.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142633228.1141.7.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 17 Mar 2006 16:07:08 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.147 required=5 tests=[AWL=0.146, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.147 X-Spam-Level: X-Archive-Number: 200603/291 X-Sequence-Number: 17728 On Fri, 2006-03-17 at 15:28, Merlin Moncure wrote: > On 3/17/06, Luke Lonergan wrote: > > > Now what happens as soon as you start doing random I/O? :) > > If you are accessing 3 rows at a time from among billions, the problem you > > have is mostly access time - so an SSD might be very good for some OLTP > > applications. However - the idea of putting Terabytes of data into an SSD > > through a thin straw of a channel is silly. > > I'll 'byte' on this..right now the price for gigabyte of ddr ram is > hovering around 60$/gigabyte. If you conveniently leave aside the > problem of making ddr ram fault tolerant vs making disks tolerant, you > are getting 10 orders of magnitude faster seek time and unlimited > bandwidth...at least from the physical device. While SANs are getting > cheaper they are still fairly expensive at 1-5$/gigabyte depending on > various factors. You can do the same tricks on SSD storage as with > disks. > > SSD storage is 1-2k$/gigabyte currently, but I think there is huge > room to maneuver price-wise after the major players recoup their > investments and market forces kick in. IMO this process is already in > play and the next cycle of hardware upgrades in the enterprise will be > updating critical servers with SSD storage. Im guessing by as early > 2010 a significant percentage of enterpise storage will be SSD of some > flavor. Now I'm envisioning building something with commodity 1U servers hold 4 to 16 gigs ram, and interconnected with 1g or 10g ethernet. Open Source SSD via iSCSI with commodity hardware... hmmm. sounds like a useful project. From pgsql-performance-owner@postgresql.org Fri Mar 17 18:11:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 80F759DC842 for ; Fri, 17 Mar 2006 18:11: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 29688-02 for ; Fri, 17 Mar 2006 18:11:20 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id C77679DCC35 for ; Fri, 17 Mar 2006 18:11:16 -0400 (AST) Received: from colo-dns-ext2.juniper.net (colo-dns-ext2.juniper.net [207.17.137.64]) by svr4.postgresql.org (Postfix) with ESMTP id 5CE0A5AF9F1 for ; Fri, 17 Mar 2006 22:11:19 +0000 (GMT) Received: from merlot.juniper.net (merlot.juniper.net [172.17.27.10]) by colo-dns-ext2.juniper.net (8.12.3/8.12.3) with ESMTP id k2HMBH1Z095022 for ; Fri, 17 Mar 2006 14:11:17 -0800 (PST) (envelope-from kenjim@juniper.net) Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [172.17.58.60]) by merlot.juniper.net (8.11.3/8.11.3) with ESMTP id k2HMBH591931; Fri, 17 Mar 2006 14:11:17 -0800 (PST) (envelope-from kenjim@juniper.net) Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [127.0.0.1]) by kenjim-lnx.juniper.net (8.13.4/8.13.4) with ESMTP id k2HMBHRv015694; Fri, 17 Mar 2006 14:11:17 -0800 Received: (from kenjim@localhost) by kenjim-lnx.juniper.net (8.13.4/8.13.4/Submit) id k2HMBG5L015693; Fri, 17 Mar 2006 14:11:16 -0800 Date: Fri, 17 Mar 2006 14:11:16 -0800 From: Kenji Morishige To: pgsql-performance@postgresql.org Cc: kenjim@juniper.net Subject: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Message-ID: <20060317221116.GA14661@juniper.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" 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: 200603/292 X-Sequence-Number: 17729 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline About a year ago we decided to migrate our central database that powers various intranet tools from MySQL to PostgreSQL. We have about 130 tables and about 10GB of data that stores various status information for a variety of services for our intranet. We generally have somewhere between 150-200 connections to the database at any given time and probably anywhere between 5-10 new connections being made every second and about 100 queries per second. Most of the queries and transactions are very small due to the fact that the tools were designed to work around the small functionality of MySQL 3.23 DB. Our company primarily uses FreeBSD and we are stuck on FreeBSD 4.X series due to IT support issues, but I believe I may be able to get more performance out of our server by reconfiguring and setting up the postgresql.conf file up better. The performance is not as good as I was hoping at the moment and it seems as if the database is not making use of the available ram. snapshot of active server: last pid: 5788; load averages: 0.32, 0.31, 0.28 up 127+15:16:08 13:59:24 169 processes: 1 running, 168 sleeping CPU states: 5.4% user, 0.0% nice, 9.9% system, 0.0% interrupt, 84.7% idle Mem: 181M Active, 2632M Inact, 329M Wired, 179M Cache, 199M Buf, 81M Free Swap: 4096M Total, 216K Used, 4096M Free PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND 14501 pgsql 2 0 254M 242M select 2 76:26 1.95% 1.95% postgre 5720 root 28 0 2164K 1360K CPU0 0 0:00 1.84% 0.88% top 5785 pgsql 2 0 255M 29296K sbwait 0 0:00 3.00% 0.15% postgre 5782 pgsql 2 0 255M 11900K sbwait 0 0:00 3.00% 0.15% postgre 5772 pgsql 2 0 255M 11708K sbwait 2 0:00 1.54% 0.15% postgre Here is my current configuration: Dual Xeon 3.06Ghz 4GB RAM Adaptec 2200S 48MB cache & 4 disks configured in RAID5 FreeBSD 4.11 w/kernel options: options SHMMAXPGS=65536 options SEMMNI=256 options SEMMNS=512 options SEMUME=256 options SEMMNU=256 options SMP # Symmetric MultiProcessor Kernel options APIC_IO # Symmetric (APIC) I/O The OS is installed on the local single disk and postgres data directory is on the RAID5 partition. Maybe Adaptec 2200S RAID5 performance is not as good as the vendor claimed. It was my impression that the raid controller these days are optimized for RAID5 and going RAID10 would not benefit me much. Also, I may be overlooking a postgresql.conf setting. I have attached the config file. In summary, my questions: 1. Would running PG on FreeBSD 5.x or 6.x or Linux improve performance? 2. Should I change SCSI controller config to use RAID 10 instead of 5? 3. Why isn't postgres using all 4GB of ram for at least caching table for reads? 4. Are there any other settings in the conf file I could try to tweak? --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; 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' # the host-based authentication file # ident_file = 'ConfigDir/pg_ident.conf' # the IDENT configuration file # If external_pid_file is not explicitly set, no extra pid file is written. # external_pid_file = '(none)' # write an extra pid file #--------------------------------------------------------------------------- # CONNECTIONS AND AUTHENTICATION #--------------------------------------------------------------------------- # - Connection Settings - listen_addresses = '*' # what IP interface(s) to listen on; # defaults to localhost, '*' = any port = 5432 max_connections = 450 # note: increasing max_connections costs about 500 bytes of shared # memory per connection slot, in addition to costs from shared_buffers # and max_locks_per_transaction. superuser_reserved_connections = 2 #unix_socket_directory = '' #unix_socket_group = '' #unix_socket_permissions = 0777 # octal #rendezvous_name = '' # defaults to the computer name # - Security & Authentication - #authentication_timeout = 60 # 1-600, in seconds #ssl = false #password_encryption = true #krb_server_keyfile = '' #db_user_namespace = false #--------------------------------------------------------------------------- # RESOURCE USAGE (except WAL) #--------------------------------------------------------------------------- # - Memory - shared_buffers = 30000 # min 16, at least max_connections*2, 8KB each #shared_buffers = 40000 # min 16, at least max_connections*2, 8KB each work_mem = 16384 # min 64, size in KB maintenance_work_mem = 256000 # min 1024, size in KB max_stack_depth = 16384 # min 100, size in KB # - Free Space Map - #max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 1000 # min 100, ~50 bytes each # - Kernel Resource Usage - #max_files_per_process = 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_percent = 1 # 0-100% of dirty buffers in each round #bgwriter_maxpages = 100 # 0-1000 buffers max per round #--------------------------------------------------------------------------- # WRITE AHEAD LOG #--------------------------------------------------------------------------- # - Settings - #fsync = true # turns forced synchronization on or off #wal_sync_method = fsync # the default varies across platforms: # fsync, fdatasync, open_sync, or open_datasync #wal_buffers = 8 # min 4, 8KB each #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 # - Checkpoints - #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each checkpoint_segments = 12 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 300 # range 30-3600, in seconds checkpoint_timeout = 600 # range 30-3600, in seconds #checkpoint_warning = 30 # 0 is off, in seconds checkpoint_warning = 60 # 0 is off, in seconds # - Archiving - #archive_command = '' # command to use to archive a logfile segment #--------------------------------------------------------------------------- # QUERY TUNING #--------------------------------------------------------------------------- # - Planner Method Configuration - #enable_hashagg = true #enable_hashjoin = true #enable_indexscan = true #enable_mergejoin = true #enable_nestloop = true #enable_seqscan = true #enable_sort = true #enable_tidscan = true # - Planner Cost Constants - effective_cache_size = 300000 # typically 8KB each random_page_cost = 2.5 # units are one sequential page fetch cost #cpu_tuple_cost = 0.01 # (same) #cpu_index_tuple_cost = 0.001 # (same) #cpu_operator_cost = 0.0025 # (same) # - Genetic Query Optimizer - #geqo = true #geqo_threshold = 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 #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 relevant when logging to stderr: #redirect_stderr = false # Enable capturing of stderr into log files. # These are only relevant if redirect_stderr is true: log_directory = 'pg_log' # Directory where log files are written. # May be specified absolute or relative to PGDATA #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern. log_filename = 'postgresql-%Y%m%d.log' # Log file name pattern. # May include strftime() escapes log_truncate_on_rotation = false # If true, any existing log file of the # same name as the new log file will be truncated # rather than appended to. But such truncation # only occurs on time-driven rotation, # not on restarts or size-driven rotation. # Default is false, meaning append to existing # files in all cases. log_rotation_age = 0 # Automatic rotation of logfiles will happen after # so many minutes. 0 to disable. log_rotation_size = 500000 # 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 = notice # Values in order of increasing severity: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, panic(off) log_min_duration_statement = 2000 # -1 is disabled, in milliseconds. #silent_mode = false # DO NOT USE without syslog or redirect_stderr # - What to Log - #debug_print_parse = true #debug_print_rewritten = false #debug_print_plan = false #debug_pretty_print = false #log_connections = true #log_disconnections = false #log_duration = false log_line_prefix = '%t %u %d %r ' # e.g. '<%u%%%d> ' # %u=user name %d=database name # %r=remote host and port # %p=PID %t=timestamp %i=command tag # %c=session id %l=session line number # %s=session start timestamp %x=transaction id # %q=stop here in non-session processes # %%='%' #log_statement = 'all' # none, mod, ddl, all log_hostname = true #--------------------------------------------------------------------------- # RUNTIME STATISTICS #--------------------------------------------------------------------------- # - Statistics Monitoring - #log_parser_stats = false #log_planner_stats = false #log_executor_stats = false #log_statement_stats = false # - Query/Index Statistics Collector - # defaults, kenji turned it on 2005 Aug 2 stats_start_collector = true #stats_command_string = false #stats_block_level = false stats_row_level = true stats_reset_on_server_start = true #--------------------------------------------------------------------------- # CLIENT CONNECTION DEFAULTS #--------------------------------------------------------------------------- # - Statement Behavior - #search_path = '$user,public' # schema names #default_tablespace = '' # a tablespace name, or '' for default #check_function_bodies = true #default_transaction_isolation = 'read committed' #default_transaction_read_only = false #statement_timeout = 0 # 0 is disabled, in milliseconds # - Locale and Formatting - #datestyle = 'iso, mdy' #timezone = unknown # actually, defaults to TZ environment setting #australian_timezones = false #extra_float_digits = 0 # min -15, max 2 #client_encoding = sql_ascii # actually, defaults to database encoding # These settings are initialized by initdb -- they 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 = true #dynamic_library_path = '$libdir' #--------------------------------------------------------------------------- # LOCK MANAGEMENT #--------------------------------------------------------------------------- #deadlock_timeout = 1000 # in milliseconds #max_locks_per_transaction = 64 # min 10, ~200*max_connections bytes each #--------------------------------------------------------------------------- # VERSION/PLATFORM COMPATIBILITY #--------------------------------------------------------------------------- # - Previous Postgres Versions - #add_missing_from = true #regex_flavor = advanced # advanced, extended, or basic #sql_inheritance = true #default_with_oids = true # - Other Platforms & Clients - #transform_null_equals = false --0OAP2g/MAC+5xKAE-- From pgsql-performance-owner@postgresql.org Fri Mar 17 19:00:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BDE8F9DC8A8 for ; Fri, 17 Mar 2006 19:00: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 35776-05 for ; Fri, 17 Mar 2006 19:00:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 6FEDA9DC871 for ; Fri, 17 Mar 2006 19:00:32 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Fri, 17 Mar 2006 23:00:34 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 17 Mar 2006 17:00:34 -0600 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: Scott Marlowe To: Kenji Morishige Cc: pgsql-performance@postgresql.org In-Reply-To: <20060317221116.GA14661@juniper.net> References: <20060317221116.GA14661@juniper.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142636433.1141.33.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 17 Mar 2006 17:00:34 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.147 required=5 tests=[AWL=0.146, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.147 X-Spam-Level: X-Archive-Number: 200603/293 X-Sequence-Number: 17730 On Fri, 2006-03-17 at 16:11, Kenji Morishige wrote: > About a year ago we decided to migrate our central database that powers various > intranet tools from MySQL to PostgreSQL. We have about 130 tables and about > 10GB of data that stores various status information for a variety of services > for our intranet. We generally have somewhere between 150-200 connections to > the database at any given time and probably anywhere between 5-10 new > connections being made every second and about 100 queries per second. Most > of the queries and transactions are very small due to the fact that the tools > were designed to work around the small functionality of MySQL 3.23 DB. > Our company primarily uses FreeBSD and we are stuck on FreeBSD 4.X series due > to IT support issues, There were a LOT of performance enhancements to FreeBSD with the 5.x series release. I'd recommend fast tracking the database server to the 5.x branch. 4-stable was release 6 years ago. 5-stable was released two years ago. > but I believe I may be able to get more performance out > of our server by reconfiguring and setting up the postgresql.conf file up > better. Can't hurt. But if your OS isn't doing the job, postgresql.conf can only do so much, nee? > The performance is not as good as I was hoping at the moment and > it seems as if the database is not making use of the available ram. > snapshot of active server: > last pid: 5788; load averages: 0.32, 0.31, 0.28 up 127+15:16:08 13:59:24 > 169 processes: 1 running, 168 sleeping > CPU states: 5.4% user, 0.0% nice, 9.9% system, 0.0% interrupt, 84.7% idle > Mem: 181M Active, 2632M Inact, 329M Wired, 179M Cache, 199M Buf, 81M Free > Swap: 4096M Total, 216K Used, 4096M Free > > PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND > 14501 pgsql 2 0 254M 242M select 2 76:26 1.95% 1.95% postgre > 5720 root 28 0 2164K 1360K CPU0 0 0:00 1.84% 0.88% top > 5785 pgsql 2 0 255M 29296K sbwait 0 0:00 3.00% 0.15% postgre > 5782 pgsql 2 0 255M 11900K sbwait 0 0:00 3.00% 0.15% postgre > 5772 pgsql 2 0 255M 11708K sbwait 2 0:00 1.54% 0.15% postgre That doesn't look good. Is this machine freshly rebooted, or has it been running postgres for a while? 179M cache and 199M buffer with 2.6 gig inactive is horrible for a machine running a 10gig databases. For comparison, here's what my production linux boxes show in top: 16:42:27 up 272 days, 14:49, 1 user, load average: 1.02, 1.04, 1.00 162 processes: 161 sleeping, 1 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 0.2% 0.0% 0.4% 0.0% 0.0% 0.4% 98.7% cpu00 0.4% 0.0% 0.4% 0.0% 0.0% 0.0% 99.0% cpu01 0.0% 0.0% 0.4% 0.0% 0.0% 0.9% 98.5% Mem: 6096912k av, 4529208k used, 1567704k free, 0k shrd, 306884k buff 2398948k actv, 1772072k in_d, 78060k in_c Swap: 4192880k av, 157480k used, 4035400k free 3939332k cached PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND 24000 postgres 15 0 752 524 456 S 0.0 0.0 0:00 1 rotatelogs 24012 postgres 15 0 1536 1420 1324 S 0.0 0.0 7:11 0 postmaster 24015 postgres 15 0 2196 2032 996 S 0.0 0.0 56:07 0 postmaster 24016 postgres 15 0 1496 1352 1004 S 0.0 0.0 233:46 1 postmaster Note that the kernel here is caching ~3.9 gigs of data. so, postgresql doesn't have to. Also, the disk buffers are sitting at > 300 Megs. If FreeBSD 4.x can't or won't cache more than that, there's an OS issue here, either endemic to FreeBSD 4.x, or your configuration of it. > Dual Xeon 3.06Ghz 4GB RAM Make sure hyperthreading is disabled, it's generally a performance loss for pgsql. > Adaptec 2200S 48MB cache & 4 disks configured in RAID5 I'm not a huge fan of adaptec RAID controllers, and 48 Megs ain't much. But for what you're doing, I'd expect it to run well enough. Have you tested this array with bonnie++ to see what kind of performance it gets in general? There could be some kind of hardware issue going on you're not seeing in the logs. Is that memory cache set to write back not through, and does it have battery backup (the cache, not the machine)? > The OS is installed on the local single disk and postgres data directory > is on the RAID5 partition. Maybe Adaptec 2200S RAID5 performance is not as > good as the vendor claimed. It was my impression that the raid controller > these days are optimized for RAID5 and going RAID10 would not benefit me much. You have to be careful about RAID 10, since many controllers serialize access through multiple levels of RAID, and therefore wind up being slower in RAID 10 or 50 than in RAID 1 or 5. > Also, I may be overlooking a postgresql.conf setting. I have attached the > config file. If you're doing a lot of small transactions you might see some gain from increasing commit_delay to 100 to 1000 and commit siblings to 25 to 100. It won't set the world on fire, but it's given me a 25% boost on certain loads with lots of small transactions > > In summary, my questions: > > 1. Would running PG on FreeBSD 5.x or 6.x or Linux improve performance? It most probably would. I'd at least test it out. > 2. Should I change SCSI controller config to use RAID 10 instead of 5? Maybe. With that controller, and many others in its league, you may be slowing things down doing that. You may be better off with a simple RAID 1 instead as well. Also, if you've got a problem with the controller serializing multiple raid levels, you might see the best performance with one raid level on the controller and the other handled by the kernel. BSD does do kernel level RAID, right? > 3. Why isn't postgres using all 4GB of ram for at least caching table for reads? Because that's your Operating System's job. > 4. Are there any other settings in the conf file I could try to tweak? With the later versions of PostgreSQL, it's gotten better at doing the OS job of caching, IF you set it to use enough memory. You might try cranking up shared memory / shared_buffers to something large like 75% of the machine memory and see if that does help. With 7.4 and before, it's generally a really bad idea. Looking at your postgresql.conf it appears you're running a post-7.4 version, so you might be able to get away with handing over all the ram to the database. Now that the tuning stuff is out of the way. Have you been using the logging to look for individual slow queries and run explain analyze on them? Are you analyzing your database and vacuuming it too? From pgsql-performance-owner@postgresql.org Fri Mar 17 16:03:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B4A039DCA3C for ; Fri, 17 Mar 2006 16:03: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 83334-10 for ; Fri, 17 Mar 2006 16:03:41 -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 33FD19DCA4A for ; Fri, 17 Mar 2006 16:03:38 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 17 Mar 2006 15:03:29 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 17 Mar 2006 15:03:23 -0500 Received: from 208.54.95.129 ([208.54.95.129]) 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 ; Fri, 17 Mar 2006 20:03:24 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 17 Mar 2006 15:03:19 -0800 Subject: Re: 1 TB of memory From: "Luke Lonergan" To: "Jim C. Nasby" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] 1 TB of memory Thread-Index: AcZJ6WwgHyJ1TlwcSCKu7QUg2reFXAALY8EE In-Reply-To: <20060317173653.GC15742@pervasive.com> MIME-Version: 1.0 X-OriginalArrivalTime: 17 Mar 2006 20:03:23.0901 (UTC) FILETIME=[D8C572D0:01C649FD] X-WSS-ID: 6805C9853XK326766-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=2.489 required=5 tests=[RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.489 X-Spam-Level: ** X-Archive-Number: 200603/287 X-Sequence-Number: 17724 Jim, On 3/17/06 9:36 AM, "Jim C. Nasby" wrote: > Now what happens as soon as you start doing random I/O? :) Well - given that we've divided the data into 32 separate segments, and that seeking is done in parallel over all 256 disk drives, random I/O rocks hard and scales. Of course, the parallelizing planner is designed to minimize seeking as much as possible, as is the normal Postgres planner, but with more segment and more parallel platters, seeking is faster. The biggest problem with this idea of "put huge amounts of data on your SSD and everything is infinitely fast" is that it ignores several critical scaling factors: - How much bandwidth is available in and out of the device? - Does that bandwidth scale as you grow the data? - As you grow the data, how long does it take to use the data? - Can more than 1 CPU use the data at once? Do they share the path to the data? If you are accessing 3 rows at a time from among billions, the problem you have is mostly access time - so an SSD might be very good for some OLTP applications. However - the idea of putting Terabytes of data into an SSD through a thin straw of a channel is silly. Note that SSDs have been around for a *long* time. I was using them on Cray X/MP and 2 supercomputers back in 1987-92, when we had a 4 Million Word SSD connected over a 2GB/s channel. In fact, some people I worked with built a machine with 4 Cray 2 computers that shared an SSD between them for parallel computing and it was very effective, and also ungodly expensive and special purpose. - Luke From pgsql-performance-owner@postgresql.org Fri Mar 17 19:03:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6A7199DC9DA for ; Fri, 17 Mar 2006 19:03: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 34628-06 for ; Fri, 17 Mar 2006 19:03: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 4AD499DC871 for ; Fri, 17 Mar 2006 19:03:27 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so623728nzo for ; Fri, 17 Mar 2006 15:03: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OG7dSFFh26iszt0Olv2al4fvDrv1HjEjtJ/o1/h0SK9bjtE+Z1DqZ8GJlJPibFFfxid/5qOUGcYWlme3mFluT/zcaq8DrWS/LqIPnCzhYZuPz9QeKoKKc32/72Y+wcDcNo9iqWx/pJvmFfyOv+77Y7z16rXaitlShaD6xq4bzBk= Received: by 10.65.61.6 with SMTP id o6mr566902qbk; Fri, 17 Mar 2006 15:03:29 -0800 (PST) Received: by 10.65.216.18 with HTTP; Fri, 17 Mar 2006 15:03:29 -0800 (PST) Message-ID: Date: Sat, 18 Mar 2006 00:03:29 +0100 From: "Claus Guttesen" To: "Kenji Morishige" Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Cc: pgsql-performance@postgresql.org In-Reply-To: <20060317221116.GA14661@juniper.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060317221116.GA14661@juniper.net> 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: 200603/294 X-Sequence-Number: 17731 > Here is my current configuration: > > Dual Xeon 3.06Ghz 4GB RAM > Adaptec 2200S 48MB cache & 4 disks configured in RAID5 > FreeBSD 4.11 w/kernel options: > options SHMMAXPGS=3D65536 > options SEMMNI=3D256 > options SEMMNS=3D512 > options SEMUME=3D256 > options SEMMNU=3D256 > options SMP # Symmetric MultiProcessor Kernel > options APIC_IO # Symmetric (APIC) I/O > > The OS is installed on the local single disk and postgres data directory > is on the RAID5 partition. Maybe Adaptec 2200S RAID5 performance is not = as > good as the vendor claimed. It was my impression that the raid controlle= r > these days are optimized for RAID5 and going RAID10 would not benefit me = much. I don't know whether 'systat -vmstat' is available on 4.x, if so try to issue the command with 'systat -vmstat 1' for 1 sec. updates. This will (amongst much other info) show how much disk-transfer you have. > Also, I may be overlooking a postgresql.conf setting. I have attached th= e > config file. You could try to lower shared_buffers from 30000 to 16384. Setting this value too high can in some cases be counterproductive according to doc's I read. Also try to lower work_mem from 16384 to 8192 or 4096. This setting is for each sort, so it does become expensive in terms of memory when many sorts are being carried out. It does depend on the complexity of your sorts of course. Try to do a vacuum analyse in your crontab. If your aliases-file is set up correctly mails generated by crontab will be forwarded to a human being. I have the following in my (root) crontab (and mail to root forwarded to me): time /usr/local/bin/psql -d dbname -h dbhost -U username -c "vacuum analyse verbose;" > In summary, my questions: > > 1. Would running PG on FreeBSD 5.x or 6.x or Linux improve performance? Going to 6.x would probably increase overall performance, but you have to try it out first. Many people report increased performance just by upgrading, some report that it grinds to a halt. But SMP-wise 6.x is a more mature release than 4.x is. Changes to the kernel from being giant-locked in 4.x to be "fine-grained locked" started in 5.x and have improved in 6.x. The disk- and network-layer should behave better. Linux, don't know. If your expertise is in FreeBSD try this first and then move to Linux (or Solaris 10) if 6.x does not meet your expectations. > 3. Why isn't postgres using all 4GB of ram for at least caching table for= reads? I guess it's related to the usage of the i386-architecture in general. If the zzeons are the newer noconas you can try the amd64-port instead. This can utilize more memory (without going through PAE). > 4. Are there any other settings in the conf file I could try to tweak? max_fsm_pages and max_fsm_relations. You can look at the bottom of vacuum analyze and increase the values: INFO: free space map: 153 relations, 43445 pages stored; 45328 total pages needed Raise max_fsm_pages so it meet or exceed 'total pages needed' and max_fsm_relations to relations. This is finetuning though. It's more important to set work- and maintenance-mem correct. hth Claus From pgsql-performance-owner@postgresql.org Fri Mar 17 19:14:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E4FCB9DC8A8 for ; Fri, 17 Mar 2006 19:14: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 34104-08 for ; Fri, 17 Mar 2006 19:14: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 BE5459DC871 for ; Fri, 17 Mar 2006 19:14: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 k2HNEUfH010889; Fri, 17 Mar 2006 18:14:30 -0500 (EST) To: Kenji Morishige cc: pgsql-performance@postgresql.org Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S In-reply-to: <20060317221116.GA14661@juniper.net> References: <20060317221116.GA14661@juniper.net> Comments: In-reply-to Kenji Morishige message dated "Fri, 17 Mar 2006 14:11:16 -0800" Date: Fri, 17 Mar 2006 18:14:30 -0500 Message-ID: <10888.1142637270@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/295 X-Sequence-Number: 17732 Kenji Morishige writes: > ... We generally have somewhere between 150-200 connections to > the database at any given time and probably anywhere between 5-10 new > connections being made every second and about 100 queries per second. Most > of the queries and transactions are very small due to the fact that the tools > were designed to work around the small functionality of MySQL 3.23 DB. You should think seriously about putting in some sort of connection-pooling facility. Postgres backends aren't especially lightweight things; the overhead involved in forking a process and then getting its internal caches populated etc. is significant. You don't want to be doing that for one small query, at least not if you're doing so many times a second. > it seems as if the database is not making use of the available ram. Postgres generally relies on the kernel to do the bulk of the disk caching. Your shared_buffers setting of 30000 seems quite reasonable to me; I don't think you want to bump it up (not much anyway). I'm not too familiar with FreeBSD and so I'm not clear on what "Inact" is: > Mem: 181M Active, 2632M Inact, 329M Wired, 179M Cache, 199M Buf, 81M Free > Swap: 4096M Total, 216K Used, 4096M Free If "Inact" covers disk pages cached by the kernel then this is looking reasonably good. If it's something else then you got a problem, but fixing it is a kernel issue not a database issue. > #max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each You almost certainly need to bump this way up. 20000 is enough to cover dirty pages in about 200MB of database, which is only a fiftieth of what you say your disk footprint is. Unless most of your data is static, you're going to be suffering severe table bloat over time due to inability to recycle free space properly. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 17 19:21:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 33B4A9DCC68 for ; Fri, 17 Mar 2006 19: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 37085-04 for ; Fri, 17 Mar 2006 19:21:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 301809DCC66 for ; Fri, 17 Mar 2006 19:21:13 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Fri, 17 Mar 2006 23:21:16 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 17 Mar 2006 17:21:16 -0600 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: Scott Marlowe To: Claus Guttesen Cc: Kenji Morishige , pgsql-performance@postgresql.org In-Reply-To: References: <20060317221116.GA14661@juniper.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142637675.1141.38.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 17 Mar 2006 17:21:16 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.147 required=5 tests=[AWL=0.146, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.147 X-Spam-Level: X-Archive-Number: 200603/296 X-Sequence-Number: 17733 On Fri, 2006-03-17 at 17:03, Claus Guttesen wrote: > > Here is my current configuration: > > Also, I may be overlooking a postgresql.conf setting. I have attached the > > config file. > > You could try to lower shared_buffers from 30000 to 16384. Setting > this value too high can in some cases be counterproductive according > to doc's I read. FYI, that was very true before 8.0, but since the introduction of better cache management algorithms, you can have pretty big shared_buffers settings. > Also try to lower work_mem from 16384 to 8192 or 4096. This setting is > for each sort, so it does become expensive in terms of memory when > many sorts are being carried out. It does depend on the complexity of > your sorts of course. But looking at his usage of RAM on his box, it doesn't look like one at the time that snapshot was taken. Assuming the box was busy then, he's OK. Otherwise, he'd show a usage of swapping, which he doesn't. From pgsql-performance-owner@postgresql.org Fri Mar 17 19:29:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CD4979DCC0E for ; Fri, 17 Mar 2006 19:29: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 23718-02 for ; Fri, 17 Mar 2006 19:29:19 -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 BA78A9DCC68 for ; Fri, 17 Mar 2006 19:29:14 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 8so626691nzo for ; Fri, 17 Mar 2006 15:29: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=igrIKgPjdX6f/CXqlmGNfdpZ3OfsR73JOnH1h4iQHjnCh/gfygFZz8vtX8BSo/9i+3jJNz1GcS85LLvmquHcL9QnSTUej8kh4KShzmVHJLRhncsW5XKClJW0KLLljeQq80Ne02T5q2rbf05W7+PmAq/gJ6wQBde97B7vHgQzZJw= Received: by 10.65.23.16 with SMTP id a16mr584612qbj; Fri, 17 Mar 2006 15:29:17 -0800 (PST) Received: by 10.65.216.18 with HTTP; Fri, 17 Mar 2006 15:29:17 -0800 (PST) Message-ID: Date: Sat, 18 Mar 2006 00:29:17 +0100 From: "Claus Guttesen" To: "Kenji Morishige" Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Cc: pgsql-performance@postgresql.org In-Reply-To: <20060317221116.GA14661@juniper.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060317221116.GA14661@juniper.net> 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: 200603/297 X-Sequence-Number: 17734 > 4. Are there any other settings in the conf file I could try to tweak? One more thing :-) I stumbled over this setting, this made the db (PG 7.4.9) make use of the index rather than doing a sequential scan and it reduced a query from several minutes to some 20 seconds. random_page_cost =3D 2 (original value was 4). Another thing you ought to do is to to get the four-five most used queries and do an explain analyze in these. Since our website wasn't prepared for this type of statistics I simply did a tcpdump, grep'ed all select's, sorted them and sorted them unique so I could see which queries were used most. regards Claus From pgsql-performance-owner@postgresql.org Fri Mar 17 20:00:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B07959DCC0E for ; Fri, 17 Mar 2006 20:00: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 27146-09 for ; Fri, 17 Mar 2006 20:00:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz [203.96.152.183]) by postgresql.org (Postfix) with ESMTP id 947DE9DCC6C for ; Fri, 17 Mar 2006 20:00:36 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IWA00K5PQP3NK@linda-4.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 18 Mar 2006 13:00:39 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-28.dsl.clear.net.nz [218.101.28.28]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 6CBFBA1416; Sat, 18 Mar 2006 13:00:38 +1300 (NZDT) Date: Sat, 18 Mar 2006 13:00:37 +1300 From: Mark Kirkwood Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & In-reply-to: <1142636433.1141.33.camel@state.g2switchworks.com> To: Scott Marlowe Cc: Kenji Morishige , pgsql-performance@postgresql.org Message-id: <441B4DA5.1020002@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: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.176 required=5 tests=[AWL=0.176] X-Spam-Score: 0.176 X-Spam-Level: X-Archive-Number: 200603/298 X-Sequence-Number: 17735 Scott Marlowe wrote: > On Fri, 2006-03-17 at 16:11, Kenji Morishige wrote: > >>About a year ago we decided to migrate our central database that powers various >>intranet tools from MySQL to PostgreSQL. We have about 130 tables and about >>10GB of data that stores various status information for a variety of services >>for our intranet. We generally have somewhere between 150-200 connections to >>the database at any given time and probably anywhere between 5-10 new >>connections being made every second and about 100 queries per second. Most >>of the queries and transactions are very small due to the fact that the tools >>were designed to work around the small functionality of MySQL 3.23 DB. >>Our company primarily uses FreeBSD and we are stuck on FreeBSD 4.X series due >>to IT support issues, > > > There were a LOT of performance enhancements to FreeBSD with the 5.x > series release. I'd recommend fast tracking the database server to the > 5.x branch. 4-stable was release 6 years ago. 5-stable was released > two years ago. > > I would recommend skipping 5.x and using 6.0 - as it performs measurably better than 5.x. In particular the vfs layer is no longer under the GIANT lock, so you will get considerably improved concurrent filesystem access on your dual Xeon. Regards Mark From pgsql-performance-owner@postgresql.org Fri Mar 17 20:08:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D51659DC9EE for ; Fri, 17 Mar 2006 20:08: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 28412-05 for ; Fri, 17 Mar 2006 20:08:57 -0400 (AST) X-Greylist: delayed 01:57:38.576021 by SQLgrey- Received: from colo-dns-ext2.juniper.net (colo-dns-ext2.juniper.net [207.17.137.64]) by postgresql.org (Postfix) with ESMTP id EA6E19DC8A0 for ; Fri, 17 Mar 2006 20:08:52 -0400 (AST) Received: from merlot.juniper.net (merlot.juniper.net [172.17.27.10]) by colo-dns-ext2.juniper.net (8.12.3/8.12.3) with ESMTP id k2I08t1Z095814; Fri, 17 Mar 2006 16:08:55 -0800 (PST) (envelope-from kenjim@juniper.net) Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [172.17.58.60]) by merlot.juniper.net (8.11.3/8.11.3) with ESMTP id k2I08t513174; Fri, 17 Mar 2006 16:08:55 -0800 (PST) (envelope-from kenjim@juniper.net) Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [127.0.0.1]) by kenjim-lnx.juniper.net (8.13.4/8.13.4) with ESMTP id k2I08tQM020532; Fri, 17 Mar 2006 16:08:55 -0800 Received: (from kenjim@localhost) by kenjim-lnx.juniper.net (8.13.4/8.13.4/Submit) id k2I08t1c020531; Fri, 17 Mar 2006 16:08:55 -0800 Date: Fri, 17 Mar 2006 16:08:55 -0800 From: Kenji Morishige To: Claus Guttesen Cc: pgsql-performance@postgresql.org, kenjim@juniper.net Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Message-ID: <20060318000855.GB14661@juniper.net> References: <20060317221116.GA14661@juniper.net> 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/299 X-Sequence-Number: 17736 Thanks guys, I'm studying each of your responses and am going to start to experiement. Unfortunately, I don't have another box with similar specs to do a perfect experiment with, but I think I'm going to go ahead and open a service window to ungrade the box to FBSD6.0 and apply some other changes. It also gives me the chance to go from 8.0.1 to 8.1 series which I been wanting to do as well. Thanks guys and I will see if any of your suggestions make a noticable difference. I also have been looking at log result of slow queries and making necessary indexes to make those go faster. -Kenji On Sat, Mar 18, 2006 at 12:29:17AM +0100, Claus Guttesen wrote: > > 4. Are there any other settings in the conf file I could try to tweak? > > One more thing :-) > > I stumbled over this setting, this made the db (PG 7.4.9) make use of > the index rather than doing a sequential scan and it reduced a query > from several minutes to some 20 seconds. > > random_page_cost = 2 (original value was 4). > > Another thing you ought to do is to to get the four-five most used > queries and do an explain analyze in these. Since our website wasn't > prepared for this type of statistics I simply did a tcpdump, grep'ed > all select's, sorted them and sorted them unique so I could see which > queries were used most. > > regards > Claus From pgsql-performance-owner@postgresql.org Sat Mar 18 00:41:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5D1929DCBA4 for ; Sat, 18 Mar 2006 00: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 15407-07 for ; Sat, 18 Mar 2006 00:41:13 -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 EC82E9DCA89 for ; Sat, 18 Mar 2006 00:41:12 -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 k2I4fBOs012824; Fri, 17 Mar 2006 23:41:11 -0500 (EST) To: Dan Harris cc: PostgreSQL Performance Subject: Re: Help optimizing a slow index scan In-reply-to: <441B1FC6.60001@drivefaster.net> References: <4419DB50.10404@drivefaster.net> <441B1FC6.60001@drivefaster.net> Comments: In-reply-to Dan Harris message dated "Fri, 17 Mar 2006 13:44:54 -0700" Date: Fri, 17 Mar 2006 23:41:11 -0500 Message-ID: <12823.1142656871@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/300 X-Sequence-Number: 17737 Dan Harris writes: > Furthermore, by doing so, I am tying my queries directly to > "postgres-isms". One of the long term goals of this project is to be > able to fairly transparently support any ANSI SQL-compliant back end > with the same code base. Unfortunately, there isn't any portable or standard (not exactly the same thing ;-)) SQL functionality for dealing gracefully with two-dimensional searches, which is what your lat/long queries are. You should accept right now that you can have portability or you can have good performance, not both. Merlin's enthusiasm for row-comparison queries is understandable because that fix definitely helped a common problem. But row comparison has nothing to do with searches in two independent dimensions. Row comparison basically makes it easier to exploit the natural behavior of multicolumn btree indexes ... but a multicolumn btree index does not efficiently support queries that involve separate range limitations on each index column. (If you think about the index storage order you'll see why: the answer entries are not contiguous in the index.) To support two-dimensional searches you really need a non-btree index structure, such as GIST. Since this isn't standard, demanding a portable answer won't get you anywhere. (I don't mean to suggest that Postgres is the only database that has such functionality, just that the DBs that do have it don't agree on any common API.) regards, tom lane From pgsql-performance-owner@postgresql.org Sat Mar 18 01:29:56 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 72F3F9DC81C for ; Sat, 18 Mar 2006 01:29: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 18170-10 for ; Sat, 18 Mar 2006 01:29:53 -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 69BA59DC820 for ; Sat, 18 Mar 2006 01:29:51 -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 k2I5TgX5001110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 17 Mar 2006 22:29: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 k2I5TgIl002378; Fri, 17 Mar 2006 22:29: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 k2I5Tgp7002371; Fri, 17 Mar 2006 22:29:42 -0700 (MST) (envelope-from mfuhr) Date: Fri, 17 Mar 2006 22:29:41 -0700 From: Michael Fuhr To: Tom Lane Cc: Dan Harris , PostgreSQL Performance Subject: Re: Help optimizing a slow index scan Message-ID: <20060318052941.GA46733@winnie.fuhr.org> References: <4419DB50.10404@drivefaster.net> <441B1FC6.60001@drivefaster.net> <12823.1142656871@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12823.1142656871@sss.pgh.pa.us> 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: 200603/301 X-Sequence-Number: 17738 On Fri, Mar 17, 2006 at 11:41:11PM -0500, Tom Lane wrote: > Dan Harris writes: > > Furthermore, by doing so, I am tying my queries directly to > > "postgres-isms". One of the long term goals of this project is to be > > able to fairly transparently support any ANSI SQL-compliant back end > > with the same code base. > > Unfortunately, there isn't any portable or standard (not exactly the > same thing ;-)) SQL functionality for dealing gracefully with > two-dimensional searches, which is what your lat/long queries are. The OpenGIS Simple Features Specification[1] is a step in that direction, no? PostGIS[2], MySQL[3], and Oracle Spatial[4] implement to varying degrees. With PostGIS you do have to add non-standard operators to a query's predicate to benefit from GiST indexes on spatial columns, but the rest of the query can be straight out of the SQL and OGC standards. [1] http://www.opengeospatial.org/docs/99-049.pdf [2] http://www.postgis.org/ [3] http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html [4] http://www.oracle.com/technology/products/spatial/index.html -- Michael Fuhr From pgsql-performance-owner@postgresql.org Sat Mar 18 04:52:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8BD939DC853 for ; Sat, 18 Mar 2006 04:52: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 74146-10 for ; Sat, 18 Mar 2006 04:52:16 -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 172AB9DC842 for ; Sat, 18 Mar 2006 04:52:06 -0400 (AST) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id k2I8om9a010384; Sat, 18 Mar 2006 11:50:49 +0300 (MSK) Date: Sat, 18 Mar 2006 11:50:48 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Michael Fuhr cc: Tom Lane , Dan Harris , PostgreSQL Performance Subject: Re: Help optimizing a slow index scan In-Reply-To: <20060318052941.GA46733@winnie.fuhr.org> Message-ID: References: <4419DB50.10404@drivefaster.net> <441B1FC6.60001@drivefaster.net> <12823.1142656871@sss.pgh.pa.us> <20060318052941.GA46733@winnie.fuhr.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.44 required=5 tests=[AWL=-0.039, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.44 X-Spam-Level: X-Archive-Number: 200603/302 X-Sequence-Number: 17739 I may be wrong but we in astronomy have several sky indexing schemes, which allows to effectively use classical btree index. See http://www.sai.msu.su/~megera/oddmuse/index.cgi/SkyPixelization for details. Sergei Koposov has developed Q3C contrib module for PostgreSQL 8.1+ and we use it with billiard size astronomical catalogs. Oleg On Fri, 17 Mar 2006, Michael Fuhr wrote: > On Fri, Mar 17, 2006 at 11:41:11PM -0500, Tom Lane wrote: >> Dan Harris writes: >>> Furthermore, by doing so, I am tying my queries directly to >>> "postgres-isms". One of the long term goals of this project is to be >>> able to fairly transparently support any ANSI SQL-compliant back end >>> with the same code base. >> >> Unfortunately, there isn't any portable or standard (not exactly the >> same thing ;-)) SQL functionality for dealing gracefully with >> two-dimensional searches, which is what your lat/long queries are. > > The OpenGIS Simple Features Specification[1] is a step in that > direction, no? PostGIS[2], MySQL[3], and Oracle Spatial[4] implement > to varying degrees. With PostGIS you do have to add non-standard > operators to a query's predicate to benefit from GiST indexes on > spatial columns, but the rest of the query can be straight out of > the SQL and OGC standards. > > [1] http://www.opengeospatial.org/docs/99-049.pdf > [2] http://www.postgis.org/ > [3] http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html > [4] http://www.oracle.com/technology/products/spatial/index.html > > 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 Sat Mar 18 06:20:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4077B9DCBA4 for ; Sat, 18 Mar 2006 06: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 91381-01 for ; Sat, 18 Mar 2006 06:20:47 -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 1BBAB9DC89E for ; Sat, 18 Mar 2006 06:20:43 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i5so714598wra for ; Sat, 18 Mar 2006 02:20: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dvCG4NoHGkEDgB54ZUQmt2Zn6Gwdp/y1pzH/kOYTCRxr4tMbQWAPxnHvC7mJOzNKdpJJqqvTDYe94wx0t8/NAQY52BoF40u7LZ5sfEKfK+VPWaSl+2KdHGH5VyCy0nPVM4jX/kEcM6JENXCSzEKx8/7/7SRaqVD4hS59Y4Q/SbQ= Received: by 10.65.158.13 with SMTP id k13mr765777qbo; Sat, 18 Mar 2006 02:20:45 -0800 (PST) Received: by 10.65.123.12 with HTTP; Sat, 18 Mar 2006 02:20:45 -0800 (PST) Message-ID: <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> Date: Sat, 18 Mar 2006 11:20:45 +0100 From: "Guillaume Smet" To: "Guillaume Cottenceau" Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? Cc: pgsql-performance@postgresql.org In-Reply-To: <87ek11gz69.fsf@meuh.mnc.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <87ek11gz69.fsf@meuh.mnc.lan> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.169 required=5 tests=[AWL=0.169] X-Spam-Score: 0.169 X-Spam-Level: X-Archive-Number: 200603/303 X-Sequence-Number: 17740 Guillaume, On 17 Mar 2006 11:09:50 +0100, Guillaume Cottenceau wrote: > Reading the documentation and postgresql list archives, I have > run ANALYZE right before my tests, I have increased the > statistics target to 50 for the considered table; my problem is > that the index scan cost reported by EXPLAIN seems to be around > 12.7 times higher that it should, a figure I suppose incompatible > (too large) for just random_page_cost and effective_cache_size > tweaks. It's not surprising you have a high cost for an index scan which is planned to return and returns so much rows. I really don't think the planner does something wrong on this one. AFAIK, increasing the statistics target won't do anything to reduce the cost as the planner estimation for the number of returned rows is already really accurate and probably can't be better. > Of course real queries use smaller date ranges. What about providing us the respective plans for your real queries? And in a real case. It's a bad idea to compare index scan and seqscan when your data have to be loaded in RAM. Before doing so create an index on the date column to have the most effective index possible. > - I then tried to tweak random_page_cost and effective_cache_size > following advices from documentation: > > SET random_page_cost =3D 2; random_page_cost is the way to go for this sort of thing but I don't think it's a good idea to have it too low globally and I'm still thinking the problem is that your test case is not accurate. -- Guillaume From pgsql-performance-owner@postgresql.org Sat Mar 18 08:01:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CD0D09DCDF7 for ; Sat, 18 Mar 2006 08:01: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 06926-03 for ; Sat, 18 Mar 2006 08:01:26 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by postgresql.org (Postfix) with ESMTP id C872B9DCDD4 for ; Sat, 18 Mar 2006 08:01:21 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i21so750037wra for ; Sat, 18 Mar 2006 04:01: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:mime-version:content-type:content-transfer-encoding:content-disposition; b=nZTK8+EY/b17POxT7bluzFd4yrHcAYMXHurFqyJjEhR24FgbtjlJgY05wgNS4Vf8Izte8wq7LJc8htRvpFZBcd0NXTO6Ud4Z/cwSH3kap4gmCUt+N+dJuYlYK+b49NaOESMRHSzMsMtjt7N9olfGtkDl6gKUuCu5/I+K+jDz8yM= Received: by 10.35.34.20 with SMTP id m20mr1927556pyj; Sat, 18 Mar 2006 04:01:24 -0800 (PST) Received: by 10.35.37.10 with HTTP; Sat, 18 Mar 2006 04:01:24 -0800 (PST) Message-ID: <92d3a4950603180401p7deb391cp@mail.gmail.com> Date: Sat, 18 Mar 2006 13:01:24 +0100 From: Antoine To: pgsql-performance@postgresql.org Subject: n00b 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.2 required=5 tests=[AWL=0.200] X-Spam-Score: 0.2 X-Spam-Level: X-Archive-Number: 200603/304 X-Sequence-Number: 17741 Hi, I have enabled the autovacuum daemon, but occasionally still get a message telling me I need to run vacuum when I access a table in pgadmin. Is this normal? Should I use scripts instead of the daemon? Would posting config options make this a much more sensible question? Cheers Antoine -- This is where I should put some witty comment. From pgsql-performance-owner@postgresql.org Sat Mar 18 10:58:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EDDB09DCE13 for ; Sat, 18 Mar 2006 10:58: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 50536-02 for ; Sat, 18 Mar 2006 10:58:55 -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 433009DCE12 for ; Sat, 18 Mar 2006 10:58:49 -0400 (AST) Received: (qmail 10145 invoked by uid 500); 18 Mar 2006 15:00:19 -0000 Date: Sat, 18 Mar 2006 09:00:19 -0600 From: Bruno Wolff III To: Oleg Bartunov Cc: Michael Fuhr , Tom Lane , Dan Harris , PostgreSQL Performance Subject: Re: Help optimizing a slow index scan Message-ID: <20060318150019.GA8398@wolff.to> Mail-Followup-To: Bruno Wolff III , Oleg Bartunov , Michael Fuhr , Tom Lane , Dan Harris , PostgreSQL Performance References: <4419DB50.10404@drivefaster.net> <441B1FC6.60001@drivefaster.net> <12823.1142656871@sss.pgh.pa.us> <20060318052941.GA46733@winnie.fuhr.org> 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.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/305 X-Sequence-Number: 17742 On Sat, Mar 18, 2006 at 11:50:48 +0300, Oleg Bartunov wrote: > I may be wrong but we in astronomy have several sky indexing schemes, which > allows to effectively use classical btree index. See > http://www.sai.msu.su/~megera/oddmuse/index.cgi/SkyPixelization > for details. Sergei Koposov has developed Q3C contrib module for > PostgreSQL 8.1+ and we use it with billiard size astronomical catalogs. Note that Earth Distance can also be used for astronomy. If you use an appropiate radius, distances will be in degrees. From pgsql-performance-owner@postgresql.org Sat Mar 18 11:04:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 322C09DCA52 for ; Sat, 18 Mar 2006 11:04: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 49833-04 for ; Sat, 18 Mar 2006 11:04:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay107-dav17.bay107.hotmail.com [64.4.51.89]) by postgresql.org (Postfix) with ESMTP id 48EA39DC83A for ; Sat, 18 Mar 2006 11:03:57 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sat, 18 Mar 2006 07:04:01 -0800 Message-ID: Received: from 84.193.85.191 by BAY107-DAV17.phx.gbl with DAV; Sat, 18 Mar 2006 15:04:01 +0000 X-Originating-IP: [84.193.85.191] X-Originating-Email: [nbforyou@hotmail.com] X-Sender: nbforyou@hotmail.com From: "NbForYou" To: Subject: database model tshirt sizes Date: Sat, 18 Mar 2006 16:03:59 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001B_01C64AA5.9182DE50" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 18 Mar 2006 15:04:01.0941 (UTC) FILETIME=[31059C50:01C64A9D] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.611 required=5 tests=[AWL=-0.309, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.611 X-Spam-Level: * X-Archive-Number: 200603/306 X-Sequence-Number: 17743 This is a multi-part message in MIME format. ------=_NextPart_000_001B_01C64AA5.9182DE50 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, Does anybody know how to build a database model to include sizes for = rings, tshirts, etc? the current database is built like: table product =3D=3D=3D=3D=3D=3D=3D=3D=3D productid int8 PK productname charvar(255) quantity int4 what i want now is that WHEN (not all products have multiple sizes) = there are multiple sizes available. The sizes are stored into the = database. I was wondering to include a extra table: table sizes: =3D=3D=3D=3D=3D=3D=3D=3D productid int8 FK size varchar(100) but then i have a quantity problem. Because now not all size quantities = can be stored into this table, because it allready exist in my product = table. How do professionals do it? How do they make their model to include = sizes if any available? ------=_NextPart_000_001B_01C64AA5.9182DE50 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
 
Does anybody know how to build a = database model to=20 include sizes for rings, tshirts, etc?
 
 
the current database is built = like:
 
table product
=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
productid int8 PK
productname charvar(255)
quantity int4
 
 
what i want now is that WHEN (not all = products have=20 multiple sizes) there are multiple sizes available. The sizes are stored = into=20 the database. I was wondering to include a extra table:
 
table sizes:
=3D=3D=3D=3D=3D=3D=3D=3D
productid int8 FK
size varchar(100)
 
 
but then i have a quantity problem. = Because now not=20 all size quantities can be stored into this table, because it allready = exist in=20 my product table.
 
How do professionals do it? How do they = make their=20 model to include sizes if any available?
------=_NextPart_000_001B_01C64AA5.9182DE50-- From pgsql-performance-owner@postgresql.org Sat Mar 18 11:54:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5ECA99DCC36 for ; Sat, 18 Mar 2006 11: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 58494-03 for ; Sat, 18 Mar 2006 11:54:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by postgresql.org (Postfix) with ESMTP id 68B009DCC34 for ; Sat, 18 Mar 2006 11:54:06 -0400 (AST) Received: from ool-45745d9b.dyn.optonline.net ([69.116.93.155] helo=[192.168.4.92]) by outbound.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.51) id 1FKdkp-0000yy-1K; Sat, 18 Mar 2006 10:54:11 -0500 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 69.116.93.155 X-Report-Abuse-To: abuse@dyndns.com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: zeut Message-ID: <441C2D26.20309@zeut.net> Date: Sat, 18 Mar 2006 10:54:14 -0500 From: "Matthew T. O'Connor" User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Antoine CC: pgsql-performance@postgresql.org Subject: Re: n00b autovacuum question References: <92d3a4950603180401p7deb391cp@mail.gmail.com> In-Reply-To: <92d3a4950603180401p7deb391cp@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.131 required=5 tests=[AWL=0.131] X-Spam-Score: 0.131 X-Spam-Level: X-Archive-Number: 200603/307 X-Sequence-Number: 17744 More detail please. It sounds like you running 8.1 and talking about the integrated autovacuum is that correct? Also, what is the message specifically from pgadmin? Matt Antoine wrote: > Hi, > I have enabled the autovacuum daemon, but occasionally still get a > message telling me I need to run vacuum when I access a table in > pgadmin. Is this normal? Should I use scripts instead of the daemon? > Would posting config options make this a much more sensible question? > Cheers > Antoine > > -- > This is where I should put some witty comment. > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > From pgsql-performance-owner@postgresql.org Sat Mar 18 13:46:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B92E99DCA69 for ; Sat, 18 Mar 2006 13:46: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 77275-08 for ; Sat, 18 Mar 2006 13:46:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by postgresql.org (Postfix) with ESMTP id 76A0E9DC9CE for ; Sat, 18 Mar 2006 13:46:12 -0400 (AST) Received: from [84.143.28.185] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1FKfV32o5C-0007sA; Sat, 18 Mar 2006 18:46:11 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1FKfV2-0004wc-Ky; Sat, 18 Mar 2006 18:46:00 +0100 Message-ID: <441C4758.9000205@pse-consulting.de> Date: Sat, 18 Mar 2006 18:46:00 +0100 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Antoine CC: pgsql-performance@postgresql.org Subject: Re: n00b autovacuum question References: <92d3a4950603180401p7deb391cp@mail.gmail.com> In-Reply-To: <92d3a4950603180401p7deb391cp@mail.gmail.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.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200603/308 X-Sequence-Number: 17745 Antoine wrote: > Hi, > I have enabled the autovacuum daemon, but occasionally still get a > message telling me I need to run vacuum when I access a table in > pgadmin. pgAdmin notices a discrepancy between real rowcount and estimated rowcount and thus suggests to run vacuum/analyze; it won't examine autovacuum rules so it might warn although autovac is running ok. If you're sure autovacuum is running fine, just dismiss the message. It's a hint for newbies that do *not* run vacuum because they don't know what it's good for. Regards Andreas From pgsql-performance-owner@postgresql.org Sun Mar 19 00:14:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8E5969DCC5F for ; Sun, 19 Mar 2006 00:14: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 25614-05 for ; Sun, 19 Mar 2006 00:14:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-5.paradise.net.nz (bm-5a.paradise.net.nz [203.96.152.184]) by postgresql.org (Postfix) with ESMTP id 8035C9DCC18 for ; Sun, 19 Mar 2006 00:14:38 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-5.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IWC009KDX4BHO@linda-5.paradise.net.nz> for pgsql-performance@postgresql.org; Sun, 19 Mar 2006 16:14:36 +1200 (NZST) Received: from [192.168.1.11] (218-101-29-5.dsl.clear.net.nz [218.101.29.5]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 7B073CFE731; Sun, 19 Mar 2006 16:14:35 +1200 (NZST) Date: Sun, 19 Mar 2006 16:14:34 +1200 From: Mark Kirkwood Subject: Re: planner with index scan cost way off actual cost, In-reply-to: <87ek11gz69.fsf@meuh.mnc.lan> To: Guillaume Cottenceau Cc: pgsql-performance@postgresql.org Message-id: <441CDAAA.20609@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: <87ek11gz69.fsf@meuh.mnc.lan> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.175 required=5 tests=[AWL=0.175] X-Spam-Score: 0.175 X-Spam-Level: X-Archive-Number: 200603/312 X-Sequence-Number: 17749 Guillaume Cottenceau wrote: > > SET random_page_cost = 2; > SET effective_cache_size = 10000; > EXPLAIN SELECT * FROM sent_messages WHERE date > '2005-09-01' AND date < '2005-09-19'; > QUERY PLAN > --------------------------------------------------------------------------------------------------------------------------------------------- > Index Scan using idx_sent_msgs_date_theme_status on sent_messages (cost=0.00..595894.94 rows=392066 width=78) > Index Cond: ((date > '2005-09-01 00:00:00+00'::timestamp with time zone) AND (date < '2005-09-19 00:00:00+00'::timestamp with time zone)) > > > We can see that estimated index scan cost goes down but by a > factor of approx. 2.3 which is far from enough to "fix" it. I > am reluctant in changing way more the random_page_cost and > effective_cache_size values as I'm suspecting it might have > other (bad) consequences if it is too far away from reality > (even if Linux is known to aggressively cache), the application > being multithreaded (there is a warning about concurrent > queries using different indexes in documentation). But I > certainly could benefit from others' experience on this matter. > > > I apologize for this long email but I wanted to be sure I gave > enough information on the data and things I have tried to fix the > problem myself. If anyone can see what I am doing wrong, I would > be very interested in pointers. > > Thanks in advance! > > Btw, I use postgres 7.4.5 with -B 1000 -N 500 and all > postgresql.conf default values except timezone = 'UTC', on an > ext3 partition with data=ordered, and run Linux 2.6.12. > I didn't see any mention of how much memory is on your server, but provided you have say 1G, and are using the box solely for a database server, I would increase both shared_buffers and effective_cache size. shared_buffer = 12000 effective_cache_size = 25000 This would mean you are reserving 100M for Postgres to cache relation pages, and informing the planner that it can expect ~200M available from the disk buffer cache. To give a better recommendation, we need to know more about your server and workload (e.g server memory configuration and usage plus how close you get to 500 connections). Cheers Mark From pgsql-performance-owner@postgresql.org Sun Mar 19 02:26:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9FD699DC984 for ; Sun, 19 Mar 2006 02:26: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 57191-07 for ; Sun, 19 Mar 2006 02:26:47 -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 7BE559DCD91 for ; Sun, 19 Mar 2006 02:26:38 -0400 (AST) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id k2J6QOpm007030; Sun, 19 Mar 2006 09:26:24 +0300 (MSK) Date: Sun, 19 Mar 2006 09:26:24 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Evgeny Gridasov cc: Dan Harris , pgsql-performance@postgresql.org Subject: Re: Help optimizing a slow index scan In-Reply-To: <20060317223253.38c0e6b9.eugene@i-free.ru> Message-ID: References: <4419DB50.10404@drivefaster.net> <4419DC1C.9070806@drivefaster.net> <684362e10603161915x431c6b08t@mail.gmail.com> <441AD702.9020508@drivefaster.net> <441ADB88.9010701@drivefaster.net> <20060317223253.38c0e6b9.eugene@i-free.ru> 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.449 required=5 tests=[AWL=-0.030, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.449 X-Spam-Level: X-Archive-Number: 200603/313 X-Sequence-Number: 17750 On Fri, 17 Mar 2006, Evgeny Gridasov wrote: > Try contrib/btree_gist. contrib/btree_gist does nothing more than built-in btree - it's just an support for multicolumn GiST indices. > I've tried that one, but for my case it didn't help much. > The performance was almost equal or even slower than built-in btree. > > On Fri, 17 Mar 2006 08:53:44 -0700 > Dan Harris wrote: > >> Dan Harris wrote: >>> Markus Bertheau wrote: >>>> Have you tried using a GIST index on lat & long? These things are >>>> meant for two-dimensional data, whereas btree doesn't handle >>>> two-dimensional data that well. How many rows satisfy either of the >>>> long / lat condition? >>>> >>>> >>>>> >>> According to the analyze, less than 500 rows matched. I'll look into >>> GIST indexes, thanks for the feedback. >>> >>> -Dan >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 2: Don't 'kill -9' the postmaster >> >> When I try to create a GIST index, I get the following error: >> >> create index eventgeo_lat_idx on eventgeo using GIST (lat); >> >> ERROR: data type double precision has no default operator class for >> access method "gist" >> HINT: You must specify an operator class for the index or define a >> default operator class for the data type. >> >> I'm not sure what a "default operator class" is, exactly.. >> >> -Dan >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 5: don't forget to increase your free space map settings >> > > > 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 Sun Mar 19 08:27:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 93EBE9DC821 for ; Sun, 19 Mar 2006 08:27: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 09045-02 for ; Sun, 19 Mar 2006 08:27:32 -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 1E8459DC812 for ; Sun, 19 Mar 2006 08:27:26 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 14so912810nzn for ; Sun, 19 Mar 2006 04:27: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=TA9txlokYM3AopDIZmay+corNAK1nLb7cfPFsNXNqpT1GnZin6xMFo1vbOBMcALEQnLav7hGALpxe/8LTDNLYizZ7EV6ciVT9BUxXgMGs5CgHXi/sGYSL0MzVP6gCfU27GTiw4he99iJbZwk0DB3li6iTfS73hpkouXZJyao/4I= Received: by 10.35.107.20 with SMTP id j20mr801665pym; Sun, 19 Mar 2006 04:27:30 -0800 (PST) Received: by 10.35.37.10 with HTTP; Sun, 19 Mar 2006 04:27:29 -0800 (PST) Message-ID: <92d3a4950603190427m47f5fad6k@mail.gmail.com> Date: Sun, 19 Mar 2006 13:27:29 +0100 From: Antoine To: "Andreas Pflug" Subject: Re: n00b autovacuum question Cc: pgsql-performance@postgresql.org In-Reply-To: <441C4758.9000205@pse-consulting.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <92d3a4950603180401p7deb391cp@mail.gmail.com> <441C4758.9000205@pse-consulting.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.184 required=5 tests=[AWL=0.184] X-Spam-Score: 0.184 X-Spam-Level: X-Archive-Number: 200603/314 X-Sequence-Number: 17751 On 18/03/06, Andreas Pflug wrote: > Antoine wrote: > > Hi, > > I have enabled the autovacuum daemon, but occasionally still get a > > message telling me I need to run vacuum when I access a table in > > pgadmin. > > pgAdmin notices a discrepancy between real rowcount and estimated > rowcount and thus suggests to run vacuum/analyze; it won't examine > autovacuum rules so it might warn although autovac is running ok. > > If you're sure autovacuum is running fine, just dismiss the message. I guess that is my problem - I a not sure it is running fine. The process is definitely running but I am getting lots of complaints about performance. This probably has lots to do with crap code and not much to do with the database but I am still searching the maintenance avenue... We have a massive project coming up and I want to go for Postgres (the boss wants Oracle). If I can't get my stuff together I am not sure my arguments will stick... problem is I don't really have the time to experiment properly. Cheers Antoine -- This is where I should put some witty comment. From pgsql-performance-owner@postgresql.org Sun Mar 19 08:31:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 42A999DC821 for ; Sun, 19 Mar 2006 08:31: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 10958-01 for ; Sun, 19 Mar 2006 08:31:44 -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 341679DC812 for ; Sun, 19 Mar 2006 08:31:38 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i4so834353wra for ; Sun, 19 Mar 2006 04:31:42 -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=XlWKgkFZjQ76S2i0LXVLIIPRm7qp0d4cAQNkfmA9jYZtlgXQHuDaCL/j21bTvnNXW493fK2dZIbA+h4n29Cxg4gWcYsN/WHYO8/D4uAqp4oi9logs4Z6hW10VCNHaxbGZ+Bp4AZD69pJ+0og2nWT+a8zl5CDdBz463lk+N0ci9c= Received: by 10.35.36.13 with SMTP id o13mr74475pyj; Sun, 19 Mar 2006 04:31:42 -0800 (PST) Received: by 10.35.37.10 with HTTP; Sun, 19 Mar 2006 04:31:42 -0800 (PST) Message-ID: <92d3a4950603190431p43fd399aq@mail.gmail.com> Date: Sun, 19 Mar 2006 13:31:42 +0100 From: Antoine To: pgsql-performance@postgresql.org Subject: partitioning 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.173 required=5 tests=[AWL=0.173] X-Spam-Score: 0.173 X-Spam-Level: X-Archive-Number: 200603/315 X-Sequence-Number: 17752 Hi, Is there any work on the cards for implementing other partitioning strategies? I see mysql 5.1 will have support for hashes and stuff but didn't see anything in the todos for postgres. Cheers Antoine -- This is where I should put some witty comment. From pgsql-performance-owner@postgresql.org Sun Mar 19 10:25:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8FA549DCB89; Sun, 19 Mar 2006 10: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 23680-10; Sun, 19 Mar 2006 10:25:25 -0400 (AST) X-Greylist: delayed 00:18:27.844968 by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from fdlnint02.fds.com (fdlnint02.fds.com [208.15.91.51]) by postgresql.org (Postfix) with ESMTP id F32F49DCB7F; Sun, 19 Mar 2006 10:25:19 -0400 (AST) In-Reply-To: Subject: Re: database model tshirt sizes To: "NbForYou" Cc: pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org X-Mailer: Lotus Notes Release 6.5.4 March 27, 2005 Message-ID: From: Patrick Hatcher Date: Sun, 19 Mar 2006 05:59:35 -0800 X-MIMETrack: Serialize by Router on FDLNINT02/FSG/SVR/FDS(Release 6.5.2|June 01, 2004) at 03/19/2006 09:25:32 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.15 required=5 tests=[AWL=0.150] X-Spam-Score: 0.15 X-Spam-Level: X-Archive-Number: 200603/316 X-Sequence-Number: 17753 We have size and color in the product table itself. It is really an attribute of the product. If you update the availability of the product often, I would split out the quantity into a separate table so that you can truncate and update as needed. Patrick Hatcher Development Manager Analytics/MIO Macys.com "NbForYou" To Sent by: pgsql-performance cc -owner@postgresql .org Subject [PERFORM] database model tshirt sizes 03/18/06 07:03 AM Hello, Does anybody know how to build a database model to include sizes for rings, tshirts, etc? the current database is built like: table product ========= productid int8 PK productname charvar(255) quantity int4 what i want now is that WHEN (not all products have multiple sizes) there are multiple sizes available. The sizes are stored into the database. I was wondering to include a extra table: table sizes: ======== productid int8 FK size varchar(100) but then i have a quantity problem. Because now not all size quantities can be stored into this table, because it allready exist in my product table. How do professionals do it? How do they make their model to include sizes if any available? From pgsql-performance-owner@postgresql.org Sun Mar 19 10:38:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7AF1F9DCB7F; Sun, 19 Mar 2006 10:38: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 24896-08; Sun, 19 Mar 2006 10:38:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- 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 34F089DCD22; Sun, 19 Mar 2006 10:37:57 -0400 (AST) Received: from iwing by mail.refusion.com (Cipher TLSv1:RC4-MD5:128) (MDaemon.PRO.v8.1.4.R) with ESMTP id md50000577461.msg; Sun, 19 Mar 2006 15:37:59 +0100 Message-ID: <058d01c64b62$b6323620$0201a8c0@iwing> From: To: "NbForYou" Cc: , References: Subject: Re: database model tshirt sizes Date: Sun, 19 Mar 2006 15:37:53 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.1830 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.1830 X-Authenticated-Sender: info@alternize.com X-Spam-Processed: mail.refusion.com, Sun, 19 Mar 2006 15:37:59 +0100 (not processed: message from trusted or authenticated source) X-MDRemoteIP: 212.254.173.184 X-Return-Path: me@alternize.com X-ClamAV: Pass X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.739 required=5 tests=[AWL=-0.684, DNS_FROM_RFC_DSN=2.872, NO_REAL_NAME=0.55, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 2.739 X-Spam-Level: ** X-Archive-Number: 200603/317 X-Sequence-Number: 17754 another approach would be: table product: > productid int8 PK > productname charvar(255) table versions > productid int8 FK > versionid int8 PK > size > color > ... > quantity int4 an example would be then: table product: - productid: 123, productname: 'nice cotton t-shirt' - productid: 442, productname: 'another cotton t-shirt' table versions: - productid: 123, versionid: 1, color: 'black', size: 'all', quantity: 11 - productid: 442, versionid: 2, color: 'yellow', size: 'l', quantity: 1 - productid: 442, versionid: 2, color: 'yellow', size: 's', quantity: 4 - productid: 442, versionid: 2, color: 'red', size: 'xl', quantity: 9 - productid: 442, versionid: 2, color: 'blue', size: 's', quantity: 0 that way you can have more than 1 quantity / color / size combination per product and still have products that come in one size. so instead of only using a 2nd table for cases where more than one size is available, you would always use a 2nd table. this probably reduces your code complexity quite a bit and only needs 1 JOIN. - thomas ----- Original Message ----- From: "Patrick Hatcher" To: "NbForYou" Cc: ; Sent: Sunday, March 19, 2006 2:59 PM Subject: Re: [PERFORM] database model tshirt sizes > We have size and color in the product table itself. It is really an > attribute of the product. If you update the availability of the product > often, I would split out the quantity into a separate table so that you > can > truncate and update as needed. > > Patrick Hatcher > Development Manager Analytics/MIO > Macys.com > > > > "NbForYou" > .com> To > Sent by: > pgsql-performance cc > -owner@postgresql > .org Subject > [PERFORM] database model tshirt > sizes > 03/18/06 07:03 AM > > > > > > > > > > Hello, > > Does anybody know how to build a database model to include sizes for > rings, > tshirts, etc? > > > the current database is built like: > > table product > ========= > > productid int8 PK > productname charvar(255) > quantity int4 > > > what i want now is that WHEN (not all products have multiple sizes) there > are multiple sizes available. The sizes are stored into the database. I > was > wondering to include a extra table: > > table sizes: > ======== > productid int8 FK > size varchar(100) > > > but then i have a quantity problem. Because now not all size quantities > can > be stored into this table, because it allready exist in my product table. > > How do professionals do it? How do they make their model to include sizes > if any available? > > > ---------------------------(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 Sun Mar 19 10:47:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F18FB9DCDBA for ; Sun, 19 Mar 2006 10:47: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 23678-09 for ; Sun, 19 Mar 2006 10:47:41 -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 BC9709DCD22 for ; Sun, 19 Mar 2006 10:47:34 -0400 (AST) Received: from [84.143.43.47] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu10) with ESMTP (Nemesis), id 0ML31I-1FKzBy2A8g-0003gp; Sun, 19 Mar 2006 15:47:38 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1FKzBx-0005gD-4M; Sun, 19 Mar 2006 15:47:37 +0100 Message-ID: <441D6F04.10302@pse-consulting.de> Date: Sun, 19 Mar 2006 15:47:32 +0100 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Antoine CC: pgsql-performance@postgresql.org Subject: Re: n00b autovacuum question References: <92d3a4950603180401p7deb391cp@mail.gmail.com> <441C4758.9000205@pse-consulting.de> <92d3a4950603190427m47f5fad6k@mail.gmail.com> In-Reply-To: <92d3a4950603190427m47f5fad6k@mail.gmail.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.081 required=5 tests=[AWL=0.081] X-Spam-Score: 0.081 X-Spam-Level: X-Archive-Number: 200603/318 X-Sequence-Number: 17755 Antoine wrote: > On 18/03/06, Andreas Pflug wrote: > >>Antoine wrote: >> >>>Hi, >>>I have enabled the autovacuum daemon, but occasionally still get a >>>message telling me I need to run vacuum when I access a table in >>>pgadmin. Bring up the postgresql.conf editor on that server, and watch if pgadmin complains. Regards, Andreas From pgsql-performance-owner@postgresql.org Sun Mar 19 11:34:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 055299DC987 for ; Sun, 19 Mar 2006 11:34: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 38618-02 for ; Sun, 19 Mar 2006 11:34:41 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from pproxy.gmail.com (pproxy.gmail.com [64.233.166.178]) by postgresql.org (Postfix) with ESMTP id EB1659DC944 for ; Sun, 19 Mar 2006 11:34:34 -0400 (AST) Received: by pproxy.gmail.com with SMTP id i75so1402092pye for ; Sun, 19 Mar 2006 07:34:39 -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=jwImvf77rU4DyBtPMIzuQcaby4ZUuS81bixejyZA78UdTf/7prHot1JmvFOGRPXvPNp7cngp49ApxK+4tq5+5gC7taVbqRkqETWdCEHZhuwDxwOHAFoQw8YB9VFOJenBGL07XJGbDtKWtmBvXHajCd0FrT4SKlgq+EMfrFAerPI= Received: by 10.35.121.2 with SMTP id y2mr1352235pym; Sun, 19 Mar 2006 07:34:39 -0800 (PST) Received: by 10.35.37.10 with HTTP; Sun, 19 Mar 2006 07:34:39 -0800 (PST) Message-ID: <92d3a4950603190734w14fd1af3i@mail.gmail.com> Date: Sun, 19 Mar 2006 16:34:39 +0100 From: Antoine To: "Andreas Pflug" Subject: Re: n00b autovacuum question Cc: pgsql-performance@postgresql.org In-Reply-To: <441D6F04.10302@pse-consulting.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <92d3a4950603180401p7deb391cp@mail.gmail.com> <441C4758.9000205@pse-consulting.de> <92d3a4950603190427m47f5fad6k@mail.gmail.com> <441D6F04.10302@pse-consulting.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.832 required=5 tests=[AWL=-0.500, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.832 X-Spam-Level: X-Archive-Number: 200603/319 X-Sequence-Number: 17756 On 19/03/06, Andreas Pflug wrote: > Antoine wrote: > > On 18/03/06, Andreas Pflug wrote: > > > >>Antoine wrote: > >> > >>>Hi, > >>>I have enabled the autovacuum daemon, but occasionally still get a > >>>message telling me I need to run vacuum when I access a table in > >>>pgadmin. > > Bring up the postgresql.conf editor on that server, and watch if pgadmin > complains. Hi, I am not sure I understand what "bring up" means. Could you explain? Thanks Antoine -- This is where I should put some witty comment. From pgsql-performance-owner@postgresql.org Sun Mar 19 13:43:56 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 440CB9DCA4D for ; Sun, 19 Mar 2006 13:43: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 60297-03 for ; Sun, 19 Mar 2006 13:44:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay107-dav6.bay107.hotmail.com [64.4.51.78]) by postgresql.org (Postfix) with ESMTP id 504979DCA5F for ; Sun, 19 Mar 2006 13:43:53 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 19 Mar 2006 09:43:58 -0800 Message-ID: Received: from 84.193.85.191 by BAY107-DAV6.phx.gbl with DAV; Sun, 19 Mar 2006 17:43:55 +0000 X-Originating-IP: [84.193.85.191] X-Originating-Email: [nbforyou@hotmail.com] X-Sender: nbforyou@hotmail.com From: "NbForYou" To: Cc: , References: <058d01c64b62$b6323620$0201a8c0@iwing> Subject: Re: database model tshirt sizes Date: Sun, 19 Mar 2006 18:43:53 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 19 Mar 2006 17:43:58.0966 (UTC) FILETIME=[B3B52960:01C64B7C] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.599 required=5 tests=[AWL=-0.320, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.599 X-Spam-Level: * X-Archive-Number: 200603/321 X-Sequence-Number: 17758 So a default value for all products would be size:"all" for example, the same tshirt shop also sells cdroms. It size attribute would be to place it to be :"all". (because we cannot place an uniqe index on null values) But the industry evolves and so in time the same cdrom is now available for pc and playstation. So i would like to have it as 1 productid but with different attributes: pc (with quantity 5) and playstation (with quantity 3). So when I do an insert for this 2 products with 1 productid it would be like: insert into versions (productid,size,quantity) values (345,'pc',5); insert into versions (productid,size,quantity) values (345,'playstation',3); if however the product existed we get an error: because the default value version "all" did also exist and is now obsolete population versions: ================ productid: 123, versionid: 1, color: 'black', size: 'all', quantity: 11 productid: 442, versionid: 2, color: 'yellow', size: 'l', quantity: 1 productid: 442, versionid: 2, color: 'yellow', size: 's', quantity: 4 productid: 442, versionid: 2, color: 'red', size: 'xl', quantity: 9 productid: 442, versionid: 2, color: 'blue', size: 's', quantity: 0 productid: 345, versionid: 3, color: null, size: 'all', quantity: 15 productid: 345, versionid: 3, color: null, size: 'pc', quantity: 5 productid: 345, versionid: 3, color: null, size: 'playstation', quantity: 3 WOULD HAVE TO BE: population versions: ================ productid: 123, versionid: 1, color: 'black', size: 'all', quantity: 11 productid: 442, versionid: 2, color: 'yellow', size: 'l', quantity: 1 productid: 442, versionid: 2, color: 'yellow', size: 's', quantity: 4 productid: 442, versionid: 2, color: 'red', size: 'xl', quantity: 9 productid: 442, versionid: 2, color: 'blue', size: 's', quantity: 0 productid: 345, versionid: 3, color: null, size: 'pc', quantity: 5 productid: 345, versionid: 3, color: null, size: 'playstation', quantity: 3 ALSO: what is versionid used for? ----- Original Message ----- From: To: "NbForYou" Cc: ; Sent: Sunday, March 19, 2006 3:37 PM Subject: Re: [PERFORM] database model tshirt sizes > another approach would be: > > table product: >> productid int8 PK >> productname charvar(255) > > table versions >> productid int8 FK >> versionid int8 PK >> size >> color >> ... >> quantity int4 > > an example would be then: > > table product: > - productid: 123, productname: 'nice cotton t-shirt' > - productid: 442, productname: 'another cotton t-shirt' > > table versions: > - productid: 123, versionid: 1, color: 'black', size: 'all', quantity: 11 > - productid: 442, versionid: 2, color: 'yellow', size: 'l', quantity: 1 > - productid: 442, versionid: 2, color: 'yellow', size: 's', quantity: 4 > - productid: 442, versionid: 2, color: 'red', size: 'xl', quantity: 9 > - productid: 442, versionid: 2, color: 'blue', size: 's', quantity: 0 > > > that way you can have more than 1 quantity / color / size combination per > product and still have products that come in one size. so instead of only > using a 2nd table for cases where more than one size is available, you > would always use a 2nd table. this probably reduces your code complexity > quite a bit and only needs 1 JOIN. > > - thomas > > > > ----- Original Message ----- > From: "Patrick Hatcher" > To: "NbForYou" > Cc: ; > > Sent: Sunday, March 19, 2006 2:59 PM > Subject: Re: [PERFORM] database model tshirt sizes > > >> We have size and color in the product table itself. It is really an >> attribute of the product. If you update the availability of the product >> often, I would split out the quantity into a separate table so that you >> can >> truncate and update as needed. >> >> Patrick Hatcher >> Development Manager Analytics/MIO >> Macys.com >> >> >> >> "NbForYou" >> > .com> To >> Sent by: >> pgsql-performance cc >> -owner@postgresql >> .org Subject >> [PERFORM] database model tshirt >> sizes >> 03/18/06 07:03 AM >> >> >> >> >> >> >> >> >> >> Hello, >> >> Does anybody know how to build a database model to include sizes for >> rings, >> tshirts, etc? >> >> >> the current database is built like: >> >> table product >> ========= >> >> productid int8 PK >> productname charvar(255) >> quantity int4 >> >> >> what i want now is that WHEN (not all products have multiple sizes) there >> are multiple sizes available. The sizes are stored into the database. I >> was >> wondering to include a extra table: >> >> table sizes: >> ======== >> productid int8 FK >> size varchar(100) >> >> >> but then i have a quantity problem. Because now not all size quantities >> can >> be stored into this table, because it allready exist in my product table. >> >> How do professionals do it? How do they make their model to include sizes >> if any available? >> >> >> ---------------------------(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 >> > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Sun Mar 19 14:19:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6B12D9DC821 for ; Sun, 19 Mar 2006 14:19: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 64092-04 for ; Sun, 19 Mar 2006 14:19:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from anchor-post-36.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by postgresql.org (Postfix) with ESMTP id 48A699DC847 for ; Sun, 19 Mar 2006 14:19:47 -0400 (AST) Received: from mailgate.vale-housing.co.uk ([194.217.48.34] helo=vale-housing.co.uk) by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) id 1FL2VM-0009uy-Lq for pgsql-performance@postgresql.org; Sun, 19 Mar 2006 18:19:52 +0000 Received: from 192.168.1.106 ([192.168.1.106]) by ratbert.vale-housing.co.uk ([192.168.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sun, 19 Mar 2006 18:19:52 +0000 From: "Dave Page" To: , , Cc: Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Message-ID: <008b01c64b81$b737fcb0$6a01a8c0@valehousing.co.uk> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Sun, 19 Mar 2006 18:19:40 -0000 MIME-Version: 1.0 Thread-Topic: [PERFORM] Best OS & Configuration for Dual Xeon w/4GB & thread-index: AcZKIDwQk+uFjzHfRo2txPlZ02oXPABasGbcAAJRnDo= X-MimeOLE: Produced By Microsoft Exchange V6.5 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=3.018 required=5 tests=[AWL=-2.385, MSGID_DOLLARS=2.163, RATWARE_MS_HASH=1.379, RATWARE_OUTLOOK_NONAME=1.861] X-Spam-Score: 3.018 X-Spam-Level: *** X-Archive-Number: 200603/322 X-Sequence-Number: 17759 -----Original Message----- From: "Luke Lonergan" Sent: 19/03/06 16:26:58 To: "Kenji Morishige", "Claus = Guttesen" Cc: "pgsql-performance@postgresql.org" Subject: Re: [PERFORM] Best OS & Configuration for Dual Xeon w/4GB & > I notice that no one asked you about your disk bandwidth - the Adaptec = 2200S >is a "known bad" controller -=20 Agreed - We have a couple at work which got relagated to use in 'toy' = boxes when we realised how bad they were, long before they ever saw any = production use. Regards, Dave -----Unmodified Original Message----- Kenji, On 3/17/06 4:08 PM, "Kenji Morishige" wrote: > Thanks guys, I'm studying each of your responses and am going to start = to > experiement. I notice that no one asked you about your disk bandwidth - the Adaptec = 2200S is a "known bad" controller - the bandwidth to/from in RAID5 is about = 1/2 to 1/3 of a single disk drive, which is far too slow for a 10GB database, = and IMO should disqualify a RAID adapter from being used at all. Without fixing this, I'd suggest that all of the other tuning described = here will have little value, provided your working set is larger than your = RAM. You should test the I/O bandwidth using these simple tests: time bash -c "dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D1000000 = && sync" then: time dd if=3Dbigfile of=3D/dev/null bs=3D8k You should get on the order of 150MB/s on four disk drives in RAID5. And before people jump in about "random I/O", etc, the sequential scan = test will show whether the controller is just plain bad very quickly. If it can't do sequential fast, it won't do seeks fast either. - Luke ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Sun Mar 19 12:26:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9518A9DCDC1 for ; Sun, 19 Mar 2006 12:26: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 45664-07 for ; Sun, 19 Mar 2006 12:26:29 -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 524739DCDC9 for ; Sun, 19 Mar 2006 12:26:22 -0400 (AST) Received: from 172.16.1.25 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Sun, 19 Mar 2006 11:26:21 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 19 Mar 2006 11:26:21 -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.106]) with Microsoft Exchange Server HTTP-DAV ; Sun, 19 Mar 2006 16:26:21 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Sun, 19 Mar 2006 11:26:16 -0800 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: "Luke Lonergan" To: "Kenji Morishige" , "Claus Guttesen" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Thread-Index: AcZKIDwQk+uFjzHfRo2txPlZ02oXPABasGbc In-Reply-To: <20060318000855.GB14661@juniper.net> MIME-Version: 1.0 X-OriginalArrivalTime: 19 Mar 2006 16:26:21.0572 (UTC) FILETIME=[DBAF3C40:01C64B71] X-WSS-ID: 680359A72JC81074-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.349 required=5 tests=[AWL=0.096, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.349 X-Spam-Level: * X-Archive-Number: 200603/320 X-Sequence-Number: 17757 Kenji, On 3/17/06 4:08 PM, "Kenji Morishige" wrote: > Thanks guys, I'm studying each of your responses and am going to start to > experiement. I notice that no one asked you about your disk bandwidth - the Adaptec 2200S is a "known bad" controller - the bandwidth to/from in RAID5 is about 1/2 to 1/3 of a single disk drive, which is far too slow for a 10GB database, and IMO should disqualify a RAID adapter from being used at all. Without fixing this, I'd suggest that all of the other tuning described here will have little value, provided your working set is larger than your RAM. You should test the I/O bandwidth using these simple tests: time bash -c "dd if=/dev/zero of=bigfile bs=8k count=1000000 && sync" then: time dd if=bigfile of=/dev/null bs=8k You should get on the order of 150MB/s on four disk drives in RAID5. And before people jump in about "random I/O", etc, the sequential scan test will show whether the controller is just plain bad very quickly. If it can't do sequential fast, it won't do seeks fast either. - Luke From pgsql-performance-owner@postgresql.org Mon Mar 20 00:27:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BAE5A9DC991 for ; Mon, 20 Mar 2006 00:27: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 63092-01 for ; Mon, 20 Mar 2006 00:27:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gw.proximity.com.au (147-68-185-210.rev.techex.net.au [210.185.68.147]) by postgresql.org (Postfix) with ESMTP id F2C0B9DC987 for ; Mon, 20 Mar 2006 00:27:33 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by gw.proximity.com.au (Postfix) with ESMTP id EC9401F43B6 for ; Mon, 20 Mar 2006 15:27:32 +1100 (EST) Received: from gw.proximity.com.au ([127.0.0.1]) by localhost (gw [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15235-02 for ; Mon, 20 Mar 2006 15:27:31 +1100 (EST) Received: from [192.168.128.103] (bee.proximity.com.au [192.168.128.103]) by gw.proximity.com.au (Postfix) with ESMTP id 8F6241F26C8 for ; Mon, 20 Mar 2006 15:27:31 +1100 (EST) Message-ID: <441E2F29.3030004@proximity.com.au> Date: Mon, 20 Mar 2006 15:27:21 +1100 From: Tim Allen 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: partial indexes and inference Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at proximity.com.au 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: 200603/323 X-Sequence-Number: 17760 I have a case where it seems the planner should be able to infer more from its partial indexes than it is doing. Observe: px=# select version(); version ------------------------------------------------------------------------ PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 (1 row) px=# \d pxmdvalue Table "store.pxmdvalue" Column | Type | Modifiers ------------+----------+----------- entityid | bigint | not null fieldid | integer | not null value | text | not null datatypeid | integer | not null tsi | tsvector | Indexes: "pxmdvalue_pk" PRIMARY KEY, btree (entityid, fieldid) "pxmdvalue_atom_val_idx" btree (value) WHERE datatypeid = 22 "pxmdvalue_bigint_val_idx" btree ((value::bigint)) WHERE datatypeid = 43 "pxmdvalue_datatypeid_idx" btree (datatypeid) "pxmdvalue_int_val_idx" btree ((value::integer)) WHERE datatypeid = 16 "pxmdvalue_str32_val0_idx" btree (lower(value)) WHERE datatypeid = 2 AND octet_length(value) < 2700 "pxmdvalue_str32_val1_idx" btree (lower(value) text_pattern_ops) WHERE datatypeid = 2 AND octet_length(value) < 2700 "pxmdvalue_str_val0_idx" btree (lower(value)) WHERE datatypeid = 85 AND octet_length(value) < 2700 "pxmdvalue_str_val1_idx" btree (lower(value) text_pattern_ops) WHERE datatypeid = 85 AND octet_length(value) < 2700 "pxmdvalue_time_val_idx" btree (px_text2timestamp(value)) WHERE datatypeid = 37 px=# explain analyse select * from pxmdvalue where datatypeid = 43 and fieldid = 857 and cast(value as bigint) = '1009'; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- Bitmap Heap Scan on pxmdvalue (cost=2143.34..2685.74 rows=1 width=245) (actual time=144.411..144.415 rows=1 loops=1) Recheck Cond: (((value)::bigint = 1009::bigint) AND (datatypeid = 43)) Filter: (fieldid = 857) -> BitmapAnd (cost=2143.34..2143.34 rows=138 width=0) (actual time=144.394..144.394 rows=0 loops=1) -> Bitmap Index Scan on pxmdvalue_bigint_val_idx (cost=0.00..140.23 rows=1758 width=0) (actual time=0.021..0.021 rows=2 loops=1) Index Cond: ((value)::bigint = 1009::bigint) -> Bitmap Index Scan on pxmdvalue_datatypeid_idx (cost=0.00..2002.85 rows=351672 width=0) (actual time=144.127..144.127 rows=346445 loops=1) Index Cond: (datatypeid = 43) Total runtime: 144.469 ms (9 rows) px=# drop index pxmdvalue_datatypeid_idx; DROP INDEX px=# explain analyse select * from pxmdvalue where datatypeid = 43 and fieldid = 857 and cast(value as bigint) = '1009'; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------- Index Scan using pxmdvalue_bigint_val_idx on pxmdvalue (cost=0.00..6635.06 rows=1 width=245) (actual time=0.018..0.022 rows=1 loops=1) Index Cond: ((value)::bigint = 1009::bigint) Filter: (fieldid = 857) Total runtime: 0.053 ms (4 rows) Notice the two bitmap index scans in the first version of the query. The one that hits the pxmdvalue_bigint_val_idx actually subsumes the work of the second one, as it is a partial index on the same condition that the second bitmap scan is checking. So that second bitmap scan is a complete waste of time and effort, afaict. When I remove the pxmdvalue_datatypeid_idx index, to prevent it using that second bitmap scan, the resulting query is much faster, although its estimated cost is rather higher. Any clues, anyone? Is this indeed a limitation of the query planner, in that it doesn't realise that the partial index is all it needs here? Or is something else going on that is leading the cost estimation astray? Tim -- ----------------------------------------------- Tim Allen tim@proximity.com.au Proximity Pty Ltd http://www.proximity.com.au/ From pgsql-performance-owner@postgresql.org Mon Mar 20 04:14:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 109A89DCB4E for ; Mon, 20 Mar 2006 04:14: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 01371-06 for ; Mon, 20 Mar 2006 04:14:43 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id B0B5F9DCAB9 for ; Mon, 20 Mar 2006 04:14:40 -0400 (AST) Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by svr4.postgresql.org (Postfix) with ESMTP id 8964E5AF91F for ; Mon, 20 Mar 2006 08:14:41 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id BEC73A82C6; Mon, 20 Mar 2006 09:14:46 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 17629-03; Mon, 20 Mar 2006 09:14:46 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 41CC9A82BD; Mon, 20 Mar 2006 09:14:46 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id E55A91836A8; Mon, 20 Mar 2006 09:14:32 +0100 (CET) To: "Guillaume Smet" Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? References: <87ek11gz69.fsf@meuh.mnc.lan> <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> X-Hashcash: 1:20:060320:guillaume.smet@gmail.com::XwUn1IhxIyAvsGPb:000000000000000000000000000000000000018Y4 X-Hashcash: 1:20:060320:pgsql-performance@postgresql.org::HmDBMIaqQiHTITeZ:0000000000000000000000000000035PF From: Guillaume Cottenceau Date: 20 Mar 2006 09:14:32 +0100 In-Reply-To: <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> Message-ID: <87hd5tmt1z.fsf@meuh.mnc.lan> Lines: 78 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: amavisd-new at mnc.ch 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: 200603/324 X-Sequence-Number: 17761 Guillaume, Thanks for your answer. > On 17 Mar 2006 11:09:50 +0100, Guillaume Cottenceau > wrote: > > Reading the documentation and postgresql list archives, I have > > run ANALYZE right before my tests, I have increased the > > statistics target to 50 for the considered table; my problem is > > that the index scan cost reported by EXPLAIN seems to be around > > 12.7 times higher that it should, a figure I suppose incompatible > > (too large) for just random_page_cost and effective_cache_size > > tweaks. > > It's not surprising you have a high cost for an index scan which is > planned to return and returns so much rows. I really don't think the > planner does something wrong on this one. My point is that the planner's cost estimate is way above the actual cost of the query, so the planner doesn't use the best plan. Even if the index returns so much rows, actual cost of the query is so that index scan (worst case, all disk cache flushed) is still better than seq scan but the planner uses seq scan. > AFAIK, increasing the statistics target won't do anything to reduce > the cost as the planner estimation for the number of returned rows is > already really accurate and probably can't be better. Ok, thanks. > > Of course real queries use smaller date ranges. > > What about providing us the respective plans for your real queries? > And in a real case. It's a bad idea to compare index scan and seqscan The original query is more complicated and sometimes involves restricting the resultset with another constraint. I am not sure it is very interesting to show it; I know that best performance would be achieved with an index on the date column for the shown query, and an index on the date column and the other column when doing a query on these.. > when your data have to be loaded in RAM. What do you mean? That I should not flush disk cache before timing? I did so to find the worst case.. I am not sure it is the best solution.. maybe half worst case would be? but this depends a lot on whether the index pages would stay in disk cache or not before next query.. which cannot be told for sure unless a full serious timing of the real application is done (and my application can be used in quite different scenarios, which means such a test is not entirely possible/meaningful). > Before doing so create an index on the date column to have the most > effective index possible. Yes, as I said, I know that doing this would improve a lot the queries. My point was to understand why the cost of the index scan is so "inaccurate" compared to actual cost. Adding an index on the date column enlarges the data by 100-150M so I'd rather save this if possible. > > - I then tried to tweak random_page_cost and effective_cache_size > > following advices from documentation: > > > > SET random_page_cost = 2; > > random_page_cost is the way to go for this sort of thing but I don't > think it's a good idea to have it too low globally and I'm still Thanks, I suspected so. > thinking the problem is that your test case is not accurate. Ok. -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Mon Mar 20 04:35:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6EC119DCA20 for ; Mon, 20 Mar 2006 04:35: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 06325-02 for ; Mon, 20 Mar 2006 04:35:22 -0400 (AST) X-Greylist: delayed 00:20:41.623365 by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id E92DF9DC812 for ; Mon, 20 Mar 2006 04:35:18 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id A448EA82C6; Mon, 20 Mar 2006 09:35:29 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 17629-10; Mon, 20 Mar 2006 09:35:28 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 1F44FA82BD; Mon, 20 Mar 2006 09:35:28 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id B71EA1837A5; Mon, 20 Mar 2006 09:35:14 +0100 (CET) To: Mark Kirkwood Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> X-Hashcash: 1:20:060320:markir@paradise.net.nz::u5GwmW0QvWXTMLe4:000000000000000000000000000000000000000BnIb X-Hashcash: 1:20:060320:pgsql-performance@postgresql.org::xRkc/fRx26gevpKR:000000000000000000000000000000YFv From: Guillaume Cottenceau Date: 20 Mar 2006 09:35:14 +0100 In-Reply-To: <441CDAAA.20609@paradise.net.nz> Message-ID: <87d5ghms3h.fsf@meuh.mnc.lan> Lines: 63 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: amavisd-new at mnc.ch 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: 200603/325 X-Sequence-Number: 17762 Hi Mark, Thanks for your reply. > Guillaume Cottenceau wrote: [...] > > Btw, I use postgres 7.4.5 with -B 1000 -N 500 and all > > postgresql.conf default values except timezone = 'UTC', on an > > ext3 partition with data=ordered, and run Linux 2.6.12. > > I didn't see any mention of how much memory is on your server, but > provided you have say 1G, and are using the box solely for a database > server, I would increase both shared_buffers and effective_cache size. This test machine has 1G of (real) memory, servers often have 2G or 4G. The thing is that the application runs on the same machine, and as it is a java application, it takes up a little memory too (we can say half of it should go to java and half to postgres, I guess). Determining the best memory "plan" is not so easy, though your information is priceless and will help a lot! > shared_buffer = 12000 > effective_cache_size = 25000 > > This would mean you are reserving 100M for Postgres to cache relation > pages, and informing the planner that it can expect ~200M available > from the disk buffer cache. To give a better recommendation, we need Ok, thanks. I wanted to investigate this field, but as the application is multithreaded and uses a lot of postgres clients, I wanted to make sure the shared_buffers values is globally for postgres, not just per (TCP) connection to postgres, before increasing the value, fearing to take the whole server down. On a server with 235 connections and -N 512 -B 1024, reading http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html I came up with the following figure: for i in `pidof postmaster`; do pmap -d $i | grep -i writeable ; done | perl -MMDK::Common -ne 'do { push @a, $1; $tot += $1 } if /writeable.private: (\d+)K/; END { print "total postgres private memory: ${tot}K\nmin: " . min(@a) . "K\nmax: " . max(@a) . "K\n"; }' total postgres private memory: 432080K min: 936K max: 4216K As the server has 2G of memory, I was reluctant to increase the amount of shared memory since overall postgres memory use seems already quite high - though 100M more would not kill the server, obviously. Btw, can you comment on the upper figures? > to know more about your server and workload (e.g server memory > configuration and usage plus how close you get to 500 connections). Depending on the server, it can have 200, up to around 400 connections open. As of workload, I am not sure what metrics are suitable. Typically postgres can be seen in the top processes but most queries are quick and average load average reported by the linux kernel is nearly always below 0.3, and often 0.1. These are single or dual xeon 2.8 GHz machines with hardware raid (megaraid or percraid driver) with reasonable performance. -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Mon Mar 20 06:46:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1FD269DC821 for ; Mon, 20 Mar 2006 06: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 46110-06 for ; Mon, 20 Mar 2006 06:46:13 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.202]) by postgresql.org (Postfix) with ESMTP id 26CA09DC87F for ; Mon, 20 Mar 2006 06:46:08 -0400 (AST) Received: by xproxy.gmail.com with SMTP id t5so779444wxc for ; Mon, 20 Mar 2006 02:46: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:mime-version:content-type:content-transfer-encoding:content-disposition; b=CQ7pnc3Fb/Gl5U0J7QAmXYlfMqAceoS/zcsYZoWs7SfmgSM5azL7N5zz300ip4bdXkfbfHs00rMPnqMPyAj9zFX5vphIbb/cDZCAtvk10Qu8ANs7CnCHyNULiv6ey/wa1rrrQUEfd0uspFhl6MGQsPx7zHJpm9pk5a1jiGBvjog= Received: by 10.70.77.9 with SMTP id z9mr1917727wxa; Mon, 20 Mar 2006 02:46:11 -0800 (PST) Received: by 10.70.116.13 with HTTP; Mon, 20 Mar 2006 02:46:11 -0800 (PST) Message-ID: <130df1930603200246j4bd6c6a1r7204a644795ef412@mail.gmail.com> Date: Mon, 20 Mar 2006 11:46:11 +0100 From: "Ksenia Marasanova" To: pgsql-performance@postgresql.org Subject: data doesnt get saved in the database / idle in transaction 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: 200603/326 X-Sequence-Number: 17763 Hi, I have a strange problem with my Postgres application. The problem is that the data entered in the application never reaches the database, although the record id (serial) is generated, and the record can be retrieved again, and be modified. Multiple records can be added and modified. But when i check the data with psql, the record is not there. The application uses persistant database connection, and when i check the status of the connection, it shows: "idle in transaction". I am pretty sure that every insert is being committed with explicit "commit()" . It always worked before.... weird. thanks for any hints Ksenia. From pgsql-performance-owner@postgresql.org Mon Mar 20 08:06:43 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C48C39DC940 for ; Mon, 20 Mar 2006 08:06: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 61899-03 for ; Mon, 20 Mar 2006 08:06:45 -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 A15E59DC888 for ; Mon, 20 Mar 2006 08:06:40 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id BD54630CBA; Mon, 20 Mar 2006 13:06:43 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: data doesnt get saved in the database / idle in transaction Date: Mon, 20 Mar 2006 20:03:14 +0800 Organization: Hub.Org Networking Services Lines: 17 Message-ID: References: <130df1930603200246j4bd6c6a1r7204a644795ef412@mail.gmail.com> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 To: pgsql-performance@postgresql.org 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: 200603/327 X-Sequence-Number: 17764 ""Ksenia Marasanova"" wrote > > The application uses persistant database connection, and when i check > the status of the connection, it shows: "idle in transaction". I am > pretty sure that every insert is being committed with explicit > "commit()" . It always worked before.... weird. > Try to use the following command to see what commands reach the server: set log_statement = "all"; Regards, Qingqing From pgsql-performance-owner@postgresql.org Mon Mar 20 10:45:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C69099DCF5B for ; Mon, 20 Mar 2006 10:45: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 89253-09 for ; Mon, 20 Mar 2006 10:45:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 72F189DCCED for ; Mon, 20 Mar 2006 10:45:00 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id EE3B756423; Mon, 20 Mar 2006 08:45:04 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Mon, 20 Mar 2006 08:45:04 -0600 Date: Mon, 20 Mar 2006 08:45:04 -0600 From: "Jim C. Nasby" To: Scott Marlowe Cc: Kenji Morishige , pgsql-performance@postgresql.org Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Message-ID: <20060320144503.GR15742@pervasive.com> References: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1142636433.1141.33.camel@state.g2switchworks.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060320:smarlowe@g2switchworks.com::PSO5VOPuhJso0c0X:00000000000 0000000000000000000000009d6T X-Hashcash: 1:20:060320:kenjim@juniper.net::Gi3gJQwMg/z5rTKv:0000000000000000000 0000000000000000000000002SmI X-Hashcash: 1:20:060320:pgsql-performance@postgresql.org::bxZgs0fGFPqd9OsI:00000 0000000000000000000000000Owt X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/328 X-Sequence-Number: 17765 On Fri, Mar 17, 2006 at 05:00:34PM -0600, Scott Marlowe wrote: > > last pid: 5788; load averages: 0.32, 0.31, 0.28 up 127+15:16:08 13:59:24 > > 169 processes: 1 running, 168 sleeping > > CPU states: 5.4% user, 0.0% nice, 9.9% system, 0.0% interrupt, 84.7% idle > > Mem: 181M Active, 2632M Inact, 329M Wired, 179M Cache, 199M Buf, 81M Free > > Swap: 4096M Total, 216K Used, 4096M Free > > > > PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND > > 14501 pgsql 2 0 254M 242M select 2 76:26 1.95% 1.95% postgre > > 5720 root 28 0 2164K 1360K CPU0 0 0:00 1.84% 0.88% top > > 5785 pgsql 2 0 255M 29296K sbwait 0 0:00 3.00% 0.15% postgre > > 5782 pgsql 2 0 255M 11900K sbwait 0 0:00 3.00% 0.15% postgre > > 5772 pgsql 2 0 255M 11708K sbwait 2 0:00 1.54% 0.15% postgre > > That doesn't look good. Is this machine freshly rebooted, or has it > been running postgres for a while? 179M cache and 199M buffer with 2.6 > gig inactive is horrible for a machine running a 10gig databases. No, this is perfectly fine. Inactive memory in FreeBSD isn't the same as Free. It's the same as 'active' memory except that it's pages that haven't been accessed in X amount of time (between 100 and 200 ms, I think). When free memory starts getting low, FBSD will start moving pages from the inactive queue to the free queue (possibly resulting in writes to disk along the way). IIRC, Cache is the directory cache, and Buf is disk buffers, which is somewhat akin to shared_buffers in PostgreSQL. -- 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 Mar 20 10:58:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 722569DCB9C for ; Mon, 20 Mar 2006 10:58: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 95992-01 for ; Mon, 20 Mar 2006 10:58:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) by postgresql.org (Postfix) with ESMTP id 73E849DC87F for ; Mon, 20 Mar 2006 10:58:43 -0400 (AST) Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by mail.wirelesscar.com with InterScan Messaging Security Suite; Mon, 20 Mar 2006 15:58:47 +0100 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: Migration study, step 1: bulk write performance optimization Date: Mon, 20 Mar 2006 15:59:14 +0100 Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Migration study, step 1: bulk write performance optimization Thread-Index: AcZMLtpjet9X3uR4RMOzKugOCR+80Q== From: "Mikael Carneholm" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.132 required=5 tests=[AWL=0.132] X-Spam-Score: 0.132 X-Spam-Level: X-Archive-Number: 200603/329 X-Sequence-Number: 17766 Ok, here's the deal: I am responisble for an exciting project of evaluating migration of a = medium/large application for a well-known swedish car&truck manufacturer = from a proprietary DB to Postgres. The size of the database is currently = about 50Gb, annual growth depending on sales, but probably in the = 30-50Gb range. Migrating the schema was easily done, mostly involving a search/replace = of some vendor specific datatypes. The next step is to migrate the data = itself, and for this we have written a Java app relying on JDBC metadata = to map the tables in the source schema to the target schema. The goal = right now is to find the set of parameters that gives as short bulk = insert time as possible, minimizing downtime while the data itself is = migrated. The machine used for the study is a Dell PE2850, 6GB memory, 1xXEON = 3.0GHz/2MB cache, internal SCSI 0+1 raid (currently 4x36GB 10000rpm = striped+mirrored, two more 146GB 15000rpm disks will arrive later). Not = sure about the brand/model of the raid controller, so I'll leave that = for now. File system is ext3(I know, maybe not the optimal choice but = this is how it was when I got it) with a 8k block size. The OS currently = installed is CentOS4. Until the new disks arrive, both the OS itself, pg_xlog and the data = reside on the same disks. When they arrive, I will probably move the = data to the new disks (need two more to get raid 0+1, though) and leave = the OS + pg_xlog on the 10000rpm disks. Mounting the 15000rpm data disks = with the noatime option (this is safe, right?) and using a 16kb block = size (for read performance) will probably be considered as well. NOTE: this machine/configuration is NOT what we will be using in = production if the study turns out OK, it's just supposed to work as a = development machine in the first phase whose purpose more or less is to = get familiar with configurating Postgres and see if we can get the = application up and running (we will probably use a 64bit platform and = either a FC SAN or internal raid with a battery backed cache for = production use, if all goes well). The first thing I did when I got the machine was to do a raw dd write = test: # time bash -c "(dd if=3D/dev/zero of=3D/opt/bigfile count=3D1310720 = bs=3D8k && sync)" 1310720+0 records in 1310720+0 records out real 2m21.438s user 0m0.998s sys 0m51.347s (10*1024)Mb/~141s =3D> ~75.5Mb/s As a simple benchmark, I created a simple table without PK/indexes with = 1k wide rows: create table iotest.one_kb_rows ( the_col char(1024) not null ); To fill the table, I use this simple function: create or replace function iotest.writestress(megs integer) returns void = as $$ declare char_str char(1024) :=3D repeat('x', 1024); begin for i in 1..megs loop for j in 1..1024 loop insert into one_kb_rows(the_col) values (char_str); end loop; end loop; end; $$ language plpgsql; Then, I tested how long it takes to write 10Gb of data to this table: iotest=3D> \timing Timing is on. iotest=3D> select writestress((10*1024)); writestress ------------- (1 row) Time: 379971.252 ms This gives that 10Gb takes ~380s =3D> ~27Mb/s (with fsync=3Doff), = compared to the raw dd result (~75.5Mb/s). I assume this difference is due to:=20 - simultaneous WAL write activity (assumed: for each byte written to the = table, at least one byte is also written to WAL, in effect: 10Gb data = inserted in the table equals 20Gb written to disk) - lousy test method (it is done using a function =3D> the transaction = size is 10Gb, and 10Gb will *not* fit in wal_buffers :) ) - poor config - something else?=20 I have tried to read up as much as possible on Postgres configuration = (disk layout, buffer management, WAL sync methods, etc) and found this = post regarding bgwriter tweaking: = http://archives.postgresql.org/pgsql-performance/2006-03/msg00218.php - = which explains the bgwriter config below. All params in postgresql.conf that are not commented out: --------------------------------------------------------- max_connections =3D 100 superuser_reserved_connections =3D 2 shared_buffers =3D 16000 =20 bgwriter_lru_percent =3D 20 =20 bgwriter_lru_maxpages =3D 160 =20 bgwriter_all_percent =3D 10 =20 bgwriter_all_maxpages =3D 320 =20 fsync =3D off =20 wal_sync_method =3D open_sync =20 wal_buffers =3D 128 =20 checkpoint_segments =3D 3 =20 log_filename =3D 'postgresql-%Y-%m-%d_%H%M%S.log'=20 log_rotation_age =3D 1440 =20 log_line_prefix =3D '%m: (%u@%d) '=20 lc_messages =3D 'C' =20 lc_monetary =3D 'C' =20 lc_numeric =3D 'C' =20 lc_time =3D 'C' =20 fsync can safely be kept off during data migration as we are able to = restart the procedure without losing data if something goes wrong. = Increasing chekpoint_segments to 8/16/32 only increased the insert time, = so I kept it at the default. I will increase shared_buffers and = effective_cache_size as soon as it's time to tweak read performance, but = for now I'm just focusing on write performance. Postgres version used:=20 iotest=3D> select version(); version = =20 -------------------------------------------------------------------------= -------------------------- PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.4 = 20050721 (Red Hat 3.4.4-2) (1 row) I want to make sure I have made correct assumptions before I carry on, = so comments are welcome. - Mikael From pgsql-performance-owner@postgresql.org Mon Mar 20 10:59:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B83D99DCE4C for ; Mon, 20 Mar 2006 10:59: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 94241-07 for ; Mon, 20 Mar 2006 10:59:31 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 90C039DC84A for ; Mon, 20 Mar 2006 10:59:25 -0400 (AST) Received: from maya.ngi.it (ns2.ngi.it [88.149.128.3]) by svr4.postgresql.org (Postfix) with ESMTP id AB63B5AF9A5 for ; Mon, 20 Mar 2006 14:59:30 +0000 (GMT) Received: from [192.168.0.11] (194-185-53-252.f5.ngi.it [194.185.53.252]) by maya.ngi.it (8.13.5/8.13.5) with ESMTP id k2KExPYV022615 for ; Mon, 20 Mar 2006 15:59:26 +0100 Message-ID: <441EC34D.1000901@bluestudio.it> Date: Mon, 20 Mar 2006 15:59:25 +0100 From: Marco Furetto User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Query Feromance 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.905 required=5 tests=[AWL=-0.905, RCVD_IN_WHOIS_BOGONS=1.811] X-Spam-Score: 0.905 X-Spam-Level: X-Archive-Number: 200603/330 X-Sequence-Number: 17767 Hello! Can I Increment the perfomance of execution query? Where is the instrument to analyze the query runnnig for create a Index query for a single optimize that? thank's Marco "Furetto" Berri From pgsql-performance-owner@postgresql.org Mon Mar 20 11:16:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A308E9DC84A for ; Mon, 20 Mar 2006 11: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 99462-02 for ; Mon, 20 Mar 2006 11:16:26 -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 729AF9DCCC0 for ; Mon, 20 Mar 2006 11:16:19 -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 k2KFHqwn029431; Mon, 20 Mar 2006 07:17:52 -0800 Message-ID: <441EC652.1010807@modgraph-usa.com> Date: Mon, 20 Mar 2006 07:12:18 -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: Mikael Carneholm CC: pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performance optimization References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.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.103 required=5 tests=[AWL=0.103] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200603/331 X-Sequence-Number: 17768 Mikael Carneholm wrote: > I am responisble for an exciting project of evaluating migration of a > medium/large application for a well-known swedish car&truck manufacturer > ... The goal right now is to find the set of parameters that gives as > short bulk insert time as possible, minimizing downtime while the data > itself is migrated. If you haven't explored the COPY command yet, check it out. It is stunningly fast compared to normal INSERT commands. http://www.postgresql.org/docs/8.1/static/sql-copy.html pg_dump and pg_restore make use of the COPY command. Since you're coming from a different vendor, you'd have to dump the data into a COPY-compatible set of files yourself. But it will be worth the effort. Craig From pgsql-performance-owner@postgresql.org Mon Mar 20 11:19:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C476F9DC8E1 for ; Mon, 20 Mar 2006 11:19: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 00489-01 for ; Mon, 20 Mar 2006 11:19:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by postgresql.org (Postfix) with ESMTP id 858CB9DC888 for ; Mon, 20 Mar 2006 11:19:08 -0400 (AST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by mail.ecircle.de (READY) with ESMTP id 98A2C55C01C; Mon, 20 Mar 2006 16:19:12 +0100 (CET) Received: from [192.168.1.110] ([192.168.1.110]) by deimos.muc.ecircle.de with Microsoft SMTPSVC(5.0.2195.6713); Mon, 20 Mar 2006 16:19:12 +0100 Subject: Re: Migration study, step 1: bulk write performance From: Csaba Nagy To: Mikael Carneholm Cc: postgres performance list In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> Content-Type: text/plain Message-Id: <1142867952.16487.96.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 20 Mar 2006 16:19:12 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 20 Mar 2006 15:19:12.0523 (UTC) FILETIME=[A498E5B0:01C64C31] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/332 X-Sequence-Number: 17769 Mikael, I've just recently passed such an experience, i.e. migrating from another vendor to postgres of a DB about the same size category you have. I think you got it right with the fsync turned off during migration (just don't forget to turn it back after finishing ;-), and using tables without indexes/foreign keys. In our case recreating all the indexes/foreign keys/other constraints took actually longer than the raw data transfer itself... but it's possible that the process was not tuned 100%, we are still learning how to tune postgres... What I can add from our experience: ext3 turned out lousy for our application, and converting to XFS made a quite big improvement for our DB load. I don't have hard figures, but I think it was some 30% improvement in overall speed, and it had a huge improvement for heavy load times... what I mean is that with ext3 we had multiple parallel big tasks executing in more time than if we would have executed them sequentially, and with XFS that was gone, load scales linearly. In any case you should test the performance of your application on different FS and different settings, as this could make a huge difference. And another thing, we're still fighting with performance problems due to the fact that our application was designed to perform well with the other DB product... I think you'll have more work to do in this regard than just some search/replace ;-) Cheers, Csaba. From pgsql-performance-owner@postgresql.org Mon Mar 20 12:20:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9499B9DCA74 for ; Mon, 20 Mar 2006 12:20: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 10529-08 for ; Mon, 20 Mar 2006 12:20:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 605689DC888 for ; Mon, 20 Mar 2006 12:20:21 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Mon, 20 Mar 2006 16:20:20 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 20 Mar 2006 10:20:20 -0600 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: Scott Marlowe To: "Jim C. Nasby" Cc: Kenji Morishige , pgsql-performance@postgresql.org In-Reply-To: <20060320144503.GR15742@pervasive.com> References: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> <20060320144503.GR15742@pervasive.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142871620.17883.4.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 20 Mar 2006 10:20:20 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.147 required=5 tests=[AWL=0.146, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.147 X-Spam-Level: X-Archive-Number: 200603/333 X-Sequence-Number: 17770 On Mon, 2006-03-20 at 08:45, Jim C. Nasby wrote: > On Fri, Mar 17, 2006 at 05:00:34PM -0600, Scott Marlowe wrote: > > > last pid: 5788; load averages: 0.32, 0.31, 0.28 up 127+15:16:08 13:59:24 > > > 169 processes: 1 running, 168 sleeping > > > CPU states: 5.4% user, 0.0% nice, 9.9% system, 0.0% interrupt, 84.7% idle > > > Mem: 181M Active, 2632M Inact, 329M Wired, 179M Cache, 199M Buf, 81M Free > > > Swap: 4096M Total, 216K Used, 4096M Free > > > > > > PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND > > > 14501 pgsql 2 0 254M 242M select 2 76:26 1.95% 1.95% postgre > > > 5720 root 28 0 2164K 1360K CPU0 0 0:00 1.84% 0.88% top > > > 5785 pgsql 2 0 255M 29296K sbwait 0 0:00 3.00% 0.15% postgre > > > 5782 pgsql 2 0 255M 11900K sbwait 0 0:00 3.00% 0.15% postgre > > > 5772 pgsql 2 0 255M 11708K sbwait 2 0:00 1.54% 0.15% postgre > > > > That doesn't look good. Is this machine freshly rebooted, or has it > > been running postgres for a while? 179M cache and 199M buffer with 2.6 > > gig inactive is horrible for a machine running a 10gig databases. > > No, this is perfectly fine. Inactive memory in FreeBSD isn't the same as > Free. It's the same as 'active' memory except that it's pages that > haven't been accessed in X amount of time (between 100 and 200 ms, I > think). When free memory starts getting low, FBSD will start moving > pages from the inactive queue to the free queue (possibly resulting in > writes to disk along the way). > > IIRC, Cache is the directory cache, and Buf is disk buffers, which is > somewhat akin to shared_buffers in PostgreSQL. So, then, the inact is pretty much the same as kernel buffers in linux? From pgsql-performance-owner@postgresql.org Mon Mar 20 12:34:57 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8C7179DC888 for ; Mon, 20 Mar 2006 12:34: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 14474-04 for ; Mon, 20 Mar 2006 12:34:54 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 3220E9DC8E1 for ; Mon, 20 Mar 2006 12:34:54 -0400 (AST) Received: from linares.terra.com.br (linares.terra.com.br [200.176.10.195]) by svr4.postgresql.org (Postfix) with ESMTP id D1EE45AF195 for ; Mon, 20 Mar 2006 16:34:53 +0000 (GMT) Received: from moroto.terra.com.br (moroto.terra.com.br [200.176.10.5]) by linares.terra.com.br (Postfix) with ESMTP id 0977C4DC0D8 for ; Mon, 20 Mar 2006 13:34:48 -0300 (BRT) X-Terra-Karma: -2% X-Terra-Hash: a512f1d9e3549e0aa3dd0b84135014c3 Received-SPF: pass (moroto.terra.com.br: domain of terra.com.br designates 200.176.10.5 as permitted sender) client-ip=200.176.10.5; envelope-from=carlosreimer@terra.com.br; helo=reimer; Received: from reimer (201-3-253-69.bnut3702.dsl.brasiltelecom.net.br [201.3.253.69]) (authenticated user carlosreimer) by moroto.terra.com.br (Postfix) with ESMTP id C0B3614CC482 for ; Mon, 20 Mar 2006 13:34:47 -0300 (BRT) Message-ID: <001301c64c3c$3404b3f0$8b00000a@reimer> From: "Reimer" To: References: <441EC34D.1000901@bluestudio.it> Subject: Re: Query Feromance Date: Mon, 20 Mar 2006 13:34:47 -0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, 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: 200603/335 X-Sequence-Number: 17772 Marco, Could you give us the query you would like to improve performance? ----- Original Message ----- From: "Marco Furetto" To: Sent: Monday, March 20, 2006 11:59 AM Subject: [PERFORM] Query Feromance > Hello! > > Can I Increment the perfomance of execution query? > > Where is the instrument to analyze the query runnnig for create a Index > query for a single optimize that? > > thank's > > Marco "Furetto" Berri > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > From pgsql-performance-owner@postgresql.org Mon Mar 20 12:34:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EECEA9DC888 for ; Mon, 20 Mar 2006 12: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 15399-03 for ; Mon, 20 Mar 2006 12:34:37 -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 E22E79DC84A for ; Mon, 20 Mar 2006 12:34:36 -0400 (AST) Received: (qmail 18437 invoked from network); 20 Mar 2006 17:35:01 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 20 Mar 2006 17:35:01 +0100 Date: Mon, 20 Mar 2006 17:35:00 +0100 To: "Mikael Carneholm" , pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performance optimization References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/334 X-Sequence-Number: 17771 > using a 16kb block size (for read performance) will probably be > considered as well. Hm, this means that when postgres wants to write just one 8k page, the OS will have to read 16k, replace half of it with the new block, and write 16k again... I guess it should be better to stick with the usual block size. Also, it will have to read 16k every time it rally wants to read one page... which happens quite often except for seq scan. > NOTE: this machine/configuration is NOT what we will be using in > production if the study turns out OK, it's just supposed to work as a > development machine in the first phase whose purpose more or less is to > get familiar with configurating Postgres and see if we can get the > application up and running (we will probably use a 64bit platform and Opteron xDDD Use XFS or Reiser... ext3 isn't well suited for this. use noatime AND nodiratime. It's safe to turn off fsync while importing your data. For optimum speed, put the WAL on another physical disk. Look in the docs which of maintenance_work_mem, or work_mem or sort_mem is used for index creation, and set it to a very large value, to speed up that index creation. Create your indexes with fsync=off also. From pgsql-performance-owner@postgresql.org Mon Mar 20 13:44:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7DED59DCC57 for ; Mon, 20 Mar 2006 13:44: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 29201-09 for ; Mon, 20 Mar 2006 13:44:36 -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 5D3999DCAAD for ; Mon, 20 Mar 2006 13:44:34 -0400 (AST) Received: (qmail 614 invoked from network); 20 Mar 2006 17:44:33 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 20 Mar 2006 17:44:33 -0000 In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Migration study, step 1: bulk write performance optimization Date: Mon, 20 Mar 2006 12:44:31 -0500 To: Mikael Carneholm X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.142 required=5 tests=[AWL=0.142] X-Spam-Score: 0.142 X-Spam-Level: X-Archive-Number: 200603/336 X-Sequence-Number: 17773 Others are reporting better performance on 8.1.x with very large shared buffers. You may want to try tweaking that possibly as high as 20% of available memory Dave On 20-Mar-06, at 9:59 AM, Mikael Carneholm wrote: > Ok, here's the deal: > > I am responisble for an exciting project of evaluating migration of > a medium/large application for a well-known swedish car&truck > manufacturer from a proprietary DB to Postgres. The size of the > database is currently about 50Gb, annual growth depending on sales, > but probably in the 30-50Gb range. > > Migrating the schema was easily done, mostly involving a search/ > replace of some vendor specific datatypes. The next step is to > migrate the data itself, and for this we have written a Java app > relying on JDBC metadata to map the tables in the source schema to > the target schema. The goal right now is to find the set of > parameters that gives as short bulk insert time as possible, > minimizing downtime while the data itself is migrated. > > The machine used for the study is a Dell PE2850, 6GB memory, 1xXEON > 3.0GHz/2MB cache, internal SCSI 0+1 raid (currently 4x36GB 10000rpm > striped+mirrored, two more 146GB 15000rpm disks will arrive later). > Not sure about the brand/model of the raid controller, so I'll > leave that for now. File system is ext3(I know, maybe not the > optimal choice but this is how it was when I got it) with a 8k > block size. The OS currently installed is CentOS4. > > Until the new disks arrive, both the OS itself, pg_xlog and the > data reside on the same disks. When they arrive, I will probably > move the data to the new disks (need two more to get raid 0+1, > though) and leave the OS + pg_xlog on the 10000rpm disks. Mounting > the 15000rpm data disks with the noatime option (this is safe, > right?) and using a 16kb block size (for read performance) will > probably be considered as well. > > NOTE: this machine/configuration is NOT what we will be using in > production if the study turns out OK, it's just supposed to work as > a development machine in the first phase whose purpose more or less > is to get familiar with configurating Postgres and see if we can > get the application up and running (we will probably use a 64bit > platform and either a FC SAN or internal raid with a battery backed > cache for production use, if all goes well). > > The first thing I did when I got the machine was to do a raw dd > write test: > > # time bash -c "(dd if=/dev/zero of=/opt/bigfile count=1310720 > bs=8k && sync)" > 1310720+0 records in > 1310720+0 records out > > real 2m21.438s > user 0m0.998s > sys 0m51.347s > > (10*1024)Mb/~141s => ~75.5Mb/s > > As a simple benchmark, I created a simple table without PK/indexes > with 1k wide rows: > > create table iotest.one_kb_rows > ( > the_col char(1024) not null > ); > > To fill the table, I use this simple function: > > create or replace function iotest.writestress(megs integer) returns > void as $$ > declare > char_str char(1024) := repeat('x', 1024); > begin > for i in 1..megs loop > for j in 1..1024 loop > insert into one_kb_rows(the_col) values (char_str); > end loop; > end loop; > end; > $$ > language plpgsql; > > Then, I tested how long it takes to write 10Gb of data to this table: > > iotest=> \timing > Timing is on. > > iotest=> select writestress((10*1024)); > writestress > ------------- > > (1 row) > > Time: 379971.252 ms > > This gives that 10Gb takes ~380s => ~27Mb/s (with fsync=off), > compared to the raw dd result (~75.5Mb/s). > > I assume this difference is due to: > - simultaneous WAL write activity (assumed: for each byte written > to the table, at least one byte is also written to WAL, in effect: > 10Gb data inserted in the table equals 20Gb written to disk) > - lousy test method (it is done using a function => the transaction > size is 10Gb, and 10Gb will *not* fit in wal_buffers :) ) > - poor config > - something else? > > I have tried to read up as much as possible on Postgres > configuration (disk layout, buffer management, WAL sync methods, > etc) and found this post regarding bgwriter tweaking: http:// > archives.postgresql.org/pgsql-performance/2006-03/msg00218.php - > which explains the bgwriter config below. > > All params in postgresql.conf that are not commented out: > --------------------------------------------------------- > max_connections = 100 > superuser_reserved_connections = 2 > shared_buffers = 16000 > bgwriter_lru_percent = 20 > bgwriter_lru_maxpages = 160 > bgwriter_all_percent = 10 > bgwriter_all_maxpages = 320 > fsync = off > wal_sync_method = open_sync > wal_buffers = 128 > checkpoint_segments = 3 > log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' > log_rotation_age = 1440 > log_line_prefix = '%m: (%u@%d) ' > lc_messages = 'C' > lc_monetary = 'C' > lc_numeric = 'C' > lc_time = 'C' > > fsync can safely be kept off during data migration as we are able > to restart the procedure without losing data if something goes > wrong. Increasing chekpoint_segments to 8/16/32 only increased the > insert time, so I kept it at the default. I will increase > shared_buffers and effective_cache_size as soon as it's time to > tweak read performance, but for now I'm just focusing on write > performance. > > > Postgres version used: > > iotest=> select version(); > version > ---------------------------------------------------------------------- > ----------------------------- > PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) > 3.4.4 20050721 (Red Hat 3.4.4-2) > (1 row) > > > I want to make sure I have made correct assumptions before I carry > on, so comments are welcome. > > - Mikael > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Mon Mar 20 15:04:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 66B829DCC33 for ; Mon, 20 Mar 2006 15:04: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 47909-08 for ; Mon, 20 Mar 2006 15:04:26 -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 6C8379DCCAA for ; Mon, 20 Mar 2006 15:04:24 -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 ECE12B80C for ; Mon, 20 Mar 2006 14:04:23 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8746E9AD-3969-4854-836B-5F496FF9AA21@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: 1 TB of memory Date: Mon, 20 Mar 2006 14:04:23 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.07 required=5 tests=[AWL=0.070] X-Spam-Score: 0.07 X-Spam-Level: X-Archive-Number: 200603/337 X-Sequence-Number: 17774 On Mar 17, 2006, at 8:55 AM, Merlin Moncure wrote: > I like their approach...ddr ram + raid sanity backup + super reliable > power system. Their prices are on jupiter (and i dont mean jupiter, > fl) but hopefully there will be some competition and the invetible Nothing unique to them. I have a 4 year old SSD from a now out-of- business company, Imperial Technology. Initially we bought it for about $20k with 1GB of RAM. Subsequently upgraded to 5GB for another $20k. The speed is wicked fast even with just ultra2 SCSI (4 channels). The unit has the same battery backup to disk stuff (although it only does the backup at power fail). At one time they quoted me about $80k to upgrade it to a full 32MB that the unit supports. I passed. For my use it was worth the price. However, given the speed increase of other components since then, I don't think I'd buy one today. Parallelism (if you can do it like Luke suggested) is the way to go. And no, I have not run a database on one of these... though I am tempted to... From pgsql-performance-owner@postgresql.org Mon Mar 20 15:07:56 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 60AE09DC9EC for ; Mon, 20 Mar 2006 15: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 49401-04 for ; Mon, 20 Mar 2006 15:07:56 -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 6E3479DC889 for ; Mon, 20 Mar 2006 15:07:53 -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 55D10B80C for ; Mon, 20 Mar 2006 14:07:54 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <1142633228.1141.7.camel@state.g2switchworks.com> References: <20060317173653.GC15742@pervasive.com> <1142633228.1141.7.camel@state.g2switchworks.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: 1 TB of memory Date: Mon, 20 Mar 2006 14:07:53 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) 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: 200603/338 X-Sequence-Number: 17775 On Mar 17, 2006, at 5:07 PM, Scott Marlowe wrote: > Open Source SSD via iSCSI with commodity hardware... hmmm. sounds > like > a useful project. shhhhh! don't give away our top secret plans! From pgsql-performance-owner@postgresql.org Mon Mar 20 15:12:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7D4299DCA14 for ; Mon, 20 Mar 2006 15:12: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 50373-03 for ; Mon, 20 Mar 2006 15:12:37 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 783AD9DC83A for ; Mon, 20 Mar 2006 15:12:35 -0400 (AST) Received: from pi.bitscribe.net (ip-64-70-39-107.hosts.zerolag.com [64.70.39.107]) by svr4.postgresql.org (Postfix) with ESMTP id A17755AF08F for ; Mon, 20 Mar 2006 19:12:36 +0000 (GMT) Received: by pi.bitscribe.net (Postfix, from userid 99) id CD7E21073A8; Mon, 20 Mar 2006 11:12:34 -0800 (PST) Received: from [192.168.1.102] (dsl093-066-021.lax1.dsl.speakeasy.net [66.93.66.21]) by pi.bitscribe.net (Postfix) with ESMTP id 830C21073A6 for ; Mon, 20 Mar 2006 11:12:31 -0800 (PST) Message-ID: <441EFEA2.70207@orangekids.org> Date: Mon, 20 Mar 2006 11:12:34 -0800 From: Orion Henry User-Agent: Mozilla Thunderbird 1.0.7 (Macintosh/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Auto performance tuning? 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: 200603/339 X-Sequence-Number: 17776 I have to say I've been really impressed with the quality and diversity of tools here to increase performance for PostgreSQL. But I keep seeing a lot of the same basic things repeated again and again. Has anyone looked into a "smart" or auto-adjusting resource manager for postgres? Consider for instance you set it to aggressively use system resources, then it would do things like notice that it needs more work mem after profiling a few thousand queries and adds it for you, or that a specific index or table should be moved to a different spindle and does it in the background, or that query plans keep screwing up on a particular table so it knows to up the amount of stastics it keeps on that table. Is this a crazy idea or something someone's already working on? Orion From pgsql-performance-owner@postgresql.org Mon Mar 20 15:15:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 81A7A9DC999 for ; Mon, 20 Mar 2006 15:15: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 48344-10 for ; Mon, 20 Mar 2006 15:15: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 4C6D89DC86F for ; Mon, 20 Mar 2006 15:15:22 -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 414A9B80C for ; Mon, 20 Mar 2006 14:15:23 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <20060317221116.GA14661@juniper.net> References: <20060317221116.GA14661@juniper.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Date: Mon, 20 Mar 2006 14:15:22 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.07 required=5 tests=[AWL=0.070] X-Spam-Score: 0.07 X-Spam-Level: X-Archive-Number: 200603/340 X-Sequence-Number: 17777 On Mar 17, 2006, at 5:11 PM, Kenji Morishige wrote: > In summary, my questions: > > 1. Would running PG on FreeBSD 5.x or 6.x or Linux improve > performance? FreeBSD 6.x will definitely get you improvements. Many speedup improvements have been made to both the generic disk layer and the specific drivers. However, the current best of breed RAID controller is the LSI 320-x (I use 320-2X). I have one box into which this card will not fit (Thanks Sun, for making a box with only low-profile slots!) so I use an Adaptec 2230SLP card in it. Testing shows it is about 80% speed of a LSI 320-2x on sequential workload (load DB, run some queries, rebuild indexes, etc.) If you do put on FreeBSD 6, I'd love to see the output of "diskinfo - v -t" on your RAID volume(s). > > 2. Should I change SCSI controller config to use RAID 10 instead of 5? I use RAID10. > > 3. Why isn't postgres using all 4GB of ram for at least caching > table for reads? I think FreeBSD has a hard upper limit on the total ram it will use for disk cache. I haven't been able to get reliable, irrefutable, answers about it, though. > > 4. Are there any other settings in the conf file I could try to tweak? I like to bump up the checkpoint segments to 256. From pgsql-performance-owner@postgresql.org Mon Mar 20 15:44:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C8C919DC9C1 for ; Mon, 20 Mar 2006 15:44: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 55072-06 for ; Mon, 20 Mar 2006 15:44:47 -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 B606F9DC941 for ; Mon, 20 Mar 2006 15:44:44 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i34so1172104wra for ; Mon, 20 Mar 2006 11:44: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LIebOTBaEZsbbGy0UBqd+1WJLeHS+UaCBZU2RGe3dJE9/lv5PVJiFUWu9bSeb2TyEFYjtDrsL8pk+ndrvUgz7Qc0wCE4+I2l+rn5l7K1IDfAAoxKMvZ4asDZL8k94x61rzMPd6uiW/E+O6QTvKc9jk8CZUdMHMEDpXRnh+VODuM= Received: by 10.65.84.19 with SMTP id m19mr680120qbl; Mon, 20 Mar 2006 11:44:44 -0800 (PST) Received: by 10.65.135.10 with HTTP; Mon, 20 Mar 2006 11:44:44 -0800 (PST) Message-ID: Date: Mon, 20 Mar 2006 14:44:44 -0500 From: "Merlin Moncure" To: "Vivek Khera" Subject: Re: 1 TB of memory Cc: "Postgresql Performance" In-Reply-To: <8746E9AD-3969-4854-836B-5F496FF9AA21@khera.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> <8746E9AD-3969-4854-836B-5F496FF9AA21@khera.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.134 required=5 tests=[AWL=0.134] X-Spam-Score: 0.134 X-Spam-Level: X-Archive-Number: 200603/341 X-Sequence-Number: 17778 > > I like their approach...ddr ram + raid sanity backup + super reliable > > power system. Their prices are on jupiter (and i dont mean jupiter, > > fl) but hopefully there will be some competition and the invetible > > Nothing unique to them. I have a 4 year old SSD from a now out-of- > business company, Imperial Technology. Initially we bought it for > about $20k with 1GB of RAM. Subsequently upgraded to 5GB for another > $20k. The speed is wicked fast even with just ultra2 SCSI (4 > channels). The unit has the same battery backup to disk stuff > (although it only does the backup at power fail). you may or may not be intersted to know they are back in business :). > For my use it was worth the price. However, given the speed increase > of other components since then, I don't think I'd buy one today. > Parallelism (if you can do it like Luke suggested) is the way to go. Thats an interesting statement. My personal opionion is that SSD will ultimately take over the database storage market as well as most consumer level devices for primary storage. except perhaps for very large databases (>1tb). Hard disk drives will displace tapes for backup storage. merlin From pgsql-performance-owner@postgresql.org Mon Mar 20 15:46:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 322A19DCC91 for ; Mon, 20 Mar 2006 15:46: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 57052-04 for ; Mon, 20 Mar 2006 15:46:39 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 2D1FC9DCC33 for ; Mon, 20 Mar 2006 15:46:37 -0400 (AST) Received: from wumpus.mythic-beasts.com (wumpus.mythic-beasts.com [212.69.37.9]) by svr4.postgresql.org (Postfix) with ESMTP id 9C80B5AF038 for ; Mon, 20 Mar 2006 19:46:38 +0000 (GMT) Received: from sphinx.mythic-beasts.com ([212.69.37.6]) by wumpus.mythic-beasts.com with esmtp (Exim 4.44) id 1FLQKh-000801-C8; Mon, 20 Mar 2006 19:46:27 +0000 Received: from xelah (helo=localhost) by sphinx.mythic-beasts.com with local-esmtp (Exim 4.51) id 1FLQKT-0006Mi-MM; Mon, 20 Mar 2006 19:46:13 +0000 Date: Mon, 20 Mar 2006 19:46:13 +0000 (GMT) From: Alex Hayward X-X-Sender: xelah@sphinx.mythic-beasts.com To: "Jim C. Nasby" Cc: Scott Marlowe , Kenji Morishige , pgsql-performance@postgresql.org Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & In-Reply-To: <20060320144503.GR15742@pervasive.com> Message-ID: References: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> <20060320144503.GR15742@pervasive.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: 200603/342 X-Sequence-Number: 17779 On Mon, 20 Mar 2006, Jim C. Nasby wrote: > No, this is perfectly fine. Inactive memory in FreeBSD isn't the same as > Free. It's the same as 'active' memory except that it's pages that > haven't been accessed in X amount of time (between 100 and 200 ms, I > think). When free memory starts getting low, FBSD will start moving > pages from the inactive queue to the free queue (possibly resulting in > writes to disk along the way). > > IIRC, Cache is the directory cache, and Buf is disk buffers, which is > somewhat akin to shared_buffers in PostgreSQL. I don't believe that's true. I'm not an expert in FreeBSD's VM internals, but this is how I believe it works: Active pages are pages currently mapped in to a process's address space. Inactive pages are pages which are marked dirty (must be written to backing store before they can be freed) and which are not mapped in to a process's address. They're still associated with a VM object of some kind - like part of a process's virtual address space or a as part of the cache for a file on disk. If it's still part of a process's virtual address space and is accessed a fault is generated. The page is then put back in to the address mappings. Cached pages are like inactive pages but aren't dirty. Then can be either re-mapped or freed immediately. Free pages are properly free. Wired pages are unswappable. Buf I'm not sure about. It doesn't represent that amount of memory used to cache files on disk, I'm sure of that. The sysctl -d description is 'KVA memory used for bufs', so I suspect that it's the amount of kernel virtual address space mapped to pages in the 'active', 'inactive' and 'cache' queues. -- Alex Hayward Seatbooker From pgsql-performance-owner@postgresql.org Mon Mar 20 16:49:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E9899DC86F for ; Mon, 20 Mar 2006 16:49: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 72911-08 for ; Mon, 20 Mar 2006 16:49:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asgard1.americatelsal.com (asgard.americatelsal.com [200.13.161.7]) by postgresql.org (Postfix) with ESMTP id EA4E09DC80E for ; Mon, 20 Mar 2006 16:49:04 -0400 (AST) Received: (qmail 55136 invoked from network); 20 Mar 2006 21:11:46 -0000 Received: from unknown (HELO ?192.168.10.124?) (200.13.161.68) by asgard1.americatelsal.com with SMTP; 20 Mar 2006 21:11:46 -0000 Message-ID: <441F161D.7010502@123.com.sv> Date: Mon, 20 Mar 2006 14:52:45 -0600 From: Miguel User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vivek Khera CC: Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> In-Reply-To: <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200603/343 X-Sequence-Number: 17780 Vivek Khera wrote: > > On Mar 17, 2006, at 5:11 PM, Kenji Morishige wrote: > >> In summary, my questions: >> >> 1. Would running PG on FreeBSD 5.x or 6.x or Linux improve performance? > > > FreeBSD 6.x will definitely get you improvements. Many speedup > improvements have been made to both the generic disk layer and the > specific drivers. However, the current best of breed RAID controller > is the LSI 320-x (I use 320-2X). I have one box into which this > card will not fit (Thanks Sun, for making a box with only low-profile > slots!) so I use an Adaptec 2230SLP card in it. Testing shows it is > about 80% speed of a LSI 320-2x on sequential workload (load DB, run > some queries, rebuild indexes, etc.) > > If you do put on FreeBSD 6, I'd love to see the output of "diskinfo - > v -t" on your RAID volume(s). > Not directly related ... i have a HP dl380 g3 with array 5i controlled (1+0), these are my results shiva2# /usr/sbin/diskinfo -v -t /dev/da2s1d /dev/da2s1d 512 # sectorsize 218513555456 # mediasize in bytes (204G) 426784288 # mediasize in sectors 52301 # Cylinders according to firmware. 255 # Heads according to firmware. 32 # Sectors according to firmware. Seek times: Full stroke: 250 iter in 1.138232 sec = 4.553 msec Half stroke: 250 iter in 1.084474 sec = 4.338 msec Quarter stroke: 500 iter in 1.690313 sec = 3.381 msec Short forward: 400 iter in 0.752646 sec = 1.882 msec Short backward: 400 iter in 1.306270 sec = 3.266 msec Seq outer: 2048 iter in 0.766676 sec = 0.374 msec Seq inner: 2048 iter in 0.803759 sec = 0.392 msec Transfer rates: outside: 102400 kbytes in 2.075984 sec = 49326 kbytes/sec middle: 102400 kbytes in 2.100510 sec = 48750 kbytes/sec inside: 102400 kbytes in 2.042313 sec = 50139 kbytes/sec is this good enough? From pgsql-performance-owner@postgresql.org Mon Mar 20 16:59:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 00FCC9DCC91 for ; Mon, 20 Mar 2006 16:59: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 73676-08 for ; Mon, 20 Mar 2006 16:59:25 -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 94BE99DCC84 for ; Mon, 20 Mar 2006 16:59:22 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Mon, 20 Mar 2006 15:59:15 -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); Mon, 20 Mar 2006 15:59:15 -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.118]) with Microsoft Exchange Server HTTP-DAV ; Mon, 20 Mar 2006 20:59:14 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Mon, 20 Mar 2006 12:59:13 -0800 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: "Luke Lonergan" To: "Miguel" , "Vivek Khera" cc: "Postgresql Performance" Message-ID: Thread-Topic: [PERFORM] Best OS & Configuration for Dual Xeon w/4GB & Adaptec Thread-Index: AcZMX9s8FmVNNnB+TreDdxBbSoKQegAAUj+q In-Reply-To: <441F161D.7010502@123.com.sv> MIME-Version: 1.0 X-OriginalArrivalTime: 20 Mar 2006 20:59:15.0217 (UTC) FILETIME=[258CF010:01C64C61] X-WSS-ID: 6801C8292XS30860204-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.333 required=5 tests=[AWL=0.080, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.333 X-Spam-Level: * X-Archive-Number: 200603/344 X-Sequence-Number: 17781 Miguel, On 3/20/06 12:52 PM, "Miguel" wrote: > i have a HP dl380 g3 with array 5i controlled (1+0), these are my results Another "known bad" RAID controller. The Smartarray 5i is horrible on Linux - this is the first BSD result I've seen. > Seek times: > Full stroke: 250 iter in 1.138232 sec = 4.553 msec > Half stroke: 250 iter in 1.084474 sec = 4.338 msec These seem OK - are they "access times" or are they actually "seek times"? Seems like with RAID 10, you should get better by maybe double. > Transfer rates: > outside: 102400 kbytes in 2.075984 sec = 49326 kbytes/sec > middle: 102400 kbytes in 2.100510 sec = 48750 kbytes/sec > inside: 102400 kbytes in 2.042313 sec = 50139 kbytes/sec > > > is this good enough? It's pretty slow. How many disk drives do you have? - Luke From pgsql-performance-owner@postgresql.org Mon Mar 20 17:09:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7470B9DCD7B for ; Mon, 20 Mar 2006 17: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 78113-01 for ; Mon, 20 Mar 2006 17:09:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asgard1.americatelsal.com (asgard2.americatelsal.com [200.13.161.7]) by postgresql.org (Postfix) with ESMTP id 2C1299DCC84 for ; Mon, 20 Mar 2006 17:08:56 -0400 (AST) Received: (qmail 57108 invoked from network); 20 Mar 2006 21:31:39 -0000 Received: from unknown (HELO ?192.168.10.124?) (200.13.161.68) by asgard1.americatelsal.com with SMTP; 20 Mar 2006 21:31:39 -0000 Message-ID: <441F1AC5.9050700@123.com.sv> Date: Mon, 20 Mar 2006 15:12:37 -0600 From: Miguel User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200603/345 X-Sequence-Number: 17782 Luke Lonergan wrote: >Miguel, > >On 3/20/06 12:52 PM, "Miguel" wrote: > > > >>i have a HP dl380 g3 with array 5i controlled (1+0), these are my results >> >> > >Another "known bad" RAID controller. The Smartarray 5i is horrible on Linux >- this is the first BSD result I've seen. > > > >>Seek times: >> Full stroke: 250 iter in 1.138232 sec = 4.553 msec >> Half stroke: 250 iter in 1.084474 sec = 4.338 msec >> >> > >These seem OK - are they "access times" or are they actually "seek times"? > > i dont know, how can i check? >Transfer rates: > outside: 102400 kbytes in 2.075984 sec = 49326 kbytes/sec > middle: 102400 kbytes in 2.100510 sec = 48750 kbytes/sec > inside: 102400 kbytes in 2.042313 sec = 50139 kbytes/sec > > >is this good enough? >It's pretty slow. How many disk drives do you have? > > > > I have 6 ultra a320 72G 10k discs --- Miguel From pgsql-performance-owner@postgresql.org Tue Mar 21 17:15:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8A0659DCC69 for ; Tue, 21 Mar 2006 17: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 66939-04 for ; Tue, 21 Mar 2006 17:15:07 -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 F36809DCC46 for ; Tue, 21 Mar 2006 17:15:01 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=anWzPBaW0o7V9ktH16jXM0rkstLnrMt5QE7BxAfDCIIXou6QNcBDlGzqKIv2ngpz; 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 [71.243.21.155] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth07.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1FLoBy-00017h-N3; Tue, 21 Mar 2006 16:15:02 -0500 Message-Id: <7.0.1.0.2.20060320161133.03a0b5a8@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Date: Mon, 20 Mar 2006 16:17:09 -0500 To: Mikael Carneholm , pgsql-performance@postgresql.org From: Ron Subject: Re: Migration study, step 1: bulk write performance In-Reply-To: <1142973890.24487.510.camel@localhost.localdomain> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142973890.24487.510.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcedd2f1ab4701a7980bda57ed15b92132350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.243.21.155 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.914 required=5 tests=[AWL=-0.446, DATE_IN_PAST_12_24=0.881, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.914 X-Spam-Level: X-Archive-Number: 200603/428 X-Sequence-Number: 17865 At 03:44 PM 3/21/2006, Simon Riggs wrote: >On Mon, 2006-03-20 at 15:59 +0100, Mikael Carneholm wrote: > > > This gives that 10Gb takes ~380s => ~27Mb/s (with fsync=off), > compared to the raw dd result (~75.5Mb/s). > > > > I assume this difference is due to: > > - simultaneous WAL write activity (assumed: for each byte written > to the table, at least one byte is also written to WAL, in effect: > 10Gb data inserted in the table equals 20Gb written to disk) > > - lousy test method (it is done using a function => the > transaction size is 10Gb, and 10Gb will *not* fit in wal_buffers :) ) > > - poor config > > > checkpoint_segments = 3 > >With those settings, you'll be checkpointing every 48 Mb, which will be >every about once per second. Since the checkpoint will take a reasonable >amount of time, even with fsync off, you'll be spending most of your >time checkpointing. bgwriter will just be slowing you down too because >you'll always have more clean buffers than you can use, since you have >132MB of shared_buffers, yet flushing all of them every checkpoint. IIRC, Josh Berkus did some benches that suggests in pg 8.x a value of 64 - 256 is best for checkpoint_segments as long as you have the RAM available. I'd suggest trying values of 64, 128, and 256 and setting checkpoint_segments to the best of those. Ron From pgsql-performance-owner@postgresql.org Mon Mar 20 17:28:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EE87E9DC9C1 for ; Mon, 20 Mar 2006 17:28: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 79630-06 for ; Mon, 20 Mar 2006 17:28:11 -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 63E739DC941 for ; Mon, 20 Mar 2006 17:28:08 -0400 (AST) Received: from 172.16.1.148 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Mon, 20 Mar 2006 16:27:58 -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); Mon, 20 Mar 2006 16:27:57 -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.118]) with Microsoft Exchange Server HTTP-DAV ; Mon, 20 Mar 2006 21:27:57 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Mon, 20 Mar 2006 13:27:56 -0800 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: "Luke Lonergan" To: "Miguel" , "Postgresql Performance" Message-ID: Thread-Topic: [PERFORM] Best OS & Configuration for Dual Xeon w/4GB & Adaptec Thread-Index: AcZMYp6k1Xz6CMNXT3GaJZjXsHVELAAAoiRn In-Reply-To: <441F1AC5.9050700@123.com.sv> MIME-Version: 1.0 X-OriginalArrivalTime: 20 Mar 2006 21:27:57.0796 (UTC) FILETIME=[2849A240:01C64C65] X-WSS-ID: 6801C1DD2XS30875896-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.334 required=5 tests=[AWL=0.081, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.334 X-Spam-Level: * X-Archive-Number: 200603/346 X-Sequence-Number: 17783 Miguel, On 3/20/06 1:12 PM, "Miguel" wrote: > i dont know, how can i check? No matter - it's the benchmark that would tell you, it's probably "access time" that's being measured even though the text says "seek time". The difference is that seek time represents only the head motion, where access time is the whole access including seek. Access times of 4.5ms are typical of a single 10K RPM SCSI disk drive like the Seagate barracuda. >> Transfer rates: >> outside: 102400 kbytes in 2.075984 sec = 49326 kbytes/sec >> middle: 102400 kbytes in 2.100510 sec = 48750 kbytes/sec >> inside: 102400 kbytes in 2.042313 sec = 50139 kbytes/sec >> > I have 6 ultra a320 72G 10k discs Yah - ouch. With 6 drives in a RAID10, you should expect 3 drives worth of sequential scan performance, or anywhere from 100MB/s to 180MB/s. You're getting from half to 1/3 of the performance you'd get with a decent raid controller. If you add a simple SCSI adapter like the common LSI U320 adapter to your DL380G3 and then run software RAID, you will get more than 150MB/s with less CPU consumption. I'd also expect you'd get down to about 2ms access times. This might not be easy for you to do, and you might prefer hardware RAID adapters, but I don't have a recommendation for you there. I'd stay away from the HP line. - Luke From pgsql-performance-owner@postgresql.org Mon Mar 20 17:48:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4DF939DCC84 for ; Mon, 20 Mar 2006 17:48: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 82989-02 for ; Mon, 20 Mar 2006 17:48:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asgard1.americatelsal.com (asgard.americatelsal.com [200.13.161.7]) by postgresql.org (Postfix) with ESMTP id B18019DCBDB for ; Mon, 20 Mar 2006 17:47:59 -0400 (AST) Received: (qmail 62178 invoked from network); 20 Mar 2006 22:10:42 -0000 Received: from unknown (HELO ?192.168.10.124?) (200.13.161.68) by asgard1.americatelsal.com with SMTP; 20 Mar 2006 22:10:42 -0000 Message-ID: <441F23ED.1080302@123.com.sv> Date: Mon, 20 Mar 2006 15:51:41 -0600 From: Miguel User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan CC: Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.014 required=5 tests=[AWL=0.014] X-Spam-Score: 0.014 X-Spam-Level: X-Archive-Number: 200603/347 X-Sequence-Number: 17784 Luke Lonergan wrote: >>>Transfer rates: >>> outside: 102400 kbytes in 2.075984 sec = 49326 kbytes/sec >>> middle: 102400 kbytes in 2.100510 sec = 48750 kbytes/sec >>> inside: 102400 kbytes in 2.042313 sec = 50139 kbytes/sec >>> >>> >>> >>I have 6 ultra a320 72G 10k discs >> >> > >Yah - ouch. With 6 drives in a RAID10, you should expect 3 drives worth of >sequential scan performance, or anywhere from 100MB/s to 180MB/s. You're >getting from half to 1/3 of the performance you'd get with a decent raid >controller. > >If you add a simple SCSI adapter like the common LSI U320 adapter to your >DL380G3 and then run software RAID, you will get more than 150MB/s with less >CPU consumption. I'd also expect you'd get down to about 2ms access times. > >This might not be easy for you to do, and you might prefer hardware RAID >adapters, but I don't have a recommendation for you there. I'd stay away >from the HP line. > > > This is my new postgreql 8.1.3 server, so i have many options (in fact, any option) to choose from, i want maximum performance, if i undestood you well, do you mean using something like vinum? i forgot to mention that the 6 discs are in a MSA500 G2 external storadge, additionally i have two 36G a320 10k in raid 10 for the os installed in the server slots. --- Miguel From pgsql-performance-owner@postgresql.org Mon Mar 20 18:04:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 74FA79DC983 for ; Mon, 20 Mar 2006 18:04: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 82989-07 for ; Mon, 20 Mar 2006 18:04:41 -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 3C6A29DC80E for ; Mon, 20 Mar 2006 18:04:36 -0400 (AST) Received: from 172.16.1.148 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Mon, 20 Mar 2006 17:04:29 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 20 Mar 2006 17:04:26 -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.118]) with Microsoft Exchange Server HTTP-DAV ; Mon, 20 Mar 2006 22:04:26 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Mon, 20 Mar 2006 14:04:25 -0800 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: "Luke Lonergan" To: "Miguel" cc: "Postgresql Performance" Message-ID: Thread-Topic: [PERFORM] Best OS & Configuration for Dual Xeon w/4GB & Adaptec Thread-Index: AcZMaAQV19jY74j7QfuhCLe4tAYQPwAAjvh4 In-Reply-To: <441F23ED.1080302@123.com.sv> MIME-Version: 1.0 X-OriginalArrivalTime: 20 Mar 2006 22:04:26.0908 (UTC) FILETIME=[41199DC0:01C64C6A] X-WSS-ID: 6801F9612JC696267-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.335 required=5 tests=[AWL=0.082, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.335 X-Spam-Level: * X-Archive-Number: 200603/348 X-Sequence-Number: 17785 Miguel, On 3/20/06 1:51 PM, "Miguel" wrote: > i forgot to mention that the 6 discs are in a MSA500 G2 external > storadge, additionally i have two 36G a320 10k in raid 10 for the os > installed in the server slots. I just checked online and I think the MSA500 G2 has it's own SCSI RAID controllers, so you are actually just using the 5i as a SCSI attach, which it's not good at (no reordering/command queueing, etc). So, just using a simple SCSI adapter to connect to the MSA might be a big win. - Luke From pgsql-performance-owner@postgresql.org Mon Mar 20 18:10:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 43CBC9DCD12 for ; Mon, 20 Mar 2006 18: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 87347-01 for ; Mon, 20 Mar 2006 18:10:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asgard1.americatelsal.com (asgard2.americatelsal.com [200.13.161.7]) by postgresql.org (Postfix) with ESMTP id 496EE9DCF77 for ; Mon, 20 Mar 2006 18:10:31 -0400 (AST) Received: (qmail 64955 invoked from network); 20 Mar 2006 22:33:14 -0000 Received: from unknown (HELO ?192.168.10.124?) (200.13.161.68) by asgard1.americatelsal.com with SMTP; 20 Mar 2006 22:33:14 -0000 Message-ID: <441F2935.6000504@123.com.sv> Date: Mon, 20 Mar 2006 16:14:13 -0600 From: Miguel User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan CC: Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200603/349 X-Sequence-Number: 17786 Luke Lonergan wrote: >Miguel, > > >On 3/20/06 1:51 PM, "Miguel" wrote: > > > >>i forgot to mention that the 6 discs are in a MSA500 G2 external >>storadge, additionally i have two 36G a320 10k in raid 10 for the os >>installed in the server slots. >> >> > >I just checked online and I think the MSA500 G2 has it's own SCSI RAID >controllers, > Yes, it has its own redundant controller, > so you are actually just using the 5i as a SCSI attach, which >it's not good at (no reordering/command queueing, etc). So, just using a >simple SCSI adapter to connect to the MSA might be a big win. > > I will try a LS320 and will let you know if i got any performance gain, thanks for your advises --- Miguel From pgsql-performance-owner@postgresql.org Mon Mar 20 18:24:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 937BC9DC9C6 for ; Mon, 20 Mar 2006 18: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 85563-09 for ; Mon, 20 Mar 2006 18:24:55 -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 757D19DC9C0 for ; Mon, 20 Mar 2006 18:24:51 -0400 (AST) Received: from [192.168.1.3] (unknown [192.168.1.3]) by yertle.kcilink.com (Postfix) with ESMTP id BD1B9B80C for ; Mon, 20 Mar 2006 17:24:53 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: References: <8B16F5C8-DFC8-4694-902C-AE584E490530@pervasive.com> <8746E9AD-3969-4854-836B-5F496FF9AA21@khera.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: "Postgresql Performance" Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: 1 TB of memory Date: Mon, 20 Mar 2006 17:24:53 -0500 X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.165 required=5 tests=[AWL=-0.024, MISSING_HEADERS=0.189] X-Spam-Score: 0.165 X-Spam-Level: X-Archive-Number: 200603/350 X-Sequence-Number: 17787 On Mar 20, 2006, at 2:44 PM, Merlin Moncure wrote: >> For my use it was worth the price. However, given the speed increase >> of other components since then, I don't think I'd buy one today. >> Parallelism (if you can do it like Luke suggested) is the way to go. > > Thats an interesting statement. My personal opionion is that SSD will > ultimately take over the database storage market as well as most > consumer level devices for primary storage. except perhaps for very I tend to agree with you that perhaps one day when the $$ are right, but that day is not today. From pgsql-performance-owner@postgresql.org Mon Mar 20 18:39:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0A5AC9DC889 for ; Mon, 20 Mar 2006 18: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 91725-05 for ; Mon, 20 Mar 2006 18:39:38 -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 587539DC80E for ; Mon, 20 Mar 2006 18:39:34 -0400 (AST) Received: from [192.168.1.3] (unknown [192.168.1.3]) by yertle.kcilink.com (Postfix) with ESMTP id E2573B80C; Mon, 20 Mar 2006 17:39:36 -0500 (EST) In-Reply-To: <441F161D.7010502@123.com.sv> References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Postgresql Performance Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Date: Mon, 20 Mar 2006 17:39:36 -0500 To: Miguel X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.074 required=5 tests=[AWL=0.074] X-Spam-Score: 0.074 X-Spam-Level: X-Archive-Number: 200603/351 X-Sequence-Number: 17788 >> If you do put on FreeBSD 6, I'd love to see the output of >> "diskinfo - v -t" on your RAID volume(s). >> > Not directly related ... > i have a HP dl380 g3 with array 5i controlled (1+0), these are my > results > [...] > is this good enough? Is that on a loaded box or a mostly quiet box? Those number seem rather low for my tastes. For comparison, here are numbers from a Dell 1850 with a built-in PERC 4e/Si RAID in a two disk mirror. All numbers below are on mostly or totally quiet disk systems. amrd0 512 # sectorsize 73274490880 # mediasize in bytes (68G) 143114240 # mediasize in sectors 8908 # Cylinders according to firmware. 255 # Heads according to firmware. 63 # Sectors according to firmware. Seek times: Full stroke: 250 iter in 0.756718 sec = 3.027 msec Half stroke: 250 iter in 0.717824 sec = 2.871 msec Quarter stroke: 500 iter in 1.972368 sec = 3.945 msec Short forward: 400 iter in 1.193179 sec = 2.983 msec Short backward: 400 iter in 1.322440 sec = 3.306 msec Seq outer: 2048 iter in 0.271402 sec = 0.133 msec Seq inner: 2048 iter in 0.271151 sec = 0.132 msec Transfer rates: outside: 102400 kbytes in 1.080339 sec = 94785 kbytes/sec middle: 102400 kbytes in 1.166021 sec = 87820 kbytes/sec inside: 102400 kbytes in 1.461498 sec = 70065 kbytes/sec And for the *real* disks.... In the following two cases, I used a Dell 1425SC with 1GB RAM and connected the controllers to the same Dell PowerVault 14 disk U320 array (one controller at a time, obviously). For each controller each pair of the mirror was on the opposite channel of the controller for optimal speed. disk 0 is a RAID1 of two drives, and disk 1 is a RAID10 of the remaining 12 drives. All running FreeBSD 6.0 RELEASE. First I tested the Adaptec 2230SLP and got these: aacd0 512 # sectorsize 36385456128 # mediasize in bytes (34G) 71065344 # mediasize in sectors 4423 # Cylinders according to firmware. 255 # Heads according to firmware. 63 # Sectors according to firmware. Seek times: Full stroke: 250 iter in 2.288389 sec = 9.154 msec Half stroke: 250 iter in 1.657302 sec = 6.629 msec Quarter stroke: 500 iter in 2.756597 sec = 5.513 msec Short forward: 400 iter in 1.205275 sec = 3.013 msec Short backward: 400 iter in 1.249310 sec = 3.123 msec Seq outer: 2048 iter in 0.412770 sec = 0.202 msec Seq inner: 2048 iter in 0.428585 sec = 0.209 msec Transfer rates: outside: 102400 kbytes in 1.204412 sec = 85021 kbytes/sec middle: 102400 kbytes in 1.347325 sec = 76002 kbytes/sec inside: 102400 kbytes in 2.036832 sec = 50274 kbytes/sec aacd1 512 # sectorsize 218307231744 # mediasize in bytes (203G) 426381312 # mediasize in sectors 26541 # Cylinders according to firmware. 255 # Heads according to firmware. 63 # Sectors according to firmware. Seek times: Full stroke: 250 iter in 0.856699 sec = 3.427 msec Half stroke: 250 iter in 1.475651 sec = 5.903 msec Quarter stroke: 500 iter in 2.693270 sec = 5.387 msec Short forward: 400 iter in 1.127831 sec = 2.820 msec Short backward: 400 iter in 1.216876 sec = 3.042 msec Seq outer: 2048 iter in 0.416340 sec = 0.203 msec Seq inner: 2048 iter in 0.436471 sec = 0.213 msec Transfer rates: outside: 102400 kbytes in 1.245798 sec = 82196 kbytes/sec middle: 102400 kbytes in 1.169033 sec = 87594 kbytes/sec inside: 102400 kbytes in 1.390840 sec = 73625 kbytes/sec And the LSI 320-2X card: amrd0 512 # sectorsize 35999711232 # mediasize in bytes (34G) 70311936 # mediasize in sectors 4376 # Cylinders according to firmware. 255 # Heads according to firmware. 63 # Sectors according to firmware. Seek times: Full stroke: 250 iter in 0.737130 sec = 2.949 msec Half stroke: 250 iter in 0.694498 sec = 2.778 msec Quarter stroke: 500 iter in 2.040667 sec = 4.081 msec Short forward: 400 iter in 1.418592 sec = 3.546 msec Short backward: 400 iter in 0.896076 sec = 2.240 msec Seq outer: 2048 iter in 0.292390 sec = 0.143 msec Seq inner: 2048 iter in 0.300836 sec = 0.147 msec Transfer rates: outside: 102400 kbytes in 1.102025 sec = 92920 kbytes/sec middle: 102400 kbytes in 1.247608 sec = 82077 kbytes/sec inside: 102400 kbytes in 1.905603 sec = 53736 kbytes/sec amrd1 512 # sectorsize 215998267392 # mediasize in bytes (201G) 421871616 # mediasize in sectors 26260 # Cylinders according to firmware. 255 # Heads according to firmware. 63 # Sectors according to firmware. Seek times: Full stroke: 250 iter in 0.741648 sec = 2.967 msec Half stroke: 250 iter in 1.021720 sec = 4.087 msec Quarter stroke: 500 iter in 2.220321 sec = 4.441 msec Short forward: 400 iter in 0.945948 sec = 2.365 msec Short backward: 400 iter in 1.036555 sec = 2.591 msec Seq outer: 2048 iter in 0.378911 sec = 0.185 msec Seq inner: 2048 iter in 0.457275 sec = 0.223 msec Transfer rates: outside: 102400 kbytes in 0.986572 sec = 103794 kbytes/sec middle: 102400 kbytes in 0.998528 sec = 102551 kbytes/sec inside: 102400 kbytes in 0.857322 sec = 119442 kbytes/sec From pgsql-performance-owner@postgresql.org Mon Mar 20 18:53:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CCC0F9DC9C6 for ; Mon, 20 Mar 2006 18:53: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 96855-01 for ; Mon, 20 Mar 2006 18:53:50 -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 8C4339DC9C1 for ; Mon, 20 Mar 2006 18:53:46 -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 k2KMtKJX001417 for ; Mon, 20 Mar 2006 14:55:20 -0800 Message-ID: <441F3187.90506@modgraph-usa.com> Date: Mon, 20 Mar 2006 14:49:43 -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: update == delete + insert? References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> In-Reply-To: <441EC652.1010807@modgraph-usa.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.104 required=5 tests=[AWL=0.104] X-Spam-Score: 0.104 X-Spam-Level: X-Archive-Number: 200603/352 X-Sequence-Number: 17789 I've seen it said here several times that "update == delete + insert". On the other hand, I've noticed that "alter table [add|drop] column ..." is remarkably fast, even for very large tables, which leads me to wonder whether each column's contents are in a file specifically for that column. My question: Suppose I have a very "wide" set of data, say 100 columns, and one of those columns will be updated often, but the others are fairly static. I have two choices: Design 1: create table a ( id integer, frequently_updated integer); create table b( id integer, infrequently_updated_1 integer, infrequently_updated_2 integer, infrequently_updated_3 integer, ... etc. infrequently_updated_99 integer); Design 2: create table c( id integer, frequently_updated integer, infrequently_updated_1 integer, infrequently_updated_2 integer, infrequently_updated_3 integer, ... etc. infrequently_updated_99 integer); If "update == delete + insert" is strictly true, then "Design 2" would be poor since 99 columns would be moved around with each update. But if columns are actually stored in separate files, the Designs 1 and 2 would be essentially equivalent when it comes to vacuuming. Thanks, Craig From pgsql-performance-owner@postgresql.org Mon Mar 20 18:56:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DF2519DCAEE for ; Mon, 20 Mar 2006 18:56: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 96464-05 for ; Mon, 20 Mar 2006 18:56:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from amanda.contactbda.com (ipn36372-f65123.cidr.lightship.net [216.204.66.227]) by postgresql.org (Postfix) with ESMTP id C341C9DC9C0 for ; Mon, 20 Mar 2006 18:56:37 -0400 (AST) Received: from amanda.contactbda.com (amanda.contactbda.com [192.168.1.2]) by amanda.contactbda.com (8.12.11/8.12.11/Debian-3) with ESMTP id k2KMuY0O003868; Mon, 20 Mar 2006 17:56:34 -0500 From: "Jim Buttafuoco" To: "Craig A. James" , pgsql-performance@postgresql.org Reply-To: jim@contactbda.com Subject: Re: update == delete + insert? Date: Mon, 20 Mar 2006 17:56:34 -0500 Message-Id: <20060320225614.M93465@contactbda.com> In-Reply-To: <441F3187.90506@modgraph-usa.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> <441F3187.90506@modgraph-usa.com> X-Mailer: Open WebMail 2.41 20040926 X-OriginatingIP: 192.168.1.1 (jim) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.124 required=5 tests=[AWL=0.124] X-Spam-Score: 0.124 X-Spam-Level: X-Archive-Number: 200603/353 X-Sequence-Number: 17790 go with design 1, update does = delete + insert. ---------- Original Message ----------- From: "Craig A. James" To: pgsql-performance@postgresql.org Sent: Mon, 20 Mar 2006 14:49:43 -0800 Subject: [PERFORM] update == delete + insert? > I've seen it said here several times that "update == delete + insert". On the other hand, I've noticed that > "alter table [add|drop] column ..." is remarkably fast, even for very large tables, which leads me to wonder > whether each column's contents are in a file specifically for that column. > > My question: Suppose I have a very "wide" set of data, say 100 columns, and one of those columns will be > updated often, but the others are fairly static. I have two choices: > > Design 1: > create table a ( > id integer, > frequently_updated integer); > > create table b( > id integer, > infrequently_updated_1 integer, > infrequently_updated_2 integer, > infrequently_updated_3 integer, > ... etc. > infrequently_updated_99 integer); > > Design 2: > create table c( > id integer, > frequently_updated integer, > infrequently_updated_1 integer, > infrequently_updated_2 integer, > infrequently_updated_3 integer, > ... etc. > infrequently_updated_99 integer); > > If "update == delete + insert" is strictly true, then "Design 2" would be poor since 99 columns would be moved > around with each update. But if columns are actually stored in separate files, the Designs 1 and 2 would be > essentially equivalent when it comes to vacuuming. > > Thanks, > Craig > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend ------- End of Original Message ------- From pgsql-performance-owner@postgresql.org Mon Mar 20 19:00:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D48659DC9C6 for ; Mon, 20 Mar 2006 19:00: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 95301-08 for ; Mon, 20 Mar 2006 19:00:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asgard1.americatelsal.com (asgard1.americatelsal.com [200.13.161.7]) by postgresql.org (Postfix) with ESMTP id 6AA8D9DC9FC for ; Mon, 20 Mar 2006 19:00:28 -0400 (AST) Received: (qmail 70474 invoked from network); 20 Mar 2006 23:23:11 -0000 Received: from unknown (HELO ?192.168.10.124?) (200.13.161.68) by asgard1.americatelsal.com with SMTP; 20 Mar 2006 23:23:11 -0000 Message-ID: <441F34EA.6020100@123.com.sv> Date: Mon, 20 Mar 2006 17:04:10 -0600 From: Miguel User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vivek Khera CC: Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> 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.025 required=5 tests=[AWL=0.025] X-Spam-Score: 0.025 X-Spam-Level: X-Archive-Number: 200603/354 X-Sequence-Number: 17791 Vivek Khera wrote: >>> If you do put on FreeBSD 6, I'd love to see the output of "diskinfo >>> - v -t" on your RAID volume(s). >>> >> Not directly related ... >> i have a HP dl380 g3 with array 5i controlled (1+0), these are my >> results >> [...] >> is this good enough? > > > Is that on a loaded box or a mostly quiet box? Those number seem > rather low for my tastes. For comparison, here are numbers from a > Dell 1850 with a built-in PERC 4e/Si RAID in a two disk mirror. All > numbers below are on mostly or totally quiet disk systems. My numbers are on totally quiet box, i've just installed it. > > amrd0 > 512 # sectorsize > 73274490880 # mediasize in bytes (68G) > 143114240 # mediasize in sectors > 8908 # Cylinders according to firmware. > 255 # Heads according to firmware. > 63 # Sectors according to firmware. > > Seek times: > Full stroke: 250 iter in 0.756718 sec = 3.027 msec > Half stroke: 250 iter in 0.717824 sec = 2.871 msec > Quarter stroke: 500 iter in 1.972368 sec = 3.945 msec > Short forward: 400 iter in 1.193179 sec = 2.983 msec > Short backward: 400 iter in 1.322440 sec = 3.306 msec > Seq outer: 2048 iter in 0.271402 sec = 0.133 msec > Seq inner: 2048 iter in 0.271151 sec = 0.132 msec > Transfer rates: > outside: 102400 kbytes in 1.080339 sec = 94785 > kbytes/sec > middle: 102400 kbytes in 1.166021 sec = 87820 > kbytes/sec > inside: 102400 kbytes in 1.461498 sec = 70065 > kbytes/sec > > Umm, in my box i see better seektimes but worst transfer rates, does it make sense? i think i have something wrong, the question i cant answer is what tunning am i missing? --- Miguel From pgsql-performance-owner@postgresql.org Mon Mar 20 19:05:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4F13F9DD443 for ; Mon, 20 Mar 2006 19:05: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 09665-08 for ; Mon, 20 Mar 2006 19:05:38 -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 547059DD298 for ; Mon, 20 Mar 2006 19:05:33 -0400 (AST) Received: from [192.168.1.3] (unknown [192.168.1.3]) by yertle.kcilink.com (Postfix) with ESMTP id 3ED91B820 for ; Mon, 20 Mar 2006 18:05:36 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <441F34EA.6020100@123.com.sv> References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> <441F34EA.6020100@123.com.sv> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <5919B132-34DA-4B3F-ABB7-1E6B4030EA9F@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Date: Mon, 20 Mar 2006 18:05:35 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.075 required=5 tests=[AWL=0.075] X-Spam-Score: 0.075 X-Spam-Level: X-Archive-Number: 200603/355 X-Sequence-Number: 17792 On Mar 20, 2006, at 6:04 PM, Miguel wrote: > Umm, in my box i see better seektimes but worst transfer rates, > does it make sense? > i think i have something wrong, the question i cant answer is what > tunning am i missing? Well, I forgot to mention I have 15k RPM disks, so the transfers should be faster. I did no tuning to the disk configurations. I think your controller is either just not supported well in FreeBSD, or is bad in general... I *really* wish LSI would make a low profile card that would fit in a Sun X4100... as it stands the only choice for dual channel cards is the adaptec 2230SLP... From pgsql-performance-owner@postgresql.org Mon Mar 20 19:11:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B2A169DC9FC for ; Mon, 20 Mar 2006 19: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 11256-06 for ; Mon, 20 Mar 2006 19:11:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asgard1.americatelsal.com (asgard.americatelsal.com [200.13.161.7]) by postgresql.org (Postfix) with ESMTP id 27D129DC889 for ; Mon, 20 Mar 2006 19:11:18 -0400 (AST) Received: (qmail 71668 invoked from network); 20 Mar 2006 23:34:02 -0000 Received: from unknown (HELO ?192.168.10.124?) (200.13.161.68) by asgard1.americatelsal.com with SMTP; 20 Mar 2006 23:34:02 -0000 Message-ID: <441F3775.3090808@123.com.sv> Date: Mon, 20 Mar 2006 17:15:01 -0600 From: Miguel User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vivek Khera CC: Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> <441F34EA.6020100@123.com.sv> <5919B132-34DA-4B3F-ABB7-1E6B4030EA9F@khera.org> In-Reply-To: <5919B132-34DA-4B3F-ABB7-1E6B4030EA9F@khera.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.03 required=5 tests=[AWL=0.030] X-Spam-Score: 0.03 X-Spam-Level: X-Archive-Number: 200603/356 X-Sequence-Number: 17793 Vivek Khera wrote: > > On Mar 20, 2006, at 6:04 PM, Miguel wrote: > >> Umm, in my box i see better seektimes but worst transfer rates, does >> it make sense? >> i think i have something wrong, the question i cant answer is what >> tunning am i missing? > > > Well, I forgot to mention I have 15k RPM disks, so the transfers > should be faster. > > I did no tuning to the disk configurations. I think your controller > is either just not supported well in FreeBSD, or is bad in general... :-( I guess you are right, i made a really bad choice, i better look at dell next time, thanks --- Miguel From pgsql-performance-owner@postgresql.org Mon Mar 20 19:22:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 33E4B9DD451 for ; Mon, 20 Mar 2006 19:22: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 11788-07 for ; Mon, 20 Mar 2006 19:22:49 -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 097DB9DD200 for ; Mon, 20 Mar 2006 19:22: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 k2KNMj7E008910; Mon, 20 Mar 2006 18:22:45 -0500 (EST) To: "Craig A. James" cc: pgsql-performance@postgresql.org Subject: Re: update == delete + insert? In-reply-to: <441F3187.90506@modgraph-usa.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> <441F3187.90506@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Mon, 20 Mar 2006 14:49:43 -0800" Date: Mon, 20 Mar 2006 18:22:45 -0500 Message-ID: <8909.1142896965@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/357 X-Sequence-Number: 17794 "Craig A. James" writes: > I've seen it said here several times that "update == delete + insert". On the other hand, I've noticed that "alter table [add|drop] column ..." is remarkably fast, even for very large tables, which leads me to wonder whether each column's contents are in a file specifically for that column. No. The reason "drop column" is fast is that we make no attempt to remove the data from existing rows; we only mark the column's entry in the system catalogs as deleted. "add column" is only fast if you are adding a column with no default (a/k/a default NULL). In that case likewise we don't have to modify existing rows; the desired behavior falls out from the fact that the tuple access routines return NULL if asked to fetch a column beyond those existing in a particular tuple. You can read about the storage layout in http://developer.postgresql.org/docs/postgres/storage.html regards, tom lane From pgsql-performance-owner@postgresql.org Mon Mar 20 19:26:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 88A499DCC84 for ; Mon, 20 Mar 2006 19:26: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 13321-05 for ; Mon, 20 Mar 2006 19:26:40 -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 21DF29DCBB2 for ; Mon, 20 Mar 2006 19:26:35 -0400 (AST) Received: (qmail 21371 invoked from network); 21 Mar 2006 00:27:05 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 21 Mar 2006 00:27:05 +0100 Date: Tue, 21 Mar 2006 00:27:04 +0100 To: "Postgresql Performance" Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <441F161D.7010502@123.com.sv> User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/358 X-Sequence-Number: 17795 This is a 2-Disk Linux software RAID1 with 2 7200RPM IDE Drives, 1 PATA and 1 SATA : apollo13 ~ # hdparm -t /dev/md0 /dev/md0: Timing buffered disk reads: 156 MB in 3.02 seconds = 51.58 MB/sec apollo13 ~ # hdparm -t /dev/md0 /dev/md0: Timing buffered disk reads: 168 MB in 3.06 seconds = 54.87 MB/sec This is a 5-Disk Linux software RAID5 with 4 7200RPM IDE Drives and 1 5400RPM, 3 SATA and 2 PATA: apollo13 ~ # hdparm -t /dev/md2 /dev/md2: Timing buffered disk reads: 348 MB in 3.17 seconds = 109.66 MB/sec apollo13 ~ # hdparm -t /dev/md2 /dev/md2: Timing buffered disk reads: 424 MB in 3.00 seconds = 141.21 MB/sec apollo13 ~ # hdparm -t /dev/md2 /dev/md2: Timing buffered disk reads: 426 MB in 3.00 seconds = 141.88 MB/sec apollo13 ~ # hdparm -t /dev/md2 /dev/md2: Timing buffered disk reads: 426 MB in 3.01 seconds = 141.64 MB/sec The machine is a desktop Athlon 64 3000+, buggy nforce3 chipset, 1G DDR400, Gentoo Linux 2.6.15-ck4 running in 64 bit mode. The bottleneck is the PCI bus. Expensive SCSI hardware RAID cards with expensive 10Krpm harddisks should not get humiliated by such a simple (and cheap) setup. (I'm referring to the 12-drive RAID10 mentioned before, not the other one which was a simple 2-disk mirror). Toms hardware benchmarked some hardware RAIDs and got humongous transfer rates... hm ? From pgsql-performance-owner@postgresql.org Mon Mar 20 20:27:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D076F9DCA57 for ; Mon, 20 Mar 2006 20:27: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 19346-10 for ; Mon, 20 Mar 2006 20:27:20 -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 A44479DC80E for ; Mon, 20 Mar 2006 20:27: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 k2L0RHhv009397; Mon, 20 Mar 2006 19:27:17 -0500 (EST) To: "Craig A. James" cc: Mikael Carneholm , pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performance optimization In-reply-to: <441EC652.1010807@modgraph-usa.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Mon, 20 Mar 2006 07:12:18 -0800" Date: Mon, 20 Mar 2006 19:27:17 -0500 Message-ID: <9396.1142900837@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/359 X-Sequence-Number: 17796 "Craig A. James" writes: > If you haven't explored the COPY command yet, check it out. It is stunningly fast compared to normal INSERT commands. Note also that his "benchmark" is testing multiple INSERTs issued within a loop in a plpgsql function, which has got nearly nothing to do with the performance that will be obtained from INSERTs issued by a client (especially if said INSERTs aren't prepared and/or aren't batched into transactions). regards, tom lane From pgsql-performance-owner@postgresql.org Mon Mar 20 21:38:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B98389DC9F8 for ; Mon, 20 Mar 2006 21:38: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 29409-06 for ; Mon, 20 Mar 2006 21:38:17 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by postgresql.org (Postfix) with ESMTP id AF1059DC9A3 for ; Mon, 20 Mar 2006 21:38:11 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i32so1171045wra for ; Mon, 20 Mar 2006 17:38:15 -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=c5X5t6mKJpOEd5Pz9f62ghMTmVujGNLDEDgQPShDJB3+H3a7Lo1czem/M0EKMgoa5vxgkvkyONK3Ad9sCrJcAJh0IMTxssaR2AqXU7mm88iyJBEtsBc0+yPocKyJH8NymSwWvu1Kc+HxnEX4l4UhRrWhh7Y5iJ/pdXeStBCPVn4= Received: by 10.54.123.19 with SMTP id v19mr4164611wrc; Mon, 20 Mar 2006 17:38:15 -0800 (PST) Received: by 10.54.98.6 with HTTP; Mon, 20 Mar 2006 17:38:15 -0800 (PST) Message-ID: Date: Mon, 20 Mar 2006 20:38:15 -0500 From: "Jaime Casanova" To: "Craig A. James" Subject: Re: update == delete + insert? Cc: pgsql-performance@postgresql.org In-Reply-To: <441F3187.90506@modgraph-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> <441F3187.90506@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/360 X-Sequence-Number: 17797 On 3/20/06, Craig A. James wrote: > I've seen it said here several times that "update =3D=3D delete + insert"= . On the other hand, I've noticed that "alter table [add|drop] column ..."= is remarkably fast, even for very large tables, which leads me to wonder w= hether each column's contents are in a file specifically for that column. > > My question: Suppose I have a very "wide" set of data, say 100 columns, a= nd one of those columns will be updated often, but the others are fairly st= atic. I have two choices: > > Design 1: > create table a ( > id integer, > frequently_updated integer); > > create table b( > id integer, > infrequently_updated_1 integer, > infrequently_updated_2 integer, > infrequently_updated_3 integer, > ... etc. > infrequently_updated_99 integer); > > Design 2: > create table c( > id integer, > frequently_updated integer, > infrequently_updated_1 integer, > infrequently_updated_2 integer, > infrequently_updated_3 integer, > ... etc. > infrequently_updated_99 integer); > > If "update =3D=3D delete + insert" is strictly true, then "Design 2" woul= d be poor since 99 columns would be moved around with each update. But if = columns are actually stored in separate files, the Designs 1 and 2 would be= essentially equivalent when it comes to vacuuming. > > Thanks, > Craig > design 1 is normalized and better design 2 is denormalized and a bad approach no matter the RDBMS update does delete + insert, and vacuum is the way to recover the space -- Atentamente, Jaime Casanova "What they (MySQL) lose in usability, they gain back in benchmarks, and tha= t's all that matters: getting the wrong answer really fast." Randal L. Schwartz From pgsql-performance-owner@postgresql.org Mon Mar 20 22:57:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CCEB09DD202 for ; Mon, 20 Mar 2006 22:57: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 44433-06 for ; Mon, 20 Mar 2006 22:57:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz [203.96.152.183]) by postgresql.org (Postfix) with ESMTP id 9FDB79DD072 for ; Mon, 20 Mar 2006 22:57:36 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IWG00C1EIW49S@linda-4.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 21 Mar 2006 14:57:40 +1200 (NZST) Received: from [192.168.1.11] (218-101-28-245.dsl.clear.net.nz [218.101.28.245]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 9376460C462; Tue, 21 Mar 2006 14:57:39 +1200 (NZST) Date: Tue, 21 Mar 2006 14:57:37 +1200 From: Mark Kirkwood Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & In-reply-to: <1142871620.17883.4.camel@state.g2switchworks.com> To: Scott Marlowe Cc: "Jim C. Nasby" , Kenji Morishige , pgsql-performance@postgresql.org Message-id: <441F6BA1.20005@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: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> <20060320144503.GR15742@pervasive.com> <1142871620.17883.4.camel@state.g2switchworks.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.174 required=5 tests=[AWL=0.174] X-Spam-Score: 0.174 X-Spam-Level: X-Archive-Number: 200603/361 X-Sequence-Number: 17798 Scott Marlowe wrote: > On Mon, 2006-03-20 at 08:45, Jim C. Nasby wrote: > >>On Fri, Mar 17, 2006 at 05:00:34PM -0600, Scott Marlowe wrote: >> >>>>last pid: 5788; load averages: 0.32, 0.31, 0.28 up 127+15:16:08 13:59:24 >>>>169 processes: 1 running, 168 sleeping >>>>CPU states: 5.4% user, 0.0% nice, 9.9% system, 0.0% interrupt, 84.7% idle >>>>Mem: 181M Active, 2632M Inact, 329M Wired, 179M Cache, 199M Buf, 81M Free >>>>Swap: 4096M Total, 216K Used, 4096M Free >>>> >>>> PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND >>>>14501 pgsql 2 0 254M 242M select 2 76:26 1.95% 1.95% postgre >>>> 5720 root 28 0 2164K 1360K CPU0 0 0:00 1.84% 0.88% top >>>> 5785 pgsql 2 0 255M 29296K sbwait 0 0:00 3.00% 0.15% postgre >>>> 5782 pgsql 2 0 255M 11900K sbwait 0 0:00 3.00% 0.15% postgre >>>> 5772 pgsql 2 0 255M 11708K sbwait 2 0:00 1.54% 0.15% postgre >>> >>>That doesn't look good. Is this machine freshly rebooted, or has it >>>been running postgres for a while? 179M cache and 199M buffer with 2.6 >>>gig inactive is horrible for a machine running a 10gig databases. >> >>No, this is perfectly fine. Inactive memory in FreeBSD isn't the same as >>Free. It's the same as 'active' memory except that it's pages that >>haven't been accessed in X amount of time (between 100 and 200 ms, I >>think). When free memory starts getting low, FBSD will start moving >>pages from the inactive queue to the free queue (possibly resulting in >>writes to disk along the way). >> >>IIRC, Cache is the directory cache, and Buf is disk buffers, which is >>somewhat akin to shared_buffers in PostgreSQL. > > > So, then, the inact is pretty much the same as kernel buffers in linux? > I think Freebsd 'Inactive' corresponds pretty closely to Linux's 'Inactive Dirty'|'Inactive Laundered'|'Inactive Free'. From what I can see, 'Buf' is a bit misleading e.g. read a 1G file randomly and you increase 'Inactive' by about 1G - 'Buf' might get to 200M. However read the file again and you'll see zero i/o in vmstat or gstat. From reading the Freebsd architecture docs, I think 'Buf' consists of those pages from 'Inactive' or 'Active' that were last kvm mapped for read/write operations. However 'Buf' is restricted to a fairly small size (various sysctls), so really only provides a lower bound on the file buffer cache activity. Sorry to not really answer your question Scott - how are Linux kernel buffers actually defined? Cheers Mark From pgsql-performance-owner@postgresql.org Mon Mar 20 23:51:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E49BF9DC8E1 for ; Mon, 20 Mar 2006 23:51: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 54679-10 for ; Mon, 20 Mar 2006 23:51:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-5.paradise.net.nz (bm-5a.paradise.net.nz [203.96.152.184]) by postgresql.org (Postfix) with ESMTP id D10C59DC85F for ; Mon, 20 Mar 2006 23:51:33 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-5.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IWG00DG4LE1C7@linda-5.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 21 Mar 2006 15:51:38 +1200 (NZST) Received: from [192.168.1.11] (218-101-28-245.dsl.clear.net.nz [218.101.28.245]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 3A1AC12102DA; Tue, 21 Mar 2006 15:51:37 +1200 (NZST) Date: Tue, 21 Mar 2006 15:51:35 +1200 From: Mark Kirkwood Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & In-reply-to: <441F6BA1.20005@paradise.net.nz> To: Mark Kirkwood Cc: Scott Marlowe , "Jim C. Nasby" , Kenji Morishige , pgsql-performance@postgresql.org Message-id: <441F7847.5000406@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: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> <20060320144503.GR15742@pervasive.com> <1142871620.17883.4.camel@state.g2switchworks.com> <441F6BA1.20005@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.173 required=5 tests=[AWL=0.173] X-Spam-Score: 0.173 X-Spam-Level: X-Archive-Number: 200603/362 X-Sequence-Number: 17799 Mark Kirkwood wrote: > > I think Freebsd 'Inactive' corresponds pretty closely to Linux's > 'Inactive Dirty'|'Inactive Laundered'|'Inactive Free'. > Hmmm - on second thoughts I think I've got that wrong :-(, since in Linux all the file buffer pages appear in 'Cached' don't they... (I also notice that 'Inactive Laundered' does not seem to be mentioned in vanilla - read non-Redhat - 2.6 kernels) So I think its more correct to say Freebsd 'Inactive' is similar to Linux 'Inactive' + some|most of Linux 'Cached'. A good discussion of how the Freebsd vm works is here: http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/vm.html In particular: "FreeBSD reserves a limited amount of KVM to hold mappings from struct bufs, but it should be made clear that this KVM is used solely to hold mappings and does not limit the ability to cache data." Cheers Mark From pgsql-performance-owner@postgresql.org Tue Mar 21 02:06:39 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EDA0C9DCD23 for ; Tue, 21 Mar 2006 02:06: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 77248-03 for ; Tue, 21 Mar 2006 02:06:37 -0400 (AST) X-Greylist: delayed 00:06:41.233663 by SQLgrey- Received: from web507.biz.mail.mud.yahoo.com (web507.biz.mail.mud.yahoo.com [209.191.86.218]) by postgresql.org (Postfix) with SMTP id 76FE89DCCC2 for ; Tue, 21 Mar 2006 02:06:35 -0400 (AST) Received: (qmail 85304 invoked by uid 60001); 21 Mar 2006 05:59:54 -0000 Message-ID: <20060321055954.85302.qmail@web507.biz.mail.mud.yahoo.com> Received: from [210.210.13.177] by web507.biz.mail.mud.yahoo.com via HTTP; Mon, 20 Mar 2006 21:59:54 PST Date: Mon, 20 Mar 2006 21:59:54 -0800 (PST) From: Amit Soni Subject: Perfomance test figures To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-2118781698-1142920794=:85077" Content-Transfer-Encoding: 8bit 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: 200603/363 X-Sequence-Number: 17800 --0-2118781698-1142920794=:85077 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi All, I want to compare performance of postgresql database with some other database. Somebody must have done some performance testing. Can you pls. share that data (performance figures) with me? And if possible pls. share procedure also, that how you have done the same? Thanks In Advance, -Amit --0-2118781698-1142920794=:85077 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi All,
 
I want to compare performance of postgresql database with some other database.
 
Somebody must have done some performance testing.
 
Can you pls. share that data (performance figures) with me? And if possible pls. share procedure also, that how you have done the same?
 
Thanks In Advance,
-Amit
--0-2118781698-1142920794=:85077-- From pgsql-performance-owner@postgresql.org Tue Mar 21 04:25:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0068E9DCE3E for ; Tue, 21 Mar 2006 04: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 01397-04 for ; Tue, 21 Mar 2006 04:25:55 -0400 (AST) X-Greylist: delayed 17:26:24.373416 by SQLgrey- Received: from maya.ngi.it (maya.ngi.it [88.149.128.3]) by postgresql.org (Postfix) with ESMTP id A94729DCBFE for ; Tue, 21 Mar 2006 04:25:50 -0400 (AST) Received: from [192.168.0.11] (194-185-53-252.f5.ngi.it [194.185.53.252]) by maya.ngi.it (8.13.5/8.13.5) with ESMTP id k2L8Pof7016384 for ; Tue, 21 Mar 2006 09:25:51 +0100 Message-ID: <441FB88E.2060801@bluestudio.it> Date: Tue, 21 Mar 2006 09:25:50 +0100 From: Marco Furetto User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query Feromance References: <441EC34D.1000901@bluestudio.it> <001301c64c3c$3404b3f0$8b00000a@reimer> In-Reply-To: <001301c64c3c$3404b3f0$8b00000a@reimer> 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.589 required=5 tests=[AWL=-0.222, RCVD_IN_WHOIS_BOGONS=1.811] X-Spam-Score: 1.589 X-Spam-Level: * X-Archive-Number: 200603/364 X-Sequence-Number: 17801 Hello! I'm managing the db of a "Content Management environment" and I'm searching for a "Query analyzer" to improve performance because i don't know how many and what type of queries are executing on the system (for the "where and join" block). If i could have query's stats i could Optimize the queries indexes. Thank's a lot! Marco "Furetto" Berri Reimer wrote: > Marco, > > Could you give us the query you would like to improve performance? > > > ----- Original Message ----- From: "Marco Furetto" > To: > Sent: Monday, March 20, 2006 11:59 AM > Subject: [PERFORM] Query Feromance > > >> Hello! >> >> Can I Increment the perfomance of execution query? >> >> Where is the instrument to analyze the query runnnig for create a >> Index query for a single optimize that? >> >> thank's >> >> Marco "Furetto" Berri >> >> ---------------------------(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 >> > > ---------------------------(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 Mar 21 04:40:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 74D779DCBFE for ; Tue, 21 Mar 2006 04:40: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 04123-04 for ; Tue, 21 Mar 2006 04:40:48 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 22EA79DCB9F for ; Tue, 21 Mar 2006 04:40:46 -0400 (AST) Received: from mail.rp-online.de (mail.rp-online.de [149.221.1.199]) by svr4.postgresql.org (Postfix) with ESMTP id 11B5F5AF663 for ; Tue, 21 Mar 2006 08:40:47 +0000 (GMT) Received: from idefix.d.rp-online.de (idefix.d.rp-online.de [149.221.100.194]) by mail.rp-online.de (Postfix) with ESMTP id 1AA081CF8E for ; Tue, 21 Mar 2006 09:40:44 +0100 (CET) From: Thomas Pundt Reply-To: Thomas Pundt Organization: RP Online Verlagsgesellschaft mbH To: pgsql-performance@postgresql.org Subject: Re: Query Feromance Date: Tue, 21 Mar 2006 09:43:57 +0100 User-Agent: KMail/1.9.1 References: <441EC34D.1000901@bluestudio.it> <001301c64c3c$3404b3f0$8b00000a@reimer> <441FB88E.2060801@bluestudio.it> In-Reply-To: <441FB88E.2060801@bluestudio.it> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603210943.57454.mlists@rp-online.de> X-Anti-Virus: Kaspersky Anti-Virus for MailServers 5.5.3/RELEASE, bases: 21032006 #172112, status: clean 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: 200603/365 X-Sequence-Number: 17802 Hi, On Tuesday 21 March 2006 09:25, Marco Furetto wrote: | I'm managing the db of a "Content Management environment" and I'm | searching for a "Query analyzer" to improve performance because i don't | know how many and what type of queries are executing on the system (for | the "where and join" block). as a first step, I'd enable query duration logging; in postgresql.conf I have set log_min_duration_statement = 3000 this will log each query that needs more than 3 seconds to complete. The next step would be to "explain analyze" the problematic queries. Ciao, Thomas -- Thomas Pundt ---- http://rp-online.de/ ---- From pgsql-performance-owner@postgresql.org Tue Mar 21 05:50:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 05B3D9DCC57 for ; Tue, 21 Mar 2006 05:50: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 15201-08 for ; Tue, 21 Mar 2006 05:50:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 7C0929DCB67 for ; Tue, 21 Mar 2006 05:50:49 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 83E8756435; Tue, 21 Mar 2006 03:50:51 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 03:50:49 -0600 Date: Tue, 21 Mar 2006 03:50:49 -0600 From: "Jim C. Nasby" To: Guillaume Cottenceau Cc: Mark Kirkwood , pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? Message-ID: <20060321095049.GW15742@pervasive.com> References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d5ghms3h.fsf@meuh.mnc.lan> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:gc@mnc.ch::OpXr9P4V8hdvVlAr:0000000035Mz X-Hashcash: 1:20:060321:markir@paradise.net.nz::L2xdmSAf9yBBpb6y:000000000000000 0000000000000000000000003Iee X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::cFuKpCu8Ntcls8zs:00000 000000000000000000000000EPOp X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/366 X-Sequence-Number: 17803 On Mon, Mar 20, 2006 at 09:35:14AM +0100, Guillaume Cottenceau wrote: > > shared_buffer = 12000 > > effective_cache_size = 25000 > > > > This would mean you are reserving 100M for Postgres to cache relation > > pages, and informing the planner that it can expect ~200M available > > from the disk buffer cache. To give a better recommendation, we need > > Ok, thanks. I wanted to investigate this field, but as the > application is multithreaded and uses a lot of postgres clients, > I wanted to make sure the shared_buffers values is globally for > postgres, not just per (TCP) connection to postgres, before > increasing the value, fearing to take the whole server down. shared_buffer is for the entire 'cluster', not per-connection or per-database. Also, effective_cache_size of 25000 on a 1G machine seems pretty conservative to me. I'd set it to at least 512MB, if not closer to 800MB. -- 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 Mar 21 05:56:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 663AD9DC8DB for ; Tue, 21 Mar 2006 05:56: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 17165-03 for ; Tue, 21 Mar 2006 05:56:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from maya.ngi.it (ns2.ngi.it [88.149.128.3]) by postgresql.org (Postfix) with ESMTP id 5FF699DC82D for ; Tue, 21 Mar 2006 05:56:35 -0400 (AST) Received: from [192.168.0.11] (194-185-53-252.f5.ngi.it [194.185.53.252]) by maya.ngi.it (8.13.5/8.13.5) with ESMTP id k2L9uZqd025539 for ; Tue, 21 Mar 2006 10:56:36 +0100 Message-ID: <441FCDD2.8010905@bluestudio.it> Date: Tue, 21 Mar 2006 10:56:34 +0100 From: Marco Furetto User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query Feromance References: <441EC34D.1000901@bluestudio.it> <001301c64c3c$3404b3f0$8b00000a@reimer> <441FB88E.2060801@bluestudio.it> <200603210943.57454.mlists@rp-online.de> In-Reply-To: <200603210943.57454.mlists@rp-online.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.726 required=5 tests=[AWL=-0.085, RCVD_IN_WHOIS_BOGONS=1.811] X-Spam-Score: 1.726 X-Spam-Level: * X-Archive-Number: 200603/367 X-Sequence-Number: 17804 ok, I enable query duration logging in postgresql.conf. where is the instruments for analyze the statistics queries executing on my db? Eg.: Number of query executing, total time for executing a single query, etc... Thank's Marco "Furetto" Berri Thomas Pundt wrote: > Hi, > > On Tuesday 21 March 2006 09:25, Marco Furetto wrote: > | I'm managing the db of a "Content Management environment" and I'm > | searching for a "Query analyzer" to improve performance because i don't > | know how many and what type of queries are executing on the system (for > | the "where and join" block). > > as a first step, I'd enable query duration logging; in postgresql.conf > I have set > > log_min_duration_statement = 3000 > > this will log each query that needs more than 3 seconds to complete. > > The next step would be to "explain analyze" the problematic queries. > > Ciao, > Thomas > From pgsql-performance-owner@postgresql.org Tue Mar 21 05:57:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2A79F9DCC57 for ; Tue, 21 Mar 2006 05:57: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 17861-02 for ; Tue, 21 Mar 2006 05:57:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id A2A209DCC08 for ; Tue, 21 Mar 2006 05:56:59 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 8D46B56431; Tue, 21 Mar 2006 03:57:01 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 03:57:00 -0600 Date: Tue, 21 Mar 2006 03:57:00 -0600 From: "Jim C. Nasby" To: Guillaume Cottenceau Cc: Guillaume Smet , pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? Message-ID: <20060321095700.GX15742@pervasive.com> References: <87ek11gz69.fsf@meuh.mnc.lan> <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> <87hd5tmt1z.fsf@meuh.mnc.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87hd5tmt1z.fsf@meuh.mnc.lan> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:gc@mnc.ch::BvhvCDxzQw+OTD+n:0000000023xH X-Hashcash: 1:20:060321:guillaume.smet@gmail.com::lDGYZVTiI0NmBaNG:0000000000000 0000000000000000000000006IcO X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::4ItF8IbxvOxTczDw:00000 00000000000000000000000030TM X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/368 X-Sequence-Number: 17805 On Mon, Mar 20, 2006 at 09:14:32AM +0100, Guillaume Cottenceau wrote: > Guillaume, > > Thanks for your answer. > > > On 17 Mar 2006 11:09:50 +0100, Guillaume Cottenceau > > wrote: > > > Reading the documentation and postgresql list archives, I have > > > run ANALYZE right before my tests, I have increased the > > > statistics target to 50 for the considered table; my problem is > > > that the index scan cost reported by EXPLAIN seems to be around > > > 12.7 times higher that it should, a figure I suppose incompatible > > > (too large) for just random_page_cost and effective_cache_size > > > tweaks. > > > > It's not surprising you have a high cost for an index scan which is > > planned to return and returns so much rows. I really don't think the > > planner does something wrong on this one. > > My point is that the planner's cost estimate is way above the > actual cost of the query, so the planner doesn't use the best > plan. Even if the index returns so much rows, actual cost of the > query is so that index scan (worst case, all disk cache flushed) > is still better than seq scan but the planner uses seq scan. Yes. The cost estimator for an index scan supposedly does a linear interpolation between a minimum cost and a maximum cost depending on the correlation of the first field in the index. The problem is that while the comment states it's a linear interpolation, the actual formula squares the correlation before interpolating. This means that unless the correlation is very high, you're going to get an unrealistically high cost for an index scan. I have data that supports this at http://stats.distributed.net/~decibel/, but I've never been able to get around to testing a patch to see if it improves things. > > thinking the problem is that your test case is not accurate. > > Ok. Actually, I suspect your test case was probably fine, but take a look at the data I've got and see what you think. If you want to spend some time on this it should be possible to come up with a test case that uses either pgbench or dbt2/3 to generate data, so that others can easily reproduce (I can't really make the data I used for my testing available). -- 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 Mar 21 05:59:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 39F789DCA72 for ; Tue, 21 Mar 2006 05:59: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 17534-05 for ; Tue, 21 Mar 2006 05:59:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id A53959DC9C8 for ; Tue, 21 Mar 2006 05:59:30 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 14A8856427; Tue, 21 Mar 2006 03:59:33 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 03:59:32 -0600 Date: Tue, 21 Mar 2006 03:59:32 -0600 From: "Jim C. Nasby" To: Antoine Cc: pgsql-performance@postgresql.org Subject: Re: partitioning Message-ID: <20060321095931.GY15742@pervasive.com> References: <92d3a4950603190431p43fd399aq@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <92d3a4950603190431p43fd399aq@mail.gmail.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:melser.anton@gmail.com::v5V0vCvMmUWKJaq7:000000000000000 0000000000000000000000001i/A X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::DuHNK24esbD8rV3W:00000 0000000000000000000000008VAz X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/369 X-Sequence-Number: 17806 On Sun, Mar 19, 2006 at 01:31:42PM +0100, Antoine wrote: > Hi, > Is there any work on the cards for implementing other partitioning > strategies? I see mysql 5.1 will have support for hashes and stuff but > didn't see anything in the todos for postgres. You'd have to provide a pretty convincing argument for providing hash partitioning I think. I can't really think of any real-world scenarios where it's better than other forms. In any case, the next logical step on the partitioning front is to add some 'syntactic sugar' to make it easier for people to work with partitions. I seem to remember some discussion about that, but I don't recall where it lead to. -- 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 Mar 21 06:04:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E632F9DC9C8 for ; Tue, 21 Mar 2006 06: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 17054-07 for ; Tue, 21 Mar 2006 06:04:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id AFD9F9DC8DB for ; Tue, 21 Mar 2006 06:04:10 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id C35D556437; Tue, 21 Mar 2006 04:04:12 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 04:04:12 -0600 Date: Tue, 21 Mar 2006 04:04:12 -0600 From: "Jim C. Nasby" To: Tim Allen Cc: pgsql-performance@postgresql.org Subject: Re: partial indexes and inference Message-ID: <20060321100411.GZ15742@pervasive.com> References: <441E2F29.3030004@proximity.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <441E2F29.3030004@proximity.com.au> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:tim@proximity.com.au::ishgSLF/1bfadLJx:00000000000000000 0000000000000000000000001aOH X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::oevC168g83ZwqoRK:00000 0000000000000000000000005dB4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/370 X-Sequence-Number: 17807 I suspect you've found an issue with how the planner evaluates indexes for bitmap scans. My guess is that that section of the planner needs to be taught to look for partial indexes. You should also try cast(value as bigint) = 1009 The planner may be getting confused by the '1009'. On Mon, Mar 20, 2006 at 03:27:21PM +1100, Tim Allen wrote: > I have a case where it seems the planner should be able to infer more > from its partial indexes than it is doing. Observe: > > px=# select version(); > version > ------------------------------------------------------------------------ > PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 > (1 row) > > px=# \d pxmdvalue > Table "store.pxmdvalue" > Column | Type | Modifiers > ------------+----------+----------- > entityid | bigint | not null > fieldid | integer | not null > value | text | not null > datatypeid | integer | not null > tsi | tsvector | > Indexes: > "pxmdvalue_pk" PRIMARY KEY, btree (entityid, fieldid) > "pxmdvalue_atom_val_idx" btree (value) WHERE datatypeid = 22 > "pxmdvalue_bigint_val_idx" btree ((value::bigint)) WHERE datatypeid > = 43 > "pxmdvalue_datatypeid_idx" btree (datatypeid) > "pxmdvalue_int_val_idx" btree ((value::integer)) WHERE datatypeid = 16 > "pxmdvalue_str32_val0_idx" btree (lower(value)) WHERE datatypeid = > 2 AND octet_length(value) < 2700 > "pxmdvalue_str32_val1_idx" btree (lower(value) text_pattern_ops) > WHERE datatypeid = 2 AND octet_length(value) < 2700 > "pxmdvalue_str_val0_idx" btree (lower(value)) WHERE datatypeid = 85 > AND octet_length(value) < 2700 > "pxmdvalue_str_val1_idx" btree (lower(value) text_pattern_ops) > WHERE datatypeid = 85 AND octet_length(value) < 2700 > "pxmdvalue_time_val_idx" btree (px_text2timestamp(value)) WHERE > datatypeid = 37 > > px=# explain analyse select * from pxmdvalue where datatypeid = 43 and > fieldid = 857 and cast(value as bigint) = '1009'; > > QUERY PLAN > -------------------------------------------------------------------------------------------------------------------------------------------------------- > Bitmap Heap Scan on pxmdvalue (cost=2143.34..2685.74 rows=1 > width=245) (actual time=144.411..144.415 rows=1 loops=1) > Recheck Cond: (((value)::bigint = 1009::bigint) AND (datatypeid = 43)) > Filter: (fieldid = 857) > -> BitmapAnd (cost=2143.34..2143.34 rows=138 width=0) (actual > time=144.394..144.394 rows=0 loops=1) > -> Bitmap Index Scan on pxmdvalue_bigint_val_idx > (cost=0.00..140.23 rows=1758 width=0) (actual time=0.021..0.021 rows=2 > loops=1) > Index Cond: ((value)::bigint = 1009::bigint) > -> Bitmap Index Scan on pxmdvalue_datatypeid_idx > (cost=0.00..2002.85 rows=351672 width=0) (actual time=144.127..144.127 > rows=346445 loops=1) > Index Cond: (datatypeid = 43) > Total runtime: 144.469 ms > (9 rows) > > px=# drop index pxmdvalue_datatypeid_idx; > DROP INDEX > px=# explain analyse select * from pxmdvalue where datatypeid = 43 and > fieldid = 857 and cast(value as bigint) = '1009'; > QUERY PLAN > ----------------------------------------------------------------------------------------------------------------------------------------- > Index Scan using pxmdvalue_bigint_val_idx on pxmdvalue > (cost=0.00..6635.06 rows=1 width=245) (actual time=0.018..0.022 rows=1 > loops=1) > Index Cond: ((value)::bigint = 1009::bigint) > Filter: (fieldid = 857) > Total runtime: 0.053 ms > (4 rows) > > > > Notice the two bitmap index scans in the first version of the query. The > one that hits the pxmdvalue_bigint_val_idx actually subsumes the work of > the second one, as it is a partial index on the same condition that the > second bitmap scan is checking. So that second bitmap scan is a complete > waste of time and effort, afaict. When I remove the > pxmdvalue_datatypeid_idx index, to prevent it using that second bitmap > scan, the resulting query is much faster, although its estimated cost is > rather higher. > > Any clues, anyone? Is this indeed a limitation of the query planner, in > that it doesn't realise that the partial index is all it needs here? Or > is something else going on that is leading the cost estimation astray? > > Tim > > -- > ----------------------------------------------- > Tim Allen tim@proximity.com.au > Proximity Pty Ltd http://www.proximity.com.au/ > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- 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 Mar 21 06:05:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 27D459DC9C8 for ; Tue, 21 Mar 2006 06:05: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 17524-09 for ; Tue, 21 Mar 2006 06:05:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 277319DC82D for ; Tue, 21 Mar 2006 06:05:17 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id AB07956427; Tue, 21 Mar 2006 04:05:19 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 04:05:18 -0600 Date: Tue, 21 Mar 2006 04:05:18 -0600 From: "Jim C. Nasby" To: Qingqing Zhou Cc: pgsql-performance@postgresql.org Subject: Re: data doesnt get saved in the database / idle in transaction Message-ID: <20060321100518.GA15742@pervasive.com> References: <130df1930603200246j4bd6c6a1r7204a644795ef412@mail.gmail.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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:zhouqq@cs.toronto.edu::Rc2MhsaczKyX6jFY:0000000000000000 0000000000000000000000008Kxt X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::iQojnyeIsfZpF8ZO:00000 0000000000000000000000002oqU X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/371 X-Sequence-Number: 17808 On Mon, Mar 20, 2006 at 08:03:14PM +0800, Qingqing Zhou wrote: > > ""Ksenia Marasanova"" wrote > > > > The application uses persistant database connection, and when i check > > the status of the connection, it shows: "idle in transaction". I am > > pretty sure that every insert is being committed with explicit > > "commit()" . It always worked before.... weird. > > > > Try to use the following command to see what commands reach the server: > > set log_statement = "all"; I'd bet that the commits aren't making it over. -- 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 Mar 21 06:08:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C11C99DCC40 for ; Tue, 21 Mar 2006 06:08: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 20830-06 for ; Tue, 21 Mar 2006 06:08:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id B1C399DCB0A for ; Tue, 21 Mar 2006 06:08:51 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 26FDC56437; Tue, 21 Mar 2006 04:08:54 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 04:08:53 -0600 Date: Tue, 21 Mar 2006 04:08:53 -0600 From: "Jim C. Nasby" To: Mark Kirkwood Cc: Scott Marlowe , Kenji Morishige , pgsql-performance@postgresql.org Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Message-ID: <20060321100852.GB15742@pervasive.com> References: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> <20060320144503.GR15742@pervasive.com> <1142871620.17883.4.camel@state.g2switchworks.com> <441F6BA1.20005@paradise.net.nz> <441F7847.5000406@paradise.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <441F7847.5000406@paradise.net.nz> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:markir@paradise.net.nz::hkRjnBV1KtdIsMbx:000000000000000 0000000000000000000000001OYe X-Hashcash: 1:20:060321:smarlowe@g2switchworks.com::xFKNAm2id7+y1AJo:00000000000 0000000000000000000000003PSC X-Hashcash: 1:20:060321:kenjim@juniper.net::wtWFjPFc2NIwlJho:0000000000000000000 0000000000000000000000004MDy X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::Swei1Teo8xuWxXx5:00000 00000000000000000000000047I/ X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/372 X-Sequence-Number: 17809 On Tue, Mar 21, 2006 at 03:51:35PM +1200, Mark Kirkwood wrote: > Mark Kirkwood wrote: > > > >I think Freebsd 'Inactive' corresponds pretty closely to Linux's > >'Inactive Dirty'|'Inactive Laundered'|'Inactive Free'. > > > > Hmmm - on second thoughts I think I've got that wrong :-(, since in > Linux all the file buffer pages appear in 'Cached' don't they... > > (I also notice that 'Inactive Laundered' does not seem to be mentioned > in vanilla - read non-Redhat - 2.6 kernels) > > So I think its more correct to say Freebsd 'Inactive' is similar to > Linux 'Inactive' + some|most of Linux 'Cached'. > > A good discussion of how the Freebsd vm works is here: > > http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/vm.html > > In particular: > > "FreeBSD reserves a limited amount of KVM to hold mappings from struct > bufs, but it should be made clear that this KVM is used solely to hold > mappings and does not limit the ability to cache data." It's worth noting that starting in either 2.4 or 2.6, linux pretty much adopted the FreeBSD VM system (or so I've been told). -- 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 Mar 21 06:13:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 571259DC84A for ; Tue, 21 Mar 2006 06:13: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 24272-05 for ; Tue, 21 Mar 2006 06:13:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id D15E29DC81D for ; Tue, 21 Mar 2006 06:13:12 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 21577A82F9; Tue, 21 Mar 2006 11:13:20 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 10313-05; Tue, 21 Mar 2006 11:13:18 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id B40A2A82B2; Tue, 21 Mar 2006 11:13:18 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 6E904183669; Tue, 21 Mar 2006 11:13:06 +0100 (CET) To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? References: <87ek11gz69.fsf@meuh.mnc.lan> <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> <87hd5tmt1z.fsf@meuh.mnc.lan> <20060321095700.GX15742@pervasive.com> X-Hashcash: 1:20:060321:jnasby@pervasive.com::NephfnUQY6UPWiWv:000000000000000000000000000000000000000003XZD X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::EUi0K4R5aN4gsqyR:000000000000000000000000000006qmL From: Guillaume Cottenceau Date: 21 Mar 2006 11:13:06 +0100 In-Reply-To: <20060321095700.GX15742@pervasive.com> Message-ID: <87irq8kswd.fsf@meuh.mnc.lan> Lines: 31 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: amavisd-new at mnc.ch 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: 200603/373 X-Sequence-Number: 17810 "Jim C. Nasby" writes: [...] > > My point is that the planner's cost estimate is way above the > > actual cost of the query, so the planner doesn't use the best > > plan. Even if the index returns so much rows, actual cost of the > > query is so that index scan (worst case, all disk cache flushed) > > is still better than seq scan but the planner uses seq scan. > > Yes. The cost estimator for an index scan supposedly does a linear > interpolation between a minimum cost and a maximum cost depending on the > correlation of the first field in the index. The problem is that while > the comment states it's a linear interpolation, the actual formula > squares the correlation before interpolating. This means that unless the > correlation is very high, you're going to get an unrealistically high > cost for an index scan. I have data that supports this at > http://stats.distributed.net/~decibel/, but I've never been able to get > around to testing a patch to see if it improves things. Interesting. It would be nice to investigate the arguments behind the choice you describe for the formula used to perform the interpolation. I have absolutely no knowledge on pg internals so this is rather new/fresh for me, I have no idea how smart that choice is (but based on my general feeling about pg, I'm suspecting this is actually smart but I am not smart enough to see why ;p). -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Tue Mar 21 06:23:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 92AC09DC81D for ; Tue, 21 Mar 2006 06:23: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 21551-10 for ; Tue, 21 Mar 2006 06:23:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D9A689DC84A for ; Tue, 21 Mar 2006 06:23:34 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id E10F256427; Tue, 21 Mar 2006 04:23:36 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 04:23:36 -0600 Date: Tue, 21 Mar 2006 04:23:36 -0600 From: "Jim C. Nasby" To: Alex Hayward Cc: Scott Marlowe , Kenji Morishige , pgsql-performance@postgresql.org Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Message-ID: <20060321102335.GC15742@pervasive.com> References: <20060317221116.GA14661@juniper.net> <1142636433.1141.33.camel@state.g2switchworks.com> <20060320144503.GR15742@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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:xelah-pgsql@xelah.com::F8HYDDCkIFHNygs1:0000000000000000 000000000000000000000000272/ X-Hashcash: 1:20:060321:smarlowe@g2switchworks.com::N2PN+7sVQD0GWOK9:00000000000 0000000000000000000000001t0H X-Hashcash: 1:20:060321:kenjim@juniper.net::fpl5Sv8tPjri6UxL:0000000000000000000 0000000000000000000000000PBe X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::x6qxTEepJ4r6eH43:00000 0000000000000000000000007UWc X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/374 X-Sequence-Number: 17811 On Mon, Mar 20, 2006 at 07:46:13PM +0000, Alex Hayward wrote: > On Mon, 20 Mar 2006, Jim C. Nasby wrote: > > > No, this is perfectly fine. Inactive memory in FreeBSD isn't the same as > > Free. It's the same as 'active' memory except that it's pages that > > haven't been accessed in X amount of time (between 100 and 200 ms, I > > think). When free memory starts getting low, FBSD will start moving > > pages from the inactive queue to the free queue (possibly resulting in > > writes to disk along the way). > > > > IIRC, Cache is the directory cache, and Buf is disk buffers, which is > > somewhat akin to shared_buffers in PostgreSQL. > > I don't believe that's true. I'm not an expert in FreeBSD's VM internals, > but this is how I believe it works: > > Active pages are pages currently mapped in to a process's address space. > > Inactive pages are pages which are marked dirty (must be written to > backing store before they can be freed) and which are not mapped in to a > process's address. They're still associated with a VM object of some kind Actually, a page that is in the inactive queue *may* be dirty. In fact, if you start with a freshly booted system (or one that's been recently starved of memory) and read in a large file, you'll see the inactive queue grow even though the pages haven't been dirtied. > - like part of a process's virtual address space or a as part of the cache > for a file on disk. If it's still part of a process's virtual address > space and is accessed a fault is generated. The page is then put back in > to the address mappings. > > Cached pages are like inactive pages but aren't dirty. Then can be either > re-mapped or freed immediately. > > Free pages are properly free. Wired pages are unswappable. Buf I'm not > sure about. It doesn't represent that amount of memory used to cache files > on disk, I'm sure of that. The sysctl -d description is 'KVA memory used > for bufs', so I suspect that it's the amount of kernel virtual address > space mapped to pages in the 'active', 'inactive' and 'cache' queues. > > -- > Alex Hayward > Seatbooker > > > ---------------------------(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 > -- 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 Mar 21 06:32:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B80199DD54F for ; Tue, 21 Mar 2006 06:32: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 25141-10 for ; Tue, 21 Mar 2006 06:32:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 70FA39DD54C for ; Tue, 21 Mar 2006 06:32:17 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id AE86756427; Tue, 21 Mar 2006 04:32:20 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 04:32:20 -0600 Date: Tue, 21 Mar 2006 04:32:19 -0600 From: "Jim C. Nasby" To: Vivek Khera Cc: Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec RAID 2200S Message-ID: <20060321103219.GD15742@pervasive.com> References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:vivek@khera.org::AYOpbj62Jo32N0iU:001rxk X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::llE8jcg1Dmcl40y/:00000 0000000000000000000000005yMC X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/375 X-Sequence-Number: 17812 On Mon, Mar 20, 2006 at 02:15:22PM -0500, Vivek Khera wrote: > I think FreeBSD has a hard upper limit on the total ram it will use > for disk cache. I haven't been able to get reliable, irrefutable, > answers about it, though. It does not. Any memory in the inactive queue is effectively your 'disk cache'. Pages start out in the active queue, and if they aren't used fairly frequently they will move into the inactive queue. From there they will be moved to the cache queue, but only if the cache queue falls below a certain threshold, because in order to go into the cache queue the page must be marked clean, possibly incurring a write to disk. AFAIK pages only go into the free queue if they have been completely released by all objects that were referencing them, so it's theoretically posisble for that queue to go to 0. -- 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 Mar 21 06:40:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 217719DC81D for ; Tue, 21 Mar 2006 06:40: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 34188-05 for ; Tue, 21 Mar 2006 06:40:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-5.paradise.net.nz (bm-5a.paradise.net.nz [203.96.152.184]) by postgresql.org (Postfix) with ESMTP id 96B889DC84A for ; Tue, 21 Mar 2006 06:40:46 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-5.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IWH006BM4C0DK@linda-5.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 21 Mar 2006 22:40:48 +1200 (NZST) Received: from [192.168.1.11] (218-101-28-245.dsl.clear.net.nz [218.101.28.245]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id D068816A6C50; Tue, 21 Mar 2006 22:40:47 +1200 (NZST) Date: Tue, 21 Mar 2006 22:40:45 +1200 From: Mark Kirkwood Subject: Re: planner with index scan cost way off actual cost, In-reply-to: <20060321095049.GW15742@pervasive.com> To: "Jim C. Nasby" Cc: Guillaume Cottenceau , pgsql-performance@postgresql.org Message-id: <441FD82D.1040509@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: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> <20060321095049.GW15742@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.172 required=5 tests=[AWL=0.172] X-Spam-Score: 0.172 X-Spam-Level: X-Archive-Number: 200603/376 X-Sequence-Number: 17813 Jim C. Nasby wrote: > On Mon, Mar 20, 2006 at 09:35:14AM +0100, Guillaume Cottenceau wrote: > >>>shared_buffer = 12000 >>>effective_cache_size = 25000 >>> >>>This would mean you are reserving 100M for Postgres to cache relation >>>pages, and informing the planner that it can expect ~200M available >>>from the disk buffer cache. To give a better recommendation, we need >> >>Ok, thanks. I wanted to investigate this field, but as the >>application is multithreaded and uses a lot of postgres clients, >>I wanted to make sure the shared_buffers values is globally for >>postgres, not just per (TCP) connection to postgres, before >>increasing the value, fearing to take the whole server down. > > > shared_buffer is for the entire 'cluster', not per-connection or > per-database. > > Also, effective_cache_size of 25000 on a 1G machine seems pretty > conservative to me. I'd set it to at least 512MB, if not closer to > 800MB. I was going to recommend higher - but not knowing what else was running, kept it to quite conservative :-)... and given he's running java, the JVM could easily eat 512M all by itself! Cheers Mark From pgsql-performance-owner@postgresql.org Tue Mar 21 06:55:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B27119DD2E7 for ; Tue, 21 Mar 2006 06:55: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 38038-07 for ; Tue, 21 Mar 2006 06:55:32 -0400 (AST) X-Greylist: delayed 02:14:45.38211 by SQLgrey- Received: from mail.rp-online.de (mail.rp-online.de [149.221.1.199]) by postgresql.org (Postfix) with ESMTP id EE5119DCE58 for ; Tue, 21 Mar 2006 06:55:27 -0400 (AST) Received: from idefix.d.rp-online.de (idefix.d.rp-online.de [149.221.100.194]) by mail.rp-online.de (Postfix) with ESMTP id 25E741FB64 for ; Tue, 21 Mar 2006 11:55:30 +0100 (CET) From: Thomas Pundt Reply-To: Thomas Pundt Organization: RP Online Verlagsgesellschaft mbH To: pgsql-performance@postgresql.org Subject: Re: Query Feromance Date: Tue, 21 Mar 2006 11:58:43 +0100 User-Agent: KMail/1.9.1 References: <441EC34D.1000901@bluestudio.it> <200603210943.57454.mlists@rp-online.de> <441FCDD2.8010905@bluestudio.it> In-Reply-To: <441FCDD2.8010905@bluestudio.it> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603211158.43887.mlists@rp-online.de> X-Anti-Virus: Kaspersky Anti-Virus for MailServers 5.5.3/RELEASE, bases: 21032006 #172113, status: clean 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: 200603/377 X-Sequence-Number: 17814 Hi, On Tuesday 21 March 2006 10:56, Marco Furetto wrote: | ok, I enable query duration logging in postgresql.conf. | | where is the instruments for analyze the statistics queries executing on | my =A0db? | | Eg.: Number of query executing, total time for executing a single query, | etc... I don't know if there are tools or settings available for PostgreSQL that do such number-of-query-accounting; but you can set the=20 log_min_duration_statement value to 0 to log all statements with their duration. See http://www.postgresql.org/docs/8.1/interactive/runtime-config.html for more options on runtime configuration, especially 17.7 and 17.8 might be of interest for you. Ciao, Thomas =2D-=20 Thomas Pundt ---- http://rp-online.de/ ---- From pgsql-performance-owner@postgresql.org Tue Mar 21 07:03:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7F6A29DC82D for ; Tue, 21 Mar 2006 07:03: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 42283-02 for ; Tue, 21 Mar 2006 07:03:31 -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 6CE379DC885 for ; Tue, 21 Mar 2006 07:03:27 -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 <0IWH00G395DT9R@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 21 Mar 2006 23:03:29 +1200 (NZST) Received: from [192.168.1.11] (218-101-28-245.dsl.clear.net.nz [218.101.28.245]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id B08E14D87E8; Tue, 21 Mar 2006 23:03:28 +1200 (NZST) Date: Tue, 21 Mar 2006 23:03:26 +1200 From: Mark Kirkwood Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec In-reply-to: <20060321103219.GD15742@pervasive.com> To: "Jim C. Nasby" Cc: Vivek Khera , Postgresql Performance Message-id: <441FDD7E.7050106@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: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <20060321103219.GD15742@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.172 required=5 tests=[AWL=0.172] X-Spam-Score: 0.172 X-Spam-Level: X-Archive-Number: 200603/378 X-Sequence-Number: 17815 Jim C. Nasby wrote: > On Mon, Mar 20, 2006 at 02:15:22PM -0500, Vivek Khera wrote: > >>I think FreeBSD has a hard upper limit on the total ram it will use >>for disk cache. I haven't been able to get reliable, irrefutable, >>answers about it, though. > > > It does not. Any memory in the inactive queue is effectively your 'disk > cache'. Pages start out in the active queue, and if they aren't used > fairly frequently they will move into the inactive queue. From there > they will be moved to the cache queue, but only if the cache queue falls > below a certain threshold, because in order to go into the cache queue > the page must be marked clean, possibly incurring a write to disk. AFAIK > pages only go into the free queue if they have been completely released > by all objects that were referencing them, so it's theoretically > posisble for that queue to go to 0. Exactly. The so-called limit (controllable via various sysctl's) is on the amount of memory used for kvm mapped pages, not cached pages, i.e - its a subset of the cached pages that are set up for immediate access (the others require merely to be shifted from the 'Inactive' queue to this one before they can be operated on - a relatively cheap operation). So its really all about accounting, in a sense - whether pages end up in the 'Buf' or 'Inactive' queue, they are still cached! Cheers Mark From pgsql-performance-owner@postgresql.org Tue Mar 21 07:23:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D599B9DC8DB for ; Tue, 21 Mar 2006 07: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 46371-03 for ; Tue, 21 Mar 2006 07:23:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 8043D9DC885 for ; Tue, 21 Mar 2006 07:23:47 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 33F9056427; Tue, 21 Mar 2006 05:23:50 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:23:49 -0600 Date: Tue, 21 Mar 2006 05:23:48 -0600 From: "Jim C. Nasby" To: Jaime Casanova Cc: "Craig A. James" , pgsql-performance@postgresql.org Subject: Re: update == delete + insert? Message-ID: <20060321112348.GE15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> <441F3187.90506@modgraph-usa.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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:systemguards@gmail.com::RY+b8N/vogzLOYKN:000000000000000 0000000000000000000000001S5U X-Hashcash: 1:20:060321:cjames@modgraph-usa.com::wpOll18hgTx/P36r:00000000000000 0000000000000000000000002fEF X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::vQhv1zce3tNkOt8d:00000 000000000000000000000000ApSh X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/379 X-Sequence-Number: 17816 On Mon, Mar 20, 2006 at 08:38:15PM -0500, Jaime Casanova wrote: > On 3/20/06, Craig A. James wrote: > > Design 1: > > create table a ( > > id integer, > > frequently_updated integer); > > > > create table b( > > id integer, > > infrequently_updated_1 integer, > > infrequently_updated_2 integer, > > infrequently_updated_3 integer, > > ... etc. > > infrequently_updated_99 integer); > > > > Design 2: > > create table c( > > id integer, > > frequently_updated integer, > > infrequently_updated_1 integer, > > infrequently_updated_2 integer, > > infrequently_updated_3 integer, > > ... etc. > > infrequently_updated_99 integer); > design 1 is normalized and better > design 2 is denormalized and a bad approach no matter the RDBMS How is design 1 denormalized? > "What they (MySQL) lose in usability, they gain back in benchmarks, and that's > all that matters: getting the wrong answer really fast." > Randal L. Schwartz Where's that quote from? -- 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 Mar 21 07:28:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 34F4B9DC9BD for ; Tue, 21 Mar 2006 07: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 45004-09 for ; Tue, 21 Mar 2006 07:28:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C05719DC885 for ; Tue, 21 Mar 2006 07:27:57 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 6ECB256435; Tue, 21 Mar 2006 05:28:00 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:27:59 -0600 Date: Tue, 21 Mar 2006 05:27:59 -0600 From: "Jim C. Nasby" To: Csaba Nagy Cc: Mikael Carneholm , postgres performance list Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321112759.GF15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1142867952.16487.96.camel@coppola.muc.ecircle.de> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:nagy@ecircle-ag.com::mlcKikM/Cd4WzxZH:000000000000000000 0000000000000000000000002EO3 X-Hashcash: 1:20:060321:mikael.carneholm@wirelesscar.com::aRgVRYp2lC+9FUzm:00000 0000000000000000000000002sD2 X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::KDSYZ3di9BlCO5YX:00000 0000000000000000000000005bxU X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/380 X-Sequence-Number: 17817 On Mon, Mar 20, 2006 at 04:19:12PM +0100, Csaba Nagy wrote: > What I can add from our experience: ext3 turned out lousy for our > application, and converting to XFS made a quite big improvement for our > DB load. I don't have hard figures, but I think it was some 30% > improvement in overall speed, and it had a huge improvement for heavy > load times... what I mean is that with ext3 we had multiple parallel big > tasks executing in more time than if we would have executed them > sequentially, and with XFS that was gone, load scales linearly. In any > case you should test the performance of your application on different FS > and different settings, as this could make a huge difference. Did you try mounting ext3 whith data=writeback by chance? People have found that makes a big difference in performance. http://archives.postgresql.org/pgsql-performance/2003-01/msg00320.php -- 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 Mar 21 07:35:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BA76A9DC9B2 for ; Tue, 21 Mar 2006 07:35: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 49991-01 for ; Tue, 21 Mar 2006 07:35:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 589959DC8DE for ; Tue, 21 Mar 2006 07:35:04 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 28A4B56435; Tue, 21 Mar 2006 05:35:07 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:35:06 -0600 Date: Tue, 21 Mar 2006 05:35:06 -0600 From: "Jim C. Nasby" To: Orion Henry Cc: pgsql-performance@postgresql.org Subject: Re: Auto performance tuning? Message-ID: <20060321113506.GG15742@pervasive.com> References: <441EFEA2.70207@orangekids.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <441EFEA2.70207@orangekids.org> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:lab@orangekids.org::aZkbwajK/Og43GB+:0000000000000000000 0000000000000000000000003/FA X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::sgu4hS+9ZmQPKEDX:00000 0000000000000000000000003IHR X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/381 X-Sequence-Number: 17818 On Mon, Mar 20, 2006 at 11:12:34AM -0800, Orion Henry wrote: > > I have to say I've been really impressed with the quality and diversity > of tools here to increase performance for PostgreSQL. But I keep seeing > a lot of the same basic things repeated again and again. Has anyone > looked into a "smart" or auto-adjusting resource manager for postgres? > > Consider for instance you set it to aggressively use system resources, > then it would do things like notice that it needs more work mem after > profiling a few thousand queries and adds it for you, or that a specific > index or table should be moved to a different spindle and does it in the > background, or that query plans keep screwing up on a particular table > so it knows to up the amount of stastics it keeps on that table. > > Is this a crazy idea or something someone's already working on? Feel free to submit a patch. :) Seriously, the issue here is that everyone who donates code for PostgreSQL already knows how to tune it, so they're unlikely to come up with a tool to do it for them (which is much harder than you might think). There is the configurator project on pgFoundry, which is a start in the right direction. Perhaps at some point a commercial entity might come out with some kind of automatic tuning tool as well. But I doubt you'll see anything come out of the core developers. Also, note that you could probably write such a tool without embedding it into the backend, so don't let that scare you off. :) -- 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 Mar 21 07:38:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3C3D69DC981 for ; Tue, 21 Mar 2006 07:38: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 48190-09 for ; Tue, 21 Mar 2006 07:38:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C4DDF9DC97D for ; Tue, 21 Mar 2006 07:38:10 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 7BEEC5643D; Tue, 21 Mar 2006 05:38:13 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:38:13 -0600 Date: Tue, 21 Mar 2006 05:38:13 -0600 From: "Jim C. Nasby" To: Amit Soni Cc: pgsql-performance@postgresql.org Subject: Re: Perfomance test figures Message-ID: <20060321113812.GH15742@pervasive.com> References: <20060321055954.85302.qmail@web507.biz.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060321055954.85302.qmail@web507.biz.mail.mud.yahoo.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:amit@datumglobal.com::dMDDsSjpnFiipN+n:00000000000000000 0000000000000000000000001VmW X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::OGJmBQ/dE+6mFa2d:00000 0000000000000000000000001hjb X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/382 X-Sequence-Number: 17819 On Mon, Mar 20, 2006 at 09:59:54PM -0800, Amit Soni wrote: > Hi All, > > I want to compare performance of postgresql database with some other database. > > Somebody must have done some performance testing. > > Can you pls. share that data (performance figures) with me? And if possible pls. share procedure also, that how you have done the same? Sadly, there's very little in the way of meaningful benchmarks, especially ones that aren't ancient. A SQLite user recently did some testing, but his workload was a single-user case, something that SQLite is ideally suited for (and not very interesting for anything in the enterprise world). I've been wanting to do a PostgreSQL vs MySQL head-to-head using DBT2 for some time. I even have hardware to do it on. What I haven't been able to find is the time. If this is something you'd be interested in helping with, please let me know. Depending on how much work you wanted to do there could be money in it as well (Pervasive would pay for a performance comparison whitepaper). -- 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 Mar 21 07:47:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 25A5D9DC981 for ; Tue, 21 Mar 2006 07:47: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 50606-05 for ; Tue, 21 Mar 2006 07:47:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C3E219DC8DB for ; Tue, 21 Mar 2006 07:47:11 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id AF57B56427; Tue, 21 Mar 2006 05:46:59 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:46:59 -0600 Date: Tue, 21 Mar 2006 05:46:59 -0600 From: "Jim C. Nasby" To: Mark Kirkwood Cc: Vivek Khera , Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec Message-ID: <20060321114658.GK15742@pervasive.com> References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <20060321103219.GD15742@pervasive.com> <441FDD7E.7050106@paradise.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <441FDD7E.7050106@paradise.net.nz> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:markir@paradise.net.nz::Ly3fCyZqwFYrWQZs:000000000000000 0000000000000000000000001Svw X-Hashcash: 1:20:060321:vivek@khera.org::ZFM8/m4bc2PzxPMO:001ngT X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::9rQQoby8A23oc+oR:00000 0000000000000000000000004vkx X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/383 X-Sequence-Number: 17820 On Tue, Mar 21, 2006 at 11:03:26PM +1200, Mark Kirkwood wrote: > Jim C. Nasby wrote: > >On Mon, Mar 20, 2006 at 02:15:22PM -0500, Vivek Khera wrote: > > > >>I think FreeBSD has a hard upper limit on the total ram it will use > >>for disk cache. I haven't been able to get reliable, irrefutable, > >>answers about it, though. > > > > > >It does not. Any memory in the inactive queue is effectively your 'disk > >cache'. Pages start out in the active queue, and if they aren't used > >fairly frequently they will move into the inactive queue. From there > >they will be moved to the cache queue, but only if the cache queue falls > >below a certain threshold, because in order to go into the cache queue > >the page must be marked clean, possibly incurring a write to disk. AFAIK > >pages only go into the free queue if they have been completely released > >by all objects that were referencing them, so it's theoretically > >posisble for that queue to go to 0. > > Exactly. > > The so-called limit (controllable via various sysctl's) is on the amount > of memory used for kvm mapped pages, not cached pages, i.e - its a > subset of the cached pages that are set up for immediate access (the > others require merely to be shifted from the 'Inactive' queue to this > one before they can be operated on - a relatively cheap operation). > > So its really all about accounting, in a sense - whether pages end up in > the 'Buf' or 'Inactive' queue, they are still cached! So what's the difference between Buf and Active then? Just that active means it's a code page, or that it's been directly mapped into a processes memory (perhaps via mmap)? -- 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 Mar 21 07:49:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 450769DD539 for ; Tue, 21 Mar 2006 07:49: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 50573-08 for ; Tue, 21 Mar 2006 07:49:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id BE4449DCA0F for ; Tue, 21 Mar 2006 07:49:34 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 2E01F56435; Tue, 21 Mar 2006 05:49:38 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:49:37 -0600 Date: Tue, 21 Mar 2006 05:49:37 -0600 From: "Jim C. Nasby" To: Luke Lonergan Cc: Miguel , Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Message-ID: <20060321114937.GL15742@pervasive.com> References: <441F1AC5.9050700@123.com.sv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:llonergan@greenplum.com::7pKSiwCan+EIwOk1:00000000000000 0000000000000000000000000o6p X-Hashcash: 1:20:060321:mmiranda@123.com.sv::fGm02UXCh5HOpl/z:000000000000000000 0000000000000000000000004Ag+ X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::4ca0aMTtdlufSnhF:00000 0000000000000000000000002iQG X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/384 X-Sequence-Number: 17821 On Mon, Mar 20, 2006 at 01:27:56PM -0800, Luke Lonergan wrote: > >> Transfer rates: > >> outside: 102400 kbytes in 2.075984 sec = 49326 kbytes/sec > >> middle: 102400 kbytes in 2.100510 sec = 48750 kbytes/sec > >> inside: 102400 kbytes in 2.042313 sec = 50139 kbytes/sec > >> > > I have 6 ultra a320 72G 10k discs > > Yah - ouch. With 6 drives in a RAID10, you should expect 3 drives worth of > sequential scan performance, or anywhere from 100MB/s to 180MB/s. You're > getting from half to 1/3 of the performance you'd get with a decent raid > controller. > > If you add a simple SCSI adapter like the common LSI U320 adapter to your > DL380G3 and then run software RAID, you will get more than 150MB/s with less > CPU consumption. I'd also expect you'd get down to about 2ms access times. FWIW, here's my dirt-simple workstation, with 2 segate SATA drives setup as a mirror using software (first the mirror, then one of the raw drives): decibel@noel.2[5:43]~:15>sudo diskinfo -vt /dev/mirror/gm0 Password: /dev/mirror/gm0 512 # sectorsize 300069051904 # mediasize in bytes (279G) 586072367 # mediasize in sectors Seek times: Full stroke: 250 iter in 1.416409 sec = 5.666 msec Half stroke: 250 iter in 1.404503 sec = 5.618 msec Quarter stroke: 500 iter in 2.887344 sec = 5.775 msec Short forward: 400 iter in 2.101949 sec = 5.255 msec Short backward: 400 iter in 2.373578 sec = 5.934 msec Seq outer: 2048 iter in 0.209539 sec = 0.102 msec Seq inner: 2048 iter in 0.347499 sec = 0.170 msec Transfer rates: outside: 102400 kbytes in 3.183924 sec = 32162 kbytes/sec middle: 102400 kbytes in 3.216232 sec = 31838 kbytes/sec inside: 102400 kbytes in 4.242779 sec = 24135 kbytes/sec decibel@noel.2[5:43]~:16>sudo diskinfo -vt /dev/ad4 /dev/ad4 512 # sectorsize 300069052416 # mediasize in bytes (279G) 586072368 # mediasize in sectors 581421 # Cylinders according to firmware. 16 # Heads according to firmware. 63 # Sectors according to firmware. Seek times: Full stroke: 250 iter in 5.835744 sec = 23.343 msec Half stroke: 250 iter in 4.364424 sec = 17.458 msec Quarter stroke: 500 iter in 6.981597 sec = 13.963 msec Short forward: 400 iter in 2.157210 sec = 5.393 msec Short backward: 400 iter in 2.330445 sec = 5.826 msec Seq outer: 2048 iter in 0.181176 sec = 0.088 msec Seq inner: 2048 iter in 0.198974 sec = 0.097 msec Transfer rates: outside: 102400 kbytes in 1.715810 sec = 59680 kbytes/sec middle: 102400 kbytes in 1.937027 sec = 52865 kbytes/sec inside: 102400 kbytes in 3.260515 sec = 31406 kbytes/sec No, I don't know why the transfer rates for the mirror are 1/2 that as the raw device. :( -- 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 Mar 21 07:51:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D1CDD9DD559 for ; Tue, 21 Mar 2006 07:51: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 49664-09 for ; Tue, 21 Mar 2006 07:51:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C05F99DD539 for ; Tue, 21 Mar 2006 07:50:58 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 3F11456437; Tue, 21 Mar 2006 05:51:02 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:51:00 -0600 Date: Tue, 21 Mar 2006 05:51:00 -0600 From: "Jim C. Nasby" To: Mark Kirkwood Cc: Guillaume Cottenceau , pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, Message-ID: <20060321115100.GM15742@pervasive.com> References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> <20060321095049.GW15742@pervasive.com> <441FD82D.1040509@paradise.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <441FD82D.1040509@paradise.net.nz> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:markir@paradise.net.nz::7M3/UAurfC0X3y38:000000000000000 0000000000000000000000002hmR X-Hashcash: 1:20:060321:gc@mnc.ch::S9RL2kSjbrtSKuIB:00000000Bvsa X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::iCmzYCLuLi9kby+d:00000 0000000000000000000000002ZpP X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/385 X-Sequence-Number: 17822 On Tue, Mar 21, 2006 at 10:40:45PM +1200, Mark Kirkwood wrote: > I was going to recommend higher - but not knowing what else was running, > kept it to quite conservative :-)... and given he's running java, the > JVM could easily eat 512M all by itself! Oh, didn't pick up on java being in the mix. Yeah, it can be a real pig. I think people often place too much emphasis on having a seperate application server, but in the case of java you often have no choice. -- 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 Mar 21 07:52:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 52AC19DD20F for ; Tue, 21 Mar 2006 07:52: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 54369-01 for ; Tue, 21 Mar 2006 07:52:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by postgresql.org (Postfix) with ESMTP id 9F8C89DCC08 for ; Tue, 21 Mar 2006 07:52:43 -0400 (AST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by mail.ecircle.de (READY) with ESMTP id A366955C024; Tue, 21 Mar 2006 12:52:46 +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, 21 Mar 2006 12:52:46 +0100 Subject: Re: Migration study, step 1: bulk write performance From: Csaba Nagy To: "Jim C. Nasby" Cc: Mikael Carneholm , postgres performance list In-Reply-To: <20060321112759.GF15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> Content-Type: text/plain Message-Id: <1142941966.23597.4.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 21 Mar 2006 12:52:46 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 21 Mar 2006 11:52:46.0570 (UTC) FILETIME=[F86834A0:01C64CDD] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/386 X-Sequence-Number: 17823 > Did you try mounting ext3 whith data=writeback by chance? People have > found that makes a big difference in performance. I'm not sure, there's other people here doing the OS stuff - I'm pretty much ignorant about what "data=writeback" could mean :-D They knew however that for the data partitions no FS journaling is needed, and for the WAL partition meta data journaling is enough, so I guess they tuned ext3 for this. Cheers, Csaba. From pgsql-performance-owner@postgresql.org Tue Mar 21 07:55:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 308189DC885 for ; Tue, 21 Mar 2006 07:55: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 53250-08 for ; Tue, 21 Mar 2006 07:55:43 -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 BED5E9DC8DB for ; Tue, 21 Mar 2006 07:55:38 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FLfSc-0001MX-Rf; Tue, 21 Mar 2006 12:55:39 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FLfTG-0003MF-00; Tue, 21 Mar 2006 12:56:18 +0100 Date: Tue, 21 Mar 2006 12:56:18 +0100 From: "Steinar H. Gunderson" To: Csaba Nagy Cc: Mikael Carneholm , postgres performance list Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321115618.GA12880@uio.no> Mail-Followup-To: Csaba Nagy , Mikael Carneholm , postgres performance list References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1142941966.23597.4.camel@coppola.muc.ecircle.de> 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+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.085 required=5 tests=[AWL=0.085] X-Spam-Score: 0.085 X-Spam-Level: X-Archive-Number: 200603/387 X-Sequence-Number: 17824 On Tue, Mar 21, 2006 at 12:52:46PM +0100, Csaba Nagy wrote: > They knew however that for the data partitions no FS journaling is > needed, and for the WAL partition meta data journaling is enough, so I > guess they tuned ext3 for this. For the record, that's the wrong way round. For the data partitioning metadata journaling is enough, and for the WAL partition you don't need any FS journaling at all. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Mar 21 07:58:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 357A39DCA0F for ; Tue, 21 Mar 2006 07:58: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 55096-02 for ; Tue, 21 Mar 2006 07:58:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id BFA529DC885 for ; Tue, 21 Mar 2006 07:58:32 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 1AE795643A; Tue, 21 Mar 2006 05:58:36 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 05:58:35 -0600 Date: Tue, 21 Mar 2006 05:58:35 -0600 From: "Jim C. Nasby" To: Guillaume Cottenceau Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? Message-ID: <20060321115835.GN15742@pervasive.com> References: <87ek11gz69.fsf@meuh.mnc.lan> <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> <87hd5tmt1z.fsf@meuh.mnc.lan> <20060321095700.GX15742@pervasive.com> <87irq8kswd.fsf@meuh.mnc.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87irq8kswd.fsf@meuh.mnc.lan> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:gc@mnc.ch::eSDO4gFO99xSDSbV:000000001gMv X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::bke6OE+D5l2/obyh:00000 0000000000000000000000003lK0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/388 X-Sequence-Number: 17825 On Tue, Mar 21, 2006 at 11:13:06AM +0100, Guillaume Cottenceau wrote: > "Jim C. Nasby" writes: > > [...] > > > > My point is that the planner's cost estimate is way above the > > > actual cost of the query, so the planner doesn't use the best > > > plan. Even if the index returns so much rows, actual cost of the > > > query is so that index scan (worst case, all disk cache flushed) > > > is still better than seq scan but the planner uses seq scan. > > > > Yes. The cost estimator for an index scan supposedly does a linear > > interpolation between a minimum cost and a maximum cost depending on the > > correlation of the first field in the index. The problem is that while > > the comment states it's a linear interpolation, the actual formula > > squares the correlation before interpolating. This means that unless the > > correlation is very high, you're going to get an unrealistically high > > cost for an index scan. I have data that supports this at > > http://stats.distributed.net/~decibel/, but I've never been able to get > > around to testing a patch to see if it improves things. > > Interesting. > > It would be nice to investigate the arguments behind the choice > you describe for the formula used to perform the interpolation. I > have absolutely no knowledge on pg internals so this is rather > new/fresh for me, I have no idea how smart that choice is (but > based on my general feeling about pg, I'm suspecting this is > actually smart but I am not smart enough to see why ;p). If you feel like running some tests, you need to change run_cost += max_IO_cost + csquared * (min_IO_cost - max_IO_cost); in src/backend/optimizer/path/costsize.c to something like run_cost += max_IO_cost + abs(indexCorrelation) * (min_IO_cost - max_IO_cost); That might not produce a perfect cost estimate, but I'll wager that it will be substantially better than what's in there now. FYI, see also http://archives.postgresql.org/pgsql-performance/2005-04/msg00669.php -- 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 Mar 21 07:59:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 72FD69DD56C for ; Tue, 21 Mar 2006 07:59: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 53207-08 for ; Tue, 21 Mar 2006 07:59:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by postgresql.org (Postfix) with ESMTP id 55C0A9DD559 for ; Tue, 21 Mar 2006 07:59:10 -0400 (AST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by mail.ecircle.de (READY) with ESMTP id 4B90955C017; Tue, 21 Mar 2006 12:59:13 +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, 21 Mar 2006 12:59:13 +0100 Subject: Re: Migration study, step 1: bulk write performance From: Csaba Nagy To: "Steinar H. Gunderson" Cc: Mikael Carneholm , postgres performance list In-Reply-To: <20060321115618.GA12880@uio.no> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> <20060321115618.GA12880@uio.no> Content-Type: text/plain Message-Id: <1142942352.23597.8.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 21 Mar 2006 12:59:13 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 21 Mar 2006 11:59:13.0210 (UTC) FILETIME=[DEDCC9A0:01C64CDE] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/389 X-Sequence-Number: 17826 > For the record, that's the wrong way round. For the data partitioning > metadata journaling is enough, and for the WAL partition you don't need any > FS journaling at all. Yes, you're right: the data partition shouldn't loose file creation, deletion, etc., which is not important for the WAL partition where the WAL files are mostly recycled... right ? Cheers, Csaba. From pgsql-performance-owner@postgresql.org Tue Mar 21 08:01:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7A4189DC9B2 for ; Tue, 21 Mar 2006 08:01: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 54415-07 for ; Tue, 21 Mar 2006 08:02:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 044539DC885 for ; Tue, 21 Mar 2006 08:01:55 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 7AD4556435; Tue, 21 Mar 2006 06:01:59 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 06:01:58 -0600 Date: Tue, 21 Mar 2006 06:01:58 -0600 From: "Jim C. Nasby" To: Csaba Nagy , Mikael Carneholm , postgres performance list Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321120158.GO15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> <20060321115618.GA12880@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060321115618.GA12880@uio.no> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:nagy@ecircle-ag.com::TyYLunnBZCV4AmHW:000000000000000000 0000000000000000000000001Bqx X-Hashcash: 1:20:060321:mikael.carneholm@wirelesscar.com::r8zN8+oLN72AiQQO:00000 0000000000000000000000002MwL X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::pMH1afqDAqA6YuxV:00000 0000000000000000000000002Y7u X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/390 X-Sequence-Number: 17827 On Tue, Mar 21, 2006 at 12:56:18PM +0100, Steinar H. Gunderson wrote: > On Tue, Mar 21, 2006 at 12:52:46PM +0100, Csaba Nagy wrote: > > They knew however that for the data partitions no FS journaling is > > needed, and for the WAL partition meta data journaling is enough, so I > > guess they tuned ext3 for this. > > For the record, that's the wrong way round. For the data partitioning > metadata journaling is enough, and for the WAL partition you don't need any > FS journaling at all. Are you sure? Metadate changes are probably a lot more common on the WAL partition. In any case, I don't see why there should be a difference. The real issue is: is related filesystem metadata sync'd as part of a file being fsync'd? -- 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 Mar 21 08:09:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D90CB9DC80D for ; Tue, 21 Mar 2006 08:09: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 55239-09 for ; Tue, 21 Mar 2006 08:09:55 -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 C94779DC82D for ; Tue, 21 Mar 2006 08:09:50 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FLfgP-0002BO-9l; Tue, 21 Mar 2006 13:09:53 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FLfh2-0003Oq-00; Tue, 21 Mar 2006 13:10:32 +0100 Date: Tue, 21 Mar 2006 13:10:32 +0100 From: "Steinar H. Gunderson" To: Csaba Nagy , Mikael Carneholm , postgres performance list Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321121032.GB12963@uio.no> Mail-Followup-To: Csaba Nagy , Mikael Carneholm , postgres performance list References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> <20060321115618.GA12880@uio.no> <20060321120158.GO15742@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20060321120158.GO15742@pervasive.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+cvs20060126 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: 200603/391 X-Sequence-Number: 17828 On Tue, Mar 21, 2006 at 06:01:58AM -0600, Jim C. Nasby wrote: > Are you sure? Metadate changes are probably a lot more common on the WAL > partition. In any case, I don't see why there should be a difference. > The real issue is: is related filesystem metadata sync'd as part of a > file being fsync'd? I've been told on this list that PostgreSQL actually takes care to fill a new WAL file with zeroes etc. when initializing it; dig a few months back and I'm sure it's there. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Mar 21 08:18:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9A1969DD569 for ; Tue, 21 Mar 2006 08:18: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 58949-02 for ; Tue, 21 Mar 2006 08:18:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 5901A9DD559 for ; Tue, 21 Mar 2006 08:18:37 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id C854F56437; Tue, 21 Mar 2006 06:18:40 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 06:18:39 -0600 Date: Tue, 21 Mar 2006 06:18:39 -0600 From: "Jim C. Nasby" To: Csaba Nagy , Mikael Carneholm , postgres performance list Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321121839.GT15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> <20060321115618.GA12880@uio.no> <20060321120158.GO15742@pervasive.com> <20060321121032.GB12963@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060321121032.GB12963@uio.no> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:nagy@ecircle-ag.com::EpKX+cr0cwy6oHBt:000000000000000000 0000000000000000000000003w8C X-Hashcash: 1:20:060321:mikael.carneholm@wirelesscar.com::ehMro9h5eKvjMJiT:00000 0000000000000000000000000W4j X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::QBoqdRZvOOrDHn5Q:00000 0000000000000000000000007705 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/392 X-Sequence-Number: 17829 On Tue, Mar 21, 2006 at 01:10:32PM +0100, Steinar H. Gunderson wrote: > On Tue, Mar 21, 2006 at 06:01:58AM -0600, Jim C. Nasby wrote: > > Are you sure? Metadate changes are probably a lot more common on the WAL > > partition. In any case, I don't see why there should be a difference. > > The real issue is: is related filesystem metadata sync'd as part of a > > file being fsync'd? > > I've been told on this list that PostgreSQL actually takes care to fill a new > WAL file with zeroes etc. when initializing it; dig a few months back and I'm > sure it's there. That's fine and all, but does no good if the filesystem doesn't know that the file exists on a crash. The same concern is also true on the data partition, although it's less likely to be a problem because if you happen to crash soon after a DDL operation it's likely that you haven't had a checkpoint yet, so the operation will likely be repeated during WAL replay. But depending on that is a race condition. Basically, you need to know for certain that if PostgreSQL creates a file and then fsync's it that that file is safely on disk, and that the filesystem knows how to find it (ie: the metadata is also on disk in some fashion). -- 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 Mar 21 08:22:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3BF659DC999 for ; Tue, 21 Mar 2006 08:22: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 59368-01 for ; Tue, 21 Mar 2006 08:22:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C84969DC885 for ; Tue, 21 Mar 2006 08:22:08 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 9A56056427; Tue, 21 Mar 2006 06:22:11 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 06:22:11 -0600 Date: Tue, 21 Mar 2006 06:22:11 -0600 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: WAL logging of SELECT ... INTO command Message-ID: <20060321122211.GU15742@pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::L4pn30mZkw2t6YIa:00000 0000000000000000000000000Nvw X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/393 X-Sequence-Number: 17830 Currently, it appears that SELECT * INTO new_table FROM old_table logs each page as it's written to WAL. Is this actually needed? Couldn't the database simply log that the SELECT ... INTO statement was executed instead? Doing so would likely result in a large performance improvement in most installs. Is there no provision for writing anything but data page changes (or whole pages) to WAL? -- 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 Mar 21 08:22:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 94AB39DC82D for ; Tue, 21 Mar 2006 08:22: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 57234-10 for ; Tue, 21 Mar 2006 08:22:37 -0400 (AST) X-Greylist: delayed 16:35:59.351377 by SQLgrey- Received: from wumpus.mythic-beasts.com (wumpus.mythic-beasts.com [212.69.37.9]) by postgresql.org (Postfix) with ESMTP id 46CFA9DC80D for ; Tue, 21 Mar 2006 08:22:32 -0400 (AST) Received: from sphinx.mythic-beasts.com ([212.69.37.6]) by wumpus.mythic-beasts.com with esmtp (Exim 4.44) id 1FLfsf-0007l5-Cr; Tue, 21 Mar 2006 12:22:33 +0000 Received: from xelah (helo=localhost) by sphinx.mythic-beasts.com with local-esmtp (Exim 4.51) id 1FLfse-0004gO-08; Tue, 21 Mar 2006 12:22:32 +0000 Date: Tue, 21 Mar 2006 12:22:31 +0000 (GMT) From: Alex Hayward X-X-Sender: xelah@sphinx.mythic-beasts.com To: "Jim C. Nasby" cc: Mark Kirkwood , Vivek Khera , Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec In-Reply-To: <20060321114658.GK15742@pervasive.com> Message-ID: References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <20060321103219.GD15742@pervasive.com> <441FDD7E.7050106@paradise.net.nz> <20060321114658.GK15742@pervasive.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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/394 X-Sequence-Number: 17831 On Tue, 21 Mar 2006, Jim C. Nasby wrote: > On Tue, Mar 21, 2006 at 11:03:26PM +1200, Mark Kirkwood wrote: > > > > So its really all about accounting, in a sense - whether pages end up in > > the 'Buf' or 'Inactive' queue, they are still cached! > > So what's the difference between Buf and Active then? Just that active > means it's a code page, or that it's been directly mapped into a > processes memory (perhaps via mmap)? I don't think that Buf and Active are mutually exclusive. Try adding up Active, Inactive, Cache, Wired, Buf and Free - it'll come to more than your physical memory. Active gives an amount of physical memory. Buf gives an amount of kernel-space virtual memory which provide the kernel with a window on to pages in the other categories. In fact, I don't think that 'Buf' really belongs in the list as it doesn't represent a 'type' of page at all. -- Alex Hayward Seatbooker From pgsql-performance-owner@postgresql.org Tue Mar 21 08:29:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4DFA79DC80D for ; Tue, 21 Mar 2006 08:29: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 60145-03 for ; Tue, 21 Mar 2006 08:29:16 -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 C5A8B9DD2E7 for ; Tue, 21 Mar 2006 08:29:11 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FLfz8-0003f1-2v for pgsql-performance@postgresql.org; Tue, 21 Mar 2006 13:29:14 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FLfzm-0003St-00 for ; Tue, 21 Mar 2006 13:29:54 +0100 Date: Tue, 21 Mar 2006 13:29:54 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321122954.GB13241@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> <20060321115618.GA12880@uio.no> <20060321120158.GO15742@pervasive.com> <20060321121032.GB12963@uio.no> <20060321121839.GT15742@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20060321121839.GT15742@pervasive.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+cvs20060126 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: 200603/395 X-Sequence-Number: 17832 On Tue, Mar 21, 2006 at 06:18:39AM -0600, Jim C. Nasby wrote: > Basically, you need to know for certain that if PostgreSQL creates a > file and then fsync's it that that file is safely on disk, and that the > filesystem knows how to find it (ie: the metadata is also on disk in > some fashion). It seems to do, quoting Tom from http://archives.postgresql.org/pgsql-performance/2005-11/msg00184.php: == snip == No, Mike is right: for WAL you shouldn't need any journaling. This is because we zero out *and fsync* an entire WAL file before we ever consider putting live WAL data in it. During live use of a WAL file, its metadata is not changing. As long as the filesystem follows the minimal rule of syncing metadata about a file when it fsyncs the file, all the live WAL files should survive crashes OK. We can afford to do this mainly because WAL files can normally be recycled instead of created afresh, so the zero-out overhead doesn't get paid during normal operation. You do need metadata journaling for all non-WAL PG files, since we don't fsync them every time we extend them; which means the filesystem could lose track of which disk blocks belong to such a file, if it's not journaled. == snip == /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Mar 21 08:34:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4A3949DC8DE for ; Tue, 21 Mar 2006 08:34: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 62102-01 for ; Tue, 21 Mar 2006 08:34:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 72ED99DC84A for ; Tue, 21 Mar 2006 08:34:15 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 85A9F56427; Tue, 21 Mar 2006 06:34:19 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 06:34:17 -0600 Date: Tue, 21 Mar 2006 06:34:17 -0600 From: "Jim C. Nasby" To: Alex Hayward Cc: Mark Kirkwood , Vivek Khera , Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec Message-ID: <20060321123417.GW15742@pervasive.com> References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <20060321103219.GD15742@pervasive.com> <441FDD7E.7050106@paradise.net.nz> <20060321114658.GK15742@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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:xelah-pgsql@xelah.com::/roxNwnkkYhHDJty:0000000000000000 0000000000000000000000008Kqa X-Hashcash: 1:20:060321:markir@paradise.net.nz::EjN7y0mKFZo3Xnpq:000000000000000 0000000000000000000000000BNC X-Hashcash: 1:20:060321:vivek@khera.org::jxTzLuh24dYby41E:005tDZ X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::CfNGnXawlTbqtSAN:00000 000000000000000000000000DH3d X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/396 X-Sequence-Number: 17833 On Tue, Mar 21, 2006 at 12:22:31PM +0000, Alex Hayward wrote: > On Tue, 21 Mar 2006, Jim C. Nasby wrote: > > > On Tue, Mar 21, 2006 at 11:03:26PM +1200, Mark Kirkwood wrote: > > > > > > So its really all about accounting, in a sense - whether pages end up in > > > the 'Buf' or 'Inactive' queue, they are still cached! > > > > So what's the difference between Buf and Active then? Just that active > > means it's a code page, or that it's been directly mapped into a > > processes memory (perhaps via mmap)? > > I don't think that Buf and Active are mutually exclusive. Try adding up > Active, Inactive, Cache, Wired, Buf and Free - it'll come to more than > your physical memory. > > Active gives an amount of physical memory. Buf gives an amount of > kernel-space virtual memory which provide the kernel with a window on to > pages in the other categories. In fact, I don't think that 'Buf' really > belongs in the list as it doesn't represent a 'type' of page at all. Ahhh, I get it... a KVM (what's that stand for anyway?) is required any time the kernel wants to access a page that doesn't belong to it, right? And actually, I just checked 4 machines and adding all the queues plus buf together didn't add up to total memory except on one of them (there adding just the queues came close; 1507.6MB on a 1.5GB machine). -- 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 Mar 21 08:45:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 354609DC84A for ; Tue, 21 Mar 2006 08:45: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 60830-10 for ; Tue, 21 Mar 2006 08:45:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 88FBB9DC80D for ; Tue, 21 Mar 2006 08:45:23 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id E055C56427; Tue, 21 Mar 2006 06:45:26 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 06:45:25 -0600 Date: Tue, 21 Mar 2006 06:45:25 -0600 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321124525.GX15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> <20060321115618.GA12880@uio.no> <20060321120158.GO15742@pervasive.com> <20060321121032.GB12963@uio.no> <20060321121839.GT15742@pervasive.com> <20060321122954.GB13241@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060321122954.GB13241@uio.no> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::UOrw63lUoKHB4bI3:00000 000000000000000000000000Kesu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/397 X-Sequence-Number: 17834 On Tue, Mar 21, 2006 at 01:29:54PM +0100, Steinar H. Gunderson wrote: > On Tue, Mar 21, 2006 at 06:18:39AM -0600, Jim C. Nasby wrote: > > Basically, you need to know for certain that if PostgreSQL creates a > > file and then fsync's it that that file is safely on disk, and that the > > filesystem knows how to find it (ie: the metadata is also on disk in > > some fashion). > > It seems to do, quoting Tom from > http://archives.postgresql.org/pgsql-performance/2005-11/msg00184.php: 404 :( > > == snip == > its metadata is not changing. As long as the filesystem follows > the minimal rule of syncing metadata about a file when it fsyncs the > file, all the live WAL files should survive crashes OK. And therin lies the rub: file metadata *must* commit to disk as part of an fsync, and it's needed for both WAL and heap data. It's needed for heap data because as soon as a checkpoint completes, PostgreSQL is free to erase any WAL info about previous DDL changes. On FreeBSD, if you're using softupdates, the filesystem will properly order writes to the drive so that metadata must be written before file data; this ensures that an fsync on the file will first write any metadata before writing the data itself. With fsync turned off, any metadata-changing commands will wait for the metadata to commit to disk before returning (unless you run async...) I'm not really sure how this all plays out on a journalling filesystem. -- 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 Mar 21 08:51:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 658D49DD559 for ; Tue, 21 Mar 2006 08:51: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 63700-05 for ; Tue, 21 Mar 2006 08:51:16 -0400 (AST) X-Greylist: delayed 00:06:37.827925 by SQLgrey- Received: from mail.webrainstorm.it (mail.webrainstorm.it [213.92.79.132]) by postgresql.org (Postfix) with SMTP id AA51F9DD539 for ; Tue, 21 Mar 2006 08:51:10 -0400 (AST) Received: (qmail 13146 invoked from network); 21 Mar 2006 12:44:14 -0000 Received: from unknown (HELO mgmt1.webrainstorm.it) (81.174.12.48) by webrainstorm.it with SMTP; 21 Mar 2006 12:44:13 -0000 Message-Id: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> X-Mailer: QUALCOMM Windows Eudora Version 7.0.0.16 Date: Tue, 21 Mar 2006 13:46:16 +0100 To: pgsql-performance@postgresql.org From: Edoardo Serra Subject: Postmaster using only 4-5% CPU Mime-Version: 1.0 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: 200603/399 X-Sequence-Number: 17836 Hi all, I'm having a very strange performance=20 problems on a fresh install of postgres 8.1.3 I've just installed it with default option and=20 --enable-thread-safety without tweaking config files yet. The import of a small SQL files into the DB (6=20 tables with 166.500 total records, INSERT syntax) took me more than 18 minutes as shown below=20 (output of "time ./psql benchmarks < dump.sql") real 18m33.062s user 0m10.386s sys 0m7.707s The server is an - Intel(R) Xeon(TM) CPU 3.60GHz - 1MB L2 - 1 GB RAM - 2x HDD SCSI U320 RAID 1 Hardware (HP 6i controller) The same import, tried on an another low-end=20 server with a fresh install of postgres 8.1.3 gave me: real 2m4.497s user 0m6.234s sys 0m6.148s During the test, the postmaster on the first=20 server (the slow one) uses only a 4% CPU, while=20 on the second one it reaches 50% cpu usage I was thinking on a IO bandwidth saturation, but=20 "vmstat 1" during the import shows me small values for io/bo column Searching the archive of the ml I found a Disk IO=20 test I suddenly ran on the slower server as follow # time bash -c "dd if=3D/dev/zero of=3Dbigfile bs=3D8k=20 count=3D200000 && sync" (write test) # time dd if=3Dbigfile of=3D/dev/null bs=3D8k (read test) output of "vmstat 1" during the above test follows: procs -----------memory---------- ---swap-- -----io---- --system--= ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id= wa Write test 0 11 540 2344 12152 863456 4 0 340 27848 1709 695 6 53 0= 41 0 11 540 2344 12180 863516 4 0 44 45500 1623 386 0 2 0= 98 0 5 540 3168 12200 862520 0 0 264 44888 1573 315 1 2 0= 97 Read test 0 2 440 2328 6076 849120 0 0 94552 0 1550 624 3 10 0= 87 0 2 440 2248 6104 848936 0 0 94508 0 1567 715 7 10 0= 83 0 3 440 2824 6148 847828 0 0=20 102540 448 1511 675 14 11 0 75 Values of io/(bi-bo) during the disk test are a=20 lot higher than during the import operation.... I really have no more clues .... :( Do you have any ideas ? Tnx in advance Regards Edoardo Serra WeBRainstorm S.r.l. IT, Internet services & consulting Via Pio Fo=E0 83/C 10126 Torino Tel: +39 011 6966881 From pgsql-performance-owner@postgresql.org Tue Mar 21 08:48:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B8C149DCA8C for ; Tue, 21 Mar 2006 08:48: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 63465-04 for ; Tue, 21 Mar 2006 08:48:48 -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 8EBAA9DC9B2 for ; Tue, 21 Mar 2006 08:48:43 -0400 (AST) Received: from osgiliath.mathom.us ([151.200.254.241]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IWH00F5GA9AHHJ4@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 21 Mar 2006 06:48:47 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 6A6366E46D for ; Tue, 21 Mar 2006 07:48:45 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30125-03 for ; Tue, 21 Mar 2006 07:48:44 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id DA89F6E775; Tue, 21 Mar 2006 07:48:43 -0500 (EST) Date: Tue, 21 Mar 2006 07:48:43 -0500 From: Michael Stone Subject: Re: Migration study, step 1: bulk write performance In-reply-to: <20060321120158.GO15742@pervasive.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20060321124841.GZ15140@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: Debian amavisd-new at mathom.us References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142867952.16487.96.camel@coppola.muc.ecircle.de> <20060321112759.GF15742@pervasive.com> <1142941966.23597.4.camel@coppola.muc.ecircle.de> <20060321115618.GA12880@uio.no> <20060321120158.GO15742@pervasive.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.047 required=5 tests=[AWL=-0.189, RCVD_IN_SORBS_WEB=1.236] X-Spam-Score: 1.047 X-Spam-Level: * X-Archive-Number: 200603/398 X-Sequence-Number: 17835 On Tue, Mar 21, 2006 at 06:01:58AM -0600, Jim C. Nasby wrote: >On Tue, Mar 21, 2006 at 12:56:18PM +0100, Steinar H. Gunderson wrote: >> For the record, that's the wrong way round. For the data partitioning >> metadata journaling is enough, and for the WAL partition you don't need any >> FS journaling at all. > >Are you sure? Yes. :) You actually shouldn't need metadata journaling in either case--fsck will do the same thing. But fsck can take a *very* long time on a large paritition, so for your data partition the journaling fs is a big win. But your wal partition isn't likely to have very many files and should fsck in a snap, and data consistency is taken care of by synchronous operations. (Which is the reason you really don't need/want data journalling.) Mike Stone From pgsql-performance-owner@postgresql.org Tue Mar 21 09:03:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2262C9DD20F for ; Tue, 21 Mar 2006 09:03: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 66664-03 for ; Tue, 21 Mar 2006 09:03:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id D94629DCA8C for ; Tue, 21 Mar 2006 09:03:19 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 4422FA8319 for ; Tue, 21 Mar 2006 14:03:32 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 14025-04 for ; Tue, 21 Mar 2006 14:03:31 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id DE342A82B2 for ; Tue, 21 Mar 2006 14:03:31 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 9CE32183669; Tue, 21 Mar 2006 14:03:19 +0100 (CET) To: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> <20060321095049.GW15742@pervasive.com> <441FD82D.1040509@paradise.net.nz> <20060321115100.GM15742@pervasive.com> X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::T6yfsqzO5JG+LtvP:00000000000000000000000000000FgTD From: Guillaume Cottenceau Date: 21 Mar 2006 14:03:19 +0100 In-Reply-To: <20060321115100.GM15742@pervasive.com> Message-ID: <87acbkkl0o.fsf@meuh.mnc.lan> Lines: 24 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: amavisd-new at mnc.ch X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.099 required=5 tests=[AWL=0.099] X-Spam-Score: 0.099 X-Spam-Level: X-Archive-Number: 200603/400 X-Sequence-Number: 17837 "Jim C. Nasby" writes: > On Tue, Mar 21, 2006 at 10:40:45PM +1200, Mark Kirkwood wrote: > > I was going to recommend higher - but not knowing what else was running, > > kept it to quite conservative :-)... and given he's running java, the > > JVM could easily eat 512M all by itself! > > Oh, didn't pick up on java being in the mix. Yeah, it can be a real pig. > I think people often place too much emphasis on having a seperate > application server, but in the case of java you often have no choice. Fortunately the servers use 2G or 4G of memory, only my test machine had 1G, as I believe I precised in a message; so I'm definitely going to use Mark's advices to enlarge a lot the shared buffers. Btw, what about sort_mem? I have seen it only little referenced in the documentation. Also, I'd still be interested in comments on the result of pmap showing around 450M of "private memory" used by pg, if anyone can share insight about it. Though most people seem freebsd-oriented, and this might be very much linux-centric. -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Tue Mar 21 09:30:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3CFCB9DC9E5 for ; Tue, 21 Mar 2006 09:30: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 69364-10 for ; Tue, 21 Mar 2006 09:30:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id F13379DC8DE for ; Tue, 21 Mar 2006 09:30:24 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id EC268A8323; Tue, 21 Mar 2006 14:30:37 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 14370-06; Tue, 21 Mar 2006 14:30:34 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 8B873A82B2; Tue, 21 Mar 2006 14:30:34 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 4CFB0183669; Tue, 21 Mar 2006 14:30:22 +0100 (CET) To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? References: <87ek11gz69.fsf@meuh.mnc.lan> <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> <87hd5tmt1z.fsf@meuh.mnc.lan> <20060321095700.GX15742@pervasive.com> <87irq8kswd.fsf@meuh.mnc.lan> <20060321115835.GN15742@pervasive.com> X-Hashcash: 1:20:060321:jnasby@pervasive.com::BIAsDcjUEYAH/6Py:000000000000000000000000000000000000000004OcN X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::GQf+FIzVOWfNT1/G:000000000000000000000000000003zbQ From: Guillaume Cottenceau Date: 21 Mar 2006 14:30:22 +0100 In-Reply-To: <20060321115835.GN15742@pervasive.com> Message-ID: <8764m8kjrl.fsf@meuh.mnc.lan> Lines: 23 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: amavisd-new at mnc.ch X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/401 X-Sequence-Number: 17838 "Jim C. Nasby" writes: > If you feel like running some tests, you need to change > > run_cost += max_IO_cost + csquared * (min_IO_cost - max_IO_cost); > > in src/backend/optimizer/path/costsize.c to something like > > run_cost += max_IO_cost + abs(indexCorrelation) * (min_IO_cost - max_IO_cost); Short after the beginning of a discussion about planner associating too high cost for index scan, I'm suggested to change source-code.. I'm already frightened about the near future :) > That might not produce a perfect cost estimate, but I'll wager that it > will be substantially better than what's in there now. FYI, see also > http://archives.postgresql.org/pgsql-performance/2005-04/msg00669.php Sad that Tom didn't share his thoughts about your cost algorithm question in this message. -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Tue Mar 21 10:03:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 839C09DC868 for ; Tue, 21 Mar 2006 10:03: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 79932-01 for ; Tue, 21 Mar 2006 10:03:22 -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 C5AF99DC877 for ; Tue, 21 Mar 2006 10:03:16 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i22so1309941wra for ; Tue, 21 Mar 2006 06:03:21 -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=iI3rmnwJmnLuc3ovAAdtOV42asZTlzJd+Kk3OYTXtSFPNelSLr/1GsLsQbhPm4PZw7hfwxcgiXjEfuN1VOEbRgl+VHfJI/TyMDdViYknDJoQewTojMD/MUiDvzlYne74Ff9IN6DWJFOR/HdzQxJuvfIJ5uNAT9mgvJn1fNgUbCc= Received: by 10.65.113.11 with SMTP id q11mr371304qbm; Tue, 21 Mar 2006 06:03:20 -0800 (PST) Received: by 10.65.135.6 with HTTP; Tue, 21 Mar 2006 06:03:20 -0800 (PST) Message-ID: Date: Tue, 21 Mar 2006 09:03:20 -0500 From: "Merlin Moncure" To: "Amit Soni" Subject: Re: Perfomance test figures Cc: pgsql-performance@postgresql.org In-Reply-To: <20060321055954.85302.qmail@web507.biz.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: <20060321055954.85302.qmail@web507.biz.mail.mud.yahoo.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: 200603/402 X-Sequence-Number: 17839 On 3/21/06, Amit Soni wrote: > I want to compare performance of postgresql database with some other > database. > > Somebody must have done some performance testing. > > Can you pls. share that data (performance figures) with me? And if possib= leu > pls. share procedure also, that how you have done the same? Unfortunately, most database tests are synthetic and not very helpful. Compounding the problem is that the 'best' way to use the database differs between platforms (case in point: with postgresql you want to use stored procedures for simple qeries, and with mysql you don't want to use them). There are a couple of public benchmarks out there...you could try hitting one of them. But this is no substitute for developing simulations of your workload and doing your own in-house benchmarks. is there a particular reason for wanting to compare various sql databases? merlin From pgsql-performance-owner@postgresql.org Tue Mar 21 10:11:00 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 203759DCA0F for ; Tue, 21 Mar 2006 10:10: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 80866-02 for ; Tue, 21 Mar 2006 10:11:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.204]) by postgresql.org (Postfix) with ESMTP id C4FB99DC84A for ; Tue, 21 Mar 2006 10:10:52 -0400 (AST) Received: by nproxy.gmail.com with SMTP id k26so1060895nfc for ; Tue, 21 Mar 2006 06:10:56 -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:content-transfer-encoding:content-disposition:references; b=SMgEMudNg4z3yEeFMDMiBq8Fakjh6zEDi+yCDsqHKFzvgthYh+tqFbnfqgagjt/QObtB/EWTSj80cfG3/URG0Lh7qEva+9uz2P3BE6I0AJXeNUW8NeNQgkUF0oqhDU+nkjnVK3shxTVmxHkmtxk0tXAas2uxBEKlQsm25V4CdbI= Received: by 10.49.94.5 with SMTP id w5mr2422799nfl; Tue, 21 Mar 2006 06:10:56 -0800 (PST) Received: by 10.49.1.16 with HTTP; Tue, 21 Mar 2006 06:10:56 -0800 (PST) Message-ID: <684362e10603210610n709e223ds@mail.gmail.com> Date: Tue, 21 Mar 2006 20:10:56 +0600 From: "Markus Bertheau" To: "Edoardo Serra" Subject: Re: Postmaster using only 4-5% CPU Cc: pgsql-performance@postgresql.org In-Reply-To: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/403 X-Sequence-Number: 17840 The low end server by chance doesn't have an IDE disk that lies about write completion, or a battery backed disk controller? Try disabling fsync on the new server to get comparable figures. Markus Bertheau 2006/3/21, Edoardo Serra : > Hi all, > I'm having a very strange performance > problems on a fresh install of postgres 8.1.3 > I've just installed it with default option and > --enable-thread-safety without tweaking config files yet. > > The import of a small SQL files into the DB (6 > tables with 166.500 total records, INSERT syntax) > took me more than 18 minutes as shown below > (output of "time ./psql benchmarks < dump.sql") > > real 18m33.062s > user 0m10.386s > sys 0m7.707s > > The server is an > - Intel(R) Xeon(TM) CPU 3.60GHz - 1MB L2 > - 1 GB RAM > - 2x HDD SCSI U320 RAID 1 Hardware (HP 6i controller) > > The same import, tried on an another low-end > server with a fresh install of postgres 8.1.3 gave me: > > real 2m4.497s > user 0m6.234s > sys 0m6.148s > > During the test, the postmaster on the first > server (the slow one) uses only a 4% CPU, while > on the second one it reaches 50% cpu usage > > I was thinking on a IO bandwidth saturation, but > "vmstat 1" during the import shows me small values for io/bo column > > Searching the archive of the ml I found a Disk IO > test I suddenly ran on the slower server as follow > > # time bash -c "dd if=3D/dev/zero of=3Dbigfile bs=3D8k > count=3D200000 && sync" (write test) > # time dd if=3Dbigfile of=3D/dev/null bs=3D8k (read test) > > output of "vmstat 1" during the above test follows: > > procs -----------memory---------- ---swap-- -----io---- --system-- ----cp= u---- > r b swpd free buff cache si so bi bo in cs us sy= id wa > > Write test > 0 11 540 2344 12152 863456 4 0 340 27848 1709 695 6 53= 0 41 > 0 11 540 2344 12180 863516 4 0 44 45500 1623 386 0 2= 0 98 > 0 5 540 3168 12200 862520 0 0 264 44888 1573 315 1 2= 0 97 > > Read test > 0 2 440 2328 6076 849120 0 0 94552 0 1550 624 3 10= 0 87 > 0 2 440 2248 6104 848936 0 0 94508 0 1567 715 7 10= 0 83 > 0 3 440 2824 6148 847828 0 0 > 102540 448 1511 675 14 11 0 75 > > Values of io/(bi-bo) during the disk test are a > lot higher than during the import operation.... > > I really have no more clues .... :( > > Do you have any ideas ? > > Tnx in advance > > Regards > > > Edoardo Serra > WeBRainstorm S.r.l. > IT, Internet services & consulting > Via Pio Fo=E0 83/C > 10126 Torino > Tel: +39 011 6966881 > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Tue Mar 21 10:12:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7D7119DC84A for ; Tue, 21 Mar 2006 10:12: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 80748-05 for ; Tue, 21 Mar 2006 10:12:10 -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 758D79DC9E5 for ; Tue, 21 Mar 2006 10:12:04 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i14so115390wra for ; Tue, 21 Mar 2006 06:12:08 -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=Zgmnz6KoGjw2L5/5Q0Zj52qugIya0xa+fJ5snUD2P+di64MBYSNDupIxaofrNFHHkwHdfNZMXWQPv+ommICgCvXdQnCq2wQ8I5+9t4Yqv527i2xgbfWlT3mY0caug8KTjUlr4RO/YoL5nk3rdhcKBxHo9DtJO+wQUKatyg51Ldk= Received: by 10.65.75.18 with SMTP id c18mr1384295qbl; Tue, 21 Mar 2006 06:12:08 -0800 (PST) Received: by 10.65.135.6 with HTTP; Tue, 21 Mar 2006 06:12:08 -0800 (PST) Message-ID: Date: Tue, 21 Mar 2006 09:12:08 -0500 From: "Merlin Moncure" To: "Jim C. Nasby" Subject: Re: update == delete + insert? Cc: "Jaime Casanova" , "Craig A. James" , pgsql-performance@postgresql.org In-Reply-To: <20060321112348.GE15742@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> <441F3187.90506@modgraph-usa.com> <20060321112348.GE15742@pervasive.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: 200603/404 X-Sequence-Number: 17841 > > design 1 is normalized and better > > design 2 is denormalized and a bad approach no matter the RDBMS > > How is design 1 denormalized? It isn't :)...he said it is normalized. Design 2 may or may not be de-normalized (IMO there is not enough information to make that determination) but as stated it's a good idea to split the table on practical grounds. merlin From pgsql-performance-owner@postgresql.org Tue Mar 21 10:34:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 84BD39DC8DE for ; Tue, 21 Mar 2006 10:34: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 88065-01 for ; Tue, 21 Mar 2006 10:34:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id 09DAB9DC82D for ; Tue, 21 Mar 2006 10:34:47 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 6235EA8319; Tue, 21 Mar 2006 15:35:01 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 16241-04; Tue, 21 Mar 2006 15:35:01 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 02D79A82B2; Tue, 21 Mar 2006 15:35:01 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id B279C183669; Tue, 21 Mar 2006 15:34:48 +0100 (CET) To: Edoardo Serra Cc: pgsql-performance@postgresql.org Subject: Re: Postmaster using only 4-5% CPU References: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> X-Hashcash: 1:20:060321:osdevel@webrainstorm.it::AdVdnpyo+nEDgzIA:000000000000000000000000000000000000003FDC X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::EtSvC7hnGFqDUDAK:000000000000000000000000000003zyW From: Guillaume Cottenceau Date: 21 Mar 2006 15:34:48 +0100 In-Reply-To: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> Message-ID: <87slpbkgs7.fsf@meuh.mnc.lan> Lines: 34 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: amavisd-new at mnc.ch 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: 200603/405 X-Sequence-Number: 17842 Edoardo Serra writes: > Hi all, > I'm having a very strange performance problems on a fresh > install of postgres 8.1.3 > I've just installed it with default option and --enable-thread-safety > without tweaking config files yet. > > The import of a small SQL files into the DB (6 tables with 166.500 > total records, INSERT syntax) > took me more than 18 minutes as shown below (output of "time ./psql > benchmarks < dump.sql") > > real 18m33.062s > user 0m10.386s > sys 0m7.707s > > The server is an > - Intel(R) Xeon(TM) CPU 3.60GHz - 1MB L2 > - 1 GB RAM > - 2x HDD SCSI U320 RAID 1 Hardware (HP 6i controller) I have seen similar very low performance for INSERTs, although using SCSI 320 disk, controlled by LSI Logic 53C1030 (using Fusion MPT SCSI Host driver 3.01.18 on Linux 2.6.11). Something like tens of INSERTs per second into a small table, no more. "iostat" reports very large figures in the "await" field compared to other servers using raid1 controllers, that's my best guess, but I was unable to find why and how to fix (and the vendor has been very helpless until now). I'm wondering if we don't have an issue with the driver but have no more clue. -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Tue Mar 21 11:25:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 49BDE9DC9BD for ; Tue, 21 Mar 2006 11: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 97632-02 for ; Tue, 21 Mar 2006 11:25:20 -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 9C61A9DC868 for ; Tue, 21 Mar 2006 11:25:11 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Tue, 21 Mar 2006 10:25:10 -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); Tue, 21 Mar 2006 10:25:10 -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.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 21 Mar 2006 15:25:09 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Tue, 21 Mar 2006 07:25:07 -0800 Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & From: "Luke Lonergan" To: "Jim C. Nasby" cc: "Miguel" , "Postgresql Performance" Message-ID: Thread-Topic: [PERFORM] Best OS & Configuration for Dual Xeon w/4GB & Thread-Index: AcZM3ZBOujwWff3dQK2URpifL3yy1QAHhH93 In-Reply-To: <20060321114937.GL15742@pervasive.com> MIME-Version: 1.0 X-OriginalArrivalTime: 21 Mar 2006 15:25:10.0739 (UTC) FILETIME=[A4861230:01C64CFB] X-WSS-ID: 683EC55C2XS31295945-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.35 required=5 tests=[AWL=0.097, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.35 X-Spam-Level: * X-Archive-Number: 200603/406 X-Sequence-Number: 17843 Jim, On 3/21/06 3:49 AM, "Jim C. Nasby" wrote: > No, I don't know why the transfer rates for the mirror are 1/2 that as the raw > device. :( Well - lessee. Would those drives be attached to a Silicon Image (SII) SATA controller? A Highpoint? I found in testing about 2 years ago that under Linux (looks like you're BSD), most SATA controllers other than the Intel PIIX are horribly broken from a performance standpoint, probably due to bad drivers but I'm not sure. Now I think whatever is commonly used by Nforce 4 implementations seems to work ok, but we don't count on them for RAID configurations yet. - Luke From pgsql-performance-owner@postgresql.org Tue Mar 21 11:33:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A7B279DCB0D for ; Tue, 21 Mar 2006 11: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 99278-03 for ; Tue, 21 Mar 2006 11:33:35 -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 948B89DCA6F for ; Tue, 21 Mar 2006 11:33:28 -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 7703DB80C for ; Tue, 21 Mar 2006 10:33:33 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <878CF1DF-7173-4620-B56A-0CC8D25B3671@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec Date: Tue, 21 Mar 2006 10:33:32 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) 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: 200603/407 X-Sequence-Number: 17844 On Mar 20, 2006, at 6:27 PM, PFC wrote: > Expensive SCSI hardware RAID cards with expensive 10Krpm harddisks > should not get humiliated by such a simple (and cheap) setup. (I'm > referring to the 12-drive RAID10 mentioned before, not the other > one which was a simple 2-disk mirror). Toms hardware benchmarked > some hardware RAIDs and got humongous transfer rates... hm ? > I'll put up my "slow" 12 disk SCSI array up against your IDE array on a large parallel load any day. From pgsql-performance-owner@postgresql.org Tue Mar 21 11:34:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 16E909DC84B for ; Tue, 21 Mar 2006 11:34: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 99597-02 for ; Tue, 21 Mar 2006 11:34: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 1A1C39DC84A for ; Tue, 21 Mar 2006 11:34:12 -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 3D861B80C for ; Tue, 21 Mar 2006 10:34:17 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <441FDD7E.7050106@paradise.net.nz> References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <20060321103219.GD15742@pervasive.com> <441FDD7E.7050106@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: Best OS & Configuration for Dual Xeon w/4GB & Adaptec Date: Tue, 21 Mar 2006 10:34:16 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.079 required=5 tests=[AWL=0.079] X-Spam-Score: 0.079 X-Spam-Level: X-Archive-Number: 200603/408 X-Sequence-Number: 17845 On Mar 21, 2006, at 6:03 AM, Mark Kirkwood wrote: > The so-called limit (controllable via various sysctl's) is on the > amount of memory used for kvm mapped pages, not cached pages, i.e - > its a subset of the cached pages that are set up for immediate > access (the Thanks... now that makes sense to me. From pgsql-performance-owner@postgresql.org Tue Mar 21 11:40:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 74F3C9DCA01 for ; Tue, 21 Mar 2006 11:40: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 99238-10 for ; Tue, 21 Mar 2006 11:40:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailhub1.sghms.ac.uk (mailhub1.sghms.ac.uk [194.82.51.7]) by postgresql.org (Postfix) with ESMTP id 3ABC79DCA25 for ; Tue, 21 Mar 2006 11:40:46 -0400 (AST) Received: from [194.82.51.24] (helo=imail) by mailhub1.sghms.ac.uk with esmtp (Exim 4.24) id 1FLixy-0005Jp-4G; Tue, 21 Mar 2006 15:40:14 +0000 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.2 HotFix 2.10 (built Dec 26 2005)) with ESMTPA id <0IWH00GT4I71HN@imail.sghms.ac.uk>; Tue, 21 Mar 2006 15:40:14 +0000 (GMT) Date: Tue, 21 Mar 2006 15:40:25 +0000 From: Adam Witney Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & In-reply-to: <20060321114937.GL15742@pervasive.com> To: "Jim C. Nasby" Cc: pgsql-performance Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH1: No virueses detected X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.3, required 5, autolearn=not spam, ALL_TRUSTED -3.30) X-MailScanner-From: awitney@sgul.ac.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.135 required=5 tests=[AWL=0.135] X-Spam-Score: 0.135 X-Spam-Level: X-Archive-Number: 200603/409 X-Sequence-Number: 17846 > decibel@noel.2[5:43]~:15>sudo diskinfo -vt /dev/mirror/gm0 Can anyone point me to where I can find diskinfo or an equivalent to run on my debian system, I have been googling for the last hour but can't find it! I would like to analyse my own disk setup for comparison Thanks for any help Adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From pgsql-performance-owner@postgresql.org Tue Mar 21 12:57:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 80C8B9DC880 for ; Tue, 21 Mar 2006 12: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 15849-02 for ; Tue, 21 Mar 2006 12:57:57 -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 393E39DC831 for ; Tue, 21 Mar 2006 12:57:55 -0400 (AST) Received: by zproxy.gmail.com with SMTP id s1so1580945nze for ; Tue, 21 Mar 2006 08:57:55 -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=BTaAkYjqrMhI7F/yYFwE9gwz7574poB/2LeFuT0XZua+iuuZStmG2pyRB4gg9VvOOfgPJQ3N5D87I9TplouAKpYTlnRH5b4Om1l0ITQZvaCS0jR4HRSN1oRLuanGTKpaZL6Zq0lmPGwNx5XE9rqNGY41jOx/hD9G1noiu/kGCrE= Received: by 10.65.203.12 with SMTP id f12mr403491qbq; Tue, 21 Mar 2006 08:57:54 -0800 (PST) Received: by 10.65.123.12 with HTTP; Tue, 21 Mar 2006 08:57:54 -0800 (PST) Message-ID: <1d4e0c10603210857q145542e1ve8533bbf7eea2aa1@mail.gmail.com> Date: Tue, 21 Mar 2006 17:57:54 +0100 From: "Guillaume Smet" To: "Tom Lane" Subject: Re: PostgreSQL and Xeon MP Cc: "Sven Geisler" , "Richard Huxton" , pgsql-performance@postgresql.org In-Reply-To: <16633.1142522409@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: <1d4e0c10603160245n55128e86t35431a339afcf8cc@mail.gmail.com> <44194A4B.3020106@archonet.com> <1d4e0c10603160428s1a3c1f4cocbe8489634524387@mail.gmail.com> <441963F4.1010607@aeccom.com> <1d4e0c10603160630g7fe945ffo1d723843407ed128@mail.gmail.com> <16633.1142522409@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.165 required=5 tests=[AWL=0.165] X-Spam-Score: 0.165 X-Spam-Level: X-Archive-Number: 200603/410 X-Sequence-Number: 17847 On 3/16/06, Tom Lane wrote: > Can you try strace'ing some of the backend processes while the system is > behaving like this? I suspect what you'll find is a whole lot of > delaying select() calls due to high contention for spinlocks ... As announced, we have migrated our production server from 7.4.8 to 8.1.3 this morning. We did some strace'ing before the migration and you were right on the select calls. We had a lot of them even when the database was not highly loaded (one every 3-4 lines). After the upgrade, we have the expected behaviour with a more linear scalability and a growing cpu load when the database is highly loaded (and no cpu idle anymore in this case). We have fewer context switches too. 8.1.3 definitely is far better for quad Xeon MP and I recommend the upgrade for everyone having this sort of problem. Tom, thanks for your great work on this problem. -- Guillaume From pgsql-performance-owner@postgresql.org Tue Mar 21 13:38:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A0D729DC869 for ; Tue, 21 Mar 2006 13:38: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 23871-02-4 for ; Tue, 21 Mar 2006 13:38:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 58CB19DCA30 for ; Tue, 21 Mar 2006 13:38:15 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id AFF1C56431; Tue, 21 Mar 2006 11:38:14 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 11:38:13 -0600 Date: Tue, 21 Mar 2006 11:38:13 -0600 From: "Jim C. Nasby" To: Merlin Moncure Cc: Jaime Casanova , "Craig A. James" , pgsql-performance@postgresql.org Subject: Re: update == delete + insert? Message-ID: <20060321173813.GE15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> <441F3187.90506@modgraph-usa.com> <20060321112348.GE15742@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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:mmoncure@gmail.com::kYQSgYhLONyi7pLC:0000000000000000000 0000000000000000000000004lur X-Hashcash: 1:20:060321:systemguards@gmail.com::pcHmD0l1OPjkXR1i:000000000000000 0000000000000000000000005D9J X-Hashcash: 1:20:060321:cjames@modgraph-usa.com::S8JorLgMvXVwUE8O:00000000000000 0000000000000000000000001uyH X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::UNW2NNs6pgLArbHj:00000 0000000000000000000000002Mfa X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/411 X-Sequence-Number: 17848 On Tue, Mar 21, 2006 at 09:12:08AM -0500, Merlin Moncure wrote: > > > design 1 is normalized and better > > > design 2 is denormalized and a bad approach no matter the RDBMS > > > > How is design 1 denormalized? > > It isn't :)...he said it is normalized. Design 2 may or may not be > de-normalized (IMO there is not enough information to make that > determination) but as stated it's a good idea to split the table on > practical grounds. Err, sorry, got the number backwards. My point is that 2 isn't denormalized afaik, at least not based just on the example. But yes, in a case like this, vertical partitioning can make a lot of sense. -- 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 Mar 21 13:44:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9E2909DC880 for ; Tue, 21 Mar 2006 13:44: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 22814-09 for ; Tue, 21 Mar 2006 13:44:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 4FF3C9DC869 for ; Tue, 21 Mar 2006 13:44:40 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 21 Mar 2006 17:44:40 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 21 Mar 2006 11:44:40 -0600 Subject: Re: Postmaster using only 4-5% CPU From: Scott Marlowe To: Edoardo Serra Cc: pgsql-performance@postgresql.org In-Reply-To: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> References: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142963080.17883.193.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 21 Mar 2006 11:44:40 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.145 required=5 tests=[AWL=0.144, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.145 X-Spam-Level: X-Archive-Number: 200603/412 X-Sequence-Number: 17849 On Tue, 2006-03-21 at 06:46, Edoardo Serra wrote: > Hi all, > I'm having a very strange performance > problems on a fresh install of postgres 8.1.3 > I've just installed it with default option and > --enable-thread-safety without tweaking config files yet. > > The import of a small SQL files into the DB (6 > tables with 166.500 total records, INSERT syntax) > took me more than 18 minutes as shown below > (output of "time ./psql benchmarks < dump.sql") > > real 18m33.062s > user 0m10.386s > sys 0m7.707s > > The server is an > - Intel(R) Xeon(TM) CPU 3.60GHz - 1MB L2 > - 1 GB RAM > - 2x HDD SCSI U320 RAID 1 Hardware (HP 6i controller) > > The same import, tried on an another low-end > server with a fresh install of postgres 8.1.3 gave me: > > real 2m4.497s > user 0m6.234s > sys 0m6.148s Here's what's happening. On the "fast" machine, you are almost certainly using IDE drives. PostgreSQL uses a system call called "fsync" when writing data out. It writes the data to the write ahead logs, calls fsync, and waits for it to return. fsync() tells the drive to flush its write buffers to disk and tell the OS when it has completed this. SCSI drives dutifully write out those buffers, and then, only after they're written, tell the OS that yes, the data is written out. Since SCSI drives can do other things while this is going on, by using command queueing, this is no great harm to performance, since the drive and OS can transfer other data into / out of buffers during this fsync operation. Meanwhile, back in the jungle... The machine with IDE drives operates differently. Most, if not all, IDE drives, when told by the OS to fsync() tell the OS immediately that the fsync() call has completed, and the data is written to the drive. Shortly thereafter, the drive actually commences to write the data out. When it gets a chance. The reason IDE drives do this is that until very recently, the IDE interface allowed only one operation at a time to be "in flight" on an interface / drive. So, if the IDE drive really did write the data out, then report that it was done, it would be much slower than the SCSI drive listed above, because ALL operations on it would stop, waiting in line, for the caches to flush to the platters. For PostgreSQL, the way IDE drives operate is dangerous. Write data out, call fsync(), get an immediate return, mark the data as committed, move on the next operation, operator trips over power cord / power conditioner explodes, power supply dies, brown out causes the machine to reboot, et. al., and when the machine comes up, PostgreSQL politely informs you that your database is corrupt, and you come to the pgsql-general group asking how to get your database back online. Very bad. With SCSI drives, the same scenario results in a machine that comes right back up and keeps on trucking. So, what's happening to you is that on the machine with SCSI drives, PostgreSQL, the OS, and the drives are operating properly, making sure your data is secure, and, unfortunately, taking its sweet time doing it. Given that your .sql file is probably individual inserts without a transaction, this is normal. Try wrapping the inserts in the sql file in begin; / commit; statements, like so: begin; insert into table ... (100,000 inserts here) insert into table ... commit; and it should fly. And, if there's a single bad row, the whole import rolls back. Which means you don't have to figure out where the import stopped or which rows did or didn't take. You just fix the one or two bad rows, and run the whole import again. When a good friend of mine first started using PostgreSQL, he was a total MySQL bigot. He was importing a 10,000 row dataset, and made a smartassed remark after 10 minutes how it would have imported in minutes on MySQL. It was a test database, so I had him stop the import, delete all the imported rows, and wrap the whole import inside begin; and commit; The import took about 20 seconds or so. Now, for the interesting test. Run the import on both machines, with the begin; commit; pairs around it. Halfway through the import, pull the power cord, and see which one comes back up. Don't do this to servers with data you like, only test machines, obviously. For an even more interesting test, do this with MySQL, Oracle, DB2, etc... I've been amazed that the looks of horror I get for suggesting such a test are about the same from an Oracle DBA as they are from a MySQL DBA. :) From pgsql-performance-owner@postgresql.org Tue Mar 21 13:46:00 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 193CD9DC809 for ; Tue, 21 Mar 2006 13:46: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 22080-09 for ; Tue, 21 Mar 2006 13:45:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id DC1FA9DC869 for ; Tue, 21 Mar 2006 13:45:57 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id EF23056431; Tue, 21 Mar 2006 11:45:57 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 11:45:57 -0600 Date: Tue, 21 Mar 2006 11:45:57 -0600 From: "Jim C. Nasby" To: Guillaume Cottenceau Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? Message-ID: <20060321174556.GF15742@pervasive.com> References: <87ek11gz69.fsf@meuh.mnc.lan> <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> <87hd5tmt1z.fsf@meuh.mnc.lan> <20060321095700.GX15742@pervasive.com> <87irq8kswd.fsf@meuh.mnc.lan> <20060321115835.GN15742@pervasive.com> <8764m8kjrl.fsf@meuh.mnc.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8764m8kjrl.fsf@meuh.mnc.lan> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:gc@mnc.ch::ls//wXg2Byj/hVUh:000000007Dtf X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::rYFZ9d7pz4M9tCLe:00000 0000000000000000000000005djy X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/413 X-Sequence-Number: 17850 On Tue, Mar 21, 2006 at 02:30:22PM +0100, Guillaume Cottenceau wrote: > "Jim C. Nasby" writes: > > > If you feel like running some tests, you need to change > > > > run_cost += max_IO_cost + csquared * (min_IO_cost - max_IO_cost); > > > > in src/backend/optimizer/path/costsize.c to something like > > > > run_cost += max_IO_cost + abs(indexCorrelation) * (min_IO_cost - max_IO_cost); > > Short after the beginning of a discussion about planner > associating too high cost for index scan, I'm suggested to change > source-code.. I'm already frightened about the near future :) Well, this is mostly because I've just never gotten around to following up on this. > > That might not produce a perfect cost estimate, but I'll wager that it > > will be substantially better than what's in there now. FYI, see also > > http://archives.postgresql.org/pgsql-performance/2005-04/msg00669.php > > Sad that Tom didn't share his thoughts about your cost algorithm > question in this message. See above. :) If someone comes up with a before and after comparison showing that the change makes the estimator more accurate I'm sure the code will be changed in short order. The nice thing about this case is that basically any PostgreSQL user can do the heavy lifting, instead of relying on the primary contributors for a change. -- 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 Mar 21 13:49:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 914D09DCB74 for ; Tue, 21 Mar 2006 13:49: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 24931-06 for ; Tue, 21 Mar 2006 13:49:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 29C529DCAA7 for ; Tue, 21 Mar 2006 13:49:04 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 7AAD656431; Tue, 21 Mar 2006 11:49:04 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 11:49:03 -0600 Date: Tue, 21 Mar 2006 11:49:03 -0600 From: "Jim C. Nasby" To: Guillaume Cottenceau Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, Message-ID: <20060321174903.GG15742@pervasive.com> References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> <20060321095049.GW15742@pervasive.com> <441FD82D.1040509@paradise.net.nz> <20060321115100.GM15742@pervasive.com> <87acbkkl0o.fsf@meuh.mnc.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87acbkkl0o.fsf@meuh.mnc.lan> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:gc@mnc.ch::xSNFuKTlMrbg6b0s:000000006BKh X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::un3FsgXBY7UcHvFT:00000 0000000000000000000000003W2U X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/414 X-Sequence-Number: 17851 On Tue, Mar 21, 2006 at 02:03:19PM +0100, Guillaume Cottenceau wrote: > "Jim C. Nasby" writes: > > > On Tue, Mar 21, 2006 at 10:40:45PM +1200, Mark Kirkwood wrote: > > > I was going to recommend higher - but not knowing what else was running, > > > kept it to quite conservative :-)... and given he's running java, the > > > JVM could easily eat 512M all by itself! > > > > Oh, didn't pick up on java being in the mix. Yeah, it can be a real pig. > > I think people often place too much emphasis on having a seperate > > application server, but in the case of java you often have no choice. > > Fortunately the servers use 2G or 4G of memory, only my test > machine had 1G, as I believe I precised in a message; so I'm > definitely going to use Mark's advices to enlarge a lot the > shared buffers. Btw, what about sort_mem? I have seen it only > little referenced in the documentation. The biggest issue with setting work_mem (you're not doing current development on 7.4 are you?) is ensuring that you don't push the server into swapping. Remember that work_mem controls how much memory can be used for EACH sort or hash (maybe others) operation. Each query can consume multiples of work_mem (since it can do multiple sorts, for example), and of course each backend could be running a query at the same time. Because of all this it's pretty difficult to make work_mem recomendations without knowing a lot more about your environment. -- 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 Mar 21 13:59:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A68F39DCA3F for ; Tue, 21 Mar 2006 13:59: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 27593-06 for ; Tue, 21 Mar 2006 13:59:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 94FBA9DCB32 for ; Tue, 21 Mar 2006 13:59:18 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id A446E56431; Tue, 21 Mar 2006 11:59:01 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 21 Mar 2006 11:59:01 -0600 Date: Tue, 21 Mar 2006 11:59:01 -0600 From: "Jim C. Nasby" To: Luke Lonergan Cc: Miguel , Postgresql Performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Message-ID: <20060321175900.GH15742@pervasive.com> References: <20060321114937.GL15742@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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060321:llonergan@greenplum.com::6jDuNLrQ5tmnE9zG:00000000000000 0000000000000000000000000ait X-Hashcash: 1:20:060321:mmiranda@123.com.sv::5PmoHXdok2feuk9f:000000000000000000 0000000000000000000000000GJ4 X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::zuqW+5oKRpCDCQaB:00000 00000000000000000000000071Q4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/415 X-Sequence-Number: 17852 On Tue, Mar 21, 2006 at 07:25:07AM -0800, Luke Lonergan wrote: > Jim, > > On 3/21/06 3:49 AM, "Jim C. Nasby" wrote: > > > No, I don't know why the transfer rates for the mirror are 1/2 that as the raw > > device. :( > > Well - lessee. Would those drives be attached to a Silicon Image (SII) SATA > controller? A Highpoint? > > I found in testing about 2 years ago that under Linux (looks like you're > BSD), most SATA controllers other than the Intel PIIX are horribly broken > from a performance standpoint, probably due to bad drivers but I'm not sure. > > Now I think whatever is commonly used by Nforce 4 implementations seems to > work ok, but we don't count on them for RAID configurations yet. atapci1: And note that this is using FreeBSD gmirror, not the built-in raid controller. -- 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 Mar 21 14:10:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1175C9DCB32 for ; Tue, 21 Mar 2006 14:10: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 30218-04 for ; Tue, 21 Mar 2006 14:10:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-01.mandic.com.br (smtp-01.mandic.com.br [200.225.81.132]) by postgresql.org (Postfix) with ESMTP id BF2159DCB10 for ; Tue, 21 Mar 2006 14:10:49 -0400 (AST) Received: (qmail 9253 invoked from network); 21 Mar 2006 18:10:47 -0000 Received: from internet.nube.com.br (HELO [192.168.1.59]) (0Mnb0cjHxdaV1Nm4xtaioaaCll6Wp6IuYnI=@[200.190.102.100]) (envelope-sender ) by smtp-01.mandic.com.br (qmail-ldap-1.03) with SMTP for ; 21 Mar 2006 18:10:47 -0000 Message-ID: <44204107.3040708@mandic.com.br> Date: Tue, 21 Mar 2006 15:08:07 -0300 From: Fernando Lujan User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Sequence Scan vs. Index scan 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: 200603/416 X-Sequence-Number: 17853 Hi guys, I'm trying to figure out when Sequence Scan is better than Index Scan. I just want to know this because I disabled the sequence scan in postgresql and receive a better result. :) Two tables. Table 1 (1 million rows ) ----------- id text table2_id Table 2 (300 thousand rows) ---------- id text 2 When I join these two tables I have a sequence_scan. :( Thanks in advance. Fernando Lujan From pgsql-performance-owner@postgresql.org Tue Mar 21 14:16:58 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2CA779DC84B for ; Tue, 21 Mar 2006 14:16: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 31483-04 for ; Tue, 21 Mar 2006 14:16:56 -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 58EB59DC831 for ; Tue, 21 Mar 2006 14:16: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 1FLlPa-0005uJ-5n; Tue, 21 Mar 2006 19:16:54 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FLlQC-0004Gl-00; Tue, 21 Mar 2006 19:17:32 +0100 Date: Tue, 21 Mar 2006 19:17:32 +0100 From: "Steinar H. Gunderson" To: Fernando Lujan Cc: pgsql-performance@postgresql.org Subject: Re: Sequence Scan vs. Index scan Message-ID: <20060321181732.GA16124@uio.no> Mail-Followup-To: Fernando Lujan , pgsql-performance@postgresql.org References: <44204107.3040708@mandic.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <44204107.3040708@mandic.com.br> 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+cvs20060126 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: 200603/417 X-Sequence-Number: 17854 On Tue, Mar 21, 2006 at 03:08:07PM -0300, Fernando Lujan wrote: > I'm trying to figure out when Sequence Scan is better than Index Scan. I > just want to know this because I disabled the sequence scan in > postgresql and receive a better result. :) That is a very broad question, and you're introducing somewhat of a false choice since you're talking about joins (a join can be solved by more methods than just "sequential scan" or not). Could you please paste the exact query you're using, with EXPLAIN ANALYZE for both the case with and without sequential scans? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Mar 21 14:22:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 297039DCA0F for ; Tue, 21 Mar 2006 14:22: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 31697-09 for ; Tue, 21 Mar 2006 14:22:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) by postgresql.org (Postfix) with ESMTP id D23DD9DCA01 for ; Tue, 21 Mar 2006 14:22:26 -0400 (AST) Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by mail.wirelesscar.com with InterScan Messaging Security Suite; Tue, 21 Mar 2006 19:22:16 +0100 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: Sequence Scan vs. Index scan Date: Tue, 21 Mar 2006 19:22:43 +0100 Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B0A02AC@sesrv12.wirelesscar.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sequence Scan vs. Index scan Thread-Index: AcZNEuu4AFx3qA5XR+q/OYpDoqJUrwAATUGA From: "Mikael Carneholm" To: "Fernando Lujan" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.131 required=5 tests=[AWL=0.131] X-Spam-Score: 0.131 X-Spam-Level: X-Archive-Number: 200603/418 X-Sequence-Number: 17855 Assuming you are joining on "Table 1".id =3D "Table 2".id - do you have = indexes on both columns? Have you analyzed your tables + indexes (are = there statistics available?) If not those criterias are met, it is = unlikely that postgres will choose an index scan. -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Fernando Lujan Sent: den 21 mars 2006 19:08 To: pgsql-performance@postgresql.org Subject: [PERFORM] Sequence Scan vs. Index scan Hi guys, I'm trying to figure out when Sequence Scan is better than Index Scan. I = just want to know this because I disabled the sequence scan in=20 postgresql and receive a better result. :) Two tables. Table 1 (1 million rows ) ----------- id text table2_id Table 2 (300 thousand rows) ---------- id text 2 When I join these two tables I have a sequence_scan. :( Thanks in advance. Fernando Lujan ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend From pgsql-performance-owner@postgresql.org Tue Mar 21 14:23:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 509209DCA3F for ; Tue, 21 Mar 2006 14:23: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 32457-04 for ; Tue, 21 Mar 2006 14:23:10 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 6CCF09DCA0F for ; Tue, 21 Mar 2006 14:23:09 -0400 (AST) Received: from itapoa.terra.com.br (itapoa.terra.com.br [200.176.10.194]) by svr4.postgresql.org (Postfix) with ESMTP id 0ED625AF3A9 for ; Tue, 21 Mar 2006 18:23:09 +0000 (GMT) Received: from ambrose.terra.com.br (ambrose.terra.com.br [200.176.10.10]) by itapoa.terra.com.br (Postfix) with ESMTP id BF17E63465B; Tue, 21 Mar 2006 15:23:05 -0300 (BRT) X-Terra-Karma: -2% X-Terra-Hash: 3c91106f73cb221762789e13d6ad82b4 Received-SPF: pass (ambrose.terra.com.br: domain of terra.com.br designates 200.176.10.10 as permitted sender) client-ip=200.176.10.10; envelope-from=carlosreimer@terra.com.br; helo=reimer; Received: from reimer (unknown [200.101.229.242]) (authenticated user carlosreimer) by ambrose.terra.com.br (Postfix) with ESMTP id A7DA33C1C418; Tue, 21 Mar 2006 15:23:04 -0300 (BRT) Message-ID: <001a01c64d14$80f4a840$8b00000a@reimer> From: "Reimer" To: "Fernando Lujan" , References: <44204107.3040708@mandic.com.br> Subject: Re: Sequence Scan vs. Index scan Date: Tue, 21 Mar 2006 15:23:08 -0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, 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: 200603/419 X-Sequence-Number: 17856 Fernando, If you need to read all the table for example it would be better to read only the data pages instead of read data and index pages. Reimer ----- Original Message ----- From: "Fernando Lujan" To: Sent: Tuesday, March 21, 2006 3:08 PM Subject: [PERFORM] Sequence Scan vs. Index scan > Hi guys, > > I'm trying to figure out when Sequence Scan is better than Index Scan. I > just want to know this because I disabled the sequence scan in postgresql > and receive a better result. :) > > Two tables. > > Table 1 (1 million rows ) > ----------- > id > text > table2_id > > Table 2 (300 thousand rows) > ---------- > id > text 2 > > When I join these two tables I have a sequence_scan. :( > > Thanks in advance. > > Fernando Lujan > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Tue Mar 21 15:04:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CA4129DCC2C for ; Tue, 21 Mar 2006 15:04: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 41560-01-2 for ; Tue, 21 Mar 2006 15:04:27 -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 3A6829DC843 for ; Tue, 21 Mar 2006 15:04:24 -0400 (AST) Received: (qmail 32394 invoked from network); 21 Mar 2006 20:04:55 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 21 Mar 2006 20:04:55 +0100 To: "Vivek Khera" , "Postgresql Performance" Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> <878CF1DF-7173-4620-B56A-0CC8D25B3671@khera.org> Message-ID: Date: Tue, 21 Mar 2006 20:04:54 +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: <878CF1DF-7173-4620-B56A-0CC8D25B3671@khera.org> User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/420 X-Sequence-Number: 17857 >> Expensive SCSI hardware RAID cards with expensive 10Krpm harddisks >> should not get humiliated by such a simple (and cheap) setup. (I'm >> referring to the 12-drive RAID10 mentioned before, not the other one >> which was a simple 2-disk mirror). Toms hardware benchmarked some >> hardware RAIDs and got humongous transfer rates... hm ? >> > > I'll put up my "slow" 12 disk SCSI array up against your IDE array on a > large parallel load any day. Sure, and I have no doubt that yours will be immensely faster on parallel loads than mine, but still, it should also be the case on sequential scan... especially since I have desktop PCI and the original poster has a real server with PCI-X I think. From pgsql-performance-owner@postgresql.org Tue Mar 21 15:14:08 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AE69B9DD586 for ; Tue, 21 Mar 2006 15:14: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 42393-08-7 for ; Tue, 21 Mar 2006 15:14:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-5.paradise.net.nz (bm-5a.paradise.net.nz [203.96.152.184]) by postgresql.org (Postfix) with ESMTP id 469629DD582 for ; Tue, 21 Mar 2006 15:14:05 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-5.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IWH000SXS3HKE@linda-5.paradise.net.nz> for pgsql-performance@postgresql.org; Wed, 22 Mar 2006 07:14:05 +1200 (NZST) Received: from [192.168.1.11] (218-101-28-245.dsl.clear.net.nz [218.101.28.245]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id D085612019A8; Wed, 22 Mar 2006 07:14:04 +1200 (NZST) Date: Wed, 22 Mar 2006 07:14:00 +1200 From: Mark Kirkwood Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & In-reply-to: To: Adam Witney Cc: "Jim C. Nasby" , pgsql-performance Message-id: <44205078.8000306@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.171 required=5 tests=[AWL=0.171] X-Spam-Score: 0.171 X-Spam-Level: X-Archive-Number: 200603/421 X-Sequence-Number: 17858 Adam Witney wrote: > > >>decibel@noel.2[5:43]~:15>sudo diskinfo -vt /dev/mirror/gm0 > > > Can anyone point me to where I can find diskinfo or an equivalent to run on > my debian system, I have been googling for the last hour but can't find it! > I would like to analyse my own disk setup for comparison > I guess you could use hdparm (-t or -T flags do a simple benchmark). Though iozone or bonnie++ are probably better. Cheers Mark From pgsql-performance-owner@postgresql.org Tue Mar 21 15:22:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 88C4D9DC80C for ; Tue, 21 Mar 2006 15:22: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 44522-08 for ; Tue, 21 Mar 2006 15:22:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp105.sbc.mail.mud.yahoo.com (smtp105.sbc.mail.mud.yahoo.com [68.142.198.204]) by postgresql.org (Postfix) with SMTP id 23E769DC809 for ; Tue, 21 Mar 2006 15:22:24 -0400 (AST) Received: (qmail 64267 invoked from network); 21 Mar 2006 19:22:25 -0000 Received: from unknown (HELO discord.dyndns.org) (jeffroe996@sbcglobal.net@69.226.253.111 with plain) by smtp105.sbc.mail.mud.yahoo.com with SMTP; 21 Mar 2006 19:22:25 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by discord.dyndns.org (8.13.4/8.13.4) with ESMTP id k2LJMMbZ009753; Tue, 21 Mar 2006 11:22:22 -0800 Date: Tue, 21 Mar 2006 11:22:22 -0800 (PST) From: Jeff Frost X-X-Sender: jeff@discord.dyndns.org To: Mark Kirkwood cc: Adam Witney , "Jim C. Nasby" , pgsql-performance Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & In-Reply-To: <44205078.8000306@paradise.net.nz> Message-ID: References: <44205078.8000306@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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/422 X-Sequence-Number: 17859 On Wed, 22 Mar 2006, Mark Kirkwood wrote: > Adam Witney wrote: >> >>> decibel@noel.2[5:43]~:15>sudo diskinfo -vt /dev/mirror/gm0 >> >> Can anyone point me to where I can find diskinfo or an equivalent to run on >> my debian system, I have been googling for the last hour but can't find it! >> I would like to analyse my own disk setup for comparison > > I guess you could use hdparm (-t or -T flags do a simple benchmark). > > Though iozone or bonnie++ are probably better. You might also have a look at lmdd for sequential read/write performance from the lmbench suite: http://sourceforge.net/projects/lmbench As numbers from lmdd are seen on this frequently. -- Jeff Frost, Owner Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 From pgsql-hackers-owner@postgresql.org Tue Mar 21 16:08:50 2006 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0B2E19DCA0F; Tue, 21 Mar 2006 16:08: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 54998-02; Tue, 21 Mar 2006 16:08:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C39619DC9E6; Tue, 21 Mar 2006 16:08:45 -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 k2LK8flq019571; Tue, 21 Mar 2006 15:08:41 -0500 (EST) To: Gary Doades cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index behaviour) In-reply-to: <20781.1140046109@sss.pgh.pa.us> References: <43F38867.6010701@gpdnet.co.uk> <19510.1140036968@sss.pgh.pa.us> <19779.1140038874@sss.pgh.pa.us> <43F39E53.1020009@gpdnet.co.uk> <20781.1140046109@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 15 Feb 2006 18:28:29 -0500" Date: Tue, 21 Mar 2006 15:08:40 -0500 Message-ID: <19570.1142971720@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/884 X-Sequence-Number: 81282 Last month I wrote: > It seems clear that our qsort.c is doing a pretty awful job of picking > qsort pivots, while glibc is mostly managing not to make that mistake. I re-ran Gary's test script using the just-committed improvements to qsort.c, and got pretty nice numbers (attached --- compare to http://archives.postgresql.org/pgsql-performance/2006-02/msg00227.php). So it was wrong to blame his problems on the pivot selection --- the culprit was that ill-considered switch to insertion sort. regards, tom lane 100 runtimes for latest port/qsort.c, sorted ascending: Time: 335.481 ms Time: 335.606 ms Time: 335.932 ms Time: 336.039 ms Time: 336.182 ms Time: 336.231 ms Time: 336.711 ms Time: 336.721 ms Time: 336.971 ms Time: 336.982 ms Time: 337.036 ms Time: 337.190 ms Time: 337.223 ms Time: 337.312 ms Time: 337.350 ms Time: 337.423 ms Time: 337.523 ms Time: 337.528 ms Time: 337.565 ms Time: 337.566 ms Time: 337.732 ms Time: 337.741 ms Time: 337.744 ms Time: 337.786 ms Time: 337.790 ms Time: 337.898 ms Time: 337.905 ms Time: 337.952 ms Time: 337.976 ms Time: 338.017 ms Time: 338.123 ms Time: 338.206 ms Time: 338.306 ms Time: 338.514 ms Time: 338.594 ms Time: 338.597 ms Time: 338.683 ms Time: 338.705 ms Time: 338.729 ms Time: 338.748 ms Time: 338.816 ms Time: 338.958 ms Time: 338.963 ms Time: 338.997 ms Time: 339.074 ms Time: 339.106 ms Time: 339.134 ms Time: 339.159 ms Time: 339.226 ms Time: 339.260 ms Time: 339.289 ms Time: 339.341 ms Time: 339.500 ms Time: 339.585 ms Time: 339.595 ms Time: 339.774 ms Time: 339.897 ms Time: 339.927 ms Time: 340.064 ms Time: 340.133 ms Time: 340.172 ms Time: 340.219 ms Time: 340.261 ms Time: 340.323 ms Time: 340.708 ms Time: 340.761 ms Time: 340.785 ms Time: 340.900 ms Time: 340.986 ms Time: 341.339 ms Time: 341.564 ms Time: 341.707 ms Time: 342.155 ms Time: 342.213 ms Time: 342.452 ms Time: 342.515 ms Time: 342.540 ms Time: 342.928 ms Time: 343.548 ms Time: 343.663 ms Time: 344.192 ms Time: 344.952 ms Time: 345.152 ms Time: 345.174 ms Time: 345.444 ms Time: 346.848 ms Time: 348.144 ms Time: 348.842 ms Time: 354.550 ms Time: 356.877 ms Time: 357.475 ms Time: 358.487 ms Time: 364.178 ms Time: 370.730 ms Time: 493.098 ms Time: 648.009 ms Time: 849.345 ms Time: 860.616 ms Time: 936.800 ms Time: 1727.085 ms From pgsql-performance-owner@postgresql.org Tue Mar 21 16:32:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 576D89DC843 for ; Tue, 21 Mar 2006 16:32: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 57402-07 for ; Tue, 21 Mar 2006 16:32:04 -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 072029DC891 for ; Tue, 21 Mar 2006 16:32:01 -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 929AEB80C for ; Tue, 21 Mar 2006 15:32:02 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: References: <20060317221116.GA14661@juniper.net> <8F6490E1-64E2-406B-A559-7DA8BA1EB197@khera.org> <441F161D.7010502@123.com.sv> <878CF1DF-7173-4620-B56A-0CC8D25B3671@khera.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8D5AFBF8-E1BD-425B-8952-32EA96F95F07@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Adaptec Date: Tue, 21 Mar 2006 15:32:01 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.079 required=5 tests=[AWL=0.079] X-Spam-Score: 0.079 X-Spam-Level: X-Archive-Number: 200603/424 X-Sequence-Number: 17861 On Mar 21, 2006, at 2:04 PM, PFC wrote: > especially since I have desktop PCI and the original poster has a > real server with PCI-X I think. that was me :-) but yeah, I never seem to get full line speed for some reason. i don't know if it is because of inadequate measurement tools or what... From pgsql-performance-owner@postgresql.org Tue Mar 21 16:34:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F23F59DCC32 for ; Tue, 21 Mar 2006 16: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 57952-05 for ; Tue, 21 Mar 2006 16:34:01 -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 E1E649DCBA8 for ; Tue, 21 Mar 2006 16:33:58 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id B0A053365F3; Tue, 21 Mar 2006 20:33:55 +0000 (GMT) Subject: Re: WAL logging of SELECT ... INTO command From: Simon Riggs To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org In-Reply-To: <20060321122211.GU15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> Content-Type: text/plain Date: Tue, 21 Mar 2006 20:33:50 +0000 Message-Id: <1142973230.24487.501.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.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200603/425 X-Sequence-Number: 17862 On Tue, 2006-03-21 at 06:22 -0600, Jim C. Nasby wrote: > Currently, it appears that SELECT * INTO new_table FROM old_table logs > each page as it's written to WAL. Is this actually needed? Couldn't the > database simply log that the SELECT ... INTO statement was executed > instead? Doing so would likely result in a large performance improvement > in most installs. Is there no provision for writing anything but data > page changes (or whole pages) to WAL? AFAIK it takes the same code path as CREATE TABLE AS SELECT, which already does exactly what you suggest (except when using PITR). Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Mar 21 16:45:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7FF159DC891 for ; Tue, 21 Mar 2006 16:45: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 61847-01 for ; Tue, 21 Mar 2006 16:45:01 -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 423A39DC827 for ; Tue, 21 Mar 2006 16:44:58 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 5388C337A1F; Tue, 21 Mar 2006 20:44:55 +0000 (GMT) Subject: Re: Migration study, step 1: bulk write performance From: Simon Riggs To: Mikael Carneholm Cc: pgsql-performance@postgresql.org In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> Content-Type: text/plain Date: Tue, 21 Mar 2006 20:44:50 +0000 Message-Id: <1142973890.24487.510.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.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200603/426 X-Sequence-Number: 17863 On Mon, 2006-03-20 at 15:59 +0100, Mikael Carneholm wrote: > This gives that 10Gb takes ~380s => ~27Mb/s (with fsync=off), compared to the raw dd result (~75.5Mb/s). > > I assume this difference is due to: > - simultaneous WAL write activity (assumed: for each byte written to the table, at least one byte is also written to WAL, in effect: 10Gb data inserted in the table equals 20Gb written to disk) > - lousy test method (it is done using a function => the transaction size is 10Gb, and 10Gb will *not* fit in wal_buffers :) ) > - poor config > checkpoint_segments = 3 With those settings, you'll be checkpointing every 48 Mb, which will be every about once per second. Since the checkpoint will take a reasonable amount of time, even with fsync off, you'll be spending most of your time checkpointing. bgwriter will just be slowing you down too because you'll always have more clean buffers than you can use, since you have 132MB of shared_buffers, yet flushing all of them every checkpoint. Please read you're logfile, which should have relevant WARNING messages. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Mar 21 16:58:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 947479DC843 for ; Tue, 21 Mar 2006 16:58: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 62569-10 for ; Tue, 21 Mar 2006 16:58: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 858339DC809 for ; Tue, 21 Mar 2006 16:58:48 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id D96473375A5; Tue, 21 Mar 2006 20:57:32 +0000 (GMT) Subject: Re: planner with index scan cost way off actual cost, From: Simon Riggs To: Guillaume Cottenceau Cc: pgsql-performance@postgresql.org In-Reply-To: <87ek11gz69.fsf@meuh.mnc.lan> References: <87ek11gz69.fsf@meuh.mnc.lan> Content-Type: text/plain Date: Tue, 21 Mar 2006 20:57:27 +0000 Message-Id: <1142974647.24487.518.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.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/427 X-Sequence-Number: 17864 On Fri, 2006-03-17 at 11:09 +0100, Guillaume Cottenceau wrote: > INFO: index "idx_sent_msgs_date_theme_status" now contains 3692284 row versions in 88057 pages > SET effective_cache_size = 10000; SET effective_cache_size > 88057, round up to 100000 to ensure the index cost calculation knows the whole index will be cached, which it clearly could be with 4GB RAM. If the cost is still wrong, it is because the index order doesn't correlate physically with the key columns. Use CLUSTER. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Mar 21 17:19:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1B65A9DCB10 for ; Tue, 21 Mar 2006 17:19: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 67559-06 for ; Tue, 21 Mar 2006 17:19:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 03E929DCC32 for ; Tue, 21 Mar 2006 17:19:20 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 21 Mar 2006 21:19:22 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 21 Mar 2006 15:19:22 -0600 Subject: Re: Migration study, step 1: bulk write performance From: Scott Marlowe To: Ron Cc: Mikael Carneholm , pgsql-performance@postgresql.org In-Reply-To: <7.0.1.0.2.20060320161133.03a0b5a8@earthlink.net> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142973890.24487.510.camel@localhost.localdomain> <7.0.1.0.2.20060320161133.03a0b5a8@earthlink.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142975962.17883.203.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 21 Mar 2006 15:19:22 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.145 required=5 tests=[AWL=0.144, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.145 X-Spam-Level: X-Archive-Number: 200603/429 X-Sequence-Number: 17866 On Mon, 2006-03-20 at 15:17, Ron wrote: > At 03:44 PM 3/21/2006, Simon Riggs wrote: > >On Mon, 2006-03-20 at 15:59 +0100, Mikael Carneholm wrote: > > > > > This gives that 10Gb takes ~380s => ~27Mb/s (with fsync=off), > > compared to the raw dd result (~75.5Mb/s). > > > > > > I assume this difference is due to: > > > - simultaneous WAL write activity (assumed: for each byte written > > to the table, at least one byte is also written to WAL, in effect: > > 10Gb data inserted in the table equals 20Gb written to disk) > > > - lousy test method (it is done using a function => the > > transaction size is 10Gb, and 10Gb will *not* fit in wal_buffers :) ) > > > - poor config > > > > > checkpoint_segments = 3 > > > >With those settings, you'll be checkpointing every 48 Mb, which will be > >every about once per second. Since the checkpoint will take a reasonable > >amount of time, even with fsync off, you'll be spending most of your > >time checkpointing. bgwriter will just be slowing you down too because > >you'll always have more clean buffers than you can use, since you have > >132MB of shared_buffers, yet flushing all of them every checkpoint. > IIRC, Josh Berkus did some benches that suggests in pg 8.x a value of > 64 - 256 is best for checkpoint_segments as long as you have the RAM available. > > I'd suggest trying values of 64, 128, and 256 and setting > checkpoint_segments to the best of those. I've also found that modest increases in commit_siblings and commit_delay help a lot on certain types of imports. From pgsql-performance-owner@postgresql.org Tue Mar 21 17:20:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 996D69DCA16 for ; Tue, 21 Mar 2006 17: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 67550-07 for ; Tue, 21 Mar 2006 17:20:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id 5A93F9DC809 for ; Tue, 21 Mar 2006 17:20:38 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 21 Mar 2006 17:20:39 -0400 X-IronPort-AV: i="4.03,116,1141614000"; d="scan'208"; a="47990841:sNHT3919724136" Received: from alvh.no-ip.org (201.220.122.38) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00B63D51; Tue, 21 Mar 2006 17:20:38 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id A6EF8C3A2D0; Tue, 21 Mar 2006 17:20:38 -0400 (CLT) Date: Tue, 21 Mar 2006 17:20:38 -0400 From: Alvaro Herrera To: Ron Cc: Mikael Carneholm , pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performance Message-ID: <20060321212038.GD17121@surnet.cl> Mail-Followup-To: Ron , Mikael Carneholm , pgsql-performance@postgresql.org References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142973890.24487.510.camel@localhost.localdomain> <7.0.1.0.2.20060320161133.03a0b5a8@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7.0.1.0.2.20060320161133.03a0b5a8@earthlink.net> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.695 required=5 tests=[AWL=-0.224, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.695 X-Spam-Level: * X-Archive-Number: 200603/430 X-Sequence-Number: 17867 Ron wrote: > IIRC, Josh Berkus did some benches that suggests in pg 8.x a value of > 64 - 256 is best for checkpoint_segments as long as you have the RAM > available. I think you are confusing checkpoint_segments with wal_buffers. checkpoint_segments certainly has little to do with available RAM! -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Tue Mar 21 17:56:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3AE7C9DCC07 for ; Tue, 21 Mar 2006 17:56: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 72222-06 for ; Tue, 21 Mar 2006 17:56:29 -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 E0DEF9DCC21 for ; Tue, 21 Mar 2006 17:56:25 -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 k2LLuPSi002263; Tue, 21 Mar 2006 16:56:25 -0500 (EST) To: Scott Marlowe cc: Ron , Mikael Carneholm , pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performance In-reply-to: <1142975962.17883.203.camel@state.g2switchworks.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142973890.24487.510.camel@localhost.localdomain> <7.0.1.0.2.20060320161133.03a0b5a8@earthlink.net> <1142975962.17883.203.camel@state.g2switchworks.com> Comments: In-reply-to Scott Marlowe message dated "Tue, 21 Mar 2006 15:19:22 -0600" Date: Tue, 21 Mar 2006 16:56:25 -0500 Message-ID: <2262.1142978185@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/431 X-Sequence-Number: 17868 Scott Marlowe writes: > I've also found that modest increases in commit_siblings and > commit_delay help a lot on certain types of imports. On a data import? Those really should have zero effect on a single-process workload. Or are you doing multiple concurrent imports? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Mar 21 18:23:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6AFC89DCA79 for ; Tue, 21 Mar 2006 18:23: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 76722-04 for ; Tue, 21 Mar 2006 18:23:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 3CCE69DC809 for ; Tue, 21 Mar 2006 18:23:12 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 21 Mar 2006 22:23:14 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 21 Mar 2006 16:23:14 -0600 Subject: Re: Migration study, step 1: bulk write performance From: Scott Marlowe To: Tom Lane Cc: Ron , Mikael Carneholm , pgsql-performance@postgresql.org In-Reply-To: <2262.1142978185@sss.pgh.pa.us> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <1142973890.24487.510.camel@localhost.localdomain> <7.0.1.0.2.20060320161133.03a0b5a8@earthlink.net> <1142975962.17883.203.camel@state.g2switchworks.com> <2262.1142978185@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1142979794.17883.205.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 21 Mar 2006 16:23:14 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.145 required=5 tests=[AWL=0.144, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.145 X-Spam-Level: X-Archive-Number: 200603/432 X-Sequence-Number: 17869 On Tue, 2006-03-21 at 15:56, Tom Lane wrote: > Scott Marlowe writes: > > I've also found that modest increases in commit_siblings and > > commit_delay help a lot on certain types of imports. > > On a data import? Those really should have zero effect on a > single-process workload. Or are you doing multiple concurrent imports? That, and it's a machine that's doing other things. Also, a lot of the imports are NOT bundled up into groups of transactions. i.e. lots and lots of individual insert queries. From pgsql-performance-owner@postgresql.org Tue Mar 21 18:44:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 185479DCC56 for ; Tue, 21 Mar 2006 18:44: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 78877-08 for ; Tue, 21 Mar 2006 18:44:26 -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 0416E9DCB77 for ; Tue, 21 Mar 2006 18:44: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 k2LMk2ow006536 for ; Tue, 21 Mar 2006 14:46:02 -0800 Message-ID: <442080D1.5090803@modgraph-usa.com> Date: Tue, 21 Mar 2006 14:40:17 -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: Poor performance o References: <43F38867.6010701@gpdnet.co.uk> <19510.1140036968@sss.pgh.pa.us> <19779.1140038874@sss.pgh.pa.us> <43F39E53.1020009@gpdnet.co.uk> <20781.1140046109@sss.pgh.pa.us> <19570.1142971720@sss.pgh.pa.us> In-Reply-To: <19570.1142971720@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.104 required=5 tests=[AWL=0.104] X-Spam-Score: 0.104 X-Spam-Level: X-Archive-Number: 200603/433 X-Sequence-Number: 17870 I'm reposting this -- I sent this out a month ago but never got a response, and hope someone can shed some light on this. Thanks, Craig -------------------------- This is a straightforward query that should be fairly quick, but takes about 30 minutes. It's a query across three tables, call them A, B, and C. The tables are joined on indexed columns. Here's a quick summary: Table A -----> Table B -----> Table C A_ID B_ID C_ID A_ID NAME C_ID Tables A and B have 6 million rows each. Table C is small: 67 names, no repeats. All columns involved in the join are indexed. The database has been full-vacuumed and analyzed. Summary: 1. Query B only: 2.7 seconds, 302175 rows returned 2. Join B and C: 4.3 seconds, exact same answer 3. Join A and B: 7.2 minutes, exact same answer 4. Join A, B, C: 32.7 minutes, exact same answer Looking at these: Query #1 is doing the real work: finding the rows of interest. Queries #1 and #2 ought to be virtually identical, since Table C has just one row with C_ID = 9, but the time almost doubles. Query #3 should take a bit longer than Query #1 because it has to join 300K rows, but the indexes should make this take just a few seconds, certainly well under a minute. Query #4 should be identical to Query #3, again because there's only one row in Table C. 32 minutes is pretty horrible for such a straightforward query. It looks to me like the problem is the use of nested loops when a hash join should be used, but I'm no expert at query planning. This is psql 8.0.3. Table definitions are at the end. Hardware is a Dell, 2-CPU Xeon, 4 GB memory, database is on a single SATA 7200RPM disk. These table and column names are altered to protect the guilty, otherwise these are straight from Postgres. QUERY #1: --------- explain analyze select B.A_ID from B where B.B_ID = 9; Index Scan using i_B_B_ID on B (cost=0.00..154401.36 rows=131236 width=4) (actual time=0.158..1387.251 rows=302175 loops=1) Index Cond: (B_ID = 9) Total runtime: 2344.053 ms QUERY #2: --------- explain analyze select B.A_ID from B join C on (B.C_ID = C.C_ID) where C.name = 'Joe'; Nested Loop (cost=0.00..258501.92 rows=177741 width=4) (actual time=0.349..3392.532 rows=302175 loops=1) -> Seq Scan on C (cost=0.00..12.90 rows=1 width=4) (actual time=0.232..0.336 rows=1 loops=1) Filter: ((name)::text = 'Joe'::text) -> Index Scan using i_B_C_ID on B (cost=0.00..254387.31 rows=328137 width=8) (actual time=0.102..1290.002 rows=302175 loops=1) Index Cond: (B.C_ID = "outer".C_ID) Total runtime: 4373.916 ms QUERY #3: --------- explain analyze select A.A_ID from A join B on (A.A_ID = B.A_ID) where B.B_ID = 9; Nested Loop (cost=0.00..711336.41 rows=131236 width=4) (actual time=37.118..429419.347 rows=302175 loops=1) -> Index Scan using i_B_B_ID on B (cost=0.00..154401.36 rows=131236 width=4) (actual time=27.344..8858.489 rows=302175 loops=1) Index Cond: (B_ID = 9) -> Index Scan using pk_A_test on A (cost=0.00..4.23 rows=1 width=4) (actual time=1.372..1.376 rows=1 loops=302175) Index Cond: (A.A_ID = "outer".A_ID) Total runtime: 430467.686 ms QUERY #4: --------- explain analyze select A.A_ID from A join B on (A.A_ID = B.A_ID) join C on (B.B_ID = C.B_ID) where C.name = 'Joe'; Nested Loop (cost=0.00..1012793.38 rows=177741 width=4) (actual time=70.184..1960112.247 rows=302175 loops=1) -> Nested Loop (cost=0.00..258501.92 rows=177741 width=4) (actual time=52.114..17753.638 rows=302175 loops=1) -> Seq Scan on C (cost=0.00..12.90 rows=1 width=4) (actual time=0.109..0.176 rows=1 loops=1) Filter: ((name)::text = 'Joe'::text) -> Index Scan using i_B_B_ID on B (cost=0.00..254387.31 rows=328137 width=8) (actual time=51.985..15566.896 rows=302175 loops=1) Index Cond: (B.B_ID = "outer".B_ID) -> Index Scan using pk_A_test on A (cost=0.00..4.23 rows=1 width=4) (actual time=6.407..6.412 rows=1 loops=302175) Index Cond: (A.A_ID = "outer".A_ID) Total runtime: 1961200.079 ms TABLE DEFINITIONS: ------------------ xxx => \d a Table "xxx.a" Column | Type | Modifiers ------------------+------------------------+----------- a_id | integer | not null ... more columns Indexes: "pk_a_id" PRIMARY KEY, btree (a_id) ... more indexes on other columns xxx => \d b Table "xxx.b" Column | Type | Modifiers -------------------------+------------------------+----------- b_id | integer | not null a_id | integer | not null c_id | integer | not null ... more columns Indexes: "b_pkey" PRIMARY KEY, btree (b_id) "i_b_a_id" btree (a_id) "i_b_c_id" btree (c_id) xxx=> \d c Table "xxx.c" Column | Type | Modifiers --------------+------------------------+----------- c_id | integer | not null name | character varying(200) | ... more columns Indexes: "c_pkey" PRIMARY KEY, btree (c_id) From pgsql-performance-owner@postgresql.org Tue Mar 21 19:33:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F18109DCAD3 for ; Tue, 21 Mar 2006 19:33: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 85493-08 for ; Tue, 21 Mar 2006 19:33: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 C331F9DCA83 for ; Tue, 21 Mar 2006 19:33: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 k2LNXFxa006630; Tue, 21 Mar 2006 18:33:15 -0500 (EST) To: "Craig A. James" cc: pgsql-performance@postgresql.org Subject: Re: Poor performance o In-reply-to: <442080D1.5090803@modgraph-usa.com> References: <43F38867.6010701@gpdnet.co.uk> <19510.1140036968@sss.pgh.pa.us> <19779.1140038874@sss.pgh.pa.us> <43F39E53.1020009@gpdnet.co.uk> <20781.1140046109@sss.pgh.pa.us> <19570.1142971720@sss.pgh.pa.us> <442080D1.5090803@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Tue, 21 Mar 2006 14:40:17 -0800" Date: Tue, 21 Mar 2006 18:33:15 -0500 Message-ID: <6629.1142983995@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/434 X-Sequence-Number: 17871 "Craig A. James" writes: > It looks to me like the problem is the use of nested loops when a hash join should be used, but I'm no expert at query planning. Given the sizes of the tables involved, you'd likely have to boost up work_mem before the planner would consider a hash join. What nondefault configuration settings do you have, anyway? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Mar 21 21:08:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 319509DC8DF for ; Tue, 21 Mar 2006 21:08: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 07777-03 for ; Tue, 21 Mar 2006 21:08:25 -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 119FC9DC8DE for ; Tue, 21 Mar 2006 21:08:19 -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 k2M1A34s006886; Tue, 21 Mar 2006 17:10:03 -0800 Message-ID: <4420A290.2050908@modgraph-usa.com> Date: Tue, 21 Mar 2006 17:04:16 -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: Poor performance o References: <43F38867.6010701@gpdnet.co.uk> <19510.1140036968@sss.pgh.pa.us> <19779.1140038874@sss.pgh.pa.us> <43F39E53.1020009@gpdnet.co.uk> <20781.1140046109@sss.pgh.pa.us> <19570.1142971720@sss.pgh.pa.us> <442080D1.5090803@modgraph-usa.com> <6629.1142983995@sss.pgh.pa.us> In-Reply-To: <6629.1142983995@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.105 required=5 tests=[AWL=0.105] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200603/435 X-Sequence-Number: 17872 Tom Lane wrote: > "Craig A. James" writes: >> It looks to me like the problem is the use of nested loops when a hash >> join should be used, but I'm no expert at query planning. > > Given the sizes of the tables involved, you'd likely have to boost up > work_mem before the planner would consider a hash join. What nondefault > configuration settings do you have, anyway? shared_buffers = 20000 work_mem = 32768 effective_cache_size = 300000 This is on a 4GB machine. Is there a guideline for work_mem that's related to table size? Something like, "allow 2 MB per million rows"? I'm also curious why the big difference between my "Query #1" and "Query #2". Even though it does a nested loop, #2's outer loop only returns one result from a very tiny table, so shouldn't it be virtually indistinguishable from #1? Thanks, Craig From pgsql-performance-owner@postgresql.org Tue Mar 21 22:22:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C8DA79DCCA8 for ; Tue, 21 Mar 2006 22:22: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 19070-03 for ; Tue, 21 Mar 2006 22:22:56 -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 D2FFA9DCC94 for ; Tue, 21 Mar 2006 22:22:50 -0400 (AST) Received: from [192.168.1.3] (unknown [192.168.1.3]) by yertle.kcilink.com (Postfix) with ESMTP id 247F0B80C for ; Tue, 21 Mar 2006 21:22:54 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <20060321175900.GH15742@pervasive.com> References: <20060321114937.GL15742@pervasive.com> <20060321175900.GH15742@pervasive.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Best OS & Configuration for Dual Xeon w/4GB & Date: Tue, 21 Mar 2006 21:22:52 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) 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: 200603/436 X-Sequence-Number: 17873 On Mar 21, 2006, at 12:59 PM, Jim C. Nasby wrote: > atapci1: > > And note that this is using FreeBSD gmirror, not the built-in raid > controller. I get similar counter-intuitive slowdown with gmirror SATA disks on an IBM e326m I'm evaluating. If/when I buy one I'll get the onboard SCSI RAID instead. The IBM uses ServerWorks chipset, which shows up to freebsd 6.0 as "generic ATA" and only does UDMA33 transfers. From pgsql-performance-owner@postgresql.org Tue Mar 21 22:48:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 166C39DCBEC for ; Tue, 21 Mar 2006 22: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 21934-08 for ; Tue, 21 Mar 2006 22:48:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp110.sbc.mail.mud.yahoo.com (smtp110.sbc.mail.mud.yahoo.com [68.142.198.209]) by postgresql.org (Postfix) with SMTP id 135069DCA65 for ; Tue, 21 Mar 2006 22:48:23 -0400 (AST) Received: (qmail 79141 invoked from network); 22 Mar 2006 02:48:28 -0000 Received: from unknown (HELO discord.dyndns.org) (jeffroe996@sbcglobal.net@69.226.253.111 with plain) by smtp110.sbc.mail.mud.yahoo.com with SMTP; 22 Mar 2006 02:48:27 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by discord.dyndns.org (8.13.4/8.13.4) with ESMTP id k2M2mQGe027220 for ; Tue, 21 Mar 2006 18:48:26 -0800 Date: Tue, 21 Mar 2006 18:48:26 -0800 (PST) From: Jeff Frost X-X-Sender: jeff@discord.dyndns.org To: pgsql-performance@postgresql.org Subject: motherboard recommendations 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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/437 X-Sequence-Number: 17874 It's time to build a new white box postgresql test box/workstation. My Athlon XP system is getting a little long in the tooth. Have any of you performance folks evaluated the Socket 939 boards on the market these days? I'd like to find something that doesn't have terrible SATA disk performance. I'm planning to install Gentoo x86_64 on it and run software raid, so I won't be using the fakeraid controllers as raid. I have been eyeing the Abit AN8 32X board, but I don't really need SLI, though having an extra PCI-e might be nice in the future. If you respond off-list, I'll summarize and post the results back. Thanks for any input. -- Jeff Frost, Owner Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 From pgsql-performance-owner@postgresql.org Wed Mar 22 00:31:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4D90F9DCAA6 for ; Wed, 22 Mar 2006 00:31: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 38680-05 for ; Wed, 22 Mar 2006 00:31: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 8EC1D9DC959 for ; Wed, 22 Mar 2006 00:31:45 -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 k2M4VikB010013; Tue, 21 Mar 2006 23:31:44 -0500 (EST) To: "Craig A. James" cc: pgsql-performance@postgresql.org Subject: Re: Poor performance o In-reply-to: <4420A290.2050908@modgraph-usa.com> References: <43F38867.6010701@gpdnet.co.uk> <19510.1140036968@sss.pgh.pa.us> <19779.1140038874@sss.pgh.pa.us> <43F39E53.1020009@gpdnet.co.uk> <20781.1140046109@sss.pgh.pa.us> <19570.1142971720@sss.pgh.pa.us> <442080D1.5090803@modgraph-usa.com> <6629.1142983995@sss.pgh.pa.us> <4420A290.2050908@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Tue, 21 Mar 2006 17:04:16 -0800" Date: Tue, 21 Mar 2006 23:31:43 -0500 Message-ID: <10012.1143001903@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/438 X-Sequence-Number: 17875 "Craig A. James" writes: > Tom Lane wrote: >> Given the sizes of the tables involved, you'd likely have to boost up >> work_mem before the planner would consider a hash join. What nondefault >> configuration settings do you have, anyway? > shared_buffers = 20000 > work_mem = 32768 > effective_cache_size = 300000 So for a 6M-row table, 32M work_mem would allow ... um ... 5 bytes per row. It's not happening :-( Try boosting work_mem by a factor of 100 and seeing whether a hash-based join actually wins or not. If so, we can discuss where the sane setting really falls, if not there's no point. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 23 00:15:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 090269DCA8D for ; Thu, 23 Mar 2006 00: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 25243-08 for ; Thu, 23 Mar 2006 00:15: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 9E49C9DCB78 for ; Thu, 23 Mar 2006 00:15:52 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9DE8330CDE; Thu, 23 Mar 2006 05:15:50 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: WAL logging of SELECT ... INTO command Date: Wed, 22 Mar 2006 14:20:39 +0800 Organization: Hub.Org Networking Services Lines: 22 Message-ID: References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.609 required=5 tests=[AWL=-0.272, DATE_IN_PAST_12_24=0.881] X-Spam-Score: 0.609 X-Spam-Level: X-Archive-Number: 200603/465 X-Sequence-Number: 17902 "Simon Riggs" wrote > On Tue, 2006-03-21 at 06:22 -0600, Jim C. Nasby wrote: > > Currently, it appears that SELECT * INTO new_table FROM old_table logs > > each page as it's written to WAL. Is this actually needed? Couldn't the > > database simply log that the SELECT ... INTO statement was executed > > instead? Doing so would likely result in a large performance improvement > > in most installs. Is there no provision for writing anything but data > > page changes (or whole pages) to WAL? > > AFAIK it takes the same code path as CREATE TABLE AS SELECT, which > already does exactly what you suggest (except when using PITR). > As I read, they did take the same code path, but did they "simply log that the SELECT ... INTO statement was executed"? If so, how can we rely on the unreliable content of the old_table to do recovery? Regards, Qingqing From pgsql-performance-owner@postgresql.org Wed Mar 22 04:04:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9BB129DD572 for ; Wed, 22 Mar 2006 04:04: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 83169-07 for ; Wed, 22 Mar 2006 04:04:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id DAADB9DD447 for ; Wed, 22 Mar 2006 04:04:33 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id E0AE5A8323; Wed, 22 Mar 2006 09:04:42 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 30380-08; Wed, 22 Mar 2006 09:04:42 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 7B07DA82B9; Wed, 22 Mar 2006 09:04:42 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 12D2E1835B0; Wed, 22 Mar 2006 09:04:30 +0100 (CET) To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> <20060321095049.GW15742@pervasive.com> <441FD82D.1040509@paradise.net.nz> <20060321115100.GM15742@pervasive.com> <87acbkkl0o.fsf@meuh.mnc.lan> <20060321174903.GG15742@pervasive.com> X-Hashcash: 1:20:060322:jnasby@pervasive.com::kshc8BkvFJ+6eUIc:0000000000000000000000000000000000000000038+4 X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::RfSIz8e9mhQAKA5c:000000000000000000000000000002CTd From: Guillaume Cottenceau Date: 22 Mar 2006 09:04:29 +0100 In-Reply-To: <20060321174903.GG15742@pervasive.com> Message-ID: <87slpaj46q.fsf@meuh.mnc.lan> Lines: 40 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: amavisd-new at mnc.ch X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.104 required=5 tests=[AWL=0.104] X-Spam-Score: 0.104 X-Spam-Level: X-Archive-Number: 200603/439 X-Sequence-Number: 17876 "Jim C. Nasby" writes: > On Tue, Mar 21, 2006 at 02:03:19PM +0100, Guillaume Cottenceau wrote: > > "Jim C. Nasby" writes: > > > > > On Tue, Mar 21, 2006 at 10:40:45PM +1200, Mark Kirkwood wrote: > > > > I was going to recommend higher - but not knowing what else was running, > > > > kept it to quite conservative :-)... and given he's running java, the > > > > JVM could easily eat 512M all by itself! > > > > > > Oh, didn't pick up on java being in the mix. Yeah, it can be a real pig. > > > I think people often place too much emphasis on having a seperate > > > application server, but in the case of java you often have no choice. > > > > Fortunately the servers use 2G or 4G of memory, only my test > > machine had 1G, as I believe I precised in a message; so I'm > > definitely going to use Mark's advices to enlarge a lot the > > shared buffers. Btw, what about sort_mem? I have seen it only > > little referenced in the documentation. > > The biggest issue with setting work_mem (you're not doing current > development on 7.4 are you?) is ensuring that you don't push the server Yes, we use 7.4.5 actually, because "it just works", so production wants to first deal with all the things that don't work before upgrading. I have recently discovered about the background writer of 8.x which could be a supplementary reason to push for an ugprade though. > into swapping. Remember that work_mem controls how much memory can be > used for EACH sort or hash (maybe others) operation. Each query can > consume multiples of work_mem (since it can do multiple sorts, for > example), and of course each backend could be running a query at the > same time. Because of all this it's pretty difficult to make work_mem > recomendations without knowing a lot more about your environment. Ok, I see. Thanks for the info! -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Wed Mar 22 05:04:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A42759DCB76 for ; Wed, 22 Mar 2006 05:04: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 91854-08 for ; Wed, 22 Mar 2006 05:04:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) by postgresql.org (Postfix) with ESMTP id 5C4509DCA6A for ; Wed, 22 Mar 2006 05:04:22 -0400 (AST) Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by mail.wirelesscar.com with InterScan Messaging Security Suite; Wed, 22 Mar 2006 10:04:21 +0100 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: Migration study, step 1: bulk write performanceoptimization Date: Wed, 22 Mar 2006 10:04:49 +0100 Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B08828E@sesrv12.wirelesscar.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Migration study, step 1: bulk write performanceoptimization Thread-Index: AcZNKGLPDW19oqiJQBuSe0KDTnXqSQAYfWog From: "Mikael Carneholm" To: "Simon Riggs" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.13 required=5 tests=[AWL=0.130] X-Spam-Score: 0.13 X-Spam-Level: X-Archive-Number: 200603/440 X-Sequence-Number: 17877 >>On Mon, 2006-03-20 at 15:59 +0100, Mikael Carneholm wrote: >> This gives that 10Gb takes ~380s =3D> ~27Mb/s (with fsync=3Doff), = compared to the raw dd result (~75.5Mb/s). >>=20 >> I assume this difference is due to:=20 >> - simultaneous WAL write activity (assumed: for each byte written to = the table, at least one byte is also written to WAL, in effect: 10Gb = data inserted in the table equals 20Gb written to disk) >> - lousy test method (it is done using a function =3D> the transaction = size is 10Gb, and 10Gb will *not* fit in wal_buffers :) ) >> - poor config >> checkpoint_segments =3D 3 =20 >With those settings, you'll be checkpointing every 48 Mb, which will be >every about once per second. Since the checkpoint will take a = reasonable >amount of time, even with fsync off, you'll be spending most of your >time checkpointing. bgwriter will just be slowing you down too because >you'll always have more clean buffers than you can use, since you have >132MB of shared_buffers, yet flushing all of them every checkpoint. >Please read you're logfile, which should have relevant WARNING = messages. It does ("LOG: checkpoints are occurring too frequently (2 seconds = apart)") However, I tried increasing checkpoint_segments to 32 (512Mb) = making it checkpoint every 15 second or so, but that gave a more uneven = insert rate than with checkpoint_segments=3D3. Maybe 64 segments = (1024Mb) would be a better value? If I set checkpoint_segments to 64, = what would a reasonable bgwriter setup be? I still need to improve my = understanding of the relations between checkpoint_segments <-> = shared_buffers <-> bgwriter... :/ - Mikael From pgsql-performance-owner@postgresql.org Wed Mar 22 05:18:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5A9359DD572 for ; Wed, 22 Mar 2006 05:18: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 93925-07 for ; Wed, 22 Mar 2006 05:18:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from maya.ngi.it (ns2.ngi.it [88.149.128.3]) by postgresql.org (Postfix) with ESMTP id 2C0F39DD560 for ; Wed, 22 Mar 2006 05:18:22 -0400 (AST) Received: from [192.168.0.11] (194-185-53-252.f5.ngi.it [194.185.53.252]) by maya.ngi.it (8.13.5/8.13.5) with ESMTP id k2M9IMdp017634 for ; Wed, 22 Mar 2006 10:18:23 +0100 Message-ID: <4421165E.4070800@bluestudio.it> Date: Wed, 22 Mar 2006 10:18:22 +0100 From: Marco Furetto User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query Feromance References: <441EC34D.1000901@bluestudio.it> <001301c64c3c$3404b3f0$8b00000a@reimer> <441FB88E.2060801@bluestudio.it> <200603210943.57454.mlists@rp-online.de> In-Reply-To: <200603210943.57454.mlists@rp-online.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.683 required=5 tests=[AWL=0.683] X-Spam-Score: 0.683 X-Spam-Level: X-Archive-Number: 200603/441 X-Sequence-Number: 17878 I find another java program for monitory application query: http://www.p6spy.com/ with interface http://www.jahia.net/jahia/page597.html Thomas Pundt wrote: > Hi, > > On Tuesday 21 March 2006 09:25, Marco Furetto wrote: > | I'm managing the db of a "Content Management environment" and I'm > | searching for a "Query analyzer" to improve performance because i don't > | know how many and what type of queries are executing on the system (for > | the "where and join" block). > > as a first step, I'd enable query duration logging; in postgresql.conf > I have set > > log_min_duration_statement = 3000 > > this will log each query that needs more than 3 seconds to complete. > > The next step would be to "explain analyze" the problematic queries. > > Ciao, > Thomas > From pgsql-performance-owner@postgresql.org Wed Mar 22 05:48:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 707B79DC80A for ; Wed, 22 Mar 2006 05: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 96953-07 for ; Wed, 22 Mar 2006 05:48: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 861859DC800 for ; Wed, 22 Mar 2006 05:48:00 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 2BD5033BADE; Wed, 22 Mar 2006 09:46:36 +0000 (GMT) Subject: Re: Migration study, step 1: bulk write From: Simon Riggs To: Mikael Carneholm Cc: pgsql-performance@postgresql.org In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B08828E@sesrv12.wirelesscar.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B08828E@sesrv12.wirelesscar.com> Content-Type: text/plain Date: Wed, 22 Mar 2006 09:46:29 +0000 Message-Id: <1143020789.24487.563.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.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/442 X-Sequence-Number: 17879 On Wed, 2006-03-22 at 10:04 +0100, Mikael Carneholm wrote: > but that gave a more uneven insert rate Not sure what you mean, but happy to review test results. You should be able to tweak other parameters from here as you had been trying. Your bgwriter will be of some benefit now if you set it aggressively enough to keep up. Your thoughts on this process are welcome... Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Mar 22 07:50:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B2B8C9DC86F for ; Wed, 22 Mar 2006 07:50: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 18301-10 for ; Wed, 22 Mar 2006 07:50:22 -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 0C7E79DCD9B for ; Wed, 22 Mar 2006 07:50:17 -0400 (AST) Received: by zproxy.gmail.com with SMTP id v1so142872nzb for ; Wed, 22 Mar 2006 03:50:21 -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=p6QKgpYLPtAgvCAM4+MzwngfaOETPWEsrc2JwTLT+eb/8qT3n2kL2+XFDdGgMnxuMJjD4/PrWq6r/9rse/9f5NUKmA9rYovDiiH7VVb2V+1EMj4ed/upSxbUJcYLr5CywUBEkf8hSzwu2JER+oGvUO5kIUTVASV6TeWtIHO0BBc= Received: by 10.37.14.68 with SMTP id r68mr962582nzi; Wed, 22 Mar 2006 03:50:20 -0800 (PST) Received: by 10.37.13.49 with HTTP; Wed, 22 Mar 2006 03:50:20 -0800 (PST) Message-ID: <8398dc6d0603220350x4ee9c298h@mail.gmail.com> Date: Wed, 22 Mar 2006 08:50:20 -0300 From: "Alejandro D. Burne" To: pgsql-performance@postgresql.org Subject: Re: Sequence Scan vs. Index scan In-Reply-To: <001a01c64d14$80f4a840$8b00000a@reimer> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_17771_6950723.1143028220872" References: <44204107.3040708@mandic.com.br> <001a01c64d14$80f4a840$8b00000a@reimer> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.117 required=5 tests=[AWL=0.116, HTML_MESSAGE=0.001] X-Spam-Score: 0.117 X-Spam-Level: X-Archive-Number: 200603/443 X-Sequence-Number: 17880 ------=_Part_17771_6950723.1143028220872 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2006/3/21, Reimer : > > Fernando, > > If you need to read all the table for example it would be better to read > only the data pages instead of read data and index pages. > > Reimer > > ----- Original Message ----- > From: "Fernando Lujan" > To: > Sent: Tuesday, March 21, 2006 3:08 PM > Subject: [PERFORM] Sequence Scan vs. Index scan > > > > Hi guys, > > > > I'm trying to figure out when Sequence Scan is better than Index Scan. = I > > just want to know this because I disabled the sequence scan in > postgresql > > and receive a better result. :) > > > > Two tables. > > > > Table 1 (1 million rows ) > > ----------- > > id > > text > > table2_id > > > > Table 2 (300 thousand rows) > > ---------- > > id > > text 2 > > > > When I join these two tables I have a sequence_scan. :( > > > > Thanks in advance. > > > > Fernando Lujan > > > > ---------------------------(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 > Hi, I've got the same situation: ENABLE_SEQSCAN ON -> 5,031 ms ENABLE_SEQSCAN OFF -> 406 ms Tables definition: ----------------------- CREATE TABLE liquidacionesos ( codigoliquidacionos serial NOT NULL, codigoobrasocial int4 NOT NULL, quincena char(1) NOT NULL, per_m char(2) NOT NULL, per_a char(4) NOT NULL, nombreliquidacion varchar(60) NOT NULL, codigotipoliquidacionos int2 NOT NULL, importe numeric(12,2) NOT NULL, conformado bool NOT NULL, facturada bool NOT NULL, codigoremito int4 NOT NULL DEFAULT 0, codigoprofesion int2 NOT NULL DEFAULT 0, matriculaprofesional int4 NOT NULL DEFAULT 0, letrafactura char(1) NOT NULL DEFAULT ' '::bpchar, numerofactura varchar(13) NOT NULL DEFAULT '0000-00000000'::character varying, importegravado numeric(12,2) NOT NULL DEFAULT 0, importenogravado numeric(12,2) NOT NULL DEFAULT 0, importeiva numeric(12,2) NOT NULL DEFAULT 0, importefactura numeric(12,2) NOT NULL DEFAULT 0, fechahora_cga timestamp NOT NULL DEFAULT now(), userid varchar(20) NOT NULL DEFAULT "current_user"(), numerosecuencia int4 NOT NULL DEFAULT 0, CONSTRAINT liqos_pkey PRIMARY KEY (codigoliquidacionos) ) WITHOUT OIDS TABLESPACE data; ALTER TABLE liquidacionesos ALTER COLUMN codigoliquidacionos SET STATISTICS 100; ALTER TABLE liquidacionesos ALTER COLUMN per_a SET STATISTICS 100; ALTER TABLE liquidacionesos ALTER COLUMN per_m SET STATISTICS 100; ALTER TABLE liquidacionesos ALTER COLUMN quincena SET STATISTICS 100; ALTER TABLE liquidacionesos ALTER COLUMN codigoobrasocial SET STATISTICS 100; CREATE INDEX ixliqos_periodo ON liquidacionesos USING btree (per_a, per_m, quincena); CREATE TABLE detalleprestaciones ( codigoliquidacionos int4 NOT NULL, numerosecuencia int4 NOT NULL, codigoprofesionclisanhosp int2 NOT NULL, matriculaprofesionalclisanhosp int4 NOT NULL, codigoctmclisanhosp int4 NOT NULL, codigoprofesionefector int2 NOT NULL, matriculaprofesionalefector int4 NOT NULL, codigoctmefector int4 NOT NULL, fechaprestacion date NOT NULL, codigonn char(6) NOT NULL, cantidad int2 NOT NULL, codigofacturacion int2 NOT NULL, porcentajehonorarios numeric(6,2) NOT NULL, porcentajederechos numeric(6,2) NOT NULL, importehonorarios numeric(12,2) NOT NULL, importederechos numeric(12,2) NOT NULL, importegastos numeric(12,2) NOT NULL, importegastosnogravados numeric(12,2) NOT NULL, importecompensacion numeric(12,2) NOT NULL, codigopadron int2 NOT NULL, codigoafiliado char(15) NOT NULL, numerobono varchar(15) NOT NULL, matriculaprofesionalprescriptor int4 NOT NULL, codigodevolucion int2 NOT NULL, importeforzado bool NOT NULL, codigotramo int2 NOT NULL DEFAULT 0, campocomodin int2 NOT NULL, fechahora_cga timestamp NOT NULL DEFAULT now(), userid varchar(20) NOT NULL DEFAULT "current_user"(), CONSTRAINT dp_pkey PRIMARY KEY (codigoliquidacionos, numerosecuencia) ) WITHOUT OIDS TABLESPACE data; ALTER TABLE detalleprestaciones ALTER COLUMN codigoliquidacionos SET STATISTICS 100; both vacummed and analyzed table detalleprestaciones 5,408,590 rec table liquidacionesos 16,752 rec Query: -------- SELECT DP.CodigoProfesionEfector, DP.MatriculaProfesionalEfector, SUM((ImporteHonorarios+ImporteD erechos+ImporteCompensacion)*Cantidad+ImporteGastos+ImporteGastosNoGravados= ) AS Importe FROM DetallePrestaciones DP INNER JOIN LiquidacionesOS L ON DP.CodigoLiquidacionOS=3DL.CodigoLiquidacionOS WHERE L.Per_a=3D'2005' AND L.Facturada AND L.CodigoObraSocial IN(54) GROUP BY DP.CodigoProfesionEfector, DP.MatriculaProfesionalEfector; Explains: ------------ With SET ENABLE_SEQSCAN TO ON; HashAggregate (cost=3D251306.99..251627.36 rows=3D11650 width=3D78) -> Hash Join (cost=3D1894.30..250155.54 rows=3D153526 width=3D78) Hash Cond: ("outer".codigoliquidacionos =3D "inner".codigoliquidacionos) -> Seq Scan on detalleprestaciones dp=20 (cost=3D0.00..219621.32rows=3D5420932 width=3D82) -> Hash (cost=3D1891.01..1891.01 rows=3D1318 width=3D4) -> Bitmap Heap Scan on liquidacionesos l (cost=3D 43.89..1891.01 rows=3D1318 width=3D4) Recheck Cond: (codigoobrasocial =3D 54) Filter: ((per_a =3D '2005'::bpchar) AND facturada) -> Bitmap Index Scan on ixliqos_os=20 (cost=3D0.00..43.89rows=3D4541 width=3D0) Index Cond: (codigoobrasocial =3D 54) With SET ENABLE_SEQSCAN TO OFF; HashAggregate (cost=3D2943834.84..2944155.21 rows=3D11650 width=3D78) -> Nested Loop (cost=3D0.00..2942683.39 rows=3D153526 width=3D78) -> Index Scan using liqos_pkey on liquidacionesos l (cost=3D 0.00..3020.21 rows=3D1318 width=3D4) Filter: ((per_a =3D '2005'::bpchar) AND facturada AND (codigoobrasocial =3D 54)) -> Index Scan using dp_pkey on detalleprestaciones dp (cost=3D 0.00..2214.90 rows=3D1240 width=3D82) Index Cond: (dp.codigoliquidacionos =3D "outer".codigoliquidacionos) Thanks for your time!!!! Alejandro ------=_Part_17771_6950723.1143028220872 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2006/3/21, Reimer <carlosre= imer@terra.com.br>:
Fernando,

If you need to read all the table for example it would be = better to read
only the data pages instead of read data and index pages.=

Reimer

----- Original Message -----
From: "Fernando = Lujan" < fernando.lujan@mandic.com.b= r>
To: <pg= sql-performance@postgresql.org>
Sent: Tuesday, March 21, 2006 3:0= 8 PM
Subject: [PERFORM] Sequence Scan vs. Index scan


> Hi guys= ,
>
> I'm trying to figure out when Sequence Scan is better tha= n Index Scan. I
> just want to know this because I disabled the seque= nce scan in postgresql
> and receive a better result. :)
>
> Two tables.
>= ;
> Table 1 (1 million rows )
> -----------
> id
> = text
> table2_id
>
> Table 2 (300 thousand rows)
> = ----------
> id
> text 2
>
> When I join these two tables I h= ave a sequence_scan. :(
>
> Thanks in advance.
>
> = Fernando Lujan
>
> ---------------------------(end of broadcast= )---------------------------
> TIP 6: explain analyze is your friend
>


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

Hi, I've got the same situation:

ENABLE_SEQSCAN ON  -> 5,031 ms
ENABLE_SEQSCAN OFF  -> 406 ms

Tables definition:
-----------------------

CREATE TABLE liquidacionesos
(
  codigoliquidacionos serial NOT NULL,
  codigoobrasocial int4 NOT NULL,
  quincena char(1) NOT NULL,
  per_m char(2) NOT NULL,
  per_a char(4) NOT NULL,
  nombreliquidacion varchar(60) NOT NULL,
  codigotipoliquidacionos int2 NOT NULL,
  importe numeric(12,2) NOT NULL,
  conformado bool NOT NULL,
  facturada bool NOT NULL,
  codigoremito int4 NOT NULL DEFAULT 0,
  codigoprofesion int2 NOT NULL DEFAULT 0,
  matriculaprofesional int4 NOT NULL DEFAULT 0,
  letrafactura char(1) NOT NULL DEFAULT ' '::bpchar,
  numerofactura varchar(13) NOT NULL DEFAULT '0000-00000000'::characte= r varying,
  importegravado numeric(12,2) NOT NULL DEFAULT 0,
  importenogravado numeric(12,2) NOT NULL DEFAULT 0,
  importeiva numeric(12,2) NOT NULL DEFAULT 0,
  importefactura numeric(12,2) NOT NULL DEFAULT 0,
  fechahora_cga timestamp NOT NULL DEFAULT now(),
  userid varchar(20) NOT NULL DEFAULT "current_user"(),
  numerosecuencia int4 NOT NULL DEFAULT 0,
  CONSTRAINT liqos_pkey PRIMARY KEY (codigoliquidacionos)
)
WITHOUT OIDS TABLESPACE data;
ALTER TABLE liquidacionesos ALTER COLUMN codigoliquidacionos SET STATISTICS= 100;
ALTER TABLE liquidacionesos ALTER COLUMN per_a SET STATISTICS 100;
ALTER TABLE liquidacionesos ALTER COLUMN per_m SET STATISTICS 100;
ALTER TABLE liquidacionesos ALTER COLUMN quincena SET STATISTICS 100;
ALTER TABLE liquidacionesos ALTER COLUMN codigoobrasocial SET STATISTICS 10= 0;
CREATE INDEX ixliqos_periodo
  ON liquidacionesos
  USING btree
  (per_a, per_m, quincena);


CREATE TABLE detalleprestaciones
(
  codigoliquidacionos int4 NOT NULL,
  numerosecuencia int4 NOT NULL,
  codigoprofesionclisanhosp int2 NOT NULL,
  matriculaprofesionalclisanhosp int4 NOT NULL,
  codigoctmclisanhosp int4 NOT NULL,
  codigoprofesionefector int2 NOT NULL,
  matriculaprofesionalefector int4 NOT NULL,
  codigoctmefector int4 NOT NULL,
  fechaprestacion date NOT NULL,
  codigonn char(6) NOT NULL,
  cantidad int2 NOT NULL,
  codigofacturacion int2 NOT NULL,
  porcentajehonorarios numeric(6,2) NOT NULL,
  porcentajederechos numeric(6,2) NOT NULL,
  importehonorarios numeric(12,2) NOT NULL,
  importederechos numeric(12,2) NOT NULL,
  importegastos numeric(12,2) NOT NULL,
  importegastosnogravados numeric(12,2) NOT NULL,
  importecompensacion numeric(12,2) NOT NULL,
  codigopadron int2 NOT NULL,
  codigoafiliado char(15) NOT NULL,
  numerobono varchar(15) NOT NULL,
  matriculaprofesionalprescriptor int4 NOT NULL,
  codigodevolucion int2 NOT NULL,
  importeforzado bool NOT NULL,
  codigotramo int2 NOT NULL DEFAULT 0,
  campocomodin int2 NOT NULL,
  fechahora_cga timestamp NOT NULL DEFAULT now(),
  userid varchar(20) NOT NULL DEFAULT "current_user"(),
  CONSTRAINT dp_pkey PRIMARY KEY (codigoliquidacionos, numerosecuencia= )
)
WITHOUT OIDS TABLESPACE data;
ALTER TABLE detalleprestaciones ALTER COLUMN codigoliquidacionos SET STATIS= TICS 100;

both vacummed and analyzed
table detalleprestaciones 5,408,590 rec
table liquidacionesos 16,752 rec

Query:
--------

SELECT DP.CodigoProfesionEfector, DP.MatriculaProfesionalEfector,
SUM((ImporteHonorarios+ImporteD
erechos+ImporteCompensacion)*Cantidad+ImporteGastos+Import= eGastosNoGravados) AS Importe
FROM DetallePrestaciones DP INNER JOIN LiquidacionesOS L ON DP.CodigoLiquid= acionOS=3DL.CodigoLiquidacionOS
WHERE L.Per_a=3D'2005' AND L.Facturada AND L.CodigoObraSocial IN(54)
GROUP BY DP.CodigoProfesionEfector, DP.MatriculaProfesionalEfector;

Explains:
------------
With SET ENABLE_SEQSCAN TO ON;
HashAggregate  (cost=3D251306.99..251627.36 rows=3D11650 width=3D78)   ->  Hash Join  (cost=3D1894.30..250155.54 rows=3D153526= width=3D78)
        Hash Cond: ("outer".co= digoliquidacionos =3D "inner".codigoliquidacionos)
        ->  Seq Scan on detalleprestaciones dp  (cost=3D0.00..219621.32 rows=3D5420932 width=3D82)
        ->  Hash  (cost=3D1= 891.01..1891.01 rows=3D1318 width=3D4)
            &nb= sp; ->  Bitmap Heap Scan on liquidacionesos l  (cost=3D43.89..1891.01 rows=3D1318 width=3D4)
            &nb= sp;       Recheck Cond: (codigoobrasocial =3D 54)
            &nb= sp;       Filter: ((per_a =3D '2005'::bpchar) AND facturada)
            &nb= sp;       ->  Bitmap Index Scan on ixliqos_os  (cost=3D0.00..43.89 rows=3D4541 width=3D0)
        &= nbsp;           &nbs= p;     Index Cond: (codigoobrasocial =3D 54)

With SET ENABLE_SEQSCAN TO OFF;
HashAggregate  (cost=3D2943834.84..2944155.21 rows=3D11650 width=3D78)=
  ->  Nested Loop  (cost=3D0.00..2942683.39 rows=3D153526= width=3D78)
        ->  Index Scan using liqos_pkey on liquidacionesos l  (cost=3D0.00..3020.21 rows=3D1318 width=3D4)
            &nb= sp; Filter: ((per_a =3D '2005'::bpchar) AND facturada AND (codigoobrasocial =3D 54))
        ->  Index Scan using dp_pkey on detalleprestaciones dp  (cost=3D0.00..2214.90 rows=3D1240 width=3D82)
            &nb= sp; Index Cond: (dp.codigoliquidacionos =3D "outer".codigoliquidacion= os)

Thanks for your time!!!!
Alejandro

------=_Part_17771_6950723.1143028220872-- From pgsql-performance-owner@postgresql.org Wed Mar 22 08:12:58 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EA8359DCD58 for ; Wed, 22 Mar 2006 08:12: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 24549-09 for ; Wed, 22 Mar 2006 08:12:59 -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 E37FA9DCC5B for ; Wed, 22 Mar 2006 08:12:53 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FM2Cs-0007KG-9o for pgsql-performance@postgresql.org; Wed, 22 Mar 2006 13:12:54 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FM2DV-0007Cf-00 for ; Wed, 22 Mar 2006 13:13:33 +0100 Date: Wed, 22 Mar 2006 13:13:33 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Sequence Scan vs. Index scan Message-ID: <20060322121333.GB27640@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <44204107.3040708@mandic.com.br> <001a01c64d14$80f4a840$8b00000a@reimer> <8398dc6d0603220350x4ee9c298h@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <8398dc6d0603220350x4ee9c298h@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+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.089 required=5 tests=[AWL=0.089, UPPERCASE_25_50=0] X-Spam-Score: 0.089 X-Spam-Level: X-Archive-Number: 200603/444 X-Sequence-Number: 17881 On Wed, Mar 22, 2006 at 08:50:20AM -0300, Alejandro D. Burne wrote: > Explains: > ------------ > With SET ENABLE_SEQSCAN TO ON; > HashAggregate (cost=251306.99..251627.36 rows=11650 width=78) You'll need to post EXPLAIN ANALYZE results, not just EXPLAIN. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Mar 22 08:24:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 402879DD56B for ; Wed, 22 Mar 2006 08: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 29823-05-2 for ; Wed, 22 Mar 2006 08:24:27 -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 1BE4B9DD560 for ; Wed, 22 Mar 2006 08:24:21 -0400 (AST) Received: by zproxy.gmail.com with SMTP id n1so171923nzf for ; Wed, 22 Mar 2006 04:24: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:references; b=BUW6fhHinwUnltigz3vnvLPDgB8gzqbZxWgtmPF6e+cCwn1MuQjRm1MZz93+TmGhLBa2V2F3wmybcvFkglEpB4U7h9Gh21ta1WhYXIlPpEOvm44dhFCZ+e6RTbRKQ/3bXrDnZr7F6mxuzeJXj2U2mMg6xnDs2Rb5t5X5MjJbnAA= Received: by 10.37.14.68 with SMTP id r68mr997715nzi; Wed, 22 Mar 2006 04:24:23 -0800 (PST) Received: by 10.37.13.49 with HTTP; Wed, 22 Mar 2006 04:23:53 -0800 (PST) Message-ID: <8398dc6d0603220423i24ae9d41k@mail.gmail.com> Date: Wed, 22 Mar 2006 09:23:53 -0300 From: "Alejandro D. Burne" To: pgsql-performance@postgresql.org Subject: Re: Sequence Scan vs. Index scan In-Reply-To: <20060322121333.GB27640@uio.no> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_17787_25182699.1143030233867" References: <44204107.3040708@mandic.com.br> <001a01c64d14$80f4a840$8b00000a@reimer> <8398dc6d0603220350x4ee9c298h@mail.gmail.com> <20060322121333.GB27640@uio.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.099 required=5 tests=[AWL=0.098, HTML_MESSAGE=0.001] X-Spam-Score: 0.099 X-Spam-Level: X-Archive-Number: 200603/445 X-Sequence-Number: 17882 ------=_Part_17787_25182699.1143030233867 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2006/3/22, Steinar H. Gunderson : > > On Wed, Mar 22, 2006 at 08:50:20AM -0300, Alejandro D. Burne wrote: > > Explains: > > ------------ > > With SET ENABLE_SEQSCAN TO ON; > > HashAggregate (cost=3D251306.99..251627.36 rows=3D11650 width=3D78) > > You'll need to post EXPLAIN ANALYZE results, not just EXPLAIN. > > /* Steinar */ > -- > Homepage: http://www.sesse.net/ > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > Sorry, this is the result: WITH SET ENABLE_SEQSCAN TO ON; HashAggregate (cost=3D251306.99..251627.36 rows=3D11650 width=3D78) (actua= l time=3D 25089.024..25090.340 rows=3D1780 loops=3D1) -> Hash Join (cost=3D1894.30..250155.54 rows=3D153526 width=3D78) (actu= al time=3D3190.599..24944.418 rows=3D38009 loops=3D1) Hash Cond: ("outer".codigoliquidacionos =3D "inner".codigoliquidacionos) -> Seq Scan on detalleprestaciones dp=20 (cost=3D0.00..219621.32rows=3D5420932 width=3D82) (actual time=3D 0.058..23198.852 rows=3D5421786 loops=3D1) -> Hash (cost=3D1891.01..1891.01 rows=3D1318 width=3D4) (actual t= ime=3D 60.777..60.777 rows=3D1530 loops=3D1) -> Bitmap Heap Scan on liquidacionesos l (cost=3D 43.89..1891.01 rows=3D1318 width=3D4) (actual time=3D1.843..59.574 rows=3D1= 530 loops=3D1) Recheck Cond: (codigoobrasocial =3D 54) Filter: ((per_a =3D '2005'::bpchar) AND facturada) -> Bitmap Index Scan on ixliqos_os=20 (cost=3D0.00..43.89rows=3D4541 width=3D0) (actual time=3D 1.439..1.439 rows=3D4736 loops=3D1) Index Cond: (codigoobrasocial =3D 54) Total runtime: 25090.920 ms WITH SET ENABLE_SEQSCAN TO OFF; HashAggregate (cost=3D2943834.84..2944155.21 rows=3D11650 width=3D78) (act= ual time=3D1479.361..1480.641 rows=3D1780 loops=3D1) -> Nested Loop (cost=3D0.00..2942683.39 rows=3D153526 width=3D78) (actu= al time=3D195.690..1345.494 rows=3D38009 loops=3D1) -> Index Scan using liqos_pkey on liquidacionesos l (cost=3D 0.00..3020.21 rows=3D1318 width=3D4) (actual time=3D174.546..666.761 rows= =3D1530 loops=3D1) Filter: ((per_a =3D '2005'::bpchar) AND facturada AND (codigoobrasocial =3D 54)) -> Index Scan using dp_pkey on detalleprestaciones dp (cost=3D 0.00..2214.90 rows=3D1240 width=3D82) (actual time=3D0.333..0.422 rows=3D25 loops=3D1530) Index Cond: (dp.codigoliquidacionos =3D "outer".codigoliquidacionos) Total runtime: 1481.244 ms Thanks again, Alejandro ------=_Part_17787_25182699.1143030233867 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2006/3/22, Steinar H. Gunderson <sgunderson@bigfoot.com>:
<= blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 2= 04, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> On Wed, Mar 22, 2006 at 08:50:20AM -0300, Alejandro D. Burne wrote:
>= Explains:
> ------------
> With SET ENABLE_SEQSCAN TO ON;
&= gt; HashAggregate  (cost=3D251306.99..251627.36 rows=3D11650 widt= h=3D78)

You'll need to post EXPLAIN ANALYZE results, not just EXPLAIN.

/* St= einar */
--
Homepage: http://www.se= sse.net/

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

Sorry, this is the result:

WITH SET ENABLE_SEQSCAN TO ON;

HashAggregate  (cost=3D251306.99..251627.36 rows=3D11650 width=3D78) (= actual time=3D25089.024..25090.340 rows=3D1780 loops=3D1)
  ->  Hash Join  (cost=3D1894.30..250155.54 rows=3D153526 width=3D78) (actual time=3D3190.599..24944.418 rows=3D38009 loops=3D1)
        Hash Cond: ("outer".co= digoliquidacionos =3D "inner".codigoliquidacionos)
        ->  Seq Scan on detalleprestaciones dp  (cost=3D0.00..219621.32 rows=3D5420932 width=3D82) (actual time=3D0.058..23198.852 rows=3D5421786 loops=3D1)
        ->  Hash  (cost=3D1891.01..1891.01 rows=3D1318 width=3D4) (actual time=3D60.777..60.7= 77 rows=3D1530 loops=3D1)
            &nb= sp; ->  Bitmap Heap Scan on liquidacionesos l  (cost=3D43.89..1891.01 rows=3D1318 width=3D4) (actual time=3D1.843..59.574 rows=3D1530 loops=3D1)
            &nb= sp;       Recheck Cond: (codigoobrasocial =3D 54)
            &nb= sp;       Filter: ((per_a =3D '2005'::bpchar) AND facturada)
            &nb= sp;       ->  Bitmap Index Scan on ixliqos_os  (cost=3D0.00..43.89 rows=3D4541 width=3D0) (actual time=3D1.439..1.439 rows=3D4736 loops=3D1)             &nb= sp;             Index Cond: (codigoobrasocial =3D 54)
Total runtime: 25090.920 ms

WITH SET ENABLE_SEQSCAN TO OFF;
HashAggregate  (cost=3D2943834.84..2944155.21 rows=3D11650 width=3D78)= (actual time=3D1479.361..1480.641 rows=3D1780 loops=3D1)
  ->  Nested Loop  (cost=3D0.00..2942683.39 rows=3D153526 width=3D78) (actual time=3D195.690..1345.494 rows=3D38009 loops=3D1)
        ->  Index Scan using liqos_pkey on liquidacionesos l  (cost=3D0.00..3020.21 rows=3D1318 width=3D4) (actual time=3D174.546..666.761 rows=3D1530 loops=3D1)
            &nb= sp; Filter: ((per_a =3D '2005'::bpchar) AND facturada AND (codigoobrasocial =3D 54))
        ->  Index Scan using dp_pkey on detalleprestaciones dp  (cost=3D0.00..2214.90 rows=3D1240 width=3D82) (actual time=3D0.333..0.422 rows=3D25 loops=3D1530)
            &nb= sp; Index Cond: (dp.codigoliquidacionos =3D "outer".codigoliquidacion= os)
Total runtime: 1481.244 ms

Thanks again, Alejandro
------=_Part_17787_25182699.1143030233867-- From pgsql-performance-owner@postgresql.org Wed Mar 22 08:25:45 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 33E879DCC73 for ; Wed, 22 Mar 2006 08:25: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 32212-02 for ; Wed, 22 Mar 2006 08:25:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id E3DAE9DCC5B for ; Wed, 22 Mar 2006 08:25:42 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 55A2C56423; Wed, 22 Mar 2006 06:25:46 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 22 Mar 2006 06:25:45 -0600 Date: Wed, 22 Mar 2006 06:25:45 -0600 From: "Jim C. Nasby" To: "Craig A. James" Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Poor performance o Message-ID: <20060322122545.GZ15742@pervasive.com> References: <43F38867.6010701@gpdnet.co.uk> <19510.1140036968@sss.pgh.pa.us> <19779.1140038874@sss.pgh.pa.us> <43F39E53.1020009@gpdnet.co.uk> <20781.1140046109@sss.pgh.pa.us> <19570.1142971720@sss.pgh.pa.us> <442080D1.5090803@modgraph-usa.com> <6629.1142983995@sss.pgh.pa.us> <4420A290.2050908@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4420A290.2050908@modgraph-usa.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060322:cjames@modgraph-usa.com::Pit/mN+/ykgzZxWw:00000000000000 00000000000000000000000036o+ X-Hashcash: 1:20:060322:tgl@sss.pgh.pa.us::jySSTqPbeJktjay/:00000000000000000000 000000000000000000000000190m X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::6MDqtPq70QDYimP/:00000 0000000000000000000000000KOB X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.107 required=5 tests=[AWL=0.107] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/446 X-Sequence-Number: 17883 On Tue, Mar 21, 2006 at 05:04:16PM -0800, Craig A. James wrote: > Tom Lane wrote: > >"Craig A. James" writes: > >>It looks to me like the problem is the use of nested loops when a hash > >>join should be used, but I'm no expert at query planning. > > > >Given the sizes of the tables involved, you'd likely have to boost up > >work_mem before the planner would consider a hash join. What nondefault > >configuration settings do you have, anyway? > > shared_buffers = 20000 > work_mem = 32768 > effective_cache_size = 300000 > > This is on a 4GB machine. Is there a guideline for work_mem that's related > to table size? Something like, "allow 2 MB per million rows"? No. The general guide is "set it as large as possible without making the machine start swapping." In some cases, you'll want to bump it up much higher for certain queries, especially if you know those queries will only run one at a time. -- 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 Wed Mar 22 08:47:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AFE0A9DCC77 for ; Wed, 22 Mar 2006 08: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 34831-10 for ; Wed, 22 Mar 2006 08:47:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 4992D9DCC61 for ; Wed, 22 Mar 2006 08:47:29 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 860F756423; Wed, 22 Mar 2006 06:47:33 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 22 Mar 2006 06:47:32 -0600 Date: Wed, 22 Mar 2006 06:47:32 -0600 From: "Jim C. Nasby" To: Simon Riggs Cc: pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060322124732.GA15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1142973230.24487.501.camel@localhost.localdomain> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060322:simon@2ndquadrant.com::vpj6Kh8NM6z/g+qD:0000000000000000 000000000000000000000000Eeqi X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::zBIx9C3VjbGl7pEJ:00000 0000000000000000000000001Tf8 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.107 required=5 tests=[AWL=0.107] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/447 X-Sequence-Number: 17884 On Tue, Mar 21, 2006 at 08:33:50PM +0000, Simon Riggs wrote: > On Tue, 2006-03-21 at 06:22 -0600, Jim C. Nasby wrote: > > Currently, it appears that SELECT * INTO new_table FROM old_table logs > > each page as it's written to WAL. Is this actually needed? Couldn't the > > database simply log that the SELECT ... INTO statement was executed > > instead? Doing so would likely result in a large performance improvement > > in most installs. Is there no provision for writing anything but data > > page changes (or whole pages) to WAL? > > AFAIK it takes the same code path as CREATE TABLE AS SELECT, which > already does exactly what you suggest (except when using PITR). Ok, I saw disk activity on the base directory and assumed it was pg_xlog stuff. Turns out that both SELECT INTO and CREATE TABLE AS ignore default_tablepsace and create the new tables in the base directory. I'm guessing that's a bug... (this is on 8.1.2, btw). Also, why do we log rows for CTAS/SELECT INTO when PITR is in use for simple SELECTs (ones that don't call non-deterministic functions)? The data should alread be available AFAICS... -- 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 Wed Mar 22 08:55:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 077C79DCB62 for ; Wed, 22 Mar 2006 08:55: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 35428-10 for ; Wed, 22 Mar 2006 08:55:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id CC31E9DCB34 for ; Wed, 22 Mar 2006 08:55:14 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 6A6D656435; Wed, 22 Mar 2006 06:55:18 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 22 Mar 2006 06:55:17 -0600 Date: Wed, 22 Mar 2006 06:55:17 -0600 From: "Jim C. Nasby" To: Mikael Carneholm Cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performanceoptimization Message-ID: <20060322125516.GB15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B08828E@sesrv12.wirelesscar.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B08828E@sesrv12.wirelesscar.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060322:mikael.carneholm@wirelesscar.com::6h3FNmQnWmpQiQd5:00000 0000000000000000000000005KXB X-Hashcash: 1:20:060322:simon@2ndquadrant.com::JtRTKGL8hFb9dwmm:0000000000000000 0000000000000000000000004gTJ X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::qgiaPmO7tktkYm04:00000 00000000000000000000000053R3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.107 required=5 tests=[AWL=0.107] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/448 X-Sequence-Number: 17885 On Wed, Mar 22, 2006 at 10:04:49AM +0100, Mikael Carneholm wrote: > It does ("LOG: checkpoints are occurring too frequently (2 seconds apart)") However, I tried increasing checkpoint_segments to 32 (512Mb) making it checkpoint every 15 second or so, but that gave a more uneven insert rate than with checkpoint_segments=3. Maybe 64 segments (1024Mb) would be a better value? If I set checkpoint_segments to 64, what would a reasonable bgwriter setup be? I still need to improve my understanding of the relations between checkpoint_segments <-> shared_buffers <-> bgwriter... :/ Probably the easiest way is to set checkpoint_segments to something like 128 or 256 (or possibly higher), and then make bg_writer more aggressive by increasing bgwriter_*_maxpages dramatically (maybe start with 200). You might want to up lru_percent as well, otherwise it will take a minimum of 20 seconds to fully scan. Basically, slowly start increasing settings until performance smooths out. -- 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 Wed Mar 22 09:08:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EB55B9DC86F for ; Wed, 22 Mar 2006 09:08: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 39439-10 for ; Wed, 22 Mar 2006 09:08:46 -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 24CD79DC8AA for ; Wed, 22 Mar 2006 09:08:40 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id DCCF13380D2; Wed, 22 Mar 2006 13:08:40 +0000 (GMT) Subject: Re: WAL logging of SELECT ... INTO command From: Simon Riggs To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org In-Reply-To: <20060322124732.GA15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> Content-Type: text/plain Date: Wed, 22 Mar 2006 13:08:34 +0000 Message-Id: <1143032914.24487.632.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.097 required=5 tests=[AWL=0.097] X-Spam-Score: 0.097 X-Spam-Level: X-Archive-Number: 200603/449 X-Sequence-Number: 17886 On Wed, 2006-03-22 at 06:47 -0600, Jim C. Nasby wrote: > Also, why do we log rows for CTAS/SELECT INTO when PITR is in use for > simple SELECTs (ones that don't call non-deterministic functions)? The > data should alread be available AFAICS... Not sure what you're asking... SELECTs don't produce WAL. PITR wants all changes. Without PITR we can optimise certain logging actions. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Mar 22 09:12:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D8E6E9DCD64 for ; Wed, 22 Mar 2006 09:12: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 40752-08 for ; Wed, 22 Mar 2006 09:12:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) by postgresql.org (Postfix) with ESMTP id CD9A69DD566 for ; Wed, 22 Mar 2006 09:12:42 -0400 (AST) Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by mail.wirelesscar.com with InterScan Messaging Security Suite; Wed, 22 Mar 2006 14:12:15 +0100 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: Migration study, step 1: bulk write performanceoptimization Date: Wed, 22 Mar 2006 14:12:43 +0100 Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B0A02AF@sesrv12.wirelesscar.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Migration study, step 1: bulk write performanceoptimization Thread-Index: AcZNr/aAJURaeUEhSKiZFc263ugkCwAAd8BA From: "Mikael Carneholm" To: "Jim C. Nasby" Cc: "Simon Riggs" , 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: 200603/450 X-Sequence-Number: 17887 Thanks, will try that. I'll report on the progress later, I have some = unit tests to set up first but as soon as that is done I'll go back to = optimizing insert performance. Regards, Mikael. -----Original Message----- From: Jim C. Nasby [mailto:jnasby@pervasive.com] Sent: den 22 mars 2006 13:55 To: Mikael Carneholm Cc: Simon Riggs; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Migration study, step 1: bulk write performanceoptimization On Wed, Mar 22, 2006 at 10:04:49AM +0100, Mikael Carneholm wrote: > It does ("LOG: checkpoints are occurring too frequently (2 seconds = apart)") However, I tried increasing checkpoint_segments to 32 (512Mb) = making it checkpoint every 15 second or so, but that gave a more uneven = insert rate than with checkpoint_segments=3D3. Maybe 64 segments = (1024Mb) would be a better value? If I set checkpoint_segments to 64, = what would a reasonable bgwriter setup be? I still need to improve my = understanding of the relations between checkpoint_segments <-> = shared_buffers <-> bgwriter... :/ Probably the easiest way is to set checkpoint_segments to something like 128 or 256 (or possibly higher), and then make bg_writer more aggressive by increasing bgwriter_*_maxpages dramatically (maybe start with 200). You might want to up lru_percent as well, otherwise it will take a minimum of 20 seconds to fully scan. Basically, slowly start increasing settings until performance smooths out. --=20 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 Wed Mar 22 09:19:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 24A699DCD64 for ; Wed, 22 Mar 2006 09: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 45243-09 for ; Wed, 22 Mar 2006 09:19:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id B95CB9DD560 for ; Wed, 22 Mar 2006 09:19:06 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 976FD56423; Wed, 22 Mar 2006 07:19:10 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 22 Mar 2006 07:19:10 -0600 Date: Wed, 22 Mar 2006 07:19:10 -0600 From: "Jim C. Nasby" To: Simon Riggs Cc: pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060322131910.GC15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> <1143032914.24487.632.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1143032914.24487.632.camel@localhost.localdomain> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060322:simon@2ndquadrant.com::6wI9gF5ZvYqO8hbh:0000000000000000 0000000000000000000000000EHg X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::y/TvKZG/HLBsy2XF:00000 0000000000000000000000000vpQ X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/451 X-Sequence-Number: 17888 On Wed, Mar 22, 2006 at 01:08:34PM +0000, Simon Riggs wrote: > On Wed, 2006-03-22 at 06:47 -0600, Jim C. Nasby wrote: > > > Also, why do we log rows for CTAS/SELECT INTO when PITR is in use for > > simple SELECTs (ones that don't call non-deterministic functions)? The > > data should alread be available AFAICS... > > Not sure what you're asking... SELECTs don't produce WAL. Yes, there'd have to be some special kind of WAL entry that specifies what select statement was used in CTAS. > PITR wants all changes. Without PITR we can optimise certain logging > actions. The only change here is that we're creating a new table based on the results of a SELECT. If that SELECT doesn't use anything that's non-deterministic, then the machine doing the recovery should already have all the data it needs, provided that we log the SELECT that was used in the CTAS. -- 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 Wed Mar 22 10:06:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 868C19DC84C for ; Wed, 22 Mar 2006 10: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 56221-05 for ; Wed, 22 Mar 2006 10:06:16 -0400 (AST) X-Greylist: delayed 00:10:05.122841 by SQLgrey- Received: from colsweeper.cranel.com (newmail.cranel.com [66.192.200.227]) by postgresql.org (Postfix) with ESMTP id D1F7B9DC98B for ; Wed, 22 Mar 2006 10:06:09 -0400 (AST) Received: from POSTOFFICE.cranel.local (exchsvr01.cranel.local) by colsweeper.cranel.com (Clearswift SMTPRS 5.1.7) with ESMTP id for ; Wed, 22 Mar 2006 08:50:10 -0500 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: Intel C/C++ Compiler Tests Date: Wed, 22 Mar 2006 08:56:04 -0500 Message-ID: <82E74D266CB9B44390D3CCE44A781ED9E284B5@POSTOFFICE.cranel.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Intel C/C++ Compiler Tests Thread-Index: AcZNuFxkcqpGyO4kTzKl0IKZpizn/Q== From: "Spiegelberg, Greg" To: 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: 200603/452 X-Sequence-Number: 17889 All, Has anyone tested PostgreSQL 8.1.x compiled with Intel's Linux C/C++ compiler? Greg -- Greg Spiegelberg gspiegelberg@cranel.com ISOdx Product Development Manager Cranel, Inc. =20 From pgsql-performance-owner@postgresql.org Wed Mar 22 10:34:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E81EE9DC99C for ; Wed, 22 Mar 2006 10:34: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 64429-07 for ; Wed, 22 Mar 2006 10:35:02 -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 11DA69DC84C for ; Wed, 22 Mar 2006 10:34: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 k2MEYtd0016143; Wed, 22 Mar 2006 09:34:55 -0500 (EST) To: "Jim C. Nasby" cc: Mikael Carneholm , Simon Riggs , pgsql-performance@postgresql.org Subject: Re: Migration study, step 1: bulk write performanceoptimization In-reply-to: <20060322125516.GB15742@pervasive.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B08828E@sesrv12.wirelesscar.com> <20060322125516.GB15742@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Wed, 22 Mar 2006 06:55:17 -0600" Date: Wed, 22 Mar 2006 09:34:55 -0500 Message-ID: <16142.1143038095@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/453 X-Sequence-Number: 17890 "Jim C. Nasby" writes: > On Wed, Mar 22, 2006 at 10:04:49AM +0100, Mikael Carneholm wrote: >> It does ("LOG: checkpoints are occurring too frequently (2 seconds apart)") However, I tried increasing checkpoint_segments to 32 (512Mb) making it checkpoint every 15 second or so, but that gave a more uneven insert rate than with checkpoint_segments=3. Maybe 64 segments (1024Mb) would be a better value? If I set checkpoint_segments to 64, what would a reasonable bgwriter setup be? I still need to improve my understanding of the relations between checkpoint_segments <-> shared_buffers <-> bgwriter... :/ > Probably the easiest way is to set checkpoint_segments to something like > 128 or 256 (or possibly higher), and then make bg_writer more aggressive > by increasing bgwriter_*_maxpages dramatically (maybe start with 200). Definitely. You really don't want checkpoints happening oftener than once per several minutes (five or ten if possible). Push checkpoint_segments as high as you need to make that happen, and then experiment with making the bgwriter parameters more aggressive in order to smooth out the disk write behavior. Letting the physical writes happen via bgwriter is WAY cheaper than checkpointing. bgwriter parameter tuning is still a bit of a black art, so we'd be interested to hear what works well for you. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Mar 22 11:06:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6CC179DCB8B for ; Wed, 22 Mar 2006 11:06: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 70379-05 for ; Wed, 22 Mar 2006 11:06:13 -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 07CBF9DC83C for ; Wed, 22 Mar 2006 11:06: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 k2MF66EA016481; Wed, 22 Mar 2006 10:06:06 -0500 (EST) To: "Jim C. Nasby" cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command In-reply-to: <20060322131910.GC15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> <1143032914.24487.632.camel@localhost.localdomain> <20060322131910.GC15742@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Wed, 22 Mar 2006 07:19:10 -0600" Date: Wed, 22 Mar 2006 10:06:05 -0500 Message-ID: <16480.1143039965@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/454 X-Sequence-Number: 17891 "Jim C. Nasby" writes: >> PITR wants all changes. Without PITR we can optimise certain logging >> actions. > The only change here is that we're creating a new table based on the > results of a SELECT. If that SELECT doesn't use anything that's > non-deterministic, then the machine doing the recovery should already > have all the data it needs, provided that we log the SELECT that was > used in the CTAS. This is based on a fundamental misconception about the way PITR log-shipping works. We log actions at the physical level (put this tuple here), not the logical here's-the-statement-we-executed level. The two approaches cannot mix, because as soon as there's any physical discrepancy at all, physical-level actions would be incorrectly applied to the slave database. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Mar 22 11:14:36 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 44F699DCC2D for ; Wed, 22 Mar 2006 11:14: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 72682-05 for ; Wed, 22 Mar 2006 11:14:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 1B3E69DCC0D for ; Wed, 22 Mar 2006 11:14:30 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id CC48556423; Wed, 22 Mar 2006 09:14:35 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 22 Mar 2006 09:14:34 -0600 Date: Wed, 22 Mar 2006 09:14:34 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060322151434.GG15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> <1143032914.24487.632.camel@localhost.localdomain> <20060322131910.GC15742@pervasive.com> <16480.1143039965@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16480.1143039965@sss.pgh.pa.us> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060322:tgl@sss.pgh.pa.us::XPXJYp1KrCujrFtM:00000000000000000000 0000000000000000000000000KHo X-Hashcash: 1:20:060322:simon@2ndquadrant.com::F5faX3evySf0jIpq:0000000000000000 0000000000000000000000002a44 X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::dbmg9oRy/+ysnng0:00000 000000000000000000000000BiIO X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/455 X-Sequence-Number: 17892 On Wed, Mar 22, 2006 at 10:06:05AM -0500, Tom Lane wrote: > "Jim C. Nasby" writes: > >> PITR wants all changes. Without PITR we can optimize certain logging > >> actions. > > > The only change here is that we're creating a new table based on the > > results of a SELECT. If that SELECT doesn't use anything that's > > non-deterministic, then the machine doing the recovery should already > > have all the data it needs, provided that we log the SELECT that was > > used in the CTAS. > > This is based on a fundamental misconception about the way PITR > log-shipping works. We log actions at the physical level (put this > tuple here), not the logical here's-the-statement-we-executed level. > The two approaches cannot mix, because as soon as there's any physical > discrepancy at all, physical-level actions would be incorrectly applied > to the slave database. Oh, so in other words, SELECT * INTO temp FROM table is inherently non-deterministic at the physical level, so the only way to be able to allow PITR to work is to duplicate all the physical changes. Darn. -- 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 Wed Mar 22 11:50:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 251479DD59F for ; Wed, 22 Mar 2006 11:50: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 80821-03 for ; Wed, 22 Mar 2006 11:50:09 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 268B39DC837 for ; Wed, 22 Mar 2006 11:29:52 -0400 (AST) Received: from linspr1.tempdomainname.com (linspr1.tempdomainname.com [161.58.246.140]) by svr4.postgresql.org (Postfix) with ESMTP id D37AB5AF8AD for ; Wed, 22 Mar 2006 15:29:57 +0000 (GMT) Received: from [192.168.2.5] (ip-216-73-188-2.hqglobal.net [216.73.188.2]) (authenticated bits=0) by linspr1.tempdomainname.com (8.12.11/8.12.11) with ESMTP id k2MFToUj013545 for ; Wed, 22 Mar 2006 08:29:55 -0700 (MST) From: ashah Organization: opus To: pgsql Subject: Massive Inserts Strategies Date: Wed, 22 Mar 2006 10:32:10 -0500 User-Agent: KMail/1.8.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603221032.10207.ashah@opuspro.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: 200603/457 X-Sequence-Number: 17894 I have a database with foreign keys enabled on the schema. I receive different files, some of them are huge. And I need to load these files in the database every night. There are several scenerios that I want to design an optimal solution for - 1. One of the file has around 80K records and I have to delete everything from the table and load this file. The provider never provides a "delta file" so I dont have a way to identify which records are already present and which are new. If I dont delete everything and insert fresh, I have to make around 80K selects to decide if the records exist or not. Now there are lot of tables that have foreign keys linked with this table so unless I disable the foreign keys, I cannot really delete anything from this table. What would be a good practise here? 2. Another file that I receive has around 150K records that I need to load in the database. Now one of the fields is logically a "foreign key" to another table, and it is linked to the parent table via a database generated unique ID instead of the actual value. But the file comes with the actual value. So once again, I have to either drop the foreign key, or make 150K selects to determine the serial ID so that the foreign key is satisfied. What would be a good strategy in this scenerio ? Please pardon my inexperience with database ! Thanks, Amit From pgsql-performance-owner@postgresql.org Wed Mar 22 11:35:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 72D939DC83C for ; Wed, 22 Mar 2006 11:35: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 77195-08 for ; Wed, 22 Mar 2006 11:35:30 -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 1E4F29DC9F7 for ; Wed, 22 Mar 2006 11:35:23 -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 k2MFZQAk016693; Wed, 22 Mar 2006 10:35:26 -0500 (EST) To: "Jim C. Nasby" cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command In-reply-to: <20060322151434.GG15742@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> <1143032914.24487.632.camel@localhost.localdomain> <20060322131910.GC15742@pervasive.com> <16480.1143039965@sss.pgh.pa.us> <20060322151434.GG15742@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Wed, 22 Mar 2006 09:14:34 -0600" Date: Wed, 22 Mar 2006 10:35:26 -0500 Message-ID: <16692.1143041726@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/456 X-Sequence-Number: 17893 "Jim C. Nasby" writes: > Oh, so in other words, SELECT * INTO temp FROM table is inherently > non-deterministic at the physical level, so the only way to be able to > allow PITR to work is to duplicate all the physical changes. Darn. Well, lemme put it this way: I'm not prepared to require that PG be deterministic at the physical level. One obvious source of non-determinancy is the FSM, which is likely to hand out different free space to different transactions depending on what else is going on at the same time. There are others, such as deliberately random tie-breaking during btree index insertion. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Mar 22 12:07:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 113149DCC2D for ; Wed, 22 Mar 2006 12:07: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 82327-08 for ; Wed, 22 Mar 2006 12:07:25 -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 96FA79DC83C for ; Wed, 22 Mar 2006 12:07:24 -0400 (AST) Received: (qmail 10513 invoked from network); 22 Mar 2006 17:07:54 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 22 Mar 2006 17:07:54 +0100 To: ashah , pgsql Subject: Re: Massive Inserts Strategies References: <200603221032.10207.ashah@opuspro.com> Message-ID: Date: Wed, 22 Mar 2006 17:07:52 +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: <200603221032.10207.ashah@opuspro.com> User-Agent: Opera M2/8.51 (Linux, build 1462) 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: 200603/458 X-Sequence-Number: 17895 For both cases, you could COPY your file into a temporary table and do a big JOIN with your existing table, one for inserting new rows, and one for updating existing rows. Doing a large bulk query is a lot more efficient than doing a lot of selects. Vacuum afterwards, and you'll be fine. From pgsql-performance-owner@postgresql.org Wed Mar 22 12:09:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 82C369DC9F7 for ; Wed, 22 Mar 2006 12:09: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 82414-09 for ; Wed, 22 Mar 2006 12:09:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id E64FB9DC992 for ; Wed, 22 Mar 2006 12:09:26 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id BA35856423; Wed, 22 Mar 2006 10:09:25 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 22 Mar 2006 10:09:25 -0600 Date: Wed, 22 Mar 2006 10:09:25 -0600 From: "Jim C. Nasby" To: ashah Cc: pgsql Subject: Re: Massive Inserts Strategies Message-ID: <20060322160924.GJ15742@pervasive.com> References: <200603221032.10207.ashah@opuspro.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200603221032.10207.ashah@opuspro.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060322:ashah@opuspro.com::Lte4OFHxN9kYz282:00000000000000000000 0000000000000000000000002hoc X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::DHNCF0Qrnepi+o0l:00000 00000000000000000000000059zn X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/459 X-Sequence-Number: 17896 Load the files into a temp table and go from there... COPY ... FROM file; UPDATE existing_table SET ... WHERE ...; INSERT INTO existing_table SELECT * FROM temp_table WHERE NOT EXISTS( SELECT * FROM existing_table WHERE ...) On Wed, Mar 22, 2006 at 10:32:10AM -0500, ashah wrote: > I have a database with foreign keys enabled on the schema. I receive different > files, some of them are huge. And I need to load these files in the database > every night. There are several scenerios that I want to design an optimal > solution for - > > 1. One of the file has around 80K records and I have to delete everything from > the table and load this file. The provider never provides a "delta file" so I > dont have a way to identify which records are already present and which are > new. If I dont delete everything and insert fresh, I have to make around 80K > selects to decide if the records exist or not. Now there are lot of tables > that have foreign keys linked with this table so unless I disable the foreign > keys, I cannot really delete anything from this table. What would be a good > practise here? > > 2. Another file that I receive has around 150K records that I need to load in > the database. Now one of the fields is logically a "foreign key" to another > table, and it is linked to the parent table via a database generated unique > ID instead of the actual value. But the file comes with the actual value. So > once again, I have to either drop the foreign key, or make 150K selects to > determine the serial ID so that the foreign key is satisfied. What would be a > good strategy in this scenerio ? > > Please pardon my inexperience with database ! > > Thanks, > Amit > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Wed Mar 22 12:16:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 943C79DC9F7 for ; Wed, 22 Mar 2006 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 83556-07 for ; Wed, 22 Mar 2006 12:16:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 4A7639DC986 for ; Wed, 22 Mar 2006 12:16:15 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Wed, 22 Mar 2006 16:16:14 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 22 Mar 2006 10:16:14 -0600 Subject: Re: planner with index scan cost way off actual cost, From: Scott Marlowe To: Guillaume Cottenceau Cc: "Jim C. Nasby" , pgsql-performance@postgresql.org In-Reply-To: <87slpaj46q.fsf@meuh.mnc.lan> References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> <20060321095049.GW15742@pervasive.com> <441FD82D.1040509@paradise.net.nz> <20060321115100.GM15742@pervasive.com> <87acbkkl0o.fsf@meuh.mnc.lan> <20060321174903.GG15742@pervasive.com> <87slpaj46q.fsf@meuh.mnc.lan> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1143044174.17999.7.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 22 Mar 2006 10:16:14 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.144 required=5 tests=[AWL=0.143, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.144 X-Spam-Level: X-Archive-Number: 200603/460 X-Sequence-Number: 17897 On Wed, 2006-03-22 at 02:04, Guillaume Cottenceau wrote: > "Jim C. Nasby" writes: > > > On Tue, Mar 21, 2006 at 02:03:19PM +0100, Guillaume Cottenceau wrote: > > > "Jim C. Nasby" writes: > > > > > > > On Tue, Mar 21, 2006 at 10:40:45PM +1200, Mark Kirkwood wrote: > > > > > I was going to recommend higher - but not knowing what else was running, > > > > > kept it to quite conservative :-)... and given he's running java, the > > > > > JVM could easily eat 512M all by itself! > > > > > > > > Oh, didn't pick up on java being in the mix. Yeah, it can be a real pig. > > > > I think people often place too much emphasis on having a seperate > > > > application server, but in the case of java you often have no choice. > > > > > > Fortunately the servers use 2G or 4G of memory, only my test > > > machine had 1G, as I believe I precised in a message; so I'm > > > definitely going to use Mark's advices to enlarge a lot the > > > shared buffers. Btw, what about sort_mem? I have seen it only > > > little referenced in the documentation. > > > > The biggest issue with setting work_mem (you're not doing current > > development on 7.4 are you?) is ensuring that you don't push the server > > Yes, we use 7.4.5 actually, because "it just works", so production > wants to first deal with all the things that don't work before > upgrading. I have recently discovered about the background writer > of 8.x which could be a supplementary reason to push for an > ugprade though. Imagine you get a call from the manufacturer of your car. There's a problem with the fuel pump, and, in a small percentage of accidents, your car could catch fire and kill everyone inside. Do you go in for the recall, or ignore it because you just want your car to "just work?" In the case of the third number in postgresql releases, that's what you're talking about. the updates that have come after the 7.4.5 version, just talking 7.4 series here, have included a few crash and data loss fixes. Rare, but possible. Don't worry about upgrading to 8.x until later, fine, but you should really be upgrading to the latest patch level of 7.4. I fight this same fight at work, by the way. It's hard convincing people that the updates are security / crash / data loss only... From pgsql-performance-owner@postgresql.org Wed Mar 22 12:20:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2CC8D9DC986 for ; Wed, 22 Mar 2006 12:20: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 84758-07 for ; Wed, 22 Mar 2006 12:20:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by postgresql.org (Postfix) with ESMTP id 2E8919DC9F7 for ; Wed, 22 Mar 2006 12:20:00 -0400 (AST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by mail.ecircle.de (READY) with ESMTP id 1182955C007; Wed, 22 Mar 2006 17:19:59 +0100 (CET) Received: from [192.168.1.110] ([192.168.1.110]) by deimos.muc.ecircle.de with Microsoft SMTPSVC(5.0.2195.6713); Wed, 22 Mar 2006 17:19:58 +0100 Subject: Re: WAL logging of SELECT ... INTO command From: Csaba Nagy To: Tom Lane Cc: "Jim C. Nasby" , Simon Riggs , postgres performance list In-Reply-To: <16692.1143041726@sss.pgh.pa.us> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> <1143032914.24487.632.camel@localhost.localdomain> <20060322131910.GC15742@pervasive.com> <16480.1143039965@sss.pgh.pa.us> <20060322151434.GG15742@pervasive.com> <16692.1143041726@sss.pgh.pa.us> Content-Type: text/plain Message-Id: <1143044398.23597.80.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 22 Mar 2006 17:19:58 +0100 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 22 Mar 2006 16:19:58.0976 (UTC) FILETIME=[76E0F800:01C64DCC] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/461 X-Sequence-Number: 17898 On Wed, 2006-03-22 at 16:35, Tom Lane wrote: > "Jim C. Nasby" writes: > > Oh, so in other words, SELECT * INTO temp FROM table is inherently > > non-deterministic at the physical level, so the only way to be able to > > allow PITR to work is to duplicate all the physical changes. Darn. > > Well, lemme put it this way: I'm not prepared to require that PG be > deterministic at the physical level. One obvious source of > non-determinancy is the FSM, which is likely to hand out different free > space to different transactions depending on what else is going on at > the same time. There are others, such as deliberately random > tie-breaking during btree index insertion. While you're at talking about WAL and PITR... I see from the aboce discussion that PITR is already demanding special handling in the code (I hope I got this one right, as the following are based on this). What if the PITR logging would be disconnected from the WAL logging completely ? What I mean is to introduce a WAL subscription mechanism, which basically means some incoming connections where we stream the log records. We don't need to write them to disk at all in the normal case, I guess usually PITR will store the records on some other machine so it means network, not disk. And it doesn't need to be done synchronously, it can lag behind the running transactions, and we can do it in batches of WAL records. It also would mean that the local WAL does not need to log the things which are only needed for the PITR... that would likely mean some spared WAL disk activity. Of course it also would mean that the local WAL and PITR WAL are not the same, but that is not an issue I guess. It would also permit immediate recycling of the WAL files if the current archiving style is not used. The drawbacks I can see (please add yours): 1) the need for the subscription management code with the added complexity it implies; 2) problems if the WAL stream lags too much behind; 3) problems if the subscribed client's connection is interrupted; Nr. 2 could be solved by saving the PITR WAL separately if the lag grows over a threshold, and issue a warning. This could still be acceptable, as the writing doesn't have to be synchronous and can be made in relatively large blocks. There could be a second bigger lag threshold which completely cancels the subscription. All these thresholds should be configurable, as it depends on the application what's more important, to have the standby available all the time or have the primary faster if loaded... Nr. 3. can be solved by either canceling the subscription on connection drop, or by allowing a certain amount of time after which the subscription is canceled. The client can reconnect before this timeout expires. In the meantime the primary can store the PITR WAL on disk as mentioned above... Cheers, Csaba. From pgsql-performance-owner@postgresql.org Wed Mar 22 12:26:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 048AC9DCB8F for ; Wed, 22 Mar 2006 12:26: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 86395-04 for ; Wed, 22 Mar 2006 12:26:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id 852E69DCC2E for ; Wed, 22 Mar 2006 12:26:01 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 0D91AA82C0; Wed, 22 Mar 2006 17:26:09 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 08982-08; Wed, 22 Mar 2006 17:26:08 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id A6227A82B9; Wed, 22 Mar 2006 17:26:08 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 3C8E61836BA; Wed, 22 Mar 2006 17:25:56 +0100 (CET) To: Scott Marlowe Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, References: <87ek11gz69.fsf@meuh.mnc.lan> <441CDAAA.20609@paradise.net.nz> <87d5ghms3h.fsf@meuh.mnc.lan> <20060321095049.GW15742@pervasive.com> <441FD82D.1040509@paradise.net.nz> <20060321115100.GM15742@pervasive.com> <87acbkkl0o.fsf@meuh.mnc.lan> <20060321174903.GG15742@pervasive.com> <87slpaj46q.fsf@meuh.mnc.lan> <1143044174.17999.7.camel@state.g2switchworks.com> X-Hashcash: 1:20:060322:smarlowe@g2switchworks.com::A59U6pkpHtXwDw3a:0000000000000000000000000000000000029Ba X-Hashcash: 1:20:060322:pgsql-performance@postgresql.org::KH3+AfmfPPKfTURi:00000000000000000000000000000178I From: Guillaume Cottenceau Date: 22 Mar 2006 17:25:56 +0100 In-Reply-To: <1143044174.17999.7.camel@state.g2switchworks.com> Message-ID: <87irq6e99n.fsf@meuh.mnc.lan> Lines: 36 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: amavisd-new at mnc.ch 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: 200603/462 X-Sequence-Number: 17899 Hi Scott, Scott Marlowe writes: > On Wed, 2006-03-22 at 02:04, Guillaume Cottenceau wrote: [...] > > Yes, we use 7.4.5 actually, because "it just works", so production > > wants to first deal with all the things that don't work before > > upgrading. I have recently discovered about the background writer > > of 8.x which could be a supplementary reason to push for an > > ugprade though. > > Imagine you get a call from the manufacturer of your car. There's a > problem with the fuel pump, and, in a small percentage of accidents, > your car could catch fire and kill everyone inside. > > Do you go in for the recall, or ignore it because you just want your car > to "just work?" Ah, this holy computer/OS/whatever-to-cars comparison.. How many million electrons would the world save if computer people would abandon it? :) > In the case of the third number in postgresql releases, that's what > you're talking about. the updates that have come after the 7.4.5 > version, just talking 7.4 series here, have included a few crash and > data loss fixes. Rare, but possible. I guess we didn't know that. I for myself have (a bit more) excuses because I'm on the development side :) But I've passed the information to the operation team, thank you. -- Guillaume Cottenceau From pgsql-performance-owner@postgresql.org Wed Mar 22 13:11:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8CA489DC83C for ; Wed, 22 Mar 2006 13:11: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 94058-07 for ; Wed, 22 Mar 2006 13:11:20 -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 EFCAE9DCAD6 for ; Wed, 22 Mar 2006 13:11:16 -0400 (AST) Received: from 172.16.1.25 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Wed, 22 Mar 2006 12:11:02 -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); Wed, 22 Mar 2006 12:11:00 -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.106]) with Microsoft Exchange Server HTTP-DAV ; Wed, 22 Mar 2006 17:10:59 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Wed, 22 Mar 2006 09:10:58 -0800 Subject: Re: Intel C/C++ Compiler Tests From: "Luke Lonergan" To: "Spiegelberg, Greg" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Intel C/C++ Compiler Tests Thread-Index: AcZNuFxkcqpGyO4kTzKl0IKZpizn/QAGznOL In-Reply-To: <82E74D266CB9B44390D3CCE44A781ED9E284B5@POSTOFFICE.cranel.local> MIME-Version: 1.0 X-OriginalArrivalTime: 22 Mar 2006 17:11:00.0715 (UTC) FILETIME=[97D143B0:01C64DD3] X-WSS-ID: 683F5AA82XS32091004-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.35 required=5 tests=[AWL=0.097, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.35 X-Spam-Level: * X-Archive-Number: 200603/463 X-Sequence-Number: 17900 Greg, On 3/22/06 5:56 AM, "Spiegelberg, Greg" wrote: > Has anyone tested PostgreSQL 8.1.x compiled with Intel's Linux C/C++ > compiler? We used to compile 8.0 with icc and 7.x before that. We found very good performance gains for Intel P4 architecture processors and some gains for AMD Athlon. Lately, the gcc compilers have caught up with icc on pipelining optimizations and they generate better code for Opteron than icc, so we found that icc was significantly slower than gcc on Opteron and no different on P4/Xeon. Maybe things have changed in newer versions of icc, the last tests I did were about 1 year ago. - Luke From pgsql-performance-owner@postgresql.org Wed Mar 22 15:37:36 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 774239DD755 for ; Wed, 22 Mar 2006 15:37: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 26031-04 for ; Wed, 22 Mar 2006 15:37:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with SMTP id E3E719DD742 for ; Wed, 22 Mar 2006 15:37:28 -0400 (AST) Received: (qmail 25254 invoked by uid 1112); 22 Mar 2006 19:37:28 -0000 Date: Wed, 22 Mar 2006 14:37:28 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: "Jim C. Nasby" cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command In-Reply-To: <20060322124732.GA15742@pervasive.com> Message-ID: References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/464 X-Sequence-Number: 17901 On Wed, 22 Mar 2006, Jim C. Nasby wrote: > Ok, I saw disk activity on the base directory and assumed it was pg_xlog > stuff. Turns out that both SELECT INTO and CREATE TABLE AS ignore > default_tablepsace and create the new tables in the base directory. I'm > guessing that's a bug... (this is on 8.1.2, btw). This has been fixed in CVS HEAD as part of a patch to allow additional options to CREATE TABLE AS. http://archives.postgresql.org/pgsql-patches/2006-02/msg00211.php Kris Jurka From pgsql-performance-owner@postgresql.org Thu Mar 23 02:19:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 52F249DC898 for ; Thu, 23 Mar 2006 02: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 42582-03 for ; Thu, 23 Mar 2006 02:19:26 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by postgresql.org (Postfix) with ESMTP id 9B1019DC89D for ; Thu, 23 Mar 2006 02:19:24 -0400 (AST) Received: by zproxy.gmail.com with SMTP id k1so407355nzf for ; Wed, 22 Mar 2006 22:19: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:mime-version:content-type:content-transfer-encoding:content-disposition; b=kOHi/kmrylm2s/N1mS0IjWjMvxnRZEjYTo4wZkkobboBEibuf1x31mm3b9gm9D38UhC438NGKuNKBpD0e6KFgdPT5P2Vp7F2Y142Q4nWpSTq4+MzqMax+lDsxfmPDDM/WOpv1OVgl6DVzG7ecBIJTYNqdPThQVJDBuMXFV6xWlw= Received: by 10.64.209.17 with SMTP id h17mr1334102qbg; Wed, 22 Mar 2006 22:19:24 -0800 (PST) Received: by 10.64.143.10 with HTTP; Wed, 22 Mar 2006 22:19:24 -0800 (PST) Message-ID: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> Date: Thu, 23 Mar 2006 14:19:24 +0800 From: "Jojo Paderes" To: pgsql-performance@postgresql.org Subject: Scaling up PostgreSQL in Multiple CPU / Dual Core Powered Servers 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/466 X-Sequence-Number: 17903 SSdkIGxpa2UgdG8ga25vdyBpZiB0aGUgbGF0ZXN0IFBvc3RncmVTUUwgcmVsZWFzZSBjYW4gc2Nh bGUgdXAgYnkKdXRpbGl6aW5nIG11bHRpcGxlIGNwdSBvciBkdWFsIGNvcmUgY3B1IHRvIGJvb3N0 IHVwIHRoZSBzcWwKZXhlY3V0aW9ucy4KCkkgYWxyZWFkeSBkbyBhIHJlc2VhcmNoIG9uIHRoZSBQ b3N0Z3JlU1FMIG1haWxpbmcgYXJjaGl2ZXMgYW5kIG9ubHkKZm91bmQgb2xkIHRocmVhZHMgZGF0 aW5nIGJhY2sgMjAwMC4gQSBsb3Qgb2YgdGhpbmdzIGhhdmUgaW1wcm92ZWQgd2l0aApQb3N0Z3Jl U1FMIGFuZCBob3BlZnVsbHkgdGhlIHN1cHBvcnQgZm9yIG11bHRpcGxlIGNwdSBvciBkdWFsIGNv cmVzIGlzCmFscmVhZHkgcHJvdmlkZWQuCgotLQpodHRwOi8vam9qb3BhZGVyZXMubXVsdGlwbHku Y29tCmh0dHA6Ly9qb2pvcGFkZXJlcy53b3JkcHJlc3MuY29tCg== From pgsql-performance-owner@postgresql.org Thu Mar 23 05:12:34 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CA1FF9DC83C for ; Thu, 23 Mar 2006 05:12: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 85414-05 for ; Thu, 23 Mar 2006 05:12:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.webrainstorm.it (mail.webrainstorm.it [213.92.79.132]) by postgresql.org (Postfix) with SMTP id 4954C9DCAC1 for ; Thu, 23 Mar 2006 05:12:30 -0400 (AST) Received: (qmail 1380 invoked from network); 23 Mar 2006 09:12:12 -0000 Received: from unknown (HELO mgmt1.webrainstorm.it) (81.174.12.48) by webrainstorm.it with SMTP; 23 Mar 2006 09:12:11 -0000 Message-Id: <7.0.0.16.2.20060322120000.0796c930@webrainstorm.it> X-Mailer: QUALCOMM Windows Eudora Version 7.0.0.16 Date: Thu, 23 Mar 2006 10:14:24 +0100 To: Scott Marlowe From: Edoardo Serra Subject: Re: Postmaster using only 4-5% CPU Cc: pgsql-performance@postgresql.org In-Reply-To: <1142963080.17883.193.camel@state.g2switchworks.com> References: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> <1142963080.17883.193.camel@state.g2switchworks.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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/467 X-Sequence-Number: 17904 At 18.44 21/03/2006, Scott Marlowe wrote: >Here's what's happening. On the "fast" machine, you are almost >certainly using IDE drives. Oh yes, the fast machine has IDE drives, you got it ;) >Meanwhile, back in the jungle... The machine with IDE drives operates >differently. Most, if not all, IDE drives, when told by the OS to >fsync() tell the OS immediately that the fsync() call has completed, and >the data is written to the drive. Shortly thereafter, the drive >actually commences to write the data out. When it gets a chance. I really didn't know this behaviour of IDE drives. I was stracing the postmaster while investigating the problem and noticed many fsync syscalls (one after each INSERT). I was investigating on it but I didn't explain me why SCSI was slower. You helped me a lot ;) tnx >For PostgreSQL, the way IDE drives operate is dangerous. Write data >out, call fsync(), get an immediate return, mark the data as committed, >move on the next operation, operator trips over power cord / power >conditioner explodes, power supply dies, brown out causes the machine to >reboot, et. al., and when the machine comes up, PostgreSQL politely >informs you that your database is corrupt, and you come to the >pgsql-general group asking how to get your database back online. Very >bad. Yes, it sounds very bad... what about SATA drives ? I heard about command queueing in SATA but I don't know if the kernel handles it properly >Try wrapping the inserts in the sql file in begin; / commit; statements, >like so: > >begin; >insert into table ... >(100,000 inserts here) >insert into table ... >commit; > >and it should fly. Oh, yes with the insert wrapped in a transaction the import time is as follows: - SCSI: 35 secs - IDE: 50 secs >When a good friend of mine first started using PostgreSQL, he was a >total MySQL bigot. He was importing a 10,000 row dataset, and made a >smartassed remark after 10 minutes how it would have imported in minutes >on MySQL. It was a test database, so I had him stop the import, delete >all the imported rows, and wrap the whole import inside begin; and >commit; > >The import took about 20 seconds or so. ;) >Now, for the interesting test. Run the import on both machines, with >the begin; commit; pairs around it. Halfway through the import, pull >the power cord, and see which one comes back up. Don't do this to >servers with data you like, only test machines, obviously. For an even >more interesting test, do this with MySQL, Oracle, DB2, etc... I will surely run a test like this ;) Tnx a lot again for help Regards Edoardo Serra From pgsql-performance-owner@postgresql.org Thu Mar 23 07:47:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 762719DCA0A for ; Thu, 23 Mar 2006 07:47: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 10950-04 for ; Thu, 23 Mar 2006 07:47:13 -0400 (AST) X-Greylist: delayed 00:36:57.230862 by SQLgrey- Received: from beth.coza.net.za (beth.coza.net.za [206.223.136.193]) by postgresql.org (Postfix) with ESMTP id 9635F9DC98B for ; Thu, 23 Mar 2006 07:47:07 -0400 (AST) Received: from theo-laptop.int.coza.net.za ([206.223.136.211]) by beth.coza.net.za (8.11.6/8.11.2) with ESMTP id k2NB9n131678; Thu, 23 Mar 2006 13:09:49 +0200 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by theo-laptop.int.coza.net.za (8.12.11/8.12.11) with ESMTP id k2NB9nRJ022625; Thu, 23 Mar 2006 13:09:49 +0200 Subject: Re: Indexes with descending date columns From: Theo Kramer Reply-To: theo@flame.co.za To: pgsql-performance@postgresql.org In-Reply-To: <200603170625.k2H6PJ926955@pillette.com> References: <200603170625.k2H6PJ926955@pillette.com> Content-Type: text/plain Organization: Flame Computing Enterprises cc Message-Id: <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 23 Mar 2006 13:09:49 +0200 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: 200603/468 X-Sequence-Number: 17905 On Fri, 2006-03-17 at 08:25, andrew@pillette.com wrote: > > I have a performance problem when traversing a table in index order with > > multiple columns including a date column in date reverse order. Below > > follows a simplified description of the table, the index and the > > associated query > > > > \d prcdedit > > prcdedit_prcd | character(20) | > > prcdedit_date | timestamp without time zone | > > > > Indexes: > > "prcdedit_idx" btree (prcdedit_prcd, prcdedit_date) > > Depending on how you use the table, there are three possible solutions. > > First, if it makes sense in the domain, using an ORDER BY where _both_ columns are used descending will make PG search the index in reverse and will be just as fast as when both as searched by the default ascending. > > Second possibility: Create a dummy column whose value depends on the negative of prcdedit_date, e.g., -extract(epoch from prcdedit_date), keep the dummy column in sync with the original column using triggers, and rewrite your queries to use ORDER BY prcdedit_prod, dummy_column. > > Third: Create an index on a function which sorts in the order you want, and then always sort using the function index (you could use the -extract(epoch...) gimmick for that, among other possibilities.) > > HTH. All good input - thanks, however, before I start messing with my stuff which I know will be complex - some questions to any of the developers on the list. i Is it feasible to extend index creation to support descending columns? ... this is supported on other commercial and non commercial databases, but I do not know if this is a SQL standard. ii If no to i, is it feasible to extend PostgreSQL to allow traversing an index in column descending and column ascending order - assuming an order by on more than one column with column order not in the same direction and indexes existing? ... if that makes sense. -- Regards Theo From pgsql-performance-owner@postgresql.org Thu Mar 23 08:12:13 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E447B9DC8A1 for ; Thu, 23 Mar 2006 08:12: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 13695-09 for ; Thu, 23 Mar 2006 08:12:14 -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 3A1379DC87C for ; Thu, 23 Mar 2006 08:12:08 -0400 (AST) Received: by zproxy.gmail.com with SMTP id z6so489451nzd for ; Thu, 23 Mar 2006 04:12:12 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=JykHGXrjyHEWn5iabMkuzeGH9xKJHX45bIDajVy+YvbVDg2uNI4GIPKOIXn69GEP5QrawocrROS0qbhPZRAuwwp12NaaaMRqmv+z0Khdm2SQS0lQtnGl4LhS8g08W2Mi4fX5JT+VCFRBNB4TFCreBQUud8TT2d1/vqmLUUXUquY= Received: by 10.64.208.19 with SMTP id f19mr1511061qbg; Thu, 23 Mar 2006 04:12:12 -0800 (PST) Received: from ?10.80.1.46? ( [85.221.54.254]) by mx.gmail.com with ESMTP id e13sm495220qba.2006.03.23.04.12.11; Thu, 23 Mar 2006 04:12:11 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v746.2) Content-Transfer-Encoding: 7bit Message-Id: <0B8E0D23-F08D-457D-B26F-1D475F8064F4@gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Bendik Rognlien Johansen Subject: Problem with query, server totally unresponsive Date: Thu, 23 Mar 2006 13:12:08 +0100 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: 200603/469 X-Sequence-Number: 17906 Hello, I have a big problem with one of my databases. When i run my query, after a few minutes, the postmaster shows 99% mem i top, and the server becomes totally unresponsive. I get this message when I try to cancel the query: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. This works fine on a different machine with the same database settings and about 30% less records. The other machine is running PostgreSQL 8.0.3 The troubled one is running 8.1.2 Any help is greatly appreciated! Thanks The machine has 2x Intel dual core processors (3GHz) and 2 Gigs of ram. #----------------------------------------------------------------------- ---- # RESOURCE USAGE (except WAL) #----------------------------------------------------------------------- ---- # - Memory - shared_buffers = 8192 # 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 = 4096 # min 64, size in KB maintenance_work_mem = 262144 # min 1024, size in KB #max_stack_depth = 2048 # min 100, size in KB My query: SELECT r.id AS id, max(r.name) AS name, max(companyid) AS companyid, max(extract(epoch from r.updated)) as r_updated, hydra.join(co.value) AS contacts, hydra.join(ad.postalsite) AS postalsites FROM records r LEFT OUTER JOIN contacts co ON(r.id = co.record AND co.type IN (1,11,101,3)) LEFT OUTER JOIN addresses ad ON(r.id = ad.record) WHERE r.original IS NULL GROUP BY r.id; The hydra.join function -- Aggregates a column to an array DROP FUNCTION hydra.join_aggregate(text, text) CASCADE; DROP FUNCTION hydra.join_aggregate_to_array(text); CREATE FUNCTION hydra.join_aggregate(text, text) RETURNS text AS 'select $1 || ''|'' || $2' LANGUAGE sql IMMUTABLE STRICT; CREATE FUNCTION hydra.join_aggregate_to_array(text) RETURNS text[] AS 'SELECT string_to_array($1, ''|'')' LANGUAGE sql IMMUTABLE STRICT; CREATE AGGREGATE hydra.join ( BASETYPE = text ,SFUNC = hydra.join_aggregate ,STYPE = text ,FINALFUNC = hydra.join_aggregate_to_array ); Tables: records: 757278 rows contacts: 2256253 rows addresses: 741536 rows Explain: QUERY PLAN ------------------------------------------------------------------------ ----------------------------- GroupAggregate (cost=636575.63..738618.40 rows=757278 width=75) -> Merge Left Join (cost=636575.63..694469.65 rows=1681120 width=75) Merge Cond: ("outer".id = "inner".record) -> Merge Left Join (cost=523248.93..552247.54 rows=1681120 width=63) Merge Cond: ("outer".id = "inner".record) -> Sort (cost=164044.73..165937.93 rows=757278 width=48) Sort Key: r.id -> Seq Scan on records r (cost=0.00..19134.78 rows=757278 width=48) Filter: (original IS NULL) -> Sort (cost=359204.20..363407.00 rows=1681120 width=19) Sort Key: co.record -> Seq Scan on contacts co (cost=0.00..73438.06 rows=1681120 width=19) Filter: (("type" = 1) OR ("type" = 11) OR ("type" = 101) OR ("type" = 3)) -> Sort (cost=113326.70..115180.54 rows=741536 width=16) Sort Key: ad.record -> Seq Scan on addresses ad (cost=0.00..20801.36 rows=741536 width=16) (16 rows) se_companies=# \d records; Table "public.records" Column | Type | Modifiers -----------------+-------------------------- +------------------------------------------------------ id | integer | not null default nextval ('records_id_seq'::regclass) companyid | character varying(16) | default ''::character varying categories | integer[] | nace | integer[] | name | character varying(255) | default ''::character varying updated | timestamp with time zone | default ('now'::text)::timestamp(6) with time zone updater | integer | owner | integer | loaner | integer | info | text | original | integer | active | boolean | default true categoryquality | integer | not null default 0 searchwords | character varying(128)[] | priority | integer | categorized | timestamp with time zone | infopage | boolean | national | boolean | password | character varying(32) | login | boolean | deleted | boolean | not null default false reference | integer[] | nuinfo | text | brands | integer[] | volatile | boolean | not null default false Indexes: "records_pkey" PRIMARY KEY, btree (id) CLUSTER "original_is_null" btree (original) WHERE original IS NULL "records_category_rdtree_idx" gist (categories) "records_categoryquality_idx" btree (categoryquality) "records_lower_name_idx" btree (lower(name::text)) "records_original_idx" btree (original) "records_owner" btree ("owner") "records_updated_idx" btree (updated) Foreign-key constraints: "records_original_fkey" FOREIGN KEY (original) REFERENCES records (id) se_companies=# \d contacts; Table "public.contacts" Column | Type | Modifiers -------------+------------------------ +------------------------------------------------------- id | integer | not null default nextval ('contacts_id_seq'::regclass) record | integer | type | integer | value | character varying(128) | description | character varying(255) | priority | integer | itescotype | integer | original | integer | source | integer | reference | character varying(32) | quality | integer | deleted | boolean | not null default false searchable | boolean | not null default true visible | boolean | not null default true Indexes: "contacts_pkey" PRIMARY KEY, btree (id) "contacts_original_idx" btree (original) "contacts_quality_idx" btree (quality) "contacts_record_idx" btree (record) "contacts_source_reference_idx" btree (source, reference) "contacts_value_idx" btree (value) Foreign-key constraints: "contacts_original_fkey" FOREIGN KEY (original) REFERENCES contacts(id) se_companies=# \d addresses; Table "public.addresses" Column | Type | Modifiers --------------+-------------------------- +-------------------------------------------------------- id | integer | not null default nextval ('addresses_id_seq'::regclass) record | integer | address | character varying(128) | extra | character varying(32) | postalcode | character varying(16) | postalsite | character varying(64) | description | character varying(255) | position | point | uncertainty | integer | default 99999999 priority | integer | type | integer | place | character varying(64) | floor | integer | side | character varying(8) | housename | character varying(64) | original | integer | source | integer | reference | character varying(64) | quality | integer | deleted | boolean | not null default false searchable | boolean | not null default true visible | boolean | not null default true municipality | integer | map | boolean | not null default true geocoded | timestamp with time zone | default now() Indexes: "addresses_pkey" PRIMARY KEY, btree (id) "addresses_lower_address_postalcode" btree (lower (address::text), lower(postalcode::text)) "addresses_original_idx" btree (original) "addresses_record_idx" btree (record) "addresses_source_reference_idx" btree (source, reference) Foreign-key constraints: "addresses_original_fkey" FOREIGN KEY (original) REFERENCES addresses(id) From pgsql-performance-owner@postgresql.org Thu Mar 23 09:38:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 41AC89DC8A1 for ; Thu, 23 Mar 2006 09:38: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 31988-02 for ; Thu, 23 Mar 2006 09:38:10 -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 37D0E9DC87C for ; Thu, 23 Mar 2006 09:38:04 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D5AE530CDE; Thu, 23 Mar 2006 14:38:07 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Powered Servers Date: Thu, 23 Mar 2006 08:23:42 -0500 Organization: cbbrowne Computing Inc Lines: 20 Message-ID: <87mzfhl2g1.fsf@wolfe.cbbrowne.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:HDjiqZWr4hpYDj1M4wqzWJH+Rjk= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.315 required=5 tests=[AWL=0.315] X-Spam-Score: 0.315 X-Spam-Level: X-Archive-Number: 200603/471 X-Sequence-Number: 17908 jojo.paderes@gmail.com ("Jojo Paderes") wrote: > I'd like to know if the latest PostgreSQL release can scale up by > utilizing multiple cpu or dual core cpu to boost up the sql > executions. > > I already do a research on the PostgreSQL mailing archives and only > found old threads dating back 2000. A lot of things have improved with > PostgreSQL and hopefully the support for multiple cpu or dual cores is > already provided. If you submit multiple concurrent queries, they can be concurrently processed on separate CPUs; that has long been supported, and people have been using SMP systems to this end for years. -- let name="cbbrowne" and tld="gmail.com" in String.concat "@" [name;tld];; http://cbbrowne.com/info/spreadsheets.html "In other words -- and this is the rock solid principle on which the whole of the Corporation's Galaxy-wide success is founded -- their fundamental design flaws are completely hidden by their superficial design flaws." -- HHGTG From pgsql-performance-owner@postgresql.org Thu Mar 23 09:24:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7D5409DCB44 for ; Thu, 23 Mar 2006 09:24: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 27001-07 for ; Thu, 23 Mar 2006 09:24:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id 014CE9DCA89 for ; Thu, 23 Mar 2006 09:24:45 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 23 Mar 2006 09:24:49 -0400 X-IronPort-AV: i="4.03,122,1141614000"; d="scan'208"; a="48387626:sNHT78612848" Received: from alvh.no-ip.org (201.221.200.224) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00BAA250; Thu, 23 Mar 2006 09:24:49 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 2587CC3A2D0; Thu, 23 Mar 2006 09:24:49 -0400 (CLT) Date: Thu, 23 Mar 2006 09:24:49 -0400 From: Alvaro Herrera To: Theo Kramer Cc: pgsql-performance@postgresql.org Subject: Re: Indexes with descending date columns Message-ID: <20060323132448.GB4881@surnet.cl> Mail-Followup-To: Theo Kramer , pgsql-performance@postgresql.org References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.577 required=5 tests=[AWL=-0.342, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.577 X-Spam-Level: * X-Archive-Number: 200603/470 X-Sequence-Number: 17907 Theo Kramer wrote: > All good input - thanks, however, before I start messing with my stuff > which I know will be complex - some questions to any of the developers > on the list. > > i Is it feasible to extend index creation to support descending > columns? ... this is supported on other commercial and non > commercial databases, but I do not know if this is a SQL standard. This can be done. You need to create an operator class which specifies the reverse sort order (i.e. reverse the operators), and then use it in the new index. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Thu Mar 23 09:51:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9A8AC9DC814 for ; Thu, 23 Mar 2006 09:51: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 32499-05 for ; Thu, 23 Mar 2006 09:51:38 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.206]) by postgresql.org (Postfix) with ESMTP id 263749DC87C for ; Thu, 23 Mar 2006 09:51:32 -0400 (AST) Received: by zproxy.gmail.com with SMTP id x3so396001nzd for ; Thu, 23 Mar 2006 05:51:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=AIvwZqg25wDyMk2kKqd+Le4g1/mp9ClLjNHwOGs+4EqB4hQuFiKejTTwE0yCIjU5JzX35TbIsKZbdZ9vVPOBfUZ0oBE8Hyle1osmBedjV5IqX9fgQYspvUCDiq2fl7cHuxx+4aNtF9lK83qgw/fWlt1NyDSMDukZNA0Q8//S/+Y= Received: by 10.65.84.8 with SMTP id m8mr1091383qbl; Thu, 23 Mar 2006 05:51:36 -0800 (PST) Received: from ?10.80.1.46? ( [85.221.54.254]) by mx.gmail.com with ESMTP id e14sm1352995qba.2006.03.23.05.51.30; Thu, 23 Mar 2006 05:51:30 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v746.2) Content-Transfer-Encoding: 7bit Message-Id: <190DF2EA-6592-412C-A48F-5E2C17AED1B4@gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Bendik Rognlien Johansen Subject: Problem with query, forget previous message Date: Thu, 23 Mar 2006 14:51:27 +0100 X-Mailer: Apple Mail (2.746.2) 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: 200603/472 X-Sequence-Number: 17909 Seems the problem was with the custom aggregate function not being able to handle thousands of rows. From pgsql-performance-owner@postgresql.org Thu Mar 23 12:25:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3778C9DCD3D for ; Thu, 23 Mar 2006 12:25: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 63980-02 for ; Thu, 23 Mar 2006 12:25:13 -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 A536A9DCAEF for ; Thu, 23 Mar 2006 12:25:10 -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 k2NGP5gM020331; Thu, 23 Mar 2006 10:25:05 -0600 Date: Thu, 23 Mar 2006 10:26:42 -0600 From: Frank Wiles To: "Jojo Paderes" Cc: pgsql-performance@postgresql.org Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Message-Id: <20060323102642.391f489e.frank@wiles.org> In-Reply-To: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> X-Mailer: Sylpheed version 2.2.3 (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.072 required=5 tests=[AWL=0.072] X-Spam-Score: 0.072 X-Spam-Level: X-Archive-Number: 200603/473 X-Sequence-Number: 17910 On Thu, 23 Mar 2006 14:19:24 +0800 "Jojo Paderes" wrote: > I'd like to know if the latest PostgreSQL release can scale up by > utilizing multiple cpu or dual core cpu to boost up the sql > executions. > > I already do a research on the PostgreSQL mailing archives and only > found old threads dating back 2000. A lot of things have improved with > PostgreSQL and hopefully the support for multiple cpu or dual cores is > already provided. Yes PostgreSQL can take advantage of multiple CPUs and core, has been able to for quite some time. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Thu Mar 23 12:38:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 289C49DCAD4 for ; Thu, 23 Mar 2006 12:38: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 66604-02 for ; Thu, 23 Mar 2006 12:38:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id DDBD49DC948 for ; Thu, 23 Mar 2006 12:38:22 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Thu, 23 Mar 2006 16:38:21 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 23 Mar 2006 10:38:21 -0600 Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core From: Scott Marlowe To: Jojo Paderes Cc: pgsql-performance@postgresql.org In-Reply-To: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1143131901.17999.67.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 23 Mar 2006 10:38:21 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.144 required=5 tests=[AWL=0.143, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.144 X-Spam-Level: X-Archive-Number: 200603/474 X-Sequence-Number: 17911 On Thu, 2006-03-23 at 00:19, Jojo Paderes wrote: > I'd like to know if the latest PostgreSQL release can scale up by > utilizing multiple cpu or dual core cpu to boost up the sql > executions. > > I already do a research on the PostgreSQL mailing archives and only > found old threads dating back 2000. A lot of things have improved with > PostgreSQL and hopefully the support for multiple cpu or dual cores is > already provided. Can a single query be split up into parts and run on separate processors at the same time? No. Can multiple incoming queries be run on different processors for better performance? Yes. Has someone been working on the problem of splitting a query into pieces and running it on multiple CPUs / multiple machines? Yes. Bizgress has done that. From pgsql-performance-owner@postgresql.org Thu Mar 23 12:43:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9F5A89DC853 for ; Thu, 23 Mar 2006 12:43: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 67803-02 for ; Thu, 23 Mar 2006 12:43:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from projects.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by postgresql.org (Postfix) with ESMTP id 6C1759DC80A for ; Thu, 23 Mar 2006 12:43:44 -0400 (AST) Received: from [192.168.1.5] (or-67-76-146-141.sta.sprint-hsd.net [67.76.146.141]) (authenticated bits=0) by projects.commandprompt.com (8.13.4/8.13.4) with ESMTP id k2NGhYH0032762; Thu, 23 Mar 2006 08:43:37 -0800 Message-ID: <4422D033.2030407@commandprompt.com> Date: Thu, 23 Mar 2006 08:43:31 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mail/News 1.5 (X11/20060309) MIME-Version: 1.0 To: Scott Marlowe CC: Jojo Paderes , pgsql-performance@postgresql.org Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> In-Reply-To: <1143131901.17999.67.camel@state.g2switchworks.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (projects.commandprompt.com [192.168.2.159]); Thu, 23 Mar 2006 08:43:38 -0800 (PST) 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: 200603/475 X-Sequence-Number: 17912 > Has someone been working on the problem of splitting a query into pieces > and running it on multiple CPUs / multiple machines? Yes. Bizgress has > done that. I believe that is limited to Bizgress MPP yes? > > ---------------------------(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 Mar 23 13:02:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 331179DCA52 for ; Thu, 23 Mar 2006 13:02: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 70969-03 for ; Thu, 23 Mar 2006 13:02:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 0AE529DCA2F for ; Thu, 23 Mar 2006 13:02:44 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Thu, 23 Mar 2006 17:02:44 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 23 Mar 2006 11:02:44 -0600 Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core From: Scott Marlowe To: "Joshua D. Drake" Cc: Jojo Paderes , pgsql-performance@postgresql.org In-Reply-To: <4422D033.2030407@commandprompt.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> <4422D033.2030407@commandprompt.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1143133364.17999.77.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 23 Mar 2006 11:02:44 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.144 required=5 tests=[AWL=0.143, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.144 X-Spam-Level: X-Archive-Number: 200603/476 X-Sequence-Number: 17913 On Thu, 2006-03-23 at 10:43, Joshua D. Drake wrote: > > Has someone been working on the problem of splitting a query into pieces > > and running it on multiple CPUs / multiple machines? Yes. Bizgress has > > done that. > > I believe that is limited to Bizgress MPP yes? Yep. I hope that someday it will be released to the postgresql global dev group for inclusion. Or at least parts of it. From pgsql-performance-owner@postgresql.org Thu Mar 23 22:38:12 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 979459DCC6C for ; Thu, 23 Mar 2006 22: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 85604-03 for ; Thu, 23 Mar 2006 22:38:15 -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 EBD7C9DC8DA for ; Thu, 23 Mar 2006 22:38:08 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0570730920; Fri, 24 Mar 2006 03:38:13 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Date: Thu, 23 Mar 2006 21:22:34 -0500 Organization: cbbrowne Computing Inc Lines: 26 Message-ID: <87hd5olgyd.fsf@wolfe.cbbrowne.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> <4422D033.2030407@commandprompt.com> <1143133364.17999.77.camel@state.g2switchworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:4Pzri7CFuX7/yhBkBcSxl5L4qvQ= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.717 required=5 tests=[AWL=-0.096, INFO_TLD=0.813] X-Spam-Score: 0.717 X-Spam-Level: X-Archive-Number: 200603/477 X-Sequence-Number: 17914 Martha Stewart called it a Good Thing when smarlowe@g2switchworks.com (Scott Marlowe) wrote: > On Thu, 2006-03-23 at 10:43, Joshua D. Drake wrote: >> > Has someone been working on the problem of splitting a query into pieces >> > and running it on multiple CPUs / multiple machines? Yes. Bizgress has >> > done that. >> >> I believe that is limited to Bizgress MPP yes? > > Yep. I hope that someday it will be released to the postgresql global > dev group for inclusion. Or at least parts of it. Question: Does the Bizgress/MPP use threading for this concurrency? Or forking? If it does so via forking, that's more portable, and less dependent on specific complexities of threading implementations (which amounts to non-portability ;-)). Most times Jan comes to town, we spend a few minutes musing about the "splitting queries across threads" problem, and dismiss it again; if there's the beginning of a "split across processes," that's decidedly neat :-). -- output = reverse("moc.liamg" "@" "enworbbc") http://linuxfinances.info/info/internet.html Why do we put suits in a garment bag, and put garments in a suitcase? From pgsql-performance-owner@postgresql.org Fri Mar 24 00:33:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0F3899DC9DB for ; Fri, 24 Mar 2006 00:33: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 09186-01 for ; Fri, 24 Mar 2006 00:32:59 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id B52AF9DC9AC for ; Fri, 24 Mar 2006 00:32:58 -0400 (AST) Received: from mx1.vodamail.co.za (mx1.vodamail.co.za [196.11.146.148]) by svr4.postgresql.org (Postfix) with ESMTP id 3CEB05AF9B9 for ; Fri, 24 Mar 2006 04:32:57 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mx1.vodamail.co.za (Postfix) with ESMTP id 3793A4ACAD for ; Fri, 24 Mar 2006 06:32:51 +0200 (SAST) Received: from mx1.vodamail.co.za ([127.0.0.1]) by localhost (mx1.vodamail.co.za [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25186-10 for ; Fri, 24 Mar 2006 06:32:49 +0200 (SAST) Received: from josh.flame2.flame.co.za (unknown [10.50.171.33]) by mx1.vodamail.co.za (Postfix) with ESMTP id B125E4D10E for ; Fri, 24 Mar 2006 06:32:48 +0200 (SAST) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by josh.flame2.flame.co.za (8.12.11/8.12.11) with ESMTP id k2O4WUGX004174 for ; Fri, 24 Mar 2006 06:32:32 +0200 Subject: Re: Indexes with descending date columns From: Theo Kramer Reply-To: theo@flame.co.za To: pgsql-performance@postgresql.org In-Reply-To: <20060323141622.GC4881@surnet.cl> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323141622.GC4881@surnet.cl> Content-Type: text/plain Organization: Flame Computing Enterprises cc Message-Id: <1143174749.2820.2.camel@josh> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 24 Mar 2006 06:32:29 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at vodamail.co.za 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: 200603/478 X-Sequence-Number: 17915 On Thu, 2006-03-23 at 16:16, Alvaro Herrera wrote: > Theo Kramer wrote: > > > All good input - thanks, however, before I start messing with my stuff > > which I know will be complex - some questions to any of the developers > > on the list. > > > > i Is it feasible to extend index creation to support descending > > columns? ... this is supported on other commercial and non > > commercial databases, but I do not know if this is a SQL standard. > > This can be done. You need to create an operator class which specifies > the reverse sort order (i.e. reverse the operators), and then use it in > the new index. Hmmm, would that then result in the following syntax being valid? create index my_idx on my_table (c1, c2 desc, c3, c4 desc) ; where my_table is defined as create table my_table ( c1 text, c2 timestamp, c3 integer, c4 integer ); If so, I would appreciate any pointers on where to start on this - already fumbling my way through Interfacing Extensions To Indexes in the manual... Regards Theo -- Regards Theo From pgsql-performance-owner@postgresql.org Fri Mar 24 00:59:24 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 881FE9DC9DB for ; Fri, 24 Mar 2006 00:59: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 12177-04 for ; Fri, 24 Mar 2006 00:59: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 407AC9DC803 for ; Fri, 24 Mar 2006 00:59:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2O4xDDH027699; Thu, 23 Mar 2006 23:59:13 -0500 (EST) To: theo@flame.co.za cc: pgsql-performance@postgresql.org Subject: Re: Indexes with descending date columns In-reply-to: <1143174749.2820.2.camel@josh> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323141622.GC4881@surnet.cl> <1143174749.2820.2.camel@josh> Comments: In-reply-to Theo Kramer message dated "Fri, 24 Mar 2006 06:32:29 +0200" Date: Thu, 23 Mar 2006 23:59:13 -0500 Message-ID: <27697.1143176353@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/479 X-Sequence-Number: 17916 Theo Kramer writes: > If so, I would appreciate any pointers on where to start on this - > already fumbling my way through Interfacing Extensions To Indexes in the > manual... Search the PG list archives for discussions of reverse-sort opclasses. It's really pretty trivial, once you've created a negated btree comparison function for the datatype. This is the sort of thing that we are almost but not quite ready to put into the standard distribution. The issues that are bugging me have to do with whether NULLs sort low or high --- right now, if you make a reverse-sort opclass, it will effectively sort NULLs low instead of high, and that has some unpleasant consequences because the rest of the system isn't prepared for variance on the point (in particular I'm afraid this could break mergejoins). I'd like to see us make "NULLs low" vs "NULLs high" be a defined property of opclasses, and deal with the fallout from that, and then we could put reverse-sort opclasses for all the standard datatypes into the regular distribution. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 24 06:05:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C0EC99DC83F for ; Fri, 24 Mar 2006 06:05: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 67844-07 for ; Fri, 24 Mar 2006 06:05:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id AFB779DC9DB for ; Fri, 24 Mar 2006 06:05:12 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id D470556423; Fri, 24 Mar 2006 04:05:14 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 04:05:14 -0600 Date: Fri, 24 Mar 2006 04:05:14 -0600 From: "Jim C. Nasby" To: Kris Jurka Cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060324100514.GN90527@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:books@ejurka.com::/Q2J/8rMlleaNlWb:02nNy X-Hashcash: 1:20:060324:simon@2ndquadrant.com::vRYWfZWV7oCdSUlR:0000000000000000 0000000000000000000000002gVH X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::q3nlUblwimUIhrhf:00000 0000000000000000000000000g0Y X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/480 X-Sequence-Number: 17917 On Wed, Mar 22, 2006 at 02:37:28PM -0500, Kris Jurka wrote: > > > On Wed, 22 Mar 2006, Jim C. Nasby wrote: > > >Ok, I saw disk activity on the base directory and assumed it was pg_xlog > >stuff. Turns out that both SELECT INTO and CREATE TABLE AS ignore > >default_tablepsace and create the new tables in the base directory. I'm > >guessing that's a bug... (this is on 8.1.2, btw). > > This has been fixed in CVS HEAD as part of a patch to allow additional > options to CREATE TABLE AS. > > http://archives.postgresql.org/pgsql-patches/2006-02/msg00211.php I'll argue that the current behavior is still a bug and should be fixed. Would it be difficult to patch 8.1 (and 8.0 if there were tablespaces then...) to honor default_tablespace? -- 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 Mar 24 06:07:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 860D79DC82F for ; Fri, 24 Mar 2006 06:07: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 65947-09 for ; Fri, 24 Mar 2006 06:07:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 549039DC94D for ; Fri, 24 Mar 2006 06:07:29 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id EA46F56437; Fri, 24 Mar 2006 04:07:31 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 04:07:31 -0600 Date: Fri, 24 Mar 2006 04:07:31 -0600 From: "Jim C. Nasby" To: Qingqing Zhou Cc: pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060324100731.GO90527@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:zhouqq@cs.toronto.edu::sQLl5JybO2TSaxCz:0000000000000000 0000000000000000000000002oAE X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::Bi52puXzpPYbH7mG:00000 00000000000000000000000005mn X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/481 X-Sequence-Number: 17918 On Wed, Mar 22, 2006 at 02:20:39PM +0800, Qingqing Zhou wrote: > > "Simon Riggs" wrote > > On Tue, 2006-03-21 at 06:22 -0600, Jim C. Nasby wrote: > > > Currently, it appears that SELECT * INTO new_table FROM old_table logs > > > each page as it's written to WAL. Is this actually needed? Couldn't the > > > database simply log that the SELECT ... INTO statement was executed > > > instead? Doing so would likely result in a large performance improvement > > > in most installs. Is there no provision for writing anything but data > > > page changes (or whole pages) to WAL? > > > > AFAIK it takes the same code path as CREATE TABLE AS SELECT, which > > already does exactly what you suggest (except when using PITR). > > > > As I read, they did take the same code path, but did they "simply log that > the SELECT ... INTO statement was executed"? If so, how can we rely on the > unreliable content of the old_table to do recovery? Why would the content of the old_table be unreliable? If we've replayed logs up to the point of the CTAS then any data that would be visible to the CTAS should be fine, no? Though, the way Tom put it in one of his replies it sounds like WAL doesn't do any kind of statement logging, only data logging. If that's the case I'm not sure that the CTAS would actually get replayed. But I suspect I'm just misunderstanding... -- 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 Mar 24 06:14:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 408FD9DC842 for ; Fri, 24 Mar 2006 06:14: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 70890-02 for ; Fri, 24 Mar 2006 06:14:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D09769DC82F for ; Fri, 24 Mar 2006 06:14:38 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 1E01C56427; Fri, 24 Mar 2006 04:14:41 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 04:14:40 -0600 Date: Fri, 24 Mar 2006 04:14:40 -0600 From: "Jim C. Nasby" To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Message-ID: <20060324101440.GP90527@pervasive.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> <4422D033.2030407@commandprompt.com> <1143133364.17999.77.camel@state.g2switchworks.com> <87hd5olgyd.fsf@wolfe.cbbrowne.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87hd5olgyd.fsf@wolfe.cbbrowne.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:cbbrowne@acm.org::VqXyjH08aU3/khSi:01701 X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::I3fflTCe2p1o1EzC:00000 0000000000000000000000005eDB X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/482 X-Sequence-Number: 17919 On Thu, Mar 23, 2006 at 09:22:34PM -0500, Christopher Browne wrote: > Martha Stewart called it a Good Thing when smarlowe@g2switchworks.com (Scott Marlowe) wrote: > > On Thu, 2006-03-23 at 10:43, Joshua D. Drake wrote: > >> > Has someone been working on the problem of splitting a query into pieces > >> > and running it on multiple CPUs / multiple machines? Yes. Bizgress has > >> > done that. > >> > >> I believe that is limited to Bizgress MPP yes? > > > > Yep. I hope that someday it will be released to the postgresql global > > dev group for inclusion. Or at least parts of it. > > Question: Does the Bizgress/MPP use threading for this concurrency? > Or forking? > > If it does so via forking, that's more portable, and less dependent on > specific complexities of threading implementations (which amounts to > non-portability ;-)). > > Most times Jan comes to town, we spend a few minutes musing about the > "splitting queries across threads" problem, and dismiss it again; if > there's the beginning of a "split across processes," that's decidedly > neat :-). Correct me if I'm wrong, but there's no way to (reasonably) accomplish that without having some dedicated extra processes laying around that you can use to execute the queries, no? In other words, the cost of a fork() during query execution would be too prohibitive... FWIW, DB2 executes all queries in a dedicated set of processes. The process handling the connection from the client will pass a query request off to one of the executor processes. I can't remember which process actually plans the query, but I know that the executor runs 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 Fri Mar 24 06:16:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E7ADC9DC83F for ; Fri, 24 Mar 2006 06:16: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 69050-09 for ; Fri, 24 Mar 2006 06:16:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id A5ECB9DC82F for ; Fri, 24 Mar 2006 06:16:52 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 3B7D156435; Fri, 24 Mar 2006 04:16:55 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 04:16:54 -0600 Date: Fri, 24 Mar 2006 04:16:54 -0600 From: "Jim C. Nasby" To: Edoardo Serra Cc: Scott Marlowe , pgsql-performance@postgresql.org Subject: Re: Postmaster using only 4-5% CPU Message-ID: <20060324101654.GQ90527@pervasive.com> References: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> <1142963080.17883.193.camel@state.g2switchworks.com> <7.0.0.16.2.20060322120000.0796c930@webrainstorm.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7.0.0.16.2.20060322120000.0796c930@webrainstorm.it> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:osdevel@webrainstorm.it::VJdPaCoWOfeNeLkg:00000000000000 0000000000000000000000000Xrw X-Hashcash: 1:20:060324:smarlowe@g2switchworks.com::HGftchYcBNt0XYWY:00000000000 0000000000000000000000008GkH X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::fOuJX/9eR1vlKjmM:00000 0000000000000000000000000SHU X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/483 X-Sequence-Number: 17920 On Thu, Mar 23, 2006 at 10:14:24AM +0100, Edoardo Serra wrote: > >Now, for the interesting test. Run the import on both machines, with > >the begin; commit; pairs around it. Halfway through the import, pull > >the power cord, and see which one comes back up. Don't do this to > >servers with data you like, only test machines, obviously. For an even > >more interesting test, do this with MySQL, Oracle, DB2, etc... > > I will surely run a test like this ;) If you do, I'd be *very* interested in the results. Pervasive would probably pay for a whitepaper about this, btw (see http://www.pervasivepostgres.com/postgresql/partners_in_publishing.asp). -- 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 Mar 24 06:21:40 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 38E039DC82F for ; Fri, 24 Mar 2006 06:21: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 70118-09 for ; Fri, 24 Mar 2006 06:21:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C0E5E9DC83F for ; Fri, 24 Mar 2006 06:21:37 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id ABBDC56423; Fri, 24 Mar 2006 04:21:39 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 04:21:38 -0600 Date: Fri, 24 Mar 2006 04:21:38 -0600 From: "Jim C. Nasby" To: Theo Kramer Cc: pgsql-performance@postgresql.org Subject: Re: Indexes with descending date columns Message-ID: <20060324102138.GR90527@pervasive.com> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:theo@flame.co.za::kjVGTy5Snb/wxTKn:0AdL9 X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::B7RtrVFzHyps6w/e:00000 0000000000000000000000002vWv X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/484 X-Sequence-Number: 17921 On Thu, Mar 23, 2006 at 01:09:49PM +0200, Theo Kramer wrote: > ii If no to i, is it feasible to extend PostgreSQL to allow traversing > an index in column descending and column ascending order - assuming > an order by on more than one column with column order not > in the same direction and indexes existing? ... if that makes sense. Yes. stats=# explain select * from email_contrib order by project_id desc, id desc, date desc limit 10; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Limit (cost=0.00..31.76 rows=10 width=24) -> Index Scan Backward using email_contrib_pkey on email_contrib (cost=0.00..427716532.18 rows=134656656 width=24) (2 rows) -- 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 Mar 24 06:25:22 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 28B079DCB86 for ; Fri, 24 Mar 2006 06:25: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 73153-02 for ; Fri, 24 Mar 2006 06:25:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D38379DCBD6 for ; Fri, 24 Mar 2006 06:25:18 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id CDBAE56431; Fri, 24 Mar 2006 04:25:20 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 04:25:20 -0600 Date: Fri, 24 Mar 2006 04:25:20 -0600 From: "Jim C. Nasby" To: Bendik Rognlien Johansen Cc: pgsql-performance@postgresql.org Subject: Re: Problem with query, server totally unresponsive Message-ID: <20060324102520.GS90527@pervasive.com> References: <0B8E0D23-F08D-457D-B26F-1D475F8064F4@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0B8E0D23-F08D-457D-B26F-1D475F8064F4@gmail.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:bendik.johansen@gmail.com::0mpzCp7Chr0/IMea:000000000000 0000000000000000000000003nu0 X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::TVjVTIFK12heV5t5:00000 0000000000000000000000000J2y X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/485 X-Sequence-Number: 17922 On Thu, Mar 23, 2006 at 01:12:08PM +0100, Bendik Rognlien Johansen wrote: > Hello, I have a big problem with one of my databases. When i run my > query, after a few minutes, the postmaster shows 99% mem i top, and > the server becomes totally unresponsive. You've got a bunch of sorts going on; could you be pushing the machine into swapping? > I get this message when I try to cancel the query: > > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while processing the request. > The connection to the server was lost. Attempting reset: Failed. Did you send a kill of some kind to the backend? > The machine has 2x Intel dual core processors (3GHz) and 2 Gigs of ram. Unless I missed some big news recently, no such CPU exists. Hyperthreading is absolutely not the same as dual core, and many people have found that it's best to disable hyperthreading on database servers. -- 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 Mar 24 08:39:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 78A0B9DC82F for ; Fri, 24 Mar 2006 08:39: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 97273-09 for ; Fri, 24 Mar 2006 08:39:06 -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 B48FE9DC813 for ; Fri, 24 Mar 2006 08:39:00 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 24 Mar 2006 08:39:03 -0400 X-IronPort-AV: i="4.02,198,1139194800"; d="scan'208"; a="38452042:sNHT18358840" Received: from alvh.no-ip.org (201.221.200.224) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00BCDDF2; Fri, 24 Mar 2006 08:39:03 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 14611C3A2D0; Fri, 24 Mar 2006 08:39:03 -0400 (CLT) Date: Fri, 24 Mar 2006 08:39:02 -0400 From: Alvaro Herrera To: "Jim C. Nasby" Cc: Qingqing Zhou , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060324123902.GA14217@surnet.cl> Mail-Followup-To: "Jim C. Nasby" , Qingqing Zhou , pgsql-performance@postgresql.org References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060324100731.GO90527@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060324100731.GO90527@pervasive.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.578 required=5 tests=[AWL=-0.341, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.578 X-Spam-Level: * X-Archive-Number: 200603/486 X-Sequence-Number: 17923 Jim C. Nasby wrote: > Why would the content of the old_table be unreliable? If we've replayed > logs up to the point of the CTAS then any data that would be visible to > the CTAS should be fine, no? > > Though, the way Tom put it in one of his replies it sounds like WAL > doesn't do any kind of statement logging, only data logging. If that's > the case I'm not sure that the CTAS would actually get replayed. But I > suspect I'm just misunderstanding... The CTAS doesn't get logged (nor replayed obviously). What happens is that the involved files are fsync'ed before transaction commit, AFAIR. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support From pgsql-performance-owner@postgresql.org Fri Mar 24 08:42:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9F7559DC87D for ; Fri, 24 Mar 2006 08:42: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 99450-02 for ; Fri, 24 Mar 2006 08:42:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id B36C29DC842 for ; Fri, 24 Mar 2006 08:42:07 -0400 (AST) Received: (qmail 2300 invoked by uid 514); 24 Mar 2006 14:44:33 +0100 Received: from 62.37.217.236 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.217.236):SA:0(-1.0/5.0):. Processed in 0.605313 secs); 24 Mar 2006 13:44:33 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.217.236):SA:0(-1.0/5.0):. Processed in 0.605313 secs Process 2290) Received: from 62-37-217-236.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.217.236) by mail.rentalia.net with SMTP; 24 Mar 2006 14:44:32 +0100 Message-ID: <4423E90E.2090607@rentalia.com> Date: Fri, 24 Mar 2006 13:41:50 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Array performance References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> In-Reply-To: <20060323132448.GB4881@surnet.cl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/487 X-Sequence-Number: 17924 Hi, I have a select like SELECT (array[20]+array[21]+ ... +array[50]+array[51]) as total FROM table WHERE (array[20]+array[21]+ ... +array[50]+array[51])<5000 AND array[20]<>0 AND array[21]<>0 ... AND array[50]<>0 AND array[51])<>0 Any ideas to make this query faster? From pgsql-performance-owner@postgresql.org Fri Mar 24 08:48:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 428389DCD92 for ; Fri, 24 Mar 2006 08: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 01328-01 for ; Fri, 24 Mar 2006 08:48:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cicero2.cybercity.dk (cicero2.cybercity.dk [212.242.40.53]) by postgresql.org (Postfix) with ESMTP id 6E9EC9DCD91 for ; Fri, 24 Mar 2006 08:48:45 -0400 (AST) Received: from user4.cybercity.dk (user4.cybercity.dk [212.242.41.50]) by cicero2.cybercity.dk (Postfix) with ESMTP id 0694D245233 for ; Fri, 24 Mar 2006 13:48:45 +0100 (CET) Received: from [192.168.0.79] (0x3e42eeca.adsl.cybercity.dk [62.66.238.202]) by user4.cybercity.dk (Postfix) with ESMTP id AAB8950282 for ; Fri, 24 Mar 2006 13:48:44 +0100 (CET) Message-ID: <4423EACD.80706@krap.dk> Date: Fri, 24 Mar 2006 13:49:17 +0100 From: Svenne Krap User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Performance problems with multiple layers of functions Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms010808000203030803030100" 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: 200603/488 X-Sequence-Number: 17925 This is a cryptographically signed message in MIME format. --------------ms010808000203030803030100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi there. I have hit a edge in the planning and I hope you can help. The system uses a lot of stored procedures to move as much of the intelligence into the database layer as possible. My (development) query looks like and runs reasonably fast: explain analyze select dataset_id, entity, sum(amount) from entrydata_current where flow_direction in (select * from outflow_direction(dataset_id)) and dataset_id in (122,112,125,89,111) group by dataset_id, entity; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=918171.00..918171.30 rows=24 width=19) (actual time=11533.297..11533.340 rows=50 loops=1) -> Bitmap Heap Scan on entrydata_current (cost=676.72..917736.04 rows=57994 width=19) (actual time=23.921..11425.373 rows=37870 loops=1) Recheck Cond: ((dataset_id = 122) OR (dataset_id = 112) OR (dataset_id = 125) OR (dataset_id = 89) OR (dataset_id = 111)) Filter: (subplan) -> BitmapOr (cost=676.72..676.72 rows=117633 width=0) (actual time=15.765..15.765 rows=0 loops=1) -> Bitmap Index Scan on entrydata_current_dataset_idx (cost=0.00..83.97 rows=14563 width=0) (actual time=1.881..1.881 rows=13728 loops=1) Index Cond: (dataset_id = 122) -> Bitmap Index Scan on entrydata_current_dataset_idx (cost=0.00..156.12 rows=27176 width=0) (actual time=3.508..3.508 rows=25748 loops=1) Index Cond: (dataset_id = 112) -> Bitmap Index Scan on entrydata_current_dataset_idx (cost=0.00..124.24 rows=21498 width=0) (actual time=2.729..2.729 rows=20114 loops=1) Index Cond: (dataset_id = 125) -> Bitmap Index Scan on entrydata_current_dataset_idx (cost=0.00..102.20 rows=17771 width=0) (actual time=2.351..2.351 rows=17344 loops=1) Index Cond: (dataset_id = 89) -> Bitmap Index Scan on entrydata_current_dataset_idx (cost=0.00..210.19 rows=36625 width=0) (actual time=5.292..5.292 rows=37118 loops=1) Index Cond: (dataset_id = 111) SubPlan -> Function Scan on outflow_direction (cost=0.00..12.50 rows=1000 width=4) (actual time=0.093..0.095 rows=4 loops=114052) Total runtime: 11540.506 ms (18 rows) The problem is, that the application should not need to know the five dataset_ids (it will always know one - its own). So I make a function to return the five ids and then the query looks like: explain select dataset_id, entity, sum(amount) from entrydata_current where flow_direction in (select * from outflow_direction(dataset_id)) and dataset_id in (select * from get_dataset_ids(122)) group by dataset_id, entity; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=24672195.68..24672203.88 rows=656 width=19) -> Hash IN Join (cost=15.00..24660005.45 rows=1625364 width=19) Hash Cond: ("outer".dataset_id = "inner".get_dataset_ids) -> Index Scan using entrydata_current_dataset_idx on entrydata_current (cost=0.00..24558405.20 rows=1625364 width=19) Filter: (subplan) SubPlan -> Function Scan on outflow_direction (cost=0.00..12.50 rows=1000 width=4) -> Hash (cost=12.50..12.50 rows=1000 width=4) -> Function Scan on get_dataset_ids (cost=0.00..12.50 rows=1000 width=4) (9 rows) which does not return within 10 minutes - which is unacceptable. Is there any way to get a better plan for the second ? The planner should really see the two queries as equal as there is no dependencies between the outer query and get_dataset_ids (isn't it called constant folding?). Thanks in advance Svenne --------------ms010808000203030803030100 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKTjCC BSMwggQLoAMCAQICBD/KpecwDQYJKoZIhvcNAQEFBQAwMTELMAkGA1UEBhMCREsxDDAKBgNV BAoTA1REQzEUMBIGA1UEAxMLVERDIE9DRVMgQ0EwHhcNMDUwMjIzMTMxMTMwWhcNMDcwMjIz MTM0MTMwWjBzMQswCQYDVQQGEwJESzEpMCcGA1UEChMgSW5nZW4gb3JnYW5pc2F0b3Jpc2sg dGlsa255dG5pbmcxOTASBgNVBAMTC1N2ZW5uZSBLcmFwMCMGA1UEBRMcUElEOjk4MDItMjAw Mi0yLTk3OTMxMTk0MjAyNzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApF423aqlHV/8 RiX5vX5QezMEXKixU6KUSUQOfERsFgahaUn5LobNfxB31+5nKVH3EJfK/UpcE4Alfsa87+hX MBRzaAv5jbwh57NFSNcmFD/wgcIYupvyWhASacjcBnBfiqNuDBVIT7wL42yijfM3LSVjJOPw /c5R5wwFfKqjKzMCAwEAAaOCAoMwggJ/MA4GA1UdDwEB/wQEAwID+DArBgNVHRAEJDAigA8y MDA1MDIyMzEzMTEzMFqBDzIwMDcwMjIzMTM0MTMwWjCCATcGA1UdIASCAS4wggEqMIIBJgYK KoFQgSkBAQEBAjCCARYwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5kay9y ZXBvc2l0b3J5MIHiBggrBgEFBQcCAjCB1TAKFgNUREMwAwIBARqBxkZvciBhbnZlbmRlbHNl IGFmIGNlcnRpZmlrYXRldCBn5mxkZXIgT0NFUyB2aWxr5XIsIENQUyBvZyBPQ0VTIENQLCBk ZXIga2FuIGhlbnRlcyBmcmEgd3d3LmNlcnRpZmlrYXQuZGsvcmVwb3NpdG9yeS4gQmVt5nJr LCBhdCBUREMgZWZ0ZXIgdmlsa+VyZW5lIGhhciBldCBiZWdy5m5zZXQgYW5zdmFyIGlmdC4g cHJvZmVzc2lvbmVsbGUgcGFydGVyLjAZBgNVHREEEjAQgQ5zdmVubmVAa3JhcC5kazCBgwYD VR0fBHwwejBKoEigRqREMEIxCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMT C1REQyBPQ0VTIENBMQ8wDQYDVQQDEwZDUkw1NjgwLKAqoCiGJmh0dHA6Ly9jcmwub2Nlcy5j ZXJ0aWZpa2F0LmRrL29jZXMuY3JsMB8GA1UdIwQYMBaAFGC1hexWZH4SGSdnHVAVS3OuO/kS MB0GA1UdDgQWBBTmRrmEbRpZf+Pt0S/qphnyMgKoRzAJBgNVHRMEAjAAMBkGCSqGSIb2fQdB AAQMMAobBFY3LjEDAgOoMA0GCSqGSIb3DQEBBQUAA4IBAQBgfOEd/VkXc6lFNItNvhgrbPc3 eNcGE7l6sbaG1gYLREn4xmmYajtP90INRG3OlNm3ZlVeYxaMbzQKVlcrKMEwA7cMZIMcT97t KjXabwqCc/0jNCPceO/ZPoUc7T3fuF7B1QjJelzXsoK4av2lDDgaAJL8WiExsGYmJ0BwfNLZ YjLRwJ+Db4gsmvjTFazbkRtzqqqAzjy2WC6L4WEuS6EUmDhdX/ZFdq0bT58lx++DKo+TuDu3 bkIi46l6yV5lI4CgBRTmahRyyCuUMjDUiLvgX1m3Ys/U5c88MDgwrKtLcXy7TyCEazOLVC5z vAgKvNjbdSQjkFZEDiA/oVtwGNH6MIIFIzCCBAugAwIBAgIEP8ql5zANBgkqhkiG9w0BAQUF ADAxMQswCQYDVQQGEwJESzEMMAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAe Fw0wNTAyMjMxMzExMzBaFw0wNzAyMjMxMzQxMzBaMHMxCzAJBgNVBAYTAkRLMSkwJwYDVQQK EyBJbmdlbiBvcmdhbmlzYXRvcmlzayB0aWxrbnl0bmluZzE5MBIGA1UEAxMLU3Zlbm5lIEty YXAwIwYDVQQFExxQSUQ6OTgwMi0yMDAyLTItOTc5MzExOTQyMDI3MIGfMA0GCSqGSIb3DQEB AQUAA4GNADCBiQKBgQCkXjbdqqUdX/xGJfm9flB7MwRcqLFTopRJRA58RGwWBqFpSfkuhs1/ EHfX7mcpUfcQl8r9SlwTgCV+xrzv6FcwFHNoC/mNvCHns0VI1yYUP/CBwhi6m/JaEBJpyNwG cF+Ko24MFUhPvAvjbKKN8zctJWMk4/D9zlHnDAV8qqMrMwIDAQABo4ICgzCCAn8wDgYDVR0P AQH/BAQDAgP4MCsGA1UdEAQkMCKADzIwMDUwMjIzMTMxMTMwWoEPMjAwNzAyMjMxMzQxMzBa MIIBNwYDVR0gBIIBLjCCASowggEmBgoqgVCBKQEBAQECMIIBFjAvBggrBgEFBQcCARYjaHR0 cDovL3d3dy5jZXJ0aWZpa2F0LmRrL3JlcG9zaXRvcnkwgeIGCCsGAQUFBwICMIHVMAoWA1RE QzADAgEBGoHGRm9yIGFudmVuZGVsc2UgYWYgY2VydGlmaWthdGV0IGfmbGRlciBPQ0VTIHZp bGvlciwgQ1BTIG9nIE9DRVMgQ1AsIGRlciBrYW4gaGVudGVzIGZyYSB3d3cuY2VydGlmaWth dC5kay9yZXBvc2l0b3J5LiBCZW3mcmssIGF0IFREQyBlZnRlciB2aWxr5XJlbmUgaGFyIGV0 IGJlZ3LmbnNldCBhbnN2YXIgaWZ0LiBwcm9mZXNzaW9uZWxsZSBwYXJ0ZXIuMBkGA1UdEQQS MBCBDnN2ZW5uZUBrcmFwLmRrMIGDBgNVHR8EfDB6MEqgSKBGpEQwQjELMAkGA1UEBhMCREsx DDAKBgNVBAoTA1REQzEUMBIGA1UEAxMLVERDIE9DRVMgQ0ExDzANBgNVBAMTBkNSTDU2ODAs oCqgKIYmaHR0cDovL2NybC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwHwYDVR0jBBgw FoAUYLWF7FZkfhIZJ2cdUBVLc647+RIwHQYDVR0OBBYEFOZGuYRtGll/4+3RL+qmGfIyAqhH MAkGA1UdEwQCMAAwGQYJKoZIhvZ9B0EABAwwChsEVjcuMQMCA6gwDQYJKoZIhvcNAQEFBQAD ggEBAGB84R39WRdzqUU0i02+GCts9zd41wYTuXqxtobWBgtESfjGaZhqO0/3Qg1Ebc6U2bdm VV5jFoxvNApWVysowTADtwxkgxxP3u0qNdpvCoJz/SM0I9x479k+hRztPd+4XsHVCMl6XNey grhq/aUMOBoAkvxaITGwZiYnQHB80tliMtHAn4NviCya+NMVrNuRG3OqqoDOPLZYLovhYS5L oRSYOF1f9kV2rRtPnyXH74Mqj5O4O7duQiLjqXrJXmUjgKAFFOZqFHLIK5QyMNSIu+BfWbdi z9TlzzwwODCsq0txfLtPIIRrM4tULnO8CAq82Nt1JCOQVkQOID+hW3AY0foxggIqMIICJgIB ATA5MDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMTC1REQyBPQ0VTIENB AgQ/yqXnMAkGBSsOAwIaBQCgggFHMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI hvcNAQkFMQ8XDTA2MDMyNDEyNDkxN1owIwYJKoZIhvcNAQkEMRYEFIxksC3WBd7kLBZdEDT4 MtKbmbPqMEgGCSsGAQQBgjcQBDE7MDkwMTELMAkGA1UEBhMCREsxDDAKBgNVBAoTA1REQzEU MBIGA1UEAxMLVERDIE9DRVMgQ0ECBD/KpecwSgYLKoZIhvcNAQkQAgsxO6A5MDExCzAJBgNV BAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMTC1REQyBPQ0VTIENBAgQ/yqXnMFIGCSqG SIb3DQEJDzFFMEMwCgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMA0GCCqGSIb3DQMCAgFA MAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABIGAT1oCeymBX6knJsK5 FBH0FiKc8pp9sfdbtHoEaC8xp4mwbHz8RUZjMWqn99trdBjcxrrNcxE7DaHVetmj9ApP9AkS Hmt5HMs/llKz4pajtJG+QnFnWxrJ0kt14+wvSQyMFC0GWv+JrtPAjIXXQLvrnqI/4FsRRWQY zZZI0CypSvgAAAAAAAA= --------------ms010808000203030803030100-- From pgsql-performance-owner@postgresql.org Fri Mar 24 08:52:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4B7C09DCCC9 for ; Fri, 24 Mar 2006 08:52: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 00621-06 for ; Fri, 24 Mar 2006 08:52:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id B85219DCB82 for ; Fri, 24 Mar 2006 08:52:42 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 8016A56427; Fri, 24 Mar 2006 06:52:46 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 06:52:45 -0600 Date: Fri, 24 Mar 2006 06:52:45 -0600 From: "Jim C. Nasby" To: Ruben Rubio Rey Cc: pgsql-performance@postgresql.org Subject: Re: Array performance Message-ID: <20060324125245.GB90527@pervasive.com> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4423E90E.2090607@rentalia.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:ruben@rentalia.com::YUed2gMHqV0eW7ec:0000000000000000000 0000000000000000000000009kxM X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::Ch4uy4Pv56TqgoLX:00000 0000000000000000000000002EDa X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/489 X-Sequence-Number: 17926 On Fri, Mar 24, 2006 at 01:41:50PM +0100, Ruben Rubio Rey wrote: > Hi, > > I have a select like > > SELECT (array[20]+array[21]+ ... +array[50]+array[51]) as total > FROM table > WHERE > (array[20]+array[21]+ ... +array[50]+array[51])<5000 http://www.varlena.com/GeneralBits/109.php might provide some useful insights. I also recall seeing something about sum operators for arrays, but I can't recall where. > AND array[20]<>0 > AND array[21]<>0 > ... > AND array[50]<>0 > AND array[51])<>0 Uhm... please don't tell me that you're using 0 in place of NULL... You might be able to greatly simplify that by use of ANY; you'd need to ditch elements 1-19 though: ... WHERE NOT ANY(array) = 0 See http://www.postgresql.org/docs/8.1/interactive/arrays.html -- 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 Mar 24 08:59:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 145E39DC87D for ; Fri, 24 Mar 2006 08:59: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 04240-01 for ; Fri, 24 Mar 2006 08:59:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C27999DC842 for ; Fri, 24 Mar 2006 08:59:16 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 4ADE656408; Fri, 24 Mar 2006 06:59:20 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 06:59:19 -0600 Date: Fri, 24 Mar 2006 06:59:19 -0600 From: "Jim C. Nasby" To: Svenne Krap Cc: pgsql-performance@postgresql.org Subject: Re: Performance problems with multiple layers of functions Message-ID: <20060324125919.GD90527@pervasive.com> References: <4423EACD.80706@krap.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4423EACD.80706@krap.dk> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:svenne@krap.dk::pkQQGUdrLi9ZZY5m:0005tpU X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::xD3P2ZgJk1+Pt3bg:00000 0000000000000000000000000o4d X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/490 X-Sequence-Number: 17927 On Fri, Mar 24, 2006 at 01:49:17PM +0100, Svenne Krap wrote: > explain select dataset_id, entity, sum(amount) from entrydata_current > where flow_direction in (select * from outflow_direction(dataset_id)) > and dataset_id in (select * from get_dataset_ids(122)) group by > dataset_id, entity; > which does not return within 10 minutes - which is unacceptable. The issue is that the planner has no way to know what's comming back from get_dataset_ids. I think your best bet will be to wrap that select into it's own function and have that function prepare the query statement, going back to hard-coded values. So you could do something like: SQL := 'SELECT ... AND dataset_id IN (''' || get_dataset_ids(122) || ''');' (yeah, I know that won't work as written, but you get the idea). -- 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 Mar 24 09:01:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 37F649DC804 for ; Fri, 24 Mar 2006 09: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 03920-07 for ; Fri, 24 Mar 2006 09:01:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D90969DC897 for ; Fri, 24 Mar 2006 09:01:17 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id E1B6356443; Fri, 24 Mar 2006 07:01:21 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 07:01:21 -0600 Date: Fri, 24 Mar 2006 07:01:21 -0600 From: "Jim C. Nasby" To: Qingqing Zhou , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060324130121.GE90527@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060324100731.GO90527@pervasive.com> <20060324123902.GA14217@surnet.cl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060324123902.GA14217@surnet.cl> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:zhouqq@cs.toronto.edu::Ku2iJFtn6JR+IPiQ:0000000000000000 0000000000000000000000002Ddt X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::f3v8uYgmt6ZvBdNa:00000 0000000000000000000000001Qwt X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/491 X-Sequence-Number: 17928 On Fri, Mar 24, 2006 at 08:39:02AM -0400, Alvaro Herrera wrote: > Jim C. Nasby wrote: > > > Why would the content of the old_table be unreliable? If we've replayed > > logs up to the point of the CTAS then any data that would be visible to > > the CTAS should be fine, no? > > > > Though, the way Tom put it in one of his replies it sounds like WAL > > doesn't do any kind of statement logging, only data logging. If that's > > the case I'm not sure that the CTAS would actually get replayed. But I > > suspect I'm just misunderstanding... > > The CTAS doesn't get logged (nor replayed obviously). What happens is > that the involved files are fsync'ed before transaction commit, AFAIR. Ahh, yes, that sounds right. Might be a nice gain to be had if there was some way to log the statement, but I suspect getting WAL to support that would be extremely non-trivial. -- 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 Mar 24 09:01:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2F3B9DCD79 for ; Fri, 24 Mar 2006 09:01: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 04157-03-2 for ; Fri, 24 Mar 2006 09:01:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id B42069DC897 for ; Fri, 24 Mar 2006 09:01:45 -0400 (AST) Received: (qmail 11315 invoked by uid 514); 24 Mar 2006 15:04:13 +0100 Received: from 62.37.217.236 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.217.236):SA:0(-2.1/5.0):. Processed in 1.666042 secs); 24 Mar 2006 14:04:13 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.217.236):SA:0(-2.1/5.0):. Processed in 1.666042 secs Process 11297) Received: from 62-37-217-236.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.217.236) by mail.rentalia.net with SMTP; 24 Mar 2006 15:04:11 +0100 Message-ID: <4423EDA9.3090502@rentalia.com> Date: Fri, 24 Mar 2006 14:01:29 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Array performance References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> <20060324125245.GB90527@pervasive.com> In-Reply-To: <20060324125245.GB90527@pervasive.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200603/492 X-Sequence-Number: 17929 Jim C. Nasby wrote: >On Fri, Mar 24, 2006 at 01:41:50PM +0100, Ruben Rubio Rey wrote: > > >>Hi, >> >>I have a select like >> >>SELECT (array[20]+array[21]+ ... +array[50]+array[51]) as total >>FROM table >>WHERE >>(array[20]+array[21]+ ... +array[50]+array[51])<5000 >> >> > >http://www.varlena.com/GeneralBits/109.php might provide some useful >insights. I also recall seeing something about sum operators for arrays, >but I can't recall where. > > I ll check it out, seems to be very useful Is faster create a function to sum the array? > > >>AND array[20]<>0 >>AND array[21]<>0 >>... >>AND array[50]<>0 >>AND array[51])<>0 >> >> > >Uhm... please don't tell me that you're using 0 in place of NULL... > > mmm ... i have read in postgres documentation that null values on arrays are not supported ... >You might be able to greatly simplify that by use of ANY; you'd need to >ditch elements 1-19 though: > >... WHERE NOT ANY(array) = 0 > > Yep this is much better. >See http://www.postgresql.org/docs/8.1/interactive/arrays.html > > From pgsql-performance-owner@postgresql.org Fri Mar 24 09:06:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 143339DC897 for ; Fri, 24 Mar 2006 09:06: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 02287-09 for ; Fri, 24 Mar 2006 09:06:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id EDED39DC83F for ; Fri, 24 Mar 2006 09:06:15 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 839805644B; Fri, 24 Mar 2006 07:06:19 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 07:06:19 -0600 Date: Fri, 24 Mar 2006 07:06:19 -0600 From: "Jim C. Nasby" To: Ruben Rubio Rey Cc: pgsql-performance@postgresql.org Subject: Re: Array performance Message-ID: <20060324130619.GF90527@pervasive.com> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> <20060324125245.GB90527@pervasive.com> <4423EDA9.3090502@rentalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4423EDA9.3090502@rentalia.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:ruben@rentalia.com::L8u9ChM8hFYNtFdz:0000000000000000000 0000000000000000000000000CL1 X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::6XbfeutSJtcjhije:00000 0000000000000000000000002Uhx X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/493 X-Sequence-Number: 17930 On Fri, Mar 24, 2006 at 02:01:29PM +0100, Ruben Rubio Rey wrote: > >http://www.varlena.com/GeneralBits/109.php might provide some useful > >insights. I also recall seeing something about sum operators for arrays, > >but I can't recall where. > > > > > I ll check it out, seems to be very useful > Is faster create a function to sum the array? There's been talk of having one, but I don't think any such thing currently exists. > >>AND array[20]<>0 > >>AND array[21]<>0 > >>... > >>AND array[50]<>0 > >>AND array[51])<>0 > >> > >> > > > >Uhm... please don't tell me that you're using 0 in place of NULL... > > > > > mmm ... i have read in postgres documentation that null values on arrays > are not supported ... Damn, you're right. Another reason I tend to stay away from them... -- 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 Mar 24 09:32:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 627BD9DC94D for ; Fri, 24 Mar 2006 09:32: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 10768-09 for ; Fri, 24 Mar 2006 09:33:01 -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 1FFFC9DC87D for ; Fri, 24 Mar 2006 09:32:55 -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 k2ODWrAw010079 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Mar 2006 06:32:56 -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 k2ODWroD038200; Fri, 24 Mar 2006 06:32:53 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k2ODWrhW038199; Fri, 24 Mar 2006 06:32:53 -0700 (MST) (envelope-from mfuhr) Date: Fri, 24 Mar 2006 06:32:53 -0700 From: Michael Fuhr To: "Jim C. Nasby" Cc: Ruben Rubio Rey , pgsql-performance@postgresql.org Subject: Re: Array performance Message-ID: <20060324133252.GA22688@winnie.fuhr.org> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> <20060324125245.GB90527@pervasive.com> <4423EDA9.3090502@rentalia.com> <20060324130619.GF90527@pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060324130619.GF90527@pervasive.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: 200603/494 X-Sequence-Number: 17931 On Fri, Mar 24, 2006 at 07:06:19AM -0600, Jim C. Nasby wrote: > On Fri, Mar 24, 2006 at 02:01:29PM +0100, Ruben Rubio Rey wrote: > > mmm ... i have read in postgres documentation that null values on arrays > > are not supported ... > > Damn, you're right. Another reason I tend to stay away from them... 8.2 will support NULL array elements. http://archives.postgresql.org/pgsql-committers/2005-11/msg00385.php http://developer.postgresql.org/docs/postgres/arrays.html test=> SELECT '{1,2,NULL,3,4}'::integer[]; int4 ---------------- {1,2,NULL,3,4} (1 row) -- Michael Fuhr From pgsql-performance-owner@postgresql.org Fri Mar 24 09:47:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4A62D9DC973 for ; Fri, 24 Mar 2006 09:47: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 14523-02 for ; Fri, 24 Mar 2006 09:47:23 -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 9290C9DC87D for ; Fri, 24 Mar 2006 09:47:17 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 24 Mar 2006 09:47:21 -0400 X-IronPort-AV: i="4.02,198,1139194800"; d="scan'208"; a="38461118:sNHT19519120" Received: from alvh.no-ip.org (201.221.200.224) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00BCFDBE; Fri, 24 Mar 2006 09:47:21 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id A7951C3A2D0; Fri, 24 Mar 2006 09:47:20 -0400 (CLT) Date: Fri, 24 Mar 2006 09:47:20 -0400 From: Alvaro Herrera To: "Jim C. Nasby" Cc: Qingqing Zhou , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060324134720.GA25359@surnet.cl> Mail-Followup-To: "Jim C. Nasby" , Qingqing Zhou , pgsql-performance@postgresql.org References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060324100731.GO90527@pervasive.com> <20060324123902.GA14217@surnet.cl> <20060324130121.GE90527@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060324130121.GE90527@pervasive.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.578 required=5 tests=[AWL=-0.341, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.578 X-Spam-Level: * X-Archive-Number: 200603/495 X-Sequence-Number: 17932 Jim C. Nasby wrote: > On Fri, Mar 24, 2006 at 08:39:02AM -0400, Alvaro Herrera wrote: > > Jim C. Nasby wrote: > > > > > Why would the content of the old_table be unreliable? If we've replayed > > > logs up to the point of the CTAS then any data that would be visible to > > > the CTAS should be fine, no? > > > > > > Though, the way Tom put it in one of his replies it sounds like WAL > > > doesn't do any kind of statement logging, only data logging. If that's > > > the case I'm not sure that the CTAS would actually get replayed. But I > > > suspect I'm just misunderstanding... > > > > The CTAS doesn't get logged (nor replayed obviously). What happens is > > that the involved files are fsync'ed before transaction commit, AFAIR. > > Ahh, yes, that sounds right. Might be a nice gain to be had if there was > some way to log the statement, but I suspect getting WAL to support that > would be extremely non-trivial. None at all, at least in the current incarnation, I think, because said query execution is dependent on the contents of the FSM, which is itself dependent on the timing of VACUUM and other stuff. Such an action, running with a different FSM content, can very trivially cause data corruption. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Fri Mar 24 09:59:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 24E1A9DC9AB for ; Fri, 24 Mar 2006 09:59: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 15236-05 for ; Fri, 24 Mar 2006 09:59:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 5B1A39DC859 for ; Fri, 24 Mar 2006 09:59:42 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 6148856431; Fri, 24 Mar 2006 07:59:47 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 07:59:46 -0600 Date: Fri, 24 Mar 2006 07:59:46 -0600 From: "Jim C. Nasby" To: Qingqing Zhou , pgsql-performance@postgresql.org Subject: Re: WAL logging of SELECT ... INTO command Message-ID: <20060324135946.GJ90527@pervasive.com> References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060324100731.GO90527@pervasive.com> <20060324123902.GA14217@surnet.cl> <20060324130121.GE90527@pervasive.com> <20060324134720.GA25359@surnet.cl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060324134720.GA25359@surnet.cl> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:zhouqq@cs.toronto.edu::Nx5yVuFXJvlZkwcO:0000000000000000 0000000000000000000000003LaU X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::psHRNWHuQY/+B4il:00000 0000000000000000000000003Mil X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/496 X-Sequence-Number: 17933 On Fri, Mar 24, 2006 at 09:47:20AM -0400, Alvaro Herrera wrote: > Jim C. Nasby wrote: > > On Fri, Mar 24, 2006 at 08:39:02AM -0400, Alvaro Herrera wrote: > > > Jim C. Nasby wrote: > > > > > > > Why would the content of the old_table be unreliable? If we've replayed > > > > logs up to the point of the CTAS then any data that would be visible to > > > > the CTAS should be fine, no? > > > > > > > > Though, the way Tom put it in one of his replies it sounds like WAL > > > > doesn't do any kind of statement logging, only data logging. If that's > > > > the case I'm not sure that the CTAS would actually get replayed. But I > > > > suspect I'm just misunderstanding... > > > > > > The CTAS doesn't get logged (nor replayed obviously). What happens is > > > that the involved files are fsync'ed before transaction commit, AFAIR. > > > > Ahh, yes, that sounds right. Might be a nice gain to be had if there was > > some way to log the statement, but I suspect getting WAL to support that > > would be extremely non-trivial. > > None at all, at least in the current incarnation, I think, because said > query execution is dependent on the contents of the FSM, which is itself > dependent on the timing of VACUUM and other stuff. Such an action, > running with a different FSM content, can very trivially cause data > corruption. Oh, duh, because subsiquent operations will depend on the heap being in a very specific state. Oh well. -- 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 Mar 24 10:46:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1F5709DCB8A for ; Fri, 24 Mar 2006 10:46: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 31668-03 for ; Fri, 24 Mar 2006 10:46:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id 942EA9DCB82 for ; Fri, 24 Mar 2006 10:46:51 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 86473841; Fri, 24 Mar 2006 06:46:54 -0800 From: "Dave Dutcher" To: "'Jim C. Nasby'" Cc: Subject: Re: Problem with query, server totally unresponsive Date: Fri, 24 Mar 2006 08:46:54 -0600 Message-ID: <000c01c64f51$cb71b590$8300a8c0@tridecap.com> 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.2627 In-Reply-To: <20060324102520.GS90527@pervasive.com> 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/497 X-Sequence-Number: 17934 > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- > owner@postgresql.org] On Behalf Of Jim C. Nasby > Subject: Re: [PERFORM] Problem with query, server totally unresponsive > > On Thu, Mar 23, 2006 at 01:12:08PM +0100, Bendik Rognlien Johansen wrote: > > Hello, I have a big problem with one of my databases. When i run my > > query, after a few minutes, the postmaster shows 99% mem i top, and > > the server becomes totally unresponsive. > > You've got a bunch of sorts going on; could you be pushing the machine > into swapping? > > > I get this message when I try to cancel the query: > > > > server closed the connection unexpectedly > > This probably means the server terminated abnormally > > before or while processing the request. > > The connection to the server was lost. Attempting reset: Failed. > > Did you send a kill of some kind to the backend? > > > The machine has 2x Intel dual core processors (3GHz) and 2 Gigs of ram. > > Unless I missed some big news recently, no such CPU exists. > Hyperthreading is absolutely not the same as dual core, and many people > have found that it's best to disable hyperthreading on database servers. Maybe I'm confused by the marketing, but I think those CPUs do exist. According to New Egg the Pentium D 830 and the Pentium D 930 both are dual core Pentiums that run at 3Ghz. It also specifically says these processors don't support hyper threading, so I believe they really have two cores. Maybe you are thinking he was talking about a 3Ghz Core Duo. http://www.newegg.com/Product/ProductList.asp?Category=34&N=2000340000+5 0001157+1302820275+1051007392&Submit=ENE Dave From pgsql-performance-owner@postgresql.org Fri Mar 24 10:57:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C2B289DCDA7 for ; Fri, 24 Mar 2006 10:57: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 34016-04 for ; Fri, 24 Mar 2006 10:57:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id B0AFD9DCDA5 for ; Fri, 24 Mar 2006 10:57:45 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id A53C956435; Fri, 24 Mar 2006 08:57:50 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 08:57:49 -0600 Date: Fri, 24 Mar 2006 08:57:49 -0600 From: "Jim C. Nasby" To: Dave Dutcher Cc: pgsql-performance@postgresql.org Subject: Re: Problem with query, server totally unresponsive Message-ID: <20060324145749.GR90527@pervasive.com> References: <20060324102520.GS90527@pervasive.com> <000c01c64f51$cb71b590$8300a8c0@tridecap.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000c01c64f51$cb71b590$8300a8c0@tridecap.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:dave@tridecap.com::AiGVSzh7w+xG7GDw:00000000000000000000 0000000000000000000000005fs0 X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::riuwy1alOTC1fMi6:00000 000000000000000000000000BQ4w X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/498 X-Sequence-Number: 17935 On Fri, Mar 24, 2006 at 08:46:54AM -0600, Dave Dutcher wrote: > > > The machine has 2x Intel dual core processors (3GHz) and 2 Gigs of > ram. > > > > Unless I missed some big news recently, no such CPU exists. > > Hyperthreading is absolutely not the same as dual core, and many > people > > have found that it's best to disable hyperthreading on database > servers. > > Maybe I'm confused by the marketing, but I think those CPUs do exist. > According to New Egg the Pentium D 830 and the Pentium D 930 both are > dual core Pentiums that run at 3Ghz. It also specifically says these > processors don't support hyper threading, so I believe they really have > two cores. Maybe you are thinking he was talking about a 3Ghz Core > Duo. A quick google shows I'm just behind the times; Intel does have true dual-core CPUs 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 Fri Mar 24 11:02:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7A5389DCDB0 for ; Fri, 24 Mar 2006 11:02: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 34173-06 for ; Fri, 24 Mar 2006 11:02:25 -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 14FD99DCD9F for ; Fri, 24 Mar 2006 11:02:18 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 24 Mar 2006 10:02:17 -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, 24 Mar 2006 10:02:17 -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.106]) with Microsoft Exchange Server HTTP-DAV ; Fri, 24 Mar 2006 15:02:16 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Fri, 24 Mar 2006 07:02:15 -0800 Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core From: "Luke Lonergan" To: "Christopher Browne" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Scaling up PostgreSQL in Multiple CPU / Dual Core Thread-Index: AcZO7BW6ms5ItFwPRG67q7a7SncUqQAZ9oI6 In-Reply-To: <87hd5olgyd.fsf@wolfe.cbbrowne.com> MIME-Version: 1.0 X-OriginalArrivalTime: 24 Mar 2006 15:02:17.0012 (UTC) FILETIME=[F0F53740:01C64F53] X-WSS-ID: 683AD67320C32886945-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.35 required=5 tests=[AWL=0.097, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.35 X-Spam-Level: * X-Archive-Number: 200603/499 X-Sequence-Number: 17936 Christopher, On 3/23/06 6:22 PM, "Christopher Browne" wrote: > Question: Does the Bizgress/MPP use threading for this concurrency? > Or forking? > > If it does so via forking, that's more portable, and less dependent on > specific complexities of threading implementations (which amounts to > non-portability ;-)). OK - I'll byte: It's process based, we fork backends at slice points in the execution plan. To take care of the startup latency problem, we persist sets of these backends, called "gangs". They appear, persist for connection scope for reuse, then are disbanded. > Most times Jan comes to town, we spend a few minutes musing about the > "splitting queries across threads" problem, and dismiss it again; if > there's the beginning of a "split across processes," that's decidedly > neat :-). :-) - Luke From pgsql-performance-owner@postgresql.org Fri Mar 24 11:26:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B44CA9DCA31 for ; Fri, 24 Mar 2006 11:26: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 42871-06 for ; Fri, 24 Mar 2006 11:26:19 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 550789DC890 for ; Fri, 24 Mar 2006 11:26:11 -0400 (AST) Received: from obav06.netvigator.com (obav06.netvigator.com [218.102.62.132]) by svr4.postgresql.org (Postfix) with ESMTP id 998BB5AF975 for ; Fri, 24 Mar 2006 15:26:16 +0000 (GMT) Received: from obav06.netvigator.com (obav01.netvigator.com [127.0.0.1]) by obav06.netvigator.com (Postfix) with SMTP id 87AF3E0A51 for ; Fri, 24 Mar 2006 15:26:07 +0000 (GMT) Received: from n2.netvigator.com ([219.78.154.228]) by wmail05dat.netvigator.com (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060324152607.DMSG8031.wmail05dat.netvigator.com@n2.netvigator.com> for ; Fri, 24 Mar 2006 23:26:07 +0800 Received: from n2.netvigator.com ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.594) sender ; 24 Mar 2006 23:26:07 +???? Message-Id: <6.2.1.2.0.20060324225743.04d49ac0@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Fri, 24 Mar 2006 23:25:00 +0800 To: pgsql-performance@postgresql.org From: K C Lau Subject: limitation using LIKE on ANY(array) In-Reply-To: <20060324133252.GA22688@winnie.fuhr.org> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> <20060324125245.GB90527@pervasive.com> <4423EDA9.3090502@rentalia.com> <20060324130619.GF90527@pervasive.com> <20060324133252.GA22688@winnie.fuhr.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_833631218==.ALT" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.441 required=5 tests=[DNS_FROM_RFC_POST=1.44, HTML_MESSAGE=0.001] X-Spam-Score: 1.441 X-Spam-Level: * X-Archive-Number: 200603/500 X-Sequence-Number: 17937 --=====================_833631218==.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed With 8.1.3, I get an error when trying to do this on a Text[] column : .. WHERE ANY(array) LIKE 'xx%' Indeed, I get rejected even with: .. WHERE ANY(array) = 'xx' In both cases, the error is: ERROR: syntax error at or near "any" ... It would only work as documented in the manual (8.10.5): SELECT * FROM sal_emp WHERE 10000 = ANY (pay_by_quarter); It appears that this restriction is still in place in 8.2: >http://developer.postgresql.org/docs/postgres/arrays.html Is that the case? Thanks in advance, KC. --=====================_833631218==.ALT Content-Type: text/html; charset="us-ascii"
With 8.1.3, I get an error when trying to do this on a Text[] column
:
.. WHERE ANY(array) LIKE 'xx%'

Indeed, I get rejected even with:
.. WHERE ANY(array) = 'xx'

In both cases, the error is: ERROR:  syntax error at or near
"any" ... 

It would only work as documented in the manual (8.10.5):
SELECT * FROM sal_emp WHERE 10000 = ANY (pay_by_quarter);

It appears that this restriction is still in place in 8.2:
http://developer.postgresql.org/docs/postgres/arrays.html

Is that the case?

Thanks in advance,
KC. --=====================_833631218==.ALT-- From pgsql-performance-owner@postgresql.org Fri Mar 24 11:51:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D604F9DCBA0 for ; Fri, 24 Mar 2006 11:51: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 58131-01 for ; Fri, 24 Mar 2006 11:51: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 98FA59DCACE for ; Fri, 24 Mar 2006 11:51:39 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2OFpiuN005001; Fri, 24 Mar 2006 10:51:44 -0500 (EST) To: Ruben Rubio Rey cc: pgsql-performance@postgresql.org Subject: Re: Array performance In-reply-to: <4423E90E.2090607@rentalia.com> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> Comments: In-reply-to Ruben Rubio Rey message dated "Fri, 24 Mar 2006 13:41:50 +0100" Date: Fri, 24 Mar 2006 10:51:44 -0500 Message-ID: <5000.1143215504@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/501 X-Sequence-Number: 17938 Ruben Rubio Rey writes: > SELECT (array[20]+array[21]+ ... +array[50]+array[51]) as total > FROM table > WHERE > (array[20]+array[21]+ ... +array[50]+array[51])<5000 > AND array[20]<>0 > AND array[21]<>0 > ... > AND array[50]<>0 > AND array[51])<>0 > Any ideas to make this query faster? What's the array datatype? Integer or float would probably go a lot faster than NUMERIC, if that's what you're using now. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 24 12:02:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 831D49DC813 for ; Fri, 24 Mar 2006 12:02: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 59671-04 for ; Fri, 24 Mar 2006 12:02: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 511B09DCA31 for ; Fri, 24 Mar 2006 12:02:41 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2OG2Zs3005091; Fri, 24 Mar 2006 11:02:35 -0500 (EST) To: "Jim C. Nasby" cc: Svenne Krap , pgsql-performance@postgresql.org Subject: Re: Performance problems with multiple layers of functions In-reply-to: <20060324125919.GD90527@pervasive.com> References: <4423EACD.80706@krap.dk> <20060324125919.GD90527@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Fri, 24 Mar 2006 06:59:19 -0600" Date: Fri, 24 Mar 2006 11:02:34 -0500 Message-ID: <5090.1143216154@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/502 X-Sequence-Number: 17939 "Jim C. Nasby" writes: > On Fri, Mar 24, 2006 at 01:49:17PM +0100, Svenne Krap wrote: >> explain select dataset_id, entity, sum(amount) from entrydata_current >> where flow_direction in (select * from outflow_direction(dataset_id)) >> and dataset_id in (select * from get_dataset_ids(122)) group by >> dataset_id, entity; > The issue is that the planner has no way to know what's comming back > from get_dataset_ids. More specifically, the first IN is not optimizable into a join because the results of the sub-SELECT depend on the current row of the outer query. The second IN is being optimized fine, but the first one is what's killing you. I'd suggest refactoring the functions into something that returns a set of outflow_direction/dataset_id pairs, and then phrase the query as where (flow_direction, dataset_id) in (select * from new_func(122)) You could do it without refactoring: where (flow_direction, dataset_id) in (select outflow_direction(id),id from get_dataset_ids(122) id) however this won't work if outflow_direction() is a plpgsql function because of limitations in plpgsql's set-function support. (It will work if outflow_direction() is a SQL function, or you could kluge it as a SQL function wrapper around a plpgsql function.) regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 24 12:26:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1941F9DC841 for ; Fri, 24 Mar 2006 12:26: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 68325-08 for ; Fri, 24 Mar 2006 12:26: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 D94F49DC84D for ; Fri, 24 Mar 2006 12:26:00 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2OGPtIs005276; Fri, 24 Mar 2006 11:25:55 -0500 (EST) To: K C Lau cc: pgsql-performance@postgresql.org Subject: Re: limitation using LIKE on ANY(array) In-reply-to: <6.2.1.2.0.20060324225743.04d49ac0@localhost> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> <20060324125245.GB90527@pervasive.com> <4423EDA9.3090502@rentalia.com> <20060324130619.GF90527@pervasive.com> <20060324133252.GA22688@winnie.fuhr.org> <6.2.1.2.0.20060324225743.04d49ac0@localhost> Comments: In-reply-to K C Lau message dated "Fri, 24 Mar 2006 23:25:00 +0800" Date: Fri, 24 Mar 2006 11:25:55 -0500 Message-ID: <5275.1143217555@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.252 required=5 tests=[AWL=-0.024, MAILTO_TO_SPAM_ADDR=0.276] X-Spam-Score: 0.252 X-Spam-Level: X-Archive-Number: 200603/503 X-Sequence-Number: 17940 K C Lau writes: > Indeed, I get rejected even with: > .. WHERE ANY(array) = 'xx' > It would only work as documented in the manual (8.10.5): > SELECT * FROM sal_emp WHERE 10000 = ANY (pay_by_quarter); That's not changing any time soon; the SQL spec defines only the second syntax for ANY, and I believe there would be syntactic ambiguity if we tried to allow the other. > With 8.1.3, I get an error when trying to do this on a Text[] column : > .. WHERE ANY(array) LIKE 'xx%' If you're really intent on doing that, make an operator for "reverse LIKE" and use it with the ANY on the right-hand side. regression=# create function rlike(text,text) returns bool as regression-# 'select $2 like $1' language sql strict immutable; CREATE FUNCTION regression=# create operator ~~~ (procedure = rlike, leftarg = text, regression(# rightarg = text, commutator = ~~); CREATE OPERATOR regression=# select 'xx%' ~~~ any(array['aaa','bbb']); ?column? ---------- f (1 row) regression=# select 'xx%' ~~~ any(array['aaa','xxb']); ?column? ---------- t (1 row) regression=# regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 24 12:43:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D16D89DCDB4 for ; Fri, 24 Mar 2006 12: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 72507-06 for ; Fri, 24 Mar 2006 12:43:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 0CACE9DCDBE for ; Fri, 24 Mar 2006 12:42:59 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Fri, 24 Mar 2006 16:42:58 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 24 Mar 2006 10:42:58 -0600 Subject: Re: Postmaster using only 4-5% CPU From: Scott Marlowe To: "Jim C. Nasby" Cc: Edoardo Serra , pgsql-performance@postgresql.org In-Reply-To: <20060324101654.GQ90527@pervasive.com> References: <7.0.0.16.2.20060321115738.060f9078@webrainstorm.it> <1142963080.17883.193.camel@state.g2switchworks.com> <7.0.0.16.2.20060322120000.0796c930@webrainstorm.it> <20060324101654.GQ90527@pervasive.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1143218577.10403.8.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 24 Mar 2006 10:42:58 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.143 required=5 tests=[AWL=0.142, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.143 X-Spam-Level: X-Archive-Number: 200603/504 X-Sequence-Number: 17941 On Fri, 2006-03-24 at 04:16, Jim C. Nasby wrote: > On Thu, Mar 23, 2006 at 10:14:24AM +0100, Edoardo Serra wrote: > > >Now, for the interesting test. Run the import on both machines, with > > >the begin; commit; pairs around it. Halfway through the import, pull > > >the power cord, and see which one comes back up. Don't do this to > > >servers with data you like, only test machines, obviously. For an even > > >more interesting test, do this with MySQL, Oracle, DB2, etc... > > > > I will surely run a test like this ;) > > If you do, I'd be *very* interested in the results. Pervasive would > probably pay for a whitepaper about this, btw (see > http://www.pervasivepostgres.com/postgresql/partners_in_publishing.asp). Hehe. good luck with it. At the last company I worked at I was the PostgreSQL DBA, and I could not get one single Oracle, DB2, MySQL, MSSQL, Ingres, or other DBA to agree to that kind of test. 6 months later, when all three power conditioners blew at once (amazing what a 1/4" piece of wire can do, eh?) and we lost all power in our hosting center, there was one, and only one, database server that came back up without errors, and we know which one that was. No other database there was up in less than 2 hours. So, I wandered the floor watching the folks panic who were trying to bring their systems back up. And you know what? They still didn't want to test their systems for recovery from a power loss situation. From pgsql-patches-owner@postgresql.org Fri Mar 24 14:09:59 2006 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1F1489DCC1F for ; Fri, 24 Mar 2006 14:09: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 93324-02 for ; Fri, 24 Mar 2006 14:09:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with SMTP id 833169DCA49 for ; Fri, 24 Mar 2006 14:09:36 -0400 (AST) Received: (qmail 29789 invoked by uid 1112); 24 Mar 2006 18:09:26 -0000 Date: Fri, 24 Mar 2006 13:09:26 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: "Jim C. Nasby" cc: Simon Riggs , pgsql-performance@postgresql.org, pgsql-patches@postgresql.org Subject: Re: [PERFORM] WAL logging of SELECT ... INTO command In-Reply-To: <20060324100514.GN90527@pervasive.com> Message-ID: References: <20060321122211.GU15742@pervasive.com> <1142973230.24487.501.camel@localhost.localdomain> <20060322124732.GA15742@pervasive.com> <20060324100514.GN90527@pervasive.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-290523205-1143223766=:14309" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/247 X-Sequence-Number: 19251 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-290523205-1143223766=:14309 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Fri, 24 Mar 2006, Jim C. Nasby wrote: > On Wed, Mar 22, 2006 at 02:37:28PM -0500, Kris Jurka wrote: >> >> On Wed, 22 Mar 2006, Jim C. Nasby wrote: >> >>> Ok, I saw disk activity on the base directory and assumed it was pg_xlog >>> stuff. Turns out that both SELECT INTO and CREATE TABLE AS ignore >>> default_tablepsace and create the new tables in the base directory. I'm >>> guessing that's a bug... (this is on 8.1.2, btw). >> >> This has been fixed in CVS HEAD as part of a patch to allow additional >> options to CREATE TABLE AS. >> >> http://archives.postgresql.org/pgsql-patches/2006-02/msg00211.php > > I'll argue that the current behavior is still a bug and should be fixed. > Would it be difficult to patch 8.1 (and 8.0 if there were tablespaces > then...) to honor default_tablespace? Here are patches that fix this for 8.0 and 8.1. Kris Jurka --0-290523205-1143223766=:14309 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=ctas_default_tablespace_80.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=ctas_default_tablespace_80.patch SW5kZXg6IHNyYy9iYWNrZW5kL2V4ZWN1dG9yL2V4ZWNNYWluLmMNCj09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT0NClJDUyBmaWxlOiAvcHJvamVjdHMvY3Zzcm9v dC9wZ3NxbC9zcmMvYmFja2VuZC9leGVjdXRvci9leGVjTWFpbi5jLHYNCnJl dHJpZXZpbmcgcmV2aXNpb24gMS4yNDEuNC4yDQpkaWZmIC1jIC1yMS4yNDEu NC4yIGV4ZWNNYWluLmMNCioqKiBzcmMvYmFja2VuZC9leGVjdXRvci9leGVj TWFpbi5jCTEyIEphbiAyMDA2IDIxOjQ5OjE3IC0wMDAwCTEuMjQxLjQuMg0K LS0tIHNyYy9iYWNrZW5kL2V4ZWN1dG9yL2V4ZWNNYWluLmMJMjQgTWFyIDIw MDYgMTg6MDU6NTMgLTAwMDANCioqKioqKioqKioqKioqKg0KKioqIDM2LDQx ICoqKioNCi0tLSAzNiw0MiAtLS0tDQogICNpbmNsdWRlICJjYXRhbG9nL2hl YXAuaCINCiAgI2luY2x1ZGUgImNhdGFsb2cvbmFtZXNwYWNlLmgiDQogICNp bmNsdWRlICJjb21tYW5kcy90YWJsZWNtZHMuaCINCisgI2luY2x1ZGUgImNv bW1hbmRzL3RhYmxlc3BhY2UuaCINCiAgI2luY2x1ZGUgImNvbW1hbmRzL3Ry aWdnZXIuaCINCiAgI2luY2x1ZGUgImV4ZWN1dG9yL2V4ZWNkZWJ1Zy5oIg0K ICAjaW5jbHVkZSAiZXhlY3V0b3IvZXhlY2RlZnMuaCINCioqKioqKioqKioq KioqKg0KKioqIDczMSw3MzYgKioqKg0KLS0tIDczMiw3MzggLS0tLQ0KICAJ ew0KICAJCWNoYXIJICAgKmludG9OYW1lOw0KICAJCU9pZAkJCW5hbWVzcGFj ZUlkOw0KKyAJCU9pZAkJCXRhYmxlc3BhY2VJZDsNCiAgCQlBY2xSZXN1bHQJ YWNscmVzdWx0Ow0KICAJCU9pZAkJCWludG9SZWxhdGlvbklkOw0KICAJCVR1 cGxlRGVzYwl0dXBkZXNjOw0KKioqKioqKioqKioqKioqDQoqKiogNzQ3LDc1 MiAqKioqDQotLS0gNzQ5LDc2NCAtLS0tDQogIAkJCWFjbGNoZWNrX2Vycm9y KGFjbHJlc3VsdCwgQUNMX0tJTkRfTkFNRVNQQUNFLA0KICAJCQkJCQkgICBn ZXRfbmFtZXNwYWNlX25hbWUobmFtZXNwYWNlSWQpKTsNCiAgDQorIAkJdGFi bGVzcGFjZUlkID0gR2V0RGVmYXVsdFRhYmxlc3BhY2UoKTsNCisgCQlpZiAo T2lkSXNWYWxpZCh0YWJsZXNwYWNlSWQpKSB7DQorIAkJCWFjbHJlc3VsdCA9 IHBnX3RhYmxlc3BhY2VfYWNsY2hlY2sodGFibGVzcGFjZUlkLCBHZXRVc2Vy SWQoKSwNCisgCQkJCQkJCQkJCQkgICBBQ0xfQ1JFQVRFKTsNCisgDQorIAkJ CWlmIChhY2xyZXN1bHQgIT0gQUNMQ0hFQ0tfT0spDQorIAkJCQlhY2xjaGVj a19lcnJvcihhY2xyZXN1bHQsIEFDTF9LSU5EX1RBQkxFU1BBQ0UsDQorIAkJ CQkJCQkgICBnZXRfdGFibGVzcGFjZV9uYW1lKHRhYmxlc3BhY2VJZCkpOw0K KyAJCX0NCisgDQogIAkJLyoNCiAgCQkgKiBoYXZlIHRvIGNvcHkgdHVwVHlw ZSB0byBnZXQgcmlkIG9mIGNvbnN0cmFpbnRzDQogIAkJICovDQoqKioqKioq KioqKioqKioNCioqKiA3NTQsNzYwICoqKioNCiAgDQogIAkJaW50b1JlbGF0 aW9uSWQgPSBoZWFwX2NyZWF0ZV93aXRoX2NhdGFsb2coaW50b05hbWUsDQog IAkJCQkJCQkJCQkJCSAgbmFtZXNwYWNlSWQsDQohIAkJCQkJCQkJCQkJCSAg SW52YWxpZE9pZCwNCiAgCQkJCQkJCQkJCQkJICB0dXBkZXNjLA0KICAJCQkJ CQkJCQkJCQkgIFJFTEtJTkRfUkVMQVRJT04sDQogIAkJCQkJCQkJCQkJCSAg ZmFsc2UsDQotLS0gNzY2LDc3MiAtLS0tDQogIA0KICAJCWludG9SZWxhdGlv bklkID0gaGVhcF9jcmVhdGVfd2l0aF9jYXRhbG9nKGludG9OYW1lLA0KICAJ CQkJCQkJCQkJCQkgIG5hbWVzcGFjZUlkLA0KISAJCQkJCQkJCQkJCQkgIHRh Ymxlc3BhY2VJZCwNCiAgCQkJCQkJCQkJCQkJICB0dXBkZXNjLA0KICAJCQkJ CQkJCQkJCQkgIFJFTEtJTkRfUkVMQVRJT04sDQogIAkJCQkJCQkJCQkJCSAg ZmFsc2UsDQo= --0-290523205-1143223766=:14309 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=ctas_default_tablespace_81.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=ctas_default_tablespace_81.patch SW5kZXg6IHNyYy9iYWNrZW5kL2V4ZWN1dG9yL2V4ZWNNYWluLmMNCj09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT0NClJDUyBmaWxlOiAvcHJvamVjdHMvY3Zzcm9v dC9wZ3NxbC9zcmMvYmFja2VuZC9leGVjdXRvci9leGVjTWFpbi5jLHYNCnJl dHJpZXZpbmcgcmV2aXNpb24gMS4yNTYuMi41DQpkaWZmIC1jIC1yMS4yNTYu Mi41IGV4ZWNNYWluLmMNCioqKiBzcmMvYmFja2VuZC9leGVjdXRvci9leGVj TWFpbi5jCTEyIEphbiAyMDA2IDIxOjQ5OjA2IC0wMDAwCTEuMjU2LjIuNQ0K LS0tIHNyYy9iYWNrZW5kL2V4ZWN1dG9yL2V4ZWNNYWluLmMJMjQgTWFyIDIw MDYgMTc6NTc6MTEgLTAwMDANCioqKioqKioqKioqKioqKg0KKioqIDM3LDQy ICoqKioNCi0tLSAzNyw0MyAtLS0tDQogICNpbmNsdWRlICJjYXRhbG9nL2hl YXAuaCINCiAgI2luY2x1ZGUgImNhdGFsb2cvbmFtZXNwYWNlLmgiDQogICNp bmNsdWRlICJjb21tYW5kcy90YWJsZWNtZHMuaCINCisgI2luY2x1ZGUgImNv bW1hbmRzL3RhYmxlc3BhY2UuaCINCiAgI2luY2x1ZGUgImNvbW1hbmRzL3Ry aWdnZXIuaCINCiAgI2luY2x1ZGUgImV4ZWN1dG9yL2V4ZWNkZWJ1Zy5oIg0K ICAjaW5jbHVkZSAiZXhlY3V0b3IvZXhlY2RlZnMuaCINCioqKioqKioqKioq KioqKg0KKioqIDczNyw3NDIgKioqKg0KLS0tIDczOCw3NDQgLS0tLQ0KICAJ ew0KICAJCWNoYXIJICAgKmludG9OYW1lOw0KICAJCU9pZAkJCW5hbWVzcGFj ZUlkOw0KKyAJCU9pZAkJCXRhYmxlc3BhY2VJZDsNCiAgCQlBY2xSZXN1bHQJ YWNscmVzdWx0Ow0KICAJCU9pZAkJCWludG9SZWxhdGlvbklkOw0KICAJCVR1 cGxlRGVzYwl0dXBkZXNjOw0KKioqKioqKioqKioqKioqDQoqKiogNzUzLDc1 OCAqKioqDQotLS0gNzU1LDc3MCAtLS0tDQogIAkJCWFjbGNoZWNrX2Vycm9y KGFjbHJlc3VsdCwgQUNMX0tJTkRfTkFNRVNQQUNFLA0KICAJCQkJCQkgICBn ZXRfbmFtZXNwYWNlX25hbWUobmFtZXNwYWNlSWQpKTsNCiAgDQorIAkJdGFi bGVzcGFjZUlkID0gR2V0RGVmYXVsdFRhYmxlc3BhY2UoKTsNCisgCQlpZiAo T2lkSXNWYWxpZCh0YWJsZXNwYWNlSWQpKSB7DQorIAkJCWFjbHJlc3VsdCA9 IHBnX3RhYmxlc3BhY2VfYWNsY2hlY2sodGFibGVzcGFjZUlkLCBHZXRVc2Vy SWQoKSwNCisgCQkJCQkJCQkJCQkgICBBQ0xfQ1JFQVRFKTsNCisgDQorIAkJ CWlmIChhY2xyZXN1bHQgIT0gQUNMQ0hFQ0tfT0spDQorIAkJCQlhY2xjaGVj a19lcnJvcihhY2xyZXN1bHQsIEFDTF9LSU5EX1RBQkxFU1BBQ0UsDQorIAkJ CQkJCQkgICBnZXRfdGFibGVzcGFjZV9uYW1lKHRhYmxlc3BhY2VJZCkpOw0K KyAJCX0NCisgDQogIAkJLyoNCiAgCQkgKiBoYXZlIHRvIGNvcHkgdHVwVHlw ZSB0byBnZXQgcmlkIG9mIGNvbnN0cmFpbnRzDQogIAkJICovDQoqKioqKioq KioqKioqKioNCioqKiA3NjAsNzY2ICoqKioNCiAgDQogIAkJaW50b1JlbGF0 aW9uSWQgPSBoZWFwX2NyZWF0ZV93aXRoX2NhdGFsb2coaW50b05hbWUsDQog IAkJCQkJCQkJCQkJCSAgbmFtZXNwYWNlSWQsDQohIAkJCQkJCQkJCQkJCSAg SW52YWxpZE9pZCwNCiAgCQkJCQkJCQkJCQkJICBJbnZhbGlkT2lkLA0KICAJ CQkJCQkJCQkJCQkgIEdldFVzZXJJZCgpLA0KICAJCQkJCQkJCQkJCQkgIHR1 cGRlc2MsDQotLS0gNzcyLDc3OCAtLS0tDQogIA0KICAJCWludG9SZWxhdGlv bklkID0gaGVhcF9jcmVhdGVfd2l0aF9jYXRhbG9nKGludG9OYW1lLA0KICAJ CQkJCQkJCQkJCQkgIG5hbWVzcGFjZUlkLA0KISAJCQkJCQkJCQkJCQkgIHRh Ymxlc3BhY2VJZCwNCiAgCQkJCQkJCQkJCQkJICBJbnZhbGlkT2lkLA0KICAJ CQkJCQkJCQkJCQkgIEdldFVzZXJJZCgpLA0KICAJCQkJCQkJCQkJCQkgIHR1 cGRlc2MsDQo= --0-290523205-1143223766=:14309-- From pgsql-performance-owner@postgresql.org Fri Mar 24 15:04:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 62F7A9DCC37 for ; Fri, 24 Mar 2006 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 16841-02 for ; Fri, 24 Mar 2006 15: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 AEED19DCC7F for ; Fri, 24 Mar 2006 15:04:02 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0536430BA0; Fri, 24 Mar 2006 20:04:03 +0100 (MET) From: Chris Browne X-Newsgroups: pgsql.performance Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Date: Fri, 24 Mar 2006 13:21:23 -0500 Organization: cbbrowne Computing Inc Lines: 67 Message-ID: <60zmjfsnz0.fsf@dba2.int.libertyrms.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> <4422D033.2030407@commandprompt.com> <1143133364.17999.77.camel@state.g2switchworks.com> <87hd5olgyd.fsf@wolfe.cbbrowne.com> <20060324101440.GP90527@pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:s1CFl16A80RDOICVG+i/YB62+wE= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.312 required=5 tests=[AWL=0.312] X-Spam-Score: 0.312 X-Spam-Level: X-Archive-Number: 200603/506 X-Sequence-Number: 17943 jnasby@pervasive.com ("Jim C. Nasby") writes: > On Thu, Mar 23, 2006 at 09:22:34PM -0500, Christopher Browne wrote: >> Martha Stewart called it a Good Thing when smarlowe@g2switchworks.com (Scott Marlowe) wrote: >> > On Thu, 2006-03-23 at 10:43, Joshua D. Drake wrote: >> >> > Has someone been working on the problem of splitting a query into pieces >> >> > and running it on multiple CPUs / multiple machines? Yes. Bizgress has >> >> > done that. >> >> >> >> I believe that is limited to Bizgress MPP yes? >> > >> > Yep. I hope that someday it will be released to the postgresql global >> > dev group for inclusion. Or at least parts of it. >> >> Question: Does the Bizgress/MPP use threading for this concurrency? >> Or forking? >> >> If it does so via forking, that's more portable, and less dependent on >> specific complexities of threading implementations (which amounts to >> non-portability ;-)). >> >> Most times Jan comes to town, we spend a few minutes musing about the >> "splitting queries across threads" problem, and dismiss it again; if >> there's the beginning of a "split across processes," that's decidedly >> neat :-). > > Correct me if I'm wrong, but there's no way to (reasonably) accomplish > that without having some dedicated extra processes laying around that > you can use to execute the queries, no? In other words, the cost of a > fork() during query execution would be too prohibitive... Counterexample... The sort of scenario we keep musing about is where you split off a (thread|process) for each partition of a big table. There is in fact a natural such partitioning, in that tables get split at the 1GB mark, by default. Consider doing a join against 2 tables that are each 8GB in size (e.g. - they consist of 8 data files). Let's assume that the query plan indicates doing seq scans on both. You *know* you'll be reading through 16 files, each 1GB in size. Spawning a process for each of those files doesn't strike me as "prohibitively expensive." A naive read on this is that you might start with one backend process, which then spawns 16 more. Each of those backends is scanning through one of those 16 files; they then throw relevant tuples into shared memory to be aggregated/joined by the central one. That particular scenario is one where the fork()s would hardly be noticeable. > FWIW, DB2 executes all queries in a dedicated set of processes. The > process handling the connection from the client will pass a query > request off to one of the executor processes. I can't remember which > process actually plans the query, but I know that the executor runs > it. It seems to me that the kinds of cases where extra processes/threads would be warranted are quite likely to be cases where fork()ing may be an immaterial cost. -- let name="cbbrowne" and tld="ntlug.org" in String.concat "@" [name;tld];; http://www.ntlug.org/~cbbrowne/languages.html TECO Madness: a moment of convenience, a lifetime of regret. -- Dave Moon From pgsql-performance-owner@postgresql.org Fri Mar 24 15:04:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9CB729DCC1F for ; Fri, 24 Mar 2006 15:04: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 14735-10 for ; Fri, 24 Mar 2006 15:04:10 -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 AF1FC9DCD90 for ; Fri, 24 Mar 2006 15:04:04 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0F6B630BA1; Fri, 24 Mar 2006 20:04:04 +0100 (MET) From: Chris Browne X-Newsgroups: pgsql.performance Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Date: Fri, 24 Mar 2006 13:24:09 -0500 Organization: cbbrowne Computing Inc Lines: 33 Message-ID: <60veu3snue.fsf@dba2.int.libertyrms.com> References: <87hd5olgyd.fsf@wolfe.cbbrowne.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:V+h2Kfka1HlF2BRoUsXudOQfTtA= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.311 required=5 tests=[AWL=0.311] X-Spam-Score: 0.311 X-Spam-Level: X-Archive-Number: 200603/507 X-Sequence-Number: 17944 llonergan@greenplum.com ("Luke Lonergan") writes: > Christopher, > > On 3/23/06 6:22 PM, "Christopher Browne" wrote: > >> Question: Does the Bizgress/MPP use threading for this concurrency? >> Or forking? >> >> If it does so via forking, that's more portable, and less dependent on >> specific complexities of threading implementations (which amounts to >> non-portability ;-)). > > OK - I'll byte: > > It's process based, we fork backends at slice points in the execution plan. By "slice points", do you mean that you'd try to partition tables (e.g. - if there's a Seq Scan on a table with 8 1GB segments, you could spawn as many as 8 processes), or that two scans that are then merge joined means a process for each scan, and a process for the merge join? Or perhaps both :-). Or perhaps something else entirely ;-). > To take care of the startup latency problem, we persist sets of > these backends, called "gangs". They appear, persist for connection > scope for reuse, then are disbanded. If only that could happen to more gangs... -- output = ("cbbrowne" "@" "cbbrowne.com") http://cbbrowne.com/info/multiplexor.html "I'm sorry, the teleportation booth you have reached is not in service at this time. Please hand-reassemble your molecules or call an operator to help you...." From pgsql-performance-owner@postgresql.org Fri Mar 24 15:16:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5F6599DC82E for ; Fri, 24 Mar 2006 15:16: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 19895-01 for ; Fri, 24 Mar 2006 15:16:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cicero0.cybercity.dk (cicero0.cybercity.dk [212.242.40.52]) by postgresql.org (Postfix) with ESMTP id F3BDB9DC860 for ; Fri, 24 Mar 2006 15:16:00 -0400 (AST) Received: from user3.cybercity.dk (user3.cybercity.dk [212.242.41.36]) by cicero0.cybercity.dk (Postfix) with ESMTP id 13F7F6784DD; Fri, 24 Mar 2006 20:15:57 +0100 (CET) Received: from [192.168.0.79] (0x3e42eeca.adsl.cybercity.dk [62.66.238.202]) by user3.cybercity.dk (Postfix) with ESMTP id 9F10293C70; Fri, 24 Mar 2006 20:15:56 +0100 (CET) Message-ID: <4424458D.4060106@krap.dk> Date: Fri, 24 Mar 2006 20:16:29 +0100 From: Svenne Krap User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Tom Lane Cc: "Jim C. Nasby" , pgsql-performance@postgresql.org Subject: Re: Performance problems with multiple layers of functions References: <4423EACD.80706@krap.dk> <20060324125919.GD90527@pervasive.com> <5090.1143216154@sss.pgh.pa.us> In-Reply-To: <5090.1143216154@sss.pgh.pa.us> Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms050201090001010403040800" 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: 200603/508 X-Sequence-Number: 17945 This is a cryptographically signed message in MIME format. --------------ms050201090001010403040800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Tom Lane wrote: > where (flow_direction, dataset_id) in (select * from new_func(122)) > Is this form of multi-column IN mentioned anywhere in the docs? I can't find it. Svenne --------------ms050201090001010403040800 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKTjCC BSMwggQLoAMCAQICBD/KpecwDQYJKoZIhvcNAQEFBQAwMTELMAkGA1UEBhMCREsxDDAKBgNV BAoTA1REQzEUMBIGA1UEAxMLVERDIE9DRVMgQ0EwHhcNMDUwMjIzMTMxMTMwWhcNMDcwMjIz MTM0MTMwWjBzMQswCQYDVQQGEwJESzEpMCcGA1UEChMgSW5nZW4gb3JnYW5pc2F0b3Jpc2sg dGlsa255dG5pbmcxOTASBgNVBAMTC1N2ZW5uZSBLcmFwMCMGA1UEBRMcUElEOjk4MDItMjAw Mi0yLTk3OTMxMTk0MjAyNzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApF423aqlHV/8 RiX5vX5QezMEXKixU6KUSUQOfERsFgahaUn5LobNfxB31+5nKVH3EJfK/UpcE4Alfsa87+hX MBRzaAv5jbwh57NFSNcmFD/wgcIYupvyWhASacjcBnBfiqNuDBVIT7wL42yijfM3LSVjJOPw /c5R5wwFfKqjKzMCAwEAAaOCAoMwggJ/MA4GA1UdDwEB/wQEAwID+DArBgNVHRAEJDAigA8y MDA1MDIyMzEzMTEzMFqBDzIwMDcwMjIzMTM0MTMwWjCCATcGA1UdIASCAS4wggEqMIIBJgYK KoFQgSkBAQEBAjCCARYwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5kay9y ZXBvc2l0b3J5MIHiBggrBgEFBQcCAjCB1TAKFgNUREMwAwIBARqBxkZvciBhbnZlbmRlbHNl IGFmIGNlcnRpZmlrYXRldCBn5mxkZXIgT0NFUyB2aWxr5XIsIENQUyBvZyBPQ0VTIENQLCBk ZXIga2FuIGhlbnRlcyBmcmEgd3d3LmNlcnRpZmlrYXQuZGsvcmVwb3NpdG9yeS4gQmVt5nJr LCBhdCBUREMgZWZ0ZXIgdmlsa+VyZW5lIGhhciBldCBiZWdy5m5zZXQgYW5zdmFyIGlmdC4g cHJvZmVzc2lvbmVsbGUgcGFydGVyLjAZBgNVHREEEjAQgQ5zdmVubmVAa3JhcC5kazCBgwYD VR0fBHwwejBKoEigRqREMEIxCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMT C1REQyBPQ0VTIENBMQ8wDQYDVQQDEwZDUkw1NjgwLKAqoCiGJmh0dHA6Ly9jcmwub2Nlcy5j ZXJ0aWZpa2F0LmRrL29jZXMuY3JsMB8GA1UdIwQYMBaAFGC1hexWZH4SGSdnHVAVS3OuO/kS MB0GA1UdDgQWBBTmRrmEbRpZf+Pt0S/qphnyMgKoRzAJBgNVHRMEAjAAMBkGCSqGSIb2fQdB AAQMMAobBFY3LjEDAgOoMA0GCSqGSIb3DQEBBQUAA4IBAQBgfOEd/VkXc6lFNItNvhgrbPc3 eNcGE7l6sbaG1gYLREn4xmmYajtP90INRG3OlNm3ZlVeYxaMbzQKVlcrKMEwA7cMZIMcT97t KjXabwqCc/0jNCPceO/ZPoUc7T3fuF7B1QjJelzXsoK4av2lDDgaAJL8WiExsGYmJ0BwfNLZ YjLRwJ+Db4gsmvjTFazbkRtzqqqAzjy2WC6L4WEuS6EUmDhdX/ZFdq0bT58lx++DKo+TuDu3 bkIi46l6yV5lI4CgBRTmahRyyCuUMjDUiLvgX1m3Ys/U5c88MDgwrKtLcXy7TyCEazOLVC5z vAgKvNjbdSQjkFZEDiA/oVtwGNH6MIIFIzCCBAugAwIBAgIEP8ql5zANBgkqhkiG9w0BAQUF ADAxMQswCQYDVQQGEwJESzEMMAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAe Fw0wNTAyMjMxMzExMzBaFw0wNzAyMjMxMzQxMzBaMHMxCzAJBgNVBAYTAkRLMSkwJwYDVQQK EyBJbmdlbiBvcmdhbmlzYXRvcmlzayB0aWxrbnl0bmluZzE5MBIGA1UEAxMLU3Zlbm5lIEty YXAwIwYDVQQFExxQSUQ6OTgwMi0yMDAyLTItOTc5MzExOTQyMDI3MIGfMA0GCSqGSIb3DQEB AQUAA4GNADCBiQKBgQCkXjbdqqUdX/xGJfm9flB7MwRcqLFTopRJRA58RGwWBqFpSfkuhs1/ EHfX7mcpUfcQl8r9SlwTgCV+xrzv6FcwFHNoC/mNvCHns0VI1yYUP/CBwhi6m/JaEBJpyNwG cF+Ko24MFUhPvAvjbKKN8zctJWMk4/D9zlHnDAV8qqMrMwIDAQABo4ICgzCCAn8wDgYDVR0P AQH/BAQDAgP4MCsGA1UdEAQkMCKADzIwMDUwMjIzMTMxMTMwWoEPMjAwNzAyMjMxMzQxMzBa MIIBNwYDVR0gBIIBLjCCASowggEmBgoqgVCBKQEBAQECMIIBFjAvBggrBgEFBQcCARYjaHR0 cDovL3d3dy5jZXJ0aWZpa2F0LmRrL3JlcG9zaXRvcnkwgeIGCCsGAQUFBwICMIHVMAoWA1RE QzADAgEBGoHGRm9yIGFudmVuZGVsc2UgYWYgY2VydGlmaWthdGV0IGfmbGRlciBPQ0VTIHZp bGvlciwgQ1BTIG9nIE9DRVMgQ1AsIGRlciBrYW4gaGVudGVzIGZyYSB3d3cuY2VydGlmaWth dC5kay9yZXBvc2l0b3J5LiBCZW3mcmssIGF0IFREQyBlZnRlciB2aWxr5XJlbmUgaGFyIGV0 IGJlZ3LmbnNldCBhbnN2YXIgaWZ0LiBwcm9mZXNzaW9uZWxsZSBwYXJ0ZXIuMBkGA1UdEQQS MBCBDnN2ZW5uZUBrcmFwLmRrMIGDBgNVHR8EfDB6MEqgSKBGpEQwQjELMAkGA1UEBhMCREsx DDAKBgNVBAoTA1REQzEUMBIGA1UEAxMLVERDIE9DRVMgQ0ExDzANBgNVBAMTBkNSTDU2ODAs oCqgKIYmaHR0cDovL2NybC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwHwYDVR0jBBgw FoAUYLWF7FZkfhIZJ2cdUBVLc647+RIwHQYDVR0OBBYEFOZGuYRtGll/4+3RL+qmGfIyAqhH MAkGA1UdEwQCMAAwGQYJKoZIhvZ9B0EABAwwChsEVjcuMQMCA6gwDQYJKoZIhvcNAQEFBQAD ggEBAGB84R39WRdzqUU0i02+GCts9zd41wYTuXqxtobWBgtESfjGaZhqO0/3Qg1Ebc6U2bdm VV5jFoxvNApWVysowTADtwxkgxxP3u0qNdpvCoJz/SM0I9x479k+hRztPd+4XsHVCMl6XNey grhq/aUMOBoAkvxaITGwZiYnQHB80tliMtHAn4NviCya+NMVrNuRG3OqqoDOPLZYLovhYS5L oRSYOF1f9kV2rRtPnyXH74Mqj5O4O7duQiLjqXrJXmUjgKAFFOZqFHLIK5QyMNSIu+BfWbdi z9TlzzwwODCsq0txfLtPIIRrM4tULnO8CAq82Nt1JCOQVkQOID+hW3AY0foxggIqMIICJgIB ATA5MDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMTC1REQyBPQ0VTIENB AgQ/yqXnMAkGBSsOAwIaBQCgggFHMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI hvcNAQkFMQ8XDTA2MDMyNDE5MTYyOVowIwYJKoZIhvcNAQkEMRYEFNh5C7bfl+VaAP8KmH2z /OrAc3H3MEgGCSsGAQQBgjcQBDE7MDkwMTELMAkGA1UEBhMCREsxDDAKBgNVBAoTA1REQzEU MBIGA1UEAxMLVERDIE9DRVMgQ0ECBD/KpecwSgYLKoZIhvcNAQkQAgsxO6A5MDExCzAJBgNV BAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMTC1REQyBPQ0VTIENBAgQ/yqXnMFIGCSqG SIb3DQEJDzFFMEMwCgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMA0GCCqGSIb3DQMCAgFA MAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABIGAc6aDfF6bxch34hCp dulaxfEHFjoRQOrvkrUao901Tr1zmrasWxNNUSfgItskHzN91cNowXYslfduUZmzFcl4tTVq vcDmR0xh1P99QjOc2ECBzmCKQ6usZDeQTqHd1jsCd3xXoHwmymquLSNLL/kh+oHd9I8ejl+g ohgTmB7HIAUAAAAAAAA= --------------ms050201090001010403040800-- From pgsql-performance-owner@postgresql.org Fri Mar 24 15:21:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 04DB89DCB83 for ; Fri, 24 Mar 2006 15:21: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 20349-01 for ; Fri, 24 Mar 2006 15:21:30 -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 03CEB9DCAA3 for ; Fri, 24 Mar 2006 15:21:27 -0400 (AST) Received: from osgiliath.mathom.us ([151.200.254.241]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IWN001DXCFRX260@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 24 Mar 2006 13:21:28 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 0C73F6E5B2 for ; Fri, 24 Mar 2006 14:21:26 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03848-01-5 for ; Fri, 24 Mar 2006 14:21:25 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 10B5D6E630; Fri, 24 Mar 2006 14:21:25 -0500 (EST) Date: Fri, 24 Mar 2006 14:21:24 -0500 From: Michael Stone Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core In-reply-to: <60zmjfsnz0.fsf@dba2.int.libertyrms.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20060324192122.GJ15140@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: Debian amavisd-new at mathom.us References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> <4422D033.2030407@commandprompt.com> <1143133364.17999.77.camel@state.g2switchworks.com> <87hd5olgyd.fsf@wolfe.cbbrowne.com> <20060324101440.GP90527@pervasive.com> <60zmjfsnz0.fsf@dba2.int.libertyrms.com> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.15 required=5 tests=[AWL=-0.086, RCVD_IN_SORBS_WEB=1.236] X-Spam-Score: 1.15 X-Spam-Level: * X-Archive-Number: 200603/509 X-Sequence-Number: 17946 On Fri, Mar 24, 2006 at 01:21:23PM -0500, Chris Browne wrote: >A naive read on this is that you might start with one backend process, >which then spawns 16 more. Each of those backends is scanning through >one of those 16 files; they then throw relevant tuples into shared >memory to be aggregated/joined by the central one. Of course, table scanning is going to be IO limited in most cases, and having every query spawn 16 independent IO threads is likely to slow things down in more cases than it speeds them up. It could work if you have a bunch of storage devices, but at that point it's probably easier and more direct to implement a clustered approach. Mike Stone From pgsql-performance-owner@postgresql.org Fri Mar 24 15:23:57 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 578B59DCD22 for ; Fri, 24 Mar 2006 15:23: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 20857-03 for ; Fri, 24 Mar 2006 15:23: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 001A99DCB83 for ; Fri, 24 Mar 2006 15:23:53 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2OJNnrD008428; Fri, 24 Mar 2006 14:23:49 -0500 (EST) To: Svenne Krap cc: "Jim C. Nasby" , pgsql-performance@postgresql.org Subject: Re: Performance problems with multiple layers of functions In-reply-to: <4424458D.4060106@krap.dk> References: <4423EACD.80706@krap.dk> <20060324125919.GD90527@pervasive.com> <5090.1143216154@sss.pgh.pa.us> <4424458D.4060106@krap.dk> Comments: In-reply-to Svenne Krap message dated "Fri, 24 Mar 2006 20:16:29 +0100" Date: Fri, 24 Mar 2006 14:23:49 -0500 Message-ID: <8427.1143228229@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/510 X-Sequence-Number: 17947 Svenne Krap writes: > Tom Lane wrote: >> where (flow_direction, dataset_id) in (select * from new_func(122)) > Is this form of multi-column IN mentioned anywhere in the docs? I can't > find it. Sure, look under "Subquery Expressions". 8.0 and later refer to it as a row_constructor, but it's documented at least as far back as 7.3. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 24 15:24:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EEAD89DCD3F for ; Fri, 24 Mar 2006 15:24: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 20925-02 for ; Fri, 24 Mar 2006 15:24:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 8591C9DCC57 for ; Fri, 24 Mar 2006 15:24:04 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 730F156423; Fri, 24 Mar 2006 13:24:05 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 13:24:04 -0600 Date: Fri, 24 Mar 2006 13:24:04 -0600 From: "Jim C. Nasby" To: Chris Browne Cc: pgsql-performance@postgresql.org Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Message-ID: <20060324192404.GA9246@pervasive.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> <4422D033.2030407@commandprompt.com> <1143133364.17999.77.camel@state.g2switchworks.com> <87hd5olgyd.fsf@wolfe.cbbrowne.com> <20060324101440.GP90527@pervasive.com> <60zmjfsnz0.fsf@dba2.int.libertyrms.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <60zmjfsnz0.fsf@dba2.int.libertyrms.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:cbbrowne@acm.org::pHUbNDC3piUFYn+8:05Urj X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::KxQXqt/UCtKJdaq5:00000 0000000000000000000000005aCu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/511 X-Sequence-Number: 17948 On Fri, Mar 24, 2006 at 01:21:23PM -0500, Chris Browne wrote: > > Correct me if I'm wrong, but there's no way to (reasonably) accomplish > > that without having some dedicated extra processes laying around that > > you can use to execute the queries, no? In other words, the cost of a > > fork() during query execution would be too prohibitive... > > Counterexample... > > The sort of scenario we keep musing about is where you split off a > (thread|process) for each partition of a big table. There is in fact > a natural such partitioning, in that tables get split at the 1GB mark, > by default. > > Consider doing a join against 2 tables that are each 8GB in size > (e.g. - they consist of 8 data files). Let's assume that the query > plan indicates doing seq scans on both. > > You *know* you'll be reading through 16 files, each 1GB in size. > Spawning a process for each of those files doesn't strike me as > "prohibitively expensive." Have you ever tried reading from 2 large files on a disk at the same time, let alone 16? The results ain't pretty. What you're suggesting maybe makes sense if the two tables are in different tablespaces, provided you have some additional means to know if those two tablespaces are on the same set of spindles. Though even here the usefulness is somewhat suspect, because CPU is a hell of a lot faster than disks are, unless you have a whole lot of disks. Of course, this is exactly the target market for MPP. Where parallel execution really makes sense is when you're doing things like sorts or hash operations, because those are relatively CPU-intensive. -- 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 Mar 24 16:04:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4DDF69DCC57 for ; Fri, 24 Mar 2006 16: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 35548-10 for ; Fri, 24 Mar 2006 16:04:09 -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 B011D9DCC3B for ; Fri, 24 Mar 2006 16:04:03 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4196E30BA0; Fri, 24 Mar 2006 21:04:03 +0100 (MET) From: Chris Browne X-Newsgroups: pgsql.performance Subject: Re: Scaling up PostgreSQL in Multiple CPU / Dual Core Date: Fri, 24 Mar 2006 14:33:21 -0500 Organization: cbbrowne Computing Inc Lines: 22 Message-ID: <60r74rskn2.fsf@dba2.int.libertyrms.com> References: <65f9ddfb0603222219r1742c2aevda37acd55ca845be@mail.gmail.com> <1143131901.17999.67.camel@state.g2switchworks.com> <4422D033.2030407@commandprompt.com> <1143133364.17999.77.camel@state.g2switchworks.com> <87hd5olgyd.fsf@wolfe.cbbrowne.com> <20060324101440.GP90527@pervasive.com> <60zmjfsnz0.fsf@dba2.int.libertyrms.com> <20060324192122.GJ15140@mathom.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:E61skgZ6X4hjsmecXlYU13nGW8k= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.308 required=5 tests=[AWL=0.308] X-Spam-Score: 0.308 X-Spam-Level: X-Archive-Number: 200603/512 X-Sequence-Number: 17949 mstone+postgres@mathom.us (Michael Stone) writes: > On Fri, Mar 24, 2006 at 01:21:23PM -0500, Chris Browne wrote: >>A naive read on this is that you might start with one backend process, >>which then spawns 16 more. Each of those backends is scanning through >>one of those 16 files; they then throw relevant tuples into shared >>memory to be aggregated/joined by the central one. > > Of course, table scanning is going to be IO limited in most cases, and > having every query spawn 16 independent IO threads is likely to slow > things down in more cases than it speeds them up. It could work if you > have a bunch of storage devices, but at that point it's probably > easier and more direct to implement a clustered approach. All stipulated, yes. It obviously wouldn't be terribly useful to scan more aggressively than I/O bandwidth can support. The point is that this is one of the kinds of places where concurrent processing could do some good... -- let name="cbbrowne" and tld="acm.org" in name ^ "@" ^ tld;; http://cbbrowne.com/info/spiritual.html Save the whales. Collect the whole set. From pgsql-performance-owner@postgresql.org Fri Mar 24 18:54:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B136F9DC847 for ; Fri, 24 Mar 2006 18:54: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 73232-06 for ; Fri, 24 Mar 2006 18:54:45 -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 878C49DC83F for ; Fri, 24 Mar 2006 18:54:39 -0400 (AST) Received: (qmail 30386 invoked from network); 24 Mar 2006 23:54:39 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 24 Mar 2006 23:54:39 +0100 Date: Fri, 24 Mar 2006 23:54:37 +0100 To: pgsql-performance@postgresql.org Subject: Query plan from hell References: <4423EACD.80706@krap.dk> <20060324125919.GD90527@pervasive.com> <5090.1143216154@sss.pgh.pa.us> <4424458D.4060106@krap.dk> <8427.1143228229@sss.pgh.pa.us> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <8427.1143228229@sss.pgh.pa.us> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/513 X-Sequence-Number: 17950 Whoa ! bookmark_delta contains very few rows but is inserted/deleted very often... the effect is spectacular ! I guess I'll have to vacuum analyze this table every minute... annonces=# EXPLAIN ANALYZE SELECT id, priority FROM annonces WHERE id IN (SELECT annonce_id FROM bookmark_delta); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Hash IN Join (cost=32.12..8607.08 rows=1770 width=6) (actual time=387.011..387.569 rows=1 loops=1) Hash Cond: ("outer".id = "inner".annonce_id) -> Seq Scan on annonces (cost=0.00..7796.00 rows=101500 width=6) (actual time=0.022..164.369 rows=101470 loops=1) -> Hash (cost=27.70..27.70 rows=1770 width=4) (actual time=0.013..0.013 rows=5 loops=1) -> Seq Scan on bookmark_delta (cost=0.00..27.70 rows=1770 width=4) (actual time=0.004..0.010 rows=5 loops=1) Total runtime: 387.627 ms (6 lignes) annonces=# EXPLAIN ANALYZE SELECT id, priority FROM annonces a, (SELECT annonce_id FROM bookmark_delta GROUP BY annonce_id) foo WHERE a.id=foo.annonce_id; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=32.12..10409.31 rows=1770 width=6) (actual time=0.081..0.084 rows=1 loops=1) -> HashAggregate (cost=32.12..49.83 rows=1770 width=4) (actual time=0.038..0.040 rows=1 loops=1) -> Seq Scan on bookmark_delta (cost=0.00..27.70 rows=1770 width=4) (actual time=0.024..0.027 rows=5 loops=1) -> Index Scan using annonces_pkey on annonces a (cost=0.00..5.83 rows=1 width=6) (actual time=0.039..0.040 rows=1 loops=1) Index Cond: (a.id = "outer".annonce_id) Total runtime: 0.163 ms (6 lignes) annonces=# vacuum bookmark_delta ; VACUUM annonces=# EXPLAIN ANALYZE SELECT id, priority FROM annonces WHERE id IN (SELECT annonce_id FROM bookmark_delta); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Hash IN Join (cost=32.12..8607.08 rows=1770 width=6) (actual time=195.284..196.063 rows=1 loops=1) Hash Cond: ("outer".id = "inner".annonce_id) -> Seq Scan on annonces (cost=0.00..7796.00 rows=101500 width=6) (actual time=0.014..165.626 rows=101470 loops=1) -> Hash (cost=27.70..27.70 rows=1770 width=4) (actual time=0.008..0.008 rows=2 loops=1) -> Seq Scan on bookmark_delta (cost=0.00..27.70 rows=1770 width=4) (actual time=0.003..0.004 rows=2 loops=1) Total runtime: 196.122 ms (6 lignes) annonces=# vacuum analyze bookmark_delta ; VACUUM annonces=# EXPLAIN ANALYZE SELECT id, priority FROM annonces WHERE id IN (SELECT annonce_id FROM bookmark_delta); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Nested Loop (cost=1.02..6.88 rows=1 width=6) (actual time=0.025..0.027 rows=1 loops=1) -> HashAggregate (cost=1.02..1.03 rows=1 width=4) (actual time=0.011..0.012 rows=1 loops=1) -> Seq Scan on bookmark_delta (cost=0.00..1.02 rows=2 width=4) (actual time=0.004..0.006 rows=2 loops=1) -> Index Scan using annonces_pkey on annonces (cost=0.00..5.83 rows=1 width=6) (actual time=0.009..0.010 rows=1 loops=1) Index Cond: (annonces.id = "outer".annonce_id) Total runtime: 0.104 ms (6 lignes) From pgsql-performance-owner@postgresql.org Fri Mar 24 21:50:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4BAD79DC818 for ; Fri, 24 Mar 2006 21:50: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 00510-08 for ; Fri, 24 Mar 2006 21:50:06 -0400 (AST) X-Greylist: delayed 10:23:51.823294 by SQLgrey- Received: from obav02.netvigator.com (obav02.netvigator.com [218.102.62.130]) by postgresql.org (Postfix) with ESMTP id D845A9DC806 for ; Fri, 24 Mar 2006 21:50:00 -0400 (AST) Received: from obav02.netvigator.com (obav02.netvigator.com [127.0.0.1]) by obav02.netvigator.com (Postfix) with SMTP id 663021B22D0; Sat, 25 Mar 2006 01:50:01 +0000 (GMT) Received: from n2.netvigator.com ([219.78.154.228]) by imsm058dat.netvigator.com (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060325015001.LZEU22606.imsm058dat.netvigator.com@n2.netvigator.com>; Sat, 25 Mar 2006 09:50:01 +0800 Received: from n2.netvigator.com ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.594) sender ; 25 Mar 2006 09:50:01 +???? Message-Id: <6.2.1.2.0.20060325094356.04de84d8@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Sat, 25 Mar 2006 09:48:53 +0800 To: Tom Lane From: K C Lau Subject: Re: limitation using LIKE on ANY(array) Cc: pgsql-performance@postgresql.org In-Reply-To: <5275.1143217555@sss.pgh.pa.us> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> <20060324125245.GB90527@pervasive.com> <4423EDA9.3090502@rentalia.com> <20060324130619.GF90527@pervasive.com> <20060324133252.GA22688@winnie.fuhr.org> <6.2.1.2.0.20060324225743.04d49ac0@localhost> <5275.1143217555@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=1.338 required=5 tests=[AWL=-0.378, DNS_FROM_RFC_POST=1.44, MAILTO_TO_SPAM_ADDR=0.276] X-Spam-Score: 1.338 X-Spam-Level: * X-Archive-Number: 200603/514 X-Sequence-Number: 17951 Thank you very much, Tom. We'll try it and report if there is any significant impact performance-wise. Best regards, KC. At 00:25 06/03/25, Tom Lane wrote: >K C Lau writes: > > Indeed, I get rejected even with: > > .. WHERE ANY(array) = 'xx' > > > It would only work as documented in the manual (8.10.5): > > SELECT * FROM sal_emp WHERE 10000 = ANY (pay_by_quarter); > >That's not changing any time soon; the SQL spec defines only the second >syntax for ANY, and I believe there would be syntactic ambiguity if we >tried to allow the other. > > > With 8.1.3, I get an error when trying to do this on a Text[] column : > > .. WHERE ANY(array) LIKE 'xx%' > >If you're really intent on doing that, make an operator for "reverse >LIKE" and use it with the ANY on the right-hand side. > >regression=# create function rlike(text,text) returns bool as >regression-# 'select $2 like $1' language sql strict immutable; >CREATE FUNCTION >regression=# create operator ~~~ (procedure = rlike, leftarg = text, >regression(# rightarg = text, commutator = ~~); >CREATE OPERATOR >regression=# select 'xx%' ~~~ any(array['aaa','bbb']); > ?column? >---------- > f >(1 row) > >regression=# select 'xx%' ~~~ any(array['aaa','xxb']); > ?column? >---------- > t >(1 row) > >regression=# > > regards, tom lane From pgsql-performance-owner@postgresql.org Sat Mar 25 05:53:00 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4815D9DCA19 for ; Sat, 25 Mar 2006 05:52: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 96776-03 for ; Sat, 25 Mar 2006 05:52:59 -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 2CA709DCA0D for ; Sat, 25 Mar 2006 05:52:55 -0400 (AST) Received: from [192.168.0.5] (84.60.169.83) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.7); Sat, 25 Mar 2006 10:52:56 +0100 In-Reply-To: References: <4423EACD.80706@krap.dk> <20060324125919.GD90527@pervasive.com> <5090.1143216154@sss.pgh.pa.us> <4424458D.4060106@krap.dk> <8427.1143228229@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-11--383063560; protocol="application/pkcs7-signature" Message-Id: Cc: Postgresql Performance From: Guido Neitzer Subject: Re: Query plan from hell Date: Sat, 25 Mar 2006 10:52:56 +0100 To: PFC X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.182 required=5 tests=[AWL=0.182] X-Spam-Score: 0.182 X-Spam-Level: X-Archive-Number: 200603/515 X-Sequence-Number: 17952 --Apple-Mail-11--383063560 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 24.03.2006, at 23:54 Uhr, PFC wrote: > bookmark_delta contains very few rows but is inserted/deleted very > often... the effect is spectacular ! > I guess I'll have to vacuum analyze this table every minute... What about using autovacuum? cug -- PharmaLine, Essen, GERMANY Software and Database Development --Apple-Mail-11--383063560 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGNzCCAvAw ggJZoAMCAQICEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MDIxMTE3NDM1NFoXDTA3MDIxMTE3NDM1 NFowTTEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEqMCgGCSqGSIb3DQEJARYbZ3Vp ZG8ubmVpdHplckBwaGFybWFsaW5lLmRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA yLhNUnNv30/r+pFUHocoIWGm8AAwFbwAWqFRhEwZzxLPCMSZme3G7W/5hyK+SxeQoOK8PPCsNyvy sLBqUVHB3nm5w/NzZKk1gfc2QlzjPtv2C7bUnigDJs+X0YlgdxTxs68RdHBn/rbjjaxl+SkiEcsz kZhKsAnS6zhlWSX7zDCIRR5VD08M0/fYSTwEcX1j8lWb/3McY7bCcHbLd+762QQAn03A4cPco4OK 3KAMld0n6qFFMG23IKx7qDTonYtCzsDVspQ1Fk14yJYVdf62RLWGBJPF+RMXB9juFhgdUrHZY3mo wamFF3qZ8HD9wb+G7lhL8F+d5khDuLBYFXCqdQIDAQABozgwNjAmBgNVHREEHzAdgRtndWlkby5u ZWl0emVyQHBoYXJtYWxpbmUuZGUwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQCFnjZk bGIY3sGlsEIn98cV+tX9xNTThIwN6jhu7mGuxzvX+hN86kdlhEgaPmaatH8KfXXyfnhpTK3KOk8O zDsxJqQDVe1HEW8M/4MkORMlydbcxSRPL967pgMRNjAMafL/IlssFJ3kF7q/2AjRd4VhnyoA3Yl/ sXF3WLOTJB5OzjCCAz8wggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpB MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhh d3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24x JDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVy c29uYWwtZnJlZW1haWxAdGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTla MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSww KgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0B AQEFAAOBjQAwgYkCgYEAxKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B 1OVQCjDXAmNaLIkVcI7dyfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk 16emu59l0cUqVIUPSAR/p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/ AgEAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25h bEZyZWVtYWlsQ0EuY3JsMAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJp dmF0ZUxhYmVsMi0xMzgwDQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOW lJ1/TCG4+DYfqi2fNi/A9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amc OY6MIE9lX5Xa9/eH1sYITq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8xggMQMIIDDAIB ATB2MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQu MSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQHu2nEIcbtVh7 Lds/867h7zAJBgUrDgMCGgUAoIIBbzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3 DQEJBTEPFw0wNjAzMjUwOTUyNTdaMCMGCSqGSIb3DQEJBDEWBBSC7QTSXGt+sp/of5q1TrYIorGt cTCBhQYJKwYBBAGCNxAEMXgwdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1 bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3Vp bmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcN AQEBBQAEggEAkg5NWwv221j6VuvsRI2D9hox4RQ3DH6E6id9bvTwuklt8oOnOcrKP8bF8CXEpHqo rMy+Cy2GmHaskHgfjFgnYVimLKHfaT466ku4f/6XGyVYTEXf5ZIqJijmN2ITHTJiQWYXO39ytzZr pK7ijzfaVE9Nz5/MUvpDVcUxVIv8W8k6/enFe7XDrXH0jBRjf3/JSoMOGwQwRWGP7ZH+3QYs6j98 wgBkTXbVi9NeqyMpgjXWZ3CyqUjsuYrBNOoxrdbYxQQpn8ZnGJ0P8+fmTRH3F6NmEnZ9sl0RjfdD /GFu/wD/Prf2wb+RKHCA7/4Ml5F5aR/omi9/8vEyFXzDK9BuyQAAAAAAAA== --Apple-Mail-11--383063560-- From pgsql-general-owner@postgresql.org Sat Mar 25 15:11:33 2006 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 936389DCBE0 for ; Sat, 25 Mar 2006 15:11: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 99312-01 for ; Sat, 25 Mar 2006 15:11: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 DD2159DC888 for ; Sat, 25 Mar 2006 15:11:29 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9FD0030D08; Sat, 25 Mar 2006 20:11:29 +0100 (MET) From: Tomaz Borstnar X-Newsgroups: pgsql.general Subject: experiences needed - how does Itanium2/1.5GHz(4MB) compare to AMD and Intel CPUs as far as Postgresql is concerned Date: Sat, 25 Mar 2006 20:11:22 +0100 Organization: Hub.Org Networking Services Lines: 9 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051201) To: pgsql-general@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: 200603/1223 X-Sequence-Number: 93088 Hello! First tried some searching around, but did not find anything useful so I gave up and decided to ask here... I am wondering how do pair of 1.5GHz Itanium2(4MB cache) stack up against pair of AMD or Intel server CPUs as far as postgresql performance is concerned? Is it worthy or not? Thanks in advance. Tomaž From pgsql-performance-owner@postgresql.org Mon Mar 27 03:03:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E53049DCC4A for ; Mon, 27 Mar 2006 03:03: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 85289-10 for ; Mon, 27 Mar 2006 03:03:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id 378739DCA0C for ; Mon, 27 Mar 2006 03:03:14 -0400 (AST) Received: (qmail 30080 invoked by uid 514); 27 Mar 2006 10:05:30 +0200 Received: from 62.37.217.236 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.217.236):SA:0(-2.1/5.0):. Processed in 4.620238 secs); 27 Mar 2006 08:05:30 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.217.236):SA:0(-2.1/5.0):. Processed in 4.620238 secs Process 29883) Received: from 62-37-217-236.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.217.236) by mail.rentalia.net with SMTP; 27 Mar 2006 10:05:25 +0200 Message-ID: <44278E27.5090909@rentalia.com> Date: Mon, 27 Mar 2006 09:03:03 +0200 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Array performance References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060323132448.GB4881@surnet.cl> <4423E90E.2090607@rentalia.com> <5000.1143215504@sss.pgh.pa.us> In-Reply-To: <5000.1143215504@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.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/516 X-Sequence-Number: 17953 Tom Lane wrote: >Ruben Rubio Rey writes: > > >>SELECT (array[20]+array[21]+ ... +array[50]+array[51]) as total >>FROM table >>WHERE >>(array[20]+array[21]+ ... +array[50]+array[51])<5000 >>AND array[20]<>0 >>AND array[21]<>0 >> ... >>AND array[50]<>0 >>AND array[51])<>0 >> >Any ideas to make this query faster? > > > >What's the array datatype? Integer or float would probably go a lot >faster than NUMERIC, if that's what you're using now. > > Already its integer[] From pgsql-general-owner@postgresql.org Mon Mar 27 08:14:07 2006 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 22C0C9DC9CC for ; Mon, 27 Mar 2006 08:14: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 40196-10 for ; Mon, 27 Mar 2006 08:14:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 032DA9DC863 for ; Mon, 27 Mar 2006 08:14:04 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 0DC1B56423; Mon, 27 Mar 2006 06:14:08 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Mon, 27 Mar 2006 06:14:07 -0600 Date: Mon, 27 Mar 2006 06:14:07 -0600 From: "Jim C. Nasby" To: Tomaz Borstnar Cc: pgsql-performance@postgresql.org Subject: Re: experiences needed - how does Itanium2/1.5GHz(4MB) compare to AMD and Intel CPUs as far as Postgresql is concerned Message-ID: <20060327121407.GZ80726@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060327:pgsql-general@postgresql.org::UowIEdLrVYcS3sW2:000000000 0000000000000000000000000zTb X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/1258 X-Sequence-Number: 93123 On Sat, Mar 25, 2006 at 08:11:22PM +0100, Tomaz Borstnar wrote: > Hello! > > First tried some searching around, but did not find anything useful > so I gave up and decided to ask here... I am wondering how do pair of > 1.5GHz Itanium2(4MB cache) stack up against pair of AMD or Intel server > CPUs as far as postgresql performance is concerned? Is it worthy or not? -performance would be a better place to ask, so I'm moving this there. The general consensus is that your best bet CPU-wise is Opterons. -- 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 Mar 27 09:34:29 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C40CE9DCA1F for ; Mon, 27 Mar 2006 09:34: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 59243-06 for ; Mon, 27 Mar 2006 09:34:31 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4D5E49DCD1D for ; Mon, 27 Mar 2006 09:34:26 -0400 (AST) Received: from smarty.gabriel.co.hu (smarty.gabriel.co.hu [195.70.37.16]) by svr4.postgresql.org (Postfix) with ESMTP id EC35E5AF86D for ; Mon, 27 Mar 2006 13:34:30 +0000 (GMT) Received: from localhost (smarty [127.0.0.1]) by smarty.gabriel.co.hu (Postfix) with ESMTP id A8022417A3 for ; Mon, 27 Mar 2006 15:34:24 +0200 (CEST) Received: from smarty.gabriel.co.hu ([127.0.0.1]) by localhost (smarty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10929-02-5 for ; Mon, 27 Mar 2006 15:34:24 +0200 (CEST) Received: from [192.168.111.135] (customer-174.radio-net.hu [217.113.54.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smarty.gabriel.co.hu (Postfix) with ESMTP id 68FDE41798 for ; Mon, 27 Mar 2006 15:34:24 +0200 (CEST) Message-ID: <4427E9E8.9030806@i-logic.hu> Date: Mon, 27 Mar 2006 15:34:32 +0200 From: =?ISO-8859-2?Q?G=E1briel_=C1kos?= Organization: I-Logic Kft User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: count(*) performance Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at gabriel.co.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: 200603/518 X-Sequence-Number: 17955 Hi, I guess this is an age-old 100times answered question, but I didn't find the answer to it yet (neither in the FAQ nor in the mailing list archives). Question: I have a table with 2.5M rows. count(*) on this table is running 4 minutes long. (dual opteron, 4gig ram, db on 4 disk raid10 array (sata, not scsi)) Is this normal? How could I make it run faster? Maybe make it run faster for the 2nd time? Which parameters should I change in postgresql.conf and how? -- �dv�zlettel, G�briel �kos -=E-Mail :akos.gabriel@i-logic.hu|Web: http://www.i-logic.hu=- -=Tel/fax:+3612367353 |Mobil:+36209278894 =- From pgsql-performance-owner@postgresql.org Mon Mar 27 09:41:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C939E9DCA7E for ; Mon, 27 Mar 2006 09: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 61794-03 for ; Mon, 27 Mar 2006 09:41:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 9E79B9DC99E for ; Mon, 27 Mar 2006 09:41:00 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 919BE56427; Mon, 27 Mar 2006 07:41:04 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Mon, 27 Mar 2006 07:41:04 -0600 Date: Mon, 27 Mar 2006 07:41:04 -0600 From: "Jim C. Nasby" To: G?briel ?kos Cc: pgsql-performance@postgresql.org Subject: Re: count(*) performance Message-ID: <20060327134103.GI80726@pervasive.com> References: <4427E9E8.9030806@i-logic.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4427E9E8.9030806@i-logic.hu> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060327:akos.gabriel@i-logic.hu::h2jPYZbuxDxqMlCR:00000000000000 0000000000000000000000003FFg X-Hashcash: 1:20:060327:pgsql-performance@postgresql.org::UZ3Mi4kJZHbBetFW:00000 0000000000000000000000003o78 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/519 X-Sequence-Number: 17956 On Mon, Mar 27, 2006 at 03:34:32PM +0200, G?briel ?kos wrote: > Hi, > > I guess this is an age-old 100times answered question, but I didn't find > the answer to it yet (neither in the FAQ nor in the mailing list archives). > > Question: I have a table with 2.5M rows. count(*) on this table is > running 4 minutes long. (dual opteron, 4gig ram, db on 4 disk raid10 > array (sata, not scsi)) Is this normal? How could I make it run faster? > Maybe make it run faster for the 2nd time? Which parameters should I > change in postgresql.conf and how? First, count(*) on PostgreSQL tends to be slow because you can't do index covering[1]. But in this case, I'd bet money that if it's taking 4 minutes something else is wrong. Have you been vacuuming that table frequently enough? What's SELECT relpages FROM pg_class WHERE relname='tablename' show? [1] http://www.pervasive-postgres.com/lp/newsletters/2006/Insights_postgres_Feb.asp#5 -- 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 Mar 27 10:25:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D85F29DC83D for ; Mon, 27 Mar 2006 10: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 69049-10 for ; Mon, 27 Mar 2006 10:25:31 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 26E879DC800 for ; Mon, 27 Mar 2006 10:25:25 -0400 (AST) Received: from smtp1.voila.fr (smtp1.voila.fr [193.252.22.174]) by svr4.postgresql.org (Postfix) with ESMTP id 4F57C5AF197 for ; Mon, 27 Mar 2006 14:25:30 +0000 (GMT) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf4009.voila.fr (SMTP Server) with ESMTP id 7F95F6800171 for ; Mon, 27 Mar 2006 16:25:25 +0200 (CEST) Received: from wwinf4002 (wwinf4002 [172.22.157.29]) by mwinf4009.voila.fr (SMTP Server) with ESMTP id 73DA0680016B for ; Mon, 27 Mar 2006 16:25:25 +0200 (CEST) X-ME-UUID: 20060327142525474.73DA0680016B@mwinf4009.voila.fr Message-ID: <16175346.1143469525456.JavaMail.www@wwinf4002> From: luchot Reply-To: luchot@voila.fr To: "pgsql-performance@postgresql.org" Subject: Query parallelism Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_25669_13291368.1143469525454" X-Originating-IP: [129.185.75.10] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-REPLYTO: |~| Date: Mon, 27 Mar 2006 16:25:25 +0200 (CEST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.946 required=5 tests=[HTML_10_20=0.945, HTML_MESSAGE=0.001] X-Spam-Score: 0.946 X-Spam-Level: X-Archive-Number: 200603/520 X-Sequence-Number: 17957 ------=_Part_25669_13291368.1143469525454 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hello everybody , I use PostgreSQL 8.1.3 on a bi-processor Xeon and I would know how to do to enable a parallelism for the execution of queries. Indeed , when I analyse the use of the cpus during a query the result is that for some minutes a cpu is used while the other not and after it is the contrary. So they are not used at the same time and i would know what i have to do in order cpus work together . Thanks and sorry for my english, ------=_Part_25669_13291368.1143469525454 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hello everybody ,

I use PostgreSQL 8.1.3 on a bi-processor Xeon and I would know how to do to enable a parallelism for

the execution of  queries. Indeed , when I analyse the use of the cpus during a query the result is that for

some minutes a cpu is used while the other not and after it is the contrary. So they are not used at the same

time and i would know what i have to do in order cpus work together .

Thanks and sorry for my english,

 

------=_Part_25669_13291368.1143469525454-- From pgsql-performance-owner@postgresql.org Mon Mar 27 10:31:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D7FE89DCC7E for ; Mon, 27 Mar 2006 10:31: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 76368-06 for ; Mon, 27 Mar 2006 10:31:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 748AC9DCCD2 for ; Mon, 27 Mar 2006 10:31:44 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id C5B3656423; Mon, 27 Mar 2006 08:31:48 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Mon, 27 Mar 2006 08:31:48 -0600 Date: Mon, 27 Mar 2006 08:31:48 -0600 From: "Jim C. Nasby" To: luchot Cc: "pgsql-performance@postgresql.org" Subject: Re: Query parallelism Message-ID: <20060327143147.GU80726@pervasive.com> References: <16175346.1143469525456.JavaMail.www@wwinf4002> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16175346.1143469525456.JavaMail.www@wwinf4002> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060327:luchot@voila.fr::RUsw/R8KsdlaPhZm:000iDc X-Hashcash: 1:20:060327:pgsql-performance@postgresql.org::ES4SF4ca1qyZS1kv:00000 0000000000000000000000008T5d X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/521 X-Sequence-Number: 17958 On Mon, Mar 27, 2006 at 04:25:25PM +0200, luchot wrote: > Hello everybody , > I use PostgreSQL 8.1.3 on a bi-processor Xeon and I would know how to do to enable a parallelism for > the execution of queries. Indeed , when I analyse the use of the cpus during a query the result is that for > some minutes a cpu is used while the other not and after it is the contrary. So they are not used at the same > time and i would know what i have to do in order cpus work together . > Thanks and sorry for my english, PostgreSQL has no support for intra-query parallelism at this time. Greenplum's MPP might do what you're looking for. -- 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 Mar 27 12:32:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1D10C9DCE34 for ; Mon, 27 Mar 2006 12:32: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 01627-05 for ; Mon, 27 Mar 2006 12:32:17 -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 425F39DCAEC for ; Mon, 27 Mar 2006 12:32:15 -0400 (AST) Received: from 172.16.1.148 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Mon, 27 Mar 2006 11:32:03 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 27 Mar 2006 11:31:59 -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.106]) with Microsoft Exchange Server HTTP-DAV ; Mon, 27 Mar 2006 16:31:58 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Mon, 27 Mar 2006 08:31:58 -0800 Subject: Re: count(*) performance From: "Luke Lonergan" To: "G=?ISO-8859-1?B?4Q==?=briel =?ISO-8859-1?B?wQ==?=kos" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] count(*) performance Thread-Index: AcZRo0beqqLMYUUKREuSagzJOKK1GgAGLCml In-Reply-To: <4427E9E8.9030806@i-logic.hu> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Mar 2006 16:31:59.0076 (UTC) FILETIME=[F8284240:01C651BB] X-WSS-ID: 6836CCF62AW1445391-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.351 required=5 tests=[AWL=0.098, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.351 X-Spam-Level: * X-Archive-Number: 200603/522 X-Sequence-Number: 17959 Gabriel, On 3/27/06 5:34 AM, "G=E1briel =C1kos" wrote: > Question: I have a table with 2.5M rows. count(*) on this table is > running 4 minutes long. (dual opteron, 4gig ram, db on 4 disk raid10 > array (sata, not scsi)) Is this normal? How could I make it run faster? > Maybe make it run faster for the 2nd time? Which parameters should I > change in postgresql.conf and how? Before changing anything with your Postgres configuration, you should check your hard drive array performance. All select count(*) does is a sequentia= l scan of your data, and if the table is larger than memory, or if it's the first time you've scanned it, it is limited by your disk speed. To test your disk speed, use the following commands and report the times here: time bash -c "dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D500000 && sync" time dd if=3Dbigfile of=3D/dev/null bs=3D8k If these are taking a long time, from another session watch the I/O rate with "vmstat 1" for a while and report that here. - Luke =20 From pgsql-performance-owner@postgresql.org Mon Mar 27 14:04:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C86F19DCCE6 for ; Mon, 27 Mar 2006 14:04: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 23259-10 for ; Mon, 27 Mar 2006 14:04:48 -0400 (AST) X-Greylist: delayed 04:30:24.227321 by SQLgrey- Received: from smarty.gabriel.co.hu (smarty.gabriel.co.hu [195.70.37.16]) by postgresql.org (Postfix) with ESMTP id 035DF9DCC03 for ; Mon, 27 Mar 2006 14:04:45 -0400 (AST) Received: from localhost (smarty [127.0.0.1]) by smarty.gabriel.co.hu (Postfix) with ESMTP id 273013E3BB for ; Mon, 27 Mar 2006 20:04:42 +0200 (CEST) Received: from smarty.gabriel.co.hu ([127.0.0.1]) by localhost (smarty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31608-07 for ; Mon, 27 Mar 2006 20:04:42 +0200 (CEST) Received: from [192.168.111.135] (customer-174.radio-net.hu [217.113.54.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smarty.gabriel.co.hu (Postfix) with ESMTP id E67763C9EB for ; Mon, 27 Mar 2006 20:04:41 +0200 (CEST) Message-ID: <4428293E.9080300@i-logic.hu> Date: Mon, 27 Mar 2006 20:04:46 +0200 From: =?ISO-8859-1?Q?G=E1briel_=C1kos?= Organization: I-Logic Kft User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: count(*) performance References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at gabriel.co.hu 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: 200603/523 X-Sequence-Number: 17960 Luke Lonergan wrote: > To test your disk speed, use the following commands and report the times > here: > > time bash -c "dd if=/dev/zero of=bigfile bs=8k count=500000 && sync" root@panther:/fast # time bash -c "dd if=/dev/zero of=bigfile bs=8k count=500000 && sync" 500000+0 records in 500000+0 records out 4096000000 bytes transferred in 45.469404 seconds (90082553 bytes/sec) real 0m56.880s user 0m0.112s sys 0m18.937s > time dd if=bigfile of=/dev/null bs=8k root@panther:/fast # time dd if=bigfile of=/dev/null bs=8k 500000+0 records in 500000+0 records out 4096000000 bytes transferred in 53.542147 seconds (76500481 bytes/sec) real 0m53.544s user 0m0.048s sys 0m10.637s I guess these values aren't that bad :) -- �dv�zlettel, G�briel �kos -=E-Mail :akos.gabriel@i-logic.hu|Web: http://www.i-logic.hu=- -=Tel/fax:+3612367353 |Mobil:+36209278894 =- From pgsql-performance-owner@postgresql.org Mon Mar 27 14:05:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 43DCC9DCA15 for ; Mon, 27 Mar 2006 14:05: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 25980-05 for ; Mon, 27 Mar 2006 14:05:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smarty.gabriel.co.hu (smarty.gabriel.co.hu [195.70.37.16]) by postgresql.org (Postfix) with ESMTP id D3A029DC986 for ; Mon, 27 Mar 2006 14:05:22 -0400 (AST) Received: from localhost (smarty [127.0.0.1]) by smarty.gabriel.co.hu (Postfix) with ESMTP id 04C7E3E3BD for ; Mon, 27 Mar 2006 20:05:23 +0200 (CEST) Received: from smarty.gabriel.co.hu ([127.0.0.1]) by localhost (smarty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31608-07-2 for ; Mon, 27 Mar 2006 20:05:22 +0200 (CEST) Received: from [192.168.111.135] (customer-174.radio-net.hu [217.113.54.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smarty.gabriel.co.hu (Postfix) with ESMTP id D19BF2FFB7 for ; Mon, 27 Mar 2006 20:05:22 +0200 (CEST) Message-ID: <4428296B.9040505@i-logic.hu> Date: Mon, 27 Mar 2006 20:05:31 +0200 From: =?ISO-8859-1?Q?G=E1briel_=C1kos?= Organization: I-Logic Kft User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: count(*) performance References: <4427E9E8.9030806@i-logic.hu> <20060327134103.GI80726@pervasive.com> In-Reply-To: <20060327134103.GI80726@pervasive.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at gabriel.co.hu 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: 200603/524 X-Sequence-Number: 17961 Jim C. Nasby wrote: > But in this case, I'd bet money that if it's taking 4 minutes something > else is wrong. Have you been vacuuming that table frequently enough? That gave me an idea. I thought that autovacuum is doing it right, but I issued a vacuum full analyze verbose , and it worked all the day. After that I've tweaked memory settings a bit too (more fsm_pages) Now: staging=# SELECT count(*) from infx.infx_product; count --------- 3284997 (1 row) Time: 1301.049 ms As I saw the output, the database was compressed to 10% of its size :) This table has quite big changes every 4 hour, let's see how it works. Maybe I'll have to issue full vacuums from cron regularly. > What's SELECT relpages FROM pg_class WHERE relname='tablename' show? This went to 10% as well, now it's around 156000 pages. Regards, Akos -- �dv�zlettel, G�briel �kos -=E-Mail :akos.gabriel@i-logic.hu|Web: http://www.i-logic.hu=- -=Tel/fax:+3612367353 |Mobil:+36209278894 =- From pgsql-performance-owner@postgresql.org Mon Mar 27 14:15:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2787A9DCA15 for ; Mon, 27 Mar 2006 14:15: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 28793-05 for ; Mon, 27 Mar 2006 14:15:06 -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 9D0819DCA05 for ; Mon, 27 Mar 2006 14:15:01 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Mon, 27 Mar 2006 13:14:50 -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); Mon, 27 Mar 2006 13:14: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.118]) with Microsoft Exchange Server HTTP-DAV ; Mon, 27 Mar 2006 18:14:46 +0000 User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Mon, 27 Mar 2006 10:14:45 -0800 Subject: Re: count(*) performance From: "Luke Lonergan" To: "G=?ISO-8859-1?B?4Q==?=briel =?ISO-8859-1?B?wQ==?=kos" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] count(*) performance Thread-Index: AcZRyTXakziMFhjkQk+VCH4tfohm4AAAR15a In-Reply-To: <4428296B.9040505@i-logic.hu> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Mar 2006 18:14:50.0267 (UTC) FILETIME=[567946B0:01C651CA] X-WSS-ID: 6836F4102XS34959773-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.335 required=5 tests=[AWL=0.082, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.335 X-Spam-Level: * X-Archive-Number: 200603/525 X-Sequence-Number: 17962 Gabriel, On 3/27/06 10:05 AM, "G=E1briel =C1kos" wrote: > That gave me an idea. I thought that autovacuum is doing it right, but I > issued a vacuum full analyze verbose , and it worked all the day. > After that I've tweaked memory settings a bit too (more fsm_pages) Oops! I replied to your disk speed before I saw this. The only thing is - you probably don't want to do a "vacuum full", but rather a simple "vacuum" should be enough. - Luke From pgsql-performance-owner@postgresql.org Mon Mar 27 14:21:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 68A5E9DCAA1 for ; Mon, 27 Mar 2006 14: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 32823-02 for ; Mon, 27 Mar 2006 14:21:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smarty.gabriel.co.hu (smarty.gabriel.co.hu [195.70.37.16]) by postgresql.org (Postfix) with ESMTP id 03AEC9DCA15 for ; Mon, 27 Mar 2006 14:21:49 -0400 (AST) Received: from localhost (smarty [127.0.0.1]) by smarty.gabriel.co.hu (Postfix) with ESMTP id 4EC313FE2D for ; Mon, 27 Mar 2006 20:21:49 +0200 (CEST) Received: from smarty.gabriel.co.hu ([127.0.0.1]) by localhost (smarty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06081-02 for ; Mon, 27 Mar 2006 20:21:49 +0200 (CEST) Received: from [192.168.111.135] (customer-174.radio-net.hu [217.113.54.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smarty.gabriel.co.hu (Postfix) with ESMTP id 1EB9E2D958 for ; Mon, 27 Mar 2006 20:21:49 +0200 (CEST) Message-ID: <44282D45.7020008@i-logic.hu> Date: Mon, 27 Mar 2006 20:21:57 +0200 From: =?ISO-8859-1?Q?G=E1briel_=C1kos?= Organization: I-Logic Kft User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: count(*) performance References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at gabriel.co.hu 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: 200603/526 X-Sequence-Number: 17963 Luke Lonergan wrote: > Gabriel, > > On 3/27/06 10:05 AM, "G�briel �kos" wrote: > >> That gave me an idea. I thought that autovacuum is doing it right, but I >> issued a vacuum full analyze verbose , and it worked all the day. >> After that I've tweaked memory settings a bit too (more fsm_pages) > > Oops! I replied to your disk speed before I saw this. > > The only thing is - you probably don't want to do a "vacuum full", but > rather a simple "vacuum" should be enough. I thought that too. Autovacuum is running on our system but it didn't do the trick. Anyway the issue is solved, thank you all for helping. :) -- �dv�zlettel, G�briel �kos -=E-Mail :akos.gabriel@i-logic.hu|Web: http://www.i-logic.hu=- -=Tel/fax:+3612367353 |Mobil:+36209278894 =- From pgsql-performance-owner@postgresql.org Mon Mar 27 14:47:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EE3D19DC992 for ; Mon, 27 Mar 2006 14:47: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 43704-01 for ; Mon, 27 Mar 2006 14:47:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by postgresql.org (Postfix) with ESMTP id 51C7C9DC86B for ; Mon, 27 Mar 2006 14:47:48 -0400 (AST) Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id k2RIllv3019813 for ; Mon, 27 Mar 2006 13:47:47 -0500 (EST) Received: from UNKNOWN( ), claiming to be "sty.llan" via SMTP by llmail, id smtpdAAACQa4iM; Mon Mar 27 13:47:34 2006 Date: Mon, 27 Mar 2006 13:47:33 -0500 From: george young To: pgsql-performance@postgresql.org Subject: simple join uses indexes, very slow Message-Id: <20060327134733.72422d23.gry@ll.mit.edu> Reply-To: gry@ll.mit.edu Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.8.0; 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.106 required=5 tests=[AWL=0.105, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.106 X-Spam-Level: X-Archive-Number: 200603/527 X-Sequence-Number: 17964 [PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1] I have a simple join on two tables that takes way too long. Can you help me understand what's wrong? There are indexes defined on the relevant columns. I just did a fresh vacuum --full --analyze on the two tables. Is there something I'm not seeing? [CPU is 950Mhz AMD, 256MB RAM, 15k rpm scsi disk] -- George Young Table sizes: parameters has 2.1512e+07 tuples, run_opsets has 211745 tuples. explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=2.16..7957.40 rows=6707 width=22) (actual time=14.986..70197.129 rows=43050 loops=1) -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..128.75 rows=71 width=18) (actual time=0.386..62.959 rows=263 loops=1) Index Cond: (run = 'team9'::text) -> Bitmap Heap Scan on parameters p (cost=2.16..109.93 rows=27 width=22) (actual time=1.591..266.211 rows=164 loops=263) Recheck Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) -> Bitmap Index Scan on parameters_idx (cost=0.00..2.16 rows=27 width=0) (actual time=1.153..1.153 rows=164 loops=263) Index Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) Total runtime: 70237.727 ms (8 rows) Table "public.run_opsets" Column | Type | Modifiers --------------+-----------------------------+------------------------- run | text | not null opset | text | opset_ver | integer | opset_num | integer | not null status | opset_status | date_started | timestamp without time zone | date_done | timestamp without time zone | work_started | timestamp without time zone | lock_user | text | default 'NO-USER'::text lock_pid | integer | needs_review | text | Indexes: "run_opsets_pkey" PRIMARY KEY, btree (run, opset_num) CLUSTER -- Table "public.parameters" Column | Type | Modifiers -----------+---------+------------------------------- run | text | not null opset_num | integer | not null opset | text | not null opset_ver | integer | not null step_num | integer | not null step | text | not null step_ver | integer | not null name | text | not null value | text | split | boolean | not null default false wafers | text[] | not null default '{}'::text[] Indexes: "parameters_idx" btree (run, opset_num, step_num, opset, opset_ver, step, step_ver, name, split, wafers) "parameters_opset_idx" btree (opset, step, name) "parameters_step_idx" btree (step, name) "Are the gods not just?" "Oh no, child. What would become of us if they were?" (CSL) From pgsql-performance-owner@postgresql.org Mon Mar 27 15:21:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5CDF99DD548 for ; Mon, 27 Mar 2006 15:21: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 54122-08 for ; Mon, 27 Mar 2006 15:21:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.clickspace.com (router2.clickspace.com [65.110.166.227]) by postgresql.org (Postfix) with ESMTP id DDDDD9DCD26 for ; Mon, 27 Mar 2006 15:21:13 -0400 (AST) Received: from [192.168.5.166] ([68.145.108.192]) (authenticated user brendan@clickspace.com) by mail.clickspace.com (using TLSv1/SSLv3 with cipher RC4-SHA (128 bits)); Mon, 27 Mar 2006 12:21:05 -0700 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-1--176185991; protocol="application/pkcs7-signature" Message-Id: Cc: =?ISO-8859-1?Q?"G=E1briel_=C1kos"?= , pgsql-performance@postgresql.org From: Brendan Duddridge Subject: Re: count(*) performance Date: Mon, 27 Mar 2006 12:20:54 -0700 To: Luke Lonergan X-Mailer: Apple Mail (2.749.3) 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: 200603/528 X-Sequence-Number: 17965 --Apple-Mail-1--176185991 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Does that mean that even though autovacuum is turned on, you still =20 should do a regular vacuum analyze periodically? Thanks, ____________________________________________________________________ Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com ClickSpace Interactive Inc. Suite L100, 239 - 10th Ave. SE Calgary, AB T2G 0V9 http://www.clickspace.com On Mar 27, 2006, at 11:14 AM, Luke Lonergan wrote: > Gabriel, > > On 3/27/06 10:05 AM, "G=E1briel =C1kos" = wrote: > >> That gave me an idea. I thought that autovacuum is doing it right, =20= >> but I >> issued a vacuum full analyze verbose , and it worked all the day. >> After that I've tweaked memory settings a bit too (more fsm_pages) > > Oops! I replied to your disk speed before I saw this. > > The only thing is - you probably don't want to do a "vacuum full", but > rather a simple "vacuum" should be enough. > > - Luke > > > > ---------------------------(end of =20 > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > --Apple-Mail-1--176185991 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGIDCCAtkw ggJCoAMCAQICAw84ujANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwNzI5MjAxMTQzWhcNMDYwNzI5MjAxMTQzWjBIMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSUwIwYJKoZIhvcNAQkBFhZicmVuZGFuQGNsaWNrc3Bh Y2UuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqWfMCdFgKzXroGNqJuU3eyDC K/Gxts3mtmIdgcHGmUjRKdlBSfkmcCBUDPJIt4QQc91sY3h8Itg0EAsF+1yFECU6afn/1SEAHSDK 6Q86PclF58/Dux2FYNGpeIAw/lisZ2UCyIYoUiWtEDKCBq5jDuYzcGkFS5Csz+/rEL+BHTXQVqnS nUdUaXu9xdZn4wgjB/n65UEYRqr0LGN53CGsFcA9uC+ViS7WyBtzJcP02LMNT+cAZ7TKHw4Q/ZeG 5ptPgQHLTD2wza3GMbPQ4fYK6aNPA+lVzslLSCjyQpg55gVyQQlV0k/5zU5Q5m48ZtqwOqN+fPYd eIB7H5y1SFLd/wIDAQABozMwMTAhBgNVHREEGjAYgRZicmVuZGFuQGNsaWNrc3BhY2UuY29tMAwG A1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAT+6hGvStHoRO0OCHlJev31BpUlvPSpbYVKJN i5kCMF164sSX7j0IRvcyU6DfUuW7samTluXJbANyuX1ZIpXulGen5EEc2NV7eU/rMz6ExklMShTh ++azcvmMjOzTuqXi3ZsIjwzBBhqCB0U++kYlMlHEYla2qKLFbXY6PiH0a8swggM/MIICqKADAgEC AgENMA0GCSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBl MRIwEAYDVQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQL Ex9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29u YWwgRnJlZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5j b20wHhcNMDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFs IEZyZWVtYWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftO ucqZWh5owHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9x VsuvPAsH5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAe ZBlyYLf7AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJo dHRwOi8vY3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8E BAMCAQYwKQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3 DQEBBQUAA4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9 reFhYsPZOhl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAa WzVNd+NWIXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMG A1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMx CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjAzMjcxOTIwNTVaMCMGCSqGSIb3DQEJBDEW BBTeC9k+1yV388wPi/FccUnAJrFTuDB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUw IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIDDzi6MHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYD VQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMj VGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujANBgkqhkiG9w0BAQEFAASC AQBeO1xbn5H9uxl8VoVKfFrKlCcIFoTrJKv8/T22rMCpt4iWtwKKmopA4Nn/CICmmm8RqArg66k8 QhUAI/zjEQYjIsJEc6WY6GvhahcX314EBrgorxybBf5Jd5wJQJsf/OQ1LNKgbKqHFWuVFoARMxRi zh3LsTJ5NXBipplhcS1Qd7yM6ve0XCfEV4aDkEK3d5rKmEJgDJq+4Ub7gUsfrrMMsJJKg0XC8yj9 DsoNF+U1AR6WN6xrIaUO47xnsknireGMrkmuu+ubp324Q1gL5ly8yEIekCPBQce7Px/vWd/Bq7cj tsMHqNZQFk/d7LNWJwZwyM3/wQxp1vVepaJ96KrzAAAAAAAA --Apple-Mail-1--176185991-- From pgsql-performance-owner@postgresql.org Mon Mar 27 15:21:24 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9E32C9DCB7A for ; Mon, 27 Mar 2006 15:21: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 54077-09 for ; Mon, 27 Mar 2006 15:21:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by postgresql.org (Postfix) with ESMTP id 6812C9DCAA1 for ; Mon, 27 Mar 2006 15:21:21 -0400 (AST) Received: from ool-4350c8e6.dyn.optonline.net ([67.80.200.230] helo=[192.168.0.96]) by outbound.mailhop.org with esmtpa (Exim 4.51) id 1FNxHB-000CMR-9z; Mon, 27 Mar 2006 14:21:17 -0500 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 67.80.200.230 X-Report-Abuse-To: abuse@dyndns.com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: zeut Message-ID: <44283B42.7060803@zeut.net> Date: Mon, 27 Mar 2006 14:21:38 -0500 From: "Matthew T. O'Connor" User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: =?ISO-8859-1?Q?G=E1briel_=C1kos?= CC: pgsql-performance@postgresql.org Subject: Re: count(*) performance References: <44282D45.7020008@i-logic.hu> In-Reply-To: <44282D45.7020008@i-logic.hu> 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.128 required=5 tests=[AWL=0.128] X-Spam-Score: 0.128 X-Spam-Level: X-Archive-Number: 200603/529 X-Sequence-Number: 17966 G�briel �kos wrote: > Luke Lonergan wrote: >> Gabriel, >> >> On 3/27/06 10:05 AM, "G�briel �kos" wrote: >> >>> That gave me an idea. I thought that autovacuum is doing it right, but I >>> issued a vacuum full analyze verbose , and it worked all the day. >>> After that I've tweaked memory settings a bit too (more fsm_pages) >> >> Oops! I replied to your disk speed before I saw this. >> >> The only thing is - you probably don't want to do a "vacuum full", but >> rather a simple "vacuum" should be enough. > > I thought that too. Autovacuum is running on our system but it didn't do > the trick. Anyway the issue is solved, thank you all for helping. :) Yeah, it would be nice of autovacuum had some way of raising a flag to the admin that given current settings (thresholds, FSM etc...), it's not keeping up with the activity. I don't know how to do this, but I hope someone else has some good ideas. Matt From pgsql-performance-owner@postgresql.org Mon Mar 27 15:35:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 685409DC84C for ; Mon, 27 Mar 2006 15:35: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 58690-08 for ; Mon, 27 Mar 2006 15:35:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id 519D59DCAE5 for ; Mon, 27 Mar 2006 15:35:27 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 27 Mar 2006 15:35:28 -0400 X-IronPort-AV: i="4.03,135,1141614000"; d="scan'208"; a="49267840:sNHT18751048" Received: from alvh.no-ip.org (200.126.99.207) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00C323C2; Mon, 27 Mar 2006 15:35:28 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 279D4C4E9C3; Mon, 27 Mar 2006 15:35:28 -0400 (CLT) Date: Mon, 27 Mar 2006 15:35:28 -0400 From: Alvaro Herrera To: Brendan Duddridge Cc: Luke Lonergan , =?iso-8859-1?Q?G=E1briel_=C1kos?= , pgsql-performance@postgresql.org Subject: Re: count(*) performance Message-ID: <20060327193527.GB12691@surnet.cl> Mail-Followup-To: Brendan Duddridge , Luke Lonergan , =?iso-8859-1?Q?G=E1briel_=C1kos?= , 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.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.804 required=5 tests=[AWL=-0.115, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.804 X-Spam-Level: * X-Archive-Number: 200603/530 X-Sequence-Number: 17967 Brendan Duddridge wrote: > Does that mean that even though autovacuum is turned on, you still > should do a regular vacuum analyze periodically? No, it probably means you have set FSM settings too low, or not tuned the autovacuum parameters to your specific situation. A bug in the autovacuum daemon is not unexpected however, so if it doesn't work after tuning, let us know. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Mon Mar 27 15:43:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C1A1E9DCB7A for ; Mon, 27 Mar 2006 15:43: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 62387-06 for ; Mon, 27 Mar 2006 15:43:49 -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 3047E9DCAA1 for ; Mon, 27 Mar 2006 15:43:46 -0400 (AST) Received: from [192.168.4.11] (62.153.135.40) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.7); Mon, 27 Mar 2006 21:43:46 +0200 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-1--174816513; protocol="application/pkcs7-signature" Message-Id: <2C2F0FEF-084D-422C-A355-373CD18C38B3@pharmaline.de> Cc: Postgresql Performance From: Guido Neitzer Subject: Re: count(*) performance Date: Mon, 27 Mar 2006 21:43:43 +0200 To: Brendan Duddridge X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.089 required=5 tests=[AWL=0.089] X-Spam-Score: 0.089 X-Spam-Level: X-Archive-Number: 200603/531 X-Sequence-Number: 17968 --Apple-Mail-1--174816513 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 27.03.2006, at 21:20 Uhr, Brendan Duddridge wrote: > Does that mean that even though autovacuum is turned on, you still > should do a regular vacuum analyze periodically? It seems that there are situations where autovacuum does not a really good job. However, in our application I have made stupid design decision which I want to change as soon as possible. I have a "visit count" column in one of the very large tables, so updates are VERY regular. I've just checked and saw that autovacuum does a great job with that. Nevertheless I have set up a cron job to do a standard vacuum every month. I've used vacuum full only once after I did a bulk update of about 200.000 rows ... cug -- PharmaLine, Essen, GERMANY Software and Database Development --Apple-Mail-1--174816513 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGNzCCAvAw ggJZoAMCAQICEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MDIxMTE3NDM1NFoXDTA3MDIxMTE3NDM1 NFowTTEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEqMCgGCSqGSIb3DQEJARYbZ3Vp ZG8ubmVpdHplckBwaGFybWFsaW5lLmRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA yLhNUnNv30/r+pFUHocoIWGm8AAwFbwAWqFRhEwZzxLPCMSZme3G7W/5hyK+SxeQoOK8PPCsNyvy sLBqUVHB3nm5w/NzZKk1gfc2QlzjPtv2C7bUnigDJs+X0YlgdxTxs68RdHBn/rbjjaxl+SkiEcsz kZhKsAnS6zhlWSX7zDCIRR5VD08M0/fYSTwEcX1j8lWb/3McY7bCcHbLd+762QQAn03A4cPco4OK 3KAMld0n6qFFMG23IKx7qDTonYtCzsDVspQ1Fk14yJYVdf62RLWGBJPF+RMXB9juFhgdUrHZY3mo wamFF3qZ8HD9wb+G7lhL8F+d5khDuLBYFXCqdQIDAQABozgwNjAmBgNVHREEHzAdgRtndWlkby5u ZWl0emVyQHBoYXJtYWxpbmUuZGUwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQCFnjZk bGIY3sGlsEIn98cV+tX9xNTThIwN6jhu7mGuxzvX+hN86kdlhEgaPmaatH8KfXXyfnhpTK3KOk8O zDsxJqQDVe1HEW8M/4MkORMlydbcxSRPL967pgMRNjAMafL/IlssFJ3kF7q/2AjRd4VhnyoA3Yl/ sXF3WLOTJB5OzjCCAz8wggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpB MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhh d3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24x JDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVy c29uYWwtZnJlZW1haWxAdGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTla MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSww KgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0B AQEFAAOBjQAwgYkCgYEAxKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B 1OVQCjDXAmNaLIkVcI7dyfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk 16emu59l0cUqVIUPSAR/p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/ AgEAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25h bEZyZWVtYWlsQ0EuY3JsMAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJp dmF0ZUxhYmVsMi0xMzgwDQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOW lJ1/TCG4+DYfqi2fNi/A9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amc OY6MIE9lX5Xa9/eH1sYITq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8xggMQMIIDDAIB ATB2MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQu MSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQHu2nEIcbtVh7 Lds/867h7zAJBgUrDgMCGgUAoIIBbzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3 DQEJBTEPFw0wNjAzMjcxOTQzNDRaMCMGCSqGSIb3DQEJBDEWBBTN1MmbbsDGC8O1diVku4yjgR8S HDCBhQYJKwYBBAGCNxAEMXgwdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1 bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3Vp bmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcN AQEBBQAEggEAGoH7m3XJ4CHQ/uZAI5n6snIWwiApu1w6CtR15ko2ptoigEItBHKhiVmZVsVi3nRm pv/m23rb+Lq13yd8GYn95w7HBW7pSCGSiNxbktvA7BSZIc9c6/Hwlf0qGOBf6eedohPwS5FYYQh3 EACOsdZ13ZEWIPrdS+NyvwGM2VaItObccu7iFcX2YVNMB0XLnJXSjIrm7+r1NlzR8t0/JL4ArAhR 9u8c9btHXbhPjpy0re1f4MM62ltFHt5g9KlRqaXUNUrufAaXR6AbfM3IEBzsFMiH2IdDtj3vIBjC 59ZtjylG4za9HpKz3FRgbxTBC3R5w/vEa1aYE2pp6xrOW+DsIgAAAAAAAA== --Apple-Mail-1--174816513-- From pgsql-performance-owner@postgresql.org Mon Mar 27 16:16:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EB2FB9DCA67 for ; Mon, 27 Mar 2006 16: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 71413-02 for ; Mon, 27 Mar 2006 16:16:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from pproxy.gmail.com (pproxy.gmail.com [64.233.166.182]) by postgresql.org (Postfix) with ESMTP id DDCF09DC99C for ; Mon, 27 Mar 2006 16:16:20 -0400 (AST) Received: by pproxy.gmail.com with SMTP id m51so150619pye for ; Mon, 27 Mar 2006 12:16:19 -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=mcdRrhF99WmIOBRYat+Pvaf/iIPVbcJRt6DtvA9TqOV+OsMqgHz+eZ0I+FrUucv3JcE4nvQ2S8e7jLhXAMbvgCtvmVjLknZgVyB1+A12fbpuOeoO+BDsykXY3/Gp/ZZm8+Jk3m6vDzg9NkB8Ka9rmlTSzWZeixqEsOZ87VuUicQ= Received: by 10.65.156.11 with SMTP id i11mr2726805qbo; Mon, 27 Mar 2006 12:16:18 -0800 (PST) Received: by 10.65.240.20 with HTTP; Mon, 27 Mar 2006 12:16:18 -0800 (PST) Message-ID: <3cf983d0603271216x6d4a4614ye6dc48e31e8b5cb6@mail.gmail.com> Date: Mon, 27 Mar 2006 12:16:18 -0800 From: "Rodrigo Madera" To: pgsql-performance@postgresql.org Subject: Large Binary Objects Middleware 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.726 required=5 tests=[AWL=-0.606, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.726 X-Spam-Level: X-Archive-Number: 200603/532 X-Sequence-Number: 17969 Hello to all on the list. I have developed a product that sits between the database and an application that handles the storage of large binary data. The system is fast, but I'm feeling bad as to think that I have completely reinvented the weel on this case. You see, the engine does just stores the large data in "containers" that are directly on the filesystem instead of going to the database directly (since some of this list's members told me it would make the database really slow to store the data directly). So now I have a huge dilema as to continue this reinvention or use direct large objects. The database is holding large ammounts of digital video, and I am wanting to put these directly into the database. What performance guidelines would you all give seeing my position today? Thanks for all your speed-up tips, Rodrigo From pgsql-performance-owner@postgresql.org Mon Mar 27 17:57:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 408B89DCA05 for ; Mon, 27 Mar 2006 17:57: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 88176-03 for ; Mon, 27 Mar 2006 17:57:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) by postgresql.org (Postfix) with ESMTP id E984E9DC863 for ; Mon, 27 Mar 2006 17:57:12 -0400 (AST) Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by mail.wirelesscar.com with InterScan Messaging Security Suite; Mon, 27 Mar 2006 23:57:12 +0200 content-class: urn:content-classes:message Subject: Re: count(*) performance MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Date: Mon, 27 Mar 2006 23:57:43 +0200 Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B088295@sesrv12.wirelesscar.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] count(*) performance Thread-Index: AcZR1vUDxSPg/6WbQnq6S4mZtYOvrwAD94Cw From: "Mikael Carneholm" To: "Postgresql Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.128 required=5 tests=[AWL=0.128] X-Spam-Score: 0.128 X-Spam-Level: X-Archive-Number: 200603/533 X-Sequence-Number: 17970 This is where a "last_vacuumed" (and "last_analyzed") column in pg_statistic(?) would come in handy. Each time vacuum or analyze has finished, update the row for the specific table that was vacuumed/analyzed with a timestamp in the last_vacuumed/last_analyzed column. No more guessing "maybe I haven't vacuumed/analyzed in a while", and each time a user complains about bad performance, one could request the user to do a "select s.last_vacuumed, s.last_analyzed from pg_statistic s, pg_attribute a, pg_class c where ..." It SOUNDS easy to implement, but that has fooled me before... :-) - Mikael -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Guido Neitzer Sent: den 27 mars 2006 21:44 To: Brendan Duddridge Cc: Postgresql Performance Subject: Re: [PERFORM] count(*) performance On 27.03.2006, at 21:20 Uhr, Brendan Duddridge wrote: > Does that mean that even though autovacuum is turned on, you still =20 > should do a regular vacuum analyze periodically? It seems that there are situations where autovacuum does not a really =20 good job. However, in our application I have made stupid design decision which =20 I want to change as soon as possible. I have a "visit count" column =20 in one of the very large tables, so updates are VERY regular. I've =20 just checked and saw that autovacuum does a great job with that. Nevertheless I have set up a cron job to do a standard vacuum every =20 month. I've used vacuum full only once after I did a bulk update of =20 about 200.000 rows ... cug --=20 PharmaLine, Essen, GERMANY Software and Database Development From pgsql-performance-owner@postgresql.org Mon Mar 27 18:42:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BB9F69DC9C7 for ; Mon, 27 Mar 2006 18:42: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 91939-08 for ; Mon, 27 Mar 2006 18:42:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by postgresql.org (Postfix) with ESMTP id BF9959DC863 for ; Mon, 27 Mar 2006 18:42:39 -0400 (AST) Received: from ool-4350c8e6.dyn.optonline.net ([67.80.200.230] helo=[192.168.0.96]) by outbound.mailhop.org with esmtpa (Exim 4.51) id 1FO0Q6-0006b1-1u; Mon, 27 Mar 2006 17:42:42 -0500 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 67.80.200.230 X-Report-Abuse-To: abuse@dyndns.com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: zeut Message-ID: <44286A76.5010008@zeut.net> Date: Mon, 27 Mar 2006 17:43:02 -0500 From: "Matthew T. O'Connor" User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: Mikael Carneholm CC: Postgresql Performance Subject: Re: count(*) performance References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088295@sesrv12.wirelesscar.com> In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B088295@sesrv12.wirelesscar.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.127 required=5 tests=[AWL=0.127] X-Spam-Score: 0.127 X-Spam-Level: X-Archive-Number: 200603/534 X-Sequence-Number: 17971 Mikael Carneholm wrote: > This is where a "last_vacuumed" (and "last_analyzed") column in > pg_statistic(?) would come in handy. Each time vacuum or analyze has > finished, update the row for the specific table that was > vacuumed/analyzed with a timestamp in the last_vacuumed/last_analyzed > column. No more guessing "maybe I haven't vacuumed/analyzed in a while", > and each time a user complains about bad performance, one could request > the user to do a "select s.last_vacuumed, s.last_analyzed from > pg_statistic s, pg_attribute a, pg_class c where ..." > > It SOUNDS easy to implement, but that has fooled me before... :-) It is fairly easy to implement, however it has been discussed before and decided that it wasn't necessary. What the system cares about is how long it's been since the last vacuum in terms of XIDs not time. Storing a timestamp would make it more human readable, but I'm not sure the powers that be want to add two new columns to some system table to accommodate this. Matt From pgsql-performance-owner@postgresql.org Mon Mar 27 19:13:48 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 559B99DC863 for ; Mon, 27 Mar 2006 19:13: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 98453-01 for ; Mon, 27 Mar 2006 19: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 CC50C9DD236 for ; Mon, 27 Mar 2006 19:13:45 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2RNDmof024744; Mon, 27 Mar 2006 18:13:48 -0500 (EST) To: "Matthew T. O'Connor" cc: Mikael Carneholm , Postgresql Performance Subject: Re: count(*) performance In-reply-to: <44286A76.5010008@zeut.net> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088295@sesrv12.wirelesscar.com> <44286A76.5010008@zeut.net> Comments: In-reply-to "Matthew T. O'Connor" message dated "Mon, 27 Mar 2006 17:43:02 -0500" Date: Mon, 27 Mar 2006 18:13:48 -0500 Message-ID: <24743.1143501228@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/535 X-Sequence-Number: 17972 "Matthew T. O'Connor" writes: > It is fairly easy to implement, however it has been discussed before and > decided that it wasn't necessary. What the system cares about is how > long it's been since the last vacuum in terms of XIDs not time. I think Alvaro is intending to do the latter (store per-table vacuum xid info) for 8.2. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Mar 27 19:17:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7FCBB9DCC12 for ; Mon, 27 Mar 2006 19: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 96471-06 for ; Mon, 27 Mar 2006 19:17:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) by postgresql.org (Postfix) with ESMTP id 3486A9DC9C0 for ; Mon, 27 Mar 2006 19:17:13 -0400 (AST) Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by mail.wirelesscar.com with InterScan Messaging Security Suite; Tue, 28 Mar 2006 01:17:12 +0200 content-class: urn:content-classes:message Subject: Re: count(*) performance MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 28 Mar 2006 01:17:43 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B088296@sesrv12.wirelesscar.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] count(*) performance Thread-Index: AcZR79Z+fx1efc3lRQur/42EjE1srQAApX7Q From: "Mikael Carneholm" To: "Matthew T. O'Connor" Cc: "Postgresql Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.128 required=5 tests=[AWL=0.128] X-Spam-Score: 0.128 X-Spam-Level: X-Archive-Number: 200603/536 X-Sequence-Number: 17973 I think it is definitely necessary from an administration point of view = - as an administrator, I want to know: 1) Are there any stats (at all) in a schema 2) Are there any stats on the table that slow_query_foo is targeting 3) If I have stats, how recent are they 4) Could it be that there are a lot of dead tuples lying around (given = the amount of traffic I know I have) These would be (are always!) the first questions I ask myself when I'm = about to identify performance problems in an app, don't know how other = people do though :) Maybe something I'll try to look into this weekend, if I can spare some = time. - Mikael -----Original Message----- From: Matthew T. O'Connor [mailto:matthew@zeut.net] Sent: den 28 mars 2006 00:43 To: Mikael Carneholm Cc: Postgresql Performance Subject: Re: [PERFORM] count(*) performance Mikael Carneholm wrote: > This is where a "last_vacuumed" (and "last_analyzed") column in > pg_statistic(?) would come in handy. Each time vacuum or analyze has > finished, update the row for the specific table that was > vacuumed/analyzed with a timestamp in the last_vacuumed/last_analyzed > column. No more guessing "maybe I haven't vacuumed/analyzed in a = while", > and each time a user complains about bad performance, one could = request > the user to do a "select s.last_vacuumed, s.last_analyzed from > pg_statistic s, pg_attribute a, pg_class c where ..." >=20 > It SOUNDS easy to implement, but that has fooled me before... :-) It is fairly easy to implement, however it has been discussed before and = decided that it wasn't necessary. What the system cares about is how=20 long it's been since the last vacuum in terms of XIDs not time. Storing = a timestamp would make it more human readable, but I'm not sure the=20 powers that be want to add two new columns to some system table to=20 accommodate this. Matt From pgsql-performance-owner@postgresql.org Tue Mar 28 04:31:05 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 297D99DC98E for ; Tue, 28 Mar 2006 04:31: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 28720-03 for ; Tue, 28 Mar 2006 04:31: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 030A09DCBAF for ; Tue, 28 Mar 2006 04:31:02 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 7FA9C339721; Tue, 28 Mar 2006 09:31:01 +0100 (BST) Subject: Re: simple join uses indexes, very slow From: Simon Riggs To: gry@ll.mit.edu Cc: pgsql-performance@postgresql.org In-Reply-To: <20060327134733.72422d23.gry@ll.mit.edu> References: <20060327134733.72422d23.gry@ll.mit.edu> Content-Type: text/plain Date: Tue, 28 Mar 2006 09:30:54 +0100 Message-Id: <1143534654.3839.251.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.097 required=5 tests=[AWL=0.097] X-Spam-Score: 0.097 X-Spam-Level: X-Archive-Number: 200603/537 X-Sequence-Number: 17974 On Mon, 2006-03-27 at 13:47 -0500, george young wrote: > Table sizes: parameters has 2.1512e+07 tuples, run_opsets has 211745 tuples. > > explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; > QUERY PLAN > -------------------------------------------------------------------------------------------------------------------------------------------- > Nested Loop (cost=2.16..7957.40 rows=6707 width=22) (actual time=14.986..70197.129 rows=43050 loops=1) > -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..128.75 rows=71 width=18) (actual time=0.386..62.959 rows=263 loops=1) > Index Cond: (run = 'team9'::text) > -> Bitmap Heap Scan on parameters p (cost=2.16..109.93 rows=27 width=22) (actual time=1.591..266.211 rows=164 loops=263) > Recheck Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) > -> Bitmap Index Scan on parameters_idx (cost=0.00..2.16 rows=27 width=0) (actual time=1.153..1.153 rows=164 loops=263) > Index Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) > Total runtime: 70237.727 ms > (8 rows) The planner appears to be underestimating the number of rows retrieved in both cases, then multiplying them together to make it worse. Multi-column indexes provide less accurate estimates (right now). Looks like a hash join might be faster. What is your work_mem set to? Can you SET enable_nestloop=off and rerun the EXPLAIN ANALYZE? Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Mar 28 07:49:36 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7709D9DCA72 for ; Tue, 28 Mar 2006 07:49: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 15537-08 for ; Tue, 28 Mar 2006 07:49:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 4259E9DCA27 for ; Tue, 28 Mar 2006 07:49:33 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (T8b28.t.pppool.de [89.55.139.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id AF9EA656CF; Tue, 28 Mar 2006 13:50:15 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 88D6018148C82; Tue, 28 Mar 2006 13:49:45 +0200 (CEST) Message-ID: <442922D9.1020402@logix-tt.com> Date: Tue, 28 Mar 2006 13:49:45 +0200 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: =?ISO-8859-1?Q?G=E1briel_=C1kos?= Cc: pgsql-performance@postgresql.org Subject: Re: count(*) performance References: <44282D45.7020008@i-logic.hu> In-Reply-To: <44282D45.7020008@i-logic.hu> X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200603/538 X-Sequence-Number: 17975 G=E1briel =C1kos wrote: > I thought that too. Autovacuum is running on our system but it didn't d= o > the trick. Anyway the issue is solved, thank you all for helping. :) Hi, Gabriel, it may be that your Free Space Map (FSM) setting is way to low. Try increasing it. Btw, VACUUM outputs a Warning if FSM is not high enough, maybe you can find useful hints in the log file. HTH 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 From pgsql-performance-owner@postgresql.org Tue Mar 28 08:14:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E7AB69DC993 for ; Tue, 28 Mar 2006 08:14: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 22641-09 for ; Tue, 28 Mar 2006 08:14:03 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id DFBFA9DCA54 for ; Tue, 28 Mar 2006 08:13:58 -0400 (AST) Received: from ctb-mesg5.saix.net (ctb-mesg5.saix.net [196.25.240.75]) by svr4.postgresql.org (Postfix) with ESMTP id B5F0B5AF896 for ; Tue, 28 Mar 2006 12:14:01 +0000 (GMT) Received: from greg (dsl-145-175-122.telkomadsl.co.za [165.145.175.122]) by ctb-mesg5.saix.net (Postfix) with SMTP id 240DD3E0B for ; Tue, 28 Mar 2006 14:14:02 +0200 (SAST) Message-ID: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> Reply-To: "Greg Quinn" From: "Greg Quinn" To: Subject: Slow performance on Windows .NET and OleDb Date: Tue, 28 Mar 2006 14:14:00 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.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: 200603/539 X-Sequence-Number: 17976 Hello, I have just installed PostGreSql 8.1 on my Windows XP PC. I created a simple table called users with 4 varchar fields. I am using the OleDb connection driver. In my .NET application, I populate 3000 records into the table to test PostGreSql's speed. It takes about 3-4 seconds. Even worse is displaying the 3000 records in a ListView control. It takes about 7 seconds. In MySQL, the exact same table and application displays the same 3000 records in under 1/2 second!!! Why is PostGreSql so slow compared to MySQL? What do you recommend I do to speed up? It is such a simple query and small database. From pgsql-performance-owner@postgresql.org Tue Mar 28 10:10:46 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 768A39DCBAF for ; Tue, 28 Mar 2006 10:10: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 55998-08 for ; Tue, 28 Mar 2006 10:10:48 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from pproxy.gmail.com (pproxy.gmail.com [64.233.166.180]) by postgresql.org (Postfix) with ESMTP id 6BDC39DCB97 for ; Tue, 28 Mar 2006 10:10:42 -0400 (AST) Received: by pproxy.gmail.com with SMTP id x31so1935778pye for ; Tue, 28 Mar 2006 06:10:46 -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=VkSQP0ZdgiQAaD0ah6K4hkONf+62spRGIEjCgSMOAfYKk/iTKxmt2Z7p2UztzjGcHlAXMPfwSrsyxpUq49UbG89aPohP+3+mwnNCrqO+QXN2i3r6vcIadD/rbrqQSPE54FvYVPOgs92h+wkp9OdVzjaUesi+8NBgPoIgNHG3XzY= Received: by 10.65.156.9 with SMTP id i9mr242893qbo; Tue, 28 Mar 2006 06:10:46 -0800 (PST) Received: by 10.65.135.6 with HTTP; Tue, 28 Mar 2006 06:10:46 -0800 (PST) Message-ID: Date: Tue, 28 Mar 2006 09:10:46 -0500 From: "Merlin Moncure" To: "Greg Quinn" Subject: Re: Slow performance on Windows .NET and OleDb Cc: pgsql-performance@postgresql.org In-Reply-To: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.152 required=5 tests=[AWL=0.152] X-Spam-Score: 0.152 X-Spam-Level: X-Archive-Number: 200603/540 X-Sequence-Number: 17977 On 3/28/06, Greg Quinn wrote: > I am using the OleDb connection driver. In my .NET application, I populat= e > 3000 records into the table to test PostGreSql's speed. It takes about 3-= 4 > seconds. have you tried: 1. npgsql .net data provider 2. odbc ado.net bridge merlin From pgsql-performance-owner@postgresql.org Tue Mar 28 11:22:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ED5EE9DC9B6 for ; Tue, 28 Mar 2006 11:22: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 82444-06 for ; Tue, 28 Mar 2006 11:22:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by postgresql.org (Postfix) with ESMTP id 7B5739DC9FD for ; Tue, 28 Mar 2006 11:22:25 -0400 (AST) Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id k2SFMPcC005416; Tue, 28 Mar 2006 10:22:25 -0500 (EST) Received: from UNKNOWN( ), claiming to be "sty.llan" via SMTP by llmail, id smtpdAAAPraOKi; Tue Mar 28 10:22:00 2006 Date: Tue, 28 Mar 2006 10:22:00 -0500 From: george young To: Simon Riggs Cc: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-Id: <20060328102200.39077862.gry@ll.mit.edu> In-Reply-To: <1143534654.3839.251.camel@localhost.localdomain> References: <20060327134733.72422d23.gry@ll.mit.edu> <1143534654.3839.251.camel@localhost.localdomain> Reply-To: gry@ll.mit.edu Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.8.0; 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.107 required=5 tests=[AWL=0.106, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/541 X-Sequence-Number: 17978 On Tue, 28 Mar 2006 09:30:54 +0100 Simon Riggs threw this fish to the penguins: > On Mon, 2006-03-27 at 13:47 -0500, george young wrote: > > > Table sizes: parameters has 2.1512e+07 tuples, run_opsets has 211745 tuples. > > > > explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; > > QUERY PLAN > > -------------------------------------------------------------------------------------------------------------------------------------------- > > Nested Loop (cost=2.16..7957.40 rows=6707 width=22) (actual time=14.986..70197.129 rows=43050 loops=1) > > -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..128.75 rows=71 width=18) (actual time=0.386..62.959 rows=263 loops=1) > > Index Cond: (run = 'team9'::text) > > -> Bitmap Heap Scan on parameters p (cost=2.16..109.93 rows=27 width=22) (actual time=1.591..266.211 rows=164 loops=263) > > Recheck Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) > > -> Bitmap Index Scan on parameters_idx (cost=0.00..2.16 rows=27 width=0) (actual time=1.153..1.153 rows=164 loops=263) > > Index Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) > > Total runtime: 70237.727 ms > > (8 rows) > > The planner appears to be underestimating the number of rows retrieved > in both cases, then multiplying them together to make it worse. > Multi-column indexes provide less accurate estimates (right now). > > Looks like a hash join might be faster. What is your work_mem set to? work_mem= 1024 > Can you SET enable_nestloop=off and rerun the EXPLAIN ANALYZE? newschm3=> set enable_nestloop=off ; SET newschm3=> explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=34177.87..34291.36 rows=6707 width=22) (actual time=68421.681..68547.686 rows=43050 loops=1) Merge Cond: ("outer".opset_num = "inner".opset_num) -> Sort (cost=130.93..131.11 rows=71 width=18) (actual time=107.744..107.901 rows=263 loops=1) Sort Key: ro.opset_num -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..128.75 rows=71 width=18) (actual time=57.641..106.096 rows=263 loops=1) Index Cond: (run = 'team9'::text) -> Sort (cost=34046.94..34070.02 rows=9231 width=22) (actual time=68301.325..68358.087 rows=43050 loops=1) Sort Key: p.opset_num -> Bitmap Heap Scan on parameters p (cost=272.31..33438.97 rows=9231 width=22) (actual time=526.462..67363.577 rows=43050 loops=1) Recheck Cond: ('team9'::text = run) -> Bitmap Index Scan on parameters_idx (cost=0.00..272.31 rows=9231 width=0) (actual time=483.500..483.500 rows=43050 loops=1) Index Cond: ('team9'::text = run) Total runtime: 68595.868 ms (13 rows) -- George Young -- "Are the gods not just?" "Oh no, child. What would become of us if they were?" (CSL) From pgsql-performance-owner@postgresql.org Tue Mar 28 11:26:36 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9BD6E9DCA7D for ; Tue, 28 Mar 2006 11:26: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 82733-10 for ; Tue, 28 Mar 2006 11:26:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 419B39DC9DD for ; Tue, 28 Mar 2006 11:26:32 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (T8b28.t.pppool.de [89.55.139.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 881BB656CF; Tue, 28 Mar 2006 17:27:16 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 941EE18148C83; Tue, 28 Mar 2006 17:26:46 +0200 (CEST) Message-ID: <442955B6.70102@logix-tt.com> Date: Tue, 28 Mar 2006 17:26:46 +0200 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: gry@ll.mit.edu Cc: Simon Riggs , pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow References: <20060327134733.72422d23.gry@ll.mit.edu> <1143534654.3839.251.camel@localhost.localdomain> <20060328102200.39077862.gry@ll.mit.edu> In-Reply-To: <20060328102200.39077862.gry@ll.mit.edu> 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.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200603/542 X-Sequence-Number: 17979 Hi, George, george young wrote: >>Looks like a hash join might be faster. What is your work_mem set to? > > work_mem= 1024 This is 1 Megabyte. By all means, increase it, if possible. HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Tue Mar 28 14:34:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EDFE99DCCE9 for ; Tue, 28 Mar 2006 14: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 28638-02 for ; Tue, 28 Mar 2006 14:33:59 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 68B8A9DCBED for ; Tue, 28 Mar 2006 14:33:54 -0400 (AST) Received: (qmail invoked by alias); 28 Mar 2006 18:33:53 -0000 Received: from 201-35-4-225.ctame704.dsl.brasiltelecom.net.br (EHLO servidor) [201.35.4.225] by mail.gmx.net (mp043) with SMTP; 28 Mar 2006 20:33:53 +0200 X-Authenticated: #15924888 Subject: Decide between Postgresql and Mysql (help of comunity) From: Marcos To: pgsql-performance@postgresql.org Content-Type: text/plain Date: Tue, 28 Mar 2006 15:31:42 +0000 Message-Id: <1143559902.1241.16.camel@servidor> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 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: 200603/555 X-Sequence-Number: 17992 Hi, I'm a Postgresql's user and I think that it's very very good and robust. In my work we're confuse between where database is the best choose: Postgresql or Mysql. The Mysql have the reputation that is very fast working in the web but in our application we are estimating many access simultaneous, then I think that the Postgresql is the best choice. Am I right? Our server have 1 GB of RAM, how many users can it support at the same time with this memory? Thanks in advanced Marcos From pgsql-performance-owner@postgresql.org Tue Mar 28 11:57:19 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6065F9DCB88 for ; Tue, 28 Mar 2006 11:57: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 92026-05 for ; Tue, 28 Mar 2006 11:57:23 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 543919DCBAF for ; Tue, 28 Mar 2006 11:57:16 -0400 (AST) Received: from linspr1.tempdomainname.com (linspr1.tempdomainname.com [161.58.246.140]) by svr4.postgresql.org (Postfix) with ESMTP id 4E2355AF85E for ; Tue, 28 Mar 2006 15:57:22 +0000 (GMT) Received: from [192.168.2.5] (ip-216-73-188-2.hqglobal.net [216.73.188.2]) by linspr1.tempdomainname.com (8.12.11.20060308/8.12.11) with ESMTP id k2SFvJWO029749 for ; Tue, 28 Mar 2006 08:57:19 -0700 (MST) From: ashah Organization: opus To: pgsql-performance@postgresql.org Subject: Re: Massive Inserts Strategies Date: Tue, 28 Mar 2006 10:59:49 -0500 User-Agent: KMail/1.8.2 References: <200603221032.10207.ashah@opuspro.com> <20060322160924.GJ15742@pervasive.com> In-Reply-To: <20060322160924.GJ15742@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603281059.49790.ashah@opuspro.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: 200603/543 X-Sequence-Number: 17980 I tried this solution, but ran into following problem. The temp_table has columns (col1, col2, col3). The original_table has columns (col0, col1, col2, col3) Now the extra col0 on the original_table is the unique generated ID by the database. How can I make your suggestions work in that case .. ? On Wednesday 22 March 2006 11:09 am, Jim C. Nasby wrote: > Load the files into a temp table and go from there... > > COPY ... FROM file; > UPDATE existing_table SET ... WHERE ...; > INSERT INTO existing_table SELECT * FROM temp_table WHERE NOT EXISTS( > SELECT * FROM existing_table WHERE ...) > > On Wed, Mar 22, 2006 at 10:32:10AM -0500, ashah wrote: > > I have a database with foreign keys enabled on the schema. I receive > > different files, some of them are huge. And I need to load these files in > > the database every night. There are several scenerios that I want to > > design an optimal solution for - > > > > 1. One of the file has around 80K records and I have to delete everything > > from the table and load this file. The provider never provides a "delta > > file" so I dont have a way to identify which records are already present > > and which are new. If I dont delete everything and insert fresh, I have > > to make around 80K selects to decide if the records exist or not. Now > > there are lot of tables that have foreign keys linked with this table so > > unless I disable the foreign keys, I cannot really delete anything from > > this table. What would be a good practise here? > > > > 2. Another file that I receive has around 150K records that I need to > > load in the database. Now one of the fields is logically a "foreign key" > > to another table, and it is linked to the parent table via a database > > generated unique ID instead of the actual value. But the file comes with > > the actual value. So once again, I have to either drop the foreign key, > > or make 150K selects to determine the serial ID so that the foreign key > > is satisfied. What would be a good strategy in this scenerio ? > > > > Please pardon my inexperience with database ! > > > > Thanks, > > Amit > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Have you searched our list archives? > > > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Mar 28 12:18:37 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A8BD69DCB78 for ; Tue, 28 Mar 2006 12: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 98184-02 for ; Tue, 28 Mar 2006 12:18:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id E0E759DC83C for ; Tue, 28 Mar 2006 12:18:32 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 86691937; Tue, 28 Mar 2006 08:18:29 -0800 From: "Dave Dutcher" To: , Subject: Re: simple join uses indexes, very slow Date: Tue, 28 Mar 2006 10:18:25 -0600 Message-ID: <00c901c65283$401f14d0$8300a8c0@tridecap.com> 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.2627 In-Reply-To: <20060327134733.72422d23.gry@ll.mit.edu> 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/544 X-Sequence-Number: 17981 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- > owner@postgresql.org] On Behalf Of george young > Sent: Monday, March 27, 2006 12:48 PM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] simple join uses indexes, very slow > [Snip] > > Indexes: > "parameters_idx" btree (run, opset_num, step_num, opset, opset_ver, > step, step_ver, name, split, wafers) > "parameters_opset_idx" btree (opset, step, name) > "parameters_step_idx" btree (step, name) > Have you tried creating some different indexes on parameters? I don't know if it should matter or not, but I would try some indexes like: (run, opset_num) //Without all the other columns (opset_num, run) //Backwards (opset_num) I don't really know Postgres internals all that well. It just seems to me that parameters_idx has a lot of columns this query is not interested in. I'd just be curious to see what happens. From pgsql-performance-owner@postgresql.org Tue Mar 28 12:18:41 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3712C9DCBB2 for ; Tue, 28 Mar 2006 12:18: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 96875-07 for ; Tue, 28 Mar 2006 12:18:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 7B1DB9DCBA4 for ; Tue, 28 Mar 2006 12:18:37 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (T8b28.t.pppool.de [89.55.139.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id C2C65656CF; Tue, 28 Mar 2006 18:19:14 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id D9753185433DA; Tue, 28 Mar 2006 18:18:44 +0200 (CEST) Message-ID: <442961E4.3010001@logix-tt.com> Date: Tue, 28 Mar 2006 18:18:44 +0200 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: ashah Cc: pgsql-performance@postgresql.org Subject: Re: Massive Inserts Strategies References: <200603221032.10207.ashah@opuspro.com> <20060322160924.GJ15742@pervasive.com> <200603281059.49790.ashah@opuspro.com> In-Reply-To: <200603281059.49790.ashah@opuspro.com> 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.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/545 X-Sequence-Number: 17982 Hi, ashah, ashah wrote: > I tried this solution, but ran into following problem. > > The temp_table has columns (col1, col2, col3). > > The original_table has columns (col0, col1, col2, col3) > Now the extra col0 on the original_table is the unique generated ID by > the database. INSERT INTO original_table (col1, col2, col3) SELECT col1, col2, col3 FROM temp_table WHERE ... HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Tue Mar 28 12:29:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 73F4E9DCBB2 for ; Tue, 28 Mar 2006 12:29: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 00701-03 for ; Tue, 28 Mar 2006 12:29:14 -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 2E91C9DCBA4 for ; Tue, 28 Mar 2006 12:29:12 -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 1FOH4A-0007UE-OI for pgsql-performance@postgresql.org; Tue, 28 Mar 2006 18:29:11 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FOH48-0006v3-00 for ; Tue, 28 Mar 2006 18:29:08 +0200 Date: Tue, 28 Mar 2006 18:29:08 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-ID: <20060328162908.GB26539@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20060327134733.72422d23.gry@ll.mit.edu> <00c901c65283$401f14d0$8300a8c0@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <00c901c65283$401f14d0$8300a8c0@tridecap.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+cvs20060126 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: 200603/546 X-Sequence-Number: 17983 On Tue, Mar 28, 2006 at 10:18:25AM -0600, Dave Dutcher wrote: >> "parameters_idx" btree (run, opset_num, step_num, opset, > opset_ver, >> step, step_ver, name, split, wafers) >> "parameters_opset_idx" btree (opset, step, name) >> "parameters_step_idx" btree (step, name) > Have you tried creating some different indexes on parameters? I don't > know if it should matter or not, but I would try some indexes like: > > (run, opset_num) //Without all the other columns > (opset_num, run) //Backwards > (opset_num) An index on (A,B,C) can be used for a query on (A,B) or (A), so it doesn't really matter. It isn't usable for a query on (B), (C) or (B,C), though. (The index rows will get bigger, of course, so you'll need more I/O if you want to scan large parts of it, but I guess that's beside the point.) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Mar 28 16:28:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 938CB11F6825 for ; Tue, 28 Mar 2006 16:28: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 05466-07-2 for ; Tue, 28 Mar 2006 16:28:12 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id EBBCA11F68D2 for ; Tue, 28 Mar 2006 16:28:10 -0400 (AST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by svr4.postgresql.org (Postfix) with SMTP id 4226E5AFC51 for ; Tue, 28 Mar 2006 19:58:43 +0000 (GMT) Received: (qmail invoked by alias); 28 Mar 2006 19:57:39 -0000 Received: from 201-35-4-225.ctame704.dsl.brasiltelecom.net.br (EHLO servidor) [201.35.4.225] by mail.gmx.net (mp041) with SMTP; 28 Mar 2006 21:57:39 +0200 X-Authenticated: #15924888 Subject: Re: Decide between Postgresql and Mysql (help of From: Marcos To: Scott Marlowe Cc: pgsql-performance@postgresql.org In-Reply-To: <1143572392.3625.79.camel@state.g2switchworks.com> References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> Content-Type: text/plain Date: Tue, 28 Mar 2006 16:55:28 +0000 Message-Id: <1143564928.1241.28.camel@servidor> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 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: 200603/559 X-Sequence-Number: 17996 > So, what exactly are you planning on doing? The application will be a chat for web, the chats will be stored in the server. In a determined interval of time... more or less 2 seconds, the application will be looking for new messages. I believe that it will make many accesses. The write in disc will be constant. Thanks :o) Marcos From pgsql-performance-owner@postgresql.org Tue Mar 28 13:20:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 92D6C9DCBB2 for ; Tue, 28 Mar 2006 13: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 12567-10 for ; Tue, 28 Mar 2006 13:20:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id DADE49DCA33 for ; Tue, 28 Mar 2006 13:20:20 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 86698039; Tue, 28 Mar 2006 09:20:19 -0800 From: "Dave Dutcher" To: "'Steinar H. Gunderson'" , Subject: Re: simple join uses indexes, very slow Date: Tue, 28 Mar 2006 11:20:19 -0600 Message-ID: <00da01c6528b$e3b6fd30$8300a8c0@tridecap.com> 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.2627 In-Reply-To: <20060328162908.GB26539@uio.no> 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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/547 X-Sequence-Number: 17984 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- > owner@postgresql.org] On Behalf Of Steinar H. Gunderson > Sent: Tuesday, March 28, 2006 10:29 AM > > An index on (A,B,C) can be used for a query on (A,B) or (A), so it doesn't > really matter. It isn't usable for a query on (B), (C) or (B,C), though. > (The > index rows will get bigger, of course, so you'll need more I/O if you want > to > scan large parts of it, but I guess that's beside the point.) I guess what I am really curious about is why was the OP getting an expensive sort when the planner tried a merge join? Most of the time was spent sorting the parameters parameters table by opset_num even though opset_num is indexed. Isn't Postgres able to walk the index instead of sorting? I was wondering if maybe Postgres wasn't recognizing that it could just walk the index because the opset_num column isn't the first in the index. From pgsql-performance-owner@postgresql.org Tue Mar 28 13:26:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 062389DD600 for ; Tue, 28 Mar 2006 13:26: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 13273-07 for ; Tue, 28 Mar 2006 13:26:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id E9FFE9DCD96 for ; Tue, 28 Mar 2006 13:26:40 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id A356D56408; Tue, 28 Mar 2006 11:26:39 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 11:26:35 -0600 Date: Tue, 28 Mar 2006 11:26:35 -0600 From: "Jim C. Nasby" To: Brendan Duddridge Cc: Luke Lonergan , G?briel ?kos , pgsql-performance@postgresql.org Subject: Re: count(*) performance Message-ID: <20060328172634.GM75181@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:brendan@clickspace.com::3se+tsfCiIkF3X7i:000000000000000 000000000000000000000000GXuT X-Hashcash: 1:20:060328:llonergan@greenplum.com::Nv5N1zm1otV5GHwX:00000000000000 000000000000000000000000IEPO X-Hashcash: 1:20:060328:akos.gabriel@i-logic.hu::z2LrB1lpeGhpSeiB:00000000000000 000000000000000000000000806D X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::swPkJfdMa0eEdkuv:00000 000000000000000000000000Ceiu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/548 X-Sequence-Number: 17985 On Mon, Mar 27, 2006 at 12:20:54PM -0700, Brendan Duddridge wrote: > Does that mean that even though autovacuum is turned on, you still > should do a regular vacuum analyze periodically? Doing a periodic vacuumdb -avz and keeping an eye on the last few lines isn't a bad idea. It would also be helpful if there was a log parser that could take a look at the output of a vacuumdb -av and look for any problem areas, such as relations that have a lot of free space in them. -- 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 Mar 28 13:30:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6B59D9DC9B0 for ; Tue, 28 Mar 2006 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 15054-03 for ; Tue, 28 Mar 2006 13:30:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 179FF9DCA33 for ; Tue, 28 Mar 2006 13:30:49 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 778A956431; Tue, 28 Mar 2006 11:30:48 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 11:30:48 -0600 Date: Tue, 28 Mar 2006 11:30:47 -0600 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-ID: <20060328173047.GN75181@pervasive.com> References: <20060327134733.72422d23.gry@ll.mit.edu> <00c901c65283$401f14d0$8300a8c0@tridecap.com> <20060328162908.GB26539@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060328162908.GB26539@uio.no> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::7MjWAjws4I/W0lqa:00000 0000000000000000000000006TrV X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/549 X-Sequence-Number: 17986 On Tue, Mar 28, 2006 at 06:29:08PM +0200, Steinar H. Gunderson wrote: > On Tue, Mar 28, 2006 at 10:18:25AM -0600, Dave Dutcher wrote: > >> "parameters_idx" btree (run, opset_num, step_num, opset, > > opset_ver, > >> step, step_ver, name, split, wafers) > >> "parameters_opset_idx" btree (opset, step, name) > >> "parameters_step_idx" btree (step, name) > > Have you tried creating some different indexes on parameters? I don't > > know if it should matter or not, but I would try some indexes like: > > > > (run, opset_num) //Without all the other columns > > (opset_num, run) //Backwards > > (opset_num) > > An index on (A,B,C) can be used for a query on (A,B) or (A), so it doesn't > really matter. It isn't usable for a query on (B), (C) or (B,C), though. (The > index rows will get bigger, of course, so you'll need more I/O if you want to > scan large parts of it, but I guess that's beside the point.) Note that given how statistics currenly work, there are many situations where the planner will refuse to use a multi-column index. This probably won't change until there's some concept of multi-column statistics, at least for multi-column indexes. -- 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 Mar 28 13:32:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 58F379DC852 for ; Tue, 28 Mar 2006 13:32: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 15425-02 for ; Tue, 28 Mar 2006 13:32:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 442B29DCB78 for ; Tue, 28 Mar 2006 13:32:16 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 61B7456423; Tue, 28 Mar 2006 11:32:14 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 11:32:13 -0600 Date: Tue, 28 Mar 2006 11:32:13 -0600 From: "Jim C. Nasby" To: Greg Quinn Cc: pgsql-performance@postgresql.org Subject: Re: Slow performance on Windows .NET and OleDb Message-ID: <20060328173213.GO75181@pervasive.com> References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:greg@officium.co.za::JetbPpUYl9aqeGyn:000000000000000000 0000000000000000000000001Dtb X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::JJputQpNMaad3xXl:00000 00000000000000000000000049Me X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/550 X-Sequence-Number: 17987 On Tue, Mar 28, 2006 at 02:14:00PM +0200, Greg Quinn wrote: > Hello, > > I have just installed PostGreSql 8.1 on my Windows XP PC. I created a > simple table called users with 4 varchar fields. > > I am using the OleDb connection driver. In my .NET application, I populate > 3000 records into the table to test PostGreSql's speed. It takes about 3-4 > seconds. > > Even worse is displaying the 3000 records in a ListView control. It takes > about 7 seconds. In MySQL, the exact same table and application displays > the same 3000 records in under 1/2 second!!! Have you vacuumed recently? This smells like it might be a table bloat problem. -- 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 Mar 28 13:34:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 635D49DCDE5 for ; Tue, 28 Mar 2006 13:34: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 15054-06-4 for ; Tue, 28 Mar 2006 13:34:49 -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 D04D19DD594 for ; Tue, 28 Mar 2006 13:34:47 -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 1FOI5d-0003x5-Bg for pgsql-performance@postgresql.org; Tue, 28 Mar 2006 19:34:45 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FOI5b-0008Ik-00 for ; Tue, 28 Mar 2006 19:34:43 +0200 Date: Tue, 28 Mar 2006 19:34:43 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-ID: <20060328173442.GA31836@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20060328162908.GB26539@uio.no> <00da01c6528b$e3b6fd30$8300a8c0@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <00da01c6528b$e3b6fd30$8300a8c0@tridecap.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+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.091 required=5 tests=[AWL=0.091] X-Spam-Score: 0.091 X-Spam-Level: X-Archive-Number: 200603/551 X-Sequence-Number: 17988 On Tue, Mar 28, 2006 at 11:20:19AM -0600, Dave Dutcher wrote: > I guess what I am really curious about is why was the OP getting an > expensive sort when the planner tried a merge join? A merge join requires sorted inputs. > Most of the time was spent sorting the parameters parameters table by > opset_num even though opset_num is indexed. Isn't Postgres able to walk the > index instead of sorting? The time of an index scan vs. a sequential scan + sort depends on several factors, so it's not just a matter of walking the index whenever there is one. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Mar 28 13:38:34 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1D9559DC9EF for ; Tue, 28 Mar 2006 13:38: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 16647-04 for ; Tue, 28 Mar 2006 13:38:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 428549DC93C for ; Tue, 28 Mar 2006 13:38:28 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id E0C1E56427; Tue, 28 Mar 2006 11:38:27 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 11:38:27 -0600 Date: Tue, 28 Mar 2006 11:38:27 -0600 From: "Jim C. Nasby" To: ashah Cc: pgsql-performance@postgresql.org Subject: Re: Massive Inserts Strategies Message-ID: <20060328173826.GP75181@pervasive.com> References: <200603221032.10207.ashah@opuspro.com> <20060322160924.GJ15742@pervasive.com> <200603281059.49790.ashah@opuspro.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200603281059.49790.ashah@opuspro.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:ashah@opuspro.com::Ix0M26ZrmZGWqsrz:00000000000000000000 0000000000000000000000007wuL X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::DyD6jNk9ojZyhbRd:00000 0000000000000000000000001+vI X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/552 X-Sequence-Number: 17989 Is there some other unique key you can test on? Take a look at http://lnk.nu/cvs.distributed.net/8qt.sql lines 169-216 for an exammple. In this case we use a different method for assigning IDs than you probably will, but the idea remains. On Tue, Mar 28, 2006 at 10:59:49AM -0500, ashah wrote: > I tried this solution, but ran into following problem. > > The temp_table has columns (col1, col2, col3). > > The original_table has columns (col0, col1, col2, col3) > > Now the extra col0 on the original_table is the unique generated ID by the > database. > > How can I make your suggestions work in that case .. ? > > On Wednesday 22 March 2006 11:09 am, Jim C. Nasby wrote: > > Load the files into a temp table and go from there... > > > > COPY ... FROM file; > > UPDATE existing_table SET ... WHERE ...; > > INSERT INTO existing_table SELECT * FROM temp_table WHERE NOT EXISTS( > > SELECT * FROM existing_table WHERE ...) > > > > On Wed, Mar 22, 2006 at 10:32:10AM -0500, ashah wrote: > > > I have a database with foreign keys enabled on the schema. I receive > > > different files, some of them are huge. And I need to load these files in > > > the database every night. There are several scenerios that I want to > > > design an optimal solution for - > > > > > > 1. One of the file has around 80K records and I have to delete everything > > > from the table and load this file. The provider never provides a "delta > > > file" so I dont have a way to identify which records are already present > > > and which are new. If I dont delete everything and insert fresh, I have > > > to make around 80K selects to decide if the records exist or not. Now > > > there are lot of tables that have foreign keys linked with this table so > > > unless I disable the foreign keys, I cannot really delete anything from > > > this table. What would be a good practise here? > > > > > > 2. Another file that I receive has around 150K records that I need to > > > load in the database. Now one of the fields is logically a "foreign key" > > > to another table, and it is linked to the parent table via a database > > > generated unique ID instead of the actual value. But the file comes with > > > the actual value. So once again, I have to either drop the foreign key, > > > or make 150K selects to determine the serial ID so that the foreign key > > > is satisfied. What would be a good strategy in this scenerio ? > > > > > > Please pardon my inexperience with database ! > > > > > > Thanks, > > > Amit > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 4: Have you searched our list archives? > > > > > > http://archives.postgresql.org > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > -- 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 Mar 28 13:52:59 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 59FFE9DC8A7 for ; Tue, 28 Mar 2006 13:52: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 17908-06 for ; Tue, 28 Mar 2006 13:52:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from projects.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by postgresql.org (Postfix) with ESMTP id 95A4C9DC848 for ; Tue, 28 Mar 2006 13:52:53 -0400 (AST) Received: from [192.168.1.5] (or-67-76-146-141.sta.sprint-hsd.net [67.76.146.141]) (authenticated bits=0) by projects.commandprompt.com (8.13.4/8.13.4) with ESMTP id k2SHqPDr010908; Tue, 28 Mar 2006 09:52:26 -0800 Message-ID: <442977D7.5060508@commandprompt.com> Date: Tue, 28 Mar 2006 09:52:23 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mail/News 1.5 (X11/20060309) MIME-Version: 1.0 To: "Jim C. Nasby" CC: Greg Quinn , pgsql-performance@postgresql.org Subject: Re: Slow performance on Windows .NET and OleDb References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> In-Reply-To: <20060328173213.GO75181@pervasive.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (projects.commandprompt.com [192.168.2.159]); Tue, 28 Mar 2006 09:52:26 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.091 required=5 tests=[AWL=0.091] X-Spam-Score: 0.091 X-Spam-Level: X-Archive-Number: 200603/553 X-Sequence-Number: 17990 Jim C. Nasby wrote: > On Tue, Mar 28, 2006 at 02:14:00PM +0200, Greg Quinn wrote: >> Hello, >> >> I have just installed PostGreSql 8.1 on my Windows XP PC. I created a >> simple table called users with 4 varchar fields. >> >> I am using the OleDb connection driver. In my .NET application, I populate >> 3000 records into the table to test PostGreSql's speed. It takes about 3-4 >> seconds. >> >> Even worse is displaying the 3000 records in a ListView control. It takes >> about 7 seconds. In MySQL, the exact same table and application displays >> the same 3000 records in under 1/2 second!!! > > Have you vacuumed recently? This smells like it might be a table bloat > problem. This could be a lot of things... He is probably running the default postgresql.conf which is going to perform horribly. What is your work_mem? shared_buffers? Are you passing a where clause? If so is there an index on the field that is subject to the clause? When you do the population, is it via inserts or copy? Joshua D. Drake -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Tue Mar 28 14:18:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 630019DCA9B for ; Tue, 28 Mar 2006 14: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 25273-01 for ; Tue, 28 Mar 2006 14:18:00 -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 9B22D9DC9EF for ; Tue, 28 Mar 2006 14:17:58 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 944FB3373DA; Tue, 28 Mar 2006 19:17:54 +0100 (BST) Subject: Re: simple join uses indexes, very slow From: Simon Riggs To: gry@ll.mit.edu Cc: pgsql-performance@postgresql.org In-Reply-To: <20060328102200.39077862.gry@ll.mit.edu> References: <20060327134733.72422d23.gry@ll.mit.edu> <1143534654.3839.251.camel@localhost.localdomain> <20060328102200.39077862.gry@ll.mit.edu> Content-Type: text/plain Date: Tue, 28 Mar 2006 19:17:49 +0100 Message-Id: <1143569869.32384.37.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.097 required=5 tests=[AWL=0.097] X-Spam-Score: 0.097 X-Spam-Level: X-Archive-Number: 200603/554 X-Sequence-Number: 17991 On Tue, 2006-03-28 at 10:22 -0500, george young wrote: > work_mem= 1024 Set that higher. Try a couple of other plans using enable_* and let us have the EXPLAIN ANALYZE plans. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Mar 28 14:57:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 53C489DC9BC for ; Tue, 28 Mar 2006 14:57: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 32840-02 for ; Tue, 28 Mar 2006 14:57:49 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id CB9699DC848 for ; Tue, 28 Mar 2006 14:57:47 -0400 (AST) Received: from white.netsurf.net (white.NetSurf.Net [66.135.102.134]) by svr4.postgresql.org (Postfix) with ESMTP id 497EE5AF03D for ; Tue, 28 Mar 2006 18:57:48 +0000 (GMT) Received: from [10.42.124.48] (internt.43.ADSL.NetSurf.Net [66.135.96.43]) by white.netsurf.net (8.12.3/8.12.3/Debian-7.1) with ESMTP id k2SIveuW018188; Tue, 28 Mar 2006 13:57:40 -0500 Message-ID: <44298721.5050400@alteeve.com> Date: Tue, 28 Mar 2006 13:57:37 -0500 From: Madison Kelly User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Marcos Cc: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of comunity) References: <1143559902.1241.16.camel@servidor> In-Reply-To: <1143559902.1241.16.camel@servidor> 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: 200603/556 X-Sequence-Number: 17993 Marcos wrote: > Hi, > > I'm a Postgresql's user and I think that it's very very good and > robust. > > In my work we're confuse between where database is the best choose: > Postgresql or Mysql. The Mysql have the reputation that is very fast > working in the web but in our application we are estimating many access > simultaneous, then I think that the Postgresql is the best choice. > > Am I right? > > Our server have 1 GB of RAM, how many users can it support at the same > time with this memory? > > Thanks in advanced > > Marcos The RAM/users question depends largely on what the database is used for and what each user is doing in the database. From what I understand, PostgreSQL is designed with stability and reliability as key tenants. MySQL favors performance and ease of use. An example is that, last I checked, MySQL doesn't have an equivalent to PostgreSQL's 'fsync' which helps insure that data is actually written to the disk. This costs performance but increases reliability and crash recovery. HTH Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Tue Mar 28 15:00:03 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F3E659DC9B0 for ; Tue, 28 Mar 2006 15:00: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 33521-01 for ; Tue, 28 Mar 2006 14:59:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 44F599DC852 for ; Tue, 28 Mar 2006 14:59:53 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 28 Mar 2006 18:59:52 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 28 Mar 2006 12:59:53 -0600 Subject: Re: Decide between Postgresql and Mysql (help of From: Scott Marlowe To: Marcos Cc: pgsql-performance@postgresql.org In-Reply-To: <1143559902.1241.16.camel@servidor> References: <1143559902.1241.16.camel@servidor> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1143572392.3625.79.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 28 Mar 2006 12:59:52 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.142 required=5 tests=[AWL=0.141, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.142 X-Spam-Level: X-Archive-Number: 200603/557 X-Sequence-Number: 17994 On Tue, 2006-03-28 at 09:31, Marcos wrote: > Hi, > > I'm a Postgresql's user and I think that it's very very good and > robust. > > In my work we're confuse between where database is the best choose: > Postgresql or Mysql. The Mysql have the reputation that is very fast > working in the web but in our application we are estimating many access > simultaneous, then I think that the Postgresql is the best choice. > > Am I right? > > Our server have 1 GB of RAM, how many users can it support at the same > time with this memory? This is as much about the code in front of the database as the database itself. You'll want to use an architecture that supports pooled connections (java, php under lighttpd, etc...) and you'll want to look at your read to write ratio. MySQL and PostgreSQL can handle fairly heavy parallel loads. PostgreSQL is generally a much better performer when you need to make a lot of parallel writes. But the bigger question is which one is suited to your application in general. If some major issue in MySQL or PostgreSQL makes it a poor choice for your app, then it doesn't matter how much load it can handle, it's still a poor choice. Generally speaking, MySQL is a poor choice if you're doing things like accounting, where the maths have to be correct. It's quite easy to ask MySQL to do math and get the wrong answer. It also has some serious problems with referential integrity, but most of those can be worked around using innodb tables. But at that point, you're using the same basic storage methods as PostgreSQL uses, i.e. an MVCC storage engine. And now that Oracle has bought Innodb, the availability of that in the future to MySQL is in doubt. There's also the issue of licensing. If you'll be selling copies of your app to customers, you'll be writing a check for each install to MySQL AB. Not so with PostgreSQL. So, what exactly are you planning on doing? Lastly, take a look here: http://sql-info.de/mysql/gotchas.html and here: http://sql-info.de/postgresql/postgres-gotchas.html for a list of the common "gotchas" in both databases. Generally you'll find the PostgreSQL gotchas are of the sort that make you go "oh, that's interesting" and the MySQL gotchas are the kind that make you go "Dear god, you must be kidding me!" But that's just my opinion, I could be wrong. From pgsql-performance-owner@postgresql.org Tue Mar 28 16:44:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 18E9C11F6933 for ; Tue, 28 Mar 2006 16:44: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 10697-06 for ; Tue, 28 Mar 2006 16:44:11 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id C86AF11F691D for ; Tue, 28 Mar 2006 16:44:09 -0400 (AST) Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) by svr4.postgresql.org (Postfix) with ESMTP id 1C90D5AFE87 for ; Tue, 28 Mar 2006 19:43:43 +0000 (GMT) Received: (qmail 12646 invoked from network); 28 Mar 2006 21:42:51 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 28 Mar 2006 21:42:51 +0200 To: "Scott Marlowe" , Marcos Cc: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> Message-ID: Date: Tue, 28 Mar 2006 21:42:51 +0200 From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <1143572392.3625.79.camel@state.g2switchworks.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/561 X-Sequence-Number: 17998 > This is as much about the code in front of the database as the database > itself. You'll want to use an architecture that supports pooled > connections (java, php under lighttpd, etc...) and you'll want to look Well, anybody who uses PHP and cares about performance is already using lighttpd, no ? > MySQL and PostgreSQL can handle fairly heavy parallel loads. I'll only speak about MyISAM. MySQL == MyISAM. InnoDB is useless : if you want transactions, use postgres. If you say to yourself "oh yeah, but it would be cool to use a MyISAM table for stuff like hit counters etc"... Is it the job of a SQL database to count hits on the root page of your site ? No. To store user sessions ? No. The job of a SQL database is to efficiently handle data, not to do something that should stay in RAM in the application server process, or at worst, in a memcached record. MySQL + MyISAM has a huge advantage : it can look up data in the index without touching the tables. MySQL handles parallel SELECTs very well. However, throw in some maintenance operation which involves a long query with writes (like a big joined UPDATE) and all access to your website is blocked while the query lasts. This is worsened by the fact that MySQL sucks at complex queries. If all of your updates are done to a few rows, MyISAM is cool, but someday you'll want to do this query which locks a table during one minute... and then you got a problem. Just be very clear about what you want to do, what types of queries you'll want to run in two years... etc. From pgsql-performance-owner@postgresql.org Tue Mar 28 16:44:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2208A11F6949 for ; Tue, 28 Mar 2006 16:44: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 09605-07-2 for ; Tue, 28 Mar 2006 16:44:12 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id CBD6111F691E for ; Tue, 28 Mar 2006 16:44:09 -0400 (AST) Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr4.postgresql.org (Postfix) with ESMTP id 160695AFFB9 for ; Tue, 28 Mar 2006 19:51:07 +0000 (GMT) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 28 Mar 2006 19:50:45 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 28 Mar 2006 13:50:45 -0600 Subject: Re: Decide between Postgresql and Mysql (help of From: Scott Marlowe To: PFC Cc: Marcos , pgsql-performance@postgresql.org In-Reply-To: References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1143575445.3625.87.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 28 Mar 2006 13:50:45 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.142 required=5 tests=[AWL=0.141, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.142 X-Spam-Level: X-Archive-Number: 200603/560 X-Sequence-Number: 17997 On Tue, 2006-03-28 at 13:42, PFC wrote: > > This is as much about the code in front of the database as the database > > itself. You'll want to use an architecture that supports pooled > > connections (java, php under lighttpd, etc...) and you'll want to look > > Well, anybody who uses PHP and cares about performance is already using > lighttpd, no ? > > > MySQL and PostgreSQL can handle fairly heavy parallel loads. > > I'll only speak about MyISAM. MySQL == MyISAM. InnoDB is useless : if you > want transactions, use postgres. I agree with most of what you posted, but I'm not quite sure what you meant here. Innodb in and of itself is a fairly decent MVCC implementation, with, as usual, some limitations (it's rollback performance is HORRIFICLY bad). What really makes innodb useless to me is that there's no real support for proper operation by MySQL itself. If you could force MySQL to only use innodb tables, and to NEVER do the wrong things syntactically, it would be ok. But there are thousands of foot-guns in the MySQL - Innodb combination waiting to take off your toes. Too many to count really. To me, that's what makes innodb so useless, the way MySQL fails to integrate well with it. From pgsql-performance-owner@postgresql.org Tue Mar 28 16:27:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9EF8C11F676C for ; Tue, 28 Mar 2006 16:27: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 05971-05-4 for ; Tue, 28 Mar 2006 16:27:44 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from pproxy.gmail.com (pproxy.gmail.com [64.233.166.181]) by postgresql.org (Postfix) with ESMTP id 80E3611F675C for ; Tue, 28 Mar 2006 16:27:41 -0400 (AST) Received: by pproxy.gmail.com with SMTP id x31so51739pye for ; Tue, 28 Mar 2006 12:27:39 -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=DtKaYS3DJ9COZZ86wuwI4FISQBH5GpmP2nEgvHmj/JWnLOJwkj+x1Ax6iDMToHp8ciqmbsF+USujnBU/Sp2KvzCYwQzs79DprapJ2izXXMPYhQ1yC6ttmZU9gxUhOcmNGNe1ehrvebk2M3DsYvNLhMIJ9ReI5h2+wVQ0MzkO514= Received: by 10.35.36.13 with SMTP id o13mr113848pyj; Tue, 28 Mar 2006 12:27:39 -0800 (PST) Received: by 10.35.37.10 with HTTP; Tue, 28 Mar 2006 12:27:39 -0800 (PST) Message-ID: <92d3a4950603281227p50e48bc1o4af504e2d82dc6f5@mail.gmail.com> Date: Tue, 28 Mar 2006 22:27:39 +0200 From: Antoine To: pgsql-performance@postgresql.org Subject: MVCC intro and benefits docs? 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.896 required=5 tests=[AWL=-0.436, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.896 X-Spam-Level: X-Archive-Number: 200603/558 X-Sequence-Number: 17995 Hi, Does anyone know of any fairly entry-level documentation for the benefits-drawbacks of MVCC in the db? As it relates to performance? Postgres vs the others? Cheers Antoine -- This is where I should put some witty comment. From pgsql-performance-owner@postgresql.org Tue Mar 28 16:51:06 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F2D2911F68F8 for ; Tue, 28 Mar 2006 16: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 13202-05 for ; Tue, 28 Mar 2006 16:51:01 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.travelamericas.com (unknown [206.130.134.147]) by postgresql.org (Postfix) with SMTP id E8FAE11F66DA for ; Tue, 28 Mar 2006 16:50:58 -0400 (AST) Received: (qmail 26743 invoked from network); 28 Mar 2006 20:50:53 -0000 Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) by verkiel.travelamericas.com with SMTP; 28 Mar 2006 20:50:53 -0000 Message-ID: <4429A1AD.4030104@travelamericas.com> Date: Tue, 28 Mar 2006 12:50:53 -0800 From: Chris Travers User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcos CC: Scott Marlowe , pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> <1143564928.1241.28.camel@servidor> In-Reply-To: <1143564928.1241.28.camel@servidor> 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.239 required=5 tests=[AWL=0.239] X-Spam-Score: 0.239 X-Spam-Level: X-Archive-Number: 200603/562 X-Sequence-Number: 17999 Marcos wrote: >>So, what exactly are you planning on doing? >> >> > >The application will be a chat for web, the chats will be stored in the >server. In a determined interval of time... more or less 2 seconds, the >application will be looking for new messages. > >I believe that it will make many accesses. The write in disc will be >constant. > > Ok. I would favor PostgreSQL for reasons of ease of future development. However, lets look at what both RDBMS's buy you: MySQL: 1) Possibility of many components for web apps that can be used though the lack of certain features (such as complex updateable views) makes this possibly an issue. 2) Great simple read performance. PostgreSQL: 1) Possibility to integrate any other components later (including those on MySQL via DBI-Link). 2) Fabulous community support (and I am sure fabulous paid support too given the fact that many of those who contribute to the great community support also offer paid support). 3) Better parallel write performance. 4) Greater extensibility, leading to greater flexibility down the road should you want to add in new components without rewriting your front-end. For a simple chat client, you can probably put something together with some Perl/CGI scripts, Jabber, and MySQL or PostgreSQL pretty easily and without much development labor at all. Indeed I would suggest that the RDBMS is, absent other specific concerns, the least of your issues. In other words, both are probably adequate. It is impossible to provide an estimate for capacity though without knowing the app in question, expected query composition, and so forth. Best Wishes, Chris Travers Metatron Technology Consulting From pgsql-performance-owner@postgresql.org Tue Mar 28 16:57:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BB94C11F693B for ; Tue, 28 Mar 2006 16:57: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 14883-02 for ; Tue, 28 Mar 2006 16:57:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by postgresql.org (Postfix) with ESMTP id 0D5A311F68E6 for ; Tue, 28 Mar 2006 16:57:11 -0400 (AST) Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id k2SKvAYY020865 for ; Tue, 28 Mar 2006 15:57:10 -0500 (EST) Received: from UNKNOWN( ), claiming to be "sty.llan" via SMTP by llmail, id smtpdAAAFQaW1N; Tue Mar 28 15:56:57 2006 Date: Tue, 28 Mar 2006 15:56:56 -0500 From: george young To: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-Id: <20060328155656.3f66924c.gry@ll.mit.edu> In-Reply-To: <1143569869.32384.37.camel@localhost.localdomain> References: <20060327134733.72422d23.gry@ll.mit.edu> <1143534654.3839.251.camel@localhost.localdomain> <20060328102200.39077862.gry@ll.mit.edu> <1143569869.32384.37.camel@localhost.localdomain> Reply-To: gry@ll.mit.edu Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.8.0; 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.107 required=5 tests=[AWL=0.106, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.107 X-Spam-Level: X-Archive-Number: 200603/563 X-Sequence-Number: 18000 On Tue, 28 Mar 2006 19:17:49 +0100 Simon Riggs threw this fish to the penguins: > On Tue, 2006-03-28 at 10:22 -0500, george young wrote: > > > work_mem= 1024 > > Set that higher. > > Try a couple of other plans using enable_* and let us have the EXPLAIN > ANALYZE plans. I tried this, but it doesn't seem to have made much difference that I can see: newschm3=> show work_mem; work_mem ---------- 8024 newschm3=> explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=2.16..7957.40 rows=6707 width=22) (actual time=292.739..107672.525 rows=43050 loops=1) -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..128.75 rows=71 width=18) (actual time=115.134..197.818 rows=263 loops=1) Index Cond: (run = 'team9'::text) -> Bitmap Heap Scan on parameters p (cost=2.16..109.93 rows=27 width=22) (actual time=2.559..408.125 rows=164 loops=263) Recheck Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) -> Bitmap Index Scan on parameters_idx (cost=0.00..2.16 rows=27 width=0) (actual time=2.099..2.099 rows=164 loops=263) Index Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) Total runtime: 107860.493 ms (8 rows) newschm3=> shoe enable_nestloop; ERROR: syntax error at or near "shoe" at character 1 LINE 1: shoe enable_nestloop; ^ newschm3=> show enable_nestloop; enable_nestloop ----------------- on (1 row) newschm3=> set enable_nestloop=off; SET newschm3=> explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=34177.87..34291.36 rows=6707 width=22) (actual time=64654.744..64760.875 rows=43050 loops=1) Merge Cond: ("outer".opset_num = "inner".opset_num) -> Sort (cost=130.93..131.11 rows=71 width=18) (actual time=62.177..62.333 rows=263 loops=1) Sort Key: ro.opset_num -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..128.75 rows=71 width=18) (actual time=40.415..55.745 rows=263 loops=1) Index Cond: (run = 'team9'::text) -> Sort (cost=34046.94..34070.02 rows=9231 width=22) (actual time=64592.526..64615.228 rows=43050 loops=1) Sort Key: p.opset_num -> Bitmap Heap Scan on parameters p (cost=272.31..33438.97 rows=9231 width=22) (actual time=333.975..64126.200 rows=43050 loops=1) Recheck Cond: ('team9'::text = run) -> Bitmap Index Scan on parameters_idx (cost=0.00..272.31 rows=9231 width=0) (actual time=309.199..309.199 rows=43050 loops=1) Index Cond: ('team9'::text = run) Total runtime: 64919.714 ms (13 rows) -- "Are the gods not just?" "Oh no, child. What would become of us if they were?" (CSL) From pgsql-performance-owner@postgresql.org Tue Mar 28 17:18:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7AC8C11F68FD for ; Tue, 28 Mar 2006 17:18: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 19545-01-2 for ; Tue, 28 Mar 2006 17:18:36 -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 54B1211F6796 for ; Tue, 28 Mar 2006 17:18:33 -0400 (AST) Received: (qmail 13458 invoked from network); 28 Mar 2006 23:18:40 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 28 Mar 2006 23:18:40 +0200 Date: Tue, 28 Mar 2006 23:18:39 +0200 To: Marcos Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> <1143564928.1241.28.camel@servidor> Cc: pgsql-performance@postgresql.org From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <1143564928.1241.28.camel@servidor> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/564 X-Sequence-Number: 18001 >> So, what exactly are you planning on doing? > > The application will be a chat for web, the chats will be stored in the > server. In a determined interval of time... more or less 2 seconds, the > application will be looking for new messages. > > I believe that it will make many accesses. The write in disc will be > constant. Ah, cool. That's exactly what a database is not designed for xD Try this, I coded this in about 1 hour as a joke last week. http://peufeu.com/demos/xhchat/ It works in firefox and opera, uses xmlhttprequest, and the messages are stored in a dbm database. We have also coded a real HTTP chat. I'll briefly expose the details on-list, but if you want the gory stuff, ask privately. There is a Postgres database for users, authentication, chatrooms and stuff. This database can be modified by a full-blown web application. Of course, messages are not stored in the database. It would be suicidal performance-wise to do so. An asynchronous HTTP server, using select() (lighttpd style) is coded in Python. It is very special-purpose server. It keeps an open connection with the client (browser) and sends messages as they arrive in the chatroom, with no delay. The connection is interrupted only when the client submits a new message via a form, but this is not mandatory. My memories are a bit old, but we benchmarked it at about 4000 messages/second on a low-end server (athlon something). Concurrent connections are unlimited. Disk I/O is zero. I like it. If you store messages in the database, you can hope to be about 10-50 times slower. From pgsql-performance-owner@postgresql.org Tue Mar 28 17:24:31 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9027911F696C for ; Tue, 28 Mar 2006 17:24: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 17322-08 for ; Tue, 28 Mar 2006 17:24:25 -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 BBE6011F6796 for ; Tue, 28 Mar 2006 17:24:21 -0400 (AST) Received: (qmail 13508 invoked from network); 28 Mar 2006 23:24:30 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 28 Mar 2006 23:24:30 +0200 To: "Scott Marlowe" Cc: Marcos , pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> <1143575445.3625.87.camel@state.g2switchworks.com> Message-ID: Date: Tue, 28 Mar 2006 23:24:28 +0200 From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <1143575445.3625.87.camel@state.g2switchworks.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/565 X-Sequence-Number: 18002 > What really makes innodb useless to me is that there's no real support > for proper operation by MySQL itself. If you could force MySQL to only > use innodb tables, and to NEVER do the wrong things syntactically, it > would be ok. But there are thousands of foot-guns in the MySQL That's what I meant actually. And by saying "if you want transactions" I also meant "if you want a database system that will go to great lengths to save your ass and your data instead of helping you shooting yourself in the foot, generally work very well, be reliable, friendly and a pleasure to work with, which means more or less, if you're rational rather than masochistic, then yeah, you should use postgres". > If you could force MySQL to only > use innodb tables, and to NEVER do the wrong things syntactically, it > would be ok. You'd still need to teach it how to hash-join and everything, though. Life sucks when the only join type you have is merge join. From pgsql-performance-owner@postgresql.org Tue Mar 28 17:53:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AA3F011F62B9 for ; Tue, 28 Mar 2006 17:53: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 22692-06 for ; Tue, 28 Mar 2006 17:53:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 9063311F600C for ; Tue, 28 Mar 2006 17:53:01 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id DC9A456427; Tue, 28 Mar 2006 15:53:00 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 15:52:59 -0600 Date: Tue, 28 Mar 2006 15:52:59 -0600 From: "Jim C. Nasby" To: PFC Cc: Scott Marlowe , Marcos , pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of Message-ID: <20060328215259.GZ75181@pervasive.com> References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:lists@peufeu.com::A7Tmukqw5cf+PeVq:00WED X-Hashcash: 1:20:060328:smarlowe@g2switchworks.com::itLVapc97McZTPmU:00000000000 0000000000000000000000006gGi X-Hashcash: 1:20:060328:mjs_ops@gmx.net::jTYGTV7mgeWd8U77:002t7W X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::I/kLU2qT1a4LBBBV:00000 0000000000000000000000001EWQ X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/566 X-Sequence-Number: 18003 On Tue, Mar 28, 2006 at 09:42:51PM +0200, PFC wrote: > However, throw in some maintenance operation which involves a long > query with writes (like a big joined UPDATE) and all access to your > website is blocked while the query lasts. > This is worsened by the fact that MySQL sucks at complex queries. > > If all of your updates are done to a few rows, MyISAM is cool, but > someday you'll want to do this query which locks a table during one > minute... and then you got a problem. Not to mention that MyISAM loves to eat data. Livejournal suffered at least one major crash due to MyISAM corruption. -- 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 Mar 28 17:56:16 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 65FF211F65E1 for ; Tue, 28 Mar 2006 17:56: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 24047-04 for ; Tue, 28 Mar 2006 17:56:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id E8DEC11F65CA for ; Tue, 28 Mar 2006 17:56:10 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id B9E3756431; Tue, 28 Mar 2006 15:56:10 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 15:56:08 -0600 Date: Tue, 28 Mar 2006 15:56:08 -0600 From: "Jim C. Nasby" To: PFC Cc: Scott Marlowe , Marcos , pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of Message-ID: <20060328215608.GA75181@pervasive.com> References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.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-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:lists@peufeu.com::XoJxpCOOcdHl2KHq:09kiZ X-Hashcash: 1:20:060328:smarlowe@g2switchworks.com::/iyTsRa/ooxD2jy8:00000000000 0000000000000000000000001nwh X-Hashcash: 1:20:060328:mjs_ops@gmx.net::rifbWOo9XWOpqYdR:00AJ9I X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::o5msz01eTWUkmOHi:00000 0000000000000000000000008DpS X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/567 X-Sequence-Number: 18004 Heh, too quick on the send button... On Tue, Mar 28, 2006 at 09:42:51PM +0200, PFC wrote: > I'll only speak about MyISAM. MySQL == MyISAM. InnoDB is useless : > if you want transactions, use postgres. > If you say to yourself "oh yeah, but it would be cool to use a > MyISAM table for stuff like hit counters etc"... Is it the job of a SQL > database to count hits on the root page of your site ? No. To store user > sessions ? No. The job of a SQL database is to efficiently handle data, > not to do something that should stay in RAM in the application server > process, or at worst, in a memcached record. Actually, it's entirely possible to do stuff like web counters, you just want to do it differently in PostgreSQL. Simply insert into a table every time you have a hit, and then roll that data up periodically. And using MyISAM is no panacea, either. Trying to keep a web counter in a MyISAM table means you'll serialize every web page on that counter update. -- 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 Mar 28 17:59:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D54E11F65DC for ; Tue, 28 Mar 2006 17:59: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 25001-03 for ; Tue, 28 Mar 2006 17:59:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id A64BF11F65D1 for ; Tue, 28 Mar 2006 17:59:20 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 7AED756423; Tue, 28 Mar 2006 15:59:20 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 15:59:20 -0600 Date: Tue, 28 Mar 2006 15:59:20 -0600 From: "Jim C. Nasby" To: Antoine Cc: pgsql-performance@postgresql.org Subject: Re: MVCC intro and benefits docs? Message-ID: <20060328215919.GB75181@pervasive.com> References: <92d3a4950603281227p50e48bc1o4af504e2d82dc6f5@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <92d3a4950603281227p50e48bc1o4af504e2d82dc6f5@mail.gmail.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:melser.anton@gmail.com::ccZPlqpL0POEwYAn:000000000000000 0000000000000000000000001wNI X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::aXSaKzwkC8h6Wcng:00000 0000000000000000000000000yus X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/568 X-Sequence-Number: 18005 On Tue, Mar 28, 2006 at 10:27:39PM +0200, Antoine wrote: > Hi, > Does anyone know of any fairly entry-level documentation for the > benefits-drawbacks of MVCC in the db? As it relates to performance? > Postgres vs the others? > Cheers > Antoine It's not dedicated to discussing MVCC alone, but http://www.pervasive-postgres.com/lp/newsletters/2005/Insights_opensource_Dec.asp#2 might provide you with some useful info. -- 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 Mar 28 21:30:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5B5CB11F6553 for ; Tue, 28 Mar 2006 21: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 53555-04 for ; Tue, 28 Mar 2006 21:30:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id 3279611F654D for ; Tue, 28 Mar 2006 21:30:24 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 86737710; Tue, 28 Mar 2006 17:30:23 -0800 From: "Dave Dutcher" To: "'Steinar H. Gunderson'" , Subject: Re: simple join uses indexes, very slow Date: Tue, 28 Mar 2006 19:30:23 -0600 Message-ID: <010a01c652d0$59ccd870$8300a8c0@tridecap.com> 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.2627 In-Reply-To: <20060328173442.GA31836@uio.no> 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.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200603/569 X-Sequence-Number: 18006 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- > owner@postgresql.org] On Behalf Of Steinar H. Gunderson > A merge join requires sorted inputs. > > > Most of the time was spent sorting the parameters parameters table by > > opset_num even though opset_num is indexed. Isn't Postgres able to walk > the > > index instead of sorting? > > The time of an index scan vs. a sequential scan + sort depends on several > factors, so it's not just a matter of walking the index whenever there is > one. I was just looking this over again and I realized I misread the query plan. The slowest step was the Bitmap Heap Scan not the sort. (The sort was relatively fast.) From pgsql-performance-owner@postgresql.org Wed Mar 29 01:03:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4BBF411F60AB for ; Wed, 29 Mar 2006 01:03: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 08842-02 for ; Wed, 29 Mar 2006 01:03:06 -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 12AA111F6058 for ; Wed, 29 Mar 2006 01:03:05 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 046C930CDC; Wed, 29 Mar 2006 07:03:04 +0200 (MET DST) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: MVCC intro and benefits docs? Date: Wed, 29 Mar 2006 12:59:34 +0800 Organization: Hub.Org Networking Services Lines: 17 Message-ID: References: <92d3a4950603281227p50e48bc1o4af504e2d82dc6f5@mail.gmail.com> <20060328215919.GB75181@pervasive.com> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.175 required=5 tests=[AWL=0.175] X-Spam-Score: 0.175 X-Spam-Level: X-Archive-Number: 200603/570 X-Sequence-Number: 18007 ""Jim C. Nasby"" wrote > > It's not dedicated to discussing MVCC alone, but > http://www.pervasive-postgres.com/lp/newsletters/2005/Insights_opensource_Dec.asp#2 > might provide you with some useful info. > -- Another introduction is here: http://www.postgresql.org/files/developer/transactions.pdf Regards, Qingqing From pgsql-performance-owner@postgresql.org Wed Mar 29 01:16:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 88D2011F627F for ; Wed, 29 Mar 2006 01:16: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 09071-07 for ; Wed, 29 Mar 2006 01:15:57 -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 CA1EE11F60AB for ; Wed, 29 Mar 2006 01:15:56 -0400 (AST) Received: by zproxy.gmail.com with SMTP id m7so98963nzf for ; Tue, 28 Mar 2006 21:15:56 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=QJjdRQdr5TQPPMEBXjgWI7NReYxWODV8oyyG9THRNufUYBYh10VYFF0L74dJGjHiPOx4E9cRt5Y5xhdRC7Z5vxmqribb5y3Y1IN/pYHsbZMrytqTzgsL6/SOO2nLEyJrOdDHHa0ukrfSPBmXnb7IJRr9lFstPKE3Da7vN7HdSZo= Received: by 10.36.227.22 with SMTP id z22mr454577nzg; Tue, 28 Mar 2006 21:15:56 -0800 (PST) Received: from ?10.1.1.21? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 36sm159271nzk.2006.03.28.21.15.55; Tue, 28 Mar 2006 21:15:55 -0800 (PST) Message-ID: <442A1808.6090705@gmail.com> Date: Wed, 29 Mar 2006 16:15:52 +1100 From: Chris 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: simple join uses indexes, very slow References: <20060327134733.72422d23.gry@ll.mit.edu> In-Reply-To: <20060327134733.72422d23.gry@ll.mit.edu> 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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/571 X-Sequence-Number: 18008 george young wrote: > [PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1] > I have a simple join on two tables that takes way too long. Can you help > me understand what's wrong? There are indexes defined on the relevant columns. > I just did a fresh vacuum --full --analyze on the two tables. > Is there something I'm not seeing? > [CPU is 950Mhz AMD, 256MB RAM, 15k rpm scsi disk] > -- George Young > > Table sizes: parameters has 2.1512e+07 tuples, run_opsets has 211745 tuples. > > explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; > QUERY PLAN > -------------------------------------------------------------------------------------------------------------------------------------------- > Nested Loop (cost=2.16..7957.40 rows=6707 width=22) (actual time=14.986..70197.129 rows=43050 loops=1) > -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..128.75 rows=71 width=18) (actual time=0.386..62.959 rows=263 loops=1) > Index Cond: (run = 'team9'::text) > -> Bitmap Heap Scan on parameters p (cost=2.16..109.93 rows=27 width=22) (actual time=1.591..266.211 rows=164 loops=263) > Recheck Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) > -> Bitmap Index Scan on parameters_idx (cost=0.00..2.16 rows=27 width=0) (actual time=1.153..1.153 rows=164 loops=263) > Index Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) > Total runtime: 70237.727 ms > (8 rows) > > Table "public.run_opsets" > Column | Type | Modifiers > --------------+-----------------------------+------------------------- > run | text | not null > opset | text | > opset_ver | integer | > opset_num | integer | not null > status | opset_status | > date_started | timestamp without time zone | > date_done | timestamp without time zone | > work_started | timestamp without time zone | > lock_user | text | default 'NO-USER'::text > lock_pid | integer | > needs_review | text | > Indexes: > "run_opsets_pkey" PRIMARY KEY, btree (run, opset_num) CLUSTER > > > -- Table "public.parameters" > Column | Type | Modifiers > -----------+---------+------------------------------- > run | text | not null > opset_num | integer | not null > opset | text | not null > opset_ver | integer | not null > step_num | integer | not null > step | text | not null > step_ver | integer | not null > name | text | not null > value | text | > split | boolean | not null default false > wafers | text[] | not null default '{}'::text[] > Indexes: > "parameters_idx" btree (run, opset_num, step_num, opset, opset_ver, step, step_ver, name, split, wafers) > "parameters_opset_idx" btree (opset, step, name) > "parameters_step_idx" btree (step, name) More for my own information (because nobody else has suggested it), would it make a difference if 'run' was a varchar field rather than text? -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Wed Mar 29 02:11:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6EA4111F66FD for ; Wed, 29 Mar 2006 02:11: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 32365-07 for ; Wed, 29 Mar 2006 02:11:48 -0400 (AST) X-Greylist: delayed 00:06:39.759644 by SQLgrey- Received: from smtpout06-04.prod.mesa1.secureserver.net (smtpout06-01.prod.mesa1.secureserver.net [64.202.165.224]) by postgresql.org (Postfix) with SMTP id EFD0D11F665C for ; Wed, 29 Mar 2006 02:11:45 -0400 (AST) Received: (qmail 28265 invoked from network); 29 Mar 2006 06:05:05 -0000 Received: from unknown (69.199.39.70) by smtpout06-04.prod.mesa1.secureserver.net (64.202.165.227) with ESMTP; 29 Mar 2006 06:05:05 -0000 Message-ID: <442A244F.4030203@ummon.com> Date: Wed, 29 Mar 2006 01:08:15 -0500 From: stef User-Agent: Mozilla Thunderbird 1.0.7-4mdk (X11/20051221) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris CC: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow References: <20060327134733.72422d23.gry@ll.mit.edu> <442A1808.6090705@gmail.com> In-Reply-To: <442A1808.6090705@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200603/572 X-Sequence-Number: 18009 If your looking for suggestions, I would suggest updating the 8.1.x you have installed to the latest version, as of typing this is 8.1.3 ;) Most notable is some of the -bug- fixes that are in since 8.1.0, for example; * Fix incorrect optimizations of outer-join conditions (Tom) You know, minor point releases aren't adding new features or changing basic functionality, they are pure and simple bugfixes. If I was in -your- position, I would run (don't walk ;) and install upto 8.1.3 of course, thats jst my 2c, feel free to ignore :D Regards Stef Chris wrote: > george young wrote: > >> [PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1] >> I have a simple join on two tables that takes way too long. Can you >> help >> me understand what's wrong? There are indexes defined on the >> relevant columns. >> I just did a fresh vacuum --full --analyze on the two tables. >> Is there something I'm not seeing? >> [CPU is 950Mhz AMD, 256MB RAM, 15k rpm scsi disk] >> -- George Young >> >> Table sizes: parameters has 2.1512e+07 tuples, run_opsets has 211745 >> tuples. >> >> explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM >> run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = >> p.opset_num and ro.run='team9'; >> >> QUERY PLAN >> -------------------------------------------------------------------------------------------------------------------------------------------- >> >> Nested Loop (cost=2.16..7957.40 rows=6707 width=22) (actual >> time=14.986..70197.129 rows=43050 loops=1) >> -> Index Scan using run_opsets_pkey on run_opsets ro >> (cost=0.00..128.75 rows=71 width=18) (actual time=0.386..62.959 >> rows=263 loops=1) >> Index Cond: (run = 'team9'::text) >> -> Bitmap Heap Scan on parameters p (cost=2.16..109.93 rows=27 >> width=22) (actual time=1.591..266.211 rows=164 loops=263) >> Recheck Cond: (('team9'::text = p.run) AND >> ("outer".opset_num = p.opset_num)) >> -> Bitmap Index Scan on parameters_idx (cost=0.00..2.16 >> rows=27 width=0) (actual time=1.153..1.153 rows=164 loops=263) >> Index Cond: (('team9'::text = p.run) AND >> ("outer".opset_num = p.opset_num)) >> Total runtime: 70237.727 ms >> (8 rows) >> >> Table "public.run_opsets" >> Column | Type | Modifiers >> --------------+-----------------------------+------------------------- >> run | text | not null >> opset | text | >> opset_ver | integer | >> opset_num | integer | not null >> status | opset_status | >> date_started | timestamp without time zone | >> date_done | timestamp without time zone | >> work_started | timestamp without time zone | >> lock_user | text | default 'NO-USER'::text >> lock_pid | integer | >> needs_review | text | >> Indexes: >> "run_opsets_pkey" PRIMARY KEY, btree (run, opset_num) CLUSTER >> >> >> -- Table "public.parameters" >> Column | Type | Modifiers >> -----------+---------+------------------------------- >> run | text | not null >> opset_num | integer | not null >> opset | text | not null >> opset_ver | integer | not null >> step_num | integer | not null >> step | text | not null >> step_ver | integer | not null >> name | text | not null >> value | text | >> split | boolean | not null default false >> wafers | text[] | not null default '{}'::text[] >> Indexes: >> "parameters_idx" btree (run, opset_num, step_num, opset, >> opset_ver, step, step_ver, name, split, wafers) >> "parameters_opset_idx" btree (opset, step, name) >> "parameters_step_idx" btree (step, name) > > > More for my own information (because nobody else has suggested it), > would it make a difference if 'run' was a varchar field rather than text? > > From pgsql-performance-owner@postgresql.org Wed Mar 29 02:22:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4785E11F665C for ; Wed, 29 Mar 2006 02:22: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 34400-06 for ; Wed, 29 Mar 2006 02:22:04 -0400 (AST) X-Greylist: delayed 18:08:09.707901 by SQLgrey- Received: from ctb-mesg7.saix.net (ctb-mesg7.saix.net [196.25.240.77]) by postgresql.org (Postfix) with ESMTP id F386A11F640B for ; Wed, 29 Mar 2006 02:22:03 -0400 (AST) Received: from greg (dsl-145-175-122.telkomadsl.co.za [165.145.175.122]) by ctb-mesg7.saix.net (Postfix) with SMTP id 7D8E9375E for ; Wed, 29 Mar 2006 08:22:01 +0200 (SAST) Message-ID: <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> Reply-To: "Greg Quinn" From: "Greg Quinn" To: References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> Subject: Re: Slow performance on Windows .NET and OleDb Date: Wed, 29 Mar 2006 08:22:08 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/573 X-Sequence-Number: 18010 The query is, select * from users which returns 4 varchar fields, there is no where clause Yes, I am running the default postgres config. Basically I have been a MySQL user and thought I would like to check out PostGreSql. So I did a quick performance test. The performance was so different that I thought PostGreSQL was nothing compared to MySQL, but now it seems its just a few configuration options. Strange how the defult config would be so slow... I have begun reading the documentation but am not too sure what options I can quickly tweak to get good performance, could somebody give me some tips? Thanks ----- Original Message ----- From: "Joshua D. Drake" To: "Jim C. Nasby" Cc: "Greg Quinn" ; Sent: Tuesday, March 28, 2006 7:52 PM Subject: Re: [PERFORM] Slow performance on Windows .NET and OleDb > Jim C. Nasby wrote: >> On Tue, Mar 28, 2006 at 02:14:00PM +0200, Greg Quinn wrote: >>> Hello, >>> >>> I have just installed PostGreSql 8.1 on my Windows XP PC. I created a >>> simple table called users with 4 varchar fields. >>> >>> I am using the OleDb connection driver. In my .NET application, I >>> populate 3000 records into the table to test PostGreSql's speed. It >>> takes about 3-4 seconds. >>> >>> Even worse is displaying the 3000 records in a ListView control. It >>> takes about 7 seconds. In MySQL, the exact same table and application >>> displays the same 3000 records in under 1/2 second!!! >> >> Have you vacuumed recently? This smells like it might be a table bloat >> problem. > > > This could be a lot of things... > > He is probably running the default postgresql.conf which is going to > perform horribly. > > What is your work_mem? shared_buffers? > > Are you passing a where clause? If so is there an index on the field that > is subject to the clause? > > When you do the population, is it via inserts or copy? > > Joshua D. Drake > > > -- > > === The PostgreSQL Company: Command Prompt, Inc. === > Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 > Providing the most comprehensive PostgreSQL solutions since 1997 > http://www.commandprompt.com/ > > From pgsql-performance-owner@postgresql.org Wed Mar 29 02:24:57 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E056E11F6750 for ; Wed, 29 Mar 2006 02:24: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 36799-01 for ; Wed, 29 Mar 2006 02:24:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ctb-mesg4.saix.net (ctb-mesg4.saix.net [196.25.240.74]) by postgresql.org (Postfix) with ESMTP id 8E05111F674E for ; Wed, 29 Mar 2006 02:24:52 -0400 (AST) Received: from greg (dsl-145-175-122.telkomadsl.co.za [165.145.175.122]) by ctb-mesg4.saix.net (Postfix) with SMTP id C5BAB2B71 for ; Wed, 29 Mar 2006 08:24:50 +0200 (SAST) Message-ID: <007f01c652f9$818b4440$0200a8c0@pta.homex.co.za> Reply-To: "Greg Quinn" From: "Greg Quinn" To: References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> Subject: Re: Slow performance on Windows .NET and OleDb Date: Wed, 29 Mar 2006 08:24:58 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.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.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/574 X-Sequence-Number: 18011 Via insert > > When you do the population, is it via inserts or copy? > > Joshua D. Drake > > > -- > > === The PostgreSQL Company: Command Prompt, Inc. === > Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 > Providing the most comprehensive PostgreSQL solutions since 1997 > http://www.commandprompt.com/ > > > > ---------------------------(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 Mar 29 02:58:23 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DF2B311F6286 for ; Wed, 29 Mar 2006 02:58: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 41154-03 for ; Wed, 29 Mar 2006 02:58:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id CD2C811F6258 for ; Wed, 29 Mar 2006 02:58:15 -0400 (AST) Received: (qmail 16823 invoked by uid 514); 29 Mar 2006 10:00:24 +0200 Received: from 62.37.217.225 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.217.225):SA:0(-1.8/5.0):. Processed in 0.630708 secs); 29 Mar 2006 08:00:24 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.217.225):SA:0(-1.8/5.0):. Processed in 0.630708 secs Process 16805) Received: from 62-37-217-225.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.217.225) by mail.rentalia.net with SMTP; 29 Mar 2006 10:00:23 +0200 Message-ID: <442A2FFF.1080301@rentalia.com> Date: Wed, 29 Mar 2006 08:58:07 +0200 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Slow performance on Windows .NET and OleDb References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> In-Reply-To: <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> 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.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/575 X-Sequence-Number: 18012 Greg Quinn wrote: > The query is, > > select * from users > > which returns 4 varchar fields, there is no where clause > > Yes, I am running the default postgres config. Basically I have been a > MySQL user and thought I would like to check out PostGreSql. So I did > a quick performance test. The performance was so different that I > thought PostGreSQL was nothing compared to MySQL, but now it seems its > just a few configuration options. Strange how the defult config would > be so slow... My english is poor but im gonna try to explain it: Default configuration in postgres its not for good performance, its just design to make it working in any computer. Thats why u have to try to custom default config file. Anyway, people says that mysql is faster (and lighter) than postgres (at least with mysql 3.x vs postgres 7.4), but postgres is more advanced and its much harder to get data corrupted. But there is something that you should known about postgres. Postgres creates statistics of usage, and when you "vacumm", it optimizes each table depending of usage. So: - You should custom config file. - You should vacumm it, as someone recomended before. - Do u have any indexes? Remove it. To get all rows you do not need it Note that I just have use it under Linux, i have no idea about how should it work on Windows. From pgsql-performance-owner@postgresql.org Wed Mar 29 03:16:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0999311F6745 for ; Wed, 29 Mar 2006 03: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 25821-04 for ; Wed, 29 Mar 2006 03:16:29 -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 356E111F671F for ; Wed, 29 Mar 2006 03:16:28 -0400 (AST) Received: by zproxy.gmail.com with SMTP id m7so114542nzf for ; Tue, 28 Mar 2006 23:16:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.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=eZ5CTdMrfeIf+4+5j1H/wSauth+N5+fWCDtWTCOm3SUlvymb7xMULQPxeGQdwm+bQLXeIEr/+nvsVd2dkSdyunMj6WACkyheqQ6A6WEYWY2fRFmkgdeqvjZsNzVI2kjrxWVrfVPYCZPk9fkNHH/dBIUiVhJgTr93v1sdX02bhNM= Received: by 10.36.118.11 with SMTP id q11mr541562nzc; Tue, 28 Mar 2006 23:16:27 -0800 (PST) Received: from ?10.1.1.23? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 39sm723267nzk.2006.03.28.23.16.25; Tue, 28 Mar 2006 23:16:27 -0800 (PST) Message-ID: <442A3447.9060304@gmail.com> Date: Wed, 29 Mar 2006 18:16:23 +1100 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ruben Rubio Rey CC: pgsql-performance@postgresql.org Subject: Re: Slow performance on Windows .NET and OleDb References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> <442A2FFF.1080301@rentalia.com> In-Reply-To: <442A2FFF.1080301@rentalia.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.118 required=5 tests=[AWL=0.118] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200603/576 X-Sequence-Number: 18013 Ruben Rubio Rey wrote: > Greg Quinn wrote: > >> The query is, >> >> select * from users >> >> which returns 4 varchar fields, there is no where clause >> >> Yes, I am running the default postgres config. Basically I have been a >> MySQL user and thought I would like to check out PostGreSql. So I did >> a quick performance test. The performance was so different that I >> thought PostGreSQL was nothing compared to MySQL, but now it seems its >> just a few configuration options. Strange how the defult config would >> be so slow... > - Do u have any indexes? Remove it. To get all rows you do not need it I wouldn't do that. Postgres needs indexing just like any other database. It might affect this query but it's not going to help other queries. -- Postgresql & php tutorials http://www.designmagick.com/ From pgsql-performance-owner@postgresql.org Wed Mar 29 06:52:51 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3377011F675A for ; Wed, 29 Mar 2006 06: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 94542-03 for ; Wed, 29 Mar 2006 06:52:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from beth.coza.net.za (beth.coza.net.za [206.223.136.193]) by postgresql.org (Postfix) with ESMTP id CC5F311F6628 for ; Wed, 29 Mar 2006 06:52:44 -0400 (AST) Received: from theo-laptop.int.coza.net.za ([206.223.136.211]) by beth.coza.net.za (8.11.6/8.11.2) with ESMTP id k2TAqa116503; Wed, 29 Mar 2006 12:52:36 +0200 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by theo-laptop.int.coza.net.za (8.12.11/8.12.11) with ESMTP id k2TAqVAM005236; Wed, 29 Mar 2006 12:52:34 +0200 Subject: Re: Indexes with descending date columns From: Theo Kramer Reply-To: theo@flame.co.za To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org In-Reply-To: <20060324102138.GR90527@pervasive.com> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060324102138.GR90527@pervasive.com> Content-Type: text/plain Organization: Flame Computing Enterprises cc Message-Id: <1143629550.2985.29.camel@theo-laptop.int.coza.net.za> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 29 Mar 2006 12:52:31 +0200 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: 200603/577 X-Sequence-Number: 18014 On Fri, 2006-03-24 at 12:21, Jim C. Nasby wrote: > On Thu, Mar 23, 2006 at 01:09:49PM +0200, Theo Kramer wrote: > > ii If no to i, is it feasible to extend PostgreSQL to allow traversing > > an index in column descending and column ascending order - assuming > > an order by on more than one column with column order not > > in the same direction and indexes existing? ... if that makes sense. > > Yes. > > stats=# explain select * from email_contrib order by project_id desc, id desc, date desc limit 10; > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------------ > Limit (cost=0.00..31.76 rows=10 width=24) > -> Index Scan Backward using email_contrib_pkey on email_contrib (cost=0.00..427716532.18 rows=134656656 width=24) > (2 rows) Not quite what I mean - redo the above as follows and then see what explain returns explain select * from email_contrib order by project_id, id, date desc limit 10; -- Regards Theo From pgsql-performance-owner@postgresql.org Wed Mar 29 07:00:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DC5FF11F662F for ; Wed, 29 Mar 2006 07:00: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 95339-06 for ; Wed, 29 Mar 2006 07:00:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ctb-mesg4.saix.net (ctb-mesg4.saix.net [196.25.240.74]) by postgresql.org (Postfix) with ESMTP id 22BDE11F600D for ; Wed, 29 Mar 2006 07:00:15 -0400 (AST) Received: from greg (dsl-145-175-122.telkomadsl.co.za [165.145.175.122]) by ctb-mesg4.saix.net (Postfix) with SMTP id 438703C2F for ; Wed, 29 Mar 2006 13:00:15 +0200 (SAST) Message-ID: <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> Reply-To: "Greg Quinn" From: "Greg Quinn" To: References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> Subject: Re: Slow performance on Windows .NET and OleDb Date: Wed, 29 Mar 2006 13:00:20 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; 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.025 required=5 tests=[AWL=-0.786, RCVD_IN_WHOIS_BOGONS=1.811] X-Spam-Score: 1.025 X-Spam-Level: * X-Archive-Number: 200603/578 X-Sequence-Number: 18015 > how many rows does it return ? a few, or a lot ? 3000 Rows - 7 seconds - very slow Which client library may have a problem? I am using OleDb, though haven't tried the .NET connector yet. Network configuration?? I am running it off my home PC with no network. It is P4 2.4 with 1 Gig Ram. Windows XP ----- Original Message ----- From: "PFC" To: "Greg Quinn" Sent: Wednesday, March 29, 2006 11:02 AM Subject: Re: [PERFORM] Slow performance on Windows .NET and OleDb > >> select * from users >> which returns 4 varchar fields, there is no where clause > > how many rows does it return ? a few, or a lot ? > >> Yes, I am running the default postgres config. Basically I have been a >> MySQL user and thought I would like to check out PostGreSql. > > Good idea... > > From the tests I made, on simple queries like yours, with no joins, speed > pf pg 8.x is about the same as mysql 5.x ; that is to say very fast. If > you have a performance problem on something so basic, and moreover on > windows, it smells like a problem in the client library, or in the TCP > transport between client and server. > I remember messages saying postgres on windows was slow some time ago > here, and it turned out to be a problem in the network configuration of > the machine. > From pgsql-performance-owner@postgresql.org Wed Mar 29 07:21:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7A57911F661F for ; Wed, 29 Mar 2006 07:21: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 97688-09 for ; Wed, 29 Mar 2006 07:21:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 49D7811F6619 for ; Wed, 29 Mar 2006 07:21:06 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (Ta2ae.t.pppool.de [89.55.162.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 85A3A656CD; Wed, 29 Mar 2006 13:21:46 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id CA6F618530645; Wed, 29 Mar 2006 13:21:16 +0200 (CEST) Message-ID: <442A6DAB.5020404@logix-tt.com> Date: Wed, 29 Mar 2006 13:21:15 +0200 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: Greg Quinn Cc: pgsql-performance@postgresql.org Subject: Re: Slow performance on Windows .NET and OleDb References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <007f01c652f9$818b4440$0200a8c0@pta.homex.co.za> In-Reply-To: <007f01c652f9$818b4440$0200a8c0@pta.homex.co.za> 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.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/579 X-Sequence-Number: 18016 Hi, Greg, Greg Quinn wrote: >>> I populate 3000 records into the table to test PostGreSql's speed. >>> It takes about 3-4 seconds. >> When you do the population, is it via inserts or copy? > Via insert Are those inserts encapsulated into a single transaction? If not, that's the reason why it's so slow, every transaction sync()s through to the disk. Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org From pgsql-performance-owner@postgresql.org Wed Mar 29 07:40:54 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D78311F6621 for ; Wed, 29 Mar 2006 07:40: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 02553-08 for ; Wed, 29 Mar 2006 07:40:46 -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 1163011F661A for ; Wed, 29 Mar 2006 07:40:43 -0400 (AST) Received: (qmail 23356 invoked from network); 29 Mar 2006 13:40:55 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 29 Mar 2006 13:40:55 +0200 Date: Wed, 29 Mar 2006 13:40:54 +0200 To: "Greg Quinn" , pgsql-performance@postgresql.org Subject: Re: Slow performance on Windows .NET and OleDb References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/580 X-Sequence-Number: 18017 > 3000 Rows - 7 seconds - very slow On my PC (athlon 64 3000+ running Linux), selecting 3000 rows with 4 columns out of a 29 column table takes about 105 ms, including time to transfer the results and convert them to native Python objects. It takes about 85 ms on a test table with only those 4 columns. There is definitely a problem somewhere on your system. I'd suggest running this query in an infinite loop. Logically, it should use 100% processor, with postgres using some percentage (30% here) and your client using some other percentage (70% here). Is your processor used to the max ? From pgsql-performance-owner@postgresql.org Wed Mar 29 08:22:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0BF1411F661E for ; Wed, 29 Mar 2006 08:22: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 16261-02 for ; Wed, 29 Mar 2006 08:22:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smarty.gabriel.co.hu (smarty.gabriel.co.hu [195.70.37.16]) by postgresql.org (Postfix) with ESMTP id 01E4B11F661A for ; Wed, 29 Mar 2006 08:22:30 -0400 (AST) Received: from localhost (smarty [127.0.0.1]) by smarty.gabriel.co.hu (Postfix) with ESMTP id B5DDE4187D for ; Wed, 29 Mar 2006 14:22:26 +0200 (CEST) Received: from smarty.gabriel.co.hu ([127.0.0.1]) by localhost (smarty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 26280-04 for ; Wed, 29 Mar 2006 14:22:26 +0200 (CEST) Received: from [192.168.111.135] (customer-174.radio-net.hu [217.113.54.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smarty.gabriel.co.hu (Postfix) with ESMTP id 70C5C4186A for ; Wed, 29 Mar 2006 14:22:26 +0200 (CEST) Message-ID: <442A7C08.3020206@i-logic.hu> Date: Wed, 29 Mar 2006 14:22:32 +0200 From: =?ISO-8859-2?Q?G=E1briel_=C1kos?= Organization: I-Logic Kft User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: statistics buffer is full Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at gabriel.co.hu 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: 200603/581 X-Sequence-Number: 18018 Hi, I've got this message while heavily inserting into a database. What should I tune and how? It is postgresql 8.1.3. 2006-03-29 14:16:57.513 CEST:LOG: statistics buffer is full Thanks in advance, Akos -- �dv�zlettel, G�briel �kos -=E-Mail :akos.gabriel@i-logic.hu|Web: http://www.i-logic.hu=- -=Tel/fax:+3612367353 |Mobil:+36209278894 =- From pgsql-performance-owner@postgresql.org Wed Mar 29 09:48:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C589A11F6622 for ; Wed, 29 Mar 2006 09:48: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 39476-08 for ; Wed, 29 Mar 2006 09:48:25 -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 7CFCB11F6654 for ; Wed, 29 Mar 2006 09:48:23 -0400 (AST) Received: by zproxy.gmail.com with SMTP id l1so170441nzf for ; Wed, 29 Mar 2006 05:48: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=D8aZSpE2qdXsuiUjpv4EkTcn39xzy1WmO541tAkH1tasiiE9m18BAPoY81dvDfEngCyBlZxzTqmD4H8xRwCUf/J/IuuG4xJABwErlHEXrWfcPrwxZfabyAdwq6sAAxm8PWHB6KZeDxhJfySXF8T8NjK9g63oqTtOC0CC0GoqdNw= Received: by 10.65.232.18 with SMTP id j18mr504637qbr; Wed, 29 Mar 2006 05:48:22 -0800 (PST) Received: by 10.65.135.6 with HTTP; Wed, 29 Mar 2006 05:48:22 -0800 (PST) Message-ID: Date: Wed, 29 Mar 2006 08:48:22 -0500 From: "Merlin Moncure" To: "Jim C. Nasby" Subject: Re: Decide between Postgresql and Mysql (help of Cc: PFC , "Scott Marlowe" , Marcos , pgsql-performance@postgresql.org In-Reply-To: <20060328215608.GA75181@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> <20060328215608.GA75181@pervasive.com> 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: 200603/582 X-Sequence-Number: 18019 On 3/28/06, Jim C. Nasby wrote: > Heh, too quick on the send button... > > On Tue, Mar 28, 2006 at 09:42:51PM +0200, PFC wrote: > Actually, it's entirely possible to do stuff like web counters, you just > want to do it differently in PostgreSQL. Simply insert into a table > every time you have a hit, and then roll that data up periodically. > > And using MyISAM is no panacea, either. Trying to keep a web counter in > a MyISAM table means you'll serialize every web page on that counter > update. if you want raw speed, use a sequence for a hit-counter. sequences are wonder-tools and very lightweight. Explain analyze for a sequence nextval on my desktop box reports 47 microseconds. thats 200k sequence updates/second. insert into a table (fsync off/cache write, no keys) is not much slower. PostgreSQL 8.1 saw a lot of performance improvements...but the most important (and least publicized) is the reduced latency of simple queries in high cache enviroments. merlin From pgsql-performance-owner@postgresql.org Wed Mar 29 10:05:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1947511F661D for ; Wed, 29 Mar 2006 10:05: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 44603-01 for ; Wed, 29 Mar 2006 10:05:14 -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 30D8411F6616 for ; Wed, 29 Mar 2006 10:05:11 -0400 (AST) Received: by zproxy.gmail.com with SMTP id l1so173704nzf for ; Wed, 29 Mar 2006 06:05:12 -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=SqWWVb3Afpm0Ovpo6qMKTvFODbqnFmPJqmKwJdm5JhebJZ4bEb6v4oVDDsWp3f7CbZYd/it+RUSLQ7hkz9Hx7CctdLOyFB5H/Wn05MQDD0q3cZWG79T8/zcGbvDSCHa467jWqX3yJYutZN4ABMPpD9S1KNr6gKLGAyHjDQ11CLA= Received: by 10.65.59.19 with SMTP id m19mr505568qbk; Wed, 29 Mar 2006 06:05:12 -0800 (PST) Received: by 10.65.135.6 with HTTP; Wed, 29 Mar 2006 06:05:12 -0800 (PST) Message-ID: Date: Wed, 29 Mar 2006 09:05:12 -0500 From: "Merlin Moncure" To: "Greg Quinn" Subject: Re: Slow performance on Windows .NET and OleDb Cc: pgsql-performance@postgresql.org In-Reply-To: <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> 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: 200603/583 X-Sequence-Number: 18020 On 3/29/06, Greg Quinn wrote: > > how many rows does it return ? a few, or a lot ? > > 3000 Rows - 7 seconds - very slow > > Which client library may have a problem? I am using OleDb, though haven't > tried the .NET connector yet. esilo=3D# create temp table use_npgsql as select v, 12345 as a, 'abcdef' as b, 'abcdef' as c, 4 as d from generate_series(1,100000) v; SELECT Time: 203.000 ms esilo=3D# explain analyze select * from use_npgsql; QUERY PLAN ---------------------------------------------------------------------------= ---------------------------------------- Seq Scan on use_npgsql (cost=3D0.00..1451.16 rows=3D61716 width=3D76) (actual time=3D0.007..176.106 rows=3D100000 loops=3D1) Total runtime: 336.809 ms (2 rows) I just pulled out 100k rows in about 1/3 second. The problem is not your postgresql configuration. Your problem is possibly in the oledb driver. The last time I looked at it, it was not production ready. http://pgfoundry.org/frs/?group_id=3D1000140&release_id=3D407 Merlin From pgsql-performance-owner@postgresql.org Wed Mar 29 11:29:35 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B507811F65E4 for ; Wed, 29 Mar 2006 11:29: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 42418-09 for ; Wed, 29 Mar 2006 11:29:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by postgresql.org (Postfix) with ESMTP id 37B4A11F65F0 for ; Wed, 29 Mar 2006 11:29:30 -0400 (AST) Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id k2TFTVUi028178 for ; Wed, 29 Mar 2006 10:29:31 -0500 (EST) Received: from UNKNOWN( ), claiming to be "sty.llan" via SMTP by llmail, id smtpdAAAGnaWj2; Wed Mar 29 10:29:15 2006 Date: Wed, 29 Mar 2006 10:29:15 -0500 From: george young To: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-Id: <20060329102915.20a82762.gry@ll.mit.edu> In-Reply-To: <442A244F.4030203@ummon.com> References: <20060327134733.72422d23.gry@ll.mit.edu> <442A1808.6090705@gmail.com> <442A244F.4030203@ummon.com> Reply-To: gry@ll.mit.edu Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.8.0; 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.102 required=5 tests=[AWL=0.101, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/584 X-Sequence-Number: 18021 On Wed, 29 Mar 2006 01:08:15 -0500 stef threw this fish to the penguins: > > If your looking for suggestions, I would suggest updating the 8.1.x you > have installed to the latest version, as of typing this is 8.1.3 ;) Most > notable is some of the -bug- fixes that are in since 8.1.0, for example; > > * Fix incorrect optimizations of outer-join conditions (Tom) > > You know, minor point releases aren't adding new features or changing > basic functionality, they are pure and simple bugfixes. If I was in > -your- position, I would run (don't walk ;) and install upto 8.1.3 I just did this(8.1.3). I also moved the server to a host with more ram and faster cpu. And I did cluster on the main index of the large parameters table. The result is less than a second instead of 70 seconds. Sorry I didn't have time to isolate the individual effects of the above changes, but sometimes you just have to do "a bunch of good things" and move on. For your enjoyment here's the latest analyze: newschm3=> explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = p.opset_num and ro.run='team9'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..6194.18 rows=9186 width=22) (actual time=0.477..175.554 rows=43050 loops=1) -> Index Scan using run_opsets_pkey on run_opsets ro (cost=0.00..122.27 rows=68 width=18) (actual time=0.222..1.093 rows=263 loops=1) Index Cond: (run = 'team9'::text) -> Index Scan using parameters_idx on parameters p (cost=0.00..88.72 rows=46 width=22) (actual time=0.023..0.498 rows=164 loops=263) Index Cond: (('team9'::text = p.run) AND ("outer".opset_num = p.opset_num)) Total runtime: 190.821 ms Thank you all very much for you help! -- George Young > > of course, thats jst my 2c, feel free to ignore :D > Regards > Stef > > Chris wrote: > > > george young wrote: > > > >> [PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1] > >> I have a simple join on two tables that takes way too long. Can you > >> help > >> me understand what's wrong? There are indexes defined on the > >> relevant columns. > >> I just did a fresh vacuum --full --analyze on the two tables. > >> Is there something I'm not seeing? > >> [CPU is 950Mhz AMD, 256MB RAM, 15k rpm scsi disk] > >> -- George Young > >> > >> Table sizes: parameters has 2.1512e+07 tuples, run_opsets has 211745 > >> tuples. > >> > >> explain analyze SELECT ro.run, ro.opset_num, p.step_num FROM > >> run_opsets ro, parameters p WHERE ro.run = p.run AND ro.opset_num = > >> p.opset_num and ro.run='team9'; > >> > >> QUERY PLAN > >> -------------------------------------------------------------------------------------------------------------------------------------------- > >> > >> Nested Loop (cost=2.16..7957.40 rows=6707 width=22) (actual > >> time=14.986..70197.129 rows=43050 loops=1) > >> -> Index Scan using run_opsets_pkey on run_opsets ro > >> (cost=0.00..128.75 rows=71 width=18) (actual time=0.386..62.959 > >> rows=263 loops=1) > >> Index Cond: (run = 'team9'::text) > >> -> Bitmap Heap Scan on parameters p (cost=2.16..109.93 rows=27 > >> width=22) (actual time=1.591..266.211 rows=164 loops=263) > >> Recheck Cond: (('team9'::text = p.run) AND > >> ("outer".opset_num = p.opset_num)) > >> -> Bitmap Index Scan on parameters_idx (cost=0.00..2.16 > >> rows=27 width=0) (actual time=1.153..1.153 rows=164 loops=263) > >> Index Cond: (('team9'::text = p.run) AND > >> ("outer".opset_num = p.opset_num)) > >> Total runtime: 70237.727 ms > >> (8 rows) > >> > >> Table "public.run_opsets" > >> Column | Type | Modifiers > >> --------------+-----------------------------+------------------------- > >> run | text | not null > >> opset | text | > >> opset_ver | integer | > >> opset_num | integer | not null > >> status | opset_status | > >> date_started | timestamp without time zone | > >> date_done | timestamp without time zone | > >> work_started | timestamp without time zone | > >> lock_user | text | default 'NO-USER'::text > >> lock_pid | integer | > >> needs_review | text | > >> Indexes: > >> "run_opsets_pkey" PRIMARY KEY, btree (run, opset_num) CLUSTER > >> > >> > >> -- Table "public.parameters" > >> Column | Type | Modifiers > >> -----------+---------+------------------------------- > >> run | text | not null > >> opset_num | integer | not null > >> opset | text | not null > >> opset_ver | integer | not null > >> step_num | integer | not null > >> step | text | not null > >> step_ver | integer | not null > >> name | text | not null > >> value | text | > >> split | boolean | not null default false > >> wafers | text[] | not null default '{}'::text[] > >> Indexes: > >> "parameters_idx" btree (run, opset_num, step_num, opset, > >> opset_ver, step, step_ver, name, split, wafers) > >> "parameters_opset_idx" btree (opset, step, name) > >> "parameters_step_idx" btree (step, name) > > > > > > More for my own information (because nobody else has suggested it), > > would it make a difference if 'run' was a varchar field rather than text? > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > -- "Are the gods not just?" "Oh no, child. What would become of us if they were?" (CSL) From pgsql-performance-owner@postgresql.org Wed Mar 29 11:33:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 253C911F65E4 for ; Wed, 29 Mar 2006 11:33: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 43656-10 for ; Wed, 29 Mar 2006 11:33:01 -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 D020311F653C for ; Wed, 29 Mar 2006 11:32:58 -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 CA87AB816 for ; Wed, 29 Mar 2006 10:32:55 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <44298721.5050400@alteeve.com> References: <1143559902.1241.16.camel@servidor> <44298721.5050400@alteeve.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6EECBE15-976E-4E39-9022-D52C3F6DD88D@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Decide between Postgresql and Mysql (help of comunity) Date: Wed, 29 Mar 2006 10:32:54 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.081 required=5 tests=[AWL=0.081] X-Spam-Score: 0.081 X-Spam-Level: X-Archive-Number: 200603/585 X-Sequence-Number: 18022 On Mar 28, 2006, at 1:57 PM, Madison Kelly wrote: > From what I understand, PostgreSQL is designed with stability and > reliability as key tenants. MySQL favors performance and ease of > use. An From my point of view, mysql favors single-user performance over all else. Get into multiple updaters and you are competing for table locks all the time. Postgres works much better with multiple clients writing to it. From pgsql-performance-owner@postgresql.org Wed Mar 29 11:35:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4BFFE11F65F7 for ; Wed, 29 Mar 2006 11:35: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 44475-05 for ; Wed, 29 Mar 2006 11:35:14 -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 C452911F65F1 for ; Wed, 29 Mar 2006 11:35:11 -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 6EE14B80C for ; Wed, 29 Mar 2006 10:35:12 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <1143572392.3625.79.camel@state.g2switchworks.com> References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3F5E244D-12D0-48EF-AED5-4B17CFB40785@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Decide between Postgresql and Mysql (help of Date: Wed, 29 Mar 2006 10:35:11 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.081 required=5 tests=[AWL=0.081] X-Spam-Score: 0.081 X-Spam-Level: X-Archive-Number: 200603/586 X-Sequence-Number: 18023 On Mar 28, 2006, at 1:59 PM, Scott Marlowe wrote: > Generally you'll find the PostgreSQL gotchas are of the sort that make > you go "oh, that's interesting" and the MySQL gotchas are the kind > that > make you go "Dear god, you must be kidding me!" > > But that's just my opinion, I could be wrong. I nominate this for "quote of the month". :-) From pgsql-performance-owner@postgresql.org Wed Mar 29 11:36:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4340111F65F0 for ; Wed, 29 Mar 2006 11:36: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 46229-02 for ; Wed, 29 Mar 2006 11:36:52 -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 1475A11F65E4 for ; Wed, 29 Mar 2006 11:36:50 -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 A7569B80C for ; Wed, 29 Mar 2006 10:36:50 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: <1143564928.1241.28.camel@servidor> References: <1143559902.1241.16.camel@servidor> <1143572392.3625.79.camel@state.g2switchworks.com> <1143564928.1241.28.camel@servidor> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Decide between Postgresql and Mysql (help of Date: Wed, 29 Mar 2006 10:36:49 -0500 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.082 required=5 tests=[AWL=0.082] X-Spam-Score: 0.082 X-Spam-Level: X-Archive-Number: 200603/587 X-Sequence-Number: 18024 On Mar 28, 2006, at 11:55 AM, Marcos wrote: > The application will be a chat for web, the chats will be stored in > the > server. In a determined interval of time... more or less 2 seconds, > the > application will be looking for new messages. We bought software for this purpose (phplive). It is based on mysql using isam tables and is written in (surprise!) php. Two of my "favorite" techonologies! :-) From pgsql-performance-owner@postgresql.org Wed Mar 29 13:59:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 831FD11F6673 for ; Wed, 29 Mar 2006 13:59: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 70554-09 for ; Wed, 29 Mar 2006 13:59:03 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 048FF11F6615 for ; Wed, 29 Mar 2006 13:59:03 -0400 (AST) Received: from asmail001.abovesecurity.com (asmail001.abovesecurity.com [206.162.148.235]) by svr4.postgresql.org (Postfix) with ESMTP id B8E105AF023 for ; Wed, 29 Mar 2006 17:59:02 +0000 (GMT) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Database possible corruption , unsolvable mystery Date: Wed, 29 Mar 2006 12:58:59 -0500 Message-ID: X-MS-Has-Attach: Importance: normal X-MS-TNEF-Correlator: Thread-Topic: Database possible corruption , unsolvable mystery thread-index: AcZTWnQtkk1VNDVvQuq18v3B7YIrrg== From: "Eric Lauzon" To: 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: 200603/588 X-Sequence-Number: 18025 Greetings, We have an issue where we have a database with many tables. The layout of the database is 3 set of look alike tables with different = names. Each set of tables has some referential integrety that point back to = the main control table. On two set of tables we are able to efficiently delete referential and = main record without a problems, but on the 3rd set we have an issue where the = control table is clugged and delete seem to take forever , as example on the first two set a = delete of 60K record take about 4 second to 10 second but on the 3rd set it can take as long as 3hours. This seem to be only affecting one database , the schema and way of = doing is replicated elsewhere and if efficient. The question is, even after droping 3rd set integrity , dumping the = table data , deleting the table, doing a manual checkpoint and recreating the table with the dump data , = with or without referential integrity , the problems still araise. If we copy the data from the live table and do a create table aaa as = select * from problematic_table; the table aaa operations are normal and efficient. This is why our investigation brought us to the folowing questions: 1. Are postgresql data file name are hashed references to table name(as = oracle)? [~path to data EX:/var/log/pgsql/data/[arbitraty = numbers]/[datafile]]? 2. If the data files are corrupted and we re-create is it possible it = uses the same files thus creating the same issue? 3. Since we know that all the tables has that problems is there an = internal table with undisclosed references to tables data files? =09 I hope the questions were clear. Have a good day, and thank you in advance. Eric Lauzon [Recherche & D=E9veloppement] Above S=E9curit=E9 / Above Security T=E9l : (450) 430-8166 Fax : (450) 430-1858 AVERTISSEMENT CONCERNANT LA CONFIDENTIALIT=C9=20 Le pr=E9sent message est =E0 l'usage exclusif du ou des destinataires = mentionn=E9s ci-dessus. Son contenu est confidentiel et peut =EAtre = assujetti au secret professionnel. Si vous avez re=E7u le pr=E9sent = message par erreur, veuillez nous en aviser imm=E9diatement et le = d=E9truire en vous abstenant d'en faire une copie, d'en divulguer le = contenu ou d'y donner suite. CONFIDENTIALITY NOTICE This communication is intended for the exclusive use of the addressee = identified above. Its content is confidential and may contain privileged = information. If you have received this communication by error, please = notify the sender and delete the message without copying or disclosing = it. From pgsql-performance-owner@postgresql.org Wed Mar 29 18:10:08 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2E17411F66C3 for ; Wed, 29 Mar 2006 18: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 44019-03 for ; Wed, 29 Mar 2006 18:10:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by postgresql.org (Postfix) with ESMTP id 9E28E11F6249 for ; Wed, 29 Mar 2006 18:10:05 -0400 (AST) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by ptb-relay03.plus.net with esmtp (Exim) id 1FOirX-0006i3-W8; Wed, 29 Mar 2006 23:10:00 +0100 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 C5A2F735C2; Wed, 29 Mar 2006 22:06:34 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id DF2CA15EA6; Wed, 29 Mar 2006 23:09:52 +0100 (BST) Message-ID: <442B05B0.5080507@archonet.com> Date: Wed, 29 Mar 2006 23:09:52 +0100 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Eric Lauzon Cc: pgsql-performance@postgresql.org Subject: Re: Database possible corruption , unsolvable mystery References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.124 required=5 tests=[AWL=0.124] X-Spam-Score: 0.124 X-Spam-Level: X-Archive-Number: 200603/589 X-Sequence-Number: 18026 Eric Lauzon wrote: > This is why our investigation brought us to the folowing questions: > > 1. Are postgresql data file name are hashed references to table > name(as oracle)? [~path to data EX:/var/log/pgsql/data/[arbitraty > numbers]/[datafile]]? OID numbers - look in the contrib directory/package for the oid2name utility. > 2. If the data files are corrupted and we re-create is it possible it > uses the same files thus creating the same issue? No > 3. Since we know that all the tables has that problems is there an > internal table with undisclosed references to tables data files? I > hope the questions were clear. You mean a system table that could account for your problems since it refers to some of your tables but not others? No. The obvious places to start are: 1. vacuum analyse verbose on the tables in question This should show whether there are a lot of "dead" rows 2. explain analyse on problem queries To see if the query plans are correct 3. SELECT * FROM pg_stat_??? Assuming you have statistics gathering turned on, this might show unusual table accesses. HTH -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Mar 29 18:16:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B682911F624A for ; Wed, 29 Mar 2006 18:16: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 45971-03 for ; Wed, 29 Mar 2006 18:16:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 7EC8011F6251 for ; Wed, 29 Mar 2006 18:16:52 -0400 (AST) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 29 Mar 2006 14:16:51 -0800 Subject: Re: Database possible corruption , unsolvable mystery From: Mark Lewis To: Eric Lauzon Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Organization: MIR3, Inc. Date: Wed, 29 Mar 2006 14:16:51 -0800 Message-Id: <1143670611.5634.11.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-22) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.137 required=5 tests=[AWL=0.136, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.137 X-Spam-Level: X-Archive-Number: 200603/590 X-Sequence-Number: 18027 Can you post an explain analyze for the delete query? That will at least tell you if it is the delete itself which is slow, or a trigger / referential integrity constraint check. Which version of PG is this? -- Mark Lewis On Wed, 2006-03-29 at 12:58 -0500, Eric Lauzon wrote: > Greetings, >=20 > We have an issue where we have a database with many tables. > The layout of the database is 3 set of look alike tables with different = names. > Each set of tables has some referential integrety that point back to the= main > control table. >=20 > On two set of tables we are able to efficiently delete referential and m= ain record > without a problems, but on the 3rd set we have an issue where the contro= l table is clugged > and delete seem to take forever , as example on the first two set a dele= te of 60K record take about > 4 second to 10 second but on the 3rd set it can take as long as 3hours. >=20 > This seem to be only affecting one database , the schema and way of doin= g is replicated elsewhere > and if efficient. >=20 > The question is, even after droping 3rd set integrity , dumping the tabl= e data , deleting the table, > doing a manual checkpoint and recreating the table with the dump data , = with or without referential > integrity , the problems still araise. >=20 > If we copy the data from the live table and do a create table aaa as sel= ect * from problematic_table; > the table aaa operations are normal and efficient. >=20 > This is why our investigation brought us to the folowing questions: >=20 > 1. Are postgresql data file name are hashed references to table name(as = oracle)? [~path to data EX:/var/log/pgsql/data/[arbitraty numbers]/= [datafile]]? >=20 > 2. If the data files are corrupted and we re-create is it possible it us= es the same files thus creating the same issue? >=20 > 3. Since we know that all the tables has that problems is there an inte= rnal table with undisclosed references to tables data files? > =09 > I hope the questions were clear. >=20 > Have a good day, and thank you in advance. >=20 >=20 > Eric Lauzon > [Recherche & D=C3=A9veloppement] > Above S=C3=A9curit=C3=A9 / Above Security > T=C3=A9l : (450) 430-8166 > Fax : (450) 430-1858 >=20 > AVERTISSEMENT CONCERNANT LA CONFIDENTIALIT=C3=89=20 >=20 > Le pr=C3=A9sent message est =C3=A0 l'usage exclusif du ou des destinatair= es mentionn=C3=A9s ci-dessus. Son contenu est confidentiel et peut =C3=AAtr= e assujetti au secret professionnel. Si vous avez re=C3=A7u le pr=C3=A9sent= message par erreur, veuillez nous en aviser imm=C3=A9diatement et le d=C3= =A9truire en vous abstenant d'en faire une copie, d'en divulguer le contenu= ou d'y donner suite. >=20 > CONFIDENTIALITY NOTICE >=20 > This communication is intended for the exclusive use of the addressee ide= ntified above. Its content is confidential and may contain privileged infor= mation. If you have received this communication by error, please notify the= sender and delete the message without copying or disclosing it. >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? >=20 > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Wed Mar 29 18:31:24 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BC10911F6279 for ; Wed, 29 Mar 2006 18:31: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 50561-02 for ; Wed, 29 Mar 2006 18:31:21 -0400 (AST) X-Greylist: delayed 04:32:15.439677 by SQLgrey- Received: from asmail001.abovesecurity.com (asmail001.abovesecurity.com [206.162.148.235]) by postgresql.org (Postfix) with ESMTP id AABA011F6278 for ; Wed, 29 Mar 2006 18:31:19 -0400 (AST) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Database possible corruption , unsolvable mystery Date: Wed, 29 Mar 2006 17:31:17 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Importance: normal Thread-Topic: [PERFORM] Database possible corruption , unsolvable mystery thread-index: AcZTfY7Tr4t1tCRfQUqXmwDKo3/tagAAJSFQ From: "Eric Lauzon" To: "Richard Huxton" Cc: 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: 200603/591 X-Sequence-Number: 18028 > -----Original Message----- > From: Richard Huxton [mailto:dev@archonet.com]=20 > Sent: 29 mars 2006 17:10 > To: Eric Lauzon > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Database possible corruption ,=20 > unsolvable mystery >=20 > Eric Lauzon wrote: > > This is why our investigation brought us to the folowing questions: > >=20 > > 1. Are postgresql data file name are hashed references to table=20 > > name(as oracle)? [~path to data EX:/var/log/pgsql/data/[arbitraty=20 > > numbers]/[datafile]]? >=20 > OID numbers - look in the contrib directory/package for the=20 > oid2name utility. This will give me the location of the databases file for a specific table or index? >=20 > > 2. If the data files are corrupted and we re-create is it=20 > possible it=20 > > uses the same files thus creating the same issue? >=20 > No >=20 humm why would it affect only original table , and copy of that table renamed back to the original table name but not the copy. example:=20 original table name : table_problem copy name : table_problem_copy renamed copyed table: table_problem > > 3. Since we know that all the tables has that problems is there an=20 > > internal table with undisclosed references to tables data files? I=20 > > hope the questions were clear. >=20 > You mean a system table that could account for your problems=20 > since it refers to some of your tables but not others? No. Well actualy its affecting only one table in a set of 5 table (referential integrity) and the table affected if the [referenced table] so it might be system related, but as stated if all the data is copied to a create table copy_of_problematic_table as select * from problematic_table there is 0 issue but as soon as copy_of_problematic_table is renamed to problematic_table the problems is back. But we have 2 orther set of 5 table in the same database built exactly the same way and it dosen't seem affected by the same problems, this is why i am wandering why the problems is recurent if internal postgresql data file are name bound ...and i am not taking about the OID. >=20 > The obvious places to start are: > 1. vacuum analyse verbose on the tables in question > This should show whether there are a lot of "dead" rows=20 > 2. explain analyse on problem queries > To see if the query plans are correct 3. SELECT * FROM pg_stat_??? > Assuming you have statistics gathering turned on, this=20 > might show unusual table accesses. Btw i can't give vacuum info right now because the source database is being dumped for complete re-insertion. Mabey later if this dosen't fix the problem , and as of information its 7.4.6 [i know its not the most rescent] but it is the way it is right now and we suspect the problem might have come from a power outage while there was a full vacuum and the reason why its only one table that has been affected is probably because it was the table being vacummed, but this is only an assumption right now and more info will folow if the problems persis after a full restore. Thanks you :) -elz AVERTISSEMENT CONCERNANT LA CONFIDENTIALITE=20 Le present message est a l'usage exclusif du ou des destinataires = mentionnes ci-dessus. Son contenu est confidentiel et peut etre = assujetti au secret professionnel. Si vous avez recu le present message = par erreur, veuillez nous en aviser immediatement et le detruire en vous = abstenant d'en faire une copie, d'en divulguer le contenu ou d'y donner = suite. CONFIDENTIALITY NOTICE This communication is intended for the exclusive use of the addressee = identified above. Its content is confidential and may contain privileged = information. If you have received this communication by error, please = notify the sender and delete the message without copying or disclosing = it. From pgsql-performance-owner@postgresql.org Wed Mar 29 18:49:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8A65911F626B for ; Wed, 29 Mar 2006 18:49: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 52694-02 for ; Wed, 29 Mar 2006 18:49:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpout07-04.prod.mesa1.secureserver.net (smtpout07-01.prod.mesa1.secureserver.net [64.202.165.230]) by postgresql.org (Postfix) with SMTP id 36A9411F6268 for ; Wed, 29 Mar 2006 18:49:42 -0400 (AST) Received: (qmail 18697 invoked from network); 29 Mar 2006 22:49:42 -0000 Received: from unknown (69.199.39.70) by smtpout07-04.prod.mesa1.secureserver.net (64.202.165.233) with ESMTP; 29 Mar 2006 22:49:42 -0000 Message-ID: <442B0FC7.4040303@ummon.com> Date: Wed, 29 Mar 2006 17:52:55 -0500 From: stef User-Agent: Mozilla Thunderbird 1.0.7-4mdk (X11/20051221) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Eric Lauzon CC: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: Database possible corruption , unsolvable mystery References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.06 required=5 tests=[AWL=0.060] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200603/592 X-Sequence-Number: 18029 Eric Lauzon wrote: >Mabey later if this dosen't fix the problem , and as of information its >7.4.6 [i know its not the most rescent] >but it is the way it is right now and we suspect the problem might have >come from a power outage while there was >a full vacuum and the reason why its only one table that has been >affected is probably because it was the table being vacummed, >but this is only an assumption right now and more info will folow if the >problems persis after a full restore. > > > Hrm, you know that you -should- upgrade to at least the latest 7.4 (7.4.13 I think is the most recent). looking from the changelogs, there are a few bugs that you could be hitting; 7.4.10 * Fix race condition in transaction log management There was a narrow window in which an I/O operation could be initiated for the wrong page, leading to an Assert failure or data corruption. 7.4.9 * Improve checking for partially-written WAL pages * Fix error that allowed VACUUM to remove ctid chains too soon, and add more checking in code that follows ctid links. This fixes a long-standing problem that could cause crashes in very rare circumstances. 7.4.8 * Repair race condition between relation extension and VACUUMThis could theoretically have caused loss of a page's worth of freshly-inserted data, although the scenario seems of very low probability. There are no known cases of it having caused more than an Assert failure and these are only the ones that appear 'notably' in the changelog. In short, I -really- -would- -strongly- -advise- you upgrading to 7.4.13. Personally, I would have made this my first step, especially if your data is important. There is no need for a dump/reload between minor point releases. Although there is a security fix in 7.4.8. Since the db is in a state of 'down' or repair, why not do it now ? two birds, one stone. Regards Stef From pgsql-performance-owner@postgresql.org Wed Mar 29 19:33:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8EE3D11F6279 for ; Wed, 29 Mar 2006 19:33: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 57257-07 for ; Wed, 29 Mar 2006 19:33:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from asmail001.abovesecurity.com (asmail001.abovesecurity.com [206.162.148.235]) by postgresql.org (Postfix) with ESMTP id 2329C11F6668 for ; Wed, 29 Mar 2006 19:33:21 -0400 (AST) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Database possible corruption , unsolvable mystery Date: Wed, 29 Mar 2006 18:33:21 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Importance: normal Thread-Topic: [PERFORM] Database possible corruption , unsolvable mystery thread-index: AcZTgxiHvT+ZL/iRQUKZ8XB53DNDtAABTE0Q From: "Eric Lauzon" To: "stef" Cc: "Richard Huxton" , 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: 200603/593 X-Sequence-Number: 18030 > Hrm, you know that you -should- upgrade to at least the latest 7.4 > (7.4.13 I think is the most recent). looking from the=20 > changelogs, there are a few bugs that you could be hitting; >=20 > 7.4.10 > * Fix race condition in transaction log management There=20 > was a narrow window in which an I/O operation could be=20 > initiated for the wrong page, leading to an Assert failure or=20 > data corruption. >=20 > 7.4.9 > * Improve checking for partially-written WAL pages > * Fix error that allowed VACUUM to remove ctid chains too=20 > soon, and add more checking in code that follows ctid links.=20 > This fixes a long-standing problem that could cause crashes=20 > in very rare circumstances. >=20 > 7.4.8 > * Repair race condition between relation extension and=20 > VACUUMThis could theoretically have caused loss of a page's=20 > worth of freshly-inserted data, although the scenario seems=20 > of very low probability. There are no known cases of it=20 > having caused more than an Assert failure >=20 > and these are only the ones that appear 'notably' in the=20 > changelog.=20 > In short, I -really- -would- -strongly- -advise- you=20 > upgrading to 7.4.13. Personally, I would have made this my=20 > first step, especially if your data is important. >=20 > There is no need for a dump/reload between minor point releases.=20 > Although there is a security fix in 7.4.8. >=20 > Since the db is in a state of 'down' or repair, why not=20 > do it now ?=20 > two birds, one stone. Thank you , this might be a good solution , but we have a bigger upgrade comming for 8.1.x later on, but considering that other things out of our hands might occur , we might seriously look into it after fixing the current problems :) [because we dont think that upgrading right now will magicly fix the problem we are having.] And on about 10 database [all 7.4.6] it is the first time this occur , and the symtom is really on one table, considering a few terabytes of data sparsed accros a few db, we might have been lucky yet but as of now its the first time=20 we can see performance hit only on "delete". But thanks alot for the hint. [even tho we never had some unexpected data failure/crash] beside this out of control human power failure that might have been the root of this [the database is still dumping ...few gigs :)] Thanks alot all for the help,and if we find the root cause we will give feed back. -elz AVERTISSEMENT CONCERNANT LA CONFIDENTIALITE=20 Le present message est a l'usage exclusif du ou des destinataires = mentionnes ci-dessus. Son contenu est confidentiel et peut etre = assujetti au secret professionnel. Si vous avez recu le present message = par erreur, veuillez nous en aviser immediatement et le detruire en vous = abstenant d'en faire une copie, d'en divulguer le contenu ou d'y donner = suite. CONFIDENTIALITY NOTICE This communication is intended for the exclusive use of the addressee = identified above. Its content is confidential and may contain privileged = information. If you have received this communication by error, please = notify the sender and delete the message without copying or disclosing = it. From pgsql-performance-owner@postgresql.org Wed Mar 29 21:09:38 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2190411F6642 for ; Wed, 29 Mar 2006 21:09: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 88818-02-2 for ; Wed, 29 Mar 2006 21:09:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tomts28-srv.bellnexxia.net (tomts28.bellnexxia.net [209.226.175.102]) by postgresql.org (Postfix) with ESMTP id 3FC2A11F665F for ; Wed, 29 Mar 2006 21:09:31 -0400 (AST) Received: from mail.oghma.on.ca ([69.159.214.132]) by tomts28-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with SMTP id <20060330010931.NNTJ16377.tomts28-srv.bellnexxia.net@mail.oghma.on.ca> for ; Wed, 29 Mar 2006 20:09:31 -0500 Received: (aITmail 29679 invoked by uid 8); 29 Mar 2006 22:33:31 -0000 Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) by music.oghma.on.ca with SMTP; 29 Mar 2006 22:33:31 -0000 From: Gorshkov Organization: Oghma Systems To: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of Date: Wed, 29 Mar 2006 19:01:59 -0500 User-Agent: KMail/1.7 References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> In-Reply-To: <1143575445.3625.87.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603291901.59320.listsubscriptions@oghma.on.ca> X-ORIGINAL-HEADER: Received: (aITmail 29679 invoked by uid 8); 29 Mar 2006 22:33:31 -0000 X-ORIGINAL-HEADER: Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) X-ORIGINAL-HEADER: by music.oghma.on.ca with SMTP; 29 Mar 2006 22:33:31 -0000 X-ORIGINAL-HEADER: From: Gorshkov X-ORIGINAL-HEADER: Organization: Oghma Systems X-ORIGINAL-HEADER: To: pgsql-performance@postgresql.org X-ORIGINAL-HEADER: Subject: Re: [PERFORM] Decide between Postgresql and Mysql (help of X-ORIGINAL-HEADER: Date: Wed, 29 Mar 2006 19:01:59 -0500 X-ORIGINAL-HEADER: User-Agent: KMail/1.7 X-ORIGINAL-HEADER: References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> X-ORIGINAL-HEADER: In-Reply-To: <1143575445.3625.87.camel@state.g2switchworks.com> X-ORIGINAL-HEADER: MIME-Version: 1.0 X-ORIGINAL-HEADER: Content-Type: text/plain; X-ORIGINAL-HEADER: charset="iso-8859-1" X-ORIGINAL-HEADER: Content-Transfer-Encoding: 7bit X-ORIGINAL-HEADER: Content-Disposition: inline X-ORIGINAL-HEADER: Message-Id: <200603291901.59320.listsubscriptions@oghma.on.ca> X-RECEIPT-TO[0]: 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: 200603/594 X-Sequence-Number: 18031 On Tuesday 28 March 2006 14:50, Scott Marlowe wrote: > On Tue, 2006-03-28 at 13:42, PFC wrote: > > > This is as much about the code in front of the database as the database > > > itself. You'll want to use an architecture that supports pooled > > > connections (java, php under lighttpd, etc...) and you'll want to look > > > > Well, anybody who uses PHP and cares about performance is already using > > lighttpd, no ? /flame on if you were *that* worried about performance, you wouldn't be using PHP or *any* interperted language /flame off sorry - couldn't resist it :-) From pgsql-performance-owner@postgresql.org Wed Mar 29 21:18:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C7F5111F626D for ; Wed, 29 Mar 2006 21: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 87312-07 for ; Wed, 29 Mar 2006 21:18:40 -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 BAFBE11F665F for ; Wed, 29 Mar 2006 21:18:37 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 9FE4D24FF2; Thu, 30 Mar 2006 09:18: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 12EB424FE2; Thu, 30 Mar 2006 09:18:33 +0800 (WST) Message-ID: <442B3282.8070204@calorieking.com> Date: Thu, 30 Mar 2006 09:21:06 +0800 From: Christopher Kings-Lynne User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Greg Quinn Cc: pgsql-performance@postgresql.org Subject: Re: Slow performance on Windows .NET and OleDb References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> In-Reply-To: <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> 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: chris.kings-lynne@calorieking.com 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: 200603/595 X-Sequence-Number: 18032 You should run the select query from the psql utility to determine if it's PostgreSQL, or your OleDb driver that's being slow. It takes like 185ms on one of my tables to get 7000 rows. Greg Quinn wrote: >> how many rows does it return ? a few, or a lot ? > > 3000 Rows - 7 seconds - very slow > > Which client library may have a problem? I am using OleDb, though > haven't tried the .NET connector yet. > > Network configuration?? I am running it off my home PC with no network. > It is P4 2.4 with 1 Gig Ram. Windows XP > > ----- Original Message ----- From: "PFC" > To: "Greg Quinn" > Sent: Wednesday, March 29, 2006 11:02 AM > Subject: Re: [PERFORM] Slow performance on Windows .NET and OleDb > > >> >>> select * from users >>> which returns 4 varchar fields, there is no where clause >> >> how many rows does it return ? a few, or a lot ? >> >>> Yes, I am running the default postgres config. Basically I have been >>> a MySQL user and thought I would like to check out PostGreSql. >> >> Good idea... >> >> From the tests I made, on simple queries like yours, with no joins, >> speed pf pg 8.x is about the same as mysql 5.x ; that is to say very >> fast. If you have a performance problem on something so basic, and >> moreover on windows, it smells like a problem in the client library, >> or in the TCP transport between client and server. >> I remember messages saying postgres on windows was slow some time ago >> here, and it turned out to be a problem in the network configuration >> of the machine. >> > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq -- Christopher Kings-Lynne Technical Manager CalorieKing Tel: +618.9389.8777 Fax: +618.9389.8444 chris.kings-lynne@calorieking.com www.calorieking.com From pgsql-performance-owner@postgresql.org Wed Mar 29 22:28:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F1B6C11F625B for ; Wed, 29 Mar 2006 22:28: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 05892-01 for ; Wed, 29 Mar 2006 22:28:27 -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 85E5111F625C for ; Wed, 29 Mar 2006 22:28:25 -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 k2U2UrqU029595; Wed, 29 Mar 2006 18:30:53 -0800 Message-ID: <442B4138.8030207@modgraph-usa.com> Date: Wed, 29 Mar 2006 18:23:52 -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: Gorshkov CC: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> In-Reply-To: <200603291901.59320.listsubscriptions@oghma.on.ca> 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.105 required=5 tests=[AWL=0.105] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200603/596 X-Sequence-Number: 18033 Gorshkov wrote: > /flame on > if you were *that* worried about performance, you wouldn't be using PHP or > *any* interperted language > /flame off > > sorry - couldn't resist it :-) I hope this was just a joke. You should be sure to clarify - there might be some newbie out there who thinks you are seriously suggesting coding major web sites in some old-fashioned compiled language. Craig From pgsql-performance-owner@postgresql.org Wed Mar 29 23:05:53 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8BDF411F6278 for ; Wed, 29 Mar 2006 23:05: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 34281-08 for ; Wed, 29 Mar 2006 23:05:51 -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 D1E4411F6276 for ; Wed, 29 Mar 2006 23:05:48 -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 k2U38RDC029707; Wed, 29 Mar 2006 19:08:27 -0800 Message-ID: <442B4A06.8060900@modgraph-usa.com> Date: Wed, 29 Mar 2006 19:01:26 -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: Gorshkov CC: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> <200603292307.29034.listsubscriptions@oghma.on.ca> In-Reply-To: <200603292307.29034.listsubscriptions@oghma.on.ca> 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.105 required=5 tests=[AWL=0.105] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200603/598 X-Sequence-Number: 18035 This is off-topic for this group so I'll just give a brief reply; I'm happy to carry on more just between the two of us... Gorshkov wrote: > That being said ..... what *is* the difference between coding a website - > major or otherwise - in an "old-fashioned" compiled language and a > non-compiled language, except for the amount of hoursepower and memory you > require? > > Old-fashioned doesn't mean bad, inappropriate, or inferior. It's just not the > latest-and-greatest, however it's currently defined by the geek fashion > police. Our experience coding web sites with C/C++ versus Perl is about a factor of ten in productivity. We only use C/C++ for CPU-intensive calculations, such as scientific prediction code. Everything else is Perl or Java. I recently re-coded 10,000 lines of C into 650 lines of Perl. Why? String handling, hash tables, and the simplicity of DBD/DBI. And there was no loss of performance, because the app was strictly I/O bound (that is, Postgres was I/O bound). Sure, the old app may not have been optimal, but we're talking about a factor of 15 reduction in lines of code. That's not "geek fashion", it's good engineering. Pick the best tool for the job, and learn how to use it. Craig From pgsql-performance-owner@postgresql.org Wed Mar 29 23:12:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E360111F6278 for ; Wed, 29 Mar 2006 23:12: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 80915-02 for ; Wed, 29 Mar 2006 23:12:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.clickspace.com (router2.clickspace.com [65.110.166.227]) by postgresql.org (Postfix) with ESMTP id 8645911F6271 for ; Wed, 29 Mar 2006 23:12:44 -0400 (AST) Received: from [192.168.5.166] ([68.145.108.192]) (authenticated user brendan@clickspace.com) by mail.clickspace.com (using TLSv1/SSLv3 with cipher RC4-SHA (128 bits)) for pgsql-performance@postgresql.org; Wed, 29 Mar 2006 20:12:44 -0700 Mime-Version: 1.0 (Apple Message framework v749.3) To: PostgreSQL Performance Message-Id: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-4-24908704; protocol="application/pkcs7-signature" From: Brendan Duddridge Subject: Query using SeqScan instead of IndexScan Date: Wed, 29 Mar 2006 20:12:28 -0700 X-Mailer: Apple Mail (2.749.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.103 required=5 tests=[AWL=0.102, HTML_MESSAGE=0.001] X-Spam-Score: 0.103 X-Spam-Level: X-Archive-Number: 200603/600 X-Sequence-Number: 18037 --Apple-Mail-4-24908704 Content-Type: multipart/alternative; boundary=Apple-Mail-3-24907700 --Apple-Mail-3-24907700 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hi, I have a query that is using a sequential scan instead of an index scan. I've turned off sequential scans and it is in fact faster with the index scan. Here's my before and after. Before: ssdev=# SET enable_seqscan TO DEFAULT; ssdev=# explain analyze select cp.product_id from category_product cp, product_attribute_value pav where cp.category_id = 1001082 and cp.product_id = pav.product_id; QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------ Hash Join (cost=25.52..52140.59 rows=5139 width=4) (actual time=4.521..2580.520 rows=19695 loops=1) Hash Cond: ("outer".product_id = "inner".product_id) -> Seq Scan on product_attribute_value pav (cost=0.00..40127.12 rows=2387312 width=4) (actual time=0.039..1469.295 rows=2385846 loops=1) -> Hash (cost=23.10..23.10 rows=970 width=4) (actual time=2.267..2.267 rows=1140 loops=1) -> Index Scan using x_category_product__category_id_fk_idx on category_product cp (cost=0.00..23.10 rows=970 width=4) (actual time=0.122..1.395 rows=1140 loops=1) Index Cond: (category_id = 1001082) Total runtime: 2584.221 ms (7 rows) After: ssdev=# SET enable_seqscan TO false; ssdev=# explain analyze select cp.product_id from category_product cp, product_attribute_value pav where cp.category_id = 1001082 and cp.product_id = pav.product_id; QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------------- Nested Loop (cost=0.00..157425.22 rows=5139 width=4) (actual time=0.373..71.177 rows=19695 loops=1) -> Index Scan using x_category_product__category_id_fk_idx on category_product cp (cost=0.00..23.10 rows=970 width=4) (actual time=0.129..1.438 rows=1140 loops=1) Index Cond: (category_id = 1001082) -> Index Scan using product_attribute_value__product_id_fk_idx on product_attribute_value pav (cost=0.00..161.51 rows=61 width=4) (actual time=0.016..0.053 rows=17 loops=1140) Index Cond: ("outer".product_id = pav.product_id) Total runtime: 74.747 ms (6 rows) There's quite a big difference in speed there. 2584.221 ms vs. 74.747 ms. Any ideas what I can do to improve this without turning sequential scanning off? Thanks, ____________________________________________________________________ Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com ClickSpace Interactive Inc. Suite L100, 239 - 10th Ave. SE Calgary, AB T2G 0V9 http://www.clickspace.com --Apple-Mail-3-24907700 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Hi,

I have a query that is = using a sequential scan instead of an index scan. I've turned off = sequential scans and it is in fact faster with the index = scan.

Here's = my before and after.

Before:

ssdev=3D# SET = enable_seqscan TO DEFAULT;
ssdev=3D# explain analyze select = cp.product_id
from category_product cp, = product_attribute_value pav
where cp.category_id =3D = 1001082 and cp.product_id =3D pav.product_id;

=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 QUERY = PLAN=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =
---------------------------------------------------------------= --------------------------------------------------------------------------= -------------------------------------
Hash Join=A0 = (cost=3D25.52..52140.59 rows=3D5139 width=3D4) (actual = time=3D4.521..2580.520 rows=3D19695 loops=3D1)
=A0=A0 Hash = Cond: ("outer".product_id =3D "inner".product_id)
=A0=A0 = ->=A0 Seq Scan on product_attribute_value pav=A0 (cost=3D0.00..40127.12= rows=3D2387312 width=3D4) (actual time=3D0.039..1469.295 rows=3D2385846 = loops=3D1)
=A0=A0 ->=A0 Hash=A0 (cost=3D23.10..23.10 = rows=3D970 width=3D4) (actual time=3D2.267..2.267 rows=3D1140 = loops=3D1)
=A0 =A0 =A0 =A0=A0 ->=A0 Index Scan using = x_category_product__category_id_fk_idx on category_product cp=A0 = (cost=3D0.00..23.10 rows=3D970 width=3D4) (actual time=3D0.122..1.395 = rows=3D1140 loops=3D1)
=A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 Index = Cond: (category_id =3D 1001082)
Total runtime: 2584.221 = ms
(7 rows)


After:

ssdev=3D# SET = enable_seqscan TO false;
ssdev=3D# explain analyze select = cp.product_id
from category_product cp, = product_attribute_value pav
where cp.category_id =3D = 1001082 and cp.product_id =3D pav.product_id;

=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 = QUERY PLAN=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
---------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------
Nested Loop=A0 = (cost=3D0.00..157425.22 rows=3D5139 width=3D4) (actual = time=3D0.373..71.177 rows=3D19695 loops=3D1)
=A0=A0 ->=A0 = Index Scan using x_category_product__category_id_fk_idx on = category_product cp=A0 (cost=3D0.00..23.10 rows=3D970 width=3D4) (actual = time=3D0.129..1.438 rows=3D1140 loops=3D1)
=A0 =A0 =A0 =A0=A0 = Index Cond: (category_id =3D 1001082)
=A0=A0 ->=A0 Index = Scan using product_attribute_value__product_id_fk_idx on = product_attribute_value pav=A0 (cost=3D0.00..161.51 rows=3D61 width=3D4) = (actual time=3D0.016..0.053 rows=3D17 loops=3D1140)
=A0 =A0 =A0 = =A0=A0 Index Cond: ("outer".product_id =3D pav.product_id)
= Total runtime: 74.747 ms
(6 rows)

There's quite a big = difference in speed there. 2584.221 ms vs. 74.747 ms.

Any ideas what I can do to = improve this without turning sequential scanning off?

Thanks,

_________________________________________________________= ___________
Brendan Duddridge=A0| CTO | 403-277-5591 x24 | =A0brendan@clickspace.com =

ClickSpace = Interactive Inc.
Suite L100, 239 - 10th Ave. SE
Calgary, AB = =A0T2G 0V9

http://www.clickspace.com=A0
=

= --Apple-Mail-3-24907700-- --Apple-Mail-4-24908704 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGIDCCAtkw ggJCoAMCAQICAw84ujANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwNzI5MjAxMTQzWhcNMDYwNzI5MjAxMTQzWjBIMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSUwIwYJKoZIhvcNAQkBFhZicmVuZGFuQGNsaWNrc3Bh Y2UuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqWfMCdFgKzXroGNqJuU3eyDC K/Gxts3mtmIdgcHGmUjRKdlBSfkmcCBUDPJIt4QQc91sY3h8Itg0EAsF+1yFECU6afn/1SEAHSDK 6Q86PclF58/Dux2FYNGpeIAw/lisZ2UCyIYoUiWtEDKCBq5jDuYzcGkFS5Csz+/rEL+BHTXQVqnS nUdUaXu9xdZn4wgjB/n65UEYRqr0LGN53CGsFcA9uC+ViS7WyBtzJcP02LMNT+cAZ7TKHw4Q/ZeG 5ptPgQHLTD2wza3GMbPQ4fYK6aNPA+lVzslLSCjyQpg55gVyQQlV0k/5zU5Q5m48ZtqwOqN+fPYd eIB7H5y1SFLd/wIDAQABozMwMTAhBgNVHREEGjAYgRZicmVuZGFuQGNsaWNrc3BhY2UuY29tMAwG A1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAT+6hGvStHoRO0OCHlJev31BpUlvPSpbYVKJN i5kCMF164sSX7j0IRvcyU6DfUuW7samTluXJbANyuX1ZIpXulGen5EEc2NV7eU/rMz6ExklMShTh ++azcvmMjOzTuqXi3ZsIjwzBBhqCB0U++kYlMlHEYla2qKLFbXY6PiH0a8swggM/MIICqKADAgEC AgENMA0GCSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBl MRIwEAYDVQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQL Ex9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29u YWwgRnJlZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5j b20wHhcNMDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFs IEZyZWVtYWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftO ucqZWh5owHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9x VsuvPAsH5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAe ZBlyYLf7AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJo dHRwOi8vY3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8E BAMCAQYwKQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3 DQEBBQUAA4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9 reFhYsPZOhl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAa WzVNd+NWIXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMG A1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMx CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjAzMzAwMzEyMjlaMCMGCSqGSIb3DQEJBDEW BBRhMic8TH6ANS6c/L4+Let55uE9VzB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUw IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIDDzi6MHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYD VQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMj VGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujANBgkqhkiG9w0BAQEFAASC AQBEpPhsJr4IjlpRPbEFO8slFshQNck0Nioy5YtsJ4li3T/UlkdaX/NgTmYhALdPIf+bQKSvID4T YVygMWvLKD+R/qCL4z68GTwB6rQ45vq2d41RIRhA/3jOA/5nyRsL8KjBnhsOaM6kbjuOuHbNXRLl Do2mnsT9h5OKOQYgWxw9r9kM73NMOiWISfeRHHv0UAflDG+T5kd5J56mMb1D3jYpyMaWBXPBneUL uGnSv3sb9MgfkCIiuICKh+Izzyh/oBpg+m12mxExcq/upVallHP+XHdzj31rWUGgZVWoIpsyEtcV z24NgA/o9gtc8EiZtd1fkZ52ET2WetNU0z7g4ckJAAAAAAAA --Apple-Mail-4-24908704-- From pgsql-performance-owner@postgresql.org Wed Mar 29 23:20:42 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A68B211F6359 for ; Wed, 29 Mar 2006 23:20: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 83679-09-2 for ; Wed, 29 Mar 2006 23:20:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.clickspace.com (router2.clickspace.com [65.110.166.227]) by postgresql.org (Postfix) with ESMTP id B084211F65DE for ; Wed, 29 Mar 2006 23:20:34 -0400 (AST) Received: from [192.168.5.166] ([68.145.108.192]) (authenticated user brendan@clickspace.com) by mail.clickspace.com (using TLSv1/SSLv3 with cipher RC4-SHA (128 bits)); Wed, 29 Mar 2006 20:20:33 -0700 In-Reply-To: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> References: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-6-25376996; protocol="application/pkcs7-signature" Message-Id: Cc: PostgreSQL Performance From: Brendan Duddridge Subject: Re: Query using SeqScan instead of IndexScan Date: Wed, 29 Mar 2006 20:20:17 -0700 To: Brendan Duddridge X-Mailer: Apple Mail (2.749.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.105 required=5 tests=[AWL=0.104, HTML_MESSAGE=0.001] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200603/601 X-Sequence-Number: 18038 --Apple-Mail-6-25376996 Content-Type: multipart/alternative; boundary=Apple-Mail-5-25376665 --Apple-Mail-5-25376665 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Oops. I forgot to mention that I was using PostgreSQL 8.1.3 on Mac OS X. Thanks, ____________________________________________________________________ Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com ClickSpace Interactive Inc. Suite L100, 239 - 10th Ave. SE Calgary, AB T2G 0V9 http://www.clickspace.com On Mar 29, 2006, at 8:12 PM, Brendan Duddridge wrote: > Hi, > > I have a query that is using a sequential scan instead of an index > scan. I've turned off sequential scans and it is in fact faster > with the index scan. > > Here's my before and after. > > Before: > > ssdev=# SET enable_seqscan TO DEFAULT; > ssdev=# explain analyze select cp.product_id > from category_product cp, product_attribute_value pav > where cp.category_id = 1001082 and cp.product_id = pav.product_id; > > > QUERY PLAN > ---------------------------------------------------------------------- > ---------------------------------------------------------------------- > ---------------------------------- > Hash Join (cost=25.52..52140.59 rows=5139 width=4) (actual > time=4.521..2580.520 rows=19695 loops=1) > Hash Cond: ("outer".product_id = "inner".product_id) > -> Seq Scan on product_attribute_value pav > (cost=0.00..40127.12 rows=2387312 width=4) (actual > time=0.039..1469.295 rows=2385846 loops=1) > -> Hash (cost=23.10..23.10 rows=970 width=4) (actual > time=2.267..2.267 rows=1140 loops=1) > -> Index Scan using > x_category_product__category_id_fk_idx on category_product cp > (cost=0.00..23.10 rows=970 width=4) (actual time=0.122..1.395 > rows=1140 loops=1) > Index Cond: (category_id = 1001082) > Total runtime: 2584.221 ms > (7 rows) > > > After: > > ssdev=# SET enable_seqscan TO false; > ssdev=# explain analyze select cp.product_id > from category_product cp, product_attribute_value pav > where cp.category_id = 1001082 and cp.product_id = pav.product_id; > > > QUERY PLAN > ---------------------------------------------------------------------- > ---------------------------------------------------------------------- > ----------------------------------------- > Nested Loop (cost=0.00..157425.22 rows=5139 width=4) (actual > time=0.373..71.177 rows=19695 loops=1) > -> Index Scan using x_category_product__category_id_fk_idx on > category_product cp (cost=0.00..23.10 rows=970 width=4) (actual > time=0.129..1.438 rows=1140 loops=1) > Index Cond: (category_id = 1001082) > -> Index Scan using product_attribute_value__product_id_fk_idx > on product_attribute_value pav (cost=0.00..161.51 rows=61 width=4) > (actual time=0.016..0.053 rows=17 loops=1140) > Index Cond: ("outer".product_id = pav.product_id) > Total runtime: 74.747 ms > (6 rows) > > There's quite a big difference in speed there. 2584.221 ms vs. > 74.747 ms. > > Any ideas what I can do to improve this without turning sequential > scanning off? > > Thanks, > > ____________________________________________________________________ > Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com > > ClickSpace Interactive Inc. > Suite L100, 239 - 10th Ave. SE > Calgary, AB T2G 0V9 > > http://www.clickspace.com > --Apple-Mail-5-25376665 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Oops. I forgot to mention that I = was using PostgreSQL 8.1.3 on Mac OS X.

Thanks,

_________________________________________________________= ___________
Brendan Duddridge=A0| CTO | 403-277-5591 x24 | =A0brendan@clickspace.com =

ClickSpace = Interactive Inc.
Suite L100, 239 - 10th Ave. SE
Calgary, AB = =A0T2G 0V9

http://www.clickspace.com=A0
=

On Mar 29, 2006, at 8:12 PM, Brendan Duddridge = wrote:

Hi,

I = have a query that is using a sequential scan instead of an index scan. = I've turned off sequential scans and it is in fact faster with the index = scan.

Here's = my before and after.

Before:

ssdev=3D# SET = enable_seqscan TO DEFAULT;
ssdev=3D# explain analyze select = cp.product_id
from category_product cp, = product_attribute_value pav
where cp.category_id =3D = 1001082 and cp.product_id =3D pav.product_id;

=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 QUERY = PLAN=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =
---------------------------------------------------------------= --------------------------------------------------------------------------= -------------------------------------
Hash Join=A0 = (cost=3D25.52..52140.59 rows=3D5139 width=3D4) (actual = time=3D4.521..2580.520 rows=3D19695 loops=3D1)
=A0=A0 Hash = Cond: ("outer".product_id =3D "inner".product_id)
=A0=A0 = ->=A0 Seq Scan on product_attribute_value pav=A0 (cost=3D0.00..40127.12= rows=3D2387312 width=3D4) (actual time=3D0.039..1469.295 rows=3D2385846 = loops=3D1)
=A0=A0 ->=A0 Hash=A0 (cost=3D23.10..23.10 = rows=3D970 width=3D4) (actual time=3D2.267..2.267 rows=3D1140 = loops=3D1)
=A0 =A0 =A0 =A0=A0 ->=A0 Index Scan using = x_category_product__category_id_fk_idx on category_product cp=A0 = (cost=3D0.00..23.10 rows=3D970 width=3D4) (actual time=3D0.122..1.395 = rows=3D1140 loops=3D1)
=A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 Index = Cond: (category_id =3D 1001082)
Total runtime: 2584.221 = ms
(7 rows)


After:

ssdev=3D# SET = enable_seqscan TO false;
ssdev=3D# explain analyze select = cp.product_id
from category_product cp, = product_attribute_value pav
where cp.category_id =3D = 1001082 and cp.product_id =3D pav.product_id;

=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 = QUERY PLAN=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
---------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------
Nested Loop=A0 = (cost=3D0.00..157425.22 rows=3D5139 width=3D4) (actual = time=3D0.373..71.177 rows=3D19695 loops=3D1)
=A0=A0 ->=A0 = Index Scan using x_category_product__category_id_fk_idx on = category_product cp=A0 (cost=3D0.00..23.10 rows=3D970 width=3D4) (actual = time=3D0.129..1.438 rows=3D1140 loops=3D1)
=A0 =A0 =A0 =A0=A0 = Index Cond: (category_id =3D 1001082)
=A0=A0 ->=A0 Index = Scan using product_attribute_value__product_id_fk_idx on = product_attribute_value pav=A0 (cost=3D0.00..161.51 rows=3D61 width=3D4) = (actual time=3D0.016..0.053 rows=3D17 loops=3D1140)
=A0 =A0 =A0 = =A0=A0 Index Cond: ("outer".product_id =3D pav.product_id)
= Total runtime: 74.747 ms
(6 rows)

There's quite a big = difference in speed there. 2584.221 ms vs. 74.747 ms.

Any ideas what I can do to = improve this without turning sequential scanning off?

Thanks,

_________________________________________________________= ___________
Brendan Duddridge=A0| CTO | 403-277-5591 x24 | =A0brendan@clickspace.com =

ClickSpace = Interactive Inc.
Suite L100, 239 - 10th Ave. SE
Calgary, AB = =A0T2G 0V9

http://www.clickspace.com=A0
=


= --Apple-Mail-5-25376665-- --Apple-Mail-6-25376996 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGIDCCAtkw ggJCoAMCAQICAw84ujANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwNzI5MjAxMTQzWhcNMDYwNzI5MjAxMTQzWjBIMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSUwIwYJKoZIhvcNAQkBFhZicmVuZGFuQGNsaWNrc3Bh Y2UuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqWfMCdFgKzXroGNqJuU3eyDC K/Gxts3mtmIdgcHGmUjRKdlBSfkmcCBUDPJIt4QQc91sY3h8Itg0EAsF+1yFECU6afn/1SEAHSDK 6Q86PclF58/Dux2FYNGpeIAw/lisZ2UCyIYoUiWtEDKCBq5jDuYzcGkFS5Csz+/rEL+BHTXQVqnS nUdUaXu9xdZn4wgjB/n65UEYRqr0LGN53CGsFcA9uC+ViS7WyBtzJcP02LMNT+cAZ7TKHw4Q/ZeG 5ptPgQHLTD2wza3GMbPQ4fYK6aNPA+lVzslLSCjyQpg55gVyQQlV0k/5zU5Q5m48ZtqwOqN+fPYd eIB7H5y1SFLd/wIDAQABozMwMTAhBgNVHREEGjAYgRZicmVuZGFuQGNsaWNrc3BhY2UuY29tMAwG A1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAT+6hGvStHoRO0OCHlJev31BpUlvPSpbYVKJN i5kCMF164sSX7j0IRvcyU6DfUuW7samTluXJbANyuX1ZIpXulGen5EEc2NV7eU/rMz6ExklMShTh ++azcvmMjOzTuqXi3ZsIjwzBBhqCB0U++kYlMlHEYla2qKLFbXY6PiH0a8swggM/MIICqKADAgEC AgENMA0GCSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBl MRIwEAYDVQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQL Ex9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29u YWwgRnJlZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5j b20wHhcNMDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFs IEZyZWVtYWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftO ucqZWh5owHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9x VsuvPAsH5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAe ZBlyYLf7AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJo dHRwOi8vY3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8E BAMCAQYwKQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3 DQEBBQUAA4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9 reFhYsPZOhl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAa WzVNd+NWIXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMG A1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMx CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjAzMzAwMzIwMThaMCMGCSqGSIb3DQEJBDEW BBRAeuMaln0PN31UxNBg8OOyVdWEYTB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUw IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIDDzi6MHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYD VQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMj VGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujANBgkqhkiG9w0BAQEFAASC AQBvFJcR3RobBgADgN0ZouqD8H8hEmQszdWUEgjj3F5asIPzkkan6S8vVJcYubG+xenk9ByZvWPK nPkYOsM/LBG/kya5so6/co99BehjDrRA8S7+ug0cEqF2FFrr21XsV0t+l7CF3DPW4soktiO97PS2 DQNar1H9+gAwTY2AQade97NZPA7ziA0AMaYaABN9xzJvDP55lIM1hU4Ewy/0uePYpj6UVy2yO7Zz x0i34abDan93l+48f1bdgJUniNQM6FQcRJkN2BbcxtRVw4nWDhBANa0gTRk7qyB0hrLqwGM+4cSu Y5NEyxcuwhUYXozwBqF6Sq8gC+AoQmYl6zHKq1kBAAAAAAAA --Apple-Mail-6-25376996-- From pgsql-performance-owner@postgresql.org Wed Mar 29 22:39:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 265A411F6263 for ; Wed, 29 Mar 2006 22:39: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 06233-07 for ; Wed, 29 Mar 2006 22:39:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tomts53-srv.bellnexxia.net (tomts53.bellnexxia.net [209.226.175.181]) by postgresql.org (Postfix) with ESMTP id 3E27411F625E for ; Wed, 29 Mar 2006 22:39:25 -0400 (AST) Received: from mail.oghma.on.ca ([69.159.214.132]) by tomts53-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with SMTP id <20060330023926.XMBE21477.tomts53-srv.bellnexxia.net@mail.oghma.on.ca> for ; Wed, 29 Mar 2006 21:39:26 -0500 Received: (aITmail 7359 invoked by uid 8); 30 Mar 2006 02:38:59 -0000 Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) by music.oghma.on.ca with SMTP; 30 Mar 2006 02:38:59 -0000 From: Gorshkov Organization: Oghma Systems To: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of Date: Wed, 29 Mar 2006 23:07:28 -0500 User-Agent: KMail/1.7 References: <1143559902.1241.16.camel@servidor> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> In-Reply-To: <442B4138.8030207@modgraph-usa.com> Cc: "Craig A. James" MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603292307.29034.listsubscriptions@oghma.on.ca> X-ORIGINAL-HEADER: Received: (aITmail 7359 invoked by uid 8); 30 Mar 2006 02:38:59 -0000 X-ORIGINAL-HEADER: Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) X-ORIGINAL-HEADER: by music.oghma.on.ca with SMTP; 30 Mar 2006 02:38:59 -0000 X-ORIGINAL-HEADER: From: Gorshkov X-ORIGINAL-HEADER: Organization: Oghma Systems X-ORIGINAL-HEADER: To: pgsql-performance@postgresql.org X-ORIGINAL-HEADER: Subject: Re: [PERFORM] Decide between Postgresql and Mysql (help of X-ORIGINAL-HEADER: Date: Wed, 29 Mar 2006 23:07:28 -0500 X-ORIGINAL-HEADER: User-Agent: KMail/1.7 X-ORIGINAL-HEADER: References: <1143559902.1241.16.camel@servidor> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> X-ORIGINAL-HEADER: In-Reply-To: <442B4138.8030207@modgraph-usa.com> X-ORIGINAL-HEADER: Cc: "Craig A. James" X-ORIGINAL-HEADER: MIME-Version: 1.0 X-ORIGINAL-HEADER: Content-Type: text/plain; X-ORIGINAL-HEADER: charset="iso-8859-1" X-ORIGINAL-HEADER: Content-Transfer-Encoding: 7bit X-ORIGINAL-HEADER: Content-Disposition: inline X-ORIGINAL-HEADER: Message-Id: <200603292307.29034.listsubscriptions@oghma.on.ca> X-RECEIPT-TO[0]: pgsql-performance@postgresql.org X-RECEIPT-TO[1]: cjames@modgraph-usa.com 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: 200603/597 X-Sequence-Number: 18034 On Wednesday 29 March 2006 21:23, Craig A. James wrote: > Gorshkov wrote: > > /flame on > > if you were *that* worried about performance, you wouldn't be using PHP > > or *any* interperted language > > /flame off > > > > sorry - couldn't resist it :-) > > I hope this was just a joke. You should be sure to clarify - there might > be some newbie out there who thinks you are seriously suggesting coding > major web sites in some old-fashioned compiled language. > well yes, it was meant as a joke ..... that's *usually* what a ";-)" means. That being said ..... what *is* the difference between coding a website - major or otherwise - in an "old-fashioned" compiled language and a non-compiled language, except for the amount of hoursepower and memory you require? Old-fashioned doesn't mean bad, inappropriate, or inferior. It's just not the latest-and-greatest, however it's currently defined by the geek fashion police. From pgsql-performance-owner@postgresql.org Wed Mar 29 23:11:32 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5773B11F6266 for ; Wed, 29 Mar 2006 23:11: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 81440-02 for ; Wed, 29 Mar 2006 23:11:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tomts27-srv.bellnexxia.net (tomts27-srv.bellnexxia.net [209.226.175.101]) by postgresql.org (Postfix) with ESMTP id D10B811F6552 for ; Wed, 29 Mar 2006 23:11:27 -0400 (AST) Received: from mail.oghma.on.ca ([69.159.214.132]) by tomts27-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with SMTP id <20060330031127.JTRM27598.tomts27-srv.bellnexxia.net@mail.oghma.on.ca> for ; Wed, 29 Mar 2006 22:11:27 -0500 Received: (aITmail 8626 invoked by uid 8); 30 Mar 2006 03:11:16 -0000 Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) by uther.oghma.on.a with SMTP; 30 Mar 2006 03:11:16 -0000 From: Gorshkov Organization: Oghma Systems To: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of Date: Wed, 29 Mar 2006 23:39:46 -0500 User-Agent: KMail/1.7 References: <1143559902.1241.16.camel@servidor> <200603292307.29034.listsubscriptions@oghma.on.ca> <442B4A06.8060900@modgraph-usa.com> In-Reply-To: <442B4A06.8060900@modgraph-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603292339.46415.listsubscriptions@oghma.on.ca> X-ORIGINAL-HEADER: Received: (aITmail 8626 invoked by uid 8); 30 Mar 2006 03:11:16 -0000 X-ORIGINAL-HEADER: Received: from lancelot.oghma.on.ca (listsubscriptions@oghma.on.ca@172.16.6.37) X-ORIGINAL-HEADER: by uther.oghma.on.a with SMTP; 30 Mar 2006 03:11:16 -0000 X-ORIGINAL-HEADER: From: Gorshkov X-ORIGINAL-HEADER: Organization: Oghma Systems X-ORIGINAL-HEADER: To: pgsql-performance@postgresql.org X-ORIGINAL-HEADER: Subject: Re: [PERFORM] Decide between Postgresql and Mysql (help of X-ORIGINAL-HEADER: Date: Wed, 29 Mar 2006 23:39:46 -0500 X-ORIGINAL-HEADER: User-Agent: KMail/1.7 X-ORIGINAL-HEADER: References: <1143559902.1241.16.camel@servidor> <200603292307.29034.listsubscriptions@oghma.on.ca> <442B4A06.8060900@modgraph-usa.com> X-ORIGINAL-HEADER: In-Reply-To: <442B4A06.8060900@modgraph-usa.com> X-ORIGINAL-HEADER: MIME-Version: 1.0 X-ORIGINAL-HEADER: Content-Type: text/plain; X-ORIGINAL-HEADER: charset="iso-8859-1" X-ORIGINAL-HEADER: Content-Transfer-Encoding: 7bit X-ORIGINAL-HEADER: Content-Disposition: inline X-ORIGINAL-HEADER: Message-Id: <200603292339.46415.listsubscriptions@oghma.on.ca> X-RECEIPT-TO[0]: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.051 required=5 tests=[AWL=0.051] X-Spam-Score: 0.051 X-Spam-Level: X-Archive-Number: 200603/599 X-Sequence-Number: 18036 On Wednesday 29 March 2006 22:01, Craig A. James wrote: > This is off-topic for this group so I'll just give a brief reply; I'm happy > to carry on more just between the two of us... > > Gorshkov wrote: > > That being said ..... what *is* the difference between coding a website - > > major or otherwise - in an "old-fashioned" compiled language and a > > non-compiled language, except for the amount of hoursepower and memory > > you require? > > > > Old-fashioned doesn't mean bad, inappropriate, or inferior. It's just not > > the latest-and-greatest, however it's currently defined by the geek > > fashion police. > > Our experience coding web sites with C/C++ versus Perl is about a factor of > ten in productivity. We only use C/C++ for CPU-intensive calculations, > such as scientific prediction code. Everything else is Perl or Java. > > I recently re-coded 10,000 lines of C into 650 lines of Perl. Why? String > handling, hash tables, and the simplicity of DBD/DBI. And there was no > loss of performance, because the app was strictly I/O bound (that is, > Postgres was I/O bound). Sure, the old app may not have been optimal, but > we're talking about a factor of 15 reduction in lines of code. Sounds to me like the C programmers in your past needed to learn how to re-use code and make libraries. That's not a function of the language - that's a function of the programmer. > > That's not "geek fashion", it's good engineering. Pick the best tool for > the job, and learn how to use it. > Thanks for making my point. You choose the best tool for the job, and sometimes it's "old-fashioned". Please remember that - there may be newbies out there who think that if they're not using the latest alpha-beta-zeta version .0006-a-r1, then they must be bad programmers. From pgsql-performance-owner@postgresql.org Thu Mar 30 01:14:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0334511F68FA for ; Thu, 30 Mar 2006 01:13: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 09971-03 for ; Thu, 30 Mar 2006 01:13:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id 2B76F11F68EC for ; Thu, 30 Mar 2006 01:13:56 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 9185087; Wed, 29 Mar 2006 21:16:53 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Database possible corruption , unsolvable mystery Date: Wed, 29 Mar 2006 21:14:27 -0800 User-Agent: KMail/1.8.2 Cc: "Eric Lauzon" , "stef" , "Richard Huxton" References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603292114.27866.josh@agliodbs.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: 200603/602 X-Sequence-Number: 18039 Eric, > Thank you , this might be a good solution , but we have a bigger upgrade > comming for 8.1.x later on, > but considering that other things out of our hands might occur , we > might seriously look into it after fixing > the current problems :) [because we dont think that upgrading right now > will magicly fix the problem we are having.] It probably won't, but it will prevent a re-occurance before you get around to the 8.1 upgrade. How much time have you wasted on this issue already, an issue which might not have occurred if you'd kept up with patch releases? A patch upgrade is what, 5 minutes of downtime? > And on about 10 database [all 7.4.6] it is the first time this occur , > and the symtom is really on one table, considering > a few terabytes of data sparsed accros a few db, we might have been > lucky yet but as of now its the first time > we can see performance hit only on "delete". Well, that would be in line with the issues 7.4.7-7.4.12. All of them require millesecond-timing to hit the bug. You're not likely to see it more than once. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Mar 30 01:18:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9543A11F6910 for ; Thu, 30 Mar 2006 01:18: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 97703-04 for ; Thu, 30 Mar 2006 01:18:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id 6226811F690C for ; Thu, 30 Mar 2006 01:18:18 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 9185111; Wed, 29 Mar 2006 21:21:15 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Query using SeqScan instead of IndexScan Date: Wed, 29 Mar 2006 21:18:49 -0800 User-Agent: KMail/1.8.2 Cc: Brendan Duddridge References: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> In-Reply-To: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603292118.50033.josh@agliodbs.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: 200603/603 X-Sequence-Number: 18040 Brenden, > Any ideas what I can do to improve this without turning sequential =C2=A0 > scanning off? Hmmm, looks like your row estimates are good. Which means it's probably yo= ur=20 postgresql.conf parameters which are off. Try the following, in the order= =20 below: 1) Raise effective_cache_size to 2/3 of your RAM (remember that ecs is in 8= k=20 pages). Test again. 2) Multiply all of the cpu_* costs by 0.3. Test again. 3) Lower random_page_cost by steps to 3.5, then 3.0, then 2.5, then 2.0,=20 testing each time. These are all runtime-settable parameters, so you can test them in one quer= y=20 window, then set them in the main postgresql.conf if they work. =2D-=20 Josh Berkus Sun Microsystems San Francisco From pgsql-performance-owner@postgresql.org Thu Mar 30 01:57:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 381B111F65A7 for ; Thu, 30 Mar 2006 01:57: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 30092-07 for ; Thu, 30 Mar 2006 01:57:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ctb-mesg1.saix.net (ctb-mesg1.saix.net [196.25.240.81]) by postgresql.org (Postfix) with ESMTP id E002B11F65EF for ; Thu, 30 Mar 2006 01:57:12 -0400 (AST) Received: from greg (dsl-145-175-122.telkomadsl.co.za [165.145.175.122]) by ctb-mesg1.saix.net (Postfix) with SMTP id F38E453B7 for ; Thu, 30 Mar 2006 07:57:07 +0200 (SAST) Message-ID: <000a01c653be$d312e3c0$0200a8c0@pta.homex.co.za> Reply-To: "Greg Quinn" From: "Greg Quinn" To: References: <000d01c65261$19a3fa40$0200a8c0@pta.homex.co.za> <20060328173213.GO75181@pervasive.com> <442977D7.5060508@commandprompt.com> <006c01c652f9$1ca9c420$0200a8c0@pta.homex.co.za> <000f01c6531f$fcbc0570$0200a8c0@pta.homex.co.za> <442B3282.8070204@calorieking.com> Subject: [Solved] Slow performance on Windows .NET and OleDb Date: Thu, 30 Mar 2006 07:57:23 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; 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.346 required=5 tests=[AWL=0.346] X-Spam-Score: 0.346 X-Spam-Level: X-Archive-Number: 200603/604 X-Sequence-Number: 18041 This problem was caused by the OleDb driver. I used a 3rd party .NET provider and it worked, 8000 rows in just over 100ms! Can somebody send me a sample connection string for the PostGreSql native .net driver please? I'm battling to find a valid connection string. Thanks From pgsql-performance-owner@postgresql.org Thu Mar 30 04:28:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 36A7711F68E4 for ; Thu, 30 Mar 2006 04: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 01804-03 for ; Thu, 30 Mar 2006 04:28:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fon.nation-net.com (213-2-2-26.uk.vianw.net [213.2.2.26]) by postgresql.org (Postfix) with ESMTP id E95B611F66D7 for ; Thu, 30 Mar 2006 04:27:58 -0400 (AST) Received: from fon.nation-net.com (localhost [127.0.0.1]) by fon.nation-net.com (Postfix) with ESMTP id 022FA136E92 for ; Thu, 30 Mar 2006 09:27:56 +0100 (BST) Received: from [194.24.251.10] (bum.net [194.24.251.10]) by fon.nation-net.com (Postfix) with ESMTP id E9CD6136E84 for ; Thu, 30 Mar 2006 09:27:55 +0100 (BST) Message-ID: <442B9625.1060408@laterooms.com> Date: Thu, 30 Mar 2006 09:26:13 +0100 From: Gavin Hamill User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: CREATE INDEX rather sluggish Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AV-Checked: ClamAV using ClamSMTP X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.143 required=5 tests=[AWL=0.143] X-Spam-Score: 0.143 X-Spam-Level: X-Archive-Number: 200603/605 X-Sequence-Number: 18042 Hullo, I have pg 8.1.3 on an 8-CPU AIX 5.3 box with 16GB of RAM, and I'm finding that it's taking an age to CREATE INDEX on a large table: Column | Type | Modifiers ----------------+------------------------+--------------------------------------------------------------------- ID | integer | not null default nextval(('public.keyword_id_seq'::text)::regclass) Text | character varying(200) | Longitude | numeric(16,5) | Latitude | numeric(16,5) | AreaID | integer | SearchCount | integer | not null default 0 Radius | integer | LanguageID | integer | KeywordType | character varying(20) | LowerText | character varying(200) | NumberOfHotels | integer | CountryID | integer | FriendlyText | character varying(200) | Indexes: 2006-03-29 21:39:38 BST LOG: duration: 41411.625 ms statement: CREATE INDEX ix_keyword_areaid ON "Keyword" USING btree ("AreaID"); 2006-03-29 21:42:46 BST LOG: duration: 188550.644 ms statement: CREATE INDEX ix_keyword_lonlat ON "Keyword" USING btree ("Longitude", "Latitude"); 2006-03-29 21:46:41 BST LOG: duration: 234864.571 ms statement: CREATE INDEX ix_keyword_lowertext ON "Keyword" USING btree ("LowerText"); 2006-03-29 21:52:32 BST LOG: duration: 350757.565 ms statement: CREATE INDEX ix_keyword_type ON "Keyword" USING btree ("KeywordType"); The table has just under six million rows - should it really be taking nearly six minutes to add an index? These log snippets were taking during a pg_restore on a newly created db, so there should be no issues with the table needing vacuuming. What parameters in the postgresql.conf are pertinent here? I have shared_buffers 120000 work_mem 16384 maintenance_work_mem = 262144 for starters... any advice would be warmly welcomed! Cheers, Gavin. From pgsql-performance-owner@postgresql.org Thu Mar 30 04:49:02 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EA02211F6AB1 for ; Thu, 30 Mar 2006 04:49: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 04326-06 for ; Thu, 30 Mar 2006 04:48:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id AE35711F6AAA for ; Thu, 30 Mar 2006 04:48:55 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (T8a9b.t.pppool.de [89.55.138.155]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id DFE22657CE; Thu, 30 Mar 2006 10:49:35 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 1378818148F56; Thu, 30 Mar 2006 10:29:52 +0200 (CEST) Message-ID: <442B96FF.7000906@logix-tt.com> Date: Thu, 30 Mar 2006 10:29:51 +0200 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: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> In-Reply-To: <442B4138.8030207@modgraph-usa.com> 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.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/606 X-Sequence-Number: 18043 Hi, Craig, Craig A. James wrote: > I hope this was just a joke. You should be sure to clarify - there > might be some newbie out there who thinks you are seriously suggesting > coding major web sites in some old-fashioned compiled language. No, but perhaps with a CMS that pregenerates static content, or http://www.tntnet.org/ 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 Mar 30 09:57:09 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3CE5311F6AD4 for ; Thu, 30 Mar 2006 09:57: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 86640-02 for ; Thu, 30 Mar 2006 09:57:08 -0400 (AST) X-Greylist: delayed 01:05:14.597765 by SQLgrey- Received: from mxfep02.bredband.com (mxfep02.bredband.com [195.54.107.73]) by postgresql.org (Postfix) with ESMTP id 790B611F6A9E for ; Thu, 30 Mar 2006 09:57:04 -0400 (AST) Received: from server.kregert.se ([85.225.9.50] [85.225.9.50]) by mxfep02.bredband.com with ESMTP id <20060330125148.RWZC29994.mxfep02.bredband.com@server.kregert.se> for ; Thu, 30 Mar 2006 14:51:48 +0200 Received: from knatte (knatte.kregert.se [10.10.0.9]) by server.kregert.se (8.13.5/8.13.4) with SMTP id k2U975mF018171 for ; Thu, 30 Mar 2006 11:07:05 +0200 Message-ID: <00b201c653da$a4409670$09000a0a@kregert.se> From: "Mattias Kregert" To: Subject: Automatic tuning of postgresql.conf parameters? Date: Thu, 30 Mar 2006 11:16:34 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00AF_01C653EB.67ADC820" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200603/619 X-Sequence-Number: 18056 This is a multi-part message in MIME format. ------=_NextPart_000_00AF_01C653EB.67ADC820 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have noticed that a lot of people have a hard time finding out how to = tune postgresql to suit their hardware. Are there any tools for automatic tuning of the parameters in = postgresql.conf? A simple program running some benchmarks on cpu & disk = speed, checking the amount of ram and so on and then suggesting = random/seq access cost, vacuum cust, sortmem/cache settings and so on? A = pg_tune utility? Maybe it could even look at runtime statistics/usage logs and help set = the number of shared buffers, chekpoints, autovacuum...? /Mattias (using the default config) ------=_NextPart_000_00AF_01C653EB.67ADC820 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have noticed that a lot of people = have a hard=20 time finding out how to tune postgresql to suit their = hardware.
 
Are there any tools for automatic = tuning of the=20 parameters in postgresql.conf? A = simple program=20 running some benchmarks on cpu & disk speed, checking the = amount of ram=20 and so on and then suggesting random/seq access cost, vacuum = cust,=20 sortmem/cache settings and so on? A pg_tune utility?
 
Maybe it could even look at = runtime=20 statistics/usage logs and help set the number of shared buffers, = chekpoints,=20 autovacuum...?
 
/Mattias (using the default = config)
 
------=_NextPart_000_00AF_01C653EB.67ADC820-- From pgsql-performance-owner@postgresql.org Thu Mar 30 07:59:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F1DA111F61D4 for ; Thu, 30 Mar 2006 07:59: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 32986-05 for ; Thu, 30 Mar 2006 07:59:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id C1E1C11F61D3 for ; Thu, 30 Mar 2006 07:59:11 -0400 (AST) Received: from bell.credativ.de (p50896DF7.dip.t-dialin.net [80.137.109.247]) (using TLSv1 with cipher EXP1024-RC4-SHA (56/128 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id 17AF3D75F4 for ; Thu, 30 Mar 2006 13:59:10 +0200 (CEST) From: Peter Eisentraut To: pgsql-performance@postgresql.org Subject: Index scan startup time User-Agent: KMail/1.8.3 MIME-Version: 1.0 Content-Disposition: inline X-UID: 2625 X-Length: 1379 Date: Thu, 30 Mar 2006 13:59:10 +0200 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200603301359.11038.peter_e@gmx.net> 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: 200603/607 X-Sequence-Number: 18044 [Apologies if this already went through. I don't see it in the archives.] Normally one expects that an index scan would have a startup time of nearly zero. Can anyone explain this: EXPLAIN ANALYZE select activity_id from activity where state in (10000, 10001) order by activity_id limit 100; QUERY PLAN Limit (cost=0.00..622.72 rows=100 width=8) (actual time=207356.054..207356.876 rows=100 loops=1) -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 loops=1) Filter: ((state = 10000) OR (state = 10001)) Total runtime: 207357.000 ms The table has seen VACUUM FULL and REINDEX before this. The plan choice and the statistics look right, but why does it take 3 minutes before doing anything? Or is the measurement of the actual start time inaccurate? This is quite reproducible, so it's not just a case of a temporary I/O bottleneck, say. (PostgreSQL 8.0.3) -- Peter Eisentraut http://developer.postgresql.org/~petere/ From pgsql-performance-owner@postgresql.org Thu Mar 30 08:02:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1981311F68D4 for ; Thu, 30 Mar 2006 08:02: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 30818-09 for ; Thu, 30 Mar 2006 08:02:13 -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 2875611F61D3 for ; Thu, 30 Mar 2006 08:02:11 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FOvqs-00047F-Ed; Thu, 30 Mar 2006 14:02:10 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FOvqo-0003PL-00; Thu, 30 Mar 2006 14:02:06 +0200 Date: Thu, 30 Mar 2006 14:02:06 +0200 From: "Steinar H. Gunderson" To: Peter Eisentraut Cc: pgsql-performance@postgresql.org Subject: Re: Index scan startup time Message-ID: <20060330120206.GA13075@uio.no> Mail-Followup-To: Peter Eisentraut , pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200603301359.11038.peter_e@gmx.net> 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+cvs20060126 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: 200603/608 X-Sequence-Number: 18045 On Thu, Mar 30, 2006 at 01:59:10PM +0200, Peter Eisentraut wrote: > EXPLAIN ANALYZE select activity_id from activity where state in (10000, 10001) > order by activity_id limit 100; > > QUERY PLAN > > Limit (cost=0.00..622.72 rows=100 width=8) (actual > time=207356.054..207356.876 rows=100 loops=1) > -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 > rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 loops=1) > Filter: ((state = 10000) OR (state = 10001)) > Total runtime: 207357.000 ms > > The table has seen VACUUM FULL and REINDEX before this. The index scan is by activity_id, not by state. Do you have an index on state at all? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Mar 30 08:06:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9B4A411F68D6 for ; Thu, 30 Mar 2006 08:06: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 34735-03 for ; Thu, 30 Mar 2006 08:06:13 -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 7FF7211F68D5 for ; Thu, 30 Mar 2006 08:06:11 -0400 (AST) Received: from osgiliath.mathom.us ([151.200.254.241]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IWX00MQUWA8HRQ3@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 30 Mar 2006 06:06:09 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id BCAC66E6B1 for ; Thu, 30 Mar 2006 07:06:06 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 00499-01-7 for ; Thu, 30 Mar 2006 07:06:06 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 179A26E81B; Thu, 30 Mar 2006 07:06:06 -0500 (EST) Date: Thu, 30 Mar 2006 07:06:05 -0500 From: Michael Stone Subject: Re: Index scan startup time In-reply-to: <200603301359.11038.peter_e@gmx.net> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20060330120604.GJ6811@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: Debian amavisd-new at mathom.us References: <200603301359.11038.peter_e@gmx.net> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.583 required=5 tests=[AWL=0.583] X-Spam-Score: 0.583 X-Spam-Level: X-Archive-Number: 200603/609 X-Sequence-Number: 18046 On Thu, Mar 30, 2006 at 01:59:10PM +0200, Peter Eisentraut wrote: >The table has seen VACUUM FULL and REINDEX before this. But no analyze? Mike Stone From pgsql-performance-owner@postgresql.org Thu Mar 30 08:24:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CCA6111F68EF for ; Thu, 30 Mar 2006 08:23: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 38102-02 for ; Thu, 30 Mar 2006 08:23:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id 94C1E11F68FA for ; Thu, 30 Mar 2006 08:23:57 -0400 (AST) Received: from bell.credativ.de (p50896DF7.dip.t-dialin.net [80.137.109.247]) (using TLSv1 with cipher EXP1024-RC4-SHA (56/128 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id 243F9D75F4; Thu, 30 Mar 2006 14:23:53 +0200 (CEST) From: Peter Eisentraut To: "Steinar H. Gunderson" Subject: Re: Index scan startup time Date: Thu, 30 Mar 2006 14:23:53 +0200 User-Agent: KMail/1.8.3 Cc: pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> <20060330120206.GA13075@uio.no> In-Reply-To: <20060330120206.GA13075@uio.no> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200603301423.54510.peter_e@gmx.net> 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: 200603/610 X-Sequence-Number: 18047 Am Donnerstag, 30. März 2006 14:02 schrieb Steinar H. Gunderson: > On Thu, Mar 30, 2006 at 01:59:10PM +0200, Peter Eisentraut wrote: > > EXPLAIN ANALYZE select activity_id from activity where state in (10000, > > 10001) order by activity_id limit 100; > > > > QUERY PLAN > > > > Limit (cost=0.00..622.72 rows=100 width=8) (actual > > time=207356.054..207356.876 rows=100 loops=1) > > -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 > > rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 > > loops=1) Filter: ((state = 10000) OR (state = 10001)) > > Total runtime: 207357.000 ms > > > > The table has seen VACUUM FULL and REINDEX before this. > > The index scan is by activity_id, not by state. Do you have an index on > state at all? There is an index on state as well but the column is not selective enough. -- Peter Eisentraut http://developer.postgresql.org/~petere/ From pgsql-performance-owner@postgresql.org Thu Mar 30 08:24:30 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5A53411F68FA for ; Thu, 30 Mar 2006 08:24: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 36335-08 for ; Thu, 30 Mar 2006 08:24:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id 2F06911F68FC for ; Thu, 30 Mar 2006 08:24:27 -0400 (AST) Received: from bell.credativ.de (p50896DF7.dip.t-dialin.net [80.137.109.247]) (using TLSv1 with cipher EXP1024-RC4-SHA (56/128 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id B280FD75F4; Thu, 30 Mar 2006 14:24:26 +0200 (CEST) From: Peter Eisentraut To: pgsql-performance@postgresql.org Subject: Re: Index scan startup time Date: Thu, 30 Mar 2006 14:24:27 +0200 User-Agent: KMail/1.8.3 Cc: Michael Stone References: <200603301359.11038.peter_e@gmx.net> <20060330120604.GJ6811@mathom.us> In-Reply-To: <20060330120604.GJ6811@mathom.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200603301424.27765.peter_e@gmx.net> 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: 200603/611 X-Sequence-Number: 18048 Am Donnerstag, 30. M�rz 2006 14:06 schrieb Michael Stone: > On Thu, Mar 30, 2006 at 01:59:10PM +0200, Peter Eisentraut wrote: > >The table has seen VACUUM FULL and REINDEX before this. > > But no analyze? ANALYZE as well, but the plan choice is not the point anyway. -- Peter Eisentraut http://developer.postgresql.org/~petere/ From pgsql-performance-owner@postgresql.org Thu Mar 30 08:31:43 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6C6EB11F662D for ; Thu, 30 Mar 2006 08:31: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 38355-06 for ; Thu, 30 Mar 2006 08:31:41 -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 19E1611F662E for ; Thu, 30 Mar 2006 08:31:40 -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 1FOwJP-0006KB-H9; Thu, 30 Mar 2006 14:31:39 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FOwJK-0003Ul-00; Thu, 30 Mar 2006 14:31:34 +0200 Date: Thu, 30 Mar 2006 14:31:34 +0200 From: "Steinar H. Gunderson" To: Peter Eisentraut Cc: pgsql-performance@postgresql.org Subject: Re: Index scan startup time Message-ID: <20060330123134.GA13408@uio.no> Mail-Followup-To: Peter Eisentraut , pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> <20060330120206.GA13075@uio.no> <200603301423.54510.peter_e@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200603301423.54510.peter_e@gmx.net> 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+cvs20060126 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: 200603/612 X-Sequence-Number: 18049 On Thu, Mar 30, 2006 at 02:23:53PM +0200, Peter Eisentraut wrote: >>> EXPLAIN ANALYZE select activity_id from activity where state in (10000, >>> 10001) order by activity_id limit 100; >>> >>> QUERY PLAN >>> >>> Limit (cost=0.00..622.72 rows=100 width=8) (actual >>> time=207356.054..207356.876 rows=100 loops=1) >>> -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 >>> rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 >>> loops=1) Filter: ((state = 10000) OR (state = 10001)) >>> Total runtime: 207357.000 ms >>> >>> The table has seen VACUUM FULL and REINDEX before this. >> The index scan is by activity_id, not by state. Do you have an index on >> state at all? > There is an index on state as well but the column is not selective enough. Well, it's logical enough; it scans along activity_id until it finds one with state=10000 or state=10001. You obviously have a _lot_ of records with low activity_id and state none of these two, so Postgres needs to scan all those records before it founds 100 it can output. This is the “startup cost” you're seeing. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Mar 30 08:35:44 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A0C6611F662D for ; Thu, 30 Mar 2006 08:35: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 40039-01 for ; Thu, 30 Mar 2006 08:35:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id B562211F662B for ; Thu, 30 Mar 2006 08:35:40 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (T8a9b.t.pppool.de [89.55.138.155]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id B497E656CF; Thu, 30 Mar 2006 14:36:21 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 31681184D981E; Thu, 30 Mar 2006 14:35:53 +0200 (CEST) Message-ID: <442BD0A9.8050805@logix-tt.com> Date: Thu, 30 Mar 2006 14:35:53 +0200 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: Peter Eisentraut Cc: pgsql-performance@postgresql.org, Michael Stone Subject: Re: Index scan startup time References: <200603301359.11038.peter_e@gmx.net> <20060330120604.GJ6811@mathom.us> <200603301424.27765.peter_e@gmx.net> In-Reply-To: <200603301424.27765.peter_e@gmx.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.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/613 X-Sequence-Number: 18050 Hi, Peter, Peter Eisentraut wrote: >>>The table has seen VACUUM FULL and REINDEX before this. >>But no analyze? > ANALYZE as well, but the plan choice is not the point anyway. Maybe you could add a combined Index on activity_id and state, or (if you use this kind of query more often) a conditional index on activity_id where state in (10000,10001). Btw, PostgreSQL 8.1 could AND two bitmap index scans on the activity and state indices, and get the result faster (i presume). 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 Mar 30 08:43:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3A9C211F662E for ; Thu, 30 Mar 2006 08:43: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 43155-02 for ; Thu, 30 Mar 2006 08:42:59 -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 38E4711F662B for ; Thu, 30 Mar 2006 08:42:58 -0400 (AST) Received: from osgiliath.mathom.us ([151.200.254.241]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IWX00BNPXZLTU03@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 30 Mar 2006 06:42:58 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id D75A16E81B; Thu, 30 Mar 2006 07:42:55 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 00546-05; Thu, 30 Mar 2006 07:42:55 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id AA85A6E84A; Thu, 30 Mar 2006 07:42:54 -0500 (EST) Date: Thu, 30 Mar 2006 07:42:53 -0500 From: Michael Stone Subject: Re: Index scan startup time In-reply-to: <20060330123134.GA13408@uio.no> To: pgsql-performance@postgresql.org Cc: Peter Eisentraut Mail-followup-to: pgsql-performance@postgresql.org, Peter Eisentraut Message-id: <20060330124251.GK6811@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 8BIT 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: Debian amavisd-new at mathom.us References: <200603301359.11038.peter_e@gmx.net> <20060330120206.GA13075@uio.no> <200603301423.54510.peter_e@gmx.net> <20060330123134.GA13408@uio.no> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.17 required=5 tests=[AWL=-0.066, RCVD_IN_SORBS_WEB=1.236] X-Spam-Score: 1.17 X-Spam-Level: * X-Archive-Number: 200603/614 X-Sequence-Number: 18051 On Thu, Mar 30, 2006 at 02:31:34PM +0200, Steinar H. Gunderson wrote: >Well, it's logical enough; it scans along activity_id until it finds one with >state=10000 or state=10001. You obviously have a _lot_ of records with low >activity_id and state none of these two, so Postgres needs to scan all those >records before it founds 100 it can output. This is the “startup cost” you're >seeing. Yes. And the estimates are bad enough (orders of magnitude) that I can't help but wonder whether pg could come up with a better plan with better statistics: >>>> -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 loops=1) Filter: ((state = 10000) OR (state = 10001)) Mike Stone From pgsql-performance-owner@postgresql.org Thu Mar 30 08:51:55 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3E96B11F6646 for ; Thu, 30 Mar 2006 08:51: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 41399-06 for ; Thu, 30 Mar 2006 08:51:54 -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 B1E6611F6641 for ; Thu, 30 Mar 2006 08:51:52 -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 1FOwcx-0007om-W6; Thu, 30 Mar 2006 14:51:52 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FOwct-0003Y9-00; Thu, 30 Mar 2006 14:51:47 +0200 Date: Thu, 30 Mar 2006 14:51:47 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Cc: Peter Eisentraut Subject: Re: Index scan startup time Message-ID: <20060330125147.GA13611@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org, Peter Eisentraut References: <200603301359.11038.peter_e@gmx.net> <20060330120206.GA13075@uio.no> <200603301423.54510.peter_e@gmx.net> <20060330123134.GA13408@uio.no> <20060330124251.GK6811@mathom.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20060330124251.GK6811@mathom.us> 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+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/615 X-Sequence-Number: 18052 On Thu, Mar 30, 2006 at 07:42:53AM -0500, Michael Stone wrote: > Yes. And the estimates are bad enough (orders of magnitude) that I can't > help but wonder whether pg could come up with a better plan with better > statistics: > >>>>> -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 >>>>> rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 >>>>> loops=1) Filter: ((state = 10000) OR (state = 10001)) Isn't the rows=100 here because of the LIMIT? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Mar 30 08:59:14 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AB89411F662E for ; Thu, 30 Mar 2006 08:59: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 42842-05 for ; Thu, 30 Mar 2006 08:59:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id 963BA11F6645 for ; Thu, 30 Mar 2006 08:59:11 -0400 (AST) Received: from bell.credativ.de (p50896DF7.dip.t-dialin.net [80.137.109.247]) (using TLSv1 with cipher EXP1024-RC4-SHA (56/128 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id A49C6D75F4; Thu, 30 Mar 2006 14:59:07 +0200 (CEST) From: Peter Eisentraut To: "Steinar H. Gunderson" Subject: Re: Index scan startup time Date: Thu, 30 Mar 2006 14:59:02 +0200 User-Agent: KMail/1.8.3 Cc: pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> <200603301423.54510.peter_e@gmx.net> <20060330123134.GA13408@uio.no> In-Reply-To: <20060330123134.GA13408@uio.no> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200603301459.03011.peter_e@gmx.net> 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: 200603/616 X-Sequence-Number: 18053 Am Donnerstag, 30. März 2006 14:31 schrieb Steinar H. Gunderson: > Well, it's logical enough; it scans along activity_id until it finds one > with state=10000 or state=10001. You obviously have a _lot_ of records with > low activity_id and state none of these two, so Postgres needs to scan all > those records before it founds 100 it can output. This is the “startup > cost” you're seeing. The startup cost is the cost until the plan is set up to start outputting rows. It is not the time until the first row is found. -- Peter Eisentraut http://developer.postgresql.org/~petere/ From pgsql-performance-owner@postgresql.org Thu Mar 30 09:00:50 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6CEC011F6653 for ; Thu, 30 Mar 2006 09:00: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 44656-09 for ; Thu, 30 Mar 2006 09:00:49 -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 C081911F664B for ; Thu, 30 Mar 2006 09:00:46 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FOwla-00006V-G3 for pgsql-performance@postgresql.org; Thu, 30 Mar 2006 15:00:46 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FOwlV-0003a6-00 for ; Thu, 30 Mar 2006 15:00:41 +0200 Date: Thu, 30 Mar 2006 15:00:41 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Index scan startup time Message-ID: <20060330130041.GA13732@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> <200603301423.54510.peter_e@gmx.net> <20060330123134.GA13408@uio.no> <200603301459.03011.peter_e@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200603301459.03011.peter_e@gmx.net> 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+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/617 X-Sequence-Number: 18054 On Thu, Mar 30, 2006 at 02:59:02PM +0200, Peter Eisentraut wrote: >> Well, it's logical enough; it scans along activity_id until it finds one >> with state=10000 or state=10001. You obviously have a _lot_ of records with >> low activity_id and state none of these two, so Postgres needs to scan all >> those records before it founds 100 it can output. This is the “startup >> cost” you're seeing. > The startup cost is the cost until the plan is set up to start outputting > rows. It is not the time until the first row is found. Well, point, my terminology was wrong. Still, what you're seeing is endless scanning for the first row. I don't know your distribution, but are you really sure state wouldn't have better selectivity? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Mar 30 09:29:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A0FE611F665B for ; Thu, 30 Mar 2006 09: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 71701-01 for ; Thu, 30 Mar 2006 09:29:25 -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 5E51011F6657 for ; Thu, 30 Mar 2006 09:29:22 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.132.172]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IWY006FN04W7FP1@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 30 Mar 2006 07:29:21 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 0FC4A6E638; Thu, 30 Mar 2006 08:29:18 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 01131-02-7; Thu, 30 Mar 2006 08:29:17 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 4E3A96E81B; Thu, 30 Mar 2006 08:29:17 -0500 (EST) Date: Thu, 30 Mar 2006 08:29:17 -0500 From: Michael Stone Subject: Re: Index scan startup time In-reply-to: <20060330125147.GA13611@uio.no> To: pgsql-performance@postgresql.org, Peter Eisentraut Mail-followup-to: pgsql-performance@postgresql.org, Peter Eisentraut Message-id: <20060330132915.GL6811@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: Debian amavisd-new at mathom.us References: <200603301359.11038.peter_e@gmx.net> <20060330120206.GA13075@uio.no> <200603301423.54510.peter_e@gmx.net> <20060330123134.GA13408@uio.no> <20060330124251.GK6811@mathom.us> <20060330125147.GA13611@uio.no> User-Agent: Mutt/1.5.11+cvs20060126 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: 200603/618 X-Sequence-Number: 18055 On Thu, Mar 30, 2006 at 02:51:47PM +0200, Steinar H. Gunderson wrote: >On Thu, Mar 30, 2006 at 07:42:53AM -0500, Michael Stone wrote: >> Yes. And the estimates are bad enough (orders of magnitude) that I can't >> help but wonder whether pg could come up with a better plan with better >> statistics: >> >>>>>> -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 >>>>>> rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 >>>>>> loops=1) Filter: ((state = 10000) OR (state = 10001)) > >Isn't the rows=100 here because of the LIMIT? Yes. I was looking at the other side; I thought pg could estimate how much work it would have to do to hit the limit, but double-checking it looks like it can't. Mike Stone From pgsql-performance-owner@postgresql.org Thu Mar 30 10:26:04 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7E96D11F6A9E for ; Thu, 30 Mar 2006 10:26: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 92412-08 for ; Thu, 30 Mar 2006 10:26: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 43A0A11F6648 for ; Thu, 30 Mar 2006 10:26:00 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2UEPvei014359; Thu, 30 Mar 2006 09:25:57 -0500 (EST) To: Michael Stone cc: pgsql-performance@postgresql.org, Peter Eisentraut Subject: Re: Index scan startup time In-reply-to: <20060330132915.GL6811@mathom.us> References: <200603301359.11038.peter_e@gmx.net> <20060330120206.GA13075@uio.no> <200603301423.54510.peter_e@gmx.net> <20060330123134.GA13408@uio.no> <20060330124251.GK6811@mathom.us> <20060330125147.GA13611@uio.no> <20060330132915.GL6811@mathom.us> Comments: In-reply-to Michael Stone message dated "Thu, 30 Mar 2006 08:29:17 -0500" Date: Thu, 30 Mar 2006 09:25:57 -0500 Message-ID: <14358.1143728757@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/620 X-Sequence-Number: 18057 Michael Stone writes: > Yes. I was looking at the other side; I thought pg could estimate how > much work it would have to do to hit the limit, but double-checking it > looks like it can't. Yes, it does, you just have to understand how to interpret the EXPLAIN output. Peter had Limit (cost=0.00..622.72 rows=100 width=8) (actual time=207356.054..207356.876 rows=100 loops=1) -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 loops=1) Filter: ((state = 10000) OR (state = 10001)) Total runtime: 207357.000 ms Notice that the total cost of the LIMIT node is estimated as far less than the total cost of the IndexScan node. That's exactly because the planner doesn't expect the indexscan to run to completion. The problem here appears to be a non-random correlation between state and activity, such that the desired state values are not randomly scattered in the activity sequence. The planner doesn't know about that correlation and hence can't predict the poor startup time. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 30 10:34:27 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0A07C11F6A9E for ; Thu, 30 Mar 2006 10:34: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 95373-06 for ; Thu, 30 Mar 2006 10:34:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id 831A311F6648 for ; Thu, 30 Mar 2006 10:34:24 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 86848016; Thu, 30 Mar 2006 06:34:23 -0800 From: "Dave Dutcher" To: "'Greg Quinn'" , Subject: Re: [Solved] Slow performance on Windows .NET and OleDb Date: Thu, 30 Mar 2006 08:34:23 -0600 Message-ID: <002a01c65407$0a302730$8300a8c0@tridecap.com> 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.2627 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal In-Reply-To: <000a01c653be$d312e3c0$0200a8c0@pta.homex.co.za> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/621 X-Sequence-Number: 18058 I use Npgsql, and the connection string I use is real simple: Server=192.168.0.36;Database=mydb;User Id=myuserid;Password=123456 Hope that helps, Dave > -----Original Message----- > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- > owner@postgresql.org] On Behalf Of Greg Quinn > Sent: Wednesday, March 29, 2006 11:57 PM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] [Solved] Slow performance on Windows .NET and OleDb > > This problem was caused by the OleDb driver. I used a 3rd party .NET > provider and it worked, 8000 rows in just over 100ms! > > Can somebody send me a sample connection string for the PostGreSql native > .net driver please? I'm battling to find a valid connection string. > > Thanks > > > > ---------------------------(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 Mar 30 11:16:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5F67211F6785 for ; Thu, 30 Mar 2006 11: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 98682-08 for ; Thu, 30 Mar 2006 11:16:18 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 33BAF11F66EE for ; Thu, 30 Mar 2006 11:16:15 -0400 (AST) Received: (qmail invoked by alias); 30 Mar 2006 15:16:15 -0000 Received: from dslb-084-063-051-003.pools.arcor-ip.net (EHLO colt.pezone.net) [84.63.51.3] by mail.gmx.net (mp042) with SMTP; 30 Mar 2006 17:16:15 +0200 X-Authenticated: #495269 From: Peter Eisentraut To: Tom Lane Subject: Re: Index scan startup time Date: Thu, 30 Mar 2006 17:16:13 +0200 User-Agent: KMail/1.8.3 Cc: Michael Stone , pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> <20060330132915.GL6811@mathom.us> <14358.1143728757@sss.pgh.pa.us> In-Reply-To: <14358.1143728757@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603301716.13840.peter_e@gmx.net> X-Y-GMX-Trusted: 0 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: 200603/622 X-Sequence-Number: 18059 Tom Lane wrote: > The problem here appears to be a non-random correlation between state > and activity, such that the desired state values are not randomly > scattered in the activity sequence. The planner doesn't know about > that correlation and hence can't predict the poor startup time. So from when to when is the startup time (the "x" in "x..y") actually measured? When does the clock start ticking and when does it stop? That is what's confusing me. -- Peter Eisentraut http://developer.postgresql.org/~petere/ From pgsql-performance-owner@postgresql.org Thu Mar 30 11:19:21 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0D4F111F68C8 for ; Thu, 30 Mar 2006 11:19: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 02517-01-2 for ; Thu, 30 Mar 2006 11:19: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 51CE211F678B for ; Thu, 30 Mar 2006 11:19:14 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2UFJD5u014853; Thu, 30 Mar 2006 10:19:13 -0500 (EST) To: Gavin Hamill cc: pgsql-performance@postgresql.org Subject: Re: CREATE INDEX rather sluggish In-reply-to: <442B9625.1060408@laterooms.com> References: <442B9625.1060408@laterooms.com> Comments: In-reply-to Gavin Hamill message dated "Thu, 30 Mar 2006 09:26:13 +0100" Date: Thu, 30 Mar 2006 10:19:13 -0500 Message-ID: <14852.1143731953@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/623 X-Sequence-Number: 18060 Gavin Hamill writes: > The table has just under six million rows - should it really be taking > nearly six minutes to add an index? Try running it with trace_sort enabled to get more info about where the time is going. We've been doing some considerable work on the sorting code in the last couple months, so 8.2 should be better, but I'd like to verify that you're not seeing something we don't know about. > maintenance_work_mem = 262144 Fooling with this might affect the results some. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 30 11:24:28 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 93C7811F65FC for ; Thu, 30 Mar 2006 11:24: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 00885-07 for ; Thu, 30 Mar 2006 11:24:27 -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 7733B11F65DE for ; Thu, 30 Mar 2006 11:24:25 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2UFONWR014953; Thu, 30 Mar 2006 10:24:23 -0500 (EST) To: Peter Eisentraut cc: Michael Stone , pgsql-performance@postgresql.org Subject: Re: Index scan startup time In-reply-to: <200603301716.13840.peter_e@gmx.net> References: <200603301359.11038.peter_e@gmx.net> <20060330132915.GL6811@mathom.us> <14358.1143728757@sss.pgh.pa.us> <200603301716.13840.peter_e@gmx.net> Comments: In-reply-to Peter Eisentraut message dated "Thu, 30 Mar 2006 17:16:13 +0200" Date: Thu, 30 Mar 2006 10:24:23 -0500 Message-ID: <14952.1143732263@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/624 X-Sequence-Number: 18061 Peter Eisentraut writes: > So from when to when is the startup time (the "x" in "x..y") actually > measured? When does the clock start ticking and when does it stop? > That is what's confusing me. The planner thinks of the startup time (the first estimated-cost number) as the time before the output scan can start, eg, time to do the sort in a sort node. EXPLAIN ANALYZE however reports the actual time until the first output row is delivered. When you've got a filter applied to the node result, as in this case, there can be a material difference between the two definitions, because of the time spent scanning rows that don't get past the filter. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Mar 30 13:09:01 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 35AEE11F694D for ; Thu, 30 Mar 2006 13: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 15969-03 for ; Thu, 30 Mar 2006 13:08: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 7FD9411F696A for ; Thu, 30 Mar 2006 13:08:55 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 35CF5336621; Thu, 30 Mar 2006 18:08:50 +0100 (BST) Subject: Re: CREATE INDEX rather sluggish From: Simon Riggs To: Gavin Hamill Cc: pgsql-performance@postgresql.org In-Reply-To: <442B9625.1060408@laterooms.com> References: <442B9625.1060408@laterooms.com> Content-Type: text/plain Date: Thu, 30 Mar 2006 18:08:44 +0100 Message-Id: <1143738524.13549.103.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.098 required=5 tests=[AWL=0.098] X-Spam-Score: 0.098 X-Spam-Level: X-Archive-Number: 200603/625 X-Sequence-Number: 18062 On Thu, 2006-03-30 at 09:26 +0100, Gavin Hamill wrote: > Hullo, I have pg 8.1.3 on an 8-CPU AIX 5.3 box with 16GB of RAM, and I'm > finding that it's taking an age to CREATE INDEX on a large table: > > Column | Type | Modifiers > ----------------+------------------------+--------------------------------------------------------------------- > ID | integer | not null default nextval(('public.keyword_id_seq'::text)::regclass) > Text | character varying(200) | > Longitude | numeric(16,5) | > Latitude | numeric(16,5) | > AreaID | integer | > SearchCount | integer | not null default 0 > Radius | integer | > LanguageID | integer | > KeywordType | character varying(20) | > LowerText | character varying(200) | > NumberOfHotels | integer | > CountryID | integer | > FriendlyText | character varying(200) | > Indexes: > > > 2006-03-29 21:39:38 BST LOG: duration: 41411.625 ms statement: CREATE INDEX ix_keyword_areaid ON "Keyword" USING btree ("AreaID"); > 2006-03-29 21:42:46 BST LOG: duration: 188550.644 ms statement: CREATE INDEX ix_keyword_lonlat ON "Keyword" USING btree ("Longitude", "Latitude"); > 2006-03-29 21:46:41 BST LOG: duration: 234864.571 ms statement: CREATE INDEX ix_keyword_lowertext ON "Keyword" USING btree ("LowerText"); > 2006-03-29 21:52:32 BST LOG: duration: 350757.565 ms statement: CREATE INDEX ix_keyword_type ON "Keyword" USING btree ("KeywordType"); > > The table has just under six million rows - should it really be taking > nearly six minutes to add an index? These log snippets were taking > during a pg_restore on a newly created db, so there should be no issues > with the table needing vacuuming. The index build time varies according to the number and type of the datatypes, as well as the distribution of values in the table. As well as the number of rows in the table. Note the x10 factor to index AreaID (integer) v KeywordType (vchar(20)) > What parameters in the postgresql.conf are pertinent here? I have > > shared_buffers 120000 > work_mem 16384 > maintenance_work_mem = 262144 Try trace_sort = on and then rerun the index builds to see what's happening there. We've speeded sort up by about 2.5 times in the current development version, but it does just run in single threaded mode so your 8 CPUs aren't helping there. Looks like you might be just over the maintenance_work_mem limit for the last index builds. You can try doubling maintenance_work_mem. The extended runtime for KeywordType is interesting in comparison to LowerText, which on the face of it is a longer column. My guess would be that LowerText is fairly unique and sorts quickly, whereas KeywordType is fairly non-unique with a high average row length that require complete string comparison before deciding it is actually the same value. You might want to try using codes rather than textual KeywordTypes. You might try using partial indexes also, along the lines of CREATE INDEX ix_keyword_type ON "Keyword" USING btree ("KeywordType") WHERE KeywordType IS NOT NULL; Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Thu Mar 30 13:19:25 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 49A3D11F676E for ; Thu, 30 Mar 2006 13:19: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 15568-09 for ; Thu, 30 Mar 2006 13:19:22 -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 A19EE11F65DE for ; Thu, 30 Mar 2006 13:19:21 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id EB00433618F; Thu, 30 Mar 2006 18:19:16 +0100 (BST) Subject: Re: Index scan startup time From: Simon Riggs To: Peter Eisentraut Cc: pgsql-performance@postgresql.org In-Reply-To: <200603301359.11038.peter_e@gmx.net> References: <200603301359.11038.peter_e@gmx.net> Content-Type: text/plain Date: Thu, 30 Mar 2006 18:19:11 +0100 Message-Id: <1143739151.13549.112.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.098 required=5 tests=[AWL=0.098] X-Spam-Score: 0.098 X-Spam-Level: X-Archive-Number: 200603/626 X-Sequence-Number: 18063 On Thu, 2006-03-30 at 13:59 +0200, Peter Eisentraut wrote: > Can anyone explain this: > > EXPLAIN ANALYZE select activity_id from activity where state in (10000, 10001) > order by activity_id limit 100; > > QUERY PLAN > > Limit (cost=0.00..622.72 rows=100 width=8) (actual > time=207356.054..207356.876 rows=100 loops=1) > -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 > rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 loops=1) > Filter: ((state = 10000) OR (state = 10001)) > Total runtime: 207357.000 ms > ...just adding to Tom's comments: The interesting thing about this query is it *looks* like the index is being used to retrieve the matching rows and so the startup time looks wrong. However the index is being used instead of a sort to satisfy the ORDER BY, with the state clauses being applied as after-scan filters since those columns aren't part of the index. So the Index Scan starts at the leftmost page and scans the whole index... If the query had chosen a sort, the startup time would have been easily understandable, but there's no indication from the EXPLAIN as to why the Index Scan exists. Perhaps it should be a TODO item to make the EXPLAIN say explicitly when an Index Scan is being used to provide sorted output? Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Thu Mar 30 14:04:11 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9A0B211F6924 for ; Thu, 30 Mar 2006 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 24603-08 for ; Thu, 30 Mar 2006 14:04:06 -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 D7D7411F6928 for ; Thu, 30 Mar 2006 14:04:05 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 05E8330925; Thu, 30 Mar 2006 20:04:04 +0200 (MET DST) From: Chris Browne X-Newsgroups: pgsql.performance Subject: Re: Decide between Postgresql and Mysql (help of Date: Thu, 30 Mar 2006 12:22:48 -0500 Organization: cbbrowne Computing Inc Lines: 35 Message-ID: <60acb7rgnr.fsf@dba2.int.libertyrms.com> References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:N/uucN30HhmrOd/NRVDRn5Lr2Ls= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.309 required=5 tests=[AWL=0.309] X-Spam-Score: 0.309 X-Spam-Level: X-Archive-Number: 200603/627 X-Sequence-Number: 18064 cjames@modgraph-usa.com ("Craig A. James") writes: > Gorshkov wrote: >> /flame on >> if you were *that* worried about performance, you wouldn't be using >> PHP or *any* interperted language >> /flame off >> sorry - couldn't resist it :-) > > I hope this was just a joke. You should be sure to clarify - there > might be some newbie out there who thinks you are seriously > suggesting coding major web sites in some old-fashioned compiled > language. Actually, this seems not so bad a point... If people are so interested in micro-managing certain bits of how performance works, then it seems an excellent question to ask why NOT write all the CGIs in C. After all, CGI in C *won't* suffer from the performance troubles associated with repetitively loading in Perl/PHP frameworks (which is why things like FastCGI, mod_perl, and such came about), and you can get a fair level of assurance that the compiled C won't be the performance bottleneck. And yes, it does become natural to ask "why not write CGIs in ASM?" ;-) -- (format nil "~S@~S" "cbbrowne" "acm.org") http://www3.sympatico.ca/cbbrowne/lisp.html "When I was a boy of fourteen, my father was so ignorant I could hardly stand to have the old man around. But when I got to be twenty-one, I was astonished at how much the old man had learned in seven years." -- Mark Twain From pgsql-performance-owner@postgresql.org Thu Mar 30 15:21:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B308611F66F3 for ; Thu, 30 Mar 2006 15:21: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 50430-07 for ; Thu, 30 Mar 2006 15:21:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 929C711F6657 for ; Thu, 30 Mar 2006 15:21:30 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Thu, 30 Mar 2006 19:21:30 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 30 Mar 2006 13:21:30 -0600 Subject: Re: Decide between Postgresql and Mysql (help of From: Scott Marlowe To: Chris Browne Cc: pgsql-performance@postgresql.org In-Reply-To: <60acb7rgnr.fsf@dba2.int.libertyrms.com> References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> <60acb7rgnr.fsf@dba2.int.libertyrms.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1143746489.26940.34.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 30 Mar 2006 13:21:30 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.139 required=5 tests=[AWL=0.138, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.139 X-Spam-Level: X-Archive-Number: 200603/628 X-Sequence-Number: 18065 On Thu, 2006-03-30 at 11:22, Chris Browne wrote: > cjames@modgraph-usa.com ("Craig A. James") writes: > > > Gorshkov wrote: > >> /flame on > >> if you were *that* worried about performance, you wouldn't be using > >> PHP or *any* interperted language > >> /flame off > >> sorry - couldn't resist it :-) > > > > I hope this was just a joke. You should be sure to clarify - there > > might be some newbie out there who thinks you are seriously > > suggesting coding major web sites in some old-fashioned compiled > > language. > > Actually, this seems not so bad a point... > > If people are so interested in micro-managing certain bits of how > performance works, then it seems an excellent question to ask why NOT > write all the CGIs in C. > > After all, CGI in C *won't* suffer from the performance troubles > associated with repetitively loading in Perl/PHP frameworks (which is > why things like FastCGI, mod_perl, and such came about), and you can > get a fair level of assurance that the compiled C won't be the > performance bottleneck. > > And yes, it does become natural to ask "why not write CGIs in ASM?" > ;-) But as an aside, I've been load testing our web application. We have, in the test farm, two tomcat servers feeding into three jboss servers, feeding into a database farm (oracle and postgresql, doing different things, oracle is the transaction engine, postgresql is the "data collection bucket" so to speak.) Our tomcat servers sit at 10% load, the jboss servers sit at 20 to 40% load, and the Oracle server sits at 100% load. And the thing is, while we can add load balanced tomcat and jboss servers as need be, and get nearly linear scaling from them, we can't do the same for the database. That's going to require vertical scaling. And that, nowadays, is generally the state of web development. It's not the language you're using to write it in, it's how efficiently you're using your database. We can probably tweak the system we're testing now and get more from our databases by adjusting how hibernate hits them, and the types of queries that it's throwing, but in the long run, the bottleneck will always be the database server, because we can throw relatively small amounts of money at the other layers if they happen to be bogging down. Not so much with the database. From pgsql-performance-owner@postgresql.org Thu Mar 30 16:23:26 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0E8FC11F6609 for ; Thu, 30 Mar 2006 16:23: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 11707-04 for ; Thu, 30 Mar 2006 16:23:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fon.nation-net.com (213-2-2-26.uk.vianw.net [213.2.2.26]) by postgresql.org (Postfix) with ESMTP id 91B1D11F660A for ; Thu, 30 Mar 2006 16:23:23 -0400 (AST) Received: from fon.nation-net.com (localhost [127.0.0.1]) by fon.nation-net.com (Postfix) with ESMTP id 4826F136EE9 for ; Thu, 30 Mar 2006 21:23:22 +0100 (BST) Received: from [194.24.251.10] (bum.net [194.24.251.10]) by fon.nation-net.com (Postfix) with ESMTP id 3918D136EC7 for ; Thu, 30 Mar 2006 21:23:22 +0100 (BST) Message-ID: <442C3DD2.3060706@laterooms.com> Date: Thu, 30 Mar 2006 21:21:38 +0100 From: Gavin Hamill User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: CREATE INDEX rather sluggish References: <442B9625.1060408@laterooms.com> <14852.1143731953@sss.pgh.pa.us> In-Reply-To: <14852.1143731953@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AV-Checked: ClamAV using ClamSMTP 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: 200603/629 X-Sequence-Number: 18066 Tom Lane wrote: >Gavin Hamill writes: > > >>The table has just under six million rows - should it really be taking >>nearly six minutes to add an index? >> >> > >Try running it with trace_sort enabled to get more info about where the >time is going. > >We've been doing some considerable work on the sorting code in the last >couple months, so 8.2 should be better, but I'd like to verify that >you're not seeing something we don't know about. > > > OKies, I dropped the db, created again so it's all clean, ran pg_restore again with trace_sort on - here's the output from one of the larger CREATE INDEXes: 2006-03-30 16:48:53 BST LOG: begin index sort: unique = f, workMem = 262144, randomAccess = f 2006-03-30 16:49:04 BST LOG: switching to external sort: CPU 0.88s/9.99u sec elapsed 10.90 sec 2006-03-30 16:49:44 BST LOG: autovacuum: processing database "postgres" 2006-03-30 16:50:38 BST LOG: performsort starting: CPU 1.69s/102.73u sec elapsed 104.58 sec 2006-03-30 16:50:44 BST LOG: autovacuum: processing database "laterooms" 2006-03-30 16:51:44 BST LOG: autovacuum: processing database "postgres" 2006-03-30 16:52:23 BST LOG: finished writing run 1: CPU 2.40s/206.53u sec elapsed 209.30 sec 2006-03-30 16:52:39 BST LOG: finished writing final run 2: CPU 2.51s/222.98u sec elapsed 225.89 sec 2006-03-30 16:52:40 BST LOG: performsort done (except final merge): CPU 2.59s/223.99u sec elapsed 226.98 sec 2006-03-30 16:52:44 BST LOG: autovacuum: processing database "laterooms" 2006-03-30 16:52:53 BST LOG: external sort ended, 21292 disk blocks used: CPU 3.65s/233.10u sec elapsed 239.35 sec 2006-03-30 16:52:53 BST LOG: duration: 239381.535 ms statement: CREATE INDEX ix_keyword_lowertext ON "Keyword" USING btree ("LowerText"); During all this, there's been about 900KB/sec of disk activity. The disks are RAID1 and will happily sustain 50MB/sec with minimal system overhead. I'm guessing then that an external sort means disk-based... >>maintenance_work_mem = 262144 >> >> > >Fooling with this might affect the results some. > > OK will tinker with that - it's not a massive problem since I hope I never have to do a pg_restore once the live server is running fulltime :) Right - I bumped maintenance_work_mem up to 1GB, tried dropping the index and recreating, and sure enough it's an internal sort now, chopping 10% off the time taken: 2006-03-30 21:15:57 BST LOG: begin index sort: unique = f, workMem = 1048576, randomAccess = f 2006-03-30 21:16:03 BST LOG: autovacuum: processing database "laterooms" 2006-03-30 21:16:12 BST LOG: performsort starting: CPU 1.20s/13.85u sec elapsed 15.07 sec 2006-03-30 21:17:03 BST LOG: autovacuum: processing database "laterooms" 2006-03-30 21:18:03 BST LOG: autovacuum: processing database "laterooms" 2006-03-30 21:19:03 BST LOG: autovacuum: processing database "laterooms" 2006-03-30 21:19:28 BST LOG: performsort done: CPU 1.20s/210.34u sec elapsed 211.69 sec 2006-03-30 21:19:36 BST LOG: internal sort ended, 336538 KB used: CPU 2.06s/212.61u sec elapsed 218.80 sec 2006-03-30 21:19:36 BST LOG: duration: 218847.055 ms statement: CREATE INDEX ix_keyword_lowertext on "Keyword" USING btree ("LowerText"); If that's reasonable performance from 8.1, then that's fine - I just didn't want to be inadvertantly running way under average :) Cheers, Gavin. From pgsql-performance-owner@postgresql.org Thu Mar 30 16:45:36 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 28B9D11F665A for ; Thu, 30 Mar 2006 16:45: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 12763-09 for ; Thu, 30 Mar 2006 16:45:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fon.nation-net.com (213-2-2-26.uk.vianw.net [213.2.2.26]) by postgresql.org (Postfix) with ESMTP id A580211F6672 for ; Thu, 30 Mar 2006 16:45:32 -0400 (AST) Received: from fon.nation-net.com (localhost [127.0.0.1]) by fon.nation-net.com (Postfix) with ESMTP id 38601136EC7 for ; Thu, 30 Mar 2006 21:45:32 +0100 (BST) Received: from eddie.acentral.co.uk (80-192-144-33.cable.ubr04.pres.blueyonder.co.uk [80.192.144.33]) by fon.nation-net.com (Postfix) with ESMTP id 10C6E136E8B for ; Thu, 30 Mar 2006 21:45:32 +0100 (BST) Received: from eddie.acentral.co.uk (eddie.acentral.co.uk [127.0.0.1]) by eddie.acentral.co.uk (Postfix) with ESMTP id 347EF75D9F for ; Thu, 30 Mar 2006 21:45:34 +0100 (BST) Received: from localhost.localdomain (unknown [10.0.0.29]) by eddie.acentral.co.uk (Postfix) with SMTP id 1A11875D13 for ; Thu, 30 Mar 2006 21:45:34 +0100 (BST) Date: Thu, 30 Mar 2006 21:45:31 +0100 From: Gavin Hamill To: pgsql-performance@postgresql.org Subject: Re: CREATE INDEX rather sluggish Message-Id: <20060330214531.ce6620e1.gdh@laterooms.com> In-Reply-To: <1143738524.13549.103.camel@localhost.localdomain> References: <442B9625.1060408@laterooms.com> <1143738524.13549.103.camel@localhost.localdomain> X-Mailer: Sylpheed version 2.1.1 (GTK+ 2.8.6; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-AV-Checked: ClamAV using ClamSMTP X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.575 required=5 tests=[AWL=0.575] X-Spam-Score: 0.575 X-Spam-Level: X-Archive-Number: 200603/630 X-Sequence-Number: 18067 On Thu, 30 Mar 2006 18:08:44 +0100 Simon Riggs wrote: Hello again Simon :) > The index build time varies according to the number and type of the > datatypes, as well as the distribution of values in the table. As well > as the number of rows in the table. > > Note the x10 factor to index AreaID (integer) v KeywordType (vchar(20)) Fair enough. :) Is there much of a performance increase by using fixed-length character fields instead of varchars? > Try trace_sort = on and then rerun the index builds to see what's > happening there. We've speeded sort up by about 2.5 times in the current > development version, but it does just run in single threaded mode so > your 8 CPUs aren't helping there. Yum - I look forward to the 8.2 release =) > Looks like you might be just over the maintenance_work_mem limit for the > last index builds. You can try doubling maintenance_work_mem. You were right - needed ~370MB ... I'm happy to alloc 1GB to allow for db growth.. > The extended runtime for KeywordType is interesting in comparison to > LowerText, which on the face of it is a longer column. My guess would be > that LowerText is fairly unique and sorts quickly, whereas KeywordType > is fairly non-unique with a high average row length that require > complete string comparison before deciding it is actually the same > value. From looking at a few samples of the millions of rows it seems that it's actually KeywordType that's more unique - LowerText is simply an lowercase representation of the name of this search-keyword, so it's much less unique. Fun stuff :) > You might want to try using codes rather than textual KeywordTypes. That makes sense - I can't get a grip on the data in KeywordType at the moment .. many are more obvious like 'RGN' 'AREA' 'MKT' 'LK' for Region, Area, Market and Lake, but many other rows have '1'. > You might try using partial indexes also, along the lines of > > CREATE INDEX ix_keyword_type ON "Keyword" USING btree ("KeywordType") WHERE KeywordType IS NOT NULL; Well, each row does have a KeywordType, so no row has a NULL entry... > Best Regards, Simon Riggs Cheers :) Gavin. From pgsql-performance-owner@postgresql.org Thu Mar 30 17:31:33 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 831AD11F674B for ; Thu, 30 Mar 2006 17:31: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 23175-05 for ; Thu, 30 Mar 2006 17:31:31 -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 75ECF11F6604 for ; Thu, 30 Mar 2006 17:31:28 -0400 (AST) Received: (qmail 32181 invoked from network); 30 Mar 2006 23:31:26 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 30 Mar 2006 23:31:26 +0200 To: "Scott Marlowe" , "Chris Browne" Cc: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> <60acb7rgnr.fsf@dba2.int.libertyrms.com> <1143746489.26940.34.camel@state.g2switchworks.com> Message-ID: Date: Thu, 30 Mar 2006 23:31:25 +0200 From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <1143746489.26940.34.camel@state.g2switchworks.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/631 X-Sequence-Number: 18068 >> And yes, it does become natural to ask "why not write CGIs in ASM?" >> ;-) Personally, I'd code it in brainfuck, for aesthetic reasons. > And that, nowadays, is generally the state of web development. It's not > the language you're using to write it in, it's how efficiently you're > using your database. We can probably tweak the system we're testing now > and get more from our databases by adjusting how hibernate hits them, > and the types of queries that it's throwing, but in the long run, the > bottleneck will always be the database server, because we can throw > relatively small amounts of money at the other layers if they happen to > be bogging down. Not so much with the database. So, one wonders why some use 70's languages like Java instead of Lisp or Python, which are slower, but a lot more powerful and faster to develop in... (and don't have hibernate, which is a big bonus) (why do you think I don't like Java ?) From pgsql-performance-owner@postgresql.org Thu Mar 30 18:36:49 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BC62D11F6238 for ; Thu, 30 Mar 2006 18:36: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 25396-06 for ; Thu, 30 Mar 2006 18:36:46 -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 CB78A11F6208 for ; Thu, 30 Mar 2006 18:36:44 -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 1FP5kx-0004lc-89 for pgsql-performance@postgresql.org; Fri, 31 Mar 2006 00:36:43 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FP5ks-0004K0-00 for ; Fri, 31 Mar 2006 00:36:38 +0200 Date: Fri, 31 Mar 2006 00:36:38 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of Message-ID: <20060330223638.GA16558@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> <60acb7rgnr.fsf@dba2.int.libertyrms.com> <1143746489.26940.34.camel@state.g2switchworks.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+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/632 X-Sequence-Number: 18069 On Thu, Mar 30, 2006 at 11:31:25PM +0200, PFC wrote: > So, one wonders why some use 70's languages like Java instead of > Lisp or Python, which are slower, but a lot more powerful and faster to > develop in... > (and don't have hibernate, which is a big bonus) > (why do you think I don't like Java ?) Python may not have Hibernate, but it has even worse stuff trying to do about the same thing. :-) Anyhow, this is rapidly becoming offtopic for the original thread. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Mar 30 19:04:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6E46411F6359 for ; Thu, 30 Mar 2006 19:04: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 25290-10 for ; Thu, 30 Mar 2006 19:04:05 -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 BC66211F61EE for ; Thu, 30 Mar 2006 19:04:03 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id AEFB030F1A; Fri, 31 Mar 2006 01:04:03 +0200 (MET DST) From: Chris Browne X-Newsgroups: pgsql.performance Subject: Re: Decide between Postgresql and Mysql (help of Date: Thu, 30 Mar 2006 17:53:08 -0500 Organization: cbbrowne Computing Inc Lines: 48 Message-ID: <60mzf7pmsr.fsf@dba2.int.libertyrms.com> References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> <60acb7rgnr.fsf@dba2.int.libertyrms.com> <1143746489.26940.34.camel@state.g2switchworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:UHIBW6cMUoZkUtkWFBQ7jlVZVUA= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.305 required=5 tests=[AWL=0.305] X-Spam-Score: 0.305 X-Spam-Level: X-Archive-Number: 200603/633 X-Sequence-Number: 18070 smarlowe@g2switchworks.com (Scott Marlowe) writes: > And that, nowadays, is generally the state of web development. It's > not the language you're using to write it in, it's how efficiently > you're using your database. Which properly puts my comments in their place :-). More importantly, that seems like a valid statement which has a *wide* scope of effects and side-effects. Including some that ought to put PostgreSQL in a very good place, in that it provides some very good ways of achieving high efficiency. Neat performance thing du jour: Hibernate seems to be the "neat new Java persistence thing." I have been very unimpressed with some of the web frameworks I have seen thus far in their interaction with databases. We use RT (Request Tracker) for tracking tickets, and in its attempt to be "database agnostic," it actually only achieves being MySQL(tm)-specific, because they have an automated query generator that is only good at one style of queries at a time. Coworkers have suggested improved queries that are (on occasion) hundreds or thousands of times faster than what it generates; those improvements fall on deaf ears because they wouldn't work with all the databases. (Well, more precisely, they wouldn't work with MySQL(tm).) There's a home grown flavor of Java persistence mapping; it doesn't seem as heinous as RT's, but it still doesn't make it overly convenient to replace poor queries with more efficient ones. Hibernate has a nifty thing in the form of "Named Queries." It'll often use its own "HQL" to auto-generate SQL, but any time the DBAs come up with something that's nicely tuned, it seems to be highly recommended to generate a "Named Query" for that which allows a Nice Query to be made part of the application without too much weeping and gnashing of teeth on either DBA or developers' sides. A framework that allows you to thereby "soup up" how efficiently you use your database... Hmm... I wonder if that fits into anyone's notable quote? :-). -- (format nil "~S@~S" "cbbrowne" "acm.org") http://www3.sympatico.ca/cbbrowne/lisp.html "When I was a boy of fourteen, my father was so ignorant I could hardly stand to have the old man around. But when I got to be twenty-one, I was astonished at how much the old man had learned in seven years." -- Mark Twain From pgsql-performance-owner@postgresql.org Thu Mar 30 22:08:10 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6190211F6208 for ; Thu, 30 Mar 2006 22:08: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 74994-03 for ; Thu, 30 Mar 2006 22:08:09 -0400 (AST) X-Greylist: whitelisted by SQLgrey- Received: from smtp2-g19.free.fr (smtp2-g19.free.fr [212.27.42.28]) by postgresql.org (Postfix) with ESMTP id 08C4A11F621B for ; Thu, 30 Mar 2006 22:08:07 -0400 (AST) Received: from [127.0.0.1] (rue92-4-82-236-4-82.fbx.proxad.net [82.236.4.82]) by smtp2-g19.free.fr (Postfix) with ESMTP id 3AB2D71130 for ; Fri, 31 Mar 2006 04:08:07 +0200 (CEST) Message-ID: <442C8F05.3060907@free.fr> Date: Fri, 31 Mar 2006 04:08:05 +0200 From: Philippe Marzin User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Decide between Postgresql and Mysql (help of References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> <60acb7rgnr.fsf@dba2.int.libertyrms.com> <1143746489.26940.34.camel@state.g2switchworks.com> <20060330223638.GA16558@uio.no> In-Reply-To: <20060330223638.GA16558@uio.no> Content-Type: multipart/alternative; boundary="------------040703030305060805090005" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.215 required=5 tests=[AWL=0.214, HTML_MESSAGE=0.001] X-Spam-Score: 0.215 X-Spam-Level: X-Archive-Number: 200603/634 X-Sequence-Number: 18071 This is a multi-part message in MIME format. --------------040703030305060805090005 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable jython is a full rewrite of python in java and interface naturally with=20 java classes, therefore hibernate ... and is just as easy as python. Steinar H. Gunderson a =C3=A9crit : > On Thu, Mar 30, 2006 at 11:31:25PM +0200, PFC wrote: > =20 >> So, one wonders why some use 70's languages like Java instead of=20 >> Lisp or Python, which are slower, but a lot more powerful and faster= to=20 >> develop in... >> (and don't have hibernate, which is a big bonus) >> (why do you think I don't like Java ?) >> =20 > > Python may not have Hibernate, but it has even worse stuff trying to do= about > the same thing. :-) > > Anyhow, this is rapidly becoming offtopic for the original thread. > > /* Steinar */ > =20 --------------040703030305060805090005 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable jython is a full rewrite of python in java and interface naturally with java classes, therefore hibernate ... and is just as easy as python.

Steinar H. Gunderson a =C3=A9crit=C2=A0:
On Thu, Mar 30, 2006 at 11:31:25PM +0200, PFC wrote:
  
	So, one wonders why some use 70's languages like Java=
 instead of=20
	Lisp or  Python, which are slower, but a lot more powerful and faster to=
=20
develop  in...
	(and don't have hibernate, which is a big bonus)
	(why do you think I don't like Java ?)
    

Python may not have Hibernate, but it has even worse stuff trying to do a=
bout
the same thing. :-)

Anyhow, this is rapidly becoming offtopic for the original thread.

/* Steinar */
  
--------------040703030305060805090005-- From pgsql-performance-owner@postgresql.org Fri Mar 31 02:56:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5833811F65CA for ; Fri, 31 Mar 2006 02:56: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 24676-01 for ; Fri, 31 Mar 2006 02:56:16 -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 26D6D11F65E5 for ; Fri, 31 Mar 2006 02:56:14 -0400 (AST) Received: from [192.168.2.121] (62.153.135.40) by mail.pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.7) for ; Fri, 31 Mar 2006 08:56:09 +0200 Mime-Version: 1.0 (Apple Message framework v746.3) In-Reply-To: References: <1143559902.1241.16.camel@servidor> <1143575445.3625.87.camel@state.g2switchworks.com> <200603291901.59320.listsubscriptions@oghma.on.ca> <442B4138.8030207@modgraph-usa.com> <60acb7rgnr.fsf@dba2.int.libertyrms.com> <1143746489.26940.34.camel@state.g2switchworks.com> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-2-124727608; protocol="application/pkcs7-signature" Message-Id: From: Guido Neitzer Subject: Re: Decide between Postgresql and Mysql (help of Date: Fri, 31 Mar 2006 08:56:07 +0200 To: Postgresql Performance X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.091 required=5 tests=[AWL=0.091] X-Spam-Score: 0.091 X-Spam-Level: X-Archive-Number: 200603/635 X-Sequence-Number: 18072 --Apple-Mail-2-124727608 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 30.03.2006, at 23:31 Uhr, PFC wrote: > (why do you think I don't like Java ?) Because you haven't used a good framework/toolkit yet? Come on, the language doesn't really matter these days, it's all about frameworks, toolkits, libraries, interfaces and so on. But, nevertheless, this has nothing to do with a decision between PostgreSQL or MySQL. They can both be accessed by a myriad of programming languages, so the decision may (and should) be based on other things. cug -- PharmaLine, Essen, GERMANY Software and Database Development --Apple-Mail-2-124727608 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGNzCCAvAw ggJZoAMCAQICEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MDIxMTE3NDM1NFoXDTA3MDIxMTE3NDM1 NFowTTEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEqMCgGCSqGSIb3DQEJARYbZ3Vp ZG8ubmVpdHplckBwaGFybWFsaW5lLmRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA yLhNUnNv30/r+pFUHocoIWGm8AAwFbwAWqFRhEwZzxLPCMSZme3G7W/5hyK+SxeQoOK8PPCsNyvy sLBqUVHB3nm5w/NzZKk1gfc2QlzjPtv2C7bUnigDJs+X0YlgdxTxs68RdHBn/rbjjaxl+SkiEcsz kZhKsAnS6zhlWSX7zDCIRR5VD08M0/fYSTwEcX1j8lWb/3McY7bCcHbLd+762QQAn03A4cPco4OK 3KAMld0n6qFFMG23IKx7qDTonYtCzsDVspQ1Fk14yJYVdf62RLWGBJPF+RMXB9juFhgdUrHZY3mo wamFF3qZ8HD9wb+G7lhL8F+d5khDuLBYFXCqdQIDAQABozgwNjAmBgNVHREEHzAdgRtndWlkby5u ZWl0emVyQHBoYXJtYWxpbmUuZGUwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQFAAOBgQCFnjZk bGIY3sGlsEIn98cV+tX9xNTThIwN6jhu7mGuxzvX+hN86kdlhEgaPmaatH8KfXXyfnhpTK3KOk8O zDsxJqQDVe1HEW8M/4MkORMlydbcxSRPL967pgMRNjAMafL/IlssFJ3kF7q/2AjRd4VhnyoA3Yl/ sXF3WLOTJB5OzjCCAz8wggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpB MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhh d3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24x JDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVy c29uYWwtZnJlZW1haWxAdGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTla MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSww KgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0B AQEFAAOBjQAwgYkCgYEAxKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B 1OVQCjDXAmNaLIkVcI7dyfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk 16emu59l0cUqVIUPSAR/p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/ AgEAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25h bEZyZWVtYWlsQ0EuY3JsMAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJp dmF0ZUxhYmVsMi0xMzgwDQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOW lJ1/TCG4+DYfqi2fNi/A9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amc OY6MIE9lX5Xa9/eH1sYITq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8xggMQMIIDDAIB ATB2MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQu MSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQHu2nEIcbtVh7 Lds/867h7zAJBgUrDgMCGgUAoIIBbzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3 DQEJBTEPFw0wNjAzMzEwNjU2MDhaMCMGCSqGSIb3DQEJBDEWBBTaPXHoTLoQQkxMY081oTkCWqc1 5zCBhQYJKwYBBAGCNxAEMXgwdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1 bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3Vp bmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEB7tpxCHG7VYey3bP/Ou4e8wDQYJKoZIhvcN AQEBBQAEggEAC4/GJmPmWLZ5wS9KfeokIqV64BoqhitgWC48ECf5zwzOF/kYN7W1iYkSyNtmHOCY aWHq8rBjyvrXwt/M42tfx60AWZpwqKdD8xRrrNiB/ueDvy3YOZC9odbyfBst9wFQ6xURjB6pdidf YhkiEvhS/pqWHnNRnT2XyFOJvKybej6tr92AkxCrQgrYt23wiqU1msYlqw1b2LiuFyeRXVjRHQ2Z wOIXkQkaFRmTxUWjNcpG3NdQpFCTqYklExWvKz94qOa0DMjwgS+x4nmw04cQf6eOBi6z7v9Y1wUh 82bJsn+SrUHf2jBS8l4WklVmMt3mF3Liu9VtFSrfHw/6ew9AGgAAAAAAAA== --Apple-Mail-2-124727608-- From pgsql-performance-owner@postgresql.org Fri Mar 31 05:16:52 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5B15B11F6205 for ; Fri, 31 Mar 2006 05:16: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 47945-07 for ; Fri, 31 Mar 2006 05:16:50 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id E015911F61CF for ; Fri, 31 Mar 2006 05:16:48 -0400 (AST) Received: from h6608.serverkompetenz.net (gpg-keyserver.de [81.169.179.29]) by svr4.postgresql.org (Postfix) with ESMTP id 231245AF1AC for ; Fri, 31 Mar 2006 09:16:49 +0000 (GMT) Received: from dslc-082-082-101-080.pools.arcor-ip.net ([82.82.101.80] helo=[192.168.0.60]) by h6608.serverkompetenz.net with esmtpa (Exim 4.60) (envelope-from ) id 1FPFkH-0007Eq-Tk for pgsql-performance@postgresql.org; Fri, 31 Mar 2006 11:16:43 +0200 Message-ID: <442CF375.2080903@web.de> Date: Fri, 31 Mar 2006 11:16:37 +0200 From: Jan Kesten User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: index not used again X-Enigmail-Version: 0.94.0.0 OpenPGP: id=82201FC4; url=http://gpg-keyserver.de Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD34F435BA9B3A6C9DBE8E7AB" 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: 200603/636 X-Sequence-Number: 18073 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD34F435BA9B3A6C9DBE8E7AB Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Hi folks! I have just a issue again with unused indexes. I have a database with a couple of tables and I have to do an sync job with them. For marking which row has to be transfered I added a new column token (integer, I will need some more tokens in near future) to every table. Before determining wich rows to mark I first had a simple update set token=3D0; Okay, this uses seq scan of course. For speeding things up, I created an partial index on every table like this: create index
_idx_token on
using (token) where token=3D1; After that I run vacuum analyse to update statistics and changed my to: update
set token=3D0 where token=3D1; I think this should be able to use my index, and indeed on one table this works quite fine: transfer=3D> explain analyse update ku set token=3D0 where token=3D1; QUERY PLAN ------------------------------------------------------------------------ Index Scan using ku_idx_token on ku (cost=3D0.00..1.01 rows=3D1 width=3D1871) (actual time=3D0.169..0.169 rows=3D0 loops=3D1) Index Cond: (token =3D 1) Total runtime: 3.816 ms (3 rows) But on most of the other tables a seq scan is still used: transfer=3D> explain analyse update fak6 set token=3D0 where token=3D1; QUERY PLAN ------------------------------------------------------------------------ Seq Scan on fak6 (cost=3D0.00..301618.71 rows=3D24217 width=3D1895) (ac= tual time=3D96987.417..127020.919 rows=3D24251 loops=3D1) Filter: (token =3D 1) Total runtime: 181828.281 ms (3 rows) So I tried to force using an index with setting enable_seqscan to off, here are the results: transfer=3D> set enable_seqscan to off; SET transfer=3D> explain analyse update fak6 set token=3D0 where token=3D1; QUERY PLAN ------------------------------------------------------------------------ Index Scan using fak6_idx_token on fak6 (cost=3D0.00..301697.93 rows=3D24217 width=3D1895) (actual time=3D1271.273..1271.273 rows=3D0 loo= ps=3D1) Index Cond: (token =3D 1) Total runtime: 1272.572 ms (3 rows) transfer=3D> set enable_seqscan to on; SET transfer=3D> explain analyse update fak6 set token=3D0 where token=3D1; QUERY PLAN ------------------------------------------------------------------------ Seq Scan on fak6 (cost=3D0.00..301618.71 rows=3D24217 width=3D1895) (ac= tual time=3D93903.379..93903.379 rows=3D0 loops=3D1) Filter: (token =3D 1) Total runtime: 93904.679 ms (3 rows) transfer=3D> set enable_seqscan to off; SET transfer=3D> explain analyse update fak6 set token=3D0 where token=3D1; QUERY PLAN ------------------------------------------------------------------------ Index Scan using fak6_idx_token on fak6 (cost=3D0.00..301697.93 rows=3D24217 width=3D1895) (actual time=3D223.721..223.721 rows=3D0 loops= =3D1) Index Cond: (token =3D 1) Total runtime: 226.851 ms (3 rows) Now I'm a bit confused. The costs are nearly the same if using index or not - but runtime is about 70 times faster? Any idea how I can fix this issue - I thought a partial index would be the right way? Cheers, Jan --------------enigD34F435BA9B3A6C9DBE8E7AB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3-cvs (MingW32) Comment: GnuPT 2.7.6 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFELPN1vvmCkIIgH8QRAi5iAJ4iLT7eor5ontIVcISpFAqBQuXKBQCeJ5uf uK+kCjyTvd/SzgqjKDiOUBE= =vZt/ -----END PGP SIGNATURE----- --------------enigD34F435BA9B3A6C9DBE8E7AB-- From pgsql-performance-owner@postgresql.org Fri Mar 31 10:44:47 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D395A11F6782 for ; Fri, 31 Mar 2006 10:44: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 33195-07 for ; Fri, 31 Mar 2006 10:44:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id 9F16711F6773 for ; Fri, 31 Mar 2006 10:44:44 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id CA98034DEF; Fri, 31 Mar 2006 06:44:44 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id C894634DBC; Fri, 31 Mar 2006 06:44:44 -0800 (PST) Date: Fri, 31 Mar 2006 06:44:44 -0800 (PST) From: Stephan Szabo To: Jan Kesten Cc: pgsql-performance@postgresql.org Subject: Re: index not used again In-Reply-To: <442CF375.2080903@web.de> Message-ID: <20060331064252.J61282@megazone.bigpanda.com> References: <442CF375.2080903@web.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.138 required=5 tests=[AWL=0.138] X-Spam-Score: 0.138 X-Spam-Level: X-Archive-Number: 200603/637 X-Sequence-Number: 18074 On Fri, 31 Mar 2006, Jan Kesten wrote: > > Hi folks! > > I have just a issue again with unused indexes. I have a database with a > couple of tables and I have to do an sync job with them. For marking > which row has to be transfered I added a new column token (integer, I > will need some more tokens in near future) to every table. > > Before determining wich rows to mark I first had a simple > > update
set token=0; > > Okay, this uses seq scan of course. For speeding things up, I created an > partial index on every table like this: > > create index
_idx_token on
using (token) where token=1; > > After that I run vacuum analyse to update statistics and changed my to: > > update
set token=0 where token=1; > > I think this should be able to use my index, and indeed on one table > this works quite fine: > > transfer=> explain analyse update ku set token=0 where token=1; > > QUERY PLAN > ------------------------------------------------------------------------ > Index Scan using ku_idx_token on ku (cost=0.00..1.01 rows=1 > width=1871) (actual time=0.169..0.169 rows=0 loops=1) > Index Cond: (token = 1) > Total runtime: 3.816 ms > (3 rows) > > But on most of the other tables a seq scan is still used: > > transfer=> explain analyse update fak6 set token=0 where token=1; > > QUERY PLAN > ------------------------------------------------------------------------ > Seq Scan on fak6 (cost=0.00..301618.71 rows=24217 width=1895) (actual > time=96987.417..127020.919 rows=24251 loops=1) > Filter: (token = 1) > Total runtime: 181828.281 ms > (3 rows) > > So I tried to force using an index with setting enable_seqscan to off, > here are the results: > > transfer=> set enable_seqscan to off; > SET > transfer=> explain analyse update fak6 set token=0 where token=1; > > QUERY PLAN > ------------------------------------------------------------------------ > Index Scan using fak6_idx_token on fak6 (cost=0.00..301697.93 > rows=24217 width=1895) (actual time=1271.273..1271.273 rows=0 loops=1) > Index Cond: (token = 1) > Total runtime: 1272.572 ms > (3 rows) Did you reset the table contents between these two (remember that explain analyze actually runs the query)? The second appears to be changing no rows from the output. From pgsql-performance-owner@postgresql.org Fri Mar 31 11:48:07 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CE85D11F65EB for ; Fri, 31 Mar 2006 11:48: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 41989-08 for ; Fri, 31 Mar 2006 11:47:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C0FBE11F66BE for ; Fri, 31 Mar 2006 11:47:52 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id CC69556427; Fri, 31 Mar 2006 09:47:53 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 31 Mar 2006 09:47:53 -0600 Date: Fri, 31 Mar 2006 09:47:53 -0600 From: "Jim C. Nasby" To: stef Cc: Chris , pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-ID: <20060331154752.GN49405@pervasive.com> References: <20060327134733.72422d23.gry@ll.mit.edu> <442A1808.6090705@gmail.com> <442A244F.4030203@ummon.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <442A244F.4030203@ummon.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060331:stef@ummon.com::Q6ANBOzzu/n/dQAG:0000Zer X-Hashcash: 1:20:060331:dmagick@gmail.com::NyWcjnX4cq3RNd1J:00000000000000000000 00000000000000000000000037kp X-Hashcash: 1:20:060331:pgsql-performance@postgresql.org::Bl3YLu1E02iglKhl:00000 0000000000000000000000004nea X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/638 X-Sequence-Number: 18075 On Wed, Mar 29, 2006 at 01:08:15AM -0500, stef wrote: > > If your looking for suggestions, I would suggest updating the 8.1.x you > have installed to the latest version, as of typing this is 8.1.3 ;) Most > notable is some of the -bug- fixes that are in since 8.1.0, for example; > > * Fix incorrect optimizations of outer-join conditions (Tom) > > You know, minor point releases aren't adding new features or changing > basic functionality, they are pure and simple bugfixes. If I was in > -your- position, I would run (don't walk ;) and install upto 8.1.3 More important, there are data loss bugfixes between 8.1.0 and 8.1.3. -- 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 Mar 31 11:55:57 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1498811F681A for ; Fri, 31 Mar 2006 11:55: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 44620-01 for ; Fri, 31 Mar 2006 11:55:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 977FC11F6825 for ; Fri, 31 Mar 2006 11:55:54 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 438F356423; Fri, 31 Mar 2006 09:55:55 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 31 Mar 2006 09:55:54 -0600 Date: Fri, 31 Mar 2006 09:55:54 -0600 From: "Jim C. Nasby" To: Theo Kramer Cc: pgsql-performance@postgresql.org Subject: Re: Indexes with descending date columns Message-ID: <20060331155554.GO49405@pervasive.com> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> <20060324102138.GR90527@pervasive.com> <1143629550.2985.29.camel@theo-laptop.int.coza.net.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1143629550.2985.29.camel@theo-laptop.int.coza.net.za> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060331:theo@flame.co.za::Vt5jOoM2ekbygTBr:01VOW X-Hashcash: 1:20:060331:pgsql-performance@postgresql.org::0DkLEtWTFYDysDfR:00000 0000000000000000000000005VG0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/639 X-Sequence-Number: 18076 On Wed, Mar 29, 2006 at 12:52:31PM +0200, Theo Kramer wrote: > On Fri, 2006-03-24 at 12:21, Jim C. Nasby wrote: > > On Thu, Mar 23, 2006 at 01:09:49PM +0200, Theo Kramer wrote: > > > ii If no to i, is it feasible to extend PostgreSQL to allow traversing > > > an index in column descending and column ascending order - assuming > > > an order by on more than one column with column order not > > > in the same direction and indexes existing? ... if that makes sense. > > > > Yes. > > > > stats=# explain select * from email_contrib order by project_id desc, id desc, date desc limit 10; > > QUERY PLAN > > ------------------------------------------------------------------------------------------------------------------------ > > Limit (cost=0.00..31.76 rows=10 width=24) > > -> Index Scan Backward using email_contrib_pkey on email_contrib (cost=0.00..427716532.18 rows=134656656 width=24) > > (2 rows) > > Not quite what I mean - redo the above as follows and then see what > explain returns > > explain select * from email_contrib order by project_id, id, date desc > limit 10; Ahh. There's a hack to do that by defining a new opclass that reverses < and >, and then doing ORDER BY project_id, id, date USING new_opclass. I think there's a TODO about this, but I'm not sure... -- 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 Mar 31 11:59:20 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6879511F65EB for ; Fri, 31 Mar 2006 11:59: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 42413-08 for ; Fri, 31 Mar 2006 11:59:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 4D36D11F6ACB for ; Fri, 31 Mar 2006 11:59:13 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 309D956423; Fri, 31 Mar 2006 09:59:12 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 31 Mar 2006 09:59:12 -0600 Date: Fri, 31 Mar 2006 09:59:12 -0600 From: "Jim C. Nasby" To: Brendan Duddridge Cc: PostgreSQL Performance Subject: Re: Query using SeqScan instead of IndexScan Message-ID: <20060331155911.GP49405@pervasive.com> References: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060331:brendan@clickspace.com::B1vBl43+Nsfxx/pn:000000000000000 0000000000000000000000000iU/ X-Hashcash: 1:20:060331:pgsql-performance@postgresql.org::ueEP1ZxAImm7ZGkn:00000 0000000000000000000000000WNU X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/640 X-Sequence-Number: 18077 What's the correlation of category_id? The current index scan cost estimator places a heavy penalty on anything with a correlation much below about 90%. On Wed, Mar 29, 2006 at 08:12:28PM -0700, Brendan Duddridge wrote: > Hi, > > I have a query that is using a sequential scan instead of an index > scan. I've turned off sequential scans and it is in fact faster with > the index scan. > > Here's my before and after. > > Before: > > ssdev=# SET enable_seqscan TO DEFAULT; > ssdev=# explain analyze select cp.product_id > from category_product cp, product_attribute_value pav > where cp.category_id = 1001082 and cp.product_id = > pav.product_id; > > > QUERY PLAN > ------------------------------------------------------------------------ > ------------------------------------------------------------------------ > ------------------------------ > Hash Join (cost=25.52..52140.59 rows=5139 width=4) (actual > time=4.521..2580.520 rows=19695 loops=1) > Hash Cond: ("outer".product_id = "inner".product_id) > -> Seq Scan on product_attribute_value pav (cost=0.00..40127.12 > rows=2387312 width=4) (actual time=0.039..1469.295 rows=2385846 loops=1) > -> Hash (cost=23.10..23.10 rows=970 width=4) (actual > time=2.267..2.267 rows=1140 loops=1) > -> Index Scan using x_category_product__category_id_fk_idx > on category_product cp (cost=0.00..23.10 rows=970 width=4) (actual > time=0.122..1.395 rows=1140 loops=1) > Index Cond: (category_id = 1001082) > Total runtime: 2584.221 ms > (7 rows) > > > After: > > ssdev=# SET enable_seqscan TO false; > ssdev=# explain analyze select cp.product_id > from category_product cp, product_attribute_value pav > where cp.category_id = 1001082 and cp.product_id = > pav.product_id; > > > QUERY PLAN > ------------------------------------------------------------------------ > ------------------------------------------------------------------------ > ------------------------------------- > Nested Loop (cost=0.00..157425.22 rows=5139 width=4) (actual > time=0.373..71.177 rows=19695 loops=1) > -> Index Scan using x_category_product__category_id_fk_idx on > category_product cp (cost=0.00..23.10 rows=970 width=4) (actual > time=0.129..1.438 rows=1140 loops=1) > Index Cond: (category_id = 1001082) > -> Index Scan using product_attribute_value__product_id_fk_idx > on product_attribute_value pav (cost=0.00..161.51 rows=61 width=4) > (actual time=0.016..0.053 rows=17 loops=1140) > Index Cond: ("outer".product_id = pav.product_id) > Total runtime: 74.747 ms > (6 rows) > > There's quite a big difference in speed there. 2584.221 ms vs. 74.747 > ms. > > Any ideas what I can do to improve this without turning sequential > scanning off? > > Thanks, > > ____________________________________________________________________ > Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com > > ClickSpace Interactive Inc. > Suite L100, 239 - 10th Ave. SE > Calgary, AB T2G 0V9 > > http://www.clickspace.com > -- 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 Mar 31 12:02:24 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6695311F68CA for ; Fri, 31 Mar 2006 12: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 44679-06 for ; Fri, 31 Mar 2006 12:02:21 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.186]) by postgresql.org (Postfix) with ESMTP id 8541111F68CF for ; Fri, 31 Mar 2006 12:02:20 -0400 (AST) Received: by nproxy.gmail.com with SMTP id l24so577717nfc for ; Fri, 31 Mar 2006 08:02:18 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:subject:message-id:x-mailer:mime-version:content-type:content-transfer-encoding; b=ZG3wHxFDqVQu7d75DS17O4x3fesguxRBU3XrlfpUiR6vslsqvUzTjva8MAFZcxeO0O9duw8WHEblSsqgUPMs/3uTIRt1uO0gdBNsX/fVnco3bcGWt5h2skYBCmdbwtyIcUm8NYd0v4/rRPnUcEJ6hIzcsE1fs9TuqJbv7L1Vpzk= Received: by 10.48.254.11 with SMTP id b11mr404747nfi; Fri, 31 Mar 2006 08:02:18 -0800 (PST) Received: from localhost.localdomain ( [129.217.191.31]) by mx.gmail.com with ESMTP id c10sm78433nfb.2006.03.31.08.02.18; Fri, 31 Mar 2006 08:02:18 -0800 (PST) Date: Fri, 31 Mar 2006 18:02:16 +0200 From: Frederic Back To: pgsql-performance@postgresql.org Subject: un-'vacuum analyse' Message-Id: <20060331180216.f25c3e91.fredericback@gmail.com> X-Mailer: Sylpheed version 2.1.1 (GTK+ 2.8.16; i486-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=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200603/641 X-Sequence-Number: 18078 Hello, I would like to know how my application works before and after data from VACUUM ANALYSE is available. Is there a way to de-'vacuum analyse' a database for testing purposes? Thank you, Fred From pgsql-performance-owner@postgresql.org Fri Mar 31 12:27:15 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 32B8511F68CA for ; Fri, 31 Mar 2006 12:27: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 50316-05 for ; Fri, 31 Mar 2006 12:27: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 2D63211F68B1 for ; Fri, 31 Mar 2006 12:27:11 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2VGRASt008961; Fri, 31 Mar 2006 11:27:10 -0500 (EST) To: Frederic Back cc: pgsql-performance@postgresql.org Subject: Re: un-'vacuum analyse' In-reply-to: <20060331180216.f25c3e91.fredericback@gmail.com> References: <20060331180216.f25c3e91.fredericback@gmail.com> Comments: In-reply-to Frederic Back message dated "Fri, 31 Mar 2006 18:02:16 +0200" Date: Fri, 31 Mar 2006 11:27:10 -0500 Message-ID: <8960.1143822430@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/642 X-Sequence-Number: 18079 Frederic Back writes: > Is there a way to de-'vacuum analyse' a database for > testing purposes? "DELETE FROM pg_statistic" will get you most of the way there. It doesn't get rid of the accurate relpages/reltuples entries in pg_class, but since CREATE INDEX also updates those counts, I think it's reasonable to consider that a freshly loaded database would normally have correct counts. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Mar 31 16:49:17 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 56B8711F67DE for ; Fri, 31 Mar 2006 16:49: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 38568-03 for ; Fri, 31 Mar 2006 16:49:15 -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 9B84311F677D for ; Fri, 31 Mar 2006 16:49:12 -0400 (AST) Received: by zproxy.gmail.com with SMTP id m7so16861nzf for ; Fri, 31 Mar 2006 12:49:12 -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=tX6cyisXl2mJ01iuFL9+od1AQvKJThcLoIjLcODjlRAXzlzbHoRV1eYFXyMPq07p/G+a4JOKqSpppb0S5mRhtxh2Tkuy+DrFW8PoB0Gl/vJ4Ko+MgUJxf9mZJo1Bv4ISIMYvnM43ZAiluu9IjL+DDJQ2Ev+pqGIQLL2k4OvQma8= Received: by 10.35.121.2 with SMTP id y2mr796650pym; Fri, 31 Mar 2006 12:49:10 -0800 (PST) Received: by 10.35.37.10 with HTTP; Fri, 31 Mar 2006 12:49:10 -0800 (PST) Message-ID: <92d3a4950603311249n5eb1e26maa9d0777d6ec70cf@mail.gmail.com> Date: Fri, 31 Mar 2006 22:49:10 +0200 From: Antoine To: "Dave Dutcher" Subject: Re: [Solved] Slow performance on Windows .NET and OleDb Cc: "Greg Quinn" , pgsql-performance@postgresql.org In-Reply-To: <002a01c65407$0a302730$8300a8c0@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <000a01c653be$d312e3c0$0200a8c0@pta.homex.co.za> <002a01c65407$0a302730$8300a8c0@tridecap.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.285 required=5 tests=[AWL=0.285] X-Spam-Score: 0.285 X-Spam-Level: X-Archive-Number: 200603/643 X-Sequence-Number: 18080 This is a blatant thread steal... but here we go... Do people have any opinions on the pgsql driver? How does it compare with the odbc in terms of performance? Is it fully production ready? The boss wants to go .net (instead of Java, which is my preference...) - will I have to spend my time defending postgres against mysql/postgres/sqlserver? Cheers Antoine ps. I try my best not to steal threads but sometimes... :-) On 30/03/06, Dave Dutcher wrote: > I use Npgsql, and the connection string I use is real simple: > > Server=3D192.168.0.36;Database=3Dmydb;User Id=3Dmyuserid;Password=3D12345= 6 > > Hope that helps, > > Dave > > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance- > > owner@postgresql.org] On Behalf Of Greg Quinn > > Sent: Wednesday, March 29, 2006 11:57 PM > > To: pgsql-performance@postgresql.org > > Subject: [PERFORM] [Solved] Slow performance on Windows .NET and OleDb > > > > This problem was caused by the OleDb driver. I used a 3rd party .NET > > provider and it worked, 8000 rows in just over 100ms! > > > > Can somebody send me a sample connection string for the PostGreSql > native > > .net driver please? I'm battling to find a valid connection string. > > > > Thanks > > > > > > > > ---------------------------(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 5: don't forget to increase your free space map settings > -- This is where I should put some witty comment. From pgsql-performance-owner@postgresql.org Fri Mar 31 19:27:18 2006 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A912511F61BF for ; Fri, 31 Mar 2006 19:27: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 58668-02 for ; Fri, 31 Mar 2006 19:27:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by postgresql.org (Postfix) with ESMTP id 9EAF611F610B for ; Fri, 31 Mar 2006 19:27:15 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 56E388F28D; Sat, 1 Apr 2006 01:27:15 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: [Solved] Slow performance on Windows .NET and OleDb Date: Sat, 1 Apr 2006 01:27:15 +0200 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA0F8C7@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [Solved] Slow performance on Windows .NET and OleDb Thread-Index: AcZVBKskVR6lJSGMTM2Qseqn6+nbNAAFTjUg From: "Magnus Hagander" To: "Antoine" , "Dave Dutcher" Cc: "Greg Quinn" , 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: 200603/644 X-Sequence-Number: 18081 > This is a blatant thread steal... but here we go... > Do people have any opinions on the pgsql driver? It's very nice. > How does it compare with the odbc in terms of performance? I haven't measured specifically, but if you're tlaking .net it should be better. It's all in managed code, so you won't pay the repeated penalty of switching down to unmanaged and back all the time (the .net-ODBC-bridge is known not to be very fast). As a bonus your program will run in an environment where the CAS policy prevents native code.=20 And I've never had any performance problems with it myself. > Is it fully production ready? I beleive so. I've been using it for a long time with zero problems. While I don't use many of the exotic features in it, I doubt most people do ;-) Don't get scared by the claim it's in beta - IIRC there's an RC out any day now, and it's been stable long before 1.0. But it's always a good idea to browse through the list of known bugs and see if one will likely hit you... //Magnus